diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..ecb53b32 --- /dev/null +++ b/.babelrc @@ -0,0 +1,46 @@ +{ + "plugins": [ + ["transform-es2015-template-literals", { + "loose": true + }], + "transform-es2015-literals", + "transform-es2015-function-name", + "transform-es2015-arrow-functions", + "transform-es2015-block-scoped-functions", ["transform-es2015-classes", { + "loose": true + }], + "transform-es2015-object-super", + "transform-es2015-shorthand-properties", ["transform-es2015-computed-properties", { + "loose": true + }], + ["transform-es2015-for-of", { + "loose": true + }], + "transform-es2015-sticky-regex", + "transform-es2015-unicode-regex", + "check-es2015-constants", ["transform-es2015-spread", { + "loose": true + }], + "transform-es2015-parameters", ["transform-es2015-destructuring", { + "loose": true + }], + "transform-es2015-block-scoping", + "transform-object-rest-spread", + "transform-es3-member-expression-literals", + "transform-es3-property-literals", + "transform-async-to-generator", + "transform-regenerator", + ["transform-runtime", { + "polyfill": false, + "regenerator": true + }] + ], + "env": { + "es5": { + "presets": ["es2015"] + }, + "es6": { + "presets": ["es2017"] + } + } +} diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..c512d62d --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,36 @@ +{ + "parser": "babel-eslint", + "env": { + "browser": true, + "es6": true, + "node": true + }, + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + 4, { + "MemberExpression": "off", + "SwitchCase": 1 + } + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ], + "no-console": "off", + "no-unused-vars": "error", + "no-var": "error", + "no-throw-literal": "error" + } +} diff --git a/.gitignore b/.gitignore new file mode 100755 index 00000000..b00e0a09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +node_modules/ +package-lock.json +.idea/ +.vscode/ +.transpile_state.json +.com.google.* +shelljs_* +test_tmp/ +tmp/ \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..f5b3c3db --- /dev/null +++ b/.npmignore @@ -0,0 +1,15 @@ +.git/ +config/ +docs/ +test/ +test_tmp/ +tmp/ +.babelrc +.editorconfig +.eslintrc.json +.gitignore +.travis.yml +ISSUE_TEMPLATE.md +PULL_REQUEST_TEMPLATE.md + +log.txt diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..41a34295 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +unsafe-perm = true +package-lock=false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..b713882e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: node_js +sudo: required +os: + - linux +node_js: + - "9.4.0" +before_install: + - export CHROME_BIN=chromium-browser + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start +script: +- travis_retry npm install --depth 0 --silent +- npm run lint +- npm run build +- travis_retry npm run test:node +- travis_retry npm run test:browser +- travis_retry npm run test:e2e +- npm run test:typings +- npm run test:size \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..42ff19a0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Daniel Meyer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..bd13d397 --- /dev/null +++ b/README.md @@ -0,0 +1,131 @@ + +

+ + + +

+ +

BroadcastChannel

+

+ A BroadcastChannel that works in old browsers, new browsers, WebWorkers and NodeJs +

+ +

+ + + + follow on Twitter +

+ +
+ +* * * + +A BroadcastChannel allows simple communication between browsing contexts with the same origin or different NodeJs processes. + +This implementation works with old browsers, new browsers, WebWorkers and NodeJs. You can use it to send messages between multiple browser-tabs, iframes, WebWorkers and NodeJs-processes. + +This behaves similar to the [BroadcastChannel-API](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API) which is currently not featured in all browsers. + +## Usage + +This API behaves similar to the [javascript-standard](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API). + +```bash +npm install --save broadcast-channel +``` + +Create a channel in one tab/process and send a message. + +```js +const BroadcastChannel = require('broadcast-channel'); +const channel = new BroadcastChannel('foobar'); +channel.postMessage('I am not alone'); +``` + +Create a channel with the same name in another tab/process and recieve messages. + +```js +const BroadcastChannel = require('broadcast-channel'); +const channel = new BroadcastChannel('foobar'); +channel.onmessage = msg => console.dir(msg); +// > 'I am not alone' +``` + + +Add and remove multiple eventlisteners + +```js +const BroadcastChannel = require('broadcast-channel'); +const channel = new BroadcastChannel('foobar'); + +const handler = msg => console.log(msg); +channel.addEventListener('message', handler); + +// remove it +channel.removeEventListener('message', handler); +``` + +Close the channel if you do not need it anymore. + +```js +channel.close(); +``` + +Set options when creating a channel (optional): + +```js +const options = { + type: 'localstorage', // (optional) enforce a type, oneOf['native', 'idb', 'localstorage', 'node'] + webWorkerSupport: true; // (optional) set this to false if you know that your channel will never be used in a WebWorker (increases performance) +}; +const channel = new BroadcastChannel('foobar', options); +``` + +Create a typed channel in typescript: + +```typescript +import BroadcastChannel from 'broadcast-channel'; +declare type Message = { + foo: string; +}; +const channel: BroadcastChannel = new BroadcastChannel('foobar'); +channel.postMessage({ + foo: 'bar' +}); +``` + +## Methods: + +Depending in which environment this is used, a proper method is automatically selected to ensure it always works. + +| Method | Used in | Description | +| ---------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **Native** | [Modern Browsers](https://caniuse.com/broadcastchannel) | If the browser supports the BroadcastChannel-API, this method will be used because it is the fastest | +| **IndexedDB** | [Browsers with WebWorkers](https://caniuse.com/#feat=indexeddb) | If there is no native BroadcastChannel support, the IndexedDB method is used because it supports messaging between browser-tabs, iframes and WebWorkers | +| **LocalStorage** | [Older Browsers](https://caniuse.com/#feat=namevalue-storage) | In older browsers that do not support IndexedDb, a localstorage-method is used | +| **Sockets** | NodeJs | In NodeJs the communication is handled by sockets that send each other messages | + + +## What this is + +This module is optimised for: + +- **low latency**: When you postMessage on one channel, it should take as low as possible time until other channels recieve the message. +- **lossless**: When you send a message, it should be impossible that the message is lost before other channels recieved it +- **low idle workload**: During the time when no messages are send, there should be a low processor footprint. + +## What this is not + +- This is not a polyfill. Do not set this module to `window.BroadcastChannel`. This implementation behaves similiar to the [BroadcastChannel-Standard](https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API) with these limitations: + - You can only send data that can be `JSON.stringify`-ed. + - While the offical API emits [onmessage-events](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel/onmessage), this module directly emitts the data which was posted +- This is not a replacement for a message queue. If you use this in NodeJs and want send more than 50 messages per second, you should use proper [IPC-Tooling](https://en.wikipedia.org/wiki/Message_queue) + + +## Browser Support +I have tested this in all browsers that I could find. For ie8 and ie9 you must transpile the code before you can use this. If you want to know if this works with your browser, [open the demo page](https://pubkey.github.io/broadcast-channel/). + +## Thanks +Thanks to [Hemanth.HM](https://github.com/hemanth) for the module name. diff --git a/config/.eslintignore b/config/.eslintignore new file mode 100644 index 00000000..9a7ae27f --- /dev/null +++ b/config/.eslintignore @@ -0,0 +1,4 @@ +../dist/ +../node_modules/ +../tmp/ +../test/scripts/worker.js diff --git a/config/karma.conf.js b/config/karma.conf.js new file mode 100644 index 00000000..14777309 --- /dev/null +++ b/config/karma.conf.js @@ -0,0 +1,75 @@ +const configuration = { + basePath: '', + frameworks: [ + 'mocha', + 'browserify', + 'detectBrowsers' + ], + files: [ + '../test/index.test.js' + ], + // reporters: ['progress'], + port: 9876, + colors: true, + autoWatch: false, + + /** + * see + * @link https://github.com/litixsoft/karma-detect-browsers + */ + detectBrowsers: { + enabled: true, + usePhantomJS: false, + postDetection: function (availableBrowser) { + // return ['Chrome']; // comment in to test specific browser + // return ['Firefox']; // comment in to test specific browser + const browsers = availableBrowser + .filter(b => !['PhantomJS', 'FirefoxAurora', 'FirefoxNightly'].includes(b)) + .map(b => { + if (process.env.TRAVIS && b === 'Chrome') return 'Chrome_travis_ci'; + else return b; + }); + return browsers; + } + }, + + // Karma plugins loaded + plugins: [ + 'karma-mocha', + 'karma-browserify', + 'karma-chrome-launcher', + 'karma-edge-launcher', + 'karma-firefox-launcher', + 'karma-ie-launcher', + 'karma-opera-launcher', + 'karma-detect-browsers' + ], + + // Source files that you wanna generate coverage for. + // Do not include tests or libraries (these files will be instrumented by Istanbul) + preprocessors: { + '../test/*.test.js': ['browserify'] + }, + + client: { + mocha: { + bail: false, + timeout: 6000 + }, + captureConsole: true + }, + // browsers: ['ChromeNoSandbox'], + browserDisconnectTimeout: 8000, + processKillTimeout: 8000, + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + singleRun: true +}; + +module.exports = function (config) { + config.set(configuration); +}; diff --git a/dist/es/browserify.index.js b/dist/es/browserify.index.js new file mode 100644 index 00000000..785f9211 --- /dev/null +++ b/dist/es/browserify.index.js @@ -0,0 +1,3 @@ +var BroadcastChannel = require('./index.es5.js'); + +window['BroadcastChannel2'] = BroadcastChannel; \ No newline at end of file diff --git a/dist/es/index.es5.js b/dist/es/index.es5.js new file mode 100644 index 00000000..e94ea060 --- /dev/null +++ b/dist/es/index.es5.js @@ -0,0 +1,12 @@ +/** + * because babel can only export on default-attribute, + * we use this for the non-module-build + * this ensures that users do not have to use + * var BroadcastChannel = require('broadcast-channel').default; + * but + * var BroadcastChannel = require('broadcast-channel'); + */ + +import BroadcastChannel from './index.js'; + +module.exports = BroadcastChannel; \ No newline at end of file diff --git a/dist/es/index.js b/dist/es/index.js new file mode 100644 index 00000000..40aa1474 --- /dev/null +++ b/dist/es/index.js @@ -0,0 +1,164 @@ +import { isPromise } from './util.js'; + +import { chooseMethod } from './method-chooser.js'; + +import { fillOptionsWithDefaults } from './options.js'; + +var BroadcastChannel = function BroadcastChannel(name, options) { + this.name = name; + this.options = fillOptionsWithDefaults(options); + this.method = chooseMethod(this.options); + + this._isListening = false; + + /** + * setting onmessage twice, + * will overwrite the first listener + */ + this._onMessageListener = null; + + this._addEventListeners = { + message: [], + internal: [] + }; + + this._preparePromise = null; + _prepareChannel(this); +}; + +BroadcastChannel.prototype = { + postMessage: function postMessage(msg) { + var _this = this; + + var msgObj = { + time: new Date().getTime(), + type: 'message', + data: msg + }; + + if (this.closed) { + throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed'); + } + + var awaitPrepare = this._preparePromise ? this._preparePromise : Promise.resolve(); + return awaitPrepare.then(function () { + return _this.method.postMessage(_this._state, msgObj); + }); + }, + + set onmessage(fn) { + var time = new Date().getTime() - 5; + var listenObj = { + time: time, + fn: fn + }; + _removeListenerObject(this, 'message', this._onMessageListener); + if (fn && typeof fn === 'function') { + this._onMessageListener = listenObj; + _addListenerObject(this, 'message', listenObj); + } else { + this._onMessageListener = null; + } + }, + + addEventListener: function addEventListener(type, fn) { + var time = new Date().getTime() - 5; + var listenObj = { + time: time, + fn: fn + }; + _addListenerObject(this, type, listenObj); + }, + removeEventListener: function removeEventListener(type, fn) { + var obj = this._addEventListeners[type].find(function (obj) { + return obj.fn === fn; + }); + _removeListenerObject(this, type, obj); + }, + close: function close() { + var _this2 = this; + + this.closed = true; + var awaitPrepare = this._preparePromise ? this._preparePromise : Promise.resolve(); + + this._onMessageListener = null; + this._addEventListeners.message = []; + + return awaitPrepare.then(function () { + return _this2.method.close(_this2._state); + }); + }, + + get type() { + return this.method.type; + } +}; + +function _prepareChannel(channel) { + var maybePromise = channel.method.create(channel.name, channel.options); + if (isPromise(maybePromise)) { + channel._preparePromise = maybePromise; + maybePromise.then(function (s) { + // used in tests to simulate slow runtime + /*if (channel.options.prepareDelay) { + await new Promise(res => setTimeout(res, this.options.prepareDelay)); + }*/ + channel._state = s; + }); + } else { + channel._state = maybePromise; + } +} + +function _hasMessageListeners(channel) { + if (channel._addEventListeners.message.length > 0) return true; + if (channel._addEventListeners.internal.length > 0) return true; + return false; +} + +function _addListenerObject(channel, type, obj) { + channel._addEventListeners[type].push(obj); + _startListening(channel); +} +function _removeListenerObject(channel, type, obj) { + channel._addEventListeners[type] = channel._addEventListeners[type].filter(function (o) { + return o !== obj; + }); + _stopListening(channel); +} + +function _startListening(channel) { + if (!channel._isListening && _hasMessageListeners(channel)) { + // someone is listening, start subscribing + + var listenerFn = function listenerFn(msgObj) { + channel._addEventListeners[msgObj.type].forEach(function (obj) { + if (msgObj.time >= obj.time) { + obj.fn(msgObj.data); + }; + }); + }; + + var time = new Date().getTime() - 5; + if (channel._preparePromise) { + channel._preparePromise.then(function () { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + }); + } else { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + } + } +} + +function _stopListening(channel) { + if (channel._isListening && !_hasMessageListeners(channel)) { + // noone is listening, stop subscribing + channel._isListening = false; + var time = new Date().getTime() - 5; + channel.method.onMessage(channel._state, null, time); + } +} + +export default BroadcastChannel; \ No newline at end of file diff --git a/dist/es/method-chooser.js b/dist/es/method-chooser.js new file mode 100644 index 00000000..2716e0b7 --- /dev/null +++ b/dist/es/method-chooser.js @@ -0,0 +1,45 @@ +var isNode = require('detect-node'); + +var NativeMethod = require('./methods/native.js'); +var IndexeDbMethod = require('./methods/indexed-db.js'); +var LocalstorageMethod = require('./methods/localstorage.js'); + +// order is important +var METHODS = [NativeMethod, // fastest +IndexeDbMethod, LocalstorageMethod]; + +var REQUIRE_FUN = require; + +/** + * The NodeMethod is loaded lazy + * so it will not get bundled in browser-builds + */ +if (isNode) { + var NodeMethod = REQUIRE_FUN('./methods/node.js'); + METHODS.push(NodeMethod); +} + +export function chooseMethod(options) { + // directly chosen + if (options.type) { + var ret = METHODS.find(function (m) { + return m.type === options.type; + }); + if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret; + } + + var chooseMethods = METHODS; + if (!options.webWorkerSupport && !isNode) { + // prefer localstorage over idb when no webworker-support needed + chooseMethods = METHODS.filter(function (m) { + return m.type !== 'idb'; + }); + } + + var useMethod = chooseMethods.find(function (method) { + return method.canBeUsed(); + }); + if (!useMethod) throw new Error('No useable methode found:' + JSON.stringify(METHODS.map(function (m) { + return m.type; + })));else return useMethod; +} \ No newline at end of file diff --git a/dist/es/methods/cookies.js b/dist/es/methods/cookies.js new file mode 100644 index 00000000..f0cf25c8 --- /dev/null +++ b/dist/es/methods/cookies.js @@ -0,0 +1,4 @@ +/** + * if you really need this method, + * implement it + */ \ No newline at end of file diff --git a/dist/es/methods/indexed-db.js b/dist/es/methods/indexed-db.js new file mode 100644 index 00000000..f948aeb5 --- /dev/null +++ b/dist/es/methods/indexed-db.js @@ -0,0 +1,261 @@ +/** + * this method uses indexeddb to store the messages + * There is currently no observerAPI for idb + * @link https://github.com/w3c/IndexedDB/issues/51 + */ + +var isNode = require('detect-node'); + +import { sleep, randomInt, randomToken } from '../util.js'; + +import { fillOptionsWithDefaults } from '../options'; + +var DB_PREFIX = 'pubkey.broadcast-channel-0-'; +var OBJECT_STORE_ID = 'messages'; + +export var type = 'idb'; + +export function getIdb() { + if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof mozIndexedDB !== 'undefined') return mozIndexedDB; + if (typeof webkitIndexedDB !== 'undefined') return webkitIndexedDB; + if (typeof msIndexedDB !== 'undefined') return msIndexedDB; + + return false; +} + +export function createDatabase(channelName) { + var IndexedDB = getIdb(); + + // create table + var dbName = DB_PREFIX + channelName; + var openRequest = IndexedDB.open(dbName, 1); + + openRequest.onupgradeneeded = function (ev) { + var db = ev.target.result; + db.createObjectStore(OBJECT_STORE_ID, { + keyPath: 'id', + autoIncrement: true + }); + }; + var dbPromise = new Promise(function (res, rej) { + openRequest.onerror = function (ev) { + return rej(ev); + }; + openRequest.onsuccess = function () { + res(openRequest.result); + }; + }); + + return dbPromise; +} + +/** + * writes the new message to the database + * so other readers can find it + */ +export function writeMessage(db, readerUuid, messageJson) { + var time = new Date().getTime(); + var writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + + var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); + + return new Promise(function (res, rej) { + transaction.oncomplete = function () { + return res(); + }; + transaction.onerror = function (ev) { + return rej(ev); + }; + + var objectStore = transaction.objectStore(OBJECT_STORE_ID); + objectStore.add(writeObject); + }); +} + +export function getAllMessages(db) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +export function getMessagesHigherThen(db, lastCursorId) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity); + return new Promise(function (res) { + objectStore.openCursor(keyRangeValue).onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +export function removeMessageById(db, id) { + var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)['delete'](id); + return new Promise(function (res) { + request.onsuccess = function () { + return res(); + }; + }); +} + +export function getOldMessages(db, ttl) { + var olderThen = new Date().getTime() - ttl; + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + var msgObk = cursor.value; + if (msgObk.time < olderThen) { + ret.push(msgObk); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + // no more old messages, + res(ret); + return; + } + } else { + res(ret); + } + }; + }); +} + +export function cleanOldMessages(db, ttl) { + return getOldMessages(db, ttl).then(function (tooOld) { + return Promise.all(tooOld.map(function (msgObj) { + return removeMessageById(db, msgObj.id); + })); + }); +} + +export function create(channelName, options) { + options = fillOptionsWithDefaults(options); + + var uuid = randomToken(10); + + return createDatabase(channelName).then(function (db) { + var state = { + closed: false, + lastCursorId: 0, + channelName: channelName, + options: options, + uuid: uuid, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallback: null, + readQueuePromises: [], + db: db + }; + + /** + * if service-workers are used, + * we have no 'storage'-event if they post a message, + * therefore we also have to set an interval + */ + _readLoop(state); + + return state; + }); +} + +function _readLoop(state) { + if (state.closed) return; + + return readNewMessages(state).then(function () { + return sleep(state.options.idb.fallbackInterval); + }).then(function () { + return _readLoop(state); + }); +} + +/** + * reads all new messages from the database and emits them + */ +function readNewMessages(state) { + return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessages) { + var useMessages = newerMessages.map(function (msgObj) { + if (msgObj.id > state.lastCursorId) { + state.lastCursorId = msgObj.id; + } + return msgObj; + }).filter(function (msgObj) { + return msgObj.uuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.id); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + + useMessages.forEach(function (msgObj) { + if (state.messagesCallback) { + state.emittedMessagesIds.add(msgObj.id); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.id); + }, state.options.idb.ttl * 2); + + state.messagesCallback(msgObj.data); + } + }); + + return Promise.resolve(); + }); +} + +export function close(channelState) { + channelState.closed = true; + channelState.db.close(); +} + +export function postMessage(channelState, messageJson) { + return writeMessage(channelState.db, channelState.uuid, messageJson).then(function () { + if (randomInt(0, 10) === 0) { + /* await (do not await) */cleanOldMessages(channelState.db, channelState.options.idb.ttl); + } + }); +} + +export function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + readNewMessages(channelState); +} + +export function canBeUsed() { + if (isNode) return false; + var idb = getIdb(); + + if (!idb) return false; + return true; +}; \ No newline at end of file diff --git a/dist/es/methods/localstorage.js b/dist/es/methods/localstorage.js new file mode 100644 index 00000000..45919573 --- /dev/null +++ b/dist/es/methods/localstorage.js @@ -0,0 +1,138 @@ +/** + * A localStorage-only method which uses localstorage and its 'storage'-event + * This does not work inside of webworkers because they have no access to locastorage + * This is basically implemented to support IE9 or your grandmothers toaster. + * @link https://caniuse.com/#feat=namevalue-storage + * @link https://caniuse.com/#feat=indexeddb + */ + +var isNode = require('detect-node'); + +import { fillOptionsWithDefaults } from '../options'; + +import { sleep, randomToken } from '../util'; + +var KEY_PREFIX = 'pubkey.broadcastChannel-'; +export var type = 'localstorage'; + +/** + * copied from crosstab + * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32 + */ +export function getLocalStorage() { + var localStorage = void 0; + if (typeof window === 'undefined') return null; + try { + localStorage = window.localStorage; + localStorage = window['ie8-eventlistener/storage'] || window.localStorage; + } catch (e) { + // New versions of Firefox throw a Security exception + // if cookies are disabled. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153 + } + return localStorage; +} + +export function storageKey(channelName) { + return KEY_PREFIX + channelName; +} + +/** +* writes the new message to the storage +* and fires the storage-event so other readers can find it +*/ +export function postMessage(channelState, messageJson) { + return new Promise(function (res) { + sleep().then(function () { + var key = storageKey(channelState.channelName); + var writeObj = { + token: randomToken(10), + time: new Date().getTime(), + data: messageJson, + uuid: channelState.uuid + }; + var value = JSON.stringify(writeObj); + localStorage.setItem(key, value); + + /** + * StorageEvent does not fire the 'storage' event + * in the window that changes the state of the local storage. + * So we fire it manually + */ + var ev = document.createEvent('Event'); + ev.initEvent('storage', true, true); + ev.key = key; + ev.newValue = value; + window.dispatchEvent(ev); + + res(); + }); + }); +} + +export function addStorageEventListener(channelName, fn) { + var key = storageKey(channelName); + var listener = function listener(ev) { + if (ev.key === key) { + fn(JSON.parse(ev.newValue)); + } + }; + window.addEventListener('storage', listener); + return listener; +} +export function removeStorageEventListener(listener) { + window.removeEventListener('storage', listener); +} + +export function create(channelName, options) { + options = fillOptionsWithDefaults(options); + if (!canBeUsed()) { + throw new Error('BroadcastChannel: localstorage cannot be used'); + } + + var startTime = new Date().getTime(); + var uuid = randomToken(10); + + // contains all messages that have been emitted before + var emittedMessagesIds = new Set(); + + var state = { + startTime: startTime, + channelName: channelName, + options: options, + uuid: uuid, + emittedMessagesIds: emittedMessagesIds + }; + + state.listener = addStorageEventListener(channelName, function (msgObj) { + if (!state.messagesCallback) return; // no listener + if (msgObj.uuid === uuid) return; // own message + if (!msgObj.token || emittedMessagesIds.has(msgObj.token)) return; // already emitted + if (msgObj.time && msgObj.time < state.messagesCallbackTime) return; // too old + + emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return emittedMessagesIds['delete'](msgObj.token); + }, options.localstorage.removeTimeout); + state.messagesCallback(msgObj.data); + }); + + return state; +} + +export function close(channelState) { + removeStorageEventListener(channelState.listener); +} + +export function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +export function canBeUsed() { + if (isNode) return false; + var ls = getLocalStorage(); + + if (!ls) return false; + return true; +}; \ No newline at end of file diff --git a/dist/es/methods/native.js b/dist/es/methods/native.js new file mode 100644 index 00000000..6b66caa4 --- /dev/null +++ b/dist/es/methods/native.js @@ -0,0 +1,42 @@ +var isNode = require('detect-node'); + +export var type = 'native'; + +export function create(channelName, options) { + if (!options) options = {}; + var state = { + channelName: channelName, + options: options, + messagesCallback: null, + bc: new BroadcastChannel(channelName), + subscriberFunctions: [] + }; + + state.bc.onmessage = function (msg) { + if (state.messagesCallback) { + state.messagesCallback(msg.data); + } + }; + + return state; +}; + +export function close(channelState) { + channelState.bc.close(); + channelState.subscriberFunctions = []; +} + +export function postMessage(channelState, messageJson) { + channelState.bc.postMessage(messageJson, false); +} + +export function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +export function canBeUsed() { + if (isNode) return false; + + if (typeof BroadcastChannel === 'function') return true; +}; \ No newline at end of file diff --git a/dist/es/methods/node.js b/dist/es/methods/node.js new file mode 100644 index 00000000..9bc10d4d --- /dev/null +++ b/dist/es/methods/node.js @@ -0,0 +1,944 @@ +import _regeneratorRuntime from 'babel-runtime/regenerator'; +import _asyncToGenerator from 'babel-runtime/helpers/asyncToGenerator'; +/** + * this method is used in nodejs-environments. + * The ipc is handled via sockets and file-writes to the tmp-folder + */ + +import * as util from 'util'; +import * as fs from 'fs'; +import * as os from 'os'; +import * as events from 'events'; +import * as net from 'net'; +import * as path from 'path'; +import { sha3_224 } from 'js-sha3'; + +import isNode from 'detect-node'; +import IdleQueue from 'custom-idle-queue'; +import unload from 'unload'; + +import { fillOptionsWithDefaults } from '../options'; + +import { randomInt, randomToken } from '../util'; + +/** + * windows sucks, so we have handle windows-type of socket-paths + * @link https://gist.github.com/domenic/2790533#gistcomment-331356 + */ +export function cleanPipeName(str) { + if (process.platform === 'win32' && !str.startsWith('\\\\.\\pipe\\')) { + str = str.replace(/^\//, ''); + str = str.replace(/\//g, '-'); + return '\\\\.\\pipe\\' + str; + } else { + return str; + } +}; + +var mkdir = util.promisify(fs.mkdir); +var writeFile = util.promisify(fs.writeFile); +var readFile = util.promisify(fs.readFile); +var unlink = util.promisify(fs.unlink); +var readdir = util.promisify(fs.readdir); + +var TMP_FOLDER_NAME = 'pubkey.broadcast-channel'; + +export function getPaths(channelName) { + var folderPathBase = path.join(os.tmpdir(), TMP_FOLDER_NAME); + var channelPathBase = path.join(os.tmpdir(), TMP_FOLDER_NAME, sha3_224(channelName) // use hash incase of strange characters + ); + var folderPathReaders = path.join(channelPathBase, 'readers'); + var folderPathMessages = path.join(channelPathBase, 'messages'); + + return { + base: folderPathBase, + channelBase: channelPathBase, + readers: folderPathReaders, + messages: folderPathMessages + }; +} + +export var ensureFoldersExist = function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(channelName) { + var paths; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + paths = getPaths(channelName); + _context.next = 3; + return mkdir(paths.base)['catch'](function () { + return null; + }); + + case 3: + _context.next = 5; + return mkdir(paths.channelBase)['catch'](function () { + return null; + }); + + case 5: + _context.t0 = Promise; + _context.next = 8; + return mkdir(paths.readers)['catch'](function () { + return null; + }); + + case 8: + _context.t1 = _context.sent; + _context.next = 11; + return mkdir(paths.messages)['catch'](function () { + return null; + }); + + case 11: + _context.t2 = _context.sent; + _context.t3 = [_context.t1, _context.t2]; + _context.next = 15; + return _context.t0.all.call(_context.t0, _context.t3); + + case 15: + case 'end': + return _context.stop(); + } + } + }, _callee, this); + })); + + return function ensureFoldersExist(_x) { + return _ref.apply(this, arguments); + }; +}();; + +export function socketPath(channelName, readerUuid) { + + var paths = getPaths(channelName); + var socketPath = path.join(paths.readers, readerUuid + '.s'); + return cleanPipeName(socketPath); +} + +export function socketInfoPath(channelName, readerUuid) { + var paths = getPaths(channelName); + var socketPath = path.join(paths.readers, readerUuid + '.json'); + return socketPath; +} + +/** + * Because it is not possible to get all socket-files in a folder, + * when used under fucking windows, + * we have to set a normal file so other readers know our socket exists + */ +export var createSocketInfoFile = function () { + var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(channelName, readerUuid) { + var pathToFile; + return _regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return ensureFoldersExist(channelName); + + case 2: + pathToFile = socketInfoPath(channelName, readerUuid); + _context2.next = 5; + return writeFile(pathToFile, JSON.stringify({ + time: new Date().getTime() + })); + + case 5: + return _context2.abrupt('return', pathToFile); + + case 6: + case 'end': + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function createSocketInfoFile(_x2, _x3) { + return _ref2.apply(this, arguments); + }; +}(); + +/** + * creates the socket-file and subscribes to it + * @return {{emitter: EventEmitter, server: any}} + */ +export var createSocketEventEmitter = function () { + var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(channelName, readerUuid) { + var pathToSocket, emitter, server; + return _regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + pathToSocket = socketPath(channelName, readerUuid); + emitter = new events.EventEmitter(); + server = net.createServer(function (stream) { + stream.on('end', function () { + // console.log('server: end'); + }); + + stream.on('data', function (msg) { + // console.log('server: got data:'); + // console.dir(msg.toString()); + emitter.emit('data', msg.toString()); + }); + }); + _context3.next = 5; + return new Promise(function (res) { + server.listen(pathToSocket, function () { + res(); + }); + }); + + case 5: + server.on('connection', function () { + // console.log('server: Client connected.'); + }); + + return _context3.abrupt('return', { + path: pathToSocket, + emitter: emitter, + server: server + }); + + case 7: + case 'end': + return _context3.stop(); + } + } + }, _callee3, this); + })); + + return function createSocketEventEmitter(_x4, _x5) { + return _ref3.apply(this, arguments); + }; +}(); + +export var openClientConnection = function () { + var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(channelName, readerUuid) { + var pathToSocket, client; + return _regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + pathToSocket = socketPath(channelName, readerUuid); + client = new net.Socket(); + _context4.next = 4; + return new Promise(function (res) { + client.connect(pathToSocket, res); + }); + + case 4: + return _context4.abrupt('return', client); + + case 5: + case 'end': + return _context4.stop(); + } + } + }, _callee4, this); + })); + + return function openClientConnection(_x6, _x7) { + return _ref4.apply(this, arguments); + }; +}(); + +/** + * writes the new message to the file-system + * so other readers can find it + */ +export var writeMessage = function () { + var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(channelName, readerUuid, messageJson) { + var time, writeObject, token, fileName, msgPath; + return _regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + time = new Date().getTime(); + writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + token = randomToken(12); + fileName = time + '_' + readerUuid + '_' + token + '.json'; + msgPath = path.join(getPaths(channelName).messages, fileName); + _context5.next = 7; + return writeFile(msgPath, JSON.stringify(writeObject)); + + case 7: + return _context5.abrupt('return', { + time: time, + uuid: readerUuid, + token: token, + path: msgPath + }); + + case 8: + case 'end': + return _context5.stop(); + } + } + }, _callee5, this); + })); + + return function writeMessage(_x8, _x9, _x10) { + return _ref5.apply(this, arguments); + }; +}(); + +/** + * returns the uuids of all readers + * @return {string[]} + */ +export var getReadersUuids = function () { + var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(channelName) { + var readersPath, files; + return _regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + readersPath = getPaths(channelName).readers; + _context6.next = 3; + return readdir(readersPath); + + case 3: + files = _context6.sent; + return _context6.abrupt('return', files.map(function (file) { + return file.split('.'); + }).filter(function (split) { + return split[1] === 'json'; + }) // do not scan .socket-files + .map(function (split) { + return split[0]; + })); + + case 5: + case 'end': + return _context6.stop(); + } + } + }, _callee6, this); + })); + + return function getReadersUuids(_x11) { + return _ref6.apply(this, arguments); + }; +}(); + +export var messagePath = function () { + var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(channelName, time, token, writerUuid) { + var fileName, msgPath; + return _regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + fileName = time + '_' + writerUuid + '_' + token + '.json'; + msgPath = path.join(getPaths(channelName).messages, fileName); + return _context7.abrupt('return', msgPath); + + case 3: + case 'end': + return _context7.stop(); + } + } + }, _callee7, this); + })); + + return function messagePath(_x12, _x13, _x14, _x15) { + return _ref7.apply(this, arguments); + }; +}(); + +export var getAllMessages = function () { + var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(channelName) { + var messagesPath, files; + return _regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + messagesPath = getPaths(channelName).messages; + _context8.next = 3; + return readdir(messagesPath); + + case 3: + files = _context8.sent; + return _context8.abrupt('return', files.map(function (file) { + var fileName = file.split('.')[0]; + var split = fileName.split('_'); + + return { + path: path.join(messagesPath, file), + time: parseInt(split[0]), + senderUuid: split[1], + token: split[2] + }; + })); + + case 5: + case 'end': + return _context8.stop(); + } + } + }, _callee8, this); + })); + + return function getAllMessages(_x16) { + return _ref8.apply(this, arguments); + }; +}(); + +export function getSingleMessage(channelName, msgObj) { + var messagesPath = getPaths(channelName).messages; + + return { + path: path.join(messagesPath, msgObj.t + '_' + msgObj.u + '_' + msgObj.to + '.json'), + time: msgObj.t, + senderUuid: msgObj.u, + token: msgObj.to + }; +} + +export var readMessage = function () { + var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(messageObj) { + var content; + return _regeneratorRuntime.wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return readFile(messageObj.path, 'utf8'); + + case 2: + content = _context9.sent; + return _context9.abrupt('return', JSON.parse(content)); + + case 4: + case 'end': + return _context9.stop(); + } + } + }, _callee9, this); + })); + + return function readMessage(_x17) { + return _ref9.apply(this, arguments); + }; +}(); + +export var cleanOldMessages = function () { + var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(messageObjects, ttl) { + var olderThen; + return _regeneratorRuntime.wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + olderThen = new Date().getTime() - ttl; + _context10.next = 3; + return Promise.all(messageObjects.filter(function (obj) { + return obj.time < olderThen; + }).map(function (obj) { + return unlink(obj.path)['catch'](function () { + return null; + }); + })); + + case 3: + case 'end': + return _context10.stop(); + } + } + }, _callee10, this); + })); + + return function cleanOldMessages(_x18, _x19) { + return _ref10.apply(this, arguments); + }; +}(); + +export var type = 'node'; + +export var create = function () { + var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(channelName) { + var _this = this; + + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var uuid, _ref12, otherReaderUuids, socketEE, infoFilePath, otherReaderClients, readQueue, writeQueue, state; + + return _regeneratorRuntime.wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + options = fillOptionsWithDefaults(options); + + _context12.next = 3; + return ensureFoldersExist(channelName); + + case 3: + uuid = randomToken(10); + _context12.next = 6; + return Promise.all([getReadersUuids(channelName), createSocketEventEmitter(channelName, uuid), createSocketInfoFile(channelName, uuid)]); + + case 6: + _ref12 = _context12.sent; + otherReaderUuids = _ref12[0]; + socketEE = _ref12[1]; + infoFilePath = _ref12[2]; + otherReaderClients = {}; + _context12.next = 13; + return Promise.all(otherReaderUuids.filter(function (readerUuid) { + return readerUuid !== uuid; + }) // not own + .map(function () { + var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(readerUuid) { + var client; + return _regeneratorRuntime.wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + _context11.next = 2; + return openClientConnection(channelName, readerUuid); + + case 2: + client = _context11.sent; + + otherReaderClients[readerUuid] = client; + + case 4: + case 'end': + return _context11.stop(); + } + } + }, _callee11, _this); + })); + + return function (_x22) { + return _ref13.apply(this, arguments); + }; + }())); + + case 13: + + // ensures we do not read messages in parrallel + readQueue = new IdleQueue(1); + writeQueue = new IdleQueue(1); + state = { + channelName: channelName, + options: options, + uuid: uuid, + socketEE: socketEE, + infoFilePath: infoFilePath, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallbackTime: null, + messagesCallback: null, + readQueue: readQueue, + writeQueue: writeQueue, + otherReaderUuids: otherReaderUuids, + otherReaderClients: otherReaderClients, + // ensure if process crashes, everything is cleaned up + removeUnload: unload.add(function () { + return close(state); + }) + }; + + // when new message comes in, we read it and emit it + + socketEE.emitter.on('data', function (data) { + var obj = JSON.parse(data); + if (obj.a === 'msg') { + handleMessagePing(state, obj.d); + return; + } + }); + + return _context12.abrupt('return', state); + + case 18: + case 'end': + return _context12.stop(); + } + } + }, _callee12, this); + })); + + return function create(_x20) { + return _ref11.apply(this, arguments); + }; +}(); + +/** + * when the socket pings, so that we now new messages came, + * run this + */ +export var handleMessagePing = function () { + var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(state) { + var _this2 = this; + + var msgObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + return _regeneratorRuntime.wrap(function _callee14$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + if (state.messagesCallback) { + _context15.next = 2; + break; + } + + return _context15.abrupt('return'); + + case 2: + _context15.next = 4; + return state.readQueue.requestIdlePromise(); + + case 4: + _context15.next = 6; + return state.readQueue.wrapCall(_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() { + var messages, useMessages, _loop, _iterator, _isArray, _i, _ref16, _ret; + + return _regeneratorRuntime.wrap(function _callee13$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + messages = void 0; + + if (msgObj) { + _context14.next = 7; + break; + } + + _context14.next = 4; + return getAllMessages(state.channelName); + + case 4: + messages = _context14.sent; + _context14.next = 8; + break; + + case 7: + // get single message + messages = [getSingleMessage(state.channelName, msgObj)]; + + case 8: + useMessages = messages.filter(function (msgObj) { + return msgObj.senderUuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.token); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + if (!state.messagesCallback) { + _context14.next = 18; + break; + } + + _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() { + var msgObj, content; + return _regeneratorRuntime.wrap(function _loop$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + if (!_isArray) { + _context13.next = 6; + break; + } + + if (!(_i >= _iterator.length)) { + _context13.next = 3; + break; + } + + return _context13.abrupt('return', 'break'); + + case 3: + _ref16 = _iterator[_i++]; + _context13.next = 10; + break; + + case 6: + _i = _iterator.next(); + + if (!_i.done) { + _context13.next = 9; + break; + } + + return _context13.abrupt('return', 'break'); + + case 9: + _ref16 = _i.value; + + case 10: + msgObj = _ref16; + _context13.next = 13; + return readMessage(msgObj); + + case 13: + content = _context13.sent; + + state.emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.token); + }, state.options.node.ttl * 2); + + if (state.messagesCallback) { + state.messagesCallback(content.data); + } + + case 17: + case 'end': + return _context13.stop(); + } + } + }, _loop, _this2); + }); + _iterator = useMessages, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator](); + + case 12: + return _context14.delegateYield(_loop(), 't0', 13); + + case 13: + _ret = _context14.t0; + + if (!(_ret === 'break')) { + _context14.next = 16; + break; + } + + return _context14.abrupt('break', 18); + + case 16: + _context14.next = 12; + break; + + case 18: + case 'end': + return _context14.stop(); + } + } + }, _callee13, _this2); + }))); + + case 6: + case 'end': + return _context15.stop(); + } + } + }, _callee14, this); + })); + + return function handleMessagePing(_x23) { + return _ref14.apply(this, arguments); + }; +}(); + +export var refreshReaderClients = function () { + var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(channelState) { + var _this3 = this; + + var otherReaders; + return _regeneratorRuntime.wrap(function _callee16$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + _context17.next = 2; + return getReadersUuids(channelState.channelName); + + case 2: + otherReaders = _context17.sent; + + + // remove subscriptions to closed readers + Object.keys(channelState.otherReaderClients).filter(function (readerUuid) { + return !otherReaders.includes(readerUuid); + }).forEach(function (readerUuid) { + channelState.otherReaderClients[readerUuid].close(); + delete channelState.otherReaderClients[readerUuid]; + }); + + _context17.next = 6; + return Promise.all(otherReaders.filter(function (readerUuid) { + return readerUuid !== channelState.uuid; + }) // not own + .filter(function (readerUuid) { + return !channelState.otherReaderClients[readerUuid]; + }) // not already has client + .map(function () { + var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(readerUuid) { + var client; + return _regeneratorRuntime.wrap(function _callee15$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + _context16.next = 2; + return openClientConnection(channelState.channelName, readerUuid); + + case 2: + client = _context16.sent; + + channelState.otherReaderClients[readerUuid] = client; + + case 4: + case 'end': + return _context16.stop(); + } + } + }, _callee15, _this3); + })); + + return function (_x26) { + return _ref18.apply(this, arguments); + }; + }())); + + case 6: + case 'end': + return _context17.stop(); + } + } + }, _callee16, this); + })); + + return function refreshReaderClients(_x25) { + return _ref17.apply(this, arguments); + }; +}(); + +export var postMessage = function () { + var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(channelState, messageJson) { + var _this4 = this; + + return _regeneratorRuntime.wrap(function _callee18$(_context19) { + while (1) { + switch (_context19.prev = _context19.next) { + case 0: + _context19.next = 2; + return channelState.writeQueue.requestIdlePromise(); + + case 2: + _context19.next = 4; + return channelState.writeQueue.wrapCall(_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() { + var msgObj, pingObj, messages; + return _regeneratorRuntime.wrap(function _callee17$(_context18) { + while (1) { + switch (_context18.prev = _context18.next) { + case 0: + _context18.next = 2; + return refreshReaderClients(channelState); + + case 2: + _context18.next = 4; + return writeMessage(channelState.channelName, channelState.uuid, messageJson); + + case 4: + msgObj = _context18.sent; + + + // ping other readers + pingObj = { + a: 'msg', + d: { + t: msgObj.time, + u: msgObj.uuid, + to: msgObj.token + } + }; + _context18.next = 8; + return Promise.all(Object.values(channelState.otherReaderClients).map(function (client) { + return client.write(JSON.stringify(pingObj)); + })); + + case 8: + if (!(randomInt(0, 10) === 0)) { + _context18.next = 14; + break; + } + + _context18.next = 11; + return getAllMessages(channelState.channelName); + + case 11: + messages = _context18.sent; + _context18.next = 14; + return cleanOldMessages(messages, channelState.options.node.ttl); + + case 14: + case 'end': + return _context18.stop(); + } + } + }, _callee17, _this4); + })) + + // emit to own eventEmitter + // channelState.socketEE.emitter.emit('data', JSON.parse(JSON.stringify(messageJson))); + ); + + case 4: + case 'end': + return _context19.stop(); + } + } + }, _callee18, this); + })); + + return function postMessage(_x27, _x28) { + return _ref19.apply(this, arguments); + }; +}(); + +export function onMessage(channelState, fn) { + var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Date().getTime(); + + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + handleMessagePing(channelState); +} + +export var close = function () { + var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(channelState) { + return _regeneratorRuntime.wrap(function _callee19$(_context20) { + while (1) { + switch (_context20.prev = _context20.next) { + case 0: + channelState.removeUnload(); + channelState.socketEE.server.close(); + channelState.socketEE.emitter.removeAllListeners(); + channelState.readQueue.clear(); + channelState.writeQueue.clear(); + + _context20.next = 7; + return unlink(channelState.infoFilePath); + + case 7: + + Object.values(channelState.otherReaderClients).forEach(function (client) { + return client.destroy(); + }); + + case 8: + case 'end': + return _context20.stop(); + } + } + }, _callee19, this); + })); + + return function close(_x30) { + return _ref21.apply(this, arguments); + }; +}(); + +export function canBeUsed() { + return isNode; +}; \ No newline at end of file diff --git a/dist/es/options.js b/dist/es/options.js new file mode 100644 index 00000000..5c4f8ab3 --- /dev/null +++ b/dist/es/options.js @@ -0,0 +1,23 @@ +export function fillOptionsWithDefaults(options) { + if (!options) options = {}; + options = JSON.parse(JSON.stringify(options)); + + // main + if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; + + // indexed-db + if (!options.idb) options.idb = {}; + // after this time the messages get deleted + if (!options.idb.ttl) options.idb.ttl = 1000 * 45; + if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 50; + + // localstorage + if (!options.localstorage) options.localstorage = {}; + if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; + + // node + if (!options.node) options.node = {}; + if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes; + + return options; +} \ No newline at end of file diff --git a/dist/es/util.js b/dist/es/util.js new file mode 100644 index 00000000..0f3a389a --- /dev/null +++ b/dist/es/util.js @@ -0,0 +1,33 @@ +/** + * returns true if the given object is a promise + */ +export function isPromise(obj) { + if (obj && typeof obj.then === 'function') { + return true; + } else { + return false; + } +} + +export function sleep(time) { + if (!time) time = 0; + return new Promise(function (res) { + return setTimeout(res, time); + }); +} + +export function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +/** + * https://stackoverflow.com/a/1349426/3443137 + */ +export function randomToken(length) { + var text = ''; + var possible = 'abcdefghijklmnopqrstuvwxzy0123456789'; + + for (var i = 0; i < 5; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + }return text; +} \ No newline at end of file diff --git a/dist/lib/browserify.index.js b/dist/lib/browserify.index.js new file mode 100644 index 00000000..24a71883 --- /dev/null +++ b/dist/lib/browserify.index.js @@ -0,0 +1,5 @@ +'use strict'; + +var BroadcastChannel = require('./index.es5.js'); + +window['BroadcastChannel2'] = BroadcastChannel; \ No newline at end of file diff --git a/dist/lib/index.es5.js b/dist/lib/index.es5.js new file mode 100644 index 00000000..8916ea4d --- /dev/null +++ b/dist/lib/index.es5.js @@ -0,0 +1,16 @@ +'use strict'; + +var _index = require('./index.js'); + +var _index2 = _interopRequireDefault(_index); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +module.exports = _index2['default']; /** + * because babel can only export on default-attribute, + * we use this for the non-module-build + * this ensures that users do not have to use + * var BroadcastChannel = require('broadcast-channel').default; + * but + * var BroadcastChannel = require('broadcast-channel'); + */ \ No newline at end of file diff --git a/dist/lib/index.js b/dist/lib/index.js new file mode 100644 index 00000000..3100e4c1 --- /dev/null +++ b/dist/lib/index.js @@ -0,0 +1,170 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _util = require('./util.js'); + +var _methodChooser = require('./method-chooser.js'); + +var _options = require('./options.js'); + +var BroadcastChannel = function BroadcastChannel(name, options) { + this.name = name; + this.options = (0, _options.fillOptionsWithDefaults)(options); + this.method = (0, _methodChooser.chooseMethod)(this.options); + + this._isListening = false; + + /** + * setting onmessage twice, + * will overwrite the first listener + */ + this._onMessageListener = null; + + this._addEventListeners = { + message: [], + internal: [] + }; + + this._preparePromise = null; + _prepareChannel(this); +}; + +BroadcastChannel.prototype = { + postMessage: function postMessage(msg) { + var _this = this; + + var msgObj = { + time: new Date().getTime(), + type: 'message', + data: msg + }; + + if (this.closed) { + throw new Error('BroadcastChannel.postMessage(): ' + 'Cannot post message after channel has closed'); + } + + var awaitPrepare = this._preparePromise ? this._preparePromise : Promise.resolve(); + return awaitPrepare.then(function () { + return _this.method.postMessage(_this._state, msgObj); + }); + }, + + set onmessage(fn) { + var time = new Date().getTime() - 5; + var listenObj = { + time: time, + fn: fn + }; + _removeListenerObject(this, 'message', this._onMessageListener); + if (fn && typeof fn === 'function') { + this._onMessageListener = listenObj; + _addListenerObject(this, 'message', listenObj); + } else { + this._onMessageListener = null; + } + }, + + addEventListener: function addEventListener(type, fn) { + var time = new Date().getTime() - 5; + var listenObj = { + time: time, + fn: fn + }; + _addListenerObject(this, type, listenObj); + }, + removeEventListener: function removeEventListener(type, fn) { + var obj = this._addEventListeners[type].find(function (obj) { + return obj.fn === fn; + }); + _removeListenerObject(this, type, obj); + }, + close: function close() { + var _this2 = this; + + this.closed = true; + var awaitPrepare = this._preparePromise ? this._preparePromise : Promise.resolve(); + + this._onMessageListener = null; + this._addEventListeners.message = []; + + return awaitPrepare.then(function () { + return _this2.method.close(_this2._state); + }); + }, + + get type() { + return this.method.type; + } +}; + +function _prepareChannel(channel) { + var maybePromise = channel.method.create(channel.name, channel.options); + if ((0, _util.isPromise)(maybePromise)) { + channel._preparePromise = maybePromise; + maybePromise.then(function (s) { + // used in tests to simulate slow runtime + /*if (channel.options.prepareDelay) { + await new Promise(res => setTimeout(res, this.options.prepareDelay)); + }*/ + channel._state = s; + }); + } else { + channel._state = maybePromise; + } +} + +function _hasMessageListeners(channel) { + if (channel._addEventListeners.message.length > 0) return true; + if (channel._addEventListeners.internal.length > 0) return true; + return false; +} + +function _addListenerObject(channel, type, obj) { + channel._addEventListeners[type].push(obj); + _startListening(channel); +} +function _removeListenerObject(channel, type, obj) { + channel._addEventListeners[type] = channel._addEventListeners[type].filter(function (o) { + return o !== obj; + }); + _stopListening(channel); +} + +function _startListening(channel) { + if (!channel._isListening && _hasMessageListeners(channel)) { + // someone is listening, start subscribing + + var listenerFn = function listenerFn(msgObj) { + channel._addEventListeners[msgObj.type].forEach(function (obj) { + if (msgObj.time >= obj.time) { + obj.fn(msgObj.data); + }; + }); + }; + + var time = new Date().getTime() - 5; + if (channel._preparePromise) { + channel._preparePromise.then(function () { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + }); + } else { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + } + } +} + +function _stopListening(channel) { + if (channel._isListening && !_hasMessageListeners(channel)) { + // noone is listening, stop subscribing + channel._isListening = false; + var time = new Date().getTime() - 5; + channel.method.onMessage(channel._state, null, time); + } +} + +exports['default'] = BroadcastChannel; \ No newline at end of file diff --git a/dist/lib/method-chooser.js b/dist/lib/method-chooser.js new file mode 100644 index 00000000..857d15db --- /dev/null +++ b/dist/lib/method-chooser.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.chooseMethod = chooseMethod; +var isNode = require('detect-node'); + +var NativeMethod = require('./methods/native.js'); +var IndexeDbMethod = require('./methods/indexed-db.js'); +var LocalstorageMethod = require('./methods/localstorage.js'); + +// order is important +var METHODS = [NativeMethod, // fastest +IndexeDbMethod, LocalstorageMethod]; + +var REQUIRE_FUN = require; + +/** + * The NodeMethod is loaded lazy + * so it will not get bundled in browser-builds + */ +if (isNode) { + var NodeMethod = REQUIRE_FUN('./methods/node.js'); + METHODS.push(NodeMethod); +} + +function chooseMethod(options) { + // directly chosen + if (options.type) { + var ret = METHODS.find(function (m) { + return m.type === options.type; + }); + if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret; + } + + var chooseMethods = METHODS; + if (!options.webWorkerSupport && !isNode) { + // prefer localstorage over idb when no webworker-support needed + chooseMethods = METHODS.filter(function (m) { + return m.type !== 'idb'; + }); + } + + var useMethod = chooseMethods.find(function (method) { + return method.canBeUsed(); + }); + if (!useMethod) throw new Error('No useable methode found:' + JSON.stringify(METHODS.map(function (m) { + return m.type; + })));else return useMethod; +} \ No newline at end of file diff --git a/dist/lib/methods/cookies.js b/dist/lib/methods/cookies.js new file mode 100644 index 00000000..0011f3e2 --- /dev/null +++ b/dist/lib/methods/cookies.js @@ -0,0 +1,5 @@ +/** + * if you really need this method, + * implement it + */ +"use strict"; \ No newline at end of file diff --git a/dist/lib/methods/indexed-db.js b/dist/lib/methods/indexed-db.js new file mode 100644 index 00000000..1d86c7db --- /dev/null +++ b/dist/lib/methods/indexed-db.js @@ -0,0 +1,281 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getIdb = getIdb; +exports.createDatabase = createDatabase; +exports.writeMessage = writeMessage; +exports.getAllMessages = getAllMessages; +exports.getMessagesHigherThen = getMessagesHigherThen; +exports.removeMessageById = removeMessageById; +exports.getOldMessages = getOldMessages; +exports.cleanOldMessages = cleanOldMessages; +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _util = require('../util.js'); + +var _options = require('../options'); + +/** + * this method uses indexeddb to store the messages + * There is currently no observerAPI for idb + * @link https://github.com/w3c/IndexedDB/issues/51 + */ + +var isNode = require('detect-node'); + +var DB_PREFIX = 'pubkey.broadcast-channel-0-'; +var OBJECT_STORE_ID = 'messages'; + +var type = exports.type = 'idb'; + +function getIdb() { + if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof mozIndexedDB !== 'undefined') return mozIndexedDB; + if (typeof webkitIndexedDB !== 'undefined') return webkitIndexedDB; + if (typeof msIndexedDB !== 'undefined') return msIndexedDB; + + return false; +} + +function createDatabase(channelName) { + var IndexedDB = getIdb(); + + // create table + var dbName = DB_PREFIX + channelName; + var openRequest = IndexedDB.open(dbName, 1); + + openRequest.onupgradeneeded = function (ev) { + var db = ev.target.result; + db.createObjectStore(OBJECT_STORE_ID, { + keyPath: 'id', + autoIncrement: true + }); + }; + var dbPromise = new Promise(function (res, rej) { + openRequest.onerror = function (ev) { + return rej(ev); + }; + openRequest.onsuccess = function () { + res(openRequest.result); + }; + }); + + return dbPromise; +} + +/** + * writes the new message to the database + * so other readers can find it + */ +function writeMessage(db, readerUuid, messageJson) { + var time = new Date().getTime(); + var writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + + var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); + + return new Promise(function (res, rej) { + transaction.oncomplete = function () { + return res(); + }; + transaction.onerror = function (ev) { + return rej(ev); + }; + + var objectStore = transaction.objectStore(OBJECT_STORE_ID); + objectStore.add(writeObject); + }); +} + +function getAllMessages(db) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function getMessagesHigherThen(db, lastCursorId) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity); + return new Promise(function (res) { + objectStore.openCursor(keyRangeValue).onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function removeMessageById(db, id) { + var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)['delete'](id); + return new Promise(function (res) { + request.onsuccess = function () { + return res(); + }; + }); +} + +function getOldMessages(db, ttl) { + var olderThen = new Date().getTime() - ttl; + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + var msgObk = cursor.value; + if (msgObk.time < olderThen) { + ret.push(msgObk); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + // no more old messages, + res(ret); + return; + } + } else { + res(ret); + } + }; + }); +} + +function cleanOldMessages(db, ttl) { + return getOldMessages(db, ttl).then(function (tooOld) { + return Promise.all(tooOld.map(function (msgObj) { + return removeMessageById(db, msgObj.id); + })); + }); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + + var uuid = (0, _util.randomToken)(10); + + return createDatabase(channelName).then(function (db) { + var state = { + closed: false, + lastCursorId: 0, + channelName: channelName, + options: options, + uuid: uuid, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallback: null, + readQueuePromises: [], + db: db + }; + + /** + * if service-workers are used, + * we have no 'storage'-event if they post a message, + * therefore we also have to set an interval + */ + _readLoop(state); + + return state; + }); +} + +function _readLoop(state) { + if (state.closed) return; + + return readNewMessages(state).then(function () { + return (0, _util.sleep)(state.options.idb.fallbackInterval); + }).then(function () { + return _readLoop(state); + }); +} + +/** + * reads all new messages from the database and emits them + */ +function readNewMessages(state) { + return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessages) { + var useMessages = newerMessages.map(function (msgObj) { + if (msgObj.id > state.lastCursorId) { + state.lastCursorId = msgObj.id; + } + return msgObj; + }).filter(function (msgObj) { + return msgObj.uuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.id); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + + useMessages.forEach(function (msgObj) { + if (state.messagesCallback) { + state.emittedMessagesIds.add(msgObj.id); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.id); + }, state.options.idb.ttl * 2); + + state.messagesCallback(msgObj.data); + } + }); + + return Promise.resolve(); + }); +} + +function close(channelState) { + channelState.closed = true; + channelState.db.close(); +} + +function postMessage(channelState, messageJson) { + return writeMessage(channelState.db, channelState.uuid, messageJson).then(function () { + if ((0, _util.randomInt)(0, 10) === 0) { + /* await (do not await) */cleanOldMessages(channelState.db, channelState.options.idb.ttl); + } + }); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + readNewMessages(channelState); +} + +function canBeUsed() { + if (isNode) return false; + var idb = getIdb(); + + if (!idb) return false; + return true; +}; \ No newline at end of file diff --git a/dist/lib/methods/localstorage.js b/dist/lib/methods/localstorage.js new file mode 100644 index 00000000..f2e58d69 --- /dev/null +++ b/dist/lib/methods/localstorage.js @@ -0,0 +1,154 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getLocalStorage = getLocalStorage; +exports.storageKey = storageKey; +exports.postMessage = postMessage; +exports.addStorageEventListener = addStorageEventListener; +exports.removeStorageEventListener = removeStorageEventListener; +exports.create = create; +exports.close = close; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _options = require('../options'); + +var _util = require('../util'); + +/** + * A localStorage-only method which uses localstorage and its 'storage'-event + * This does not work inside of webworkers because they have no access to locastorage + * This is basically implemented to support IE9 or your grandmothers toaster. + * @link https://caniuse.com/#feat=namevalue-storage + * @link https://caniuse.com/#feat=indexeddb + */ + +var isNode = require('detect-node'); + +var KEY_PREFIX = 'pubkey.broadcastChannel-'; +var type = exports.type = 'localstorage'; + +/** + * copied from crosstab + * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32 + */ +function getLocalStorage() { + var localStorage = void 0; + if (typeof window === 'undefined') return null; + try { + localStorage = window.localStorage; + localStorage = window['ie8-eventlistener/storage'] || window.localStorage; + } catch (e) { + // New versions of Firefox throw a Security exception + // if cookies are disabled. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153 + } + return localStorage; +} + +function storageKey(channelName) { + return KEY_PREFIX + channelName; +} + +/** +* writes the new message to the storage +* and fires the storage-event so other readers can find it +*/ +function postMessage(channelState, messageJson) { + return new Promise(function (res) { + (0, _util.sleep)().then(function () { + var key = storageKey(channelState.channelName); + var writeObj = { + token: (0, _util.randomToken)(10), + time: new Date().getTime(), + data: messageJson, + uuid: channelState.uuid + }; + var value = JSON.stringify(writeObj); + localStorage.setItem(key, value); + + /** + * StorageEvent does not fire the 'storage' event + * in the window that changes the state of the local storage. + * So we fire it manually + */ + var ev = document.createEvent('Event'); + ev.initEvent('storage', true, true); + ev.key = key; + ev.newValue = value; + window.dispatchEvent(ev); + + res(); + }); + }); +} + +function addStorageEventListener(channelName, fn) { + var key = storageKey(channelName); + var listener = function listener(ev) { + if (ev.key === key) { + fn(JSON.parse(ev.newValue)); + } + }; + window.addEventListener('storage', listener); + return listener; +} +function removeStorageEventListener(listener) { + window.removeEventListener('storage', listener); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + if (!canBeUsed()) { + throw new Error('BroadcastChannel: localstorage cannot be used'); + } + + var startTime = new Date().getTime(); + var uuid = (0, _util.randomToken)(10); + + // contains all messages that have been emitted before + var emittedMessagesIds = new Set(); + + var state = { + startTime: startTime, + channelName: channelName, + options: options, + uuid: uuid, + emittedMessagesIds: emittedMessagesIds + }; + + state.listener = addStorageEventListener(channelName, function (msgObj) { + if (!state.messagesCallback) return; // no listener + if (msgObj.uuid === uuid) return; // own message + if (!msgObj.token || emittedMessagesIds.has(msgObj.token)) return; // already emitted + if (msgObj.time && msgObj.time < state.messagesCallbackTime) return; // too old + + emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return emittedMessagesIds['delete'](msgObj.token); + }, options.localstorage.removeTimeout); + state.messagesCallback(msgObj.data); + }); + + return state; +} + +function close(channelState) { + removeStorageEventListener(channelState.listener); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + var ls = getLocalStorage(); + + if (!ls) return false; + return true; +}; \ No newline at end of file diff --git a/dist/lib/methods/native.js b/dist/lib/methods/native.js new file mode 100644 index 00000000..30d0f4ce --- /dev/null +++ b/dist/lib/methods/native.js @@ -0,0 +1,52 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; +var isNode = require('detect-node'); + +var type = exports.type = 'native'; + +function create(channelName, options) { + if (!options) options = {}; + var state = { + channelName: channelName, + options: options, + messagesCallback: null, + bc: new BroadcastChannel(channelName), + subscriberFunctions: [] + }; + + state.bc.onmessage = function (msg) { + if (state.messagesCallback) { + state.messagesCallback(msg.data); + } + }; + + return state; +}; + +function close(channelState) { + channelState.bc.close(); + channelState.subscriberFunctions = []; +} + +function postMessage(channelState, messageJson) { + channelState.bc.postMessage(messageJson, false); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + + if (typeof BroadcastChannel === 'function') return true; +}; \ No newline at end of file diff --git a/dist/lib/methods/node.js b/dist/lib/methods/node.js new file mode 100644 index 00000000..15d242cd --- /dev/null +++ b/dist/lib/methods/node.js @@ -0,0 +1,1011 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.close = exports.postMessage = exports.refreshReaderClients = exports.handleMessagePing = exports.create = exports.type = exports.cleanOldMessages = exports.readMessage = exports.getAllMessages = exports.messagePath = exports.getReadersUuids = exports.writeMessage = exports.openClientConnection = exports.createSocketEventEmitter = exports.createSocketInfoFile = exports.ensureFoldersExist = undefined; + +var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray'); + +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); + +var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); + +var ensureFoldersExist = exports.ensureFoldersExist = function () { + var _ref = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee(channelName) { + var paths; + return _regenerator2['default'].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + paths = getPaths(channelName); + _context.next = 3; + return mkdir(paths.base)['catch'](function () { + return null; + }); + + case 3: + _context.next = 5; + return mkdir(paths.channelBase)['catch'](function () { + return null; + }); + + case 5: + _context.t0 = Promise; + _context.next = 8; + return mkdir(paths.readers)['catch'](function () { + return null; + }); + + case 8: + _context.t1 = _context.sent; + _context.next = 11; + return mkdir(paths.messages)['catch'](function () { + return null; + }); + + case 11: + _context.t2 = _context.sent; + _context.t3 = [_context.t1, _context.t2]; + _context.next = 15; + return _context.t0.all.call(_context.t0, _context.t3); + + case 15: + case 'end': + return _context.stop(); + } + } + }, _callee, this); + })); + + return function ensureFoldersExist(_x) { + return _ref.apply(this, arguments); + }; +}(); + +/** + * Because it is not possible to get all socket-files in a folder, + * when used under fucking windows, + * we have to set a normal file so other readers know our socket exists + */ +var createSocketInfoFile = exports.createSocketInfoFile = function () { + var _ref2 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee2(channelName, readerUuid) { + var pathToFile; + return _regenerator2['default'].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return ensureFoldersExist(channelName); + + case 2: + pathToFile = socketInfoPath(channelName, readerUuid); + _context2.next = 5; + return writeFile(pathToFile, JSON.stringify({ + time: new Date().getTime() + })); + + case 5: + return _context2.abrupt('return', pathToFile); + + case 6: + case 'end': + return _context2.stop(); + } + } + }, _callee2, this); + })); + + return function createSocketInfoFile(_x2, _x3) { + return _ref2.apply(this, arguments); + }; +}(); + +/** + * creates the socket-file and subscribes to it + * @return {{emitter: EventEmitter, server: any}} + */ + + +var createSocketEventEmitter = exports.createSocketEventEmitter = function () { + var _ref3 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee3(channelName, readerUuid) { + var pathToSocket, emitter, server; + return _regenerator2['default'].wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + pathToSocket = socketPath(channelName, readerUuid); + emitter = new events.EventEmitter(); + server = net.createServer(function (stream) { + stream.on('end', function () { + // console.log('server: end'); + }); + + stream.on('data', function (msg) { + // console.log('server: got data:'); + // console.dir(msg.toString()); + emitter.emit('data', msg.toString()); + }); + }); + _context3.next = 5; + return new Promise(function (res) { + server.listen(pathToSocket, function () { + res(); + }); + }); + + case 5: + server.on('connection', function () { + // console.log('server: Client connected.'); + }); + + return _context3.abrupt('return', { + path: pathToSocket, + emitter: emitter, + server: server + }); + + case 7: + case 'end': + return _context3.stop(); + } + } + }, _callee3, this); + })); + + return function createSocketEventEmitter(_x4, _x5) { + return _ref3.apply(this, arguments); + }; +}(); + +var openClientConnection = exports.openClientConnection = function () { + var _ref4 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee4(channelName, readerUuid) { + var pathToSocket, client; + return _regenerator2['default'].wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + pathToSocket = socketPath(channelName, readerUuid); + client = new net.Socket(); + _context4.next = 4; + return new Promise(function (res) { + client.connect(pathToSocket, res); + }); + + case 4: + return _context4.abrupt('return', client); + + case 5: + case 'end': + return _context4.stop(); + } + } + }, _callee4, this); + })); + + return function openClientConnection(_x6, _x7) { + return _ref4.apply(this, arguments); + }; +}(); + +/** + * writes the new message to the file-system + * so other readers can find it + */ + + +var writeMessage = exports.writeMessage = function () { + var _ref5 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee5(channelName, readerUuid, messageJson) { + var time, writeObject, token, fileName, msgPath; + return _regenerator2['default'].wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + time = new Date().getTime(); + writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + token = (0, _util2.randomToken)(12); + fileName = time + '_' + readerUuid + '_' + token + '.json'; + msgPath = path.join(getPaths(channelName).messages, fileName); + _context5.next = 7; + return writeFile(msgPath, JSON.stringify(writeObject)); + + case 7: + return _context5.abrupt('return', { + time: time, + uuid: readerUuid, + token: token, + path: msgPath + }); + + case 8: + case 'end': + return _context5.stop(); + } + } + }, _callee5, this); + })); + + return function writeMessage(_x8, _x9, _x10) { + return _ref5.apply(this, arguments); + }; +}(); + +/** + * returns the uuids of all readers + * @return {string[]} + */ + + +var getReadersUuids = exports.getReadersUuids = function () { + var _ref6 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee6(channelName) { + var readersPath, files; + return _regenerator2['default'].wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + readersPath = getPaths(channelName).readers; + _context6.next = 3; + return readdir(readersPath); + + case 3: + files = _context6.sent; + return _context6.abrupt('return', files.map(function (file) { + return file.split('.'); + }).filter(function (split) { + return split[1] === 'json'; + }) // do not scan .socket-files + .map(function (split) { + return split[0]; + })); + + case 5: + case 'end': + return _context6.stop(); + } + } + }, _callee6, this); + })); + + return function getReadersUuids(_x11) { + return _ref6.apply(this, arguments); + }; +}(); + +var messagePath = exports.messagePath = function () { + var _ref7 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee7(channelName, time, token, writerUuid) { + var fileName, msgPath; + return _regenerator2['default'].wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + fileName = time + '_' + writerUuid + '_' + token + '.json'; + msgPath = path.join(getPaths(channelName).messages, fileName); + return _context7.abrupt('return', msgPath); + + case 3: + case 'end': + return _context7.stop(); + } + } + }, _callee7, this); + })); + + return function messagePath(_x12, _x13, _x14, _x15) { + return _ref7.apply(this, arguments); + }; +}(); + +var getAllMessages = exports.getAllMessages = function () { + var _ref8 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee8(channelName) { + var messagesPath, files; + return _regenerator2['default'].wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + messagesPath = getPaths(channelName).messages; + _context8.next = 3; + return readdir(messagesPath); + + case 3: + files = _context8.sent; + return _context8.abrupt('return', files.map(function (file) { + var fileName = file.split('.')[0]; + var split = fileName.split('_'); + + return { + path: path.join(messagesPath, file), + time: parseInt(split[0]), + senderUuid: split[1], + token: split[2] + }; + })); + + case 5: + case 'end': + return _context8.stop(); + } + } + }, _callee8, this); + })); + + return function getAllMessages(_x16) { + return _ref8.apply(this, arguments); + }; +}(); + +var readMessage = exports.readMessage = function () { + var _ref9 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee9(messageObj) { + var content; + return _regenerator2['default'].wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return readFile(messageObj.path, 'utf8'); + + case 2: + content = _context9.sent; + return _context9.abrupt('return', JSON.parse(content)); + + case 4: + case 'end': + return _context9.stop(); + } + } + }, _callee9, this); + })); + + return function readMessage(_x17) { + return _ref9.apply(this, arguments); + }; +}(); + +var cleanOldMessages = exports.cleanOldMessages = function () { + var _ref10 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee10(messageObjects, ttl) { + var olderThen; + return _regenerator2['default'].wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + olderThen = new Date().getTime() - ttl; + _context10.next = 3; + return Promise.all(messageObjects.filter(function (obj) { + return obj.time < olderThen; + }).map(function (obj) { + return unlink(obj.path)['catch'](function () { + return null; + }); + })); + + case 3: + case 'end': + return _context10.stop(); + } + } + }, _callee10, this); + })); + + return function cleanOldMessages(_x18, _x19) { + return _ref10.apply(this, arguments); + }; +}(); + +var create = exports.create = function () { + var _ref11 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee12(channelName) { + var _this = this; + + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var uuid, _ref12, _ref13, otherReaderUuids, socketEE, infoFilePath, otherReaderClients, readQueue, writeQueue, state; + + return _regenerator2['default'].wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + options = (0, _options.fillOptionsWithDefaults)(options); + + _context12.next = 3; + return ensureFoldersExist(channelName); + + case 3: + uuid = (0, _util2.randomToken)(10); + _context12.next = 6; + return Promise.all([getReadersUuids(channelName), createSocketEventEmitter(channelName, uuid), createSocketInfoFile(channelName, uuid)]); + + case 6: + _ref12 = _context12.sent; + _ref13 = (0, _slicedToArray3['default'])(_ref12, 3); + otherReaderUuids = _ref13[0]; + socketEE = _ref13[1]; + infoFilePath = _ref13[2]; + otherReaderClients = {}; + _context12.next = 14; + return Promise.all(otherReaderUuids.filter(function (readerUuid) { + return readerUuid !== uuid; + }) // not own + .map(function () { + var _ref14 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee11(readerUuid) { + var client; + return _regenerator2['default'].wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + _context11.next = 2; + return openClientConnection(channelName, readerUuid); + + case 2: + client = _context11.sent; + + otherReaderClients[readerUuid] = client; + + case 4: + case 'end': + return _context11.stop(); + } + } + }, _callee11, _this); + })); + + return function (_x22) { + return _ref14.apply(this, arguments); + }; + }())); + + case 14: + + // ensures we do not read messages in parrallel + readQueue = new _customIdleQueue2['default'](1); + writeQueue = new _customIdleQueue2['default'](1); + state = { + channelName: channelName, + options: options, + uuid: uuid, + socketEE: socketEE, + infoFilePath: infoFilePath, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallbackTime: null, + messagesCallback: null, + readQueue: readQueue, + writeQueue: writeQueue, + otherReaderUuids: otherReaderUuids, + otherReaderClients: otherReaderClients, + // ensure if process crashes, everything is cleaned up + removeUnload: _unload2['default'].add(function () { + return close(state); + }) + }; + + // when new message comes in, we read it and emit it + + socketEE.emitter.on('data', function (data) { + var obj = JSON.parse(data); + if (obj.a === 'msg') { + handleMessagePing(state, obj.d); + return; + } + }); + + return _context12.abrupt('return', state); + + case 19: + case 'end': + return _context12.stop(); + } + } + }, _callee12, this); + })); + + return function create(_x21) { + return _ref11.apply(this, arguments); + }; +}(); + +/** + * when the socket pings, so that we now new messages came, + * run this + */ + + +var handleMessagePing = exports.handleMessagePing = function () { + var _ref15 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee14(state) { + var _this2 = this; + + var msgObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + return _regenerator2['default'].wrap(function _callee14$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + if (state.messagesCallback) { + _context15.next = 2; + break; + } + + return _context15.abrupt('return'); + + case 2: + _context15.next = 4; + return state.readQueue.requestIdlePromise(); + + case 4: + _context15.next = 6; + return state.readQueue.wrapCall((0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee13() { + var messages, useMessages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step; + + return _regenerator2['default'].wrap(function _callee13$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + messages = void 0; + + if (msgObj) { + _context14.next = 7; + break; + } + + _context14.next = 4; + return getAllMessages(state.channelName); + + case 4: + messages = _context14.sent; + _context14.next = 8; + break; + + case 7: + // get single message + messages = [getSingleMessage(state.channelName, msgObj)]; + + case 8: + useMessages = messages.filter(function (msgObj) { + return msgObj.senderUuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.token); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + if (!state.messagesCallback) { + _context14.next = 35; + break; + } + + _iteratorNormalCompletion = true; + _didIteratorError = false; + _iteratorError = undefined; + _context14.prev = 13; + _loop = /*#__PURE__*/_regenerator2['default'].mark(function _loop() { + var msgObj, content; + return _regenerator2['default'].wrap(function _loop$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + msgObj = _step.value; + _context13.next = 3; + return readMessage(msgObj); + + case 3: + content = _context13.sent; + + state.emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.token); + }, state.options.node.ttl * 2); + + if (state.messagesCallback) { + state.messagesCallback(content.data); + } + + case 7: + case 'end': + return _context13.stop(); + } + } + }, _loop, _this2); + }); + _iterator = useMessages[Symbol.iterator](); + + case 16: + if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { + _context14.next = 21; + break; + } + + return _context14.delegateYield(_loop(), 't0', 18); + + case 18: + _iteratorNormalCompletion = true; + _context14.next = 16; + break; + + case 21: + _context14.next = 27; + break; + + case 23: + _context14.prev = 23; + _context14.t1 = _context14['catch'](13); + _didIteratorError = true; + _iteratorError = _context14.t1; + + case 27: + _context14.prev = 27; + _context14.prev = 28; + + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); + } + + case 30: + _context14.prev = 30; + + if (!_didIteratorError) { + _context14.next = 33; + break; + } + + throw _iteratorError; + + case 33: + return _context14.finish(30); + + case 34: + return _context14.finish(27); + + case 35: + case 'end': + return _context14.stop(); + } + } + }, _callee13, _this2, [[13, 23, 27, 35], [28,, 30, 34]]); + }))); + + case 6: + case 'end': + return _context15.stop(); + } + } + }, _callee14, this); + })); + + return function handleMessagePing(_x24) { + return _ref15.apply(this, arguments); + }; +}(); + +var refreshReaderClients = exports.refreshReaderClients = function () { + var _ref17 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee16(channelState) { + var _this3 = this; + + var otherReaders; + return _regenerator2['default'].wrap(function _callee16$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + _context17.next = 2; + return getReadersUuids(channelState.channelName); + + case 2: + otherReaders = _context17.sent; + + + // remove subscriptions to closed readers + Object.keys(channelState.otherReaderClients).filter(function (readerUuid) { + return !otherReaders.includes(readerUuid); + }).forEach(function (readerUuid) { + channelState.otherReaderClients[readerUuid].close(); + delete channelState.otherReaderClients[readerUuid]; + }); + + _context17.next = 6; + return Promise.all(otherReaders.filter(function (readerUuid) { + return readerUuid !== channelState.uuid; + }) // not own + .filter(function (readerUuid) { + return !channelState.otherReaderClients[readerUuid]; + }) // not already has client + .map(function () { + var _ref18 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee15(readerUuid) { + var client; + return _regenerator2['default'].wrap(function _callee15$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + _context16.next = 2; + return openClientConnection(channelState.channelName, readerUuid); + + case 2: + client = _context16.sent; + + channelState.otherReaderClients[readerUuid] = client; + + case 4: + case 'end': + return _context16.stop(); + } + } + }, _callee15, _this3); + })); + + return function (_x26) { + return _ref18.apply(this, arguments); + }; + }())); + + case 6: + case 'end': + return _context17.stop(); + } + } + }, _callee16, this); + })); + + return function refreshReaderClients(_x25) { + return _ref17.apply(this, arguments); + }; +}(); + +var postMessage = exports.postMessage = function () { + var _ref19 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee18(channelState, messageJson) { + var _this4 = this; + + return _regenerator2['default'].wrap(function _callee18$(_context19) { + while (1) { + switch (_context19.prev = _context19.next) { + case 0: + _context19.next = 2; + return channelState.writeQueue.requestIdlePromise(); + + case 2: + _context19.next = 4; + return channelState.writeQueue.wrapCall((0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee17() { + var msgObj, pingObj, messages; + return _regenerator2['default'].wrap(function _callee17$(_context18) { + while (1) { + switch (_context18.prev = _context18.next) { + case 0: + _context18.next = 2; + return refreshReaderClients(channelState); + + case 2: + _context18.next = 4; + return writeMessage(channelState.channelName, channelState.uuid, messageJson); + + case 4: + msgObj = _context18.sent; + + + // ping other readers + pingObj = { + a: 'msg', + d: { + t: msgObj.time, + u: msgObj.uuid, + to: msgObj.token + } + }; + _context18.next = 8; + return Promise.all(Object.values(channelState.otherReaderClients).map(function (client) { + return client.write(JSON.stringify(pingObj)); + })); + + case 8: + if (!((0, _util2.randomInt)(0, 10) === 0)) { + _context18.next = 14; + break; + } + + _context18.next = 11; + return getAllMessages(channelState.channelName); + + case 11: + messages = _context18.sent; + _context18.next = 14; + return cleanOldMessages(messages, channelState.options.node.ttl); + + case 14: + case 'end': + return _context18.stop(); + } + } + }, _callee17, _this4); + })) + + // emit to own eventEmitter + // channelState.socketEE.emitter.emit('data', JSON.parse(JSON.stringify(messageJson))); + ); + + case 4: + case 'end': + return _context19.stop(); + } + } + }, _callee18, this); + })); + + return function postMessage(_x27, _x28) { + return _ref19.apply(this, arguments); + }; +}(); + +var close = exports.close = function () { + var _ref21 = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee19(channelState) { + return _regenerator2['default'].wrap(function _callee19$(_context20) { + while (1) { + switch (_context20.prev = _context20.next) { + case 0: + channelState.removeUnload(); + channelState.socketEE.server.close(); + channelState.socketEE.emitter.removeAllListeners(); + channelState.readQueue.clear(); + channelState.writeQueue.clear(); + + _context20.next = 7; + return unlink(channelState.infoFilePath); + + case 7: + + Object.values(channelState.otherReaderClients).forEach(function (client) { + return client.destroy(); + }); + + case 8: + case 'end': + return _context20.stop(); + } + } + }, _callee19, this); + })); + + return function close(_x30) { + return _ref21.apply(this, arguments); + }; +}(); + +exports.cleanPipeName = cleanPipeName; +exports.getPaths = getPaths; +exports.socketPath = socketPath; +exports.socketInfoPath = socketInfoPath; +exports.getSingleMessage = getSingleMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _util = require('util'); + +var util = _interopRequireWildcard(_util); + +var _fs = require('fs'); + +var fs = _interopRequireWildcard(_fs); + +var _os = require('os'); + +var os = _interopRequireWildcard(_os); + +var _events = require('events'); + +var events = _interopRequireWildcard(_events); + +var _net = require('net'); + +var net = _interopRequireWildcard(_net); + +var _path = require('path'); + +var path = _interopRequireWildcard(_path); + +var _jsSha = require('js-sha3'); + +var _detectNode = require('detect-node'); + +var _detectNode2 = _interopRequireDefault(_detectNode); + +var _customIdleQueue = require('custom-idle-queue'); + +var _customIdleQueue2 = _interopRequireDefault(_customIdleQueue); + +var _unload = require('unload'); + +var _unload2 = _interopRequireDefault(_unload); + +var _options = require('../options'); + +var _util2 = require('../util'); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/** + * windows sucks, so we have handle windows-type of socket-paths + * @link https://gist.github.com/domenic/2790533#gistcomment-331356 + */ +/** + * this method is used in nodejs-environments. + * The ipc is handled via sockets and file-writes to the tmp-folder + */ + +function cleanPipeName(str) { + if (process.platform === 'win32' && !str.startsWith('\\\\.\\pipe\\')) { + str = str.replace(/^\//, ''); + str = str.replace(/\//g, '-'); + return '\\\\.\\pipe\\' + str; + } else { + return str; + } +}; + +var mkdir = util.promisify(fs.mkdir); +var writeFile = util.promisify(fs.writeFile); +var readFile = util.promisify(fs.readFile); +var unlink = util.promisify(fs.unlink); +var readdir = util.promisify(fs.readdir); + +var TMP_FOLDER_NAME = 'pubkey.broadcast-channel'; + +function getPaths(channelName) { + var folderPathBase = path.join(os.tmpdir(), TMP_FOLDER_NAME); + var channelPathBase = path.join(os.tmpdir(), TMP_FOLDER_NAME, (0, _jsSha.sha3_224)(channelName) // use hash incase of strange characters + ); + var folderPathReaders = path.join(channelPathBase, 'readers'); + var folderPathMessages = path.join(channelPathBase, 'messages'); + + return { + base: folderPathBase, + channelBase: channelPathBase, + readers: folderPathReaders, + messages: folderPathMessages + }; +} + +; + +function socketPath(channelName, readerUuid) { + + var paths = getPaths(channelName); + var socketPath = path.join(paths.readers, readerUuid + '.s'); + return cleanPipeName(socketPath); +} + +function socketInfoPath(channelName, readerUuid) { + var paths = getPaths(channelName); + var socketPath = path.join(paths.readers, readerUuid + '.json'); + return socketPath; +}function getSingleMessage(channelName, msgObj) { + var messagesPath = getPaths(channelName).messages; + + return { + path: path.join(messagesPath, msgObj.t + '_' + msgObj.u + '_' + msgObj.to + '.json'), + time: msgObj.t, + senderUuid: msgObj.u, + token: msgObj.to + }; +} + +var type = exports.type = 'node'; + +function onMessage(channelState, fn) { + var time = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Date().getTime(); + + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + handleMessagePing(channelState); +} + +function canBeUsed() { + return _detectNode2['default']; +}; \ No newline at end of file diff --git a/dist/lib/options.js b/dist/lib/options.js new file mode 100644 index 00000000..b9f7282e --- /dev/null +++ b/dist/lib/options.js @@ -0,0 +1,29 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fillOptionsWithDefaults = fillOptionsWithDefaults; +function fillOptionsWithDefaults(options) { + if (!options) options = {}; + options = JSON.parse(JSON.stringify(options)); + + // main + if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; + + // indexed-db + if (!options.idb) options.idb = {}; + // after this time the messages get deleted + if (!options.idb.ttl) options.idb.ttl = 1000 * 45; + if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 50; + + // localstorage + if (!options.localstorage) options.localstorage = {}; + if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; + + // node + if (!options.node) options.node = {}; + if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes; + + return options; +} \ No newline at end of file diff --git a/dist/lib/util.js b/dist/lib/util.js new file mode 100644 index 00000000..aed6bf8f --- /dev/null +++ b/dist/lib/util.js @@ -0,0 +1,42 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isPromise = isPromise; +exports.sleep = sleep; +exports.randomInt = randomInt; +exports.randomToken = randomToken; +/** + * returns true if the given object is a promise + */ +function isPromise(obj) { + if (obj && typeof obj.then === 'function') { + return true; + } else { + return false; + } +} + +function sleep(time) { + if (!time) time = 0; + return new Promise(function (res) { + return setTimeout(res, time); + }); +} + +function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +/** + * https://stackoverflow.com/a/1349426/3443137 + */ +function randomToken(length) { + var text = ''; + var possible = 'abcdefghijklmnopqrstuvwxzy0123456789'; + + for (var i = 0; i < 5; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + }return text; +} \ No newline at end of file diff --git a/docs/iframe.html b/docs/iframe.html new file mode 100644 index 00000000..3f670f6e --- /dev/null +++ b/docs/iframe.html @@ -0,0 +1,8 @@ + + + +
+ + + + \ No newline at end of file diff --git a/docs/iframe.js b/docs/iframe.js new file mode 100644 index 00000000..02fa503b --- /dev/null +++ b/docs/iframe.js @@ -0,0 +1,8422 @@ +(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 setTimeout(res, this.options.prepareDelay)); + }*/ + channel._state = s; + }); + } else { + channel._state = maybePromise; + } +} + +function _hasMessageListeners(channel) { + if (channel._addEventListeners.message.length > 0) return true; + if (channel._addEventListeners.internal.length > 0) return true; + return false; +} + +function _addListenerObject(channel, type, obj) { + channel._addEventListeners[type].push(obj); + _startListening(channel); +} +function _removeListenerObject(channel, type, obj) { + channel._addEventListeners[type] = channel._addEventListeners[type].filter(function (o) { + return o !== obj; + }); + _stopListening(channel); +} + +function _startListening(channel) { + if (!channel._isListening && _hasMessageListeners(channel)) { + // someone is listening, start subscribing + + var listenerFn = function listenerFn(msgObj) { + channel._addEventListeners[msgObj.type].forEach(function (obj) { + if (msgObj.time >= obj.time) { + obj.fn(msgObj.data); + }; + }); + }; + + var time = new Date().getTime() - 5; + if (channel._preparePromise) { + channel._preparePromise.then(function () { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + }); + } else { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + } + } +} + +function _stopListening(channel) { + if (channel._isListening && !_hasMessageListeners(channel)) { + // noone is listening, stop subscribing + channel._isListening = false; + var time = new Date().getTime() - 5; + channel.method.onMessage(channel._state, null, time); + } +} + +exports['default'] = BroadcastChannel; +},{"./method-chooser.js":3,"./options.js":7,"./util.js":8}],3:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.chooseMethod = chooseMethod; +var isNode = require('detect-node'); + +var NativeMethod = require('./methods/native.js'); +var IndexeDbMethod = require('./methods/indexed-db.js'); +var LocalstorageMethod = require('./methods/localstorage.js'); + +// order is important +var METHODS = [NativeMethod, // fastest +IndexeDbMethod, LocalstorageMethod]; + +var REQUIRE_FUN = require; + +/** + * The NodeMethod is loaded lazy + * so it will not get bundled in browser-builds + */ +if (isNode) { + var NodeMethod = REQUIRE_FUN('./methods/node.js'); + METHODS.push(NodeMethod); +} + +function chooseMethod(options) { + // directly chosen + if (options.type) { + var ret = METHODS.find(function (m) { + return m.type === options.type; + }); + if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret; + } + + var chooseMethods = METHODS; + if (!options.webWorkerSupport && !isNode) { + // prefer localstorage over idb when no webworker-support needed + chooseMethods = METHODS.filter(function (m) { + return m.type !== 'idb'; + }); + } + + var useMethod = chooseMethods.find(function (method) { + return method.canBeUsed(); + }); + if (!useMethod) throw new Error('No useable methode found:' + JSON.stringify(METHODS.map(function (m) { + return m.type; + })));else return useMethod; +} +},{"./methods/indexed-db.js":4,"./methods/localstorage.js":5,"./methods/native.js":6,"detect-node":335}],4:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getIdb = getIdb; +exports.createDatabase = createDatabase; +exports.writeMessage = writeMessage; +exports.getAllMessages = getAllMessages; +exports.getMessagesHigherThen = getMessagesHigherThen; +exports.removeMessageById = removeMessageById; +exports.getOldMessages = getOldMessages; +exports.cleanOldMessages = cleanOldMessages; +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _util = require('../util.js'); + +var _options = require('../options'); + +/** + * this method uses indexeddb to store the messages + * There is currently no observerAPI for idb + * @link https://github.com/w3c/IndexedDB/issues/51 + */ + +var isNode = require('detect-node'); + +var DB_PREFIX = 'pubkey.broadcast-channel-0-'; +var OBJECT_STORE_ID = 'messages'; + +var type = exports.type = 'idb'; + +function getIdb() { + if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof mozIndexedDB !== 'undefined') return mozIndexedDB; + if (typeof webkitIndexedDB !== 'undefined') return webkitIndexedDB; + if (typeof msIndexedDB !== 'undefined') return msIndexedDB; + + return false; +} + +function createDatabase(channelName) { + var IndexedDB = getIdb(); + + // create table + var dbName = DB_PREFIX + channelName; + var openRequest = IndexedDB.open(dbName, 1); + + openRequest.onupgradeneeded = function (ev) { + var db = ev.target.result; + db.createObjectStore(OBJECT_STORE_ID, { + keyPath: 'id', + autoIncrement: true + }); + }; + var dbPromise = new Promise(function (res, rej) { + openRequest.onerror = function (ev) { + return rej(ev); + }; + openRequest.onsuccess = function () { + res(openRequest.result); + }; + }); + + return dbPromise; +} + +/** + * writes the new message to the database + * so other readers can find it + */ +function writeMessage(db, readerUuid, messageJson) { + var time = new Date().getTime(); + var writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + + var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); + + return new Promise(function (res, rej) { + transaction.oncomplete = function () { + return res(); + }; + transaction.onerror = function (ev) { + return rej(ev); + }; + + var objectStore = transaction.objectStore(OBJECT_STORE_ID); + objectStore.add(writeObject); + }); +} + +function getAllMessages(db) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function getMessagesHigherThen(db, lastCursorId) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity); + return new Promise(function (res) { + objectStore.openCursor(keyRangeValue).onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function removeMessageById(db, id) { + var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)['delete'](id); + return new Promise(function (res) { + request.onsuccess = function () { + return res(); + }; + }); +} + +function getOldMessages(db, ttl) { + var olderThen = new Date().getTime() - ttl; + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + var msgObk = cursor.value; + if (msgObk.time < olderThen) { + ret.push(msgObk); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + // no more old messages, + res(ret); + return; + } + } else { + res(ret); + } + }; + }); +} + +function cleanOldMessages(db, ttl) { + return getOldMessages(db, ttl).then(function (tooOld) { + return Promise.all(tooOld.map(function (msgObj) { + return removeMessageById(db, msgObj.id); + })); + }); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + + var uuid = (0, _util.randomToken)(10); + + return createDatabase(channelName).then(function (db) { + var state = { + closed: false, + lastCursorId: 0, + channelName: channelName, + options: options, + uuid: uuid, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallback: null, + readQueuePromises: [], + db: db + }; + + /** + * if service-workers are used, + * we have no 'storage'-event if they post a message, + * therefore we also have to set an interval + */ + _readLoop(state); + + return state; + }); +} + +function _readLoop(state) { + if (state.closed) return; + + return readNewMessages(state).then(function () { + return (0, _util.sleep)(state.options.idb.fallbackInterval); + }).then(function () { + return _readLoop(state); + }); +} + +/** + * reads all new messages from the database and emits them + */ +function readNewMessages(state) { + return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessages) { + var useMessages = newerMessages.map(function (msgObj) { + if (msgObj.id > state.lastCursorId) { + state.lastCursorId = msgObj.id; + } + return msgObj; + }).filter(function (msgObj) { + return msgObj.uuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.id); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + + useMessages.forEach(function (msgObj) { + if (state.messagesCallback) { + state.emittedMessagesIds.add(msgObj.id); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.id); + }, state.options.idb.ttl * 2); + + state.messagesCallback(msgObj.data); + } + }); + + return Promise.resolve(); + }); +} + +function close(channelState) { + channelState.closed = true; + channelState.db.close(); +} + +function postMessage(channelState, messageJson) { + return writeMessage(channelState.db, channelState.uuid, messageJson).then(function () { + if ((0, _util.randomInt)(0, 10) === 0) { + /* await (do not await) */cleanOldMessages(channelState.db, channelState.options.idb.ttl); + } + }); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + readNewMessages(channelState); +} + +function canBeUsed() { + if (isNode) return false; + var idb = getIdb(); + + if (!idb) return false; + return true; +}; +},{"../options":7,"../util.js":8,"detect-node":335}],5:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getLocalStorage = getLocalStorage; +exports.storageKey = storageKey; +exports.postMessage = postMessage; +exports.addStorageEventListener = addStorageEventListener; +exports.removeStorageEventListener = removeStorageEventListener; +exports.create = create; +exports.close = close; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _options = require('../options'); + +var _util = require('../util'); + +/** + * A localStorage-only method which uses localstorage and its 'storage'-event + * This does not work inside of webworkers because they have no access to locastorage + * This is basically implemented to support IE9 or your grandmothers toaster. + * @link https://caniuse.com/#feat=namevalue-storage + * @link https://caniuse.com/#feat=indexeddb + */ + +var isNode = require('detect-node'); + +var KEY_PREFIX = 'pubkey.broadcastChannel-'; +var type = exports.type = 'localstorage'; + +/** + * copied from crosstab + * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32 + */ +function getLocalStorage() { + var localStorage = void 0; + if (typeof window === 'undefined') return null; + try { + localStorage = window.localStorage; + localStorage = window['ie8-eventlistener/storage'] || window.localStorage; + } catch (e) { + // New versions of Firefox throw a Security exception + // if cookies are disabled. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153 + } + return localStorage; +} + +function storageKey(channelName) { + return KEY_PREFIX + channelName; +} + +/** +* writes the new message to the storage +* and fires the storage-event so other readers can find it +*/ +function postMessage(channelState, messageJson) { + return new Promise(function (res) { + (0, _util.sleep)().then(function () { + var key = storageKey(channelState.channelName); + var writeObj = { + token: (0, _util.randomToken)(10), + time: new Date().getTime(), + data: messageJson, + uuid: channelState.uuid + }; + var value = JSON.stringify(writeObj); + localStorage.setItem(key, value); + + /** + * StorageEvent does not fire the 'storage' event + * in the window that changes the state of the local storage. + * So we fire it manually + */ + var ev = document.createEvent('Event'); + ev.initEvent('storage', true, true); + ev.key = key; + ev.newValue = value; + window.dispatchEvent(ev); + + res(); + }); + }); +} + +function addStorageEventListener(channelName, fn) { + var key = storageKey(channelName); + var listener = function listener(ev) { + if (ev.key === key) { + fn(JSON.parse(ev.newValue)); + } + }; + window.addEventListener('storage', listener); + return listener; +} +function removeStorageEventListener(listener) { + window.removeEventListener('storage', listener); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + if (!canBeUsed()) { + throw new Error('BroadcastChannel: localstorage cannot be used'); + } + + var startTime = new Date().getTime(); + var uuid = (0, _util.randomToken)(10); + + // contains all messages that have been emitted before + var emittedMessagesIds = new Set(); + + var state = { + startTime: startTime, + channelName: channelName, + options: options, + uuid: uuid, + emittedMessagesIds: emittedMessagesIds + }; + + state.listener = addStorageEventListener(channelName, function (msgObj) { + if (!state.messagesCallback) return; // no listener + if (msgObj.uuid === uuid) return; // own message + if (!msgObj.token || emittedMessagesIds.has(msgObj.token)) return; // already emitted + if (msgObj.time && msgObj.time < state.messagesCallbackTime) return; // too old + + emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return emittedMessagesIds['delete'](msgObj.token); + }, options.localstorage.removeTimeout); + state.messagesCallback(msgObj.data); + }); + + return state; +} + +function close(channelState) { + removeStorageEventListener(channelState.listener); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + var ls = getLocalStorage(); + + if (!ls) return false; + return true; +}; +},{"../options":7,"../util":8,"detect-node":335}],6:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; +var isNode = require('detect-node'); + +var type = exports.type = 'native'; + +function create(channelName, options) { + if (!options) options = {}; + var state = { + channelName: channelName, + options: options, + messagesCallback: null, + bc: new BroadcastChannel(channelName), + subscriberFunctions: [] + }; + + state.bc.onmessage = function (msg) { + if (state.messagesCallback) { + state.messagesCallback(msg.data); + } + }; + + return state; +}; + +function close(channelState) { + channelState.bc.close(); + channelState.subscriberFunctions = []; +} + +function postMessage(channelState, messageJson) { + channelState.bc.postMessage(messageJson, false); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + + if (typeof BroadcastChannel === 'function') return true; +}; +},{"detect-node":335}],7:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fillOptionsWithDefaults = fillOptionsWithDefaults; +function fillOptionsWithDefaults(options) { + if (!options) options = {}; + options = JSON.parse(JSON.stringify(options)); + + // main + if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; + + // indexed-db + if (!options.idb) options.idb = {}; + // after this time the messages get deleted + if (!options.idb.ttl) options.idb.ttl = 1000 * 45; + if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 50; + + // localstorage + if (!options.localstorage) options.localstorage = {}; + if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; + + // node + if (!options.node) options.node = {}; + if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes; + + return options; +} +},{}],8:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isPromise = isPromise; +exports.sleep = sleep; +exports.randomInt = randomInt; +exports.randomToken = randomToken; +/** + * returns true if the given object is a promise + */ +function isPromise(obj) { + if (obj && typeof obj.then === 'function') { + return true; + } else { + return false; + } +} + +function sleep(time) { + if (!time) time = 0; + return new Promise(function (res) { + return setTimeout(res, time); + }); +} + +function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +/** + * https://stackoverflow.com/a/1349426/3443137 + */ +function randomToken(length) { + var text = ''; + var possible = 'abcdefghijklmnopqrstuvwxzy0123456789'; + + for (var i = 0; i < 5; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + }return text; +} +},{}],9:[function(require,module,exports){ +(function (global){ +"use strict"; + +require("core-js/shim"); + +require("regenerator-runtime/runtime"); + +require("core-js/fn/regexp/escape"); + +if (global._babelPolyfill) { + throw new Error("only one instance of babel-polyfill is allowed"); +} +global._babelPolyfill = true; + +var DEFINE_PROPERTY = "defineProperty"; +function define(O, key, value) { + O[key] || Object[DEFINE_PROPERTY](O, key, { + writable: true, + configurable: true, + value: value + }); +} + +define(String.prototype, "padLeft", "".padStart); +define(String.prototype, "padRight", "".padEnd); + +"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) { + [][key] && define(Array, key, Function.call.bind([][key])); +}); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"core-js/fn/regexp/escape":11,"core-js/shim":334,"regenerator-runtime/runtime":10}],10:[function(require,module,exports){ +(function (global){ +/** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + if (typeof global.process === "object" && global.process.domain) { + invoke = global.process.domain.bind(invoke); + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // Among the various tricks for obtaining a reference to the global + // object, this seems to be the most reliable technique that does not + // use indirect eval (which violates Content Security Policy). + typeof global === "object" ? global : + typeof window === "object" ? window : + typeof self === "object" ? self : this +); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],11:[function(require,module,exports){ +require('../../modules/core.regexp.escape'); +module.exports = require('../../modules/_core').RegExp.escape; + +},{"../../modules/_core":32,"../../modules/core.regexp.escape":137}],12:[function(require,module,exports){ +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +},{}],13:[function(require,module,exports){ +var cof = require('./_cof'); +module.exports = function (it, msg) { + if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg); + return +it; +}; + +},{"./_cof":27}],14:[function(require,module,exports){ +// 22.1.3.31 Array.prototype[@@unscopables] +var UNSCOPABLES = require('./_wks')('unscopables'); +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {}); +module.exports = function (key) { + ArrayProto[UNSCOPABLES][key] = true; +}; + +},{"./_hide":51,"./_wks":135}],15:[function(require,module,exports){ +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { + throw TypeError(name + ': incorrect invocation!'); + } return it; +}; + +},{}],16:[function(require,module,exports){ +var isObject = require('./_is-object'); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +},{"./_is-object":60}],17:[function(require,module,exports){ +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +'use strict'; +var toObject = require('./_to-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); + +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 = Math.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; +}; + +},{"./_to-absolute-index":120,"./_to-length":124,"./_to-object":125}],18:[function(require,module,exports){ +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +'use strict'; +var toObject = require('./_to-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +module.exports = function fill(value /* , start = 0, end = @length */) { + var O = toObject(this); + var length = toLength(O.length); + var aLen = arguments.length; + var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); + var end = aLen > 2 ? arguments[2] : undefined; + var endPos = end === undefined ? length : toAbsoluteIndex(end, length); + while (endPos > index) O[index++] = value; + return O; +}; + +},{"./_to-absolute-index":120,"./_to-length":124,"./_to-object":125}],19:[function(require,module,exports){ +var forOf = require('./_for-of'); + +module.exports = function (iter, ITERATOR) { + var result = []; + forOf(iter, false, result.push, result, ITERATOR); + return result; +}; + +},{"./_for-of":48}],20:[function(require,module,exports){ +// false -> Array#indexOf +// true -> Array#includes +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); +var toAbsoluteIndex = require('./_to-absolute-index'); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($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) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + +},{"./_to-absolute-index":120,"./_to-iobject":123,"./_to-length":124}],21:[function(require,module,exports){ +// 0 -> Array#forEach +// 1 -> Array#map +// 2 -> Array#filter +// 3 -> Array#some +// 4 -> Array#every +// 5 -> Array#find +// 6 -> Array#findIndex +var ctx = require('./_ctx'); +var IObject = require('./_iobject'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var asc = require('./_array-species-create'); +module.exports = function (TYPE, $create) { + 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; + var create = $create || asc; + return function ($this, callbackfn, that) { + var O = toObject($this); + var self = IObject(O); + var f = ctx(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var val, res; + for (;length > index; index++) if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; +}; + +},{"./_array-species-create":24,"./_ctx":34,"./_iobject":56,"./_to-length":124,"./_to-object":125}],22:[function(require,module,exports){ +var aFunction = require('./_a-function'); +var toObject = require('./_to-object'); +var IObject = require('./_iobject'); +var toLength = require('./_to-length'); + +module.exports = function (that, callbackfn, aLen, memo, isRight) { + aFunction(callbackfn); + var O = toObject(that); + var self = IObject(O); + var length = toLength(O.length); + var index = isRight ? length - 1 : 0; + var i = isRight ? -1 : 1; + if (aLen < 2) for (;;) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (isRight ? index < 0 : length <= index) { + throw TypeError('Reduce of empty array with no initial value'); + } + } + for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; +}; + +},{"./_a-function":12,"./_iobject":56,"./_to-length":124,"./_to-object":125}],23:[function(require,module,exports){ +var isObject = require('./_is-object'); +var isArray = require('./_is-array'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (original) { + var C; + if (isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + } return C === undefined ? Array : C; +}; + +},{"./_is-array":58,"./_is-object":60,"./_wks":135}],24:[function(require,module,exports){ +// 9.4.2.3 ArraySpeciesCreate(originalArray, length) +var speciesConstructor = require('./_array-species-constructor'); + +module.exports = function (original, length) { + return new (speciesConstructor(original))(length); +}; + +},{"./_array-species-constructor":23}],25:[function(require,module,exports){ +'use strict'; +var aFunction = require('./_a-function'); +var isObject = require('./_is-object'); +var invoke = require('./_invoke'); +var arraySlice = [].slice; +var factories = {}; + +var construct = function (F, len, args) { + if (!(len in factories)) { + for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; + // eslint-disable-next-line no-new-func + factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); + } return factories[len](F, args); +}; + +module.exports = Function.bind || function bind(that /* , ...args */) { + var fn = aFunction(this); + var partArgs = arraySlice.call(arguments, 1); + var bound = function (/* args... */) { + var args = partArgs.concat(arraySlice.call(arguments)); + return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); + }; + if (isObject(fn.prototype)) bound.prototype = fn.prototype; + return bound; +}; + +},{"./_a-function":12,"./_invoke":55,"./_is-object":60}],26:[function(require,module,exports){ +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = require('./_cof'); +var TAG = require('./_wks')('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +},{"./_cof":27,"./_wks":135}],27:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + +},{}],28:[function(require,module,exports){ +'use strict'; +var dP = require('./_object-dp').f; +var create = require('./_object-create'); +var redefineAll = require('./_redefine-all'); +var ctx = require('./_ctx'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var $iterDefine = require('./_iter-define'); +var step = require('./_iter-step'); +var setSpecies = require('./_set-species'); +var DESCRIPTORS = require('./_descriptors'); +var fastKey = require('./_meta').fastKey; +var validate = require('./_validate-collection'); +var SIZE = DESCRIPTORS ? '_s' : 'size'; + +var getEntry = function (that, key) { + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = create(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function (key) { + var that = validate(this, NAME); + var entry = getEntry(that, key); + if (entry) { + var next = entry.n; + var prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + 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 */) { + validate(this, NAME); + var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var entry; + while (entry = entry ? entry.n : this._f) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(validate(this, NAME), key); + } + }); + if (DESCRIPTORS) dP(C.prototype, 'size', { + get: function () { + return validate(this, NAME)[SIZE]; + } + }); + return C; + }, + def: function (that, key, value) { + var entry = getEntry(that, key); + var prev, index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that._l, // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + } return that; + }, + getEntry: getEntry, + setStrong: function (C, NAME, IS_MAP) { + // 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 + $iterDefine(C, NAME, function (iterated, kind) { + this._t = validate(iterated, NAME); // target + this._k = kind; // kind + this._l = undefined; // previous + }, function () { + var that = this; + var kind = that._k; + var entry = that._l; + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return step(1); + } + // return step by kind + if (kind == 'keys') return step(0, entry.k); + if (kind == 'values') return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // add [@@species], 23.1.2.2, 23.2.2.2 + setSpecies(NAME); + } +}; + +},{"./_an-instance":15,"./_ctx":34,"./_descriptors":38,"./_for-of":48,"./_iter-define":64,"./_iter-step":66,"./_meta":74,"./_object-create":79,"./_object-dp":80,"./_redefine-all":99,"./_set-species":106,"./_validate-collection":132}],29:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var classof = require('./_classof'); +var from = require('./_array-from-iterable'); +module.exports = function (NAME) { + return function toJSON() { + if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); + return from(this); + }; +}; + +},{"./_array-from-iterable":19,"./_classof":26}],30:[function(require,module,exports){ +'use strict'; +var redefineAll = require('./_redefine-all'); +var getWeak = require('./_meta').getWeak; +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var createArrayMethod = require('./_array-methods'); +var $has = require('./_has'); +var validate = require('./_validate-collection'); +var arrayFind = createArrayMethod(5); +var arrayFindIndex = createArrayMethod(6); +var id = 0; + +// fallback for uncaught frozen keys +var uncaughtFrozenStore = function (that) { + return that._l || (that._l = new UncaughtFrozenStore()); +}; +var UncaughtFrozenStore = function () { + this.a = []; +}; +var findUncaughtFrozen = function (store, key) { + return arrayFind(store.a, function (it) { + return it[0] === key; + }); +}; +UncaughtFrozenStore.prototype = { + get: function (key) { + var entry = findUncaughtFrozen(this, key); + if (entry) return entry[1]; + }, + has: function (key) { + return !!findUncaughtFrozen(this, key); + }, + set: function (key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) entry[1] = value; + else this.a.push([key, value]); + }, + 'delete': function (key) { + var index = arrayFindIndex(this.a, function (it) { + return it[0] === key; + }); + if (~index) this.a.splice(index, 1); + return !!~index; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = id++; // collection id + that._l = undefined; // leak store for uncaught frozen objects + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.3.3.2 WeakMap.prototype.delete(key) + // 23.4.3.3 WeakSet.prototype.delete(value) + 'delete': function (key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); + return data && $has(data, this._i) && delete data[this._i]; + }, + // 23.3.3.4 WeakMap.prototype.has(key) + // 23.4.3.4 WeakSet.prototype.has(value) + has: function has(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); + return data && $has(data, this._i); + } + }); + return C; + }, + def: function (that, key, value) { + var data = getWeak(anObject(key), true); + if (data === true) uncaughtFrozenStore(that).set(key, value); + else data[that._i] = value; + return that; + }, + ufstore: uncaughtFrozenStore +}; + +},{"./_an-instance":15,"./_an-object":16,"./_array-methods":21,"./_for-of":48,"./_has":50,"./_is-object":60,"./_meta":74,"./_redefine-all":99,"./_validate-collection":132}],31:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var redefineAll = require('./_redefine-all'); +var meta = require('./_meta'); +var forOf = require('./_for-of'); +var anInstance = require('./_an-instance'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var $iterDetect = require('./_iter-detect'); +var setToStringTag = require('./_set-to-string-tag'); +var inheritIfRequired = require('./_inherit-if-required'); + +module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = global[NAME]; + var C = Base; + var ADDER = IS_MAP ? 'set' : 'add'; + var proto = C && C.prototype; + var O = {}; + var fixMethod = function (KEY) { + var fn = proto[KEY]; + redefine(proto, KEY, + KEY == 'delete' ? function (a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'has' ? function has(a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'get' ? function get(a) { + return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } + : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } + ); + }; + if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { + new C().entries().next(); + }))) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + var instance = new C(); + // 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 + var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new + // 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 C(); + var index = 5; + while (index--) $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + C = wrapper(function (target, iterable) { + anInstance(target, C, NAME); + var that = inheritIfRequired(new Base(), target, C); + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + 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 && proto.clear) delete proto.clear; + } + + setToStringTag(C, NAME); + + O[NAME] = C; + $export($export.G + $export.W + $export.F * (C != Base), O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; +}; + +},{"./_an-instance":15,"./_export":42,"./_fails":44,"./_for-of":48,"./_global":49,"./_inherit-if-required":54,"./_is-object":60,"./_iter-detect":65,"./_meta":74,"./_redefine":100,"./_redefine-all":99,"./_set-to-string-tag":107}],32:[function(require,module,exports){ +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + +},{}],33:[function(require,module,exports){ +'use strict'; +var $defineProperty = require('./_object-dp'); +var createDesc = require('./_property-desc'); + +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; +}; + +},{"./_object-dp":80,"./_property-desc":98}],34:[function(require,module,exports){ +// optional / simple context binding +var aFunction = require('./_a-function'); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + 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); + }; +}; + +},{"./_a-function":12}],35:[function(require,module,exports){ +'use strict'; +// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() +var fails = require('./_fails'); +var getTime = Date.prototype.getTime; +var $toISOString = Date.prototype.toISOString; + +var lz = function (num) { + return num > 9 ? num : '0' + num; +}; + +// PhantomJS / old WebKit has a broken implementations +module.exports = (fails(function () { + return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; +}) || !fails(function () { + $toISOString.call(new Date(NaN)); +})) ? function toISOString() { + if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); + var d = this; + var y = d.getUTCFullYear(); + var m = d.getUTCMilliseconds(); + var s = y < 0 ? '-' : y > 9999 ? '+' : ''; + return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; +} : $toISOString; + +},{"./_fails":44}],36:[function(require,module,exports){ +'use strict'; +var anObject = require('./_an-object'); +var toPrimitive = require('./_to-primitive'); +var NUMBER = 'number'; + +module.exports = function (hint) { + if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint'); + return toPrimitive(anObject(this), hint != NUMBER); +}; + +},{"./_an-object":16,"./_to-primitive":126}],37:[function(require,module,exports){ +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +},{}],38:[function(require,module,exports){ +// Thank's IE8 for his funny defineProperty +module.exports = !require('./_fails')(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_fails":44}],39:[function(require,module,exports){ +var isObject = require('./_is-object'); +var document = require('./_global').document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + +},{"./_global":49,"./_is-object":60}],40:[function(require,module,exports){ +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + +},{}],41:[function(require,module,exports){ +// all enumerable object keys, includes symbols +var getKeys = require('./_object-keys'); +var gOPS = require('./_object-gops'); +var pIE = require('./_object-pie'); +module.exports = function (it) { + var result = getKeys(it); + var getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it); + var isEnum = pIE.f; + var i = 0; + var key; + while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); + } return result; +}; + +},{"./_object-gops":86,"./_object-keys":89,"./_object-pie":90}],42:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var hide = require('./_hide'); +var redefine = require('./_redefine'); +var ctx = require('./_ctx'); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // extend global + if (target) redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +global.core = core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + +},{"./_core":32,"./_ctx":34,"./_global":49,"./_hide":51,"./_redefine":100}],43:[function(require,module,exports){ +var MATCH = require('./_wks')('match'); +module.exports = function (KEY) { + var re = /./; + try { + '/./'[KEY](re); + } catch (e) { + try { + re[MATCH] = false; + return !'/./'[KEY](re); + } catch (f) { /* empty */ } + } return true; +}; + +},{"./_wks":135}],44:[function(require,module,exports){ +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +},{}],45:[function(require,module,exports){ +'use strict'; +var hide = require('./_hide'); +var redefine = require('./_redefine'); +var fails = require('./_fails'); +var defined = require('./_defined'); +var wks = require('./_wks'); + +module.exports = function (KEY, length, exec) { + var SYMBOL = wks(KEY); + var fns = exec(defined, SYMBOL, ''[KEY]); + var strfn = fns[0]; + var rxfn = fns[1]; + if (fails(function () { + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + })) { + redefine(String.prototype, KEY, strfn); + hide(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 rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return rxfn.call(string, this); } + ); + } +}; + +},{"./_defined":37,"./_fails":44,"./_hide":51,"./_redefine":100,"./_wks":135}],46:[function(require,module,exports){ +'use strict'; +// 21.2.5.3 get RegExp.prototype.flags +var anObject = require('./_an-object'); +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.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; +}; + +},{"./_an-object":16}],47:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray +var isArray = require('./_is-array'); +var isObject = require('./_is-object'); +var toLength = require('./_to-length'); +var ctx = require('./_ctx'); +var IS_CONCAT_SPREADABLE = require('./_wks')('isConcatSpreadable'); + +function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) { + var targetIndex = start; + var sourceIndex = 0; + var mapFn = mapper ? ctx(mapper, thisArg, 3) : false; + var element, spreadable; + + while (sourceIndex < sourceLen) { + if (sourceIndex in source) { + element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; + + spreadable = false; + if (isObject(element)) { + spreadable = element[IS_CONCAT_SPREADABLE]; + spreadable = spreadable !== undefined ? !!spreadable : isArray(element); + } + + if (spreadable && depth > 0) { + targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; + } else { + if (targetIndex >= 0x1fffffffffffff) throw TypeError(); + target[targetIndex] = element; + } + + targetIndex++; + } + sourceIndex++; + } + return targetIndex; +} + +module.exports = flattenIntoArray; + +},{"./_ctx":34,"./_is-array":58,"./_is-object":60,"./_to-length":124,"./_wks":135}],48:[function(require,module,exports){ +var ctx = require('./_ctx'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var anObject = require('./_an-object'); +var toLength = require('./_to-length'); +var getIterFn = require('./core.get-iterator-method'); +var BREAK = {}; +var RETURN = {}; +var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); + var f = ctx(fn, that, entries ? 2 : 1); + var index = 0; + var length, step, iterator, result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } +}; +exports.BREAK = BREAK; +exports.RETURN = RETURN; + +},{"./_an-object":16,"./_ctx":34,"./_is-array-iter":57,"./_iter-call":62,"./_to-length":124,"./core.get-iterator-method":136}],49:[function(require,module,exports){ +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + +},{}],50:[function(require,module,exports){ +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +},{}],51:[function(require,module,exports){ +var dP = require('./_object-dp'); +var createDesc = require('./_property-desc'); +module.exports = require('./_descriptors') ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +},{"./_descriptors":38,"./_object-dp":80,"./_property-desc":98}],52:[function(require,module,exports){ +var document = require('./_global').document; +module.exports = document && document.documentElement; + +},{"./_global":49}],53:[function(require,module,exports){ +module.exports = !require('./_descriptors') && !require('./_fails')(function () { + return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_descriptors":38,"./_dom-create":39,"./_fails":44}],54:[function(require,module,exports){ +var isObject = require('./_is-object'); +var setPrototypeOf = require('./_set-proto').set; +module.exports = function (that, target, C) { + var S = target.constructor; + var P; + if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { + setPrototypeOf(that, P); + } return that; +}; + +},{"./_is-object":60,"./_set-proto":105}],55:[function(require,module,exports){ +// fast apply, http://jsperf.lnkit.com/fast-apply/5 +module.exports = function (fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: return un ? fn() + : fn.call(that); + case 1: return un ? fn(args[0]) + : fn.call(that, args[0]); + case 2: return un ? fn(args[0], args[1]) + : fn.call(that, args[0], args[1]); + case 3: return un ? fn(args[0], args[1], args[2]) + : fn.call(that, args[0], args[1], args[2]); + case 4: return un ? fn(args[0], args[1], args[2], args[3]) + : fn.call(that, args[0], args[1], args[2], args[3]); + } return fn.apply(that, args); +}; + +},{}],56:[function(require,module,exports){ +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = require('./_cof'); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + +},{"./_cof":27}],57:[function(require,module,exports){ +// check on default Array iterator +var Iterators = require('./_iterators'); +var ITERATOR = require('./_wks')('iterator'); +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + +},{"./_iterators":67,"./_wks":135}],58:[function(require,module,exports){ +// 7.2.2 IsArray(argument) +var cof = require('./_cof'); +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; + +},{"./_cof":27}],59:[function(require,module,exports){ +// 20.1.2.3 Number.isInteger(number) +var isObject = require('./_is-object'); +var floor = Math.floor; +module.exports = function isInteger(it) { + return !isObject(it) && isFinite(it) && floor(it) === it; +}; + +},{"./_is-object":60}],60:[function(require,module,exports){ +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +},{}],61:[function(require,module,exports){ +// 7.2.8 IsRegExp(argument) +var isObject = require('./_is-object'); +var cof = require('./_cof'); +var MATCH = require('./_wks')('match'); +module.exports = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); +}; + +},{"./_cof":27,"./_is-object":60,"./_wks":135}],62:[function(require,module,exports){ +// call something on iterator step with safe closing on error +var anObject = require('./_an-object'); +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 (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + +},{"./_an-object":16}],63:[function(require,module,exports){ +'use strict'; +var create = require('./_object-create'); +var descriptor = require('./_property-desc'); +var setToStringTag = require('./_set-to-string-tag'); +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + +},{"./_hide":51,"./_object-create":79,"./_property-desc":98,"./_set-to-string-tag":107,"./_wks":135}],64:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var $iterCreate = require('./_iter-create'); +var setToStringTag = require('./_set-to-string-tag'); +var getPrototypeOf = require('./_object-gpo'); +var ITERATOR = require('./_wks')('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + +},{"./_export":42,"./_hide":51,"./_iter-create":63,"./_iterators":67,"./_library":68,"./_object-gpo":87,"./_redefine":100,"./_set-to-string-tag":107,"./_wks":135}],65:[function(require,module,exports){ +var ITERATOR = require('./_wks')('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + +},{"./_wks":135}],66:[function(require,module,exports){ +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + +},{}],67:[function(require,module,exports){ +module.exports = {}; + +},{}],68:[function(require,module,exports){ +module.exports = false; + +},{}],69:[function(require,module,exports){ +// 20.2.2.14 Math.expm1(x) +var $expm1 = Math.expm1; +module.exports = (!$expm1 + // Old FF bug + || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 + // Tor Browser bug + || $expm1(-2e-17) != -2e-17 +) ? function expm1(x) { + return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; +} : $expm1; + +},{}],70:[function(require,module,exports){ +// 20.2.2.16 Math.fround(x) +var sign = require('./_math-sign'); +var pow = Math.pow; +var EPSILON = pow(2, -52); +var EPSILON32 = pow(2, -23); +var MAX32 = pow(2, 127) * (2 - EPSILON32); +var MIN32 = pow(2, -126); + +var roundTiesToEven = function (n) { + return n + 1 / EPSILON - 1 / EPSILON; +}; + +module.exports = Math.fround || function fround(x) { + var $abs = Math.abs(x); + var $sign = sign(x); + var a, result; + if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; + a = (1 + EPSILON32 / EPSILON) * $abs; + result = a - (a - $abs); + // eslint-disable-next-line no-self-compare + if (result > MAX32 || result != result) return $sign * Infinity; + return $sign * result; +}; + +},{"./_math-sign":73}],71:[function(require,module,exports){ +// 20.2.2.20 Math.log1p(x) +module.exports = Math.log1p || function log1p(x) { + return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); +}; + +},{}],72:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { + if ( + arguments.length === 0 + // eslint-disable-next-line no-self-compare + || x != x + // eslint-disable-next-line no-self-compare + || inLow != inLow + // eslint-disable-next-line no-self-compare + || inHigh != inHigh + // eslint-disable-next-line no-self-compare + || outLow != outLow + // eslint-disable-next-line no-self-compare + || outHigh != outHigh + ) return NaN; + if (x === Infinity || x === -Infinity) return x; + return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; +}; + +},{}],73:[function(require,module,exports){ +// 20.2.2.28 Math.sign(x) +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; +}; + +},{}],74:[function(require,module,exports){ +var META = require('./_uid')('meta'); +var isObject = require('./_is-object'); +var has = require('./_has'); +var setDesc = require('./_object-dp').f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !require('./_fails')(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // 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 + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!has(it, META)) { + // 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 + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; + +},{"./_fails":44,"./_has":50,"./_is-object":60,"./_object-dp":80,"./_uid":130}],75:[function(require,module,exports){ +var Map = require('./es6.map'); +var $export = require('./_export'); +var shared = require('./_shared')('metadata'); +var store = shared.store || (shared.store = new (require('./es6.weak-map'))()); + +var getOrCreateMetadataMap = function (target, targetKey, create) { + var targetMetadata = store.get(target); + if (!targetMetadata) { + if (!create) return undefined; + store.set(target, targetMetadata = new Map()); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) return undefined; + targetMetadata.set(targetKey, keyMetadata = new Map()); + } return keyMetadata; +}; +var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? false : metadataMap.has(MetadataKey); +}; +var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); +}; +var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { + getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); +}; +var ordinaryOwnMetadataKeys = function (target, targetKey) { + var metadataMap = getOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); + return keys; +}; +var toMetaKey = function (it) { + return it === undefined || typeof it == 'symbol' ? it : String(it); +}; +var exp = function (O) { + $export($export.S, 'Reflect', O); +}; + +module.exports = { + store: store, + map: getOrCreateMetadataMap, + has: ordinaryHasOwnMetadata, + get: ordinaryGetOwnMetadata, + set: ordinaryDefineOwnMetadata, + keys: ordinaryOwnMetadataKeys, + key: toMetaKey, + exp: exp +}; + +},{"./_export":42,"./_shared":109,"./es6.map":167,"./es6.weak-map":273}],76:[function(require,module,exports){ +var global = require('./_global'); +var macrotask = require('./_task').set; +var Observer = global.MutationObserver || global.WebKitMutationObserver; +var process = global.process; +var Promise = global.Promise; +var isNode = require('./_cof')(process) == 'process'; + +module.exports = function () { + var head, last, notify; + + var flush = function () { + var parent, fn; + if (isNode && (parent = process.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify(); + else last = undefined; + throw e; + } + } last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function () { + process.nextTick(flush); + }; + // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 + } else if (Observer && !(global.navigator && global.navigator.standalone)) { + var toggle = true; + var node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + 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 + var promise = Promise.resolve(undefined); + notify = function () { + promise.then(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); + }; + } + + return function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } last = task; + }; +}; + +},{"./_cof":27,"./_global":49,"./_task":119}],77:[function(require,module,exports){ +'use strict'; +// 25.4.1.5 NewPromiseCapability(C) +var aFunction = require('./_a-function'); + +function PromiseCapability(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); +} + +module.exports.f = function (C) { + return new PromiseCapability(C); +}; + +},{"./_a-function":12}],78:[function(require,module,exports){ +'use strict'; +// 19.1.2.1 Object.assign(target, source, ...) +var getKeys = require('./_object-keys'); +var gOPS = require('./_object-gops'); +var pIE = require('./_object-pie'); +var toObject = require('./_to-object'); +var IObject = require('./_iobject'); +var $assign = Object.assign; + +// should work with symbols and should have deterministic property order (V8 bug) +module.exports = !$assign || require('./_fails')(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = gOPS.f; + var isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]); + var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } return T; +} : $assign; + +},{"./_fails":44,"./_iobject":56,"./_object-gops":86,"./_object-keys":89,"./_object-pie":90,"./_to-object":125}],79:[function(require,module,exports){ +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = require('./_an-object'); +var dPs = require('./_object-dps'); +var enumBugKeys = require('./_enum-bug-keys'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = require('./_dom-create')('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + require('./_html').appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + +},{"./_an-object":16,"./_dom-create":39,"./_enum-bug-keys":40,"./_html":52,"./_object-dps":81,"./_shared-key":108}],80:[function(require,module,exports){ +var anObject = require('./_an-object'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var toPrimitive = require('./_to-primitive'); +var dP = Object.defineProperty; + +exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +},{"./_an-object":16,"./_descriptors":38,"./_ie8-dom-define":53,"./_to-primitive":126}],81:[function(require,module,exports){ +var dP = require('./_object-dp'); +var anObject = require('./_an-object'); +var getKeys = require('./_object-keys'); + +module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; + +},{"./_an-object":16,"./_descriptors":38,"./_object-dp":80,"./_object-keys":89}],82:[function(require,module,exports){ +'use strict'; +// Forced replacement prototype accessors methods +module.exports = require('./_library') || !require('./_fails')(function () { + var K = Math.random(); + // In FF throws only define methods + // eslint-disable-next-line no-undef, no-useless-call + __defineSetter__.call(null, K, function () { /* empty */ }); + delete require('./_global')[K]; +}); + +},{"./_fails":44,"./_global":49,"./_library":68}],83:[function(require,module,exports){ +var pIE = require('./_object-pie'); +var createDesc = require('./_property-desc'); +var toIObject = require('./_to-iobject'); +var toPrimitive = require('./_to-primitive'); +var has = require('./_has'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var gOPD = Object.getOwnPropertyDescriptor; + +exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); +}; + +},{"./_descriptors":38,"./_has":50,"./_ie8-dom-define":53,"./_object-pie":90,"./_property-desc":98,"./_to-iobject":123,"./_to-primitive":126}],84:[function(require,module,exports){ +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var toIObject = require('./_to-iobject'); +var gOPN = require('./_object-gopn').f; +var toString = {}.toString; + +var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + +var getWindowNames = function (it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } +}; + +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +}; + +},{"./_object-gopn":85,"./_to-iobject":123}],85:[function(require,module,exports){ +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = require('./_object-keys-internal'); +var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype'); + +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); +}; + +},{"./_enum-bug-keys":40,"./_object-keys-internal":88}],86:[function(require,module,exports){ +exports.f = Object.getOwnPropertySymbols; + +},{}],87:[function(require,module,exports){ +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = require('./_has'); +var toObject = require('./_to-object'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = 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 ? ObjectProto : null; +}; + +},{"./_has":50,"./_shared-key":108,"./_to-object":125}],88:[function(require,module,exports){ +var has = require('./_has'); +var toIObject = require('./_to-iobject'); +var arrayIndexOf = require('./_array-includes')(false); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; + +},{"./_array-includes":20,"./_has":50,"./_shared-key":108,"./_to-iobject":123}],89:[function(require,module,exports){ +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = require('./_object-keys-internal'); +var enumBugKeys = require('./_enum-bug-keys'); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + +},{"./_enum-bug-keys":40,"./_object-keys-internal":88}],90:[function(require,module,exports){ +exports.f = {}.propertyIsEnumerable; + +},{}],91:[function(require,module,exports){ +// most Object methods by ES6 should accept primitives +var $export = require('./_export'); +var core = require('./_core'); +var fails = require('./_fails'); +module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); +}; + +},{"./_core":32,"./_export":42,"./_fails":44}],92:[function(require,module,exports){ +var getKeys = require('./_object-keys'); +var toIObject = require('./_to-iobject'); +var isEnum = require('./_object-pie').f; +module.exports = function (isEntries) { + return function (it) { + var O = toIObject(it); + var keys = getKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) if (isEnum.call(O, key = keys[i++])) { + result.push(isEntries ? [key, O[key]] : O[key]); + } return result; + }; +}; + +},{"./_object-keys":89,"./_object-pie":90,"./_to-iobject":123}],93:[function(require,module,exports){ +// all object keys, includes non-enumerable and symbols +var gOPN = require('./_object-gopn'); +var gOPS = require('./_object-gops'); +var anObject = require('./_an-object'); +var Reflect = require('./_global').Reflect; +module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) { + var keys = gOPN.f(anObject(it)); + var getSymbols = gOPS.f; + return getSymbols ? keys.concat(getSymbols(it)) : keys; +}; + +},{"./_an-object":16,"./_global":49,"./_object-gopn":85,"./_object-gops":86}],94:[function(require,module,exports){ +var $parseFloat = require('./_global').parseFloat; +var $trim = require('./_string-trim').trim; + +module.exports = 1 / $parseFloat(require('./_string-ws') + '-0') !== -Infinity ? function parseFloat(str) { + var string = $trim(String(str), 3); + var result = $parseFloat(string); + return result === 0 && string.charAt(0) == '-' ? -0 : result; +} : $parseFloat; + +},{"./_global":49,"./_string-trim":117,"./_string-ws":118}],95:[function(require,module,exports){ +var $parseInt = require('./_global').parseInt; +var $trim = require('./_string-trim').trim; +var ws = require('./_string-ws'); +var hex = /^[-+]?0[xX]/; + +module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) { + var string = $trim(String(str), 3); + return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); +} : $parseInt; + +},{"./_global":49,"./_string-trim":117,"./_string-ws":118}],96:[function(require,module,exports){ +module.exports = function (exec) { + try { + return { e: false, v: exec() }; + } catch (e) { + return { e: true, v: e }; + } +}; + +},{}],97:[function(require,module,exports){ +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var newPromiseCapability = require('./_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; +}; + +},{"./_an-object":16,"./_is-object":60,"./_new-promise-capability":77}],98:[function(require,module,exports){ +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +},{}],99:[function(require,module,exports){ +var redefine = require('./_redefine'); +module.exports = function (target, src, safe) { + for (var key in src) redefine(target, key, src[key], safe); + return target; +}; + +},{"./_redefine":100}],100:[function(require,module,exports){ +var global = require('./_global'); +var hide = require('./_hide'); +var has = require('./_has'); +var SRC = require('./_uid')('src'); +var TO_STRING = 'toString'; +var $toString = Function[TO_STRING]; +var TPL = ('' + $toString).split(TO_STRING); + +require('./_core').inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) has(val, 'name') || hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); + +},{"./_core":32,"./_global":49,"./_has":50,"./_hide":51,"./_uid":130}],101:[function(require,module,exports){ +module.exports = function (regExp, replace) { + var replacer = replace === Object(replace) ? function (part) { + return replace[part]; + } : replace; + return function (it) { + return String(it).replace(regExp, replacer); + }; +}; + +},{}],102:[function(require,module,exports){ +// 7.2.9 SameValue(x, y) +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; +}; + +},{}],103:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-setmap-offrom/ +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var ctx = require('./_ctx'); +var forOf = require('./_for-of'); + +module.exports = function (COLLECTION) { + $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) { + var mapFn = arguments[1]; + var mapping, A, n, cb; + aFunction(this); + mapping = mapFn !== undefined; + if (mapping) aFunction(mapFn); + if (source == undefined) return new this(); + A = []; + if (mapping) { + n = 0; + cb = ctx(mapFn, arguments[2], 2); + forOf(source, false, function (nextItem) { + A.push(cb(nextItem, n++)); + }); + } else { + forOf(source, false, A.push, A); + } + return new this(A); + } }); +}; + +},{"./_a-function":12,"./_ctx":34,"./_export":42,"./_for-of":48}],104:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-setmap-offrom/ +var $export = require('./_export'); + +module.exports = function (COLLECTION) { + $export($export.S, COLLECTION, { of: function of() { + var length = arguments.length; + var A = new Array(length); + while (length--) A[length] = arguments[length]; + return new this(A); + } }); +}; + +},{"./_export":42}],105:[function(require,module,exports){ +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var isObject = require('./_is-object'); +var anObject = require('./_an-object'); +var check = function (O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; + +},{"./_an-object":16,"./_ctx":34,"./_is-object":60,"./_object-gopd":83}],106:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var dP = require('./_object-dp'); +var DESCRIPTORS = require('./_descriptors'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (KEY) { + var C = global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function () { return this; } + }); +}; + +},{"./_descriptors":38,"./_global":49,"./_object-dp":80,"./_wks":135}],107:[function(require,module,exports){ +var def = require('./_object-dp').f; +var has = require('./_has'); +var TAG = require('./_wks')('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + +},{"./_has":50,"./_object-dp":80,"./_wks":135}],108:[function(require,module,exports){ +var shared = require('./_shared')('keys'); +var uid = require('./_uid'); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + +},{"./_shared":109,"./_uid":130}],109:[function(require,module,exports){ +var core = require('./_core'); +var global = require('./_global'); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: require('./_library') ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); + +},{"./_core":32,"./_global":49,"./_library":68}],110:[function(require,module,exports){ +// 7.3.20 SpeciesConstructor(O, defaultConstructor) +var anObject = require('./_an-object'); +var aFunction = require('./_a-function'); +var SPECIES = require('./_wks')('species'); +module.exports = function (O, D) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); +}; + +},{"./_a-function":12,"./_an-object":16,"./_wks":135}],111:[function(require,module,exports){ +'use strict'; +var fails = require('./_fails'); + +module.exports = function (method, arg) { + return !!method && fails(function () { + // eslint-disable-next-line no-useless-call + arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); + }); +}; + +},{"./_fails":44}],112:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + +},{"./_defined":37,"./_to-integer":122}],113:[function(require,module,exports){ +// helper for String#{startsWith, endsWith, includes} +var isRegExp = require('./_is-regexp'); +var defined = require('./_defined'); + +module.exports = function (that, searchString, NAME) { + if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(defined(that)); +}; + +},{"./_defined":37,"./_is-regexp":61}],114:[function(require,module,exports){ +var $export = require('./_export'); +var fails = require('./_fails'); +var defined = require('./_defined'); +var quot = /"/g; +// B.2.3.2.1 CreateHTML(string, tag, attribute, value) +var createHTML = function (string, tag, attribute, value) { + var S = String(defined(string)); + var p1 = '<' + tag; + if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; + return p1 + '>' + S + ''; +}; +module.exports = function (NAME, exec) { + var O = {}; + O[NAME] = exec(createHTML); + $export($export.P + $export.F * fails(function () { + var test = ''[NAME]('"'); + return test !== test.toLowerCase() || test.split('"').length > 3; + }), 'String', O); +}; + +},{"./_defined":37,"./_export":42,"./_fails":44}],115:[function(require,module,exports){ +// https://github.com/tc39/proposal-string-pad-start-end +var toLength = require('./_to-length'); +var repeat = require('./_string-repeat'); +var defined = require('./_defined'); + +module.exports = function (that, maxLength, fillString, left) { + var S = String(defined(that)); + var stringLength = S.length; + var fillStr = fillString === undefined ? ' ' : String(fillString); + var intMaxLength = toLength(maxLength); + if (intMaxLength <= stringLength || fillStr == '') return S; + var fillLen = intMaxLength - stringLength; + var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); + return left ? stringFiller + S : S + stringFiller; +}; + +},{"./_defined":37,"./_string-repeat":116,"./_to-length":124}],116:[function(require,module,exports){ +'use strict'; +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); + +module.exports = function repeat(count) { + var str = String(defined(this)); + var res = ''; + var n = toInteger(count); + if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); + for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; + return res; +}; + +},{"./_defined":37,"./_to-integer":122}],117:[function(require,module,exports){ +var $export = require('./_export'); +var defined = require('./_defined'); +var fails = require('./_fails'); +var spaces = require('./_string-ws'); +var space = '[' + spaces + ']'; +var non = '\u200b\u0085'; +var ltrim = RegExp('^' + space + space + '*'); +var rtrim = RegExp(space + space + '*$'); + +var exporter = function (KEY, exec, ALIAS) { + var exp = {}; + var FORCE = fails(function () { + return !!spaces[KEY]() || non[KEY]() != non; + }); + var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; + if (ALIAS) exp[ALIAS] = fn; + $export($export.P + $export.F * FORCE, 'String', exp); +}; + +// 1 -> String#trimLeft +// 2 -> String#trimRight +// 3 -> String#trim +var trim = exporter.trim = function (string, TYPE) { + string = String(defined(string)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; +}; + +module.exports = exporter; + +},{"./_defined":37,"./_export":42,"./_fails":44,"./_string-ws":118}],118:[function(require,module,exports){ +module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + +},{}],119:[function(require,module,exports){ +var ctx = require('./_ctx'); +var invoke = require('./_invoke'); +var html = require('./_html'); +var cel = require('./_dom-create'); +var global = require('./_global'); +var process = global.process; +var setTask = global.setImmediate; +var clearTask = global.clearImmediate; +var MessageChannel = global.MessageChannel; +var Dispatch = global.Dispatch; +var counter = 0; +var queue = {}; +var ONREADYSTATECHANGE = 'onreadystatechange'; +var defer, channel, port; +var run = function () { + var id = +this; + // eslint-disable-next-line no-prototype-builtins + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var listener = function (event) { + run.call(event.data); +}; +// Node.js 0.9+ & IE10+ has setImmediate, otherwise: +if (!setTask || !clearTask) { + setTask = 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 + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (require('./_cof')(process) == 'process') { + defer = function (id) { + process.nextTick(ctx(run, id, 1)); + }; + // Sphere (JS game engine) Dispatch API + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(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) { + defer = function (id) { + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in cel('script')) { + defer = function (id) { + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function (id) { + setTimeout(ctx(run, id, 1), 0); + }; + } +} +module.exports = { + set: setTask, + clear: clearTask +}; + +},{"./_cof":27,"./_ctx":34,"./_dom-create":39,"./_global":49,"./_html":52,"./_invoke":55}],120:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + +},{"./_to-integer":122}],121:[function(require,module,exports){ +// https://tc39.github.io/ecma262/#sec-toindex +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +module.exports = function (it) { + if (it === undefined) return 0; + var number = toInteger(it); + var length = toLength(number); + if (number !== length) throw RangeError('Wrong length!'); + return length; +}; + +},{"./_to-integer":122,"./_to-length":124}],122:[function(require,module,exports){ +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + +},{}],123:[function(require,module,exports){ +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = require('./_iobject'); +var defined = require('./_defined'); +module.exports = function (it) { + return IObject(defined(it)); +}; + +},{"./_defined":37,"./_iobject":56}],124:[function(require,module,exports){ +// 7.1.15 ToLength +var toInteger = require('./_to-integer'); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + +},{"./_to-integer":122}],125:[function(require,module,exports){ +// 7.1.13 ToObject(argument) +var defined = require('./_defined'); +module.exports = function (it) { + return Object(defined(it)); +}; + +},{"./_defined":37}],126:[function(require,module,exports){ +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = require('./_is-object'); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +},{"./_is-object":60}],127:[function(require,module,exports){ +'use strict'; +if (require('./_descriptors')) { + var LIBRARY = require('./_library'); + var global = require('./_global'); + var fails = require('./_fails'); + var $export = require('./_export'); + var $typed = require('./_typed'); + var $buffer = require('./_typed-buffer'); + var ctx = require('./_ctx'); + var anInstance = require('./_an-instance'); + var propertyDesc = require('./_property-desc'); + var hide = require('./_hide'); + var redefineAll = require('./_redefine-all'); + var toInteger = require('./_to-integer'); + var toLength = require('./_to-length'); + var toIndex = require('./_to-index'); + var toAbsoluteIndex = require('./_to-absolute-index'); + var toPrimitive = require('./_to-primitive'); + var has = require('./_has'); + var classof = require('./_classof'); + var isObject = require('./_is-object'); + var toObject = require('./_to-object'); + var isArrayIter = require('./_is-array-iter'); + var create = require('./_object-create'); + var getPrototypeOf = require('./_object-gpo'); + var gOPN = require('./_object-gopn').f; + var getIterFn = require('./core.get-iterator-method'); + var uid = require('./_uid'); + var wks = require('./_wks'); + var createArrayMethod = require('./_array-methods'); + var createArrayIncludes = require('./_array-includes'); + var speciesConstructor = require('./_species-constructor'); + var ArrayIterators = require('./es6.array.iterator'); + var Iterators = require('./_iterators'); + var $iterDetect = require('./_iter-detect'); + var setSpecies = require('./_set-species'); + var arrayFill = require('./_array-fill'); + var arrayCopyWithin = require('./_array-copy-within'); + var $DP = require('./_object-dp'); + var $GOPD = require('./_object-gopd'); + var dP = $DP.f; + var gOPD = $GOPD.f; + var RangeError = global.RangeError; + var TypeError = global.TypeError; + var Uint8Array = global.Uint8Array; + var ARRAY_BUFFER = 'ArrayBuffer'; + var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; + var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; + var PROTOTYPE = 'prototype'; + var ArrayProto = Array[PROTOTYPE]; + var $ArrayBuffer = $buffer.ArrayBuffer; + var $DataView = $buffer.DataView; + var arrayForEach = createArrayMethod(0); + var arrayFilter = createArrayMethod(2); + var arraySome = createArrayMethod(3); + var arrayEvery = createArrayMethod(4); + var arrayFind = createArrayMethod(5); + var arrayFindIndex = createArrayMethod(6); + var arrayIncludes = createArrayIncludes(true); + var arrayIndexOf = createArrayIncludes(false); + var arrayValues = ArrayIterators.values; + var arrayKeys = ArrayIterators.keys; + var arrayEntries = ArrayIterators.entries; + var arrayLastIndexOf = ArrayProto.lastIndexOf; + var arrayReduce = ArrayProto.reduce; + var arrayReduceRight = ArrayProto.reduceRight; + var arrayJoin = ArrayProto.join; + var arraySort = ArrayProto.sort; + var arraySlice = ArrayProto.slice; + var arrayToString = ArrayProto.toString; + var arrayToLocaleString = ArrayProto.toLocaleString; + var ITERATOR = wks('iterator'); + var TAG = wks('toStringTag'); + var TYPED_CONSTRUCTOR = uid('typed_constructor'); + var DEF_CONSTRUCTOR = uid('def_constructor'); + var ALL_CONSTRUCTORS = $typed.CONSTR; + var TYPED_ARRAY = $typed.TYPED; + var VIEW = $typed.VIEW; + var WRONG_LENGTH = 'Wrong length!'; + + var $map = createArrayMethod(1, function (O, length) { + return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); + }); + + var LITTLE_ENDIAN = fails(function () { + // eslint-disable-next-line no-undef + return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; + }); + + var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { + new Uint8Array(1).set({}); + }); + + var toOffset = function (it, BYTES) { + var offset = toInteger(it); + if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); + return offset; + }; + + var validate = function (it) { + if (isObject(it) && TYPED_ARRAY in it) return it; + throw TypeError(it + ' is not a typed array!'); + }; + + var allocate = function (C, length) { + if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { + throw TypeError('It is not a typed array constructor!'); + } return new C(length); + }; + + var speciesFromList = function (O, list) { + return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); + }; + + var fromList = function (C, list) { + var index = 0; + var length = list.length; + var result = allocate(C, length); + while (length > index) result[index] = list[index++]; + return result; + }; + + var addGetter = function (it, key, internal) { + dP(it, key, { get: function () { return this._d[internal]; } }); + }; + + var $from = function from(source /* , mapfn, thisArg */) { + var O = toObject(source); + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var iterFn = getIterFn(O); + var i, length, values, result, step, iterator; + if (iterFn != undefined && !isArrayIter(iterFn)) { + for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { + values.push(step.value); + } O = values; + } + if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); + for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { + result[i] = mapping ? mapfn(O[i], i) : O[i]; + } + return result; + }; + + var $of = function of(/* ...items */) { + var index = 0; + var length = arguments.length; + var result = allocate(this, length); + while (length > index) result[index] = arguments[index++]; + return result; + }; + + // iOS Safari 6.x fails here + var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); + + var $toLocaleString = function toLocaleString() { + return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); + }; + + var proto = { + copyWithin: function copyWithin(target, start /* , end */) { + return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + }, + every: function every(callbackfn /* , thisArg */) { + return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars + return arrayFill.apply(validate(this), arguments); + }, + filter: function filter(callbackfn /* , thisArg */) { + return speciesFromList(this, arrayFilter(validate(this), callbackfn, + arguments.length > 1 ? arguments[1] : undefined)); + }, + find: function find(predicate /* , thisArg */) { + return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + findIndex: function findIndex(predicate /* , thisArg */) { + return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + forEach: function forEach(callbackfn /* , thisArg */) { + arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + indexOf: function indexOf(searchElement /* , fromIndex */) { + return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + includes: function includes(searchElement /* , fromIndex */) { + return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + join: function join(separator) { // eslint-disable-line no-unused-vars + return arrayJoin.apply(validate(this), arguments); + }, + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars + return arrayLastIndexOf.apply(validate(this), arguments); + }, + map: function map(mapfn /* , thisArg */) { + return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); + }, + reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduce.apply(validate(this), arguments); + }, + reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduceRight.apply(validate(this), arguments); + }, + reverse: function reverse() { + var that = this; + var length = validate(that).length; + var middle = Math.floor(length / 2); + var index = 0; + var value; + while (index < middle) { + value = that[index]; + that[index++] = that[--length]; + that[length] = value; + } return that; + }, + some: function some(callbackfn /* , thisArg */) { + return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + sort: function sort(comparefn) { + return arraySort.call(validate(this), comparefn); + }, + subarray: function subarray(begin, end) { + var O = validate(this); + var length = O.length; + var $begin = toAbsoluteIndex(begin, length); + return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( + O.buffer, + O.byteOffset + $begin * O.BYTES_PER_ELEMENT, + toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) + ); + } + }; + + var $slice = function slice(start, end) { + return speciesFromList(this, arraySlice.call(validate(this), start, end)); + }; + + var $set = function set(arrayLike /* , offset */) { + validate(this); + var offset = toOffset(arguments[1], 1); + var length = this.length; + var src = toObject(arrayLike); + var len = toLength(src.length); + var index = 0; + if (len + offset > length) throw RangeError(WRONG_LENGTH); + while (index < len) this[offset + index] = src[index++]; + }; + + var $iterators = { + entries: function entries() { + return arrayEntries.call(validate(this)); + }, + keys: function keys() { + return arrayKeys.call(validate(this)); + }, + values: function values() { + return arrayValues.call(validate(this)); + } + }; + + var isTAIndex = function (target, key) { + return isObject(target) + && target[TYPED_ARRAY] + && typeof key != 'symbol' + && key in target + && String(+key) == String(key); + }; + var $getDesc = function getOwnPropertyDescriptor(target, key) { + return isTAIndex(target, key = toPrimitive(key, true)) + ? propertyDesc(2, target[key]) + : gOPD(target, key); + }; + var $setDesc = function defineProperty(target, key, desc) { + if (isTAIndex(target, key = toPrimitive(key, true)) + && isObject(desc) + && has(desc, 'value') + && !has(desc, 'get') + && !has(desc, 'set') + // TODO: add validation descriptor w/o calling accessors + && !desc.configurable + && (!has(desc, 'writable') || desc.writable) + && (!has(desc, 'enumerable') || desc.enumerable) + ) { + target[key] = desc.value; + return target; + } return dP(target, key, desc); + }; + + if (!ALL_CONSTRUCTORS) { + $GOPD.f = $getDesc; + $DP.f = $setDesc; + } + + $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { + getOwnPropertyDescriptor: $getDesc, + defineProperty: $setDesc + }); + + if (fails(function () { arrayToString.call({}); })) { + arrayToString = arrayToLocaleString = function toString() { + return arrayJoin.call(this); + }; + } + + var $TypedArrayPrototype$ = redefineAll({}, proto); + redefineAll($TypedArrayPrototype$, $iterators); + hide($TypedArrayPrototype$, ITERATOR, $iterators.values); + redefineAll($TypedArrayPrototype$, { + slice: $slice, + set: $set, + constructor: function () { /* noop */ }, + toString: arrayToString, + toLocaleString: $toLocaleString + }); + addGetter($TypedArrayPrototype$, 'buffer', 'b'); + addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); + addGetter($TypedArrayPrototype$, 'byteLength', 'l'); + addGetter($TypedArrayPrototype$, 'length', 'e'); + dP($TypedArrayPrototype$, TAG, { + get: function () { return this[TYPED_ARRAY]; } + }); + + // eslint-disable-next-line max-statements + module.exports = function (KEY, BYTES, wrapper, CLAMPED) { + CLAMPED = !!CLAMPED; + var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; + var GETTER = 'get' + KEY; + var SETTER = 'set' + KEY; + var TypedArray = global[NAME]; + var Base = TypedArray || {}; + var TAC = TypedArray && getPrototypeOf(TypedArray); + var FORCED = !TypedArray || !$typed.ABV; + var O = {}; + var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; + var getter = function (that, index) { + var data = that._d; + return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); + }; + var setter = function (that, index, value) { + var data = that._d; + if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; + data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); + }; + var addElement = function (that, index) { + dP(that, index, { + get: function () { + return getter(this, index); + }, + set: function (value) { + return setter(this, index, value); + }, + enumerable: true + }); + }; + if (FORCED) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME, '_d'); + var index = 0; + var offset = 0; + var buffer, byteLength, length, klass; + if (!isObject(data)) { + length = toIndex(data); + byteLength = length * BYTES; + buffer = new $ArrayBuffer(byteLength); + } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + buffer = data; + offset = toOffset($offset, BYTES); + var $len = data.byteLength; + if ($length === undefined) { + if ($len % BYTES) throw RangeError(WRONG_LENGTH); + byteLength = $len - offset; + if (byteLength < 0) throw RangeError(WRONG_LENGTH); + } else { + byteLength = toLength($length) * BYTES; + if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); + } + length = byteLength / BYTES; + } else if (TYPED_ARRAY in data) { + return fromList(TypedArray, data); + } else { + return $from.call(TypedArray, data); + } + hide(that, '_d', { + b: buffer, + o: offset, + l: byteLength, + e: length, + v: new $DataView(buffer) + }); + while (index < length) addElement(that, index++); + }); + TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); + hide(TypedArrayPrototype, 'constructor', TypedArray); + } else if (!fails(function () { + TypedArray(1); + }) || !fails(function () { + new TypedArray(-1); // eslint-disable-line no-new + }) || !$iterDetect(function (iter) { + new TypedArray(); // eslint-disable-line no-new + new TypedArray(null); // eslint-disable-line no-new + new TypedArray(1.5); // eslint-disable-line no-new + new TypedArray(iter); // eslint-disable-line no-new + }, true)) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME); + var klass; + // `ws` module bug, temporarily remove validation length for Uint8Array + // https://github.com/websockets/ws/pull/645 + if (!isObject(data)) return new Base(toIndex(data)); + if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + return $length !== undefined + ? new Base(data, toOffset($offset, BYTES), $length) + : $offset !== undefined + ? new Base(data, toOffset($offset, BYTES)) + : new Base(data); + } + if (TYPED_ARRAY in data) return fromList(TypedArray, data); + return $from.call(TypedArray, data); + }); + arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { + if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); + }); + TypedArray[PROTOTYPE] = TypedArrayPrototype; + if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; + } + var $nativeIterator = TypedArrayPrototype[ITERATOR]; + var CORRECT_ITER_NAME = !!$nativeIterator + && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); + var $iterator = $iterators.values; + hide(TypedArray, TYPED_CONSTRUCTOR, true); + hide(TypedArrayPrototype, TYPED_ARRAY, NAME); + hide(TypedArrayPrototype, VIEW, true); + hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); + + if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { + dP(TypedArrayPrototype, TAG, { + get: function () { return NAME; } + }); + } + + O[NAME] = TypedArray; + + $export($export.G + $export.W + $export.F * (TypedArray != Base), O); + + $export($export.S, NAME, { + BYTES_PER_ELEMENT: BYTES + }); + + $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { + from: $from, + of: $of + }); + + if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); + + $export($export.P, NAME, proto); + + setSpecies(NAME); + + $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); + + $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); + + if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; + + $export($export.P + $export.F * fails(function () { + new TypedArray(1).slice(); + }), NAME, { slice: $slice }); + + $export($export.P + $export.F * (fails(function () { + return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); + }) || !fails(function () { + TypedArrayPrototype.toLocaleString.call([1, 2]); + })), NAME, { toLocaleString: $toLocaleString }); + + Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; + if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); + }; +} else module.exports = function () { /* empty */ }; + +},{"./_an-instance":15,"./_array-copy-within":17,"./_array-fill":18,"./_array-includes":20,"./_array-methods":21,"./_classof":26,"./_ctx":34,"./_descriptors":38,"./_export":42,"./_fails":44,"./_global":49,"./_has":50,"./_hide":51,"./_is-array-iter":57,"./_is-object":60,"./_iter-detect":65,"./_iterators":67,"./_library":68,"./_object-create":79,"./_object-dp":80,"./_object-gopd":83,"./_object-gopn":85,"./_object-gpo":87,"./_property-desc":98,"./_redefine-all":99,"./_set-species":106,"./_species-constructor":110,"./_to-absolute-index":120,"./_to-index":121,"./_to-integer":122,"./_to-length":124,"./_to-object":125,"./_to-primitive":126,"./_typed":129,"./_typed-buffer":128,"./_uid":130,"./_wks":135,"./core.get-iterator-method":136,"./es6.array.iterator":148}],128:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var DESCRIPTORS = require('./_descriptors'); +var LIBRARY = require('./_library'); +var $typed = require('./_typed'); +var hide = require('./_hide'); +var redefineAll = require('./_redefine-all'); +var fails = require('./_fails'); +var anInstance = require('./_an-instance'); +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +var toIndex = require('./_to-index'); +var gOPN = require('./_object-gopn').f; +var dP = require('./_object-dp').f; +var arrayFill = require('./_array-fill'); +var setToStringTag = require('./_set-to-string-tag'); +var ARRAY_BUFFER = 'ArrayBuffer'; +var DATA_VIEW = 'DataView'; +var PROTOTYPE = 'prototype'; +var WRONG_LENGTH = 'Wrong length!'; +var WRONG_INDEX = 'Wrong index!'; +var $ArrayBuffer = global[ARRAY_BUFFER]; +var $DataView = global[DATA_VIEW]; +var Math = global.Math; +var RangeError = global.RangeError; +// eslint-disable-next-line no-shadow-restricted-names +var Infinity = global.Infinity; +var BaseBuffer = $ArrayBuffer; +var abs = Math.abs; +var pow = Math.pow; +var floor = Math.floor; +var log = Math.log; +var LN2 = Math.LN2; +var BUFFER = 'buffer'; +var BYTE_LENGTH = 'byteLength'; +var BYTE_OFFSET = 'byteOffset'; +var $BUFFER = DESCRIPTORS ? '_b' : BUFFER; +var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH; +var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; + +// IEEE754 conversions based on https://github.com/feross/ieee754 +function packIEEE754(value, mLen, nBytes) { + var buffer = new Array(nBytes); + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; + var i = 0; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + var e, m, c; + value = abs(value); + // eslint-disable-next-line no-self-compare + if (value != value || value === Infinity) { + // eslint-disable-next-line no-self-compare + m = value != value ? 1 : 0; + e = eMax; + } else { + e = floor(log(value) / LN2); + if (value * (c = pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * pow(2, mLen); + e = e + eBias; + } else { + m = value * pow(2, eBias - 1) * pow(2, mLen); + e = 0; + } + } + for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); + e = e << mLen | m; + eLen += mLen; + for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); + buffer[--i] |= s * 128; + return buffer; +} +function unpackIEEE754(buffer, mLen, nBytes) { + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = eLen - 7; + var i = nBytes - 1; + var s = buffer[i--]; + var e = s & 127; + var m; + s >>= 7; + for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : s ? -Infinity : Infinity; + } else { + m = m + pow(2, mLen); + e = e - eBias; + } return (s ? -1 : 1) * m * pow(2, e - mLen); +} + +function unpackI32(bytes) { + return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; +} +function packI8(it) { + return [it & 0xff]; +} +function packI16(it) { + return [it & 0xff, it >> 8 & 0xff]; +} +function packI32(it) { + return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; +} +function packF64(it) { + return packIEEE754(it, 52, 8); +} +function packF32(it) { + return packIEEE754(it, 23, 4); +} + +function addGetter(C, key, internal) { + dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); +} + +function get(view, bytes, index, isLittleEndian) { + var numIndex = +index; + var intIndex = toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = store.slice(start, start + bytes); + return isLittleEndian ? pack : pack.reverse(); +} +function set(view, bytes, index, conversion, value, isLittleEndian) { + var numIndex = +index; + var intIndex = toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = conversion(+value); + for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; +} + +if (!$typed.ABV) { + $ArrayBuffer = function ArrayBuffer(length) { + anInstance(this, $ArrayBuffer, ARRAY_BUFFER); + var byteLength = toIndex(length); + this._b = arrayFill.call(new Array(byteLength), 0); + this[$LENGTH] = byteLength; + }; + + $DataView = function DataView(buffer, byteOffset, byteLength) { + anInstance(this, $DataView, DATA_VIEW); + anInstance(buffer, $ArrayBuffer, DATA_VIEW); + var bufferLength = buffer[$LENGTH]; + 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); + this[$BUFFER] = buffer; + this[$OFFSET] = offset; + this[$LENGTH] = byteLength; + }; + + if (DESCRIPTORS) { + addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); + addGetter($DataView, BUFFER, '_b'); + addGetter($DataView, BYTE_LENGTH, '_l'); + addGetter($DataView, BYTE_OFFSET, '_o'); + } + + 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[1]); + return (bytes[1] << 8 | bytes[0]) << 16 >> 16; + }, + getUint16: function getUint16(byteOffset /* , littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return bytes[1] << 8 | bytes[0]; + }, + getInt32: function getInt32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])); + }, + getUint32: function getUint32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; + }, + getFloat32: function getFloat32(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); + }, + getFloat64: function getFloat64(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); + }, + setInt8: function setInt8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setUint8: function setUint8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setInt16: function setInt16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setUint16: function setUint16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setInt32: function setInt32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setUint32: function setUint32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packF32, value, arguments[2]); + }, + setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { + set(this, 8, byteOffset, packF64, value, arguments[2]); + } + }); +} else { + if (!fails(function () { + $ArrayBuffer(1); + }) || !fails(function () { + new $ArrayBuffer(-1); // eslint-disable-line no-new + }) || fails(function () { + new $ArrayBuffer(); // eslint-disable-line no-new + new $ArrayBuffer(1.5); // eslint-disable-line no-new + new $ArrayBuffer(NaN); // eslint-disable-line no-new + return $ArrayBuffer.name != ARRAY_BUFFER; + })) { + $ArrayBuffer = function ArrayBuffer(length) { + anInstance(this, $ArrayBuffer); + return new BaseBuffer(toIndex(length)); + }; + var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; + for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { + if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]); + } + if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; + } + // iOS Safari 7.x bug + var view = new $DataView(new $ArrayBuffer(2)); + var $setInt8 = $DataView[PROTOTYPE].setInt8; + view.setInt8(0, 2147483648); + view.setInt8(1, 2147483649); + if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], { + setInt8: function setInt8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + }, + setUint8: function setUint8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + } + }, true); +} +setToStringTag($ArrayBuffer, ARRAY_BUFFER); +setToStringTag($DataView, DATA_VIEW); +hide($DataView[PROTOTYPE], $typed.VIEW, true); +exports[ARRAY_BUFFER] = $ArrayBuffer; +exports[DATA_VIEW] = $DataView; + +},{"./_an-instance":15,"./_array-fill":18,"./_descriptors":38,"./_fails":44,"./_global":49,"./_hide":51,"./_library":68,"./_object-dp":80,"./_object-gopn":85,"./_redefine-all":99,"./_set-to-string-tag":107,"./_to-index":121,"./_to-integer":122,"./_to-length":124,"./_typed":129}],129:[function(require,module,exports){ +var global = require('./_global'); +var hide = require('./_hide'); +var uid = require('./_uid'); +var TYPED = uid('typed_array'); +var VIEW = uid('view'); +var ABV = !!(global.ArrayBuffer && global.DataView); +var CONSTR = ABV; +var i = 0; +var l = 9; +var Typed; + +var TypedArrayConstructors = ( + 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' +).split(','); + +while (i < l) { + if (Typed = global[TypedArrayConstructors[i++]]) { + hide(Typed.prototype, TYPED, true); + hide(Typed.prototype, VIEW, true); + } else CONSTR = false; +} + +module.exports = { + ABV: ABV, + CONSTR: CONSTR, + TYPED: TYPED, + VIEW: VIEW +}; + +},{"./_global":49,"./_hide":51,"./_uid":130}],130:[function(require,module,exports){ +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +},{}],131:[function(require,module,exports){ +var global = require('./_global'); +var navigator = global.navigator; + +module.exports = navigator && navigator.userAgent || ''; + +},{"./_global":49}],132:[function(require,module,exports){ +var isObject = require('./_is-object'); +module.exports = function (it, TYPE) { + if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); + return it; +}; + +},{"./_is-object":60}],133:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var LIBRARY = require('./_library'); +var wksExt = require('./_wks-ext'); +var defineProperty = require('./_object-dp').f; +module.exports = function (name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +}; + +},{"./_core":32,"./_global":49,"./_library":68,"./_object-dp":80,"./_wks-ext":134}],134:[function(require,module,exports){ +exports.f = require('./_wks'); + +},{"./_wks":135}],135:[function(require,module,exports){ +var store = require('./_shared')('wks'); +var uid = require('./_uid'); +var Symbol = require('./_global').Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + +},{"./_global":49,"./_shared":109,"./_uid":130}],136:[function(require,module,exports){ +var classof = require('./_classof'); +var ITERATOR = require('./_wks')('iterator'); +var Iterators = require('./_iterators'); +module.exports = require('./_core').getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; + +},{"./_classof":26,"./_core":32,"./_iterators":67,"./_wks":135}],137:[function(require,module,exports){ +// https://github.com/benjamingr/RexExp.escape +var $export = require('./_export'); +var $re = require('./_replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + +$export($export.S, 'RegExp', { escape: function escape(it) { return $re(it); } }); + +},{"./_export":42,"./_replacer":101}],138:[function(require,module,exports){ +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +var $export = require('./_export'); + +$export($export.P, 'Array', { copyWithin: require('./_array-copy-within') }); + +require('./_add-to-unscopables')('copyWithin'); + +},{"./_add-to-unscopables":14,"./_array-copy-within":17,"./_export":42}],139:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $every = require('./_array-methods')(4); + +$export($export.P + $export.F * !require('./_strict-method')([].every, true), 'Array', { + // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) + every: function every(callbackfn /* , thisArg */) { + return $every(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],140:[function(require,module,exports){ +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +var $export = require('./_export'); + +$export($export.P, 'Array', { fill: require('./_array-fill') }); + +require('./_add-to-unscopables')('fill'); + +},{"./_add-to-unscopables":14,"./_array-fill":18,"./_export":42}],141:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $filter = require('./_array-methods')(2); + +$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', { + // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],142:[function(require,module,exports){ +'use strict'; +// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) +var $export = require('./_export'); +var $find = require('./_array-methods')(6); +var KEY = 'findIndex'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + findIndex: function findIndex(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +require('./_add-to-unscopables')(KEY); + +},{"./_add-to-unscopables":14,"./_array-methods":21,"./_export":42}],143:[function(require,module,exports){ +'use strict'; +// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) +var $export = require('./_export'); +var $find = require('./_array-methods')(5); +var KEY = 'find'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +require('./_add-to-unscopables')(KEY); + +},{"./_add-to-unscopables":14,"./_array-methods":21,"./_export":42}],144:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $forEach = require('./_array-methods')(0); +var STRICT = require('./_strict-method')([].forEach, true); + +$export($export.P + $export.F * !STRICT, 'Array', { + // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) + forEach: function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],145:[function(require,module,exports){ +'use strict'; +var ctx = require('./_ctx'); +var $export = require('./_export'); +var toObject = require('./_to-object'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var toLength = require('./_to-length'); +var createProperty = require('./_create-property'); +var getIterFn = require('./core.get-iterator-method'); + +$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = getIterFn(O); + var length, result, step, iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); + +},{"./_create-property":33,"./_ctx":34,"./_export":42,"./_is-array-iter":57,"./_iter-call":62,"./_iter-detect":65,"./_to-length":124,"./_to-object":125,"./core.get-iterator-method":136}],146:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $indexOf = require('./_array-includes')(false); +var $native = [].indexOf; +var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; + +$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', { + // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + return NEGATIVE_ZERO + // convert -0 to +0 + ? $native.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments[1]); + } +}); + +},{"./_array-includes":20,"./_export":42,"./_strict-method":111}],147:[function(require,module,exports){ +// 22.1.2.2 / 15.4.3.2 Array.isArray(arg) +var $export = require('./_export'); + +$export($export.S, 'Array', { isArray: require('./_is-array') }); + +},{"./_export":42,"./_is-array":58}],148:[function(require,module,exports){ +'use strict'; +var addToUnscopables = require('./_add-to-unscopables'); +var step = require('./_iter-step'); +var Iterators = require('./_iterators'); +var toIObject = require('./_to-iobject'); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + +},{"./_add-to-unscopables":14,"./_iter-define":64,"./_iter-step":66,"./_iterators":67,"./_to-iobject":123}],149:[function(require,module,exports){ +'use strict'; +// 22.1.3.13 Array.prototype.join(separator) +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var arrayJoin = [].join; + +// fallback for not array-like strings +$export($export.P + $export.F * (require('./_iobject') != Object || !require('./_strict-method')(arrayJoin)), 'Array', { + join: function join(separator) { + return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); + } +}); + +},{"./_export":42,"./_iobject":56,"./_strict-method":111,"./_to-iobject":123}],150:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +var $native = [].lastIndexOf; +var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; + +$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', { + // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + // convert -0 to +0 + if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0; + var O = toIObject(this); + var length = toLength(O.length); + var index = length - 1; + if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1])); + if (index < 0) index = length + index; + for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; + return -1; + } +}); + +},{"./_export":42,"./_strict-method":111,"./_to-integer":122,"./_to-iobject":123,"./_to-length":124}],151:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $map = require('./_array-methods')(1); + +$export($export.P + $export.F * !require('./_strict-method')([].map, true), 'Array', { + // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],152:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var createProperty = require('./_create-property'); + +// WebKit Array.of isn't generic +$export($export.S + $export.F * require('./_fails')(function () { + function F() { /* empty */ } + return !(Array.of.call(F) instanceof F); +}), 'Array', { + // 22.1.2.3 Array.of( ...items) + of: function of(/* ...args */) { + var index = 0; + var aLen = arguments.length; + var result = new (typeof this == 'function' ? this : Array)(aLen); + while (aLen > index) createProperty(result, index, arguments[index++]); + result.length = aLen; + return result; + } +}); + +},{"./_create-property":33,"./_export":42,"./_fails":44}],153:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $reduce = require('./_array-reduce'); + +$export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', { + // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) + reduceRight: function reduceRight(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], true); + } +}); + +},{"./_array-reduce":22,"./_export":42,"./_strict-method":111}],154:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $reduce = require('./_array-reduce'); + +$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', { + // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) + reduce: function reduce(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], false); + } +}); + +},{"./_array-reduce":22,"./_export":42,"./_strict-method":111}],155:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var html = require('./_html'); +var cof = require('./_cof'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +var arraySlice = [].slice; + +// fallback for not array-like ES3 strings and DOM objects +$export($export.P + $export.F * require('./_fails')(function () { + if (html) arraySlice.call(html); +}), 'Array', { + slice: function slice(begin, end) { + var len = toLength(this.length); + var klass = cof(this); + end = end === undefined ? len : end; + if (klass == 'Array') return arraySlice.call(this, begin, end); + var start = toAbsoluteIndex(begin, len); + var upTo = toAbsoluteIndex(end, len); + var size = toLength(upTo - start); + var cloned = new Array(size); + var i = 0; + for (; i < size; i++) cloned[i] = klass == 'String' + ? this.charAt(start + i) + : this[start + i]; + return cloned; + } +}); + +},{"./_cof":27,"./_export":42,"./_fails":44,"./_html":52,"./_to-absolute-index":120,"./_to-length":124}],156:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $some = require('./_array-methods')(3); + +$export($export.P + $export.F * !require('./_strict-method')([].some, true), 'Array', { + // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],157:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var toObject = require('./_to-object'); +var fails = require('./_fails'); +var $sort = [].sort; +var test = [1, 2, 3]; + +$export($export.P + $export.F * (fails(function () { + // IE8- + test.sort(undefined); +}) || !fails(function () { + // V8 bug + test.sort(null); + // Old WebKit +}) || !require('./_strict-method')($sort)), 'Array', { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(toObject(this)) + : $sort.call(toObject(this), aFunction(comparefn)); + } +}); + +},{"./_a-function":12,"./_export":42,"./_fails":44,"./_strict-method":111,"./_to-object":125}],158:[function(require,module,exports){ +require('./_set-species')('Array'); + +},{"./_set-species":106}],159:[function(require,module,exports){ +// 20.3.3.1 / 15.9.4.4 Date.now() +var $export = require('./_export'); + +$export($export.S, 'Date', { now: function () { return new Date().getTime(); } }); + +},{"./_export":42}],160:[function(require,module,exports){ +// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() +var $export = require('./_export'); +var toISOString = require('./_date-to-iso-string'); + +// PhantomJS / old WebKit has a broken implementations +$export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', { + toISOString: toISOString +}); + +},{"./_date-to-iso-string":35,"./_export":42}],161:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); + +$export($export.P + $export.F * require('./_fails')(function () { + return new Date(NaN).toJSON() !== null + || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; +}), 'Date', { + // eslint-disable-next-line no-unused-vars + toJSON: function toJSON(key) { + var O = toObject(this); + var pv = toPrimitive(O); + return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); + } +}); + +},{"./_export":42,"./_fails":44,"./_to-object":125,"./_to-primitive":126}],162:[function(require,module,exports){ +var TO_PRIMITIVE = require('./_wks')('toPrimitive'); +var proto = Date.prototype; + +if (!(TO_PRIMITIVE in proto)) require('./_hide')(proto, TO_PRIMITIVE, require('./_date-to-primitive')); + +},{"./_date-to-primitive":36,"./_hide":51,"./_wks":135}],163:[function(require,module,exports){ +var DateProto = Date.prototype; +var INVALID_DATE = 'Invalid Date'; +var TO_STRING = 'toString'; +var $toString = DateProto[TO_STRING]; +var getTime = DateProto.getTime; +if (new Date(NaN) + '' != INVALID_DATE) { + require('./_redefine')(DateProto, TO_STRING, function toString() { + var value = getTime.call(this); + // eslint-disable-next-line no-self-compare + return value === value ? $toString.call(this) : INVALID_DATE; + }); +} + +},{"./_redefine":100}],164:[function(require,module,exports){ +// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) +var $export = require('./_export'); + +$export($export.P, 'Function', { bind: require('./_bind') }); + +},{"./_bind":25,"./_export":42}],165:[function(require,module,exports){ +'use strict'; +var isObject = require('./_is-object'); +var getPrototypeOf = require('./_object-gpo'); +var HAS_INSTANCE = require('./_wks')('hasInstance'); +var FunctionProto = Function.prototype; +// 19.2.3.6 Function.prototype[@@hasInstance](V) +if (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) { + if (typeof this != 'function' || !isObject(O)) return false; + if (!isObject(this.prototype)) return O instanceof this; + // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + while (O = getPrototypeOf(O)) if (this.prototype === O) return true; + return false; +} }); + +},{"./_is-object":60,"./_object-dp":80,"./_object-gpo":87,"./_wks":135}],166:[function(require,module,exports){ +var dP = require('./_object-dp').f; +var FProto = Function.prototype; +var nameRE = /^\s*function ([^ (]*)/; +var NAME = 'name'; + +// 19.2.4.2 name +NAME in FProto || require('./_descriptors') && dP(FProto, NAME, { + configurable: true, + get: function () { + try { + return ('' + this).match(nameRE)[1]; + } catch (e) { + return ''; + } + } +}); + +},{"./_descriptors":38,"./_object-dp":80}],167:[function(require,module,exports){ +'use strict'; +var strong = require('./_collection-strong'); +var validate = require('./_validate-collection'); +var MAP = 'Map'; + +// 23.1 Map Objects +module.exports = require('./_collection')(MAP, function (get) { + return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key) { + var entry = strong.getEntry(validate(this, MAP), key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value) { + return strong.def(validate(this, MAP), key === 0 ? 0 : key, value); + } +}, strong, true); + +},{"./_collection":31,"./_collection-strong":28,"./_validate-collection":132}],168:[function(require,module,exports){ +// 20.2.2.3 Math.acosh(x) +var $export = require('./_export'); +var log1p = require('./_math-log1p'); +var sqrt = Math.sqrt; +var $acosh = Math.acosh; + +$export($export.S + $export.F * !($acosh + // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 + && Math.floor($acosh(Number.MAX_VALUE)) == 710 + // Tor Browser bug: Math.acosh(Infinity) -> NaN + && $acosh(Infinity) == Infinity +), 'Math', { + acosh: function acosh(x) { + return (x = +x) < 1 ? NaN : x > 94906265.62425156 + ? Math.log(x) + Math.LN2 + : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); + } +}); + +},{"./_export":42,"./_math-log1p":71}],169:[function(require,module,exports){ +// 20.2.2.5 Math.asinh(x) +var $export = require('./_export'); +var $asinh = Math.asinh; + +function asinh(x) { + return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); +} + +// Tor Browser bug: Math.asinh(0) -> -0 +$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh }); + +},{"./_export":42}],170:[function(require,module,exports){ +// 20.2.2.7 Math.atanh(x) +var $export = require('./_export'); +var $atanh = Math.atanh; + +// Tor Browser bug: Math.atanh(-0) -> 0 +$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { + atanh: function atanh(x) { + return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; + } +}); + +},{"./_export":42}],171:[function(require,module,exports){ +// 20.2.2.9 Math.cbrt(x) +var $export = require('./_export'); +var sign = require('./_math-sign'); + +$export($export.S, 'Math', { + cbrt: function cbrt(x) { + return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); + } +}); + +},{"./_export":42,"./_math-sign":73}],172:[function(require,module,exports){ +// 20.2.2.11 Math.clz32(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + clz32: function clz32(x) { + return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; + } +}); + +},{"./_export":42}],173:[function(require,module,exports){ +// 20.2.2.12 Math.cosh(x) +var $export = require('./_export'); +var exp = Math.exp; + +$export($export.S, 'Math', { + cosh: function cosh(x) { + return (exp(x = +x) + exp(-x)) / 2; + } +}); + +},{"./_export":42}],174:[function(require,module,exports){ +// 20.2.2.14 Math.expm1(x) +var $export = require('./_export'); +var $expm1 = require('./_math-expm1'); + +$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 }); + +},{"./_export":42,"./_math-expm1":69}],175:[function(require,module,exports){ +// 20.2.2.16 Math.fround(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { fround: require('./_math-fround') }); + +},{"./_export":42,"./_math-fround":70}],176:[function(require,module,exports){ +// 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) +var $export = require('./_export'); +var abs = Math.abs; + +$export($export.S, 'Math', { + hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars + var sum = 0; + var i = 0; + var aLen = arguments.length; + var larg = 0; + var arg, div; + while (i < aLen) { + arg = abs(arguments[i++]); + if (larg < arg) { + div = larg / arg; + sum = sum * div * div + 1; + larg = arg; + } else if (arg > 0) { + div = arg / larg; + sum += div * div; + } else sum += arg; + } + return larg === Infinity ? Infinity : larg * Math.sqrt(sum); + } +}); + +},{"./_export":42}],177:[function(require,module,exports){ +// 20.2.2.18 Math.imul(x, y) +var $export = require('./_export'); +var $imul = Math.imul; + +// some WebKit versions fails with big numbers, some has wrong arity +$export($export.S + $export.F * require('./_fails')(function () { + return $imul(0xffffffff, 5) != -5 || $imul.length != 2; +}), 'Math', { + imul: function imul(x, y) { + var UINT16 = 0xffff; + var xn = +x; + var yn = +y; + var xl = UINT16 & xn; + var yl = UINT16 & yn; + return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); + } +}); + +},{"./_export":42,"./_fails":44}],178:[function(require,module,exports){ +// 20.2.2.21 Math.log10(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + log10: function log10(x) { + return Math.log(x) * Math.LOG10E; + } +}); + +},{"./_export":42}],179:[function(require,module,exports){ +// 20.2.2.20 Math.log1p(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { log1p: require('./_math-log1p') }); + +},{"./_export":42,"./_math-log1p":71}],180:[function(require,module,exports){ +// 20.2.2.22 Math.log2(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + log2: function log2(x) { + return Math.log(x) / Math.LN2; + } +}); + +},{"./_export":42}],181:[function(require,module,exports){ +// 20.2.2.28 Math.sign(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { sign: require('./_math-sign') }); + +},{"./_export":42,"./_math-sign":73}],182:[function(require,module,exports){ +// 20.2.2.30 Math.sinh(x) +var $export = require('./_export'); +var expm1 = require('./_math-expm1'); +var exp = Math.exp; + +// V8 near Chromium 38 has a problem with very small numbers +$export($export.S + $export.F * require('./_fails')(function () { + return !Math.sinh(-2e-17) != -2e-17; +}), 'Math', { + sinh: function sinh(x) { + return Math.abs(x = +x) < 1 + ? (expm1(x) - expm1(-x)) / 2 + : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); + } +}); + +},{"./_export":42,"./_fails":44,"./_math-expm1":69}],183:[function(require,module,exports){ +// 20.2.2.33 Math.tanh(x) +var $export = require('./_export'); +var expm1 = require('./_math-expm1'); +var exp = Math.exp; + +$export($export.S, 'Math', { + tanh: function tanh(x) { + var a = expm1(x = +x); + var b = expm1(-x); + return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); + } +}); + +},{"./_export":42,"./_math-expm1":69}],184:[function(require,module,exports){ +// 20.2.2.34 Math.trunc(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + trunc: function trunc(it) { + return (it > 0 ? Math.floor : Math.ceil)(it); + } +}); + +},{"./_export":42}],185:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var has = require('./_has'); +var cof = require('./_cof'); +var inheritIfRequired = require('./_inherit-if-required'); +var toPrimitive = require('./_to-primitive'); +var fails = require('./_fails'); +var gOPN = require('./_object-gopn').f; +var gOPD = require('./_object-gopd').f; +var dP = require('./_object-dp').f; +var $trim = require('./_string-trim').trim; +var NUMBER = 'Number'; +var $Number = global[NUMBER]; +var Base = $Number; +var proto = $Number.prototype; +// Opera ~12 has broken Object#toString +var BROKEN_COF = cof(require('./_object-create')(proto)) == NUMBER; +var TRIM = 'trim' in String.prototype; + +// 7.1.3 ToNumber(argument) +var toNumber = function (argument) { + var it = toPrimitive(argument, false); + if (typeof it == 'string' && it.length > 2) { + it = TRIM ? it.trim() : $trim(it, 3); + var first = it.charCodeAt(0); + var third, radix, maxCode; + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i + case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i + default: return +it; + } + for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { + code = digits.charCodeAt(i); + // parseInt parses a string to a first unavailable symbol + // but ToNumber should return NaN if a string contains unavailable symbols + if (code < 48 || code > maxCode) return NaN; + } return parseInt(digits, radix); + } + } return +it; +}; + +if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { + $Number = function Number(value) { + var it = arguments.length < 1 ? 0 : value; + var that = this; + return that instanceof $Number + // check on 1..constructor(foo) case + && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) + ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); + }; + for (var keys = require('./_descriptors') ? gOPN(Base) : ( + // ES3: + 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES6 (in case, if modules with ES6 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + ).split(','), j = 0, key; keys.length > j; j++) { + if (has(Base, key = keys[j]) && !has($Number, key)) { + dP($Number, key, gOPD(Base, key)); + } + } + $Number.prototype = proto; + proto.constructor = $Number; + require('./_redefine')(global, NUMBER, $Number); +} + +},{"./_cof":27,"./_descriptors":38,"./_fails":44,"./_global":49,"./_has":50,"./_inherit-if-required":54,"./_object-create":79,"./_object-dp":80,"./_object-gopd":83,"./_object-gopn":85,"./_redefine":100,"./_string-trim":117,"./_to-primitive":126}],186:[function(require,module,exports){ +// 20.1.2.1 Number.EPSILON +var $export = require('./_export'); + +$export($export.S, 'Number', { EPSILON: Math.pow(2, -52) }); + +},{"./_export":42}],187:[function(require,module,exports){ +// 20.1.2.2 Number.isFinite(number) +var $export = require('./_export'); +var _isFinite = require('./_global').isFinite; + +$export($export.S, 'Number', { + isFinite: function isFinite(it) { + return typeof it == 'number' && _isFinite(it); + } +}); + +},{"./_export":42,"./_global":49}],188:[function(require,module,exports){ +// 20.1.2.3 Number.isInteger(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { isInteger: require('./_is-integer') }); + +},{"./_export":42,"./_is-integer":59}],189:[function(require,module,exports){ +// 20.1.2.4 Number.isNaN(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { + isNaN: function isNaN(number) { + // eslint-disable-next-line no-self-compare + return number != number; + } +}); + +},{"./_export":42}],190:[function(require,module,exports){ +// 20.1.2.5 Number.isSafeInteger(number) +var $export = require('./_export'); +var isInteger = require('./_is-integer'); +var abs = Math.abs; + +$export($export.S, 'Number', { + isSafeInteger: function isSafeInteger(number) { + return isInteger(number) && abs(number) <= 0x1fffffffffffff; + } +}); + +},{"./_export":42,"./_is-integer":59}],191:[function(require,module,exports){ +// 20.1.2.6 Number.MAX_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); + +},{"./_export":42}],192:[function(require,module,exports){ +// 20.1.2.10 Number.MIN_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); + +},{"./_export":42}],193:[function(require,module,exports){ +var $export = require('./_export'); +var $parseFloat = require('./_parse-float'); +// 20.1.2.12 Number.parseFloat(string) +$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat }); + +},{"./_export":42,"./_parse-float":94}],194:[function(require,module,exports){ +var $export = require('./_export'); +var $parseInt = require('./_parse-int'); +// 20.1.2.13 Number.parseInt(string, radix) +$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt }); + +},{"./_export":42,"./_parse-int":95}],195:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toInteger = require('./_to-integer'); +var aNumberValue = require('./_a-number-value'); +var repeat = require('./_string-repeat'); +var $toFixed = 1.0.toFixed; +var floor = Math.floor; +var data = [0, 0, 0, 0, 0, 0]; +var ERROR = 'Number.toFixed: incorrect invocation!'; +var ZERO = '0'; + +var multiply = function (n, c) { + var i = -1; + var c2 = c; + while (++i < 6) { + c2 += n * data[i]; + data[i] = c2 % 1e7; + c2 = floor(c2 / 1e7); + } +}; +var divide = function (n) { + var i = 6; + var c = 0; + while (--i >= 0) { + c += data[i]; + data[i] = floor(c / n); + c = (c % n) * 1e7; + } +}; +var numToString = function () { + var i = 6; + var s = ''; + while (--i >= 0) { + if (s !== '' || i === 0 || data[i] !== 0) { + var t = String(data[i]); + s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; + } + } return s; +}; +var pow = function (x, n, acc) { + return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); +}; +var log = function (x) { + var n = 0; + var x2 = x; + while (x2 >= 4096) { + n += 12; + x2 /= 4096; + } + while (x2 >= 2) { + n += 1; + x2 /= 2; + } return n; +}; + +$export($export.P + $export.F * (!!$toFixed && ( + 0.00008.toFixed(3) !== '0.000' || + 0.9.toFixed(0) !== '1' || + 1.255.toFixed(2) !== '1.25' || + 1000000000000000128.0.toFixed(0) !== '1000000000000000128' +) || !require('./_fails')(function () { + // V8 ~ Android 4.3- + $toFixed.call({}); +})), 'Number', { + toFixed: function toFixed(fractionDigits) { + var x = aNumberValue(this, ERROR); + var f = toInteger(fractionDigits); + var s = ''; + var m = ZERO; + var e, z, j, k; + if (f < 0 || f > 20) throw RangeError(ERROR); + // eslint-disable-next-line no-self-compare + if (x != x) return 'NaN'; + if (x <= -1e21 || x >= 1e21) return String(x); + if (x < 0) { + s = '-'; + x = -x; + } + if (x > 1e-21) { + e = log(x * pow(2, 69, 1)) - 69; + z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); + z *= 0x10000000000000; + e = 52 - e; + if (e > 0) { + multiply(0, z); + j = f; + while (j >= 7) { + multiply(1e7, 0); + j -= 7; + } + multiply(pow(10, j, 1), 0); + j = e - 1; + while (j >= 23) { + divide(1 << 23); + j -= 23; + } + divide(1 << j); + multiply(1, 1); + divide(2); + m = numToString(); + } else { + multiply(0, z); + multiply(1 << -e, 0); + m = numToString() + repeat.call(ZERO, f); + } + } + if (f > 0) { + k = m.length; + m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); + } else { + m = s + m; + } return m; + } +}); + +},{"./_a-number-value":13,"./_export":42,"./_fails":44,"./_string-repeat":116,"./_to-integer":122}],196:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $fails = require('./_fails'); +var aNumberValue = require('./_a-number-value'); +var $toPrecision = 1.0.toPrecision; + +$export($export.P + $export.F * ($fails(function () { + // IE7- + return $toPrecision.call(1, undefined) !== '1'; +}) || !$fails(function () { + // V8 ~ Android 4.3- + $toPrecision.call({}); +})), 'Number', { + toPrecision: function toPrecision(precision) { + var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); + return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); + } +}); + +},{"./_a-number-value":13,"./_export":42,"./_fails":44}],197:[function(require,module,exports){ +// 19.1.3.1 Object.assign(target, source) +var $export = require('./_export'); + +$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') }); + +},{"./_export":42,"./_object-assign":78}],198:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +$export($export.S, 'Object', { create: require('./_object-create') }); + +},{"./_export":42,"./_object-create":79}],199:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') }); + +},{"./_descriptors":38,"./_export":42,"./_object-dps":81}],200:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f }); + +},{"./_descriptors":38,"./_export":42,"./_object-dp":80}],201:[function(require,module,exports){ +// 19.1.2.5 Object.freeze(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('freeze', function ($freeze) { + return function freeze(it) { + return $freeze && isObject(it) ? $freeze(meta(it)) : it; + }; +}); + +},{"./_is-object":60,"./_meta":74,"./_object-sap":91}],202:[function(require,module,exports){ +// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) +var toIObject = require('./_to-iobject'); +var $getOwnPropertyDescriptor = require('./_object-gopd').f; + +require('./_object-sap')('getOwnPropertyDescriptor', function () { + return function getOwnPropertyDescriptor(it, key) { + return $getOwnPropertyDescriptor(toIObject(it), key); + }; +}); + +},{"./_object-gopd":83,"./_object-sap":91,"./_to-iobject":123}],203:[function(require,module,exports){ +// 19.1.2.7 Object.getOwnPropertyNames(O) +require('./_object-sap')('getOwnPropertyNames', function () { + return require('./_object-gopn-ext').f; +}); + +},{"./_object-gopn-ext":84,"./_object-sap":91}],204:[function(require,module,exports){ +// 19.1.2.9 Object.getPrototypeOf(O) +var toObject = require('./_to-object'); +var $getPrototypeOf = require('./_object-gpo'); + +require('./_object-sap')('getPrototypeOf', function () { + return function getPrototypeOf(it) { + return $getPrototypeOf(toObject(it)); + }; +}); + +},{"./_object-gpo":87,"./_object-sap":91,"./_to-object":125}],205:[function(require,module,exports){ +// 19.1.2.11 Object.isExtensible(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isExtensible', function ($isExtensible) { + return function isExtensible(it) { + return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; + }; +}); + +},{"./_is-object":60,"./_object-sap":91}],206:[function(require,module,exports){ +// 19.1.2.12 Object.isFrozen(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isFrozen', function ($isFrozen) { + return function isFrozen(it) { + return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + }; +}); + +},{"./_is-object":60,"./_object-sap":91}],207:[function(require,module,exports){ +// 19.1.2.13 Object.isSealed(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isSealed', function ($isSealed) { + return function isSealed(it) { + return isObject(it) ? $isSealed ? $isSealed(it) : false : true; + }; +}); + +},{"./_is-object":60,"./_object-sap":91}],208:[function(require,module,exports){ +// 19.1.3.10 Object.is(value1, value2) +var $export = require('./_export'); +$export($export.S, 'Object', { is: require('./_same-value') }); + +},{"./_export":42,"./_same-value":102}],209:[function(require,module,exports){ +// 19.1.2.14 Object.keys(O) +var toObject = require('./_to-object'); +var $keys = require('./_object-keys'); + +require('./_object-sap')('keys', function () { + return function keys(it) { + return $keys(toObject(it)); + }; +}); + +},{"./_object-keys":89,"./_object-sap":91,"./_to-object":125}],210:[function(require,module,exports){ +// 19.1.2.15 Object.preventExtensions(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('preventExtensions', function ($preventExtensions) { + return function preventExtensions(it) { + return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; + }; +}); + +},{"./_is-object":60,"./_meta":74,"./_object-sap":91}],211:[function(require,module,exports){ +// 19.1.2.17 Object.seal(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('seal', function ($seal) { + return function seal(it) { + return $seal && isObject(it) ? $seal(meta(it)) : it; + }; +}); + +},{"./_is-object":60,"./_meta":74,"./_object-sap":91}],212:[function(require,module,exports){ +// 19.1.3.19 Object.setPrototypeOf(O, proto) +var $export = require('./_export'); +$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set }); + +},{"./_export":42,"./_set-proto":105}],213:[function(require,module,exports){ +'use strict'; +// 19.1.3.6 Object.prototype.toString() +var classof = require('./_classof'); +var test = {}; +test[require('./_wks')('toStringTag')] = 'z'; +if (test + '' != '[object z]') { + require('./_redefine')(Object.prototype, 'toString', function toString() { + return '[object ' + classof(this) + ']'; + }, true); +} + +},{"./_classof":26,"./_redefine":100,"./_wks":135}],214:[function(require,module,exports){ +var $export = require('./_export'); +var $parseFloat = require('./_parse-float'); +// 18.2.4 parseFloat(string) +$export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat }); + +},{"./_export":42,"./_parse-float":94}],215:[function(require,module,exports){ +var $export = require('./_export'); +var $parseInt = require('./_parse-int'); +// 18.2.5 parseInt(string, radix) +$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); + +},{"./_export":42,"./_parse-int":95}],216:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var global = require('./_global'); +var ctx = require('./_ctx'); +var classof = require('./_classof'); +var $export = require('./_export'); +var isObject = require('./_is-object'); +var aFunction = require('./_a-function'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var speciesConstructor = require('./_species-constructor'); +var task = require('./_task').set; +var microtask = require('./_microtask')(); +var newPromiseCapabilityModule = require('./_new-promise-capability'); +var perform = require('./_perform'); +var userAgent = require('./_user-agent'); +var promiseResolve = require('./_promise-resolve'); +var PROMISE = 'Promise'; +var TypeError = global.TypeError; +var process = global.process; +var versions = process && process.versions; +var v8 = versions && versions.v8 || ''; +var $Promise = global[PROMISE]; +var isNode = classof(process) == 'process'; +var empty = function () { /* empty */ }; +var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; +var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; + +var USE_NATIVE = !!function () { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1); + var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) { + exec(empty, empty); + }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode || typeof PromiseRejectionEvent == 'function') + && promise.then(empty) instanceof FakePromise + // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables + // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 + // we can't detect it synchronously, so just check versions + && v8.indexOf('6.6') !== 0 + && userAgent.indexOf('Chrome/66') === -1; + } catch (e) { /* empty */ } +}(); + +// helpers +var isThenable = function (it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var notify = function (promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function () { + var value = promise._v; + var ok = promise._s == 1; + var i = 0; + var run = function (reaction) { + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); // may throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + if (domain && !exited) domain.exit(); + reject(e); + } + }; + while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); +}; +var onUnhandled = function (promise) { + task.call(global, function () { + var value = promise._v; + var unhandled = isUnhandled(promise); + var result, handler, console; + if (unhandled) { + result = perform(function () { + if (isNode) { + process.emit('unhandledRejection', value, promise); + } else if (handler = global.onunhandledrejection) { + handler({ promise: promise, reason: value }); + } else if ((console = global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + } promise._a = undefined; + if (unhandled && result.e) throw result.v; + }); +}; +var isUnhandled = function (promise) { + return promise._h !== 1 && (promise._a || promise._c).length === 0; +}; +var onHandleUnhandled = function (promise) { + task.call(global, function () { + var handler; + if (isNode) { + process.emit('rejectionHandled', promise); + } else if (handler = global.onrejectionhandled) { + handler({ promise: promise, reason: promise._v }); + } + }); +}; +var $reject = function (value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); +}; +var $resolve = function (value) { + var promise = this; + var then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError("Promise can't be resolved itself"); + if (then = isThenable(value)) { + microtask(function () { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } +}; + +// constructor polyfill +if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + // eslint-disable-next-line no-unused-vars + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = require('./_redefine-all')($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + OwnPromiseCapability = function () { + var promise = new Internal(); + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; + newPromiseCapabilityModule.f = newPromiseCapability = function (C) { + return C === $Promise || C === Wrapper + ? new OwnPromiseCapability(C) + : newGenericPromiseCapability(C); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); +require('./_set-to-string-tag')($Promise, PROMISE); +require('./_set-species')(PROMISE); +Wrapper = require('./_core')[PROMISE]; + +// statics +$export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this); + var $$reject = capability.reject; + $$reject(r); + return capability.promise; + } +}); +$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); + } +}); +$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) { + $Promise.all(iter)['catch'](empty); +})), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var values = []; + var index = 0; + var remaining = 1; + forOf(iterable, false, function (promise) { + var $index = index++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.e) reject(result.v); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var reject = capability.reject; + var result = perform(function () { + forOf(iterable, false, function (promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (result.e) reject(result.v); + return capability.promise; + } +}); + +},{"./_a-function":12,"./_an-instance":15,"./_classof":26,"./_core":32,"./_ctx":34,"./_export":42,"./_for-of":48,"./_global":49,"./_is-object":60,"./_iter-detect":65,"./_library":68,"./_microtask":76,"./_new-promise-capability":77,"./_perform":96,"./_promise-resolve":97,"./_redefine-all":99,"./_set-species":106,"./_set-to-string-tag":107,"./_species-constructor":110,"./_task":119,"./_user-agent":131,"./_wks":135}],217:[function(require,module,exports){ +// 26.1.1 Reflect.apply(target, thisArgument, argumentsList) +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var rApply = (require('./_global').Reflect || {}).apply; +var fApply = Function.apply; +// MS Edge argumentsList argument is optional +$export($export.S + $export.F * !require('./_fails')(function () { + rApply(function () { /* empty */ }); +}), 'Reflect', { + apply: function apply(target, thisArgument, argumentsList) { + var T = aFunction(target); + var L = anObject(argumentsList); + return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); + } +}); + +},{"./_a-function":12,"./_an-object":16,"./_export":42,"./_fails":44,"./_global":49}],218:[function(require,module,exports){ +// 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) +var $export = require('./_export'); +var create = require('./_object-create'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var bind = require('./_bind'); +var rConstruct = (require('./_global').Reflect || {}).construct; + +// MS Edge supports only 2 arguments and argumentsList argument is optional +// FF Nightly sets third argument as `new.target`, but does not create `this` from it +var NEW_TARGET_BUG = fails(function () { + function F() { /* empty */ } + return !(rConstruct(function () { /* empty */ }, [], F) instanceof F); +}); +var ARGS_BUG = !fails(function () { + rConstruct(function () { /* empty */ }); +}); + +$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { + construct: function construct(Target, args /* , newTarget */) { + aFunction(Target); + anObject(args); + var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); + if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget); + if (Target == newTarget) { + // w/o altered newTarget, optimization for 0-4 arguments + switch (args.length) { + case 0: return new Target(); + case 1: return new Target(args[0]); + case 2: return new Target(args[0], args[1]); + case 3: return new Target(args[0], args[1], args[2]); + case 4: return new Target(args[0], args[1], args[2], args[3]); + } + // w/o altered newTarget, lot of arguments case + var $args = [null]; + $args.push.apply($args, args); + return new (bind.apply(Target, $args))(); + } + // with altered newTarget, not support built-in constructors + var proto = newTarget.prototype; + var instance = create(isObject(proto) ? proto : Object.prototype); + var result = Function.apply.call(Target, instance, args); + return isObject(result) ? result : instance; + } +}); + +},{"./_a-function":12,"./_an-object":16,"./_bind":25,"./_export":42,"./_fails":44,"./_global":49,"./_is-object":60,"./_object-create":79}],219:[function(require,module,exports){ +// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) +var dP = require('./_object-dp'); +var $export = require('./_export'); +var anObject = require('./_an-object'); +var toPrimitive = require('./_to-primitive'); + +// MS Edge has broken Reflect.defineProperty - throwing instead of returning false +$export($export.S + $export.F * require('./_fails')(function () { + // eslint-disable-next-line no-undef + Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); +}), 'Reflect', { + defineProperty: function defineProperty(target, propertyKey, attributes) { + anObject(target); + propertyKey = toPrimitive(propertyKey, true); + anObject(attributes); + try { + dP.f(target, propertyKey, attributes); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_an-object":16,"./_export":42,"./_fails":44,"./_object-dp":80,"./_to-primitive":126}],220:[function(require,module,exports){ +// 26.1.4 Reflect.deleteProperty(target, propertyKey) +var $export = require('./_export'); +var gOPD = require('./_object-gopd').f; +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + deleteProperty: function deleteProperty(target, propertyKey) { + var desc = gOPD(anObject(target), propertyKey); + return desc && !desc.configurable ? false : delete target[propertyKey]; + } +}); + +},{"./_an-object":16,"./_export":42,"./_object-gopd":83}],221:[function(require,module,exports){ +'use strict'; +// 26.1.5 Reflect.enumerate(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var Enumerate = function (iterated) { + this._t = anObject(iterated); // target + this._i = 0; // next index + var keys = this._k = []; // keys + var key; + for (key in iterated) keys.push(key); +}; +require('./_iter-create')(Enumerate, 'Object', function () { + var that = this; + var keys = that._k; + var key; + do { + if (that._i >= keys.length) return { value: undefined, done: true }; + } while (!((key = keys[that._i++]) in that._t)); + return { value: key, done: false }; +}); + +$export($export.S, 'Reflect', { + enumerate: function enumerate(target) { + return new Enumerate(target); + } +}); + +},{"./_an-object":16,"./_export":42,"./_iter-create":63}],222:[function(require,module,exports){ +// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) +var gOPD = require('./_object-gopd'); +var $export = require('./_export'); +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { + return gOPD.f(anObject(target), propertyKey); + } +}); + +},{"./_an-object":16,"./_export":42,"./_object-gopd":83}],223:[function(require,module,exports){ +// 26.1.8 Reflect.getPrototypeOf(target) +var $export = require('./_export'); +var getProto = require('./_object-gpo'); +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + getPrototypeOf: function getPrototypeOf(target) { + return getProto(anObject(target)); + } +}); + +},{"./_an-object":16,"./_export":42,"./_object-gpo":87}],224:[function(require,module,exports){ +// 26.1.6 Reflect.get(target, propertyKey [, receiver]) +var gOPD = require('./_object-gopd'); +var getPrototypeOf = require('./_object-gpo'); +var has = require('./_has'); +var $export = require('./_export'); +var isObject = require('./_is-object'); +var anObject = require('./_an-object'); + +function get(target, propertyKey /* , receiver */) { + var receiver = arguments.length < 3 ? target : arguments[2]; + var desc, proto; + if (anObject(target) === receiver) return target[propertyKey]; + if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') + ? desc.value + : desc.get !== undefined + ? desc.get.call(receiver) + : undefined; + if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver); +} + +$export($export.S, 'Reflect', { get: get }); + +},{"./_an-object":16,"./_export":42,"./_has":50,"./_is-object":60,"./_object-gopd":83,"./_object-gpo":87}],225:[function(require,module,exports){ +// 26.1.9 Reflect.has(target, propertyKey) +var $export = require('./_export'); + +$export($export.S, 'Reflect', { + has: function has(target, propertyKey) { + return propertyKey in target; + } +}); + +},{"./_export":42}],226:[function(require,module,exports){ +// 26.1.10 Reflect.isExtensible(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var $isExtensible = Object.isExtensible; + +$export($export.S, 'Reflect', { + isExtensible: function isExtensible(target) { + anObject(target); + return $isExtensible ? $isExtensible(target) : true; + } +}); + +},{"./_an-object":16,"./_export":42}],227:[function(require,module,exports){ +// 26.1.11 Reflect.ownKeys(target) +var $export = require('./_export'); + +$export($export.S, 'Reflect', { ownKeys: require('./_own-keys') }); + +},{"./_export":42,"./_own-keys":93}],228:[function(require,module,exports){ +// 26.1.12 Reflect.preventExtensions(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var $preventExtensions = Object.preventExtensions; + +$export($export.S, 'Reflect', { + preventExtensions: function preventExtensions(target) { + anObject(target); + try { + if ($preventExtensions) $preventExtensions(target); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_an-object":16,"./_export":42}],229:[function(require,module,exports){ +// 26.1.14 Reflect.setPrototypeOf(target, proto) +var $export = require('./_export'); +var setProto = require('./_set-proto'); + +if (setProto) $export($export.S, 'Reflect', { + setPrototypeOf: function setPrototypeOf(target, proto) { + setProto.check(target, proto); + try { + setProto.set(target, proto); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_export":42,"./_set-proto":105}],230:[function(require,module,exports){ +// 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) +var dP = require('./_object-dp'); +var gOPD = require('./_object-gopd'); +var getPrototypeOf = require('./_object-gpo'); +var has = require('./_has'); +var $export = require('./_export'); +var createDesc = require('./_property-desc'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); + +function set(target, propertyKey, V /* , receiver */) { + var receiver = arguments.length < 4 ? target : arguments[3]; + var ownDesc = gOPD.f(anObject(target), propertyKey); + var existingDescriptor, proto; + if (!ownDesc) { + if (isObject(proto = getPrototypeOf(target))) { + return set(proto, propertyKey, V, receiver); + } + ownDesc = createDesc(0); + } + if (has(ownDesc, 'value')) { + if (ownDesc.writable === false || !isObject(receiver)) return false; + if (existingDescriptor = gOPD.f(receiver, propertyKey)) { + if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false; + existingDescriptor.value = V; + dP.f(receiver, propertyKey, existingDescriptor); + } else dP.f(receiver, propertyKey, createDesc(0, V)); + return true; + } + return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); +} + +$export($export.S, 'Reflect', { set: set }); + +},{"./_an-object":16,"./_export":42,"./_has":50,"./_is-object":60,"./_object-dp":80,"./_object-gopd":83,"./_object-gpo":87,"./_property-desc":98}],231:[function(require,module,exports){ +var global = require('./_global'); +var inheritIfRequired = require('./_inherit-if-required'); +var dP = require('./_object-dp').f; +var gOPN = require('./_object-gopn').f; +var isRegExp = require('./_is-regexp'); +var $flags = require('./_flags'); +var $RegExp = global.RegExp; +var Base = $RegExp; +var proto = $RegExp.prototype; +var re1 = /a/g; +var re2 = /a/g; +// "new" creates a new object, old webkit buggy here +var CORRECT_NEW = new $RegExp(re1) !== re1; + +if (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () { + re2[require('./_wks')('match')] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; +}))) { + $RegExp = function RegExp(p, f) { + var tiRE = this instanceof $RegExp; + var piRE = isRegExp(p); + var fiU = f === undefined; + return !tiRE && piRE && p.constructor === $RegExp && fiU ? p + : inheritIfRequired(CORRECT_NEW + ? new Base(piRE && !fiU ? p.source : p, f) + : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) + , tiRE ? this : proto, $RegExp); + }; + var proxy = function (key) { + key in $RegExp || dP($RegExp, key, { + configurable: true, + get: function () { return Base[key]; }, + set: function (it) { Base[key] = it; } + }); + }; + for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]); + proto.constructor = $RegExp; + $RegExp.prototype = proto; + require('./_redefine')(global, 'RegExp', $RegExp); +} + +require('./_set-species')('RegExp'); + +},{"./_descriptors":38,"./_fails":44,"./_flags":46,"./_global":49,"./_inherit-if-required":54,"./_is-regexp":61,"./_object-dp":80,"./_object-gopn":85,"./_redefine":100,"./_set-species":106,"./_wks":135}],232:[function(require,module,exports){ +// 21.2.5.3 get RegExp.prototype.flags() +if (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', { + configurable: true, + get: require('./_flags') +}); + +},{"./_descriptors":38,"./_flags":46,"./_object-dp":80}],233:[function(require,module,exports){ +// @@match logic +require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) { + // 21.1.3.11 String.prototype.match(regexp) + return [function match(regexp) { + 'use strict'; + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, $match]; +}); + +},{"./_fix-re-wks":45}],234:[function(require,module,exports){ +// @@replace logic +require('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace) { + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [function replace(searchValue, replaceValue) { + 'use strict'; + var O = defined(this); + var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, $replace]; +}); + +},{"./_fix-re-wks":45}],235:[function(require,module,exports){ +// @@search logic +require('./_fix-re-wks')('search', 1, function (defined, SEARCH, $search) { + // 21.1.3.15 String.prototype.search(regexp) + return [function search(regexp) { + 'use strict'; + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, $search]; +}); + +},{"./_fix-re-wks":45}],236:[function(require,module,exports){ +// @@split logic +require('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split) { + 'use strict'; + var isRegExp = require('./_is-regexp'); + var _split = $split; + var $push = [].push; + var $SPLIT = 'split'; + var LENGTH = 'length'; + var LAST_INDEX = 'lastIndex'; + if ( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ) { + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function (separator, limit) { + var string = String(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!isRegExp(separator)) return _split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + while (match = separatorCopy.exec(string)) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + // eslint-disable-next-line no-loop-func + if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { + for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; + }); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + $split = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); + }; + } + // 21.1.3.17 String.prototype.split(separator, limit) + return [function split(separator, limit) { + var O = defined(this); + var fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); + }, $split]; +}); + +},{"./_fix-re-wks":45,"./_is-regexp":61}],237:[function(require,module,exports){ +'use strict'; +require('./es6.regexp.flags'); +var anObject = require('./_an-object'); +var $flags = require('./_flags'); +var DESCRIPTORS = require('./_descriptors'); +var TO_STRING = 'toString'; +var $toString = /./[TO_STRING]; + +var define = function (fn) { + require('./_redefine')(RegExp.prototype, TO_STRING, fn, true); +}; + +// 21.2.5.14 RegExp.prototype.toString() +if (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { + define(function toString() { + var R = anObject(this); + return '/'.concat(R.source, '/', + 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); + }); +// FF44- RegExp#toString has a wrong name +} else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); +} + +},{"./_an-object":16,"./_descriptors":38,"./_fails":44,"./_flags":46,"./_redefine":100,"./es6.regexp.flags":232}],238:[function(require,module,exports){ +'use strict'; +var strong = require('./_collection-strong'); +var validate = require('./_validate-collection'); +var SET = 'Set'; + +// 23.2 Set Objects +module.exports = require('./_collection')(SET, function (get) { + return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value) { + return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value); + } +}, strong); + +},{"./_collection":31,"./_collection-strong":28,"./_validate-collection":132}],239:[function(require,module,exports){ +'use strict'; +// B.2.3.2 String.prototype.anchor(name) +require('./_string-html')('anchor', function (createHTML) { + return function anchor(name) { + return createHTML(this, 'a', 'name', name); + }; +}); + +},{"./_string-html":114}],240:[function(require,module,exports){ +'use strict'; +// B.2.3.3 String.prototype.big() +require('./_string-html')('big', function (createHTML) { + return function big() { + return createHTML(this, 'big', '', ''); + }; +}); + +},{"./_string-html":114}],241:[function(require,module,exports){ +'use strict'; +// B.2.3.4 String.prototype.blink() +require('./_string-html')('blink', function (createHTML) { + return function blink() { + return createHTML(this, 'blink', '', ''); + }; +}); + +},{"./_string-html":114}],242:[function(require,module,exports){ +'use strict'; +// B.2.3.5 String.prototype.bold() +require('./_string-html')('bold', function (createHTML) { + return function bold() { + return createHTML(this, 'b', '', ''); + }; +}); + +},{"./_string-html":114}],243:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $at = require('./_string-at')(false); +$export($export.P, 'String', { + // 21.1.3.3 String.prototype.codePointAt(pos) + codePointAt: function codePointAt(pos) { + return $at(this, pos); + } +}); + +},{"./_export":42,"./_string-at":112}],244:[function(require,module,exports){ +// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) +'use strict'; +var $export = require('./_export'); +var toLength = require('./_to-length'); +var context = require('./_string-context'); +var ENDS_WITH = 'endsWith'; +var $endsWith = ''[ENDS_WITH]; + +$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', { + endsWith: function endsWith(searchString /* , endPosition = @length */) { + var that = context(this, searchString, ENDS_WITH); + var endPosition = arguments.length > 1 ? arguments[1] : undefined; + var len = toLength(that.length); + var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); + var search = String(searchString); + return $endsWith + ? $endsWith.call(that, search, end) + : that.slice(end - search.length, end) === search; + } +}); + +},{"./_export":42,"./_fails-is-regexp":43,"./_string-context":113,"./_to-length":124}],245:[function(require,module,exports){ +'use strict'; +// B.2.3.6 String.prototype.fixed() +require('./_string-html')('fixed', function (createHTML) { + return function fixed() { + return createHTML(this, 'tt', '', ''); + }; +}); + +},{"./_string-html":114}],246:[function(require,module,exports){ +'use strict'; +// B.2.3.7 String.prototype.fontcolor(color) +require('./_string-html')('fontcolor', function (createHTML) { + return function fontcolor(color) { + return createHTML(this, 'font', 'color', color); + }; +}); + +},{"./_string-html":114}],247:[function(require,module,exports){ +'use strict'; +// B.2.3.8 String.prototype.fontsize(size) +require('./_string-html')('fontsize', function (createHTML) { + return function fontsize(size) { + return createHTML(this, 'font', 'size', size); + }; +}); + +},{"./_string-html":114}],248:[function(require,module,exports){ +var $export = require('./_export'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var fromCharCode = String.fromCharCode; +var $fromCodePoint = String.fromCodePoint; + +// length should be 1, old FF problem +$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars + var res = []; + var aLen = arguments.length; + var i = 0; + var code; + while (aLen > i) { + code = +arguments[i++]; + if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); + res.push(code < 0x10000 + ? fromCharCode(code) + : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) + ); + } return res.join(''); + } +}); + +},{"./_export":42,"./_to-absolute-index":120}],249:[function(require,module,exports){ +// 21.1.3.7 String.prototype.includes(searchString, position = 0) +'use strict'; +var $export = require('./_export'); +var context = require('./_string-context'); +var INCLUDES = 'includes'; + +$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', { + includes: function includes(searchString /* , position = 0 */) { + return !!~context(this, searchString, INCLUDES) + .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +},{"./_export":42,"./_fails-is-regexp":43,"./_string-context":113}],250:[function(require,module,exports){ +'use strict'; +// B.2.3.9 String.prototype.italics() +require('./_string-html')('italics', function (createHTML) { + return function italics() { + return createHTML(this, 'i', '', ''); + }; +}); + +},{"./_string-html":114}],251:[function(require,module,exports){ +'use strict'; +var $at = require('./_string-at')(true); + +// 21.1.3.27 String.prototype[@@iterator]() +require('./_iter-define')(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + +},{"./_iter-define":64,"./_string-at":112}],252:[function(require,module,exports){ +'use strict'; +// B.2.3.10 String.prototype.link(url) +require('./_string-html')('link', function (createHTML) { + return function link(url) { + return createHTML(this, 'a', 'href', url); + }; +}); + +},{"./_string-html":114}],253:[function(require,module,exports){ +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); + +$export($export.S, 'String', { + // 21.1.2.4 String.raw(callSite, ...substitutions) + raw: function raw(callSite) { + var tpl = toIObject(callSite.raw); + var len = toLength(tpl.length); + var aLen = arguments.length; + var res = []; + var i = 0; + while (len > i) { + res.push(String(tpl[i++])); + if (i < aLen) res.push(String(arguments[i])); + } return res.join(''); + } +}); + +},{"./_export":42,"./_to-iobject":123,"./_to-length":124}],254:[function(require,module,exports){ +var $export = require('./_export'); + +$export($export.P, 'String', { + // 21.1.3.13 String.prototype.repeat(count) + repeat: require('./_string-repeat') +}); + +},{"./_export":42,"./_string-repeat":116}],255:[function(require,module,exports){ +'use strict'; +// B.2.3.11 String.prototype.small() +require('./_string-html')('small', function (createHTML) { + return function small() { + return createHTML(this, 'small', '', ''); + }; +}); + +},{"./_string-html":114}],256:[function(require,module,exports){ +// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) +'use strict'; +var $export = require('./_export'); +var toLength = require('./_to-length'); +var context = require('./_string-context'); +var STARTS_WITH = 'startsWith'; +var $startsWith = ''[STARTS_WITH]; + +$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', { + startsWith: function startsWith(searchString /* , position = 0 */) { + var that = context(this, searchString, STARTS_WITH); + var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var search = String(searchString); + return $startsWith + ? $startsWith.call(that, search, index) + : that.slice(index, index + search.length) === search; + } +}); + +},{"./_export":42,"./_fails-is-regexp":43,"./_string-context":113,"./_to-length":124}],257:[function(require,module,exports){ +'use strict'; +// B.2.3.12 String.prototype.strike() +require('./_string-html')('strike', function (createHTML) { + return function strike() { + return createHTML(this, 'strike', '', ''); + }; +}); + +},{"./_string-html":114}],258:[function(require,module,exports){ +'use strict'; +// B.2.3.13 String.prototype.sub() +require('./_string-html')('sub', function (createHTML) { + return function sub() { + return createHTML(this, 'sub', '', ''); + }; +}); + +},{"./_string-html":114}],259:[function(require,module,exports){ +'use strict'; +// B.2.3.14 String.prototype.sup() +require('./_string-html')('sup', function (createHTML) { + return function sup() { + return createHTML(this, 'sup', '', ''); + }; +}); + +},{"./_string-html":114}],260:[function(require,module,exports){ +'use strict'; +// 21.1.3.25 String.prototype.trim() +require('./_string-trim')('trim', function ($trim) { + return function trim() { + return $trim(this, 3); + }; +}); + +},{"./_string-trim":117}],261:[function(require,module,exports){ +'use strict'; +// ECMAScript 6 symbols shim +var global = require('./_global'); +var has = require('./_has'); +var DESCRIPTORS = require('./_descriptors'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var META = require('./_meta').KEY; +var $fails = require('./_fails'); +var shared = require('./_shared'); +var setToStringTag = require('./_set-to-string-tag'); +var uid = require('./_uid'); +var wks = require('./_wks'); +var wksExt = require('./_wks-ext'); +var wksDefine = require('./_wks-define'); +var enumKeys = require('./_enum-keys'); +var isArray = require('./_is-array'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var toIObject = require('./_to-iobject'); +var toPrimitive = require('./_to-primitive'); +var createDesc = require('./_property-desc'); +var _create = require('./_object-create'); +var gOPNExt = require('./_object-gopn-ext'); +var $GOPD = require('./_object-gopd'); +var $DP = require('./_object-dp'); +var $keys = require('./_object-keys'); +var gOPD = $GOPD.f; +var dP = $DP.f; +var gOPN = gOPNExt.f; +var $Symbol = global.Symbol; +var $JSON = global.JSON; +var _stringify = $JSON && $JSON.stringify; +var PROTOTYPE = 'prototype'; +var HIDDEN = wks('_hidden'); +var TO_PRIMITIVE = wks('toPrimitive'); +var isEnum = {}.propertyIsEnumerable; +var SymbolRegistry = shared('symbol-registry'); +var AllSymbols = shared('symbols'); +var OPSymbols = shared('op-symbols'); +var ObjectProto = Object[PROTOTYPE]; +var USE_NATIVE = typeof $Symbol == 'function'; +var QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = DESCRIPTORS && $fails(function () { + return _create(dP({}, 'a', { + get: function () { return dP(this, 'a', { value: 7 }).a; } + })).a != 7; +}) ? function (it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); +} : dP; + +var wrap = function (tag) { + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; +}; + +var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + } return setSymbolDesc(it, key, D); + } return dP(it, key, D); +}; +var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys(P = toIObject(P)); + var i = 0; + var l = keys.length; + var key; + while (l > i) $defineProperty(it, key = keys[i++], P[key]); + return it; +}; +var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = toPrimitive(key, true)); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + } return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto; + var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + } return result; +}; + +// 19.4.1.1 Symbol([description]) +if (!USE_NATIVE) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function (value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames; + require('./_object-pie').f = $propertyIsEnumerable; + require('./_object-gops').f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !require('./_library')) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function (name) { + return wrap(wks(name)); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); + +for (var es6Symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' +).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); + +for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); + +$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function (key) { + return has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); + for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; + }, + useSetter: function () { setter = true; }, + useSimple: function () { setter = false; } +}); + +$export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); + +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it) { + var args = [it]; + var i = 1; + var replacer, $replacer; + while (arguments.length > i) args.push(arguments[i++]); + $replacer = replacer = args[1]; + if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + if (!isArray(replacer)) replacer = function (key, value) { + if (typeof $replacer == 'function') value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); + +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +setToStringTag(global.JSON, 'JSON', true); + +},{"./_an-object":16,"./_descriptors":38,"./_enum-keys":41,"./_export":42,"./_fails":44,"./_global":49,"./_has":50,"./_hide":51,"./_is-array":58,"./_is-object":60,"./_library":68,"./_meta":74,"./_object-create":79,"./_object-dp":80,"./_object-gopd":83,"./_object-gopn":85,"./_object-gopn-ext":84,"./_object-gops":86,"./_object-keys":89,"./_object-pie":90,"./_property-desc":98,"./_redefine":100,"./_set-to-string-tag":107,"./_shared":109,"./_to-iobject":123,"./_to-primitive":126,"./_uid":130,"./_wks":135,"./_wks-define":133,"./_wks-ext":134}],262:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $typed = require('./_typed'); +var buffer = require('./_typed-buffer'); +var anObject = require('./_an-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +var isObject = require('./_is-object'); +var ArrayBuffer = require('./_global').ArrayBuffer; +var speciesConstructor = require('./_species-constructor'); +var $ArrayBuffer = buffer.ArrayBuffer; +var $DataView = buffer.DataView; +var $isView = $typed.ABV && ArrayBuffer.isView; +var $slice = $ArrayBuffer.prototype.slice; +var VIEW = $typed.VIEW; +var ARRAY_BUFFER = 'ArrayBuffer'; + +$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer }); + +$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { + // 24.1.3.1 ArrayBuffer.isView(arg) + isView: function isView(it) { + return $isView && $isView(it) || isObject(it) && VIEW in it; + } +}); + +$export($export.P + $export.U + $export.F * require('./_fails')(function () { + return !new $ArrayBuffer(2).slice(1, undefined).byteLength; +}), ARRAY_BUFFER, { + // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) + slice: function slice(start, end) { + if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix + var len = anObject(this).byteLength; + var first = toAbsoluteIndex(start, len); + var fin = toAbsoluteIndex(end === undefined ? len : end, len); + var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first)); + var viewS = new $DataView(this); + var viewT = new $DataView(result); + var index = 0; + while (first < fin) { + viewT.setUint8(index++, viewS.getUint8(first++)); + } return result; + } +}); + +require('./_set-species')(ARRAY_BUFFER); + +},{"./_an-object":16,"./_export":42,"./_fails":44,"./_global":49,"./_is-object":60,"./_set-species":106,"./_species-constructor":110,"./_to-absolute-index":120,"./_to-length":124,"./_typed":129,"./_typed-buffer":128}],263:[function(require,module,exports){ +var $export = require('./_export'); +$export($export.G + $export.W + $export.F * !require('./_typed').ABV, { + DataView: require('./_typed-buffer').DataView +}); + +},{"./_export":42,"./_typed":129,"./_typed-buffer":128}],264:[function(require,module,exports){ +require('./_typed-array')('Float32', 4, function (init) { + return function Float32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],265:[function(require,module,exports){ +require('./_typed-array')('Float64', 8, function (init) { + return function Float64Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],266:[function(require,module,exports){ +require('./_typed-array')('Int16', 2, function (init) { + return function Int16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],267:[function(require,module,exports){ +require('./_typed-array')('Int32', 4, function (init) { + return function Int32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],268:[function(require,module,exports){ +require('./_typed-array')('Int8', 1, function (init) { + return function Int8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],269:[function(require,module,exports){ +require('./_typed-array')('Uint16', 2, function (init) { + return function Uint16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],270:[function(require,module,exports){ +require('./_typed-array')('Uint32', 4, function (init) { + return function Uint32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],271:[function(require,module,exports){ +require('./_typed-array')('Uint8', 1, function (init) { + return function Uint8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],272:[function(require,module,exports){ +require('./_typed-array')('Uint8', 1, function (init) { + return function Uint8ClampedArray(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}, true); + +},{"./_typed-array":127}],273:[function(require,module,exports){ +'use strict'; +var each = require('./_array-methods')(0); +var redefine = require('./_redefine'); +var meta = require('./_meta'); +var assign = require('./_object-assign'); +var weak = require('./_collection-weak'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var validate = require('./_validate-collection'); +var WEAK_MAP = 'WeakMap'; +var getWeak = meta.getWeak; +var isExtensible = Object.isExtensible; +var uncaughtFrozenStore = weak.ufstore; +var tmp = {}; +var InternalMap; + +var wrapper = function (get) { + return function WeakMap() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; +}; + +var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key) { + if (isObject(key)) { + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value) { + return weak.def(validate(this, WEAK_MAP), key, value); + } +}; + +// 23.3 WeakMap Objects +var $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true); + +// IE11 WeakMap frozen keys fix +if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) { + InternalMap = weak.getConstructor(wrapper, WEAK_MAP); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function (key) { + var proto = $WeakMap.prototype; + var method = proto[key]; + redefine(proto, key, function (a, b) { + // store frozen objects on internal weakmap shim + if (isObject(a) && !isExtensible(a)) { + if (!this._f) this._f = new InternalMap(); + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + } return method.call(this, a, b); + }); + }); +} + +},{"./_array-methods":21,"./_collection":31,"./_collection-weak":30,"./_fails":44,"./_is-object":60,"./_meta":74,"./_object-assign":78,"./_redefine":100,"./_validate-collection":132}],274:[function(require,module,exports){ +'use strict'; +var weak = require('./_collection-weak'); +var validate = require('./_validate-collection'); +var WEAK_SET = 'WeakSet'; + +// 23.4 WeakSet Objects +require('./_collection')(WEAK_SET, function (get) { + return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.4.3.1 WeakSet.prototype.add(value) + add: function add(value) { + return weak.def(validate(this, WEAK_SET), value, true); + } +}, weak, false, true); + +},{"./_collection":31,"./_collection-weak":30,"./_validate-collection":132}],275:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap +var $export = require('./_export'); +var flattenIntoArray = require('./_flatten-into-array'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var aFunction = require('./_a-function'); +var arraySpeciesCreate = require('./_array-species-create'); + +$export($export.P, 'Array', { + flatMap: function flatMap(callbackfn /* , thisArg */) { + var O = toObject(this); + var sourceLen, A; + aFunction(callbackfn); + sourceLen = toLength(O.length); + A = arraySpeciesCreate(O, 0); + flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]); + return A; + } +}); + +require('./_add-to-unscopables')('flatMap'); + +},{"./_a-function":12,"./_add-to-unscopables":14,"./_array-species-create":24,"./_export":42,"./_flatten-into-array":47,"./_to-length":124,"./_to-object":125}],276:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten +var $export = require('./_export'); +var flattenIntoArray = require('./_flatten-into-array'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var toInteger = require('./_to-integer'); +var arraySpeciesCreate = require('./_array-species-create'); + +$export($export.P, 'Array', { + flatten: function flatten(/* depthArg = 1 */) { + var depthArg = arguments[0]; + var O = toObject(this); + var sourceLen = toLength(O.length); + var A = arraySpeciesCreate(O, 0); + flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); + return A; + } +}); + +require('./_add-to-unscopables')('flatten'); + +},{"./_add-to-unscopables":14,"./_array-species-create":24,"./_export":42,"./_flatten-into-array":47,"./_to-integer":122,"./_to-length":124,"./_to-object":125}],277:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/Array.prototype.includes +var $export = require('./_export'); +var $includes = require('./_array-includes')(true); + +$export($export.P, 'Array', { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +require('./_add-to-unscopables')('includes'); + +},{"./_add-to-unscopables":14,"./_array-includes":20,"./_export":42}],278:[function(require,module,exports){ +// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask +var $export = require('./_export'); +var microtask = require('./_microtask')(); +var process = require('./_global').process; +var isNode = require('./_cof')(process) == 'process'; + +$export($export.G, { + asap: function asap(fn) { + var domain = isNode && process.domain; + microtask(domain ? domain.bind(fn) : fn); + } +}); + +},{"./_cof":27,"./_export":42,"./_global":49,"./_microtask":76}],279:[function(require,module,exports){ +// https://github.com/ljharb/proposal-is-error +var $export = require('./_export'); +var cof = require('./_cof'); + +$export($export.S, 'Error', { + isError: function isError(it) { + return cof(it) === 'Error'; + } +}); + +},{"./_cof":27,"./_export":42}],280:[function(require,module,exports){ +// https://github.com/tc39/proposal-global +var $export = require('./_export'); + +$export($export.G, { global: require('./_global') }); + +},{"./_export":42,"./_global":49}],281:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from +require('./_set-collection-from')('Map'); + +},{"./_set-collection-from":103}],282:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of +require('./_set-collection-of')('Map'); + +},{"./_set-collection-of":104}],283:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $export = require('./_export'); + +$export($export.P + $export.R, 'Map', { toJSON: require('./_collection-to-json')('Map') }); + +},{"./_collection-to-json":29,"./_export":42}],284:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { + clamp: function clamp(x, lower, upper) { + return Math.min(upper, Math.max(lower, x)); + } +}); + +},{"./_export":42}],285:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 }); + +},{"./_export":42}],286:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var RAD_PER_DEG = 180 / Math.PI; + +$export($export.S, 'Math', { + degrees: function degrees(radians) { + return radians * RAD_PER_DEG; + } +}); + +},{"./_export":42}],287:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var scale = require('./_math-scale'); +var fround = require('./_math-fround'); + +$export($export.S, 'Math', { + fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { + return fround(scale(x, inLow, inHigh, outLow, outHigh)); + } +}); + +},{"./_export":42,"./_math-fround":70,"./_math-scale":72}],288:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + iaddh: function iaddh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0; + var $x1 = x1 >>> 0; + var $y0 = y0 >>> 0; + return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; + } +}); + +},{"./_export":42}],289:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + imulh: function imulh(u, v) { + var UINT16 = 0xffff; + var $u = +u; + var $v = +v; + var u0 = $u & UINT16; + var v0 = $v & UINT16; + var u1 = $u >> 16; + var v1 = $v >> 16; + var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); + return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); + } +}); + +},{"./_export":42}],290:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + isubh: function isubh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0; + var $x1 = x1 >>> 0; + var $y0 = y0 >>> 0; + return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; + } +}); + +},{"./_export":42}],291:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI }); + +},{"./_export":42}],292:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var DEG_PER_RAD = Math.PI / 180; + +$export($export.S, 'Math', { + radians: function radians(degrees) { + return degrees * DEG_PER_RAD; + } +}); + +},{"./_export":42}],293:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { scale: require('./_math-scale') }); + +},{"./_export":42,"./_math-scale":72}],294:[function(require,module,exports){ +// http://jfbastien.github.io/papers/Math.signbit.html +var $export = require('./_export'); + +$export($export.S, 'Math', { signbit: function signbit(x) { + // eslint-disable-next-line no-self-compare + return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0; +} }); + +},{"./_export":42}],295:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + umulh: function umulh(u, v) { + var UINT16 = 0xffff; + var $u = +u; + var $v = +v; + var u0 = $u & UINT16; + var v0 = $v & UINT16; + var u1 = $u >>> 16; + var v1 = $v >>> 16; + var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); + return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); + } +}); + +},{"./_export":42}],296:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var aFunction = require('./_a-function'); +var $defineProperty = require('./_object-dp'); + +// B.2.2.2 Object.prototype.__defineGetter__(P, getter) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __defineGetter__: function __defineGetter__(P, getter) { + $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); + } +}); + +},{"./_a-function":12,"./_descriptors":38,"./_export":42,"./_object-dp":80,"./_object-forced-pam":82,"./_to-object":125}],297:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var aFunction = require('./_a-function'); +var $defineProperty = require('./_object-dp'); + +// B.2.2.3 Object.prototype.__defineSetter__(P, setter) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __defineSetter__: function __defineSetter__(P, setter) { + $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); + } +}); + +},{"./_a-function":12,"./_descriptors":38,"./_export":42,"./_object-dp":80,"./_object-forced-pam":82,"./_to-object":125}],298:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export'); +var $entries = require('./_object-to-array')(true); + +$export($export.S, 'Object', { + entries: function entries(it) { + return $entries(it); + } +}); + +},{"./_export":42,"./_object-to-array":92}],299:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-getownpropertydescriptors +var $export = require('./_export'); +var ownKeys = require('./_own-keys'); +var toIObject = require('./_to-iobject'); +var gOPD = require('./_object-gopd'); +var createProperty = require('./_create-property'); + +$export($export.S, 'Object', { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIObject(object); + var getDesc = gOPD.f; + var keys = ownKeys(O); + var result = {}; + var i = 0; + var key, desc; + while (keys.length > i) { + desc = getDesc(O, key = keys[i++]); + if (desc !== undefined) createProperty(result, key, desc); + } + return result; + } +}); + +},{"./_create-property":33,"./_export":42,"./_object-gopd":83,"./_own-keys":93,"./_to-iobject":123}],300:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); +var getPrototypeOf = require('./_object-gpo'); +var getOwnPropertyDescriptor = require('./_object-gopd').f; + +// B.2.2.4 Object.prototype.__lookupGetter__(P) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __lookupGetter__: function __lookupGetter__(P) { + var O = toObject(this); + var K = toPrimitive(P, true); + var D; + do { + if (D = getOwnPropertyDescriptor(O, K)) return D.get; + } while (O = getPrototypeOf(O)); + } +}); + +},{"./_descriptors":38,"./_export":42,"./_object-forced-pam":82,"./_object-gopd":83,"./_object-gpo":87,"./_to-object":125,"./_to-primitive":126}],301:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); +var getPrototypeOf = require('./_object-gpo'); +var getOwnPropertyDescriptor = require('./_object-gopd').f; + +// B.2.2.5 Object.prototype.__lookupSetter__(P) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __lookupSetter__: function __lookupSetter__(P) { + var O = toObject(this); + var K = toPrimitive(P, true); + var D; + do { + if (D = getOwnPropertyDescriptor(O, K)) return D.set; + } while (O = getPrototypeOf(O)); + } +}); + +},{"./_descriptors":38,"./_export":42,"./_object-forced-pam":82,"./_object-gopd":83,"./_object-gpo":87,"./_to-object":125,"./_to-primitive":126}],302:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export'); +var $values = require('./_object-to-array')(false); + +$export($export.S, 'Object', { + values: function values(it) { + return $values(it); + } +}); + +},{"./_export":42,"./_object-to-array":92}],303:[function(require,module,exports){ +'use strict'; +// https://github.com/zenparsing/es-observable +var $export = require('./_export'); +var global = require('./_global'); +var core = require('./_core'); +var microtask = require('./_microtask')(); +var OBSERVABLE = require('./_wks')('observable'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var anInstance = require('./_an-instance'); +var redefineAll = require('./_redefine-all'); +var hide = require('./_hide'); +var forOf = require('./_for-of'); +var RETURN = forOf.RETURN; + +var getMethod = function (fn) { + return fn == null ? undefined : aFunction(fn); +}; + +var cleanupSubscription = function (subscription) { + var cleanup = subscription._c; + if (cleanup) { + subscription._c = undefined; + cleanup(); + } +}; + +var subscriptionClosed = function (subscription) { + return subscription._o === undefined; +}; + +var closeSubscription = function (subscription) { + if (!subscriptionClosed(subscription)) { + subscription._o = undefined; + cleanupSubscription(subscription); + } +}; + +var Subscription = function (observer, subscriber) { + anObject(observer); + this._c = undefined; + this._o = observer; + observer = new SubscriptionObserver(this); + try { + var cleanup = subscriber(observer); + var subscription = cleanup; + if (cleanup != null) { + if (typeof cleanup.unsubscribe === 'function') cleanup = function () { subscription.unsubscribe(); }; + else aFunction(cleanup); + this._c = cleanup; + } + } catch (e) { + observer.error(e); + return; + } if (subscriptionClosed(this)) cleanupSubscription(this); +}; + +Subscription.prototype = redefineAll({}, { + unsubscribe: function unsubscribe() { closeSubscription(this); } +}); + +var SubscriptionObserver = function (subscription) { + this._s = subscription; +}; + +SubscriptionObserver.prototype = redefineAll({}, { + next: function next(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + try { + var m = getMethod(observer.next); + if (m) return m.call(observer, value); + } catch (e) { + try { + closeSubscription(subscription); + } finally { + throw e; + } + } + } + }, + error: function error(value) { + var subscription = this._s; + if (subscriptionClosed(subscription)) throw value; + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.error); + if (!m) throw value; + value = m.call(observer, value); + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } cleanupSubscription(subscription); + return value; + }, + complete: function complete(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.complete); + value = m ? m.call(observer, value) : undefined; + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } cleanupSubscription(subscription); + return value; + } + } +}); + +var $Observable = function Observable(subscriber) { + anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); +}; + +redefineAll($Observable.prototype, { + subscribe: function subscribe(observer) { + return new Subscription(observer, this._f); + }, + forEach: function forEach(fn) { + var that = this; + return new (core.Promise || global.Promise)(function (resolve, reject) { + aFunction(fn); + var subscription = that.subscribe({ + next: function (value) { + try { + return fn(value); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + }); + } +}); + +redefineAll($Observable, { + from: function from(x) { + var C = typeof this === 'function' ? this : $Observable; + var method = getMethod(anObject(x)[OBSERVABLE]); + if (method) { + var observable = anObject(method.call(x)); + return observable.constructor === C ? observable : new C(function (observer) { + return observable.subscribe(observer); + }); + } + return new C(function (observer) { + var done = false; + microtask(function () { + if (!done) { + try { + if (forOf(x, false, function (it) { + observer.next(it); + if (done) return RETURN; + }) === RETURN) return; + } catch (e) { + if (done) throw e; + observer.error(e); + return; + } observer.complete(); + } + }); + return function () { done = true; }; + }); + }, + of: function of() { + for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++]; + return new (typeof this === 'function' ? this : $Observable)(function (observer) { + var done = false; + microtask(function () { + if (!done) { + for (var j = 0; j < items.length; ++j) { + observer.next(items[j]); + if (done) return; + } observer.complete(); + } + }); + return function () { done = true; }; + }); + } +}); + +hide($Observable.prototype, OBSERVABLE, function () { return this; }); + +$export($export.G, { Observable: $Observable }); + +require('./_set-species')('Observable'); + +},{"./_a-function":12,"./_an-instance":15,"./_an-object":16,"./_core":32,"./_export":42,"./_for-of":48,"./_global":49,"./_hide":51,"./_microtask":76,"./_redefine-all":99,"./_set-species":106,"./_wks":135}],304:[function(require,module,exports){ +// https://github.com/tc39/proposal-promise-finally +'use strict'; +var $export = require('./_export'); +var core = require('./_core'); +var global = require('./_global'); +var speciesConstructor = require('./_species-constructor'); +var promiseResolve = require('./_promise-resolve'); + +$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) { + var C = speciesConstructor(this, core.Promise || global.Promise); + var isFunction = typeof onFinally == 'function'; + return this.then( + isFunction ? function (x) { + return promiseResolve(C, onFinally()).then(function () { return x; }); + } : onFinally, + isFunction ? function (e) { + return promiseResolve(C, onFinally()).then(function () { throw e; }); + } : onFinally + ); +} }); + +},{"./_core":32,"./_export":42,"./_global":49,"./_promise-resolve":97,"./_species-constructor":110}],305:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-promise-try +var $export = require('./_export'); +var newPromiseCapability = require('./_new-promise-capability'); +var perform = require('./_perform'); + +$export($export.S, 'Promise', { 'try': function (callbackfn) { + var promiseCapability = newPromiseCapability.f(this); + var result = perform(callbackfn); + (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); + return promiseCapability.promise; +} }); + +},{"./_export":42,"./_new-promise-capability":77,"./_perform":96}],306:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var toMetaKey = metadata.key; +var ordinaryDefineOwnMetadata = metadata.set; + +metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) { + ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); +} }); + +},{"./_an-object":16,"./_metadata":75}],307:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var toMetaKey = metadata.key; +var getOrCreateMetadataMap = metadata.map; +var store = metadata.store; + +metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { + var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]); + var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); + if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; + if (metadataMap.size) return true; + var targetMetadata = store.get(target); + targetMetadata['delete'](targetKey); + return !!targetMetadata.size || store['delete'](target); +} }); + +},{"./_an-object":16,"./_metadata":75}],308:[function(require,module,exports){ +var Set = require('./es6.set'); +var from = require('./_array-from-iterable'); +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +var ordinaryMetadataKeys = function (O, P) { + var oKeys = ordinaryOwnMetadataKeys(O, P); + var parent = getPrototypeOf(O); + if (parent === null) return oKeys; + var pKeys = ordinaryMetadataKeys(parent, P); + return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; +}; + +metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { + return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + +},{"./_an-object":16,"./_array-from-iterable":19,"./_metadata":75,"./_object-gpo":87,"./es6.set":238}],309:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryHasOwnMetadata = metadata.has; +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +var ordinaryGetMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; +}; + +metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75,"./_object-gpo":87}],310:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { + return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + +},{"./_an-object":16,"./_metadata":75}],311:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75}],312:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +var ordinaryHasMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return true; + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; +}; + +metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75,"./_object-gpo":87}],313:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75}],314:[function(require,module,exports){ +var $metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var aFunction = require('./_a-function'); +var toMetaKey = $metadata.key; +var ordinaryDefineOwnMetadata = $metadata.set; + +$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) { + return function decorator(target, targetKey) { + ordinaryDefineOwnMetadata( + metadataKey, metadataValue, + (targetKey !== undefined ? anObject : aFunction)(target), + toMetaKey(targetKey) + ); + }; +} }); + +},{"./_a-function":12,"./_an-object":16,"./_metadata":75}],315:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-set.from +require('./_set-collection-from')('Set'); + +},{"./_set-collection-from":103}],316:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-set.of +require('./_set-collection-of')('Set'); + +},{"./_set-collection-of":104}],317:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $export = require('./_export'); + +$export($export.P + $export.R, 'Set', { toJSON: require('./_collection-to-json')('Set') }); + +},{"./_collection-to-json":29,"./_export":42}],318:[function(require,module,exports){ +'use strict'; +// https://github.com/mathiasbynens/String.prototype.at +var $export = require('./_export'); +var $at = require('./_string-at')(true); + +$export($export.P, 'String', { + at: function at(pos) { + return $at(this, pos); + } +}); + +},{"./_export":42,"./_string-at":112}],319:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/String.prototype.matchAll/ +var $export = require('./_export'); +var defined = require('./_defined'); +var toLength = require('./_to-length'); +var isRegExp = require('./_is-regexp'); +var getFlags = require('./_flags'); +var RegExpProto = RegExp.prototype; + +var $RegExpStringIterator = function (regexp, string) { + this._r = regexp; + this._s = string; +}; + +require('./_iter-create')($RegExpStringIterator, 'RegExp String', function next() { + var match = this._r.exec(this._s); + return { value: match, done: match === null }; +}); + +$export($export.P, 'String', { + matchAll: function matchAll(regexp) { + defined(this); + if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!'); + var S = String(this); + var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp); + var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); + rx.lastIndex = toLength(regexp.lastIndex); + return new $RegExpStringIterator(rx, S); + } +}); + +},{"./_defined":37,"./_export":42,"./_flags":46,"./_is-regexp":61,"./_iter-create":63,"./_to-length":124}],320:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = require('./_export'); +var $pad = require('./_string-pad'); +var userAgent = require('./_user-agent'); + +// https://github.com/zloirock/core-js/issues/280 +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padEnd: function padEnd(maxLength /* , fillString = ' ' */) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); + } +}); + +},{"./_export":42,"./_string-pad":115,"./_user-agent":131}],321:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = require('./_export'); +var $pad = require('./_string-pad'); +var userAgent = require('./_user-agent'); + +// https://github.com/zloirock/core-js/issues/280 +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padStart: function padStart(maxLength /* , fillString = ' ' */) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); + } +}); + +},{"./_export":42,"./_string-pad":115,"./_user-agent":131}],322:[function(require,module,exports){ +'use strict'; +// https://github.com/sebmarkbage/ecmascript-string-left-right-trim +require('./_string-trim')('trimLeft', function ($trim) { + return function trimLeft() { + return $trim(this, 1); + }; +}, 'trimStart'); + +},{"./_string-trim":117}],323:[function(require,module,exports){ +'use strict'; +// https://github.com/sebmarkbage/ecmascript-string-left-right-trim +require('./_string-trim')('trimRight', function ($trim) { + return function trimRight() { + return $trim(this, 2); + }; +}, 'trimEnd'); + +},{"./_string-trim":117}],324:[function(require,module,exports){ +require('./_wks-define')('asyncIterator'); + +},{"./_wks-define":133}],325:[function(require,module,exports){ +require('./_wks-define')('observable'); + +},{"./_wks-define":133}],326:[function(require,module,exports){ +// https://github.com/tc39/proposal-global +var $export = require('./_export'); + +$export($export.S, 'System', { global: require('./_global') }); + +},{"./_export":42,"./_global":49}],327:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from +require('./_set-collection-from')('WeakMap'); + +},{"./_set-collection-from":103}],328:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of +require('./_set-collection-of')('WeakMap'); + +},{"./_set-collection-of":104}],329:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from +require('./_set-collection-from')('WeakSet'); + +},{"./_set-collection-from":103}],330:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of +require('./_set-collection-of')('WeakSet'); + +},{"./_set-collection-of":104}],331:[function(require,module,exports){ +var $iterators = require('./es6.array.iterator'); +var getKeys = require('./_object-keys'); +var redefine = require('./_redefine'); +var global = require('./_global'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var wks = require('./_wks'); +var ITERATOR = wks('iterator'); +var TO_STRING_TAG = wks('toStringTag'); +var ArrayValues = Iterators.Array; + +var DOMIterables = { + CSSRuleList: true, // TODO: Not spec compliant, should be false. + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, // TODO: Not spec compliant, should be false. + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, // TODO: Not spec compliant, should be false. + TextTrackCueList: false, + TextTrackList: false, + TouchList: false +}; + +for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { + var NAME = collections[i]; + var explicit = DOMIterables[NAME]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); + if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = ArrayValues; + if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); + } +} + +},{"./_global":49,"./_hide":51,"./_iterators":67,"./_object-keys":89,"./_redefine":100,"./_wks":135,"./es6.array.iterator":148}],332:[function(require,module,exports){ +var $export = require('./_export'); +var $task = require('./_task'); +$export($export.G + $export.B, { + setImmediate: $task.set, + clearImmediate: $task.clear +}); + +},{"./_export":42,"./_task":119}],333:[function(require,module,exports){ +// ie9- setTimeout & setInterval additional parameters fix +var global = require('./_global'); +var $export = require('./_export'); +var userAgent = require('./_user-agent'); +var slice = [].slice; +var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check +var wrap = function (set) { + return function (fn, time /* , ...args */) { + var boundArgs = arguments.length > 2; + var args = boundArgs ? slice.call(arguments, 2) : false; + return set(boundArgs ? function () { + // eslint-disable-next-line no-new-func + (typeof fn == 'function' ? fn : Function(fn)).apply(this, args); + } : fn, time); + }; +}; +$export($export.G + $export.B + $export.F * MSIE, { + setTimeout: wrap(global.setTimeout), + setInterval: wrap(global.setInterval) +}); + +},{"./_export":42,"./_global":49,"./_user-agent":131}],334:[function(require,module,exports){ +require('./modules/es6.symbol'); +require('./modules/es6.object.create'); +require('./modules/es6.object.define-property'); +require('./modules/es6.object.define-properties'); +require('./modules/es6.object.get-own-property-descriptor'); +require('./modules/es6.object.get-prototype-of'); +require('./modules/es6.object.keys'); +require('./modules/es6.object.get-own-property-names'); +require('./modules/es6.object.freeze'); +require('./modules/es6.object.seal'); +require('./modules/es6.object.prevent-extensions'); +require('./modules/es6.object.is-frozen'); +require('./modules/es6.object.is-sealed'); +require('./modules/es6.object.is-extensible'); +require('./modules/es6.object.assign'); +require('./modules/es6.object.is'); +require('./modules/es6.object.set-prototype-of'); +require('./modules/es6.object.to-string'); +require('./modules/es6.function.bind'); +require('./modules/es6.function.name'); +require('./modules/es6.function.has-instance'); +require('./modules/es6.parse-int'); +require('./modules/es6.parse-float'); +require('./modules/es6.number.constructor'); +require('./modules/es6.number.to-fixed'); +require('./modules/es6.number.to-precision'); +require('./modules/es6.number.epsilon'); +require('./modules/es6.number.is-finite'); +require('./modules/es6.number.is-integer'); +require('./modules/es6.number.is-nan'); +require('./modules/es6.number.is-safe-integer'); +require('./modules/es6.number.max-safe-integer'); +require('./modules/es6.number.min-safe-integer'); +require('./modules/es6.number.parse-float'); +require('./modules/es6.number.parse-int'); +require('./modules/es6.math.acosh'); +require('./modules/es6.math.asinh'); +require('./modules/es6.math.atanh'); +require('./modules/es6.math.cbrt'); +require('./modules/es6.math.clz32'); +require('./modules/es6.math.cosh'); +require('./modules/es6.math.expm1'); +require('./modules/es6.math.fround'); +require('./modules/es6.math.hypot'); +require('./modules/es6.math.imul'); +require('./modules/es6.math.log10'); +require('./modules/es6.math.log1p'); +require('./modules/es6.math.log2'); +require('./modules/es6.math.sign'); +require('./modules/es6.math.sinh'); +require('./modules/es6.math.tanh'); +require('./modules/es6.math.trunc'); +require('./modules/es6.string.from-code-point'); +require('./modules/es6.string.raw'); +require('./modules/es6.string.trim'); +require('./modules/es6.string.iterator'); +require('./modules/es6.string.code-point-at'); +require('./modules/es6.string.ends-with'); +require('./modules/es6.string.includes'); +require('./modules/es6.string.repeat'); +require('./modules/es6.string.starts-with'); +require('./modules/es6.string.anchor'); +require('./modules/es6.string.big'); +require('./modules/es6.string.blink'); +require('./modules/es6.string.bold'); +require('./modules/es6.string.fixed'); +require('./modules/es6.string.fontcolor'); +require('./modules/es6.string.fontsize'); +require('./modules/es6.string.italics'); +require('./modules/es6.string.link'); +require('./modules/es6.string.small'); +require('./modules/es6.string.strike'); +require('./modules/es6.string.sub'); +require('./modules/es6.string.sup'); +require('./modules/es6.date.now'); +require('./modules/es6.date.to-json'); +require('./modules/es6.date.to-iso-string'); +require('./modules/es6.date.to-string'); +require('./modules/es6.date.to-primitive'); +require('./modules/es6.array.is-array'); +require('./modules/es6.array.from'); +require('./modules/es6.array.of'); +require('./modules/es6.array.join'); +require('./modules/es6.array.slice'); +require('./modules/es6.array.sort'); +require('./modules/es6.array.for-each'); +require('./modules/es6.array.map'); +require('./modules/es6.array.filter'); +require('./modules/es6.array.some'); +require('./modules/es6.array.every'); +require('./modules/es6.array.reduce'); +require('./modules/es6.array.reduce-right'); +require('./modules/es6.array.index-of'); +require('./modules/es6.array.last-index-of'); +require('./modules/es6.array.copy-within'); +require('./modules/es6.array.fill'); +require('./modules/es6.array.find'); +require('./modules/es6.array.find-index'); +require('./modules/es6.array.species'); +require('./modules/es6.array.iterator'); +require('./modules/es6.regexp.constructor'); +require('./modules/es6.regexp.to-string'); +require('./modules/es6.regexp.flags'); +require('./modules/es6.regexp.match'); +require('./modules/es6.regexp.replace'); +require('./modules/es6.regexp.search'); +require('./modules/es6.regexp.split'); +require('./modules/es6.promise'); +require('./modules/es6.map'); +require('./modules/es6.set'); +require('./modules/es6.weak-map'); +require('./modules/es6.weak-set'); +require('./modules/es6.typed.array-buffer'); +require('./modules/es6.typed.data-view'); +require('./modules/es6.typed.int8-array'); +require('./modules/es6.typed.uint8-array'); +require('./modules/es6.typed.uint8-clamped-array'); +require('./modules/es6.typed.int16-array'); +require('./modules/es6.typed.uint16-array'); +require('./modules/es6.typed.int32-array'); +require('./modules/es6.typed.uint32-array'); +require('./modules/es6.typed.float32-array'); +require('./modules/es6.typed.float64-array'); +require('./modules/es6.reflect.apply'); +require('./modules/es6.reflect.construct'); +require('./modules/es6.reflect.define-property'); +require('./modules/es6.reflect.delete-property'); +require('./modules/es6.reflect.enumerate'); +require('./modules/es6.reflect.get'); +require('./modules/es6.reflect.get-own-property-descriptor'); +require('./modules/es6.reflect.get-prototype-of'); +require('./modules/es6.reflect.has'); +require('./modules/es6.reflect.is-extensible'); +require('./modules/es6.reflect.own-keys'); +require('./modules/es6.reflect.prevent-extensions'); +require('./modules/es6.reflect.set'); +require('./modules/es6.reflect.set-prototype-of'); +require('./modules/es7.array.includes'); +require('./modules/es7.array.flat-map'); +require('./modules/es7.array.flatten'); +require('./modules/es7.string.at'); +require('./modules/es7.string.pad-start'); +require('./modules/es7.string.pad-end'); +require('./modules/es7.string.trim-left'); +require('./modules/es7.string.trim-right'); +require('./modules/es7.string.match-all'); +require('./modules/es7.symbol.async-iterator'); +require('./modules/es7.symbol.observable'); +require('./modules/es7.object.get-own-property-descriptors'); +require('./modules/es7.object.values'); +require('./modules/es7.object.entries'); +require('./modules/es7.object.define-getter'); +require('./modules/es7.object.define-setter'); +require('./modules/es7.object.lookup-getter'); +require('./modules/es7.object.lookup-setter'); +require('./modules/es7.map.to-json'); +require('./modules/es7.set.to-json'); +require('./modules/es7.map.of'); +require('./modules/es7.set.of'); +require('./modules/es7.weak-map.of'); +require('./modules/es7.weak-set.of'); +require('./modules/es7.map.from'); +require('./modules/es7.set.from'); +require('./modules/es7.weak-map.from'); +require('./modules/es7.weak-set.from'); +require('./modules/es7.global'); +require('./modules/es7.system.global'); +require('./modules/es7.error.is-error'); +require('./modules/es7.math.clamp'); +require('./modules/es7.math.deg-per-rad'); +require('./modules/es7.math.degrees'); +require('./modules/es7.math.fscale'); +require('./modules/es7.math.iaddh'); +require('./modules/es7.math.isubh'); +require('./modules/es7.math.imulh'); +require('./modules/es7.math.rad-per-deg'); +require('./modules/es7.math.radians'); +require('./modules/es7.math.scale'); +require('./modules/es7.math.umulh'); +require('./modules/es7.math.signbit'); +require('./modules/es7.promise.finally'); +require('./modules/es7.promise.try'); +require('./modules/es7.reflect.define-metadata'); +require('./modules/es7.reflect.delete-metadata'); +require('./modules/es7.reflect.get-metadata'); +require('./modules/es7.reflect.get-metadata-keys'); +require('./modules/es7.reflect.get-own-metadata'); +require('./modules/es7.reflect.get-own-metadata-keys'); +require('./modules/es7.reflect.has-metadata'); +require('./modules/es7.reflect.has-own-metadata'); +require('./modules/es7.reflect.metadata'); +require('./modules/es7.asap'); +require('./modules/es7.observable'); +require('./modules/web.timers'); +require('./modules/web.immediate'); +require('./modules/web.dom.iterable'); +module.exports = require('./modules/_core'); + +},{"./modules/_core":32,"./modules/es6.array.copy-within":138,"./modules/es6.array.every":139,"./modules/es6.array.fill":140,"./modules/es6.array.filter":141,"./modules/es6.array.find":143,"./modules/es6.array.find-index":142,"./modules/es6.array.for-each":144,"./modules/es6.array.from":145,"./modules/es6.array.index-of":146,"./modules/es6.array.is-array":147,"./modules/es6.array.iterator":148,"./modules/es6.array.join":149,"./modules/es6.array.last-index-of":150,"./modules/es6.array.map":151,"./modules/es6.array.of":152,"./modules/es6.array.reduce":154,"./modules/es6.array.reduce-right":153,"./modules/es6.array.slice":155,"./modules/es6.array.some":156,"./modules/es6.array.sort":157,"./modules/es6.array.species":158,"./modules/es6.date.now":159,"./modules/es6.date.to-iso-string":160,"./modules/es6.date.to-json":161,"./modules/es6.date.to-primitive":162,"./modules/es6.date.to-string":163,"./modules/es6.function.bind":164,"./modules/es6.function.has-instance":165,"./modules/es6.function.name":166,"./modules/es6.map":167,"./modules/es6.math.acosh":168,"./modules/es6.math.asinh":169,"./modules/es6.math.atanh":170,"./modules/es6.math.cbrt":171,"./modules/es6.math.clz32":172,"./modules/es6.math.cosh":173,"./modules/es6.math.expm1":174,"./modules/es6.math.fround":175,"./modules/es6.math.hypot":176,"./modules/es6.math.imul":177,"./modules/es6.math.log10":178,"./modules/es6.math.log1p":179,"./modules/es6.math.log2":180,"./modules/es6.math.sign":181,"./modules/es6.math.sinh":182,"./modules/es6.math.tanh":183,"./modules/es6.math.trunc":184,"./modules/es6.number.constructor":185,"./modules/es6.number.epsilon":186,"./modules/es6.number.is-finite":187,"./modules/es6.number.is-integer":188,"./modules/es6.number.is-nan":189,"./modules/es6.number.is-safe-integer":190,"./modules/es6.number.max-safe-integer":191,"./modules/es6.number.min-safe-integer":192,"./modules/es6.number.parse-float":193,"./modules/es6.number.parse-int":194,"./modules/es6.number.to-fixed":195,"./modules/es6.number.to-precision":196,"./modules/es6.object.assign":197,"./modules/es6.object.create":198,"./modules/es6.object.define-properties":199,"./modules/es6.object.define-property":200,"./modules/es6.object.freeze":201,"./modules/es6.object.get-own-property-descriptor":202,"./modules/es6.object.get-own-property-names":203,"./modules/es6.object.get-prototype-of":204,"./modules/es6.object.is":208,"./modules/es6.object.is-extensible":205,"./modules/es6.object.is-frozen":206,"./modules/es6.object.is-sealed":207,"./modules/es6.object.keys":209,"./modules/es6.object.prevent-extensions":210,"./modules/es6.object.seal":211,"./modules/es6.object.set-prototype-of":212,"./modules/es6.object.to-string":213,"./modules/es6.parse-float":214,"./modules/es6.parse-int":215,"./modules/es6.promise":216,"./modules/es6.reflect.apply":217,"./modules/es6.reflect.construct":218,"./modules/es6.reflect.define-property":219,"./modules/es6.reflect.delete-property":220,"./modules/es6.reflect.enumerate":221,"./modules/es6.reflect.get":224,"./modules/es6.reflect.get-own-property-descriptor":222,"./modules/es6.reflect.get-prototype-of":223,"./modules/es6.reflect.has":225,"./modules/es6.reflect.is-extensible":226,"./modules/es6.reflect.own-keys":227,"./modules/es6.reflect.prevent-extensions":228,"./modules/es6.reflect.set":230,"./modules/es6.reflect.set-prototype-of":229,"./modules/es6.regexp.constructor":231,"./modules/es6.regexp.flags":232,"./modules/es6.regexp.match":233,"./modules/es6.regexp.replace":234,"./modules/es6.regexp.search":235,"./modules/es6.regexp.split":236,"./modules/es6.regexp.to-string":237,"./modules/es6.set":238,"./modules/es6.string.anchor":239,"./modules/es6.string.big":240,"./modules/es6.string.blink":241,"./modules/es6.string.bold":242,"./modules/es6.string.code-point-at":243,"./modules/es6.string.ends-with":244,"./modules/es6.string.fixed":245,"./modules/es6.string.fontcolor":246,"./modules/es6.string.fontsize":247,"./modules/es6.string.from-code-point":248,"./modules/es6.string.includes":249,"./modules/es6.string.italics":250,"./modules/es6.string.iterator":251,"./modules/es6.string.link":252,"./modules/es6.string.raw":253,"./modules/es6.string.repeat":254,"./modules/es6.string.small":255,"./modules/es6.string.starts-with":256,"./modules/es6.string.strike":257,"./modules/es6.string.sub":258,"./modules/es6.string.sup":259,"./modules/es6.string.trim":260,"./modules/es6.symbol":261,"./modules/es6.typed.array-buffer":262,"./modules/es6.typed.data-view":263,"./modules/es6.typed.float32-array":264,"./modules/es6.typed.float64-array":265,"./modules/es6.typed.int16-array":266,"./modules/es6.typed.int32-array":267,"./modules/es6.typed.int8-array":268,"./modules/es6.typed.uint16-array":269,"./modules/es6.typed.uint32-array":270,"./modules/es6.typed.uint8-array":271,"./modules/es6.typed.uint8-clamped-array":272,"./modules/es6.weak-map":273,"./modules/es6.weak-set":274,"./modules/es7.array.flat-map":275,"./modules/es7.array.flatten":276,"./modules/es7.array.includes":277,"./modules/es7.asap":278,"./modules/es7.error.is-error":279,"./modules/es7.global":280,"./modules/es7.map.from":281,"./modules/es7.map.of":282,"./modules/es7.map.to-json":283,"./modules/es7.math.clamp":284,"./modules/es7.math.deg-per-rad":285,"./modules/es7.math.degrees":286,"./modules/es7.math.fscale":287,"./modules/es7.math.iaddh":288,"./modules/es7.math.imulh":289,"./modules/es7.math.isubh":290,"./modules/es7.math.rad-per-deg":291,"./modules/es7.math.radians":292,"./modules/es7.math.scale":293,"./modules/es7.math.signbit":294,"./modules/es7.math.umulh":295,"./modules/es7.object.define-getter":296,"./modules/es7.object.define-setter":297,"./modules/es7.object.entries":298,"./modules/es7.object.get-own-property-descriptors":299,"./modules/es7.object.lookup-getter":300,"./modules/es7.object.lookup-setter":301,"./modules/es7.object.values":302,"./modules/es7.observable":303,"./modules/es7.promise.finally":304,"./modules/es7.promise.try":305,"./modules/es7.reflect.define-metadata":306,"./modules/es7.reflect.delete-metadata":307,"./modules/es7.reflect.get-metadata":309,"./modules/es7.reflect.get-metadata-keys":308,"./modules/es7.reflect.get-own-metadata":311,"./modules/es7.reflect.get-own-metadata-keys":310,"./modules/es7.reflect.has-metadata":312,"./modules/es7.reflect.has-own-metadata":313,"./modules/es7.reflect.metadata":314,"./modules/es7.set.from":315,"./modules/es7.set.of":316,"./modules/es7.set.to-json":317,"./modules/es7.string.at":318,"./modules/es7.string.match-all":319,"./modules/es7.string.pad-end":320,"./modules/es7.string.pad-start":321,"./modules/es7.string.trim-left":322,"./modules/es7.string.trim-right":323,"./modules/es7.symbol.async-iterator":324,"./modules/es7.symbol.observable":325,"./modules/es7.system.global":326,"./modules/es7.weak-map.from":327,"./modules/es7.weak-map.of":328,"./modules/es7.weak-set.from":329,"./modules/es7.weak-set.of":330,"./modules/web.dom.iterable":331,"./modules/web.immediate":332,"./modules/web.timers":333}],335:[function(require,module,exports){ +(function (global){ +module.exports = false; + +// Only Node.JS has a process variable that is of [[Class]] process +try { + module.exports = Object.prototype.toString.call(global.process) === '[object process]' +} catch(e) {} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],336:[function(require,module,exports){ +'use strict'; + +var _util = require('./util.js'); + +/* eslint-disable */ +/** + * used in docs/iframe.html + */ +require('babel-polyfill'); + + +var BroadcastChannel = require('../../'); + +var channelName = (0, _util.getParameterByName)('channelName'); +var methodType = (0, _util.getParameterByName)('methodType'); + +// overwrite console.log +var logBefore = console.log; +console.log = function (str) { + logBefore('iframe: ' + str); +}; + +var channel = new BroadcastChannel(channelName, { + type: methodType +}); +var msgContainer = document.getElementById('messages'); +channel.onmessage = function (msg) { + console.log('recieved message(' + msg.step + ') from ' + msg.from + ': ' + JSON.stringify(msg)); + + var textnode = document.createTextNode(JSON.stringify(msg) + '
'); + msgContainer.appendChild(textnode); + + if (!msg.answer) { + console.log('answer back(' + msg.step + ')'); + channel.postMessage({ + answer: true, + from: 'iframe', + original: msg + }); + } +}; +},{"../../":1,"./util.js":337,"babel-polyfill":9}],337:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getParameterByName = getParameterByName; +// https://stackoverflow.com/a/901144/3443137 +function getParameterByName(name, url) { + if (!url) url = window.location.href; + name = name.replace(/[\[\]]/g, '\\$&'); + var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); + var results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, ' ')); +} +},{}]},{},[336]); diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..df837708 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,65 @@ + + + + + + + + + Fork me on GitHub + + + +
+ + + + \ No newline at end of file diff --git a/docs/index.js b/docs/index.js new file mode 100644 index 00000000..a43debb3 --- /dev/null +++ b/docs/index.js @@ -0,0 +1,9687 @@ +(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 setTimeout(res, this.options.prepareDelay)); + }*/ + channel._state = s; + }); + } else { + channel._state = maybePromise; + } +} + +function _hasMessageListeners(channel) { + if (channel._addEventListeners.message.length > 0) return true; + if (channel._addEventListeners.internal.length > 0) return true; + return false; +} + +function _addListenerObject(channel, type, obj) { + channel._addEventListeners[type].push(obj); + _startListening(channel); +} +function _removeListenerObject(channel, type, obj) { + channel._addEventListeners[type] = channel._addEventListeners[type].filter(function (o) { + return o !== obj; + }); + _stopListening(channel); +} + +function _startListening(channel) { + if (!channel._isListening && _hasMessageListeners(channel)) { + // someone is listening, start subscribing + + var listenerFn = function listenerFn(msgObj) { + channel._addEventListeners[msgObj.type].forEach(function (obj) { + if (msgObj.time >= obj.time) { + obj.fn(msgObj.data); + }; + }); + }; + + var time = new Date().getTime() - 5; + if (channel._preparePromise) { + channel._preparePromise.then(function () { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + }); + } else { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + } + } +} + +function _stopListening(channel) { + if (channel._isListening && !_hasMessageListeners(channel)) { + // noone is listening, stop subscribing + channel._isListening = false; + var time = new Date().getTime() - 5; + channel.method.onMessage(channel._state, null, time); + } +} + +exports['default'] = BroadcastChannel; +},{"./method-chooser.js":3,"./options.js":7,"./util.js":8}],3:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.chooseMethod = chooseMethod; +var isNode = require('detect-node'); + +var NativeMethod = require('./methods/native.js'); +var IndexeDbMethod = require('./methods/indexed-db.js'); +var LocalstorageMethod = require('./methods/localstorage.js'); + +// order is important +var METHODS = [NativeMethod, // fastest +IndexeDbMethod, LocalstorageMethod]; + +var REQUIRE_FUN = require; + +/** + * The NodeMethod is loaded lazy + * so it will not get bundled in browser-builds + */ +if (isNode) { + var NodeMethod = REQUIRE_FUN('./methods/node.js'); + METHODS.push(NodeMethod); +} + +function chooseMethod(options) { + // directly chosen + if (options.type) { + var ret = METHODS.find(function (m) { + return m.type === options.type; + }); + if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret; + } + + var chooseMethods = METHODS; + if (!options.webWorkerSupport && !isNode) { + // prefer localstorage over idb when no webworker-support needed + chooseMethods = METHODS.filter(function (m) { + return m.type !== 'idb'; + }); + } + + var useMethod = chooseMethods.find(function (method) { + return method.canBeUsed(); + }); + if (!useMethod) throw new Error('No useable methode found:' + JSON.stringify(METHODS.map(function (m) { + return m.type; + })));else return useMethod; +} +},{"./methods/indexed-db.js":4,"./methods/localstorage.js":5,"./methods/native.js":6,"detect-node":426}],4:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getIdb = getIdb; +exports.createDatabase = createDatabase; +exports.writeMessage = writeMessage; +exports.getAllMessages = getAllMessages; +exports.getMessagesHigherThen = getMessagesHigherThen; +exports.removeMessageById = removeMessageById; +exports.getOldMessages = getOldMessages; +exports.cleanOldMessages = cleanOldMessages; +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _util = require('../util.js'); + +var _options = require('../options'); + +/** + * this method uses indexeddb to store the messages + * There is currently no observerAPI for idb + * @link https://github.com/w3c/IndexedDB/issues/51 + */ + +var isNode = require('detect-node'); + +var DB_PREFIX = 'pubkey.broadcast-channel-0-'; +var OBJECT_STORE_ID = 'messages'; + +var type = exports.type = 'idb'; + +function getIdb() { + if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof mozIndexedDB !== 'undefined') return mozIndexedDB; + if (typeof webkitIndexedDB !== 'undefined') return webkitIndexedDB; + if (typeof msIndexedDB !== 'undefined') return msIndexedDB; + + return false; +} + +function createDatabase(channelName) { + var IndexedDB = getIdb(); + + // create table + var dbName = DB_PREFIX + channelName; + var openRequest = IndexedDB.open(dbName, 1); + + openRequest.onupgradeneeded = function (ev) { + var db = ev.target.result; + db.createObjectStore(OBJECT_STORE_ID, { + keyPath: 'id', + autoIncrement: true + }); + }; + var dbPromise = new Promise(function (res, rej) { + openRequest.onerror = function (ev) { + return rej(ev); + }; + openRequest.onsuccess = function () { + res(openRequest.result); + }; + }); + + return dbPromise; +} + +/** + * writes the new message to the database + * so other readers can find it + */ +function writeMessage(db, readerUuid, messageJson) { + var time = new Date().getTime(); + var writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + + var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); + + return new Promise(function (res, rej) { + transaction.oncomplete = function () { + return res(); + }; + transaction.onerror = function (ev) { + return rej(ev); + }; + + var objectStore = transaction.objectStore(OBJECT_STORE_ID); + objectStore.add(writeObject); + }); +} + +function getAllMessages(db) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function getMessagesHigherThen(db, lastCursorId) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity); + return new Promise(function (res) { + objectStore.openCursor(keyRangeValue).onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function removeMessageById(db, id) { + var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)['delete'](id); + return new Promise(function (res) { + request.onsuccess = function () { + return res(); + }; + }); +} + +function getOldMessages(db, ttl) { + var olderThen = new Date().getTime() - ttl; + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + var msgObk = cursor.value; + if (msgObk.time < olderThen) { + ret.push(msgObk); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + // no more old messages, + res(ret); + return; + } + } else { + res(ret); + } + }; + }); +} + +function cleanOldMessages(db, ttl) { + return getOldMessages(db, ttl).then(function (tooOld) { + return Promise.all(tooOld.map(function (msgObj) { + return removeMessageById(db, msgObj.id); + })); + }); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + + var uuid = (0, _util.randomToken)(10); + + return createDatabase(channelName).then(function (db) { + var state = { + closed: false, + lastCursorId: 0, + channelName: channelName, + options: options, + uuid: uuid, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallback: null, + readQueuePromises: [], + db: db + }; + + /** + * if service-workers are used, + * we have no 'storage'-event if they post a message, + * therefore we also have to set an interval + */ + _readLoop(state); + + return state; + }); +} + +function _readLoop(state) { + if (state.closed) return; + + return readNewMessages(state).then(function () { + return (0, _util.sleep)(state.options.idb.fallbackInterval); + }).then(function () { + return _readLoop(state); + }); +} + +/** + * reads all new messages from the database and emits them + */ +function readNewMessages(state) { + return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessages) { + var useMessages = newerMessages.map(function (msgObj) { + if (msgObj.id > state.lastCursorId) { + state.lastCursorId = msgObj.id; + } + return msgObj; + }).filter(function (msgObj) { + return msgObj.uuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.id); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + + useMessages.forEach(function (msgObj) { + if (state.messagesCallback) { + state.emittedMessagesIds.add(msgObj.id); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.id); + }, state.options.idb.ttl * 2); + + state.messagesCallback(msgObj.data); + } + }); + + return Promise.resolve(); + }); +} + +function close(channelState) { + channelState.closed = true; + channelState.db.close(); +} + +function postMessage(channelState, messageJson) { + return writeMessage(channelState.db, channelState.uuid, messageJson).then(function () { + if ((0, _util.randomInt)(0, 10) === 0) { + /* await (do not await) */cleanOldMessages(channelState.db, channelState.options.idb.ttl); + } + }); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + readNewMessages(channelState); +} + +function canBeUsed() { + if (isNode) return false; + var idb = getIdb(); + + if (!idb) return false; + return true; +}; +},{"../options":7,"../util.js":8,"detect-node":426}],5:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getLocalStorage = getLocalStorage; +exports.storageKey = storageKey; +exports.postMessage = postMessage; +exports.addStorageEventListener = addStorageEventListener; +exports.removeStorageEventListener = removeStorageEventListener; +exports.create = create; +exports.close = close; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _options = require('../options'); + +var _util = require('../util'); + +/** + * A localStorage-only method which uses localstorage and its 'storage'-event + * This does not work inside of webworkers because they have no access to locastorage + * This is basically implemented to support IE9 or your grandmothers toaster. + * @link https://caniuse.com/#feat=namevalue-storage + * @link https://caniuse.com/#feat=indexeddb + */ + +var isNode = require('detect-node'); + +var KEY_PREFIX = 'pubkey.broadcastChannel-'; +var type = exports.type = 'localstorage'; + +/** + * copied from crosstab + * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32 + */ +function getLocalStorage() { + var localStorage = void 0; + if (typeof window === 'undefined') return null; + try { + localStorage = window.localStorage; + localStorage = window['ie8-eventlistener/storage'] || window.localStorage; + } catch (e) { + // New versions of Firefox throw a Security exception + // if cookies are disabled. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153 + } + return localStorage; +} + +function storageKey(channelName) { + return KEY_PREFIX + channelName; +} + +/** +* writes the new message to the storage +* and fires the storage-event so other readers can find it +*/ +function postMessage(channelState, messageJson) { + return new Promise(function (res) { + (0, _util.sleep)().then(function () { + var key = storageKey(channelState.channelName); + var writeObj = { + token: (0, _util.randomToken)(10), + time: new Date().getTime(), + data: messageJson, + uuid: channelState.uuid + }; + var value = JSON.stringify(writeObj); + localStorage.setItem(key, value); + + /** + * StorageEvent does not fire the 'storage' event + * in the window that changes the state of the local storage. + * So we fire it manually + */ + var ev = document.createEvent('Event'); + ev.initEvent('storage', true, true); + ev.key = key; + ev.newValue = value; + window.dispatchEvent(ev); + + res(); + }); + }); +} + +function addStorageEventListener(channelName, fn) { + var key = storageKey(channelName); + var listener = function listener(ev) { + if (ev.key === key) { + fn(JSON.parse(ev.newValue)); + } + }; + window.addEventListener('storage', listener); + return listener; +} +function removeStorageEventListener(listener) { + window.removeEventListener('storage', listener); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + if (!canBeUsed()) { + throw new Error('BroadcastChannel: localstorage cannot be used'); + } + + var startTime = new Date().getTime(); + var uuid = (0, _util.randomToken)(10); + + // contains all messages that have been emitted before + var emittedMessagesIds = new Set(); + + var state = { + startTime: startTime, + channelName: channelName, + options: options, + uuid: uuid, + emittedMessagesIds: emittedMessagesIds + }; + + state.listener = addStorageEventListener(channelName, function (msgObj) { + if (!state.messagesCallback) return; // no listener + if (msgObj.uuid === uuid) return; // own message + if (!msgObj.token || emittedMessagesIds.has(msgObj.token)) return; // already emitted + if (msgObj.time && msgObj.time < state.messagesCallbackTime) return; // too old + + emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return emittedMessagesIds['delete'](msgObj.token); + }, options.localstorage.removeTimeout); + state.messagesCallback(msgObj.data); + }); + + return state; +} + +function close(channelState) { + removeStorageEventListener(channelState.listener); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + var ls = getLocalStorage(); + + if (!ls) return false; + return true; +}; +},{"../options":7,"../util":8,"detect-node":426}],6:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; +var isNode = require('detect-node'); + +var type = exports.type = 'native'; + +function create(channelName, options) { + if (!options) options = {}; + var state = { + channelName: channelName, + options: options, + messagesCallback: null, + bc: new BroadcastChannel(channelName), + subscriberFunctions: [] + }; + + state.bc.onmessage = function (msg) { + if (state.messagesCallback) { + state.messagesCallback(msg.data); + } + }; + + return state; +}; + +function close(channelState) { + channelState.bc.close(); + channelState.subscriberFunctions = []; +} + +function postMessage(channelState, messageJson) { + channelState.bc.postMessage(messageJson, false); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + + if (typeof BroadcastChannel === 'function') return true; +}; +},{"detect-node":426}],7:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fillOptionsWithDefaults = fillOptionsWithDefaults; +function fillOptionsWithDefaults(options) { + if (!options) options = {}; + options = JSON.parse(JSON.stringify(options)); + + // main + if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; + + // indexed-db + if (!options.idb) options.idb = {}; + // after this time the messages get deleted + if (!options.idb.ttl) options.idb.ttl = 1000 * 45; + if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 50; + + // localstorage + if (!options.localstorage) options.localstorage = {}; + if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; + + // node + if (!options.node) options.node = {}; + if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes; + + return options; +} +},{}],8:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isPromise = isPromise; +exports.sleep = sleep; +exports.randomInt = randomInt; +exports.randomToken = randomToken; +/** + * returns true if the given object is a promise + */ +function isPromise(obj) { + if (obj && typeof obj.then === 'function') { + return true; + } else { + return false; + } +} + +function sleep(time) { + if (!time) time = 0; + return new Promise(function (res) { + return setTimeout(res, time); + }); +} + +function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +/** + * https://stackoverflow.com/a/1349426/3443137 + */ +function randomToken(length) { + var text = ''; + var possible = 'abcdefghijklmnopqrstuvwxzy0123456789'; + + for (var i = 0; i < 5; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + }return text; +} +},{}],9:[function(require,module,exports){ +(function (global){ +"use strict"; + +require("core-js/shim"); + +require("regenerator-runtime/runtime"); + +require("core-js/fn/regexp/escape"); + +if (global._babelPolyfill) { + throw new Error("only one instance of babel-polyfill is allowed"); +} +global._babelPolyfill = true; + +var DEFINE_PROPERTY = "defineProperty"; +function define(O, key, value) { + O[key] || Object[DEFINE_PROPERTY](O, key, { + writable: true, + configurable: true, + value: value + }); +} + +define(String.prototype, "padLeft", "".padStart); +define(String.prototype, "padRight", "".padEnd); + +"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) { + [][key] && define(Array, key, Function.call.bind([][key])); +}); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"core-js/fn/regexp/escape":17,"core-js/shim":425,"regenerator-runtime/runtime":10}],10:[function(require,module,exports){ +(function (global){ +/** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + if (typeof global.process === "object" && global.process.domain) { + invoke = global.process.domain.bind(invoke); + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // Among the various tricks for obtaining a reference to the global + // object, this seems to be the most reliable technique that does not + // use indirect eval (which violates Content Security Policy). + typeof global === "object" ? global : + typeof window === "object" ? window : + typeof self === "object" ? self : this +); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],11:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/promise"), __esModule: true }; +},{"core-js/library/fn/promise":18}],12:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true }; +},{"core-js/library/fn/symbol":19}],13:[function(require,module,exports){ +module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true }; +},{"core-js/library/fn/symbol/iterator":20}],14:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; + +var _promise = require("../core-js/promise"); + +var _promise2 = _interopRequireDefault(_promise); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (fn) { + return function () { + var gen = fn.apply(this, arguments); + return new _promise2.default(function (resolve, reject) { + function step(key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + + if (info.done) { + resolve(value); + } else { + return _promise2.default.resolve(value).then(function (value) { + step("next", value); + }, function (err) { + step("throw", err); + }); + } + } + + return step("next"); + }); + }; +}; +},{"../core-js/promise":11}],15:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; + +var _iterator = require("../core-js/symbol/iterator"); + +var _iterator2 = _interopRequireDefault(_iterator); + +var _symbol = require("../core-js/symbol"); + +var _symbol2 = _interopRequireDefault(_symbol); + +var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; }; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof(obj); +} : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); +}; +},{"../core-js/symbol":12,"../core-js/symbol/iterator":13}],16:[function(require,module,exports){ +module.exports = require("regenerator-runtime"); + +},{"regenerator-runtime":427}],17:[function(require,module,exports){ +require('../../modules/core.regexp.escape'); +module.exports = require('../../modules/_core').RegExp.escape; + +},{"../../modules/_core":123,"../../modules/core.regexp.escape":228}],18:[function(require,module,exports){ +require('../modules/es6.object.to-string'); +require('../modules/es6.string.iterator'); +require('../modules/web.dom.iterable'); +require('../modules/es6.promise'); +require('../modules/es7.promise.finally'); +require('../modules/es7.promise.try'); +module.exports = require('../modules/_core').Promise; + +},{"../modules/_core":28,"../modules/es6.object.to-string":94,"../modules/es6.promise":95,"../modules/es6.string.iterator":96,"../modules/es7.promise.finally":98,"../modules/es7.promise.try":99,"../modules/web.dom.iterable":102}],19:[function(require,module,exports){ +require('../../modules/es6.symbol'); +require('../../modules/es6.object.to-string'); +require('../../modules/es7.symbol.async-iterator'); +require('../../modules/es7.symbol.observable'); +module.exports = require('../../modules/_core').Symbol; + +},{"../../modules/_core":28,"../../modules/es6.object.to-string":94,"../../modules/es6.symbol":97,"../../modules/es7.symbol.async-iterator":100,"../../modules/es7.symbol.observable":101}],20:[function(require,module,exports){ +require('../../modules/es6.string.iterator'); +require('../../modules/web.dom.iterable'); +module.exports = require('../../modules/_wks-ext').f('iterator'); + +},{"../../modules/_wks-ext":90,"../../modules/es6.string.iterator":96,"../../modules/web.dom.iterable":102}],21:[function(require,module,exports){ +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +},{}],22:[function(require,module,exports){ +module.exports = function () { /* empty */ }; + +},{}],23:[function(require,module,exports){ +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { + throw TypeError(name + ': incorrect invocation!'); + } return it; +}; + +},{}],24:[function(require,module,exports){ +var isObject = require('./_is-object'); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +},{"./_is-object":47}],25:[function(require,module,exports){ +// false -> Array#indexOf +// true -> Array#includes +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); +var toAbsoluteIndex = require('./_to-absolute-index'); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($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) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + +},{"./_to-absolute-index":81,"./_to-iobject":83,"./_to-length":84}],26:[function(require,module,exports){ +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = require('./_cof'); +var TAG = require('./_wks')('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +},{"./_cof":27,"./_wks":91}],27:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + +},{}],28:[function(require,module,exports){ +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + +},{}],29:[function(require,module,exports){ +// optional / simple context binding +var aFunction = require('./_a-function'); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + 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); + }; +}; + +},{"./_a-function":21}],30:[function(require,module,exports){ +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +},{}],31:[function(require,module,exports){ +// Thank's IE8 for his funny defineProperty +module.exports = !require('./_fails')(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_fails":36}],32:[function(require,module,exports){ +var isObject = require('./_is-object'); +var document = require('./_global').document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + +},{"./_global":38,"./_is-object":47}],33:[function(require,module,exports){ +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + +},{}],34:[function(require,module,exports){ +// all enumerable object keys, includes symbols +var getKeys = require('./_object-keys'); +var gOPS = require('./_object-gops'); +var pIE = require('./_object-pie'); +module.exports = function (it) { + var result = getKeys(it); + var getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it); + var isEnum = pIE.f; + var i = 0; + var key; + while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); + } return result; +}; + +},{"./_object-gops":64,"./_object-keys":67,"./_object-pie":68}],35:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var ctx = require('./_ctx'); +var hide = require('./_hide'); +var has = require('./_has'); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var IS_WRAP = type & $export.W; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE]; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; + var key, own, out; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if (own && has(exports, key)) continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function (C) { + var F = function (a, b, c) { + if (this instanceof C) { + switch (arguments.length) { + case 0: return new C(); + case 1: return new C(a); + case 2: return new C(a, b); + } return new C(a, b, c); + } return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if (IS_PROTO) { + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); + } + } +}; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + +},{"./_core":28,"./_ctx":29,"./_global":38,"./_has":39,"./_hide":40}],36:[function(require,module,exports){ +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +},{}],37:[function(require,module,exports){ +var ctx = require('./_ctx'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var anObject = require('./_an-object'); +var toLength = require('./_to-length'); +var getIterFn = require('./core.get-iterator-method'); +var BREAK = {}; +var RETURN = {}; +var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); + var f = ctx(fn, that, entries ? 2 : 1); + var index = 0; + var length, step, iterator, result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } +}; +exports.BREAK = BREAK; +exports.RETURN = RETURN; + +},{"./_an-object":24,"./_ctx":29,"./_is-array-iter":45,"./_iter-call":48,"./_to-length":84,"./core.get-iterator-method":92}],38:[function(require,module,exports){ +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + +},{}],39:[function(require,module,exports){ +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +},{}],40:[function(require,module,exports){ +var dP = require('./_object-dp'); +var createDesc = require('./_property-desc'); +module.exports = require('./_descriptors') ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +},{"./_descriptors":31,"./_object-dp":59,"./_property-desc":71}],41:[function(require,module,exports){ +var document = require('./_global').document; +module.exports = document && document.documentElement; + +},{"./_global":38}],42:[function(require,module,exports){ +module.exports = !require('./_descriptors') && !require('./_fails')(function () { + return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_descriptors":31,"./_dom-create":32,"./_fails":36}],43:[function(require,module,exports){ +// fast apply, http://jsperf.lnkit.com/fast-apply/5 +module.exports = function (fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: return un ? fn() + : fn.call(that); + case 1: return un ? fn(args[0]) + : fn.call(that, args[0]); + case 2: return un ? fn(args[0], args[1]) + : fn.call(that, args[0], args[1]); + case 3: return un ? fn(args[0], args[1], args[2]) + : fn.call(that, args[0], args[1], args[2]); + case 4: return un ? fn(args[0], args[1], args[2], args[3]) + : fn.call(that, args[0], args[1], args[2], args[3]); + } return fn.apply(that, args); +}; + +},{}],44:[function(require,module,exports){ +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = require('./_cof'); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + +},{"./_cof":27}],45:[function(require,module,exports){ +// check on default Array iterator +var Iterators = require('./_iterators'); +var ITERATOR = require('./_wks')('iterator'); +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + +},{"./_iterators":53,"./_wks":91}],46:[function(require,module,exports){ +// 7.2.2 IsArray(argument) +var cof = require('./_cof'); +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; + +},{"./_cof":27}],47:[function(require,module,exports){ +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +},{}],48:[function(require,module,exports){ +// call something on iterator step with safe closing on error +var anObject = require('./_an-object'); +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 (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + +},{"./_an-object":24}],49:[function(require,module,exports){ +'use strict'; +var create = require('./_object-create'); +var descriptor = require('./_property-desc'); +var setToStringTag = require('./_set-to-string-tag'); +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + +},{"./_hide":40,"./_object-create":58,"./_property-desc":71,"./_set-to-string-tag":75,"./_wks":91}],50:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var $iterCreate = require('./_iter-create'); +var setToStringTag = require('./_set-to-string-tag'); +var getPrototypeOf = require('./_object-gpo'); +var ITERATOR = require('./_wks')('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + +},{"./_export":35,"./_hide":40,"./_iter-create":49,"./_iterators":53,"./_library":54,"./_object-gpo":65,"./_redefine":73,"./_set-to-string-tag":75,"./_wks":91}],51:[function(require,module,exports){ +var ITERATOR = require('./_wks')('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + +},{"./_wks":91}],52:[function(require,module,exports){ +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + +},{}],53:[function(require,module,exports){ +module.exports = {}; + +},{}],54:[function(require,module,exports){ +module.exports = true; + +},{}],55:[function(require,module,exports){ +var META = require('./_uid')('meta'); +var isObject = require('./_is-object'); +var has = require('./_has'); +var setDesc = require('./_object-dp').f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !require('./_fails')(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // 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 + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!has(it, META)) { + // 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 + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; + +},{"./_fails":36,"./_has":39,"./_is-object":47,"./_object-dp":59,"./_uid":87}],56:[function(require,module,exports){ +var global = require('./_global'); +var macrotask = require('./_task').set; +var Observer = global.MutationObserver || global.WebKitMutationObserver; +var process = global.process; +var Promise = global.Promise; +var isNode = require('./_cof')(process) == 'process'; + +module.exports = function () { + var head, last, notify; + + var flush = function () { + var parent, fn; + if (isNode && (parent = process.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify(); + else last = undefined; + throw e; + } + } last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function () { + process.nextTick(flush); + }; + // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 + } else if (Observer && !(global.navigator && global.navigator.standalone)) { + var toggle = true; + var node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + 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 + var promise = Promise.resolve(undefined); + notify = function () { + promise.then(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); + }; + } + + return function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } last = task; + }; +}; + +},{"./_cof":27,"./_global":38,"./_task":80}],57:[function(require,module,exports){ +'use strict'; +// 25.4.1.5 NewPromiseCapability(C) +var aFunction = require('./_a-function'); + +function PromiseCapability(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); +} + +module.exports.f = function (C) { + return new PromiseCapability(C); +}; + +},{"./_a-function":21}],58:[function(require,module,exports){ +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = require('./_an-object'); +var dPs = require('./_object-dps'); +var enumBugKeys = require('./_enum-bug-keys'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = require('./_dom-create')('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + require('./_html').appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + +},{"./_an-object":24,"./_dom-create":32,"./_enum-bug-keys":33,"./_html":41,"./_object-dps":60,"./_shared-key":76}],59:[function(require,module,exports){ +var anObject = require('./_an-object'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var toPrimitive = require('./_to-primitive'); +var dP = Object.defineProperty; + +exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +},{"./_an-object":24,"./_descriptors":31,"./_ie8-dom-define":42,"./_to-primitive":86}],60:[function(require,module,exports){ +var dP = require('./_object-dp'); +var anObject = require('./_an-object'); +var getKeys = require('./_object-keys'); + +module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; + +},{"./_an-object":24,"./_descriptors":31,"./_object-dp":59,"./_object-keys":67}],61:[function(require,module,exports){ +var pIE = require('./_object-pie'); +var createDesc = require('./_property-desc'); +var toIObject = require('./_to-iobject'); +var toPrimitive = require('./_to-primitive'); +var has = require('./_has'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var gOPD = Object.getOwnPropertyDescriptor; + +exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); +}; + +},{"./_descriptors":31,"./_has":39,"./_ie8-dom-define":42,"./_object-pie":68,"./_property-desc":71,"./_to-iobject":83,"./_to-primitive":86}],62:[function(require,module,exports){ +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var toIObject = require('./_to-iobject'); +var gOPN = require('./_object-gopn').f; +var toString = {}.toString; + +var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + +var getWindowNames = function (it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } +}; + +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +}; + +},{"./_object-gopn":63,"./_to-iobject":83}],63:[function(require,module,exports){ +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = require('./_object-keys-internal'); +var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype'); + +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); +}; + +},{"./_enum-bug-keys":33,"./_object-keys-internal":66}],64:[function(require,module,exports){ +exports.f = Object.getOwnPropertySymbols; + +},{}],65:[function(require,module,exports){ +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = require('./_has'); +var toObject = require('./_to-object'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = 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 ? ObjectProto : null; +}; + +},{"./_has":39,"./_shared-key":76,"./_to-object":85}],66:[function(require,module,exports){ +var has = require('./_has'); +var toIObject = require('./_to-iobject'); +var arrayIndexOf = require('./_array-includes')(false); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; + +},{"./_array-includes":25,"./_has":39,"./_shared-key":76,"./_to-iobject":83}],67:[function(require,module,exports){ +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = require('./_object-keys-internal'); +var enumBugKeys = require('./_enum-bug-keys'); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + +},{"./_enum-bug-keys":33,"./_object-keys-internal":66}],68:[function(require,module,exports){ +exports.f = {}.propertyIsEnumerable; + +},{}],69:[function(require,module,exports){ +module.exports = function (exec) { + try { + return { e: false, v: exec() }; + } catch (e) { + return { e: true, v: e }; + } +}; + +},{}],70:[function(require,module,exports){ +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var newPromiseCapability = require('./_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; +}; + +},{"./_an-object":24,"./_is-object":47,"./_new-promise-capability":57}],71:[function(require,module,exports){ +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +},{}],72:[function(require,module,exports){ +var hide = require('./_hide'); +module.exports = function (target, src, safe) { + for (var key in src) { + if (safe && target[key]) target[key] = src[key]; + else hide(target, key, src[key]); + } return target; +}; + +},{"./_hide":40}],73:[function(require,module,exports){ +module.exports = require('./_hide'); + +},{"./_hide":40}],74:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var core = require('./_core'); +var dP = require('./_object-dp'); +var DESCRIPTORS = require('./_descriptors'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (KEY) { + var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function () { return this; } + }); +}; + +},{"./_core":28,"./_descriptors":31,"./_global":38,"./_object-dp":59,"./_wks":91}],75:[function(require,module,exports){ +var def = require('./_object-dp').f; +var has = require('./_has'); +var TAG = require('./_wks')('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + +},{"./_has":39,"./_object-dp":59,"./_wks":91}],76:[function(require,module,exports){ +var shared = require('./_shared')('keys'); +var uid = require('./_uid'); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + +},{"./_shared":77,"./_uid":87}],77:[function(require,module,exports){ +var core = require('./_core'); +var global = require('./_global'); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: require('./_library') ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); + +},{"./_core":28,"./_global":38,"./_library":54}],78:[function(require,module,exports){ +// 7.3.20 SpeciesConstructor(O, defaultConstructor) +var anObject = require('./_an-object'); +var aFunction = require('./_a-function'); +var SPECIES = require('./_wks')('species'); +module.exports = function (O, D) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); +}; + +},{"./_a-function":21,"./_an-object":24,"./_wks":91}],79:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + +},{"./_defined":30,"./_to-integer":82}],80:[function(require,module,exports){ +var ctx = require('./_ctx'); +var invoke = require('./_invoke'); +var html = require('./_html'); +var cel = require('./_dom-create'); +var global = require('./_global'); +var process = global.process; +var setTask = global.setImmediate; +var clearTask = global.clearImmediate; +var MessageChannel = global.MessageChannel; +var Dispatch = global.Dispatch; +var counter = 0; +var queue = {}; +var ONREADYSTATECHANGE = 'onreadystatechange'; +var defer, channel, port; +var run = function () { + var id = +this; + // eslint-disable-next-line no-prototype-builtins + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var listener = function (event) { + run.call(event.data); +}; +// Node.js 0.9+ & IE10+ has setImmediate, otherwise: +if (!setTask || !clearTask) { + setTask = 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 + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (require('./_cof')(process) == 'process') { + defer = function (id) { + process.nextTick(ctx(run, id, 1)); + }; + // Sphere (JS game engine) Dispatch API + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(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) { + defer = function (id) { + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in cel('script')) { + defer = function (id) { + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function (id) { + setTimeout(ctx(run, id, 1), 0); + }; + } +} +module.exports = { + set: setTask, + clear: clearTask +}; + +},{"./_cof":27,"./_ctx":29,"./_dom-create":32,"./_global":38,"./_html":41,"./_invoke":43}],81:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + +},{"./_to-integer":82}],82:[function(require,module,exports){ +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + +},{}],83:[function(require,module,exports){ +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = require('./_iobject'); +var defined = require('./_defined'); +module.exports = function (it) { + return IObject(defined(it)); +}; + +},{"./_defined":30,"./_iobject":44}],84:[function(require,module,exports){ +// 7.1.15 ToLength +var toInteger = require('./_to-integer'); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + +},{"./_to-integer":82}],85:[function(require,module,exports){ +// 7.1.13 ToObject(argument) +var defined = require('./_defined'); +module.exports = function (it) { + return Object(defined(it)); +}; + +},{"./_defined":30}],86:[function(require,module,exports){ +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = require('./_is-object'); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +},{"./_is-object":47}],87:[function(require,module,exports){ +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +},{}],88:[function(require,module,exports){ +var global = require('./_global'); +var navigator = global.navigator; + +module.exports = navigator && navigator.userAgent || ''; + +},{"./_global":38}],89:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var LIBRARY = require('./_library'); +var wksExt = require('./_wks-ext'); +var defineProperty = require('./_object-dp').f; +module.exports = function (name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +}; + +},{"./_core":28,"./_global":38,"./_library":54,"./_object-dp":59,"./_wks-ext":90}],90:[function(require,module,exports){ +exports.f = require('./_wks'); + +},{"./_wks":91}],91:[function(require,module,exports){ +var store = require('./_shared')('wks'); +var uid = require('./_uid'); +var Symbol = require('./_global').Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + +},{"./_global":38,"./_shared":77,"./_uid":87}],92:[function(require,module,exports){ +var classof = require('./_classof'); +var ITERATOR = require('./_wks')('iterator'); +var Iterators = require('./_iterators'); +module.exports = require('./_core').getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; + +},{"./_classof":26,"./_core":28,"./_iterators":53,"./_wks":91}],93:[function(require,module,exports){ +'use strict'; +var addToUnscopables = require('./_add-to-unscopables'); +var step = require('./_iter-step'); +var Iterators = require('./_iterators'); +var toIObject = require('./_to-iobject'); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + +},{"./_add-to-unscopables":22,"./_iter-define":50,"./_iter-step":52,"./_iterators":53,"./_to-iobject":83}],94:[function(require,module,exports){ + +},{}],95:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var global = require('./_global'); +var ctx = require('./_ctx'); +var classof = require('./_classof'); +var $export = require('./_export'); +var isObject = require('./_is-object'); +var aFunction = require('./_a-function'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var speciesConstructor = require('./_species-constructor'); +var task = require('./_task').set; +var microtask = require('./_microtask')(); +var newPromiseCapabilityModule = require('./_new-promise-capability'); +var perform = require('./_perform'); +var userAgent = require('./_user-agent'); +var promiseResolve = require('./_promise-resolve'); +var PROMISE = 'Promise'; +var TypeError = global.TypeError; +var process = global.process; +var versions = process && process.versions; +var v8 = versions && versions.v8 || ''; +var $Promise = global[PROMISE]; +var isNode = classof(process) == 'process'; +var empty = function () { /* empty */ }; +var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; +var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; + +var USE_NATIVE = !!function () { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1); + var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) { + exec(empty, empty); + }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode || typeof PromiseRejectionEvent == 'function') + && promise.then(empty) instanceof FakePromise + // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables + // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 + // we can't detect it synchronously, so just check versions + && v8.indexOf('6.6') !== 0 + && userAgent.indexOf('Chrome/66') === -1; + } catch (e) { /* empty */ } +}(); + +// helpers +var isThenable = function (it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var notify = function (promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function () { + var value = promise._v; + var ok = promise._s == 1; + var i = 0; + var run = function (reaction) { + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); // may throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + if (domain && !exited) domain.exit(); + reject(e); + } + }; + while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); +}; +var onUnhandled = function (promise) { + task.call(global, function () { + var value = promise._v; + var unhandled = isUnhandled(promise); + var result, handler, console; + if (unhandled) { + result = perform(function () { + if (isNode) { + process.emit('unhandledRejection', value, promise); + } else if (handler = global.onunhandledrejection) { + handler({ promise: promise, reason: value }); + } else if ((console = global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + } promise._a = undefined; + if (unhandled && result.e) throw result.v; + }); +}; +var isUnhandled = function (promise) { + return promise._h !== 1 && (promise._a || promise._c).length === 0; +}; +var onHandleUnhandled = function (promise) { + task.call(global, function () { + var handler; + if (isNode) { + process.emit('rejectionHandled', promise); + } else if (handler = global.onrejectionhandled) { + handler({ promise: promise, reason: promise._v }); + } + }); +}; +var $reject = function (value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); +}; +var $resolve = function (value) { + var promise = this; + var then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError("Promise can't be resolved itself"); + if (then = isThenable(value)) { + microtask(function () { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } +}; + +// constructor polyfill +if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + // eslint-disable-next-line no-unused-vars + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = require('./_redefine-all')($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + OwnPromiseCapability = function () { + var promise = new Internal(); + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; + newPromiseCapabilityModule.f = newPromiseCapability = function (C) { + return C === $Promise || C === Wrapper + ? new OwnPromiseCapability(C) + : newGenericPromiseCapability(C); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); +require('./_set-to-string-tag')($Promise, PROMISE); +require('./_set-species')(PROMISE); +Wrapper = require('./_core')[PROMISE]; + +// statics +$export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this); + var $$reject = capability.reject; + $$reject(r); + return capability.promise; + } +}); +$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); + } +}); +$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) { + $Promise.all(iter)['catch'](empty); +})), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var values = []; + var index = 0; + var remaining = 1; + forOf(iterable, false, function (promise) { + var $index = index++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.e) reject(result.v); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var reject = capability.reject; + var result = perform(function () { + forOf(iterable, false, function (promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (result.e) reject(result.v); + return capability.promise; + } +}); + +},{"./_a-function":21,"./_an-instance":23,"./_classof":26,"./_core":28,"./_ctx":29,"./_export":35,"./_for-of":37,"./_global":38,"./_is-object":47,"./_iter-detect":51,"./_library":54,"./_microtask":56,"./_new-promise-capability":57,"./_perform":69,"./_promise-resolve":70,"./_redefine-all":72,"./_set-species":74,"./_set-to-string-tag":75,"./_species-constructor":78,"./_task":80,"./_user-agent":88,"./_wks":91}],96:[function(require,module,exports){ +'use strict'; +var $at = require('./_string-at')(true); + +// 21.1.3.27 String.prototype[@@iterator]() +require('./_iter-define')(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + +},{"./_iter-define":50,"./_string-at":79}],97:[function(require,module,exports){ +'use strict'; +// ECMAScript 6 symbols shim +var global = require('./_global'); +var has = require('./_has'); +var DESCRIPTORS = require('./_descriptors'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var META = require('./_meta').KEY; +var $fails = require('./_fails'); +var shared = require('./_shared'); +var setToStringTag = require('./_set-to-string-tag'); +var uid = require('./_uid'); +var wks = require('./_wks'); +var wksExt = require('./_wks-ext'); +var wksDefine = require('./_wks-define'); +var enumKeys = require('./_enum-keys'); +var isArray = require('./_is-array'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var toIObject = require('./_to-iobject'); +var toPrimitive = require('./_to-primitive'); +var createDesc = require('./_property-desc'); +var _create = require('./_object-create'); +var gOPNExt = require('./_object-gopn-ext'); +var $GOPD = require('./_object-gopd'); +var $DP = require('./_object-dp'); +var $keys = require('./_object-keys'); +var gOPD = $GOPD.f; +var dP = $DP.f; +var gOPN = gOPNExt.f; +var $Symbol = global.Symbol; +var $JSON = global.JSON; +var _stringify = $JSON && $JSON.stringify; +var PROTOTYPE = 'prototype'; +var HIDDEN = wks('_hidden'); +var TO_PRIMITIVE = wks('toPrimitive'); +var isEnum = {}.propertyIsEnumerable; +var SymbolRegistry = shared('symbol-registry'); +var AllSymbols = shared('symbols'); +var OPSymbols = shared('op-symbols'); +var ObjectProto = Object[PROTOTYPE]; +var USE_NATIVE = typeof $Symbol == 'function'; +var QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = DESCRIPTORS && $fails(function () { + return _create(dP({}, 'a', { + get: function () { return dP(this, 'a', { value: 7 }).a; } + })).a != 7; +}) ? function (it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); +} : dP; + +var wrap = function (tag) { + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; +}; + +var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + } return setSymbolDesc(it, key, D); + } return dP(it, key, D); +}; +var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys(P = toIObject(P)); + var i = 0; + var l = keys.length; + var key; + while (l > i) $defineProperty(it, key = keys[i++], P[key]); + return it; +}; +var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = toPrimitive(key, true)); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + } return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto; + var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + } return result; +}; + +// 19.4.1.1 Symbol([description]) +if (!USE_NATIVE) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function (value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames; + require('./_object-pie').f = $propertyIsEnumerable; + require('./_object-gops').f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !require('./_library')) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function (name) { + return wrap(wks(name)); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); + +for (var es6Symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' +).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); + +for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); + +$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function (key) { + return has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); + for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; + }, + useSetter: function () { setter = true; }, + useSimple: function () { setter = false; } +}); + +$export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); + +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it) { + var args = [it]; + var i = 1; + var replacer, $replacer; + while (arguments.length > i) args.push(arguments[i++]); + $replacer = replacer = args[1]; + if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + if (!isArray(replacer)) replacer = function (key, value) { + if (typeof $replacer == 'function') value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); + +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +setToStringTag(global.JSON, 'JSON', true); + +},{"./_an-object":24,"./_descriptors":31,"./_enum-keys":34,"./_export":35,"./_fails":36,"./_global":38,"./_has":39,"./_hide":40,"./_is-array":46,"./_is-object":47,"./_library":54,"./_meta":55,"./_object-create":58,"./_object-dp":59,"./_object-gopd":61,"./_object-gopn":63,"./_object-gopn-ext":62,"./_object-gops":64,"./_object-keys":67,"./_object-pie":68,"./_property-desc":71,"./_redefine":73,"./_set-to-string-tag":75,"./_shared":77,"./_to-iobject":83,"./_to-primitive":86,"./_uid":87,"./_wks":91,"./_wks-define":89,"./_wks-ext":90}],98:[function(require,module,exports){ +// https://github.com/tc39/proposal-promise-finally +'use strict'; +var $export = require('./_export'); +var core = require('./_core'); +var global = require('./_global'); +var speciesConstructor = require('./_species-constructor'); +var promiseResolve = require('./_promise-resolve'); + +$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) { + var C = speciesConstructor(this, core.Promise || global.Promise); + var isFunction = typeof onFinally == 'function'; + return this.then( + isFunction ? function (x) { + return promiseResolve(C, onFinally()).then(function () { return x; }); + } : onFinally, + isFunction ? function (e) { + return promiseResolve(C, onFinally()).then(function () { throw e; }); + } : onFinally + ); +} }); + +},{"./_core":28,"./_export":35,"./_global":38,"./_promise-resolve":70,"./_species-constructor":78}],99:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-promise-try +var $export = require('./_export'); +var newPromiseCapability = require('./_new-promise-capability'); +var perform = require('./_perform'); + +$export($export.S, 'Promise', { 'try': function (callbackfn) { + var promiseCapability = newPromiseCapability.f(this); + var result = perform(callbackfn); + (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); + return promiseCapability.promise; +} }); + +},{"./_export":35,"./_new-promise-capability":57,"./_perform":69}],100:[function(require,module,exports){ +require('./_wks-define')('asyncIterator'); + +},{"./_wks-define":89}],101:[function(require,module,exports){ +require('./_wks-define')('observable'); + +},{"./_wks-define":89}],102:[function(require,module,exports){ +require('./es6.array.iterator'); +var global = require('./_global'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var TO_STRING_TAG = require('./_wks')('toStringTag'); + +var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + + 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + + 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' + + 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' + + 'TextTrackList,TouchList').split(','); + +for (var i = 0; i < DOMIterables.length; i++) { + var NAME = DOMIterables[i]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; +} + +},{"./_global":38,"./_hide":40,"./_iterators":53,"./_wks":91,"./es6.array.iterator":93}],103:[function(require,module,exports){ +arguments[4][21][0].apply(exports,arguments) +},{"dup":21}],104:[function(require,module,exports){ +var cof = require('./_cof'); +module.exports = function (it, msg) { + if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg); + return +it; +}; + +},{"./_cof":118}],105:[function(require,module,exports){ +// 22.1.3.31 Array.prototype[@@unscopables] +var UNSCOPABLES = require('./_wks')('unscopables'); +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {}); +module.exports = function (key) { + ArrayProto[UNSCOPABLES][key] = true; +}; + +},{"./_hide":142,"./_wks":226}],106:[function(require,module,exports){ +arguments[4][23][0].apply(exports,arguments) +},{"dup":23}],107:[function(require,module,exports){ +arguments[4][24][0].apply(exports,arguments) +},{"./_is-object":151,"dup":24}],108:[function(require,module,exports){ +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +'use strict'; +var toObject = require('./_to-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); + +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 = Math.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; +}; + +},{"./_to-absolute-index":211,"./_to-length":215,"./_to-object":216}],109:[function(require,module,exports){ +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +'use strict'; +var toObject = require('./_to-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +module.exports = function fill(value /* , start = 0, end = @length */) { + var O = toObject(this); + var length = toLength(O.length); + var aLen = arguments.length; + var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); + var end = aLen > 2 ? arguments[2] : undefined; + var endPos = end === undefined ? length : toAbsoluteIndex(end, length); + while (endPos > index) O[index++] = value; + return O; +}; + +},{"./_to-absolute-index":211,"./_to-length":215,"./_to-object":216}],110:[function(require,module,exports){ +var forOf = require('./_for-of'); + +module.exports = function (iter, ITERATOR) { + var result = []; + forOf(iter, false, result.push, result, ITERATOR); + return result; +}; + +},{"./_for-of":139}],111:[function(require,module,exports){ +arguments[4][25][0].apply(exports,arguments) +},{"./_to-absolute-index":211,"./_to-iobject":214,"./_to-length":215,"dup":25}],112:[function(require,module,exports){ +// 0 -> Array#forEach +// 1 -> Array#map +// 2 -> Array#filter +// 3 -> Array#some +// 4 -> Array#every +// 5 -> Array#find +// 6 -> Array#findIndex +var ctx = require('./_ctx'); +var IObject = require('./_iobject'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var asc = require('./_array-species-create'); +module.exports = function (TYPE, $create) { + 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; + var create = $create || asc; + return function ($this, callbackfn, that) { + var O = toObject($this); + var self = IObject(O); + var f = ctx(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var val, res; + for (;length > index; index++) if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; +}; + +},{"./_array-species-create":115,"./_ctx":125,"./_iobject":147,"./_to-length":215,"./_to-object":216}],113:[function(require,module,exports){ +var aFunction = require('./_a-function'); +var toObject = require('./_to-object'); +var IObject = require('./_iobject'); +var toLength = require('./_to-length'); + +module.exports = function (that, callbackfn, aLen, memo, isRight) { + aFunction(callbackfn); + var O = toObject(that); + var self = IObject(O); + var length = toLength(O.length); + var index = isRight ? length - 1 : 0; + var i = isRight ? -1 : 1; + if (aLen < 2) for (;;) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (isRight ? index < 0 : length <= index) { + throw TypeError('Reduce of empty array with no initial value'); + } + } + for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; +}; + +},{"./_a-function":103,"./_iobject":147,"./_to-length":215,"./_to-object":216}],114:[function(require,module,exports){ +var isObject = require('./_is-object'); +var isArray = require('./_is-array'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (original) { + var C; + if (isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + } return C === undefined ? Array : C; +}; + +},{"./_is-array":149,"./_is-object":151,"./_wks":226}],115:[function(require,module,exports){ +// 9.4.2.3 ArraySpeciesCreate(originalArray, length) +var speciesConstructor = require('./_array-species-constructor'); + +module.exports = function (original, length) { + return new (speciesConstructor(original))(length); +}; + +},{"./_array-species-constructor":114}],116:[function(require,module,exports){ +'use strict'; +var aFunction = require('./_a-function'); +var isObject = require('./_is-object'); +var invoke = require('./_invoke'); +var arraySlice = [].slice; +var factories = {}; + +var construct = function (F, len, args) { + if (!(len in factories)) { + for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; + // eslint-disable-next-line no-new-func + factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); + } return factories[len](F, args); +}; + +module.exports = Function.bind || function bind(that /* , ...args */) { + var fn = aFunction(this); + var partArgs = arraySlice.call(arguments, 1); + var bound = function (/* args... */) { + var args = partArgs.concat(arraySlice.call(arguments)); + return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); + }; + if (isObject(fn.prototype)) bound.prototype = fn.prototype; + return bound; +}; + +},{"./_a-function":103,"./_invoke":146,"./_is-object":151}],117:[function(require,module,exports){ +arguments[4][26][0].apply(exports,arguments) +},{"./_cof":118,"./_wks":226,"dup":26}],118:[function(require,module,exports){ +arguments[4][27][0].apply(exports,arguments) +},{"dup":27}],119:[function(require,module,exports){ +'use strict'; +var dP = require('./_object-dp').f; +var create = require('./_object-create'); +var redefineAll = require('./_redefine-all'); +var ctx = require('./_ctx'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var $iterDefine = require('./_iter-define'); +var step = require('./_iter-step'); +var setSpecies = require('./_set-species'); +var DESCRIPTORS = require('./_descriptors'); +var fastKey = require('./_meta').fastKey; +var validate = require('./_validate-collection'); +var SIZE = DESCRIPTORS ? '_s' : 'size'; + +var getEntry = function (that, key) { + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = create(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function (key) { + var that = validate(this, NAME); + var entry = getEntry(that, key); + if (entry) { + var next = entry.n; + var prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + 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 */) { + validate(this, NAME); + var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var entry; + while (entry = entry ? entry.n : this._f) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(validate(this, NAME), key); + } + }); + if (DESCRIPTORS) dP(C.prototype, 'size', { + get: function () { + return validate(this, NAME)[SIZE]; + } + }); + return C; + }, + def: function (that, key, value) { + var entry = getEntry(that, key); + var prev, index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that._l, // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + } return that; + }, + getEntry: getEntry, + setStrong: function (C, NAME, IS_MAP) { + // 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 + $iterDefine(C, NAME, function (iterated, kind) { + this._t = validate(iterated, NAME); // target + this._k = kind; // kind + this._l = undefined; // previous + }, function () { + var that = this; + var kind = that._k; + var entry = that._l; + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return step(1); + } + // return step by kind + if (kind == 'keys') return step(0, entry.k); + if (kind == 'values') return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // add [@@species], 23.1.2.2, 23.2.2.2 + setSpecies(NAME); + } +}; + +},{"./_an-instance":106,"./_ctx":125,"./_descriptors":129,"./_for-of":139,"./_iter-define":155,"./_iter-step":157,"./_meta":165,"./_object-create":170,"./_object-dp":171,"./_redefine-all":190,"./_set-species":197,"./_validate-collection":223}],120:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var classof = require('./_classof'); +var from = require('./_array-from-iterable'); +module.exports = function (NAME) { + return function toJSON() { + if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); + return from(this); + }; +}; + +},{"./_array-from-iterable":110,"./_classof":117}],121:[function(require,module,exports){ +'use strict'; +var redefineAll = require('./_redefine-all'); +var getWeak = require('./_meta').getWeak; +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var createArrayMethod = require('./_array-methods'); +var $has = require('./_has'); +var validate = require('./_validate-collection'); +var arrayFind = createArrayMethod(5); +var arrayFindIndex = createArrayMethod(6); +var id = 0; + +// fallback for uncaught frozen keys +var uncaughtFrozenStore = function (that) { + return that._l || (that._l = new UncaughtFrozenStore()); +}; +var UncaughtFrozenStore = function () { + this.a = []; +}; +var findUncaughtFrozen = function (store, key) { + return arrayFind(store.a, function (it) { + return it[0] === key; + }); +}; +UncaughtFrozenStore.prototype = { + get: function (key) { + var entry = findUncaughtFrozen(this, key); + if (entry) return entry[1]; + }, + has: function (key) { + return !!findUncaughtFrozen(this, key); + }, + set: function (key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) entry[1] = value; + else this.a.push([key, value]); + }, + 'delete': function (key) { + var index = arrayFindIndex(this.a, function (it) { + return it[0] === key; + }); + if (~index) this.a.splice(index, 1); + return !!~index; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = id++; // collection id + that._l = undefined; // leak store for uncaught frozen objects + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.3.3.2 WeakMap.prototype.delete(key) + // 23.4.3.3 WeakSet.prototype.delete(value) + 'delete': function (key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); + return data && $has(data, this._i) && delete data[this._i]; + }, + // 23.3.3.4 WeakMap.prototype.has(key) + // 23.4.3.4 WeakSet.prototype.has(value) + has: function has(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); + return data && $has(data, this._i); + } + }); + return C; + }, + def: function (that, key, value) { + var data = getWeak(anObject(key), true); + if (data === true) uncaughtFrozenStore(that).set(key, value); + else data[that._i] = value; + return that; + }, + ufstore: uncaughtFrozenStore +}; + +},{"./_an-instance":106,"./_an-object":107,"./_array-methods":112,"./_for-of":139,"./_has":141,"./_is-object":151,"./_meta":165,"./_redefine-all":190,"./_validate-collection":223}],122:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var redefineAll = require('./_redefine-all'); +var meta = require('./_meta'); +var forOf = require('./_for-of'); +var anInstance = require('./_an-instance'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var $iterDetect = require('./_iter-detect'); +var setToStringTag = require('./_set-to-string-tag'); +var inheritIfRequired = require('./_inherit-if-required'); + +module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = global[NAME]; + var C = Base; + var ADDER = IS_MAP ? 'set' : 'add'; + var proto = C && C.prototype; + var O = {}; + var fixMethod = function (KEY) { + var fn = proto[KEY]; + redefine(proto, KEY, + KEY == 'delete' ? function (a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'has' ? function has(a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'get' ? function get(a) { + return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } + : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } + ); + }; + if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { + new C().entries().next(); + }))) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + var instance = new C(); + // 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 + var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new + // 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 C(); + var index = 5; + while (index--) $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + C = wrapper(function (target, iterable) { + anInstance(target, C, NAME); + var that = inheritIfRequired(new Base(), target, C); + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + 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 && proto.clear) delete proto.clear; + } + + setToStringTag(C, NAME); + + O[NAME] = C; + $export($export.G + $export.W + $export.F * (C != Base), O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; +}; + +},{"./_an-instance":106,"./_export":133,"./_fails":135,"./_for-of":139,"./_global":140,"./_inherit-if-required":145,"./_is-object":151,"./_iter-detect":156,"./_meta":165,"./_redefine":191,"./_redefine-all":190,"./_set-to-string-tag":198}],123:[function(require,module,exports){ +arguments[4][28][0].apply(exports,arguments) +},{"dup":28}],124:[function(require,module,exports){ +'use strict'; +var $defineProperty = require('./_object-dp'); +var createDesc = require('./_property-desc'); + +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; +}; + +},{"./_object-dp":171,"./_property-desc":189}],125:[function(require,module,exports){ +arguments[4][29][0].apply(exports,arguments) +},{"./_a-function":103,"dup":29}],126:[function(require,module,exports){ +'use strict'; +// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() +var fails = require('./_fails'); +var getTime = Date.prototype.getTime; +var $toISOString = Date.prototype.toISOString; + +var lz = function (num) { + return num > 9 ? num : '0' + num; +}; + +// PhantomJS / old WebKit has a broken implementations +module.exports = (fails(function () { + return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; +}) || !fails(function () { + $toISOString.call(new Date(NaN)); +})) ? function toISOString() { + if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); + var d = this; + var y = d.getUTCFullYear(); + var m = d.getUTCMilliseconds(); + var s = y < 0 ? '-' : y > 9999 ? '+' : ''; + return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; +} : $toISOString; + +},{"./_fails":135}],127:[function(require,module,exports){ +'use strict'; +var anObject = require('./_an-object'); +var toPrimitive = require('./_to-primitive'); +var NUMBER = 'number'; + +module.exports = function (hint) { + if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint'); + return toPrimitive(anObject(this), hint != NUMBER); +}; + +},{"./_an-object":107,"./_to-primitive":217}],128:[function(require,module,exports){ +arguments[4][30][0].apply(exports,arguments) +},{"dup":30}],129:[function(require,module,exports){ +arguments[4][31][0].apply(exports,arguments) +},{"./_fails":135,"dup":31}],130:[function(require,module,exports){ +arguments[4][32][0].apply(exports,arguments) +},{"./_global":140,"./_is-object":151,"dup":32}],131:[function(require,module,exports){ +arguments[4][33][0].apply(exports,arguments) +},{"dup":33}],132:[function(require,module,exports){ +arguments[4][34][0].apply(exports,arguments) +},{"./_object-gops":177,"./_object-keys":180,"./_object-pie":181,"dup":34}],133:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var hide = require('./_hide'); +var redefine = require('./_redefine'); +var ctx = require('./_ctx'); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // extend global + if (target) redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +global.core = core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + +},{"./_core":123,"./_ctx":125,"./_global":140,"./_hide":142,"./_redefine":191}],134:[function(require,module,exports){ +var MATCH = require('./_wks')('match'); +module.exports = function (KEY) { + var re = /./; + try { + '/./'[KEY](re); + } catch (e) { + try { + re[MATCH] = false; + return !'/./'[KEY](re); + } catch (f) { /* empty */ } + } return true; +}; + +},{"./_wks":226}],135:[function(require,module,exports){ +arguments[4][36][0].apply(exports,arguments) +},{"dup":36}],136:[function(require,module,exports){ +'use strict'; +var hide = require('./_hide'); +var redefine = require('./_redefine'); +var fails = require('./_fails'); +var defined = require('./_defined'); +var wks = require('./_wks'); + +module.exports = function (KEY, length, exec) { + var SYMBOL = wks(KEY); + var fns = exec(defined, SYMBOL, ''[KEY]); + var strfn = fns[0]; + var rxfn = fns[1]; + if (fails(function () { + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + })) { + redefine(String.prototype, KEY, strfn); + hide(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 rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return rxfn.call(string, this); } + ); + } +}; + +},{"./_defined":128,"./_fails":135,"./_hide":142,"./_redefine":191,"./_wks":226}],137:[function(require,module,exports){ +'use strict'; +// 21.2.5.3 get RegExp.prototype.flags +var anObject = require('./_an-object'); +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.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; +}; + +},{"./_an-object":107}],138:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray +var isArray = require('./_is-array'); +var isObject = require('./_is-object'); +var toLength = require('./_to-length'); +var ctx = require('./_ctx'); +var IS_CONCAT_SPREADABLE = require('./_wks')('isConcatSpreadable'); + +function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) { + var targetIndex = start; + var sourceIndex = 0; + var mapFn = mapper ? ctx(mapper, thisArg, 3) : false; + var element, spreadable; + + while (sourceIndex < sourceLen) { + if (sourceIndex in source) { + element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; + + spreadable = false; + if (isObject(element)) { + spreadable = element[IS_CONCAT_SPREADABLE]; + spreadable = spreadable !== undefined ? !!spreadable : isArray(element); + } + + if (spreadable && depth > 0) { + targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; + } else { + if (targetIndex >= 0x1fffffffffffff) throw TypeError(); + target[targetIndex] = element; + } + + targetIndex++; + } + sourceIndex++; + } + return targetIndex; +} + +module.exports = flattenIntoArray; + +},{"./_ctx":125,"./_is-array":149,"./_is-object":151,"./_to-length":215,"./_wks":226}],139:[function(require,module,exports){ +arguments[4][37][0].apply(exports,arguments) +},{"./_an-object":107,"./_ctx":125,"./_is-array-iter":148,"./_iter-call":153,"./_to-length":215,"./core.get-iterator-method":227,"dup":37}],140:[function(require,module,exports){ +arguments[4][38][0].apply(exports,arguments) +},{"dup":38}],141:[function(require,module,exports){ +arguments[4][39][0].apply(exports,arguments) +},{"dup":39}],142:[function(require,module,exports){ +arguments[4][40][0].apply(exports,arguments) +},{"./_descriptors":129,"./_object-dp":171,"./_property-desc":189,"dup":40}],143:[function(require,module,exports){ +arguments[4][41][0].apply(exports,arguments) +},{"./_global":140,"dup":41}],144:[function(require,module,exports){ +arguments[4][42][0].apply(exports,arguments) +},{"./_descriptors":129,"./_dom-create":130,"./_fails":135,"dup":42}],145:[function(require,module,exports){ +var isObject = require('./_is-object'); +var setPrototypeOf = require('./_set-proto').set; +module.exports = function (that, target, C) { + var S = target.constructor; + var P; + if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { + setPrototypeOf(that, P); + } return that; +}; + +},{"./_is-object":151,"./_set-proto":196}],146:[function(require,module,exports){ +arguments[4][43][0].apply(exports,arguments) +},{"dup":43}],147:[function(require,module,exports){ +arguments[4][44][0].apply(exports,arguments) +},{"./_cof":118,"dup":44}],148:[function(require,module,exports){ +arguments[4][45][0].apply(exports,arguments) +},{"./_iterators":158,"./_wks":226,"dup":45}],149:[function(require,module,exports){ +arguments[4][46][0].apply(exports,arguments) +},{"./_cof":118,"dup":46}],150:[function(require,module,exports){ +// 20.1.2.3 Number.isInteger(number) +var isObject = require('./_is-object'); +var floor = Math.floor; +module.exports = function isInteger(it) { + return !isObject(it) && isFinite(it) && floor(it) === it; +}; + +},{"./_is-object":151}],151:[function(require,module,exports){ +arguments[4][47][0].apply(exports,arguments) +},{"dup":47}],152:[function(require,module,exports){ +// 7.2.8 IsRegExp(argument) +var isObject = require('./_is-object'); +var cof = require('./_cof'); +var MATCH = require('./_wks')('match'); +module.exports = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); +}; + +},{"./_cof":118,"./_is-object":151,"./_wks":226}],153:[function(require,module,exports){ +arguments[4][48][0].apply(exports,arguments) +},{"./_an-object":107,"dup":48}],154:[function(require,module,exports){ +arguments[4][49][0].apply(exports,arguments) +},{"./_hide":142,"./_object-create":170,"./_property-desc":189,"./_set-to-string-tag":198,"./_wks":226,"dup":49}],155:[function(require,module,exports){ +arguments[4][50][0].apply(exports,arguments) +},{"./_export":133,"./_hide":142,"./_iter-create":154,"./_iterators":158,"./_library":159,"./_object-gpo":178,"./_redefine":191,"./_set-to-string-tag":198,"./_wks":226,"dup":50}],156:[function(require,module,exports){ +arguments[4][51][0].apply(exports,arguments) +},{"./_wks":226,"dup":51}],157:[function(require,module,exports){ +arguments[4][52][0].apply(exports,arguments) +},{"dup":52}],158:[function(require,module,exports){ +arguments[4][53][0].apply(exports,arguments) +},{"dup":53}],159:[function(require,module,exports){ +module.exports = false; + +},{}],160:[function(require,module,exports){ +// 20.2.2.14 Math.expm1(x) +var $expm1 = Math.expm1; +module.exports = (!$expm1 + // Old FF bug + || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 + // Tor Browser bug + || $expm1(-2e-17) != -2e-17 +) ? function expm1(x) { + return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; +} : $expm1; + +},{}],161:[function(require,module,exports){ +// 20.2.2.16 Math.fround(x) +var sign = require('./_math-sign'); +var pow = Math.pow; +var EPSILON = pow(2, -52); +var EPSILON32 = pow(2, -23); +var MAX32 = pow(2, 127) * (2 - EPSILON32); +var MIN32 = pow(2, -126); + +var roundTiesToEven = function (n) { + return n + 1 / EPSILON - 1 / EPSILON; +}; + +module.exports = Math.fround || function fround(x) { + var $abs = Math.abs(x); + var $sign = sign(x); + var a, result; + if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; + a = (1 + EPSILON32 / EPSILON) * $abs; + result = a - (a - $abs); + // eslint-disable-next-line no-self-compare + if (result > MAX32 || result != result) return $sign * Infinity; + return $sign * result; +}; + +},{"./_math-sign":164}],162:[function(require,module,exports){ +// 20.2.2.20 Math.log1p(x) +module.exports = Math.log1p || function log1p(x) { + return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); +}; + +},{}],163:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { + if ( + arguments.length === 0 + // eslint-disable-next-line no-self-compare + || x != x + // eslint-disable-next-line no-self-compare + || inLow != inLow + // eslint-disable-next-line no-self-compare + || inHigh != inHigh + // eslint-disable-next-line no-self-compare + || outLow != outLow + // eslint-disable-next-line no-self-compare + || outHigh != outHigh + ) return NaN; + if (x === Infinity || x === -Infinity) return x; + return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; +}; + +},{}],164:[function(require,module,exports){ +// 20.2.2.28 Math.sign(x) +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; +}; + +},{}],165:[function(require,module,exports){ +arguments[4][55][0].apply(exports,arguments) +},{"./_fails":135,"./_has":141,"./_is-object":151,"./_object-dp":171,"./_uid":221,"dup":55}],166:[function(require,module,exports){ +var Map = require('./es6.map'); +var $export = require('./_export'); +var shared = require('./_shared')('metadata'); +var store = shared.store || (shared.store = new (require('./es6.weak-map'))()); + +var getOrCreateMetadataMap = function (target, targetKey, create) { + var targetMetadata = store.get(target); + if (!targetMetadata) { + if (!create) return undefined; + store.set(target, targetMetadata = new Map()); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) return undefined; + targetMetadata.set(targetKey, keyMetadata = new Map()); + } return keyMetadata; +}; +var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? false : metadataMap.has(MetadataKey); +}; +var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); +}; +var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { + getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); +}; +var ordinaryOwnMetadataKeys = function (target, targetKey) { + var metadataMap = getOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); + return keys; +}; +var toMetaKey = function (it) { + return it === undefined || typeof it == 'symbol' ? it : String(it); +}; +var exp = function (O) { + $export($export.S, 'Reflect', O); +}; + +module.exports = { + store: store, + map: getOrCreateMetadataMap, + has: ordinaryHasOwnMetadata, + get: ordinaryGetOwnMetadata, + set: ordinaryDefineOwnMetadata, + keys: ordinaryOwnMetadataKeys, + key: toMetaKey, + exp: exp +}; + +},{"./_export":133,"./_shared":200,"./es6.map":258,"./es6.weak-map":364}],167:[function(require,module,exports){ +arguments[4][56][0].apply(exports,arguments) +},{"./_cof":118,"./_global":140,"./_task":210,"dup":56}],168:[function(require,module,exports){ +arguments[4][57][0].apply(exports,arguments) +},{"./_a-function":103,"dup":57}],169:[function(require,module,exports){ +'use strict'; +// 19.1.2.1 Object.assign(target, source, ...) +var getKeys = require('./_object-keys'); +var gOPS = require('./_object-gops'); +var pIE = require('./_object-pie'); +var toObject = require('./_to-object'); +var IObject = require('./_iobject'); +var $assign = Object.assign; + +// should work with symbols and should have deterministic property order (V8 bug) +module.exports = !$assign || require('./_fails')(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = gOPS.f; + var isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]); + var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } return T; +} : $assign; + +},{"./_fails":135,"./_iobject":147,"./_object-gops":177,"./_object-keys":180,"./_object-pie":181,"./_to-object":216}],170:[function(require,module,exports){ +arguments[4][58][0].apply(exports,arguments) +},{"./_an-object":107,"./_dom-create":130,"./_enum-bug-keys":131,"./_html":143,"./_object-dps":172,"./_shared-key":199,"dup":58}],171:[function(require,module,exports){ +arguments[4][59][0].apply(exports,arguments) +},{"./_an-object":107,"./_descriptors":129,"./_ie8-dom-define":144,"./_to-primitive":217,"dup":59}],172:[function(require,module,exports){ +arguments[4][60][0].apply(exports,arguments) +},{"./_an-object":107,"./_descriptors":129,"./_object-dp":171,"./_object-keys":180,"dup":60}],173:[function(require,module,exports){ +'use strict'; +// Forced replacement prototype accessors methods +module.exports = require('./_library') || !require('./_fails')(function () { + var K = Math.random(); + // In FF throws only define methods + // eslint-disable-next-line no-undef, no-useless-call + __defineSetter__.call(null, K, function () { /* empty */ }); + delete require('./_global')[K]; +}); + +},{"./_fails":135,"./_global":140,"./_library":159}],174:[function(require,module,exports){ +arguments[4][61][0].apply(exports,arguments) +},{"./_descriptors":129,"./_has":141,"./_ie8-dom-define":144,"./_object-pie":181,"./_property-desc":189,"./_to-iobject":214,"./_to-primitive":217,"dup":61}],175:[function(require,module,exports){ +arguments[4][62][0].apply(exports,arguments) +},{"./_object-gopn":176,"./_to-iobject":214,"dup":62}],176:[function(require,module,exports){ +arguments[4][63][0].apply(exports,arguments) +},{"./_enum-bug-keys":131,"./_object-keys-internal":179,"dup":63}],177:[function(require,module,exports){ +arguments[4][64][0].apply(exports,arguments) +},{"dup":64}],178:[function(require,module,exports){ +arguments[4][65][0].apply(exports,arguments) +},{"./_has":141,"./_shared-key":199,"./_to-object":216,"dup":65}],179:[function(require,module,exports){ +arguments[4][66][0].apply(exports,arguments) +},{"./_array-includes":111,"./_has":141,"./_shared-key":199,"./_to-iobject":214,"dup":66}],180:[function(require,module,exports){ +arguments[4][67][0].apply(exports,arguments) +},{"./_enum-bug-keys":131,"./_object-keys-internal":179,"dup":67}],181:[function(require,module,exports){ +arguments[4][68][0].apply(exports,arguments) +},{"dup":68}],182:[function(require,module,exports){ +// most Object methods by ES6 should accept primitives +var $export = require('./_export'); +var core = require('./_core'); +var fails = require('./_fails'); +module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); +}; + +},{"./_core":123,"./_export":133,"./_fails":135}],183:[function(require,module,exports){ +var getKeys = require('./_object-keys'); +var toIObject = require('./_to-iobject'); +var isEnum = require('./_object-pie').f; +module.exports = function (isEntries) { + return function (it) { + var O = toIObject(it); + var keys = getKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) if (isEnum.call(O, key = keys[i++])) { + result.push(isEntries ? [key, O[key]] : O[key]); + } return result; + }; +}; + +},{"./_object-keys":180,"./_object-pie":181,"./_to-iobject":214}],184:[function(require,module,exports){ +// all object keys, includes non-enumerable and symbols +var gOPN = require('./_object-gopn'); +var gOPS = require('./_object-gops'); +var anObject = require('./_an-object'); +var Reflect = require('./_global').Reflect; +module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) { + var keys = gOPN.f(anObject(it)); + var getSymbols = gOPS.f; + return getSymbols ? keys.concat(getSymbols(it)) : keys; +}; + +},{"./_an-object":107,"./_global":140,"./_object-gopn":176,"./_object-gops":177}],185:[function(require,module,exports){ +var $parseFloat = require('./_global').parseFloat; +var $trim = require('./_string-trim').trim; + +module.exports = 1 / $parseFloat(require('./_string-ws') + '-0') !== -Infinity ? function parseFloat(str) { + var string = $trim(String(str), 3); + var result = $parseFloat(string); + return result === 0 && string.charAt(0) == '-' ? -0 : result; +} : $parseFloat; + +},{"./_global":140,"./_string-trim":208,"./_string-ws":209}],186:[function(require,module,exports){ +var $parseInt = require('./_global').parseInt; +var $trim = require('./_string-trim').trim; +var ws = require('./_string-ws'); +var hex = /^[-+]?0[xX]/; + +module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) { + var string = $trim(String(str), 3); + return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); +} : $parseInt; + +},{"./_global":140,"./_string-trim":208,"./_string-ws":209}],187:[function(require,module,exports){ +arguments[4][69][0].apply(exports,arguments) +},{"dup":69}],188:[function(require,module,exports){ +arguments[4][70][0].apply(exports,arguments) +},{"./_an-object":107,"./_is-object":151,"./_new-promise-capability":168,"dup":70}],189:[function(require,module,exports){ +arguments[4][71][0].apply(exports,arguments) +},{"dup":71}],190:[function(require,module,exports){ +var redefine = require('./_redefine'); +module.exports = function (target, src, safe) { + for (var key in src) redefine(target, key, src[key], safe); + return target; +}; + +},{"./_redefine":191}],191:[function(require,module,exports){ +var global = require('./_global'); +var hide = require('./_hide'); +var has = require('./_has'); +var SRC = require('./_uid')('src'); +var TO_STRING = 'toString'; +var $toString = Function[TO_STRING]; +var TPL = ('' + $toString).split(TO_STRING); + +require('./_core').inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) has(val, 'name') || hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); + +},{"./_core":123,"./_global":140,"./_has":141,"./_hide":142,"./_uid":221}],192:[function(require,module,exports){ +module.exports = function (regExp, replace) { + var replacer = replace === Object(replace) ? function (part) { + return replace[part]; + } : replace; + return function (it) { + return String(it).replace(regExp, replacer); + }; +}; + +},{}],193:[function(require,module,exports){ +// 7.2.9 SameValue(x, y) +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; +}; + +},{}],194:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-setmap-offrom/ +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var ctx = require('./_ctx'); +var forOf = require('./_for-of'); + +module.exports = function (COLLECTION) { + $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) { + var mapFn = arguments[1]; + var mapping, A, n, cb; + aFunction(this); + mapping = mapFn !== undefined; + if (mapping) aFunction(mapFn); + if (source == undefined) return new this(); + A = []; + if (mapping) { + n = 0; + cb = ctx(mapFn, arguments[2], 2); + forOf(source, false, function (nextItem) { + A.push(cb(nextItem, n++)); + }); + } else { + forOf(source, false, A.push, A); + } + return new this(A); + } }); +}; + +},{"./_a-function":103,"./_ctx":125,"./_export":133,"./_for-of":139}],195:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-setmap-offrom/ +var $export = require('./_export'); + +module.exports = function (COLLECTION) { + $export($export.S, COLLECTION, { of: function of() { + var length = arguments.length; + var A = new Array(length); + while (length--) A[length] = arguments[length]; + return new this(A); + } }); +}; + +},{"./_export":133}],196:[function(require,module,exports){ +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var isObject = require('./_is-object'); +var anObject = require('./_an-object'); +var check = function (O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; + +},{"./_an-object":107,"./_ctx":125,"./_is-object":151,"./_object-gopd":174}],197:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var dP = require('./_object-dp'); +var DESCRIPTORS = require('./_descriptors'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (KEY) { + var C = global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function () { return this; } + }); +}; + +},{"./_descriptors":129,"./_global":140,"./_object-dp":171,"./_wks":226}],198:[function(require,module,exports){ +arguments[4][75][0].apply(exports,arguments) +},{"./_has":141,"./_object-dp":171,"./_wks":226,"dup":75}],199:[function(require,module,exports){ +arguments[4][76][0].apply(exports,arguments) +},{"./_shared":200,"./_uid":221,"dup":76}],200:[function(require,module,exports){ +arguments[4][77][0].apply(exports,arguments) +},{"./_core":123,"./_global":140,"./_library":159,"dup":77}],201:[function(require,module,exports){ +arguments[4][78][0].apply(exports,arguments) +},{"./_a-function":103,"./_an-object":107,"./_wks":226,"dup":78}],202:[function(require,module,exports){ +'use strict'; +var fails = require('./_fails'); + +module.exports = function (method, arg) { + return !!method && fails(function () { + // eslint-disable-next-line no-useless-call + arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); + }); +}; + +},{"./_fails":135}],203:[function(require,module,exports){ +arguments[4][79][0].apply(exports,arguments) +},{"./_defined":128,"./_to-integer":213,"dup":79}],204:[function(require,module,exports){ +// helper for String#{startsWith, endsWith, includes} +var isRegExp = require('./_is-regexp'); +var defined = require('./_defined'); + +module.exports = function (that, searchString, NAME) { + if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(defined(that)); +}; + +},{"./_defined":128,"./_is-regexp":152}],205:[function(require,module,exports){ +var $export = require('./_export'); +var fails = require('./_fails'); +var defined = require('./_defined'); +var quot = /"/g; +// B.2.3.2.1 CreateHTML(string, tag, attribute, value) +var createHTML = function (string, tag, attribute, value) { + var S = String(defined(string)); + var p1 = '<' + tag; + if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; + return p1 + '>' + S + ''; +}; +module.exports = function (NAME, exec) { + var O = {}; + O[NAME] = exec(createHTML); + $export($export.P + $export.F * fails(function () { + var test = ''[NAME]('"'); + return test !== test.toLowerCase() || test.split('"').length > 3; + }), 'String', O); +}; + +},{"./_defined":128,"./_export":133,"./_fails":135}],206:[function(require,module,exports){ +// https://github.com/tc39/proposal-string-pad-start-end +var toLength = require('./_to-length'); +var repeat = require('./_string-repeat'); +var defined = require('./_defined'); + +module.exports = function (that, maxLength, fillString, left) { + var S = String(defined(that)); + var stringLength = S.length; + var fillStr = fillString === undefined ? ' ' : String(fillString); + var intMaxLength = toLength(maxLength); + if (intMaxLength <= stringLength || fillStr == '') return S; + var fillLen = intMaxLength - stringLength; + var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); + return left ? stringFiller + S : S + stringFiller; +}; + +},{"./_defined":128,"./_string-repeat":207,"./_to-length":215}],207:[function(require,module,exports){ +'use strict'; +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); + +module.exports = function repeat(count) { + var str = String(defined(this)); + var res = ''; + var n = toInteger(count); + if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); + for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; + return res; +}; + +},{"./_defined":128,"./_to-integer":213}],208:[function(require,module,exports){ +var $export = require('./_export'); +var defined = require('./_defined'); +var fails = require('./_fails'); +var spaces = require('./_string-ws'); +var space = '[' + spaces + ']'; +var non = '\u200b\u0085'; +var ltrim = RegExp('^' + space + space + '*'); +var rtrim = RegExp(space + space + '*$'); + +var exporter = function (KEY, exec, ALIAS) { + var exp = {}; + var FORCE = fails(function () { + return !!spaces[KEY]() || non[KEY]() != non; + }); + var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; + if (ALIAS) exp[ALIAS] = fn; + $export($export.P + $export.F * FORCE, 'String', exp); +}; + +// 1 -> String#trimLeft +// 2 -> String#trimRight +// 3 -> String#trim +var trim = exporter.trim = function (string, TYPE) { + string = String(defined(string)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; +}; + +module.exports = exporter; + +},{"./_defined":128,"./_export":133,"./_fails":135,"./_string-ws":209}],209:[function(require,module,exports){ +module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + +},{}],210:[function(require,module,exports){ +arguments[4][80][0].apply(exports,arguments) +},{"./_cof":118,"./_ctx":125,"./_dom-create":130,"./_global":140,"./_html":143,"./_invoke":146,"dup":80}],211:[function(require,module,exports){ +arguments[4][81][0].apply(exports,arguments) +},{"./_to-integer":213,"dup":81}],212:[function(require,module,exports){ +// https://tc39.github.io/ecma262/#sec-toindex +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +module.exports = function (it) { + if (it === undefined) return 0; + var number = toInteger(it); + var length = toLength(number); + if (number !== length) throw RangeError('Wrong length!'); + return length; +}; + +},{"./_to-integer":213,"./_to-length":215}],213:[function(require,module,exports){ +arguments[4][82][0].apply(exports,arguments) +},{"dup":82}],214:[function(require,module,exports){ +arguments[4][83][0].apply(exports,arguments) +},{"./_defined":128,"./_iobject":147,"dup":83}],215:[function(require,module,exports){ +arguments[4][84][0].apply(exports,arguments) +},{"./_to-integer":213,"dup":84}],216:[function(require,module,exports){ +arguments[4][85][0].apply(exports,arguments) +},{"./_defined":128,"dup":85}],217:[function(require,module,exports){ +arguments[4][86][0].apply(exports,arguments) +},{"./_is-object":151,"dup":86}],218:[function(require,module,exports){ +'use strict'; +if (require('./_descriptors')) { + var LIBRARY = require('./_library'); + var global = require('./_global'); + var fails = require('./_fails'); + var $export = require('./_export'); + var $typed = require('./_typed'); + var $buffer = require('./_typed-buffer'); + var ctx = require('./_ctx'); + var anInstance = require('./_an-instance'); + var propertyDesc = require('./_property-desc'); + var hide = require('./_hide'); + var redefineAll = require('./_redefine-all'); + var toInteger = require('./_to-integer'); + var toLength = require('./_to-length'); + var toIndex = require('./_to-index'); + var toAbsoluteIndex = require('./_to-absolute-index'); + var toPrimitive = require('./_to-primitive'); + var has = require('./_has'); + var classof = require('./_classof'); + var isObject = require('./_is-object'); + var toObject = require('./_to-object'); + var isArrayIter = require('./_is-array-iter'); + var create = require('./_object-create'); + var getPrototypeOf = require('./_object-gpo'); + var gOPN = require('./_object-gopn').f; + var getIterFn = require('./core.get-iterator-method'); + var uid = require('./_uid'); + var wks = require('./_wks'); + var createArrayMethod = require('./_array-methods'); + var createArrayIncludes = require('./_array-includes'); + var speciesConstructor = require('./_species-constructor'); + var ArrayIterators = require('./es6.array.iterator'); + var Iterators = require('./_iterators'); + var $iterDetect = require('./_iter-detect'); + var setSpecies = require('./_set-species'); + var arrayFill = require('./_array-fill'); + var arrayCopyWithin = require('./_array-copy-within'); + var $DP = require('./_object-dp'); + var $GOPD = require('./_object-gopd'); + var dP = $DP.f; + var gOPD = $GOPD.f; + var RangeError = global.RangeError; + var TypeError = global.TypeError; + var Uint8Array = global.Uint8Array; + var ARRAY_BUFFER = 'ArrayBuffer'; + var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; + var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; + var PROTOTYPE = 'prototype'; + var ArrayProto = Array[PROTOTYPE]; + var $ArrayBuffer = $buffer.ArrayBuffer; + var $DataView = $buffer.DataView; + var arrayForEach = createArrayMethod(0); + var arrayFilter = createArrayMethod(2); + var arraySome = createArrayMethod(3); + var arrayEvery = createArrayMethod(4); + var arrayFind = createArrayMethod(5); + var arrayFindIndex = createArrayMethod(6); + var arrayIncludes = createArrayIncludes(true); + var arrayIndexOf = createArrayIncludes(false); + var arrayValues = ArrayIterators.values; + var arrayKeys = ArrayIterators.keys; + var arrayEntries = ArrayIterators.entries; + var arrayLastIndexOf = ArrayProto.lastIndexOf; + var arrayReduce = ArrayProto.reduce; + var arrayReduceRight = ArrayProto.reduceRight; + var arrayJoin = ArrayProto.join; + var arraySort = ArrayProto.sort; + var arraySlice = ArrayProto.slice; + var arrayToString = ArrayProto.toString; + var arrayToLocaleString = ArrayProto.toLocaleString; + var ITERATOR = wks('iterator'); + var TAG = wks('toStringTag'); + var TYPED_CONSTRUCTOR = uid('typed_constructor'); + var DEF_CONSTRUCTOR = uid('def_constructor'); + var ALL_CONSTRUCTORS = $typed.CONSTR; + var TYPED_ARRAY = $typed.TYPED; + var VIEW = $typed.VIEW; + var WRONG_LENGTH = 'Wrong length!'; + + var $map = createArrayMethod(1, function (O, length) { + return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); + }); + + var LITTLE_ENDIAN = fails(function () { + // eslint-disable-next-line no-undef + return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; + }); + + var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { + new Uint8Array(1).set({}); + }); + + var toOffset = function (it, BYTES) { + var offset = toInteger(it); + if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); + return offset; + }; + + var validate = function (it) { + if (isObject(it) && TYPED_ARRAY in it) return it; + throw TypeError(it + ' is not a typed array!'); + }; + + var allocate = function (C, length) { + if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { + throw TypeError('It is not a typed array constructor!'); + } return new C(length); + }; + + var speciesFromList = function (O, list) { + return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); + }; + + var fromList = function (C, list) { + var index = 0; + var length = list.length; + var result = allocate(C, length); + while (length > index) result[index] = list[index++]; + return result; + }; + + var addGetter = function (it, key, internal) { + dP(it, key, { get: function () { return this._d[internal]; } }); + }; + + var $from = function from(source /* , mapfn, thisArg */) { + var O = toObject(source); + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var iterFn = getIterFn(O); + var i, length, values, result, step, iterator; + if (iterFn != undefined && !isArrayIter(iterFn)) { + for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { + values.push(step.value); + } O = values; + } + if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); + for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { + result[i] = mapping ? mapfn(O[i], i) : O[i]; + } + return result; + }; + + var $of = function of(/* ...items */) { + var index = 0; + var length = arguments.length; + var result = allocate(this, length); + while (length > index) result[index] = arguments[index++]; + return result; + }; + + // iOS Safari 6.x fails here + var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); + + var $toLocaleString = function toLocaleString() { + return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); + }; + + var proto = { + copyWithin: function copyWithin(target, start /* , end */) { + return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + }, + every: function every(callbackfn /* , thisArg */) { + return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars + return arrayFill.apply(validate(this), arguments); + }, + filter: function filter(callbackfn /* , thisArg */) { + return speciesFromList(this, arrayFilter(validate(this), callbackfn, + arguments.length > 1 ? arguments[1] : undefined)); + }, + find: function find(predicate /* , thisArg */) { + return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + findIndex: function findIndex(predicate /* , thisArg */) { + return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + forEach: function forEach(callbackfn /* , thisArg */) { + arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + indexOf: function indexOf(searchElement /* , fromIndex */) { + return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + includes: function includes(searchElement /* , fromIndex */) { + return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + join: function join(separator) { // eslint-disable-line no-unused-vars + return arrayJoin.apply(validate(this), arguments); + }, + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars + return arrayLastIndexOf.apply(validate(this), arguments); + }, + map: function map(mapfn /* , thisArg */) { + return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); + }, + reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduce.apply(validate(this), arguments); + }, + reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduceRight.apply(validate(this), arguments); + }, + reverse: function reverse() { + var that = this; + var length = validate(that).length; + var middle = Math.floor(length / 2); + var index = 0; + var value; + while (index < middle) { + value = that[index]; + that[index++] = that[--length]; + that[length] = value; + } return that; + }, + some: function some(callbackfn /* , thisArg */) { + return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + sort: function sort(comparefn) { + return arraySort.call(validate(this), comparefn); + }, + subarray: function subarray(begin, end) { + var O = validate(this); + var length = O.length; + var $begin = toAbsoluteIndex(begin, length); + return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( + O.buffer, + O.byteOffset + $begin * O.BYTES_PER_ELEMENT, + toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) + ); + } + }; + + var $slice = function slice(start, end) { + return speciesFromList(this, arraySlice.call(validate(this), start, end)); + }; + + var $set = function set(arrayLike /* , offset */) { + validate(this); + var offset = toOffset(arguments[1], 1); + var length = this.length; + var src = toObject(arrayLike); + var len = toLength(src.length); + var index = 0; + if (len + offset > length) throw RangeError(WRONG_LENGTH); + while (index < len) this[offset + index] = src[index++]; + }; + + var $iterators = { + entries: function entries() { + return arrayEntries.call(validate(this)); + }, + keys: function keys() { + return arrayKeys.call(validate(this)); + }, + values: function values() { + return arrayValues.call(validate(this)); + } + }; + + var isTAIndex = function (target, key) { + return isObject(target) + && target[TYPED_ARRAY] + && typeof key != 'symbol' + && key in target + && String(+key) == String(key); + }; + var $getDesc = function getOwnPropertyDescriptor(target, key) { + return isTAIndex(target, key = toPrimitive(key, true)) + ? propertyDesc(2, target[key]) + : gOPD(target, key); + }; + var $setDesc = function defineProperty(target, key, desc) { + if (isTAIndex(target, key = toPrimitive(key, true)) + && isObject(desc) + && has(desc, 'value') + && !has(desc, 'get') + && !has(desc, 'set') + // TODO: add validation descriptor w/o calling accessors + && !desc.configurable + && (!has(desc, 'writable') || desc.writable) + && (!has(desc, 'enumerable') || desc.enumerable) + ) { + target[key] = desc.value; + return target; + } return dP(target, key, desc); + }; + + if (!ALL_CONSTRUCTORS) { + $GOPD.f = $getDesc; + $DP.f = $setDesc; + } + + $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { + getOwnPropertyDescriptor: $getDesc, + defineProperty: $setDesc + }); + + if (fails(function () { arrayToString.call({}); })) { + arrayToString = arrayToLocaleString = function toString() { + return arrayJoin.call(this); + }; + } + + var $TypedArrayPrototype$ = redefineAll({}, proto); + redefineAll($TypedArrayPrototype$, $iterators); + hide($TypedArrayPrototype$, ITERATOR, $iterators.values); + redefineAll($TypedArrayPrototype$, { + slice: $slice, + set: $set, + constructor: function () { /* noop */ }, + toString: arrayToString, + toLocaleString: $toLocaleString + }); + addGetter($TypedArrayPrototype$, 'buffer', 'b'); + addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); + addGetter($TypedArrayPrototype$, 'byteLength', 'l'); + addGetter($TypedArrayPrototype$, 'length', 'e'); + dP($TypedArrayPrototype$, TAG, { + get: function () { return this[TYPED_ARRAY]; } + }); + + // eslint-disable-next-line max-statements + module.exports = function (KEY, BYTES, wrapper, CLAMPED) { + CLAMPED = !!CLAMPED; + var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; + var GETTER = 'get' + KEY; + var SETTER = 'set' + KEY; + var TypedArray = global[NAME]; + var Base = TypedArray || {}; + var TAC = TypedArray && getPrototypeOf(TypedArray); + var FORCED = !TypedArray || !$typed.ABV; + var O = {}; + var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; + var getter = function (that, index) { + var data = that._d; + return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); + }; + var setter = function (that, index, value) { + var data = that._d; + if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; + data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); + }; + var addElement = function (that, index) { + dP(that, index, { + get: function () { + return getter(this, index); + }, + set: function (value) { + return setter(this, index, value); + }, + enumerable: true + }); + }; + if (FORCED) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME, '_d'); + var index = 0; + var offset = 0; + var buffer, byteLength, length, klass; + if (!isObject(data)) { + length = toIndex(data); + byteLength = length * BYTES; + buffer = new $ArrayBuffer(byteLength); + } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + buffer = data; + offset = toOffset($offset, BYTES); + var $len = data.byteLength; + if ($length === undefined) { + if ($len % BYTES) throw RangeError(WRONG_LENGTH); + byteLength = $len - offset; + if (byteLength < 0) throw RangeError(WRONG_LENGTH); + } else { + byteLength = toLength($length) * BYTES; + if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); + } + length = byteLength / BYTES; + } else if (TYPED_ARRAY in data) { + return fromList(TypedArray, data); + } else { + return $from.call(TypedArray, data); + } + hide(that, '_d', { + b: buffer, + o: offset, + l: byteLength, + e: length, + v: new $DataView(buffer) + }); + while (index < length) addElement(that, index++); + }); + TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); + hide(TypedArrayPrototype, 'constructor', TypedArray); + } else if (!fails(function () { + TypedArray(1); + }) || !fails(function () { + new TypedArray(-1); // eslint-disable-line no-new + }) || !$iterDetect(function (iter) { + new TypedArray(); // eslint-disable-line no-new + new TypedArray(null); // eslint-disable-line no-new + new TypedArray(1.5); // eslint-disable-line no-new + new TypedArray(iter); // eslint-disable-line no-new + }, true)) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME); + var klass; + // `ws` module bug, temporarily remove validation length for Uint8Array + // https://github.com/websockets/ws/pull/645 + if (!isObject(data)) return new Base(toIndex(data)); + if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + return $length !== undefined + ? new Base(data, toOffset($offset, BYTES), $length) + : $offset !== undefined + ? new Base(data, toOffset($offset, BYTES)) + : new Base(data); + } + if (TYPED_ARRAY in data) return fromList(TypedArray, data); + return $from.call(TypedArray, data); + }); + arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { + if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); + }); + TypedArray[PROTOTYPE] = TypedArrayPrototype; + if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; + } + var $nativeIterator = TypedArrayPrototype[ITERATOR]; + var CORRECT_ITER_NAME = !!$nativeIterator + && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); + var $iterator = $iterators.values; + hide(TypedArray, TYPED_CONSTRUCTOR, true); + hide(TypedArrayPrototype, TYPED_ARRAY, NAME); + hide(TypedArrayPrototype, VIEW, true); + hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); + + if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { + dP(TypedArrayPrototype, TAG, { + get: function () { return NAME; } + }); + } + + O[NAME] = TypedArray; + + $export($export.G + $export.W + $export.F * (TypedArray != Base), O); + + $export($export.S, NAME, { + BYTES_PER_ELEMENT: BYTES + }); + + $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { + from: $from, + of: $of + }); + + if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); + + $export($export.P, NAME, proto); + + setSpecies(NAME); + + $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); + + $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); + + if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; + + $export($export.P + $export.F * fails(function () { + new TypedArray(1).slice(); + }), NAME, { slice: $slice }); + + $export($export.P + $export.F * (fails(function () { + return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); + }) || !fails(function () { + TypedArrayPrototype.toLocaleString.call([1, 2]); + })), NAME, { toLocaleString: $toLocaleString }); + + Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; + if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); + }; +} else module.exports = function () { /* empty */ }; + +},{"./_an-instance":106,"./_array-copy-within":108,"./_array-fill":109,"./_array-includes":111,"./_array-methods":112,"./_classof":117,"./_ctx":125,"./_descriptors":129,"./_export":133,"./_fails":135,"./_global":140,"./_has":141,"./_hide":142,"./_is-array-iter":148,"./_is-object":151,"./_iter-detect":156,"./_iterators":158,"./_library":159,"./_object-create":170,"./_object-dp":171,"./_object-gopd":174,"./_object-gopn":176,"./_object-gpo":178,"./_property-desc":189,"./_redefine-all":190,"./_set-species":197,"./_species-constructor":201,"./_to-absolute-index":211,"./_to-index":212,"./_to-integer":213,"./_to-length":215,"./_to-object":216,"./_to-primitive":217,"./_typed":220,"./_typed-buffer":219,"./_uid":221,"./_wks":226,"./core.get-iterator-method":227,"./es6.array.iterator":239}],219:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var DESCRIPTORS = require('./_descriptors'); +var LIBRARY = require('./_library'); +var $typed = require('./_typed'); +var hide = require('./_hide'); +var redefineAll = require('./_redefine-all'); +var fails = require('./_fails'); +var anInstance = require('./_an-instance'); +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +var toIndex = require('./_to-index'); +var gOPN = require('./_object-gopn').f; +var dP = require('./_object-dp').f; +var arrayFill = require('./_array-fill'); +var setToStringTag = require('./_set-to-string-tag'); +var ARRAY_BUFFER = 'ArrayBuffer'; +var DATA_VIEW = 'DataView'; +var PROTOTYPE = 'prototype'; +var WRONG_LENGTH = 'Wrong length!'; +var WRONG_INDEX = 'Wrong index!'; +var $ArrayBuffer = global[ARRAY_BUFFER]; +var $DataView = global[DATA_VIEW]; +var Math = global.Math; +var RangeError = global.RangeError; +// eslint-disable-next-line no-shadow-restricted-names +var Infinity = global.Infinity; +var BaseBuffer = $ArrayBuffer; +var abs = Math.abs; +var pow = Math.pow; +var floor = Math.floor; +var log = Math.log; +var LN2 = Math.LN2; +var BUFFER = 'buffer'; +var BYTE_LENGTH = 'byteLength'; +var BYTE_OFFSET = 'byteOffset'; +var $BUFFER = DESCRIPTORS ? '_b' : BUFFER; +var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH; +var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; + +// IEEE754 conversions based on https://github.com/feross/ieee754 +function packIEEE754(value, mLen, nBytes) { + var buffer = new Array(nBytes); + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; + var i = 0; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + var e, m, c; + value = abs(value); + // eslint-disable-next-line no-self-compare + if (value != value || value === Infinity) { + // eslint-disable-next-line no-self-compare + m = value != value ? 1 : 0; + e = eMax; + } else { + e = floor(log(value) / LN2); + if (value * (c = pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * pow(2, mLen); + e = e + eBias; + } else { + m = value * pow(2, eBias - 1) * pow(2, mLen); + e = 0; + } + } + for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); + e = e << mLen | m; + eLen += mLen; + for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); + buffer[--i] |= s * 128; + return buffer; +} +function unpackIEEE754(buffer, mLen, nBytes) { + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = eLen - 7; + var i = nBytes - 1; + var s = buffer[i--]; + var e = s & 127; + var m; + s >>= 7; + for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : s ? -Infinity : Infinity; + } else { + m = m + pow(2, mLen); + e = e - eBias; + } return (s ? -1 : 1) * m * pow(2, e - mLen); +} + +function unpackI32(bytes) { + return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; +} +function packI8(it) { + return [it & 0xff]; +} +function packI16(it) { + return [it & 0xff, it >> 8 & 0xff]; +} +function packI32(it) { + return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; +} +function packF64(it) { + return packIEEE754(it, 52, 8); +} +function packF32(it) { + return packIEEE754(it, 23, 4); +} + +function addGetter(C, key, internal) { + dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); +} + +function get(view, bytes, index, isLittleEndian) { + var numIndex = +index; + var intIndex = toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = store.slice(start, start + bytes); + return isLittleEndian ? pack : pack.reverse(); +} +function set(view, bytes, index, conversion, value, isLittleEndian) { + var numIndex = +index; + var intIndex = toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = conversion(+value); + for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; +} + +if (!$typed.ABV) { + $ArrayBuffer = function ArrayBuffer(length) { + anInstance(this, $ArrayBuffer, ARRAY_BUFFER); + var byteLength = toIndex(length); + this._b = arrayFill.call(new Array(byteLength), 0); + this[$LENGTH] = byteLength; + }; + + $DataView = function DataView(buffer, byteOffset, byteLength) { + anInstance(this, $DataView, DATA_VIEW); + anInstance(buffer, $ArrayBuffer, DATA_VIEW); + var bufferLength = buffer[$LENGTH]; + 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); + this[$BUFFER] = buffer; + this[$OFFSET] = offset; + this[$LENGTH] = byteLength; + }; + + if (DESCRIPTORS) { + addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); + addGetter($DataView, BUFFER, '_b'); + addGetter($DataView, BYTE_LENGTH, '_l'); + addGetter($DataView, BYTE_OFFSET, '_o'); + } + + 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[1]); + return (bytes[1] << 8 | bytes[0]) << 16 >> 16; + }, + getUint16: function getUint16(byteOffset /* , littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return bytes[1] << 8 | bytes[0]; + }, + getInt32: function getInt32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])); + }, + getUint32: function getUint32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; + }, + getFloat32: function getFloat32(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); + }, + getFloat64: function getFloat64(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); + }, + setInt8: function setInt8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setUint8: function setUint8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setInt16: function setInt16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setUint16: function setUint16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setInt32: function setInt32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setUint32: function setUint32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packF32, value, arguments[2]); + }, + setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { + set(this, 8, byteOffset, packF64, value, arguments[2]); + } + }); +} else { + if (!fails(function () { + $ArrayBuffer(1); + }) || !fails(function () { + new $ArrayBuffer(-1); // eslint-disable-line no-new + }) || fails(function () { + new $ArrayBuffer(); // eslint-disable-line no-new + new $ArrayBuffer(1.5); // eslint-disable-line no-new + new $ArrayBuffer(NaN); // eslint-disable-line no-new + return $ArrayBuffer.name != ARRAY_BUFFER; + })) { + $ArrayBuffer = function ArrayBuffer(length) { + anInstance(this, $ArrayBuffer); + return new BaseBuffer(toIndex(length)); + }; + var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; + for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { + if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]); + } + if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; + } + // iOS Safari 7.x bug + var view = new $DataView(new $ArrayBuffer(2)); + var $setInt8 = $DataView[PROTOTYPE].setInt8; + view.setInt8(0, 2147483648); + view.setInt8(1, 2147483649); + if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], { + setInt8: function setInt8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + }, + setUint8: function setUint8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + } + }, true); +} +setToStringTag($ArrayBuffer, ARRAY_BUFFER); +setToStringTag($DataView, DATA_VIEW); +hide($DataView[PROTOTYPE], $typed.VIEW, true); +exports[ARRAY_BUFFER] = $ArrayBuffer; +exports[DATA_VIEW] = $DataView; + +},{"./_an-instance":106,"./_array-fill":109,"./_descriptors":129,"./_fails":135,"./_global":140,"./_hide":142,"./_library":159,"./_object-dp":171,"./_object-gopn":176,"./_redefine-all":190,"./_set-to-string-tag":198,"./_to-index":212,"./_to-integer":213,"./_to-length":215,"./_typed":220}],220:[function(require,module,exports){ +var global = require('./_global'); +var hide = require('./_hide'); +var uid = require('./_uid'); +var TYPED = uid('typed_array'); +var VIEW = uid('view'); +var ABV = !!(global.ArrayBuffer && global.DataView); +var CONSTR = ABV; +var i = 0; +var l = 9; +var Typed; + +var TypedArrayConstructors = ( + 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' +).split(','); + +while (i < l) { + if (Typed = global[TypedArrayConstructors[i++]]) { + hide(Typed.prototype, TYPED, true); + hide(Typed.prototype, VIEW, true); + } else CONSTR = false; +} + +module.exports = { + ABV: ABV, + CONSTR: CONSTR, + TYPED: TYPED, + VIEW: VIEW +}; + +},{"./_global":140,"./_hide":142,"./_uid":221}],221:[function(require,module,exports){ +arguments[4][87][0].apply(exports,arguments) +},{"dup":87}],222:[function(require,module,exports){ +arguments[4][88][0].apply(exports,arguments) +},{"./_global":140,"dup":88}],223:[function(require,module,exports){ +var isObject = require('./_is-object'); +module.exports = function (it, TYPE) { + if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); + return it; +}; + +},{"./_is-object":151}],224:[function(require,module,exports){ +arguments[4][89][0].apply(exports,arguments) +},{"./_core":123,"./_global":140,"./_library":159,"./_object-dp":171,"./_wks-ext":225,"dup":89}],225:[function(require,module,exports){ +arguments[4][90][0].apply(exports,arguments) +},{"./_wks":226,"dup":90}],226:[function(require,module,exports){ +arguments[4][91][0].apply(exports,arguments) +},{"./_global":140,"./_shared":200,"./_uid":221,"dup":91}],227:[function(require,module,exports){ +arguments[4][92][0].apply(exports,arguments) +},{"./_classof":117,"./_core":123,"./_iterators":158,"./_wks":226,"dup":92}],228:[function(require,module,exports){ +// https://github.com/benjamingr/RexExp.escape +var $export = require('./_export'); +var $re = require('./_replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + +$export($export.S, 'RegExp', { escape: function escape(it) { return $re(it); } }); + +},{"./_export":133,"./_replacer":192}],229:[function(require,module,exports){ +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +var $export = require('./_export'); + +$export($export.P, 'Array', { copyWithin: require('./_array-copy-within') }); + +require('./_add-to-unscopables')('copyWithin'); + +},{"./_add-to-unscopables":105,"./_array-copy-within":108,"./_export":133}],230:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $every = require('./_array-methods')(4); + +$export($export.P + $export.F * !require('./_strict-method')([].every, true), 'Array', { + // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) + every: function every(callbackfn /* , thisArg */) { + return $every(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":112,"./_export":133,"./_strict-method":202}],231:[function(require,module,exports){ +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +var $export = require('./_export'); + +$export($export.P, 'Array', { fill: require('./_array-fill') }); + +require('./_add-to-unscopables')('fill'); + +},{"./_add-to-unscopables":105,"./_array-fill":109,"./_export":133}],232:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $filter = require('./_array-methods')(2); + +$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', { + // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":112,"./_export":133,"./_strict-method":202}],233:[function(require,module,exports){ +'use strict'; +// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) +var $export = require('./_export'); +var $find = require('./_array-methods')(6); +var KEY = 'findIndex'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + findIndex: function findIndex(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +require('./_add-to-unscopables')(KEY); + +},{"./_add-to-unscopables":105,"./_array-methods":112,"./_export":133}],234:[function(require,module,exports){ +'use strict'; +// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) +var $export = require('./_export'); +var $find = require('./_array-methods')(5); +var KEY = 'find'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +require('./_add-to-unscopables')(KEY); + +},{"./_add-to-unscopables":105,"./_array-methods":112,"./_export":133}],235:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $forEach = require('./_array-methods')(0); +var STRICT = require('./_strict-method')([].forEach, true); + +$export($export.P + $export.F * !STRICT, 'Array', { + // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) + forEach: function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":112,"./_export":133,"./_strict-method":202}],236:[function(require,module,exports){ +'use strict'; +var ctx = require('./_ctx'); +var $export = require('./_export'); +var toObject = require('./_to-object'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var toLength = require('./_to-length'); +var createProperty = require('./_create-property'); +var getIterFn = require('./core.get-iterator-method'); + +$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = getIterFn(O); + var length, result, step, iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); + +},{"./_create-property":124,"./_ctx":125,"./_export":133,"./_is-array-iter":148,"./_iter-call":153,"./_iter-detect":156,"./_to-length":215,"./_to-object":216,"./core.get-iterator-method":227}],237:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $indexOf = require('./_array-includes')(false); +var $native = [].indexOf; +var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; + +$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', { + // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + return NEGATIVE_ZERO + // convert -0 to +0 + ? $native.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments[1]); + } +}); + +},{"./_array-includes":111,"./_export":133,"./_strict-method":202}],238:[function(require,module,exports){ +// 22.1.2.2 / 15.4.3.2 Array.isArray(arg) +var $export = require('./_export'); + +$export($export.S, 'Array', { isArray: require('./_is-array') }); + +},{"./_export":133,"./_is-array":149}],239:[function(require,module,exports){ +arguments[4][93][0].apply(exports,arguments) +},{"./_add-to-unscopables":105,"./_iter-define":155,"./_iter-step":157,"./_iterators":158,"./_to-iobject":214,"dup":93}],240:[function(require,module,exports){ +'use strict'; +// 22.1.3.13 Array.prototype.join(separator) +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var arrayJoin = [].join; + +// fallback for not array-like strings +$export($export.P + $export.F * (require('./_iobject') != Object || !require('./_strict-method')(arrayJoin)), 'Array', { + join: function join(separator) { + return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); + } +}); + +},{"./_export":133,"./_iobject":147,"./_strict-method":202,"./_to-iobject":214}],241:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +var $native = [].lastIndexOf; +var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; + +$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', { + // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + // convert -0 to +0 + if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0; + var O = toIObject(this); + var length = toLength(O.length); + var index = length - 1; + if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1])); + if (index < 0) index = length + index; + for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; + return -1; + } +}); + +},{"./_export":133,"./_strict-method":202,"./_to-integer":213,"./_to-iobject":214,"./_to-length":215}],242:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $map = require('./_array-methods')(1); + +$export($export.P + $export.F * !require('./_strict-method')([].map, true), 'Array', { + // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":112,"./_export":133,"./_strict-method":202}],243:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var createProperty = require('./_create-property'); + +// WebKit Array.of isn't generic +$export($export.S + $export.F * require('./_fails')(function () { + function F() { /* empty */ } + return !(Array.of.call(F) instanceof F); +}), 'Array', { + // 22.1.2.3 Array.of( ...items) + of: function of(/* ...args */) { + var index = 0; + var aLen = arguments.length; + var result = new (typeof this == 'function' ? this : Array)(aLen); + while (aLen > index) createProperty(result, index, arguments[index++]); + result.length = aLen; + return result; + } +}); + +},{"./_create-property":124,"./_export":133,"./_fails":135}],244:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $reduce = require('./_array-reduce'); + +$export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', { + // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) + reduceRight: function reduceRight(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], true); + } +}); + +},{"./_array-reduce":113,"./_export":133,"./_strict-method":202}],245:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $reduce = require('./_array-reduce'); + +$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', { + // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) + reduce: function reduce(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], false); + } +}); + +},{"./_array-reduce":113,"./_export":133,"./_strict-method":202}],246:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var html = require('./_html'); +var cof = require('./_cof'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +var arraySlice = [].slice; + +// fallback for not array-like ES3 strings and DOM objects +$export($export.P + $export.F * require('./_fails')(function () { + if (html) arraySlice.call(html); +}), 'Array', { + slice: function slice(begin, end) { + var len = toLength(this.length); + var klass = cof(this); + end = end === undefined ? len : end; + if (klass == 'Array') return arraySlice.call(this, begin, end); + var start = toAbsoluteIndex(begin, len); + var upTo = toAbsoluteIndex(end, len); + var size = toLength(upTo - start); + var cloned = new Array(size); + var i = 0; + for (; i < size; i++) cloned[i] = klass == 'String' + ? this.charAt(start + i) + : this[start + i]; + return cloned; + } +}); + +},{"./_cof":118,"./_export":133,"./_fails":135,"./_html":143,"./_to-absolute-index":211,"./_to-length":215}],247:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $some = require('./_array-methods')(3); + +$export($export.P + $export.F * !require('./_strict-method')([].some, true), 'Array', { + // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":112,"./_export":133,"./_strict-method":202}],248:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var toObject = require('./_to-object'); +var fails = require('./_fails'); +var $sort = [].sort; +var test = [1, 2, 3]; + +$export($export.P + $export.F * (fails(function () { + // IE8- + test.sort(undefined); +}) || !fails(function () { + // V8 bug + test.sort(null); + // Old WebKit +}) || !require('./_strict-method')($sort)), 'Array', { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(toObject(this)) + : $sort.call(toObject(this), aFunction(comparefn)); + } +}); + +},{"./_a-function":103,"./_export":133,"./_fails":135,"./_strict-method":202,"./_to-object":216}],249:[function(require,module,exports){ +require('./_set-species')('Array'); + +},{"./_set-species":197}],250:[function(require,module,exports){ +// 20.3.3.1 / 15.9.4.4 Date.now() +var $export = require('./_export'); + +$export($export.S, 'Date', { now: function () { return new Date().getTime(); } }); + +},{"./_export":133}],251:[function(require,module,exports){ +// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() +var $export = require('./_export'); +var toISOString = require('./_date-to-iso-string'); + +// PhantomJS / old WebKit has a broken implementations +$export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', { + toISOString: toISOString +}); + +},{"./_date-to-iso-string":126,"./_export":133}],252:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); + +$export($export.P + $export.F * require('./_fails')(function () { + return new Date(NaN).toJSON() !== null + || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; +}), 'Date', { + // eslint-disable-next-line no-unused-vars + toJSON: function toJSON(key) { + var O = toObject(this); + var pv = toPrimitive(O); + return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); + } +}); + +},{"./_export":133,"./_fails":135,"./_to-object":216,"./_to-primitive":217}],253:[function(require,module,exports){ +var TO_PRIMITIVE = require('./_wks')('toPrimitive'); +var proto = Date.prototype; + +if (!(TO_PRIMITIVE in proto)) require('./_hide')(proto, TO_PRIMITIVE, require('./_date-to-primitive')); + +},{"./_date-to-primitive":127,"./_hide":142,"./_wks":226}],254:[function(require,module,exports){ +var DateProto = Date.prototype; +var INVALID_DATE = 'Invalid Date'; +var TO_STRING = 'toString'; +var $toString = DateProto[TO_STRING]; +var getTime = DateProto.getTime; +if (new Date(NaN) + '' != INVALID_DATE) { + require('./_redefine')(DateProto, TO_STRING, function toString() { + var value = getTime.call(this); + // eslint-disable-next-line no-self-compare + return value === value ? $toString.call(this) : INVALID_DATE; + }); +} + +},{"./_redefine":191}],255:[function(require,module,exports){ +// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) +var $export = require('./_export'); + +$export($export.P, 'Function', { bind: require('./_bind') }); + +},{"./_bind":116,"./_export":133}],256:[function(require,module,exports){ +'use strict'; +var isObject = require('./_is-object'); +var getPrototypeOf = require('./_object-gpo'); +var HAS_INSTANCE = require('./_wks')('hasInstance'); +var FunctionProto = Function.prototype; +// 19.2.3.6 Function.prototype[@@hasInstance](V) +if (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) { + if (typeof this != 'function' || !isObject(O)) return false; + if (!isObject(this.prototype)) return O instanceof this; + // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + while (O = getPrototypeOf(O)) if (this.prototype === O) return true; + return false; +} }); + +},{"./_is-object":151,"./_object-dp":171,"./_object-gpo":178,"./_wks":226}],257:[function(require,module,exports){ +var dP = require('./_object-dp').f; +var FProto = Function.prototype; +var nameRE = /^\s*function ([^ (]*)/; +var NAME = 'name'; + +// 19.2.4.2 name +NAME in FProto || require('./_descriptors') && dP(FProto, NAME, { + configurable: true, + get: function () { + try { + return ('' + this).match(nameRE)[1]; + } catch (e) { + return ''; + } + } +}); + +},{"./_descriptors":129,"./_object-dp":171}],258:[function(require,module,exports){ +'use strict'; +var strong = require('./_collection-strong'); +var validate = require('./_validate-collection'); +var MAP = 'Map'; + +// 23.1 Map Objects +module.exports = require('./_collection')(MAP, function (get) { + return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key) { + var entry = strong.getEntry(validate(this, MAP), key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value) { + return strong.def(validate(this, MAP), key === 0 ? 0 : key, value); + } +}, strong, true); + +},{"./_collection":122,"./_collection-strong":119,"./_validate-collection":223}],259:[function(require,module,exports){ +// 20.2.2.3 Math.acosh(x) +var $export = require('./_export'); +var log1p = require('./_math-log1p'); +var sqrt = Math.sqrt; +var $acosh = Math.acosh; + +$export($export.S + $export.F * !($acosh + // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 + && Math.floor($acosh(Number.MAX_VALUE)) == 710 + // Tor Browser bug: Math.acosh(Infinity) -> NaN + && $acosh(Infinity) == Infinity +), 'Math', { + acosh: function acosh(x) { + return (x = +x) < 1 ? NaN : x > 94906265.62425156 + ? Math.log(x) + Math.LN2 + : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); + } +}); + +},{"./_export":133,"./_math-log1p":162}],260:[function(require,module,exports){ +// 20.2.2.5 Math.asinh(x) +var $export = require('./_export'); +var $asinh = Math.asinh; + +function asinh(x) { + return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); +} + +// Tor Browser bug: Math.asinh(0) -> -0 +$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh }); + +},{"./_export":133}],261:[function(require,module,exports){ +// 20.2.2.7 Math.atanh(x) +var $export = require('./_export'); +var $atanh = Math.atanh; + +// Tor Browser bug: Math.atanh(-0) -> 0 +$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { + atanh: function atanh(x) { + return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; + } +}); + +},{"./_export":133}],262:[function(require,module,exports){ +// 20.2.2.9 Math.cbrt(x) +var $export = require('./_export'); +var sign = require('./_math-sign'); + +$export($export.S, 'Math', { + cbrt: function cbrt(x) { + return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); + } +}); + +},{"./_export":133,"./_math-sign":164}],263:[function(require,module,exports){ +// 20.2.2.11 Math.clz32(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + clz32: function clz32(x) { + return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; + } +}); + +},{"./_export":133}],264:[function(require,module,exports){ +// 20.2.2.12 Math.cosh(x) +var $export = require('./_export'); +var exp = Math.exp; + +$export($export.S, 'Math', { + cosh: function cosh(x) { + return (exp(x = +x) + exp(-x)) / 2; + } +}); + +},{"./_export":133}],265:[function(require,module,exports){ +// 20.2.2.14 Math.expm1(x) +var $export = require('./_export'); +var $expm1 = require('./_math-expm1'); + +$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 }); + +},{"./_export":133,"./_math-expm1":160}],266:[function(require,module,exports){ +// 20.2.2.16 Math.fround(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { fround: require('./_math-fround') }); + +},{"./_export":133,"./_math-fround":161}],267:[function(require,module,exports){ +// 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) +var $export = require('./_export'); +var abs = Math.abs; + +$export($export.S, 'Math', { + hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars + var sum = 0; + var i = 0; + var aLen = arguments.length; + var larg = 0; + var arg, div; + while (i < aLen) { + arg = abs(arguments[i++]); + if (larg < arg) { + div = larg / arg; + sum = sum * div * div + 1; + larg = arg; + } else if (arg > 0) { + div = arg / larg; + sum += div * div; + } else sum += arg; + } + return larg === Infinity ? Infinity : larg * Math.sqrt(sum); + } +}); + +},{"./_export":133}],268:[function(require,module,exports){ +// 20.2.2.18 Math.imul(x, y) +var $export = require('./_export'); +var $imul = Math.imul; + +// some WebKit versions fails with big numbers, some has wrong arity +$export($export.S + $export.F * require('./_fails')(function () { + return $imul(0xffffffff, 5) != -5 || $imul.length != 2; +}), 'Math', { + imul: function imul(x, y) { + var UINT16 = 0xffff; + var xn = +x; + var yn = +y; + var xl = UINT16 & xn; + var yl = UINT16 & yn; + return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); + } +}); + +},{"./_export":133,"./_fails":135}],269:[function(require,module,exports){ +// 20.2.2.21 Math.log10(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + log10: function log10(x) { + return Math.log(x) * Math.LOG10E; + } +}); + +},{"./_export":133}],270:[function(require,module,exports){ +// 20.2.2.20 Math.log1p(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { log1p: require('./_math-log1p') }); + +},{"./_export":133,"./_math-log1p":162}],271:[function(require,module,exports){ +// 20.2.2.22 Math.log2(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + log2: function log2(x) { + return Math.log(x) / Math.LN2; + } +}); + +},{"./_export":133}],272:[function(require,module,exports){ +// 20.2.2.28 Math.sign(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { sign: require('./_math-sign') }); + +},{"./_export":133,"./_math-sign":164}],273:[function(require,module,exports){ +// 20.2.2.30 Math.sinh(x) +var $export = require('./_export'); +var expm1 = require('./_math-expm1'); +var exp = Math.exp; + +// V8 near Chromium 38 has a problem with very small numbers +$export($export.S + $export.F * require('./_fails')(function () { + return !Math.sinh(-2e-17) != -2e-17; +}), 'Math', { + sinh: function sinh(x) { + return Math.abs(x = +x) < 1 + ? (expm1(x) - expm1(-x)) / 2 + : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); + } +}); + +},{"./_export":133,"./_fails":135,"./_math-expm1":160}],274:[function(require,module,exports){ +// 20.2.2.33 Math.tanh(x) +var $export = require('./_export'); +var expm1 = require('./_math-expm1'); +var exp = Math.exp; + +$export($export.S, 'Math', { + tanh: function tanh(x) { + var a = expm1(x = +x); + var b = expm1(-x); + return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); + } +}); + +},{"./_export":133,"./_math-expm1":160}],275:[function(require,module,exports){ +// 20.2.2.34 Math.trunc(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + trunc: function trunc(it) { + return (it > 0 ? Math.floor : Math.ceil)(it); + } +}); + +},{"./_export":133}],276:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var has = require('./_has'); +var cof = require('./_cof'); +var inheritIfRequired = require('./_inherit-if-required'); +var toPrimitive = require('./_to-primitive'); +var fails = require('./_fails'); +var gOPN = require('./_object-gopn').f; +var gOPD = require('./_object-gopd').f; +var dP = require('./_object-dp').f; +var $trim = require('./_string-trim').trim; +var NUMBER = 'Number'; +var $Number = global[NUMBER]; +var Base = $Number; +var proto = $Number.prototype; +// Opera ~12 has broken Object#toString +var BROKEN_COF = cof(require('./_object-create')(proto)) == NUMBER; +var TRIM = 'trim' in String.prototype; + +// 7.1.3 ToNumber(argument) +var toNumber = function (argument) { + var it = toPrimitive(argument, false); + if (typeof it == 'string' && it.length > 2) { + it = TRIM ? it.trim() : $trim(it, 3); + var first = it.charCodeAt(0); + var third, radix, maxCode; + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i + case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i + default: return +it; + } + for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { + code = digits.charCodeAt(i); + // parseInt parses a string to a first unavailable symbol + // but ToNumber should return NaN if a string contains unavailable symbols + if (code < 48 || code > maxCode) return NaN; + } return parseInt(digits, radix); + } + } return +it; +}; + +if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { + $Number = function Number(value) { + var it = arguments.length < 1 ? 0 : value; + var that = this; + return that instanceof $Number + // check on 1..constructor(foo) case + && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) + ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); + }; + for (var keys = require('./_descriptors') ? gOPN(Base) : ( + // ES3: + 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES6 (in case, if modules with ES6 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + ).split(','), j = 0, key; keys.length > j; j++) { + if (has(Base, key = keys[j]) && !has($Number, key)) { + dP($Number, key, gOPD(Base, key)); + } + } + $Number.prototype = proto; + proto.constructor = $Number; + require('./_redefine')(global, NUMBER, $Number); +} + +},{"./_cof":118,"./_descriptors":129,"./_fails":135,"./_global":140,"./_has":141,"./_inherit-if-required":145,"./_object-create":170,"./_object-dp":171,"./_object-gopd":174,"./_object-gopn":176,"./_redefine":191,"./_string-trim":208,"./_to-primitive":217}],277:[function(require,module,exports){ +// 20.1.2.1 Number.EPSILON +var $export = require('./_export'); + +$export($export.S, 'Number', { EPSILON: Math.pow(2, -52) }); + +},{"./_export":133}],278:[function(require,module,exports){ +// 20.1.2.2 Number.isFinite(number) +var $export = require('./_export'); +var _isFinite = require('./_global').isFinite; + +$export($export.S, 'Number', { + isFinite: function isFinite(it) { + return typeof it == 'number' && _isFinite(it); + } +}); + +},{"./_export":133,"./_global":140}],279:[function(require,module,exports){ +// 20.1.2.3 Number.isInteger(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { isInteger: require('./_is-integer') }); + +},{"./_export":133,"./_is-integer":150}],280:[function(require,module,exports){ +// 20.1.2.4 Number.isNaN(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { + isNaN: function isNaN(number) { + // eslint-disable-next-line no-self-compare + return number != number; + } +}); + +},{"./_export":133}],281:[function(require,module,exports){ +// 20.1.2.5 Number.isSafeInteger(number) +var $export = require('./_export'); +var isInteger = require('./_is-integer'); +var abs = Math.abs; + +$export($export.S, 'Number', { + isSafeInteger: function isSafeInteger(number) { + return isInteger(number) && abs(number) <= 0x1fffffffffffff; + } +}); + +},{"./_export":133,"./_is-integer":150}],282:[function(require,module,exports){ +// 20.1.2.6 Number.MAX_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); + +},{"./_export":133}],283:[function(require,module,exports){ +// 20.1.2.10 Number.MIN_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); + +},{"./_export":133}],284:[function(require,module,exports){ +var $export = require('./_export'); +var $parseFloat = require('./_parse-float'); +// 20.1.2.12 Number.parseFloat(string) +$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat }); + +},{"./_export":133,"./_parse-float":185}],285:[function(require,module,exports){ +var $export = require('./_export'); +var $parseInt = require('./_parse-int'); +// 20.1.2.13 Number.parseInt(string, radix) +$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt }); + +},{"./_export":133,"./_parse-int":186}],286:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toInteger = require('./_to-integer'); +var aNumberValue = require('./_a-number-value'); +var repeat = require('./_string-repeat'); +var $toFixed = 1.0.toFixed; +var floor = Math.floor; +var data = [0, 0, 0, 0, 0, 0]; +var ERROR = 'Number.toFixed: incorrect invocation!'; +var ZERO = '0'; + +var multiply = function (n, c) { + var i = -1; + var c2 = c; + while (++i < 6) { + c2 += n * data[i]; + data[i] = c2 % 1e7; + c2 = floor(c2 / 1e7); + } +}; +var divide = function (n) { + var i = 6; + var c = 0; + while (--i >= 0) { + c += data[i]; + data[i] = floor(c / n); + c = (c % n) * 1e7; + } +}; +var numToString = function () { + var i = 6; + var s = ''; + while (--i >= 0) { + if (s !== '' || i === 0 || data[i] !== 0) { + var t = String(data[i]); + s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; + } + } return s; +}; +var pow = function (x, n, acc) { + return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); +}; +var log = function (x) { + var n = 0; + var x2 = x; + while (x2 >= 4096) { + n += 12; + x2 /= 4096; + } + while (x2 >= 2) { + n += 1; + x2 /= 2; + } return n; +}; + +$export($export.P + $export.F * (!!$toFixed && ( + 0.00008.toFixed(3) !== '0.000' || + 0.9.toFixed(0) !== '1' || + 1.255.toFixed(2) !== '1.25' || + 1000000000000000128.0.toFixed(0) !== '1000000000000000128' +) || !require('./_fails')(function () { + // V8 ~ Android 4.3- + $toFixed.call({}); +})), 'Number', { + toFixed: function toFixed(fractionDigits) { + var x = aNumberValue(this, ERROR); + var f = toInteger(fractionDigits); + var s = ''; + var m = ZERO; + var e, z, j, k; + if (f < 0 || f > 20) throw RangeError(ERROR); + // eslint-disable-next-line no-self-compare + if (x != x) return 'NaN'; + if (x <= -1e21 || x >= 1e21) return String(x); + if (x < 0) { + s = '-'; + x = -x; + } + if (x > 1e-21) { + e = log(x * pow(2, 69, 1)) - 69; + z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); + z *= 0x10000000000000; + e = 52 - e; + if (e > 0) { + multiply(0, z); + j = f; + while (j >= 7) { + multiply(1e7, 0); + j -= 7; + } + multiply(pow(10, j, 1), 0); + j = e - 1; + while (j >= 23) { + divide(1 << 23); + j -= 23; + } + divide(1 << j); + multiply(1, 1); + divide(2); + m = numToString(); + } else { + multiply(0, z); + multiply(1 << -e, 0); + m = numToString() + repeat.call(ZERO, f); + } + } + if (f > 0) { + k = m.length; + m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); + } else { + m = s + m; + } return m; + } +}); + +},{"./_a-number-value":104,"./_export":133,"./_fails":135,"./_string-repeat":207,"./_to-integer":213}],287:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $fails = require('./_fails'); +var aNumberValue = require('./_a-number-value'); +var $toPrecision = 1.0.toPrecision; + +$export($export.P + $export.F * ($fails(function () { + // IE7- + return $toPrecision.call(1, undefined) !== '1'; +}) || !$fails(function () { + // V8 ~ Android 4.3- + $toPrecision.call({}); +})), 'Number', { + toPrecision: function toPrecision(precision) { + var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); + return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); + } +}); + +},{"./_a-number-value":104,"./_export":133,"./_fails":135}],288:[function(require,module,exports){ +// 19.1.3.1 Object.assign(target, source) +var $export = require('./_export'); + +$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') }); + +},{"./_export":133,"./_object-assign":169}],289:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +$export($export.S, 'Object', { create: require('./_object-create') }); + +},{"./_export":133,"./_object-create":170}],290:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') }); + +},{"./_descriptors":129,"./_export":133,"./_object-dps":172}],291:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f }); + +},{"./_descriptors":129,"./_export":133,"./_object-dp":171}],292:[function(require,module,exports){ +// 19.1.2.5 Object.freeze(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('freeze', function ($freeze) { + return function freeze(it) { + return $freeze && isObject(it) ? $freeze(meta(it)) : it; + }; +}); + +},{"./_is-object":151,"./_meta":165,"./_object-sap":182}],293:[function(require,module,exports){ +// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) +var toIObject = require('./_to-iobject'); +var $getOwnPropertyDescriptor = require('./_object-gopd').f; + +require('./_object-sap')('getOwnPropertyDescriptor', function () { + return function getOwnPropertyDescriptor(it, key) { + return $getOwnPropertyDescriptor(toIObject(it), key); + }; +}); + +},{"./_object-gopd":174,"./_object-sap":182,"./_to-iobject":214}],294:[function(require,module,exports){ +// 19.1.2.7 Object.getOwnPropertyNames(O) +require('./_object-sap')('getOwnPropertyNames', function () { + return require('./_object-gopn-ext').f; +}); + +},{"./_object-gopn-ext":175,"./_object-sap":182}],295:[function(require,module,exports){ +// 19.1.2.9 Object.getPrototypeOf(O) +var toObject = require('./_to-object'); +var $getPrototypeOf = require('./_object-gpo'); + +require('./_object-sap')('getPrototypeOf', function () { + return function getPrototypeOf(it) { + return $getPrototypeOf(toObject(it)); + }; +}); + +},{"./_object-gpo":178,"./_object-sap":182,"./_to-object":216}],296:[function(require,module,exports){ +// 19.1.2.11 Object.isExtensible(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isExtensible', function ($isExtensible) { + return function isExtensible(it) { + return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; + }; +}); + +},{"./_is-object":151,"./_object-sap":182}],297:[function(require,module,exports){ +// 19.1.2.12 Object.isFrozen(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isFrozen', function ($isFrozen) { + return function isFrozen(it) { + return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + }; +}); + +},{"./_is-object":151,"./_object-sap":182}],298:[function(require,module,exports){ +// 19.1.2.13 Object.isSealed(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isSealed', function ($isSealed) { + return function isSealed(it) { + return isObject(it) ? $isSealed ? $isSealed(it) : false : true; + }; +}); + +},{"./_is-object":151,"./_object-sap":182}],299:[function(require,module,exports){ +// 19.1.3.10 Object.is(value1, value2) +var $export = require('./_export'); +$export($export.S, 'Object', { is: require('./_same-value') }); + +},{"./_export":133,"./_same-value":193}],300:[function(require,module,exports){ +// 19.1.2.14 Object.keys(O) +var toObject = require('./_to-object'); +var $keys = require('./_object-keys'); + +require('./_object-sap')('keys', function () { + return function keys(it) { + return $keys(toObject(it)); + }; +}); + +},{"./_object-keys":180,"./_object-sap":182,"./_to-object":216}],301:[function(require,module,exports){ +// 19.1.2.15 Object.preventExtensions(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('preventExtensions', function ($preventExtensions) { + return function preventExtensions(it) { + return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; + }; +}); + +},{"./_is-object":151,"./_meta":165,"./_object-sap":182}],302:[function(require,module,exports){ +// 19.1.2.17 Object.seal(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('seal', function ($seal) { + return function seal(it) { + return $seal && isObject(it) ? $seal(meta(it)) : it; + }; +}); + +},{"./_is-object":151,"./_meta":165,"./_object-sap":182}],303:[function(require,module,exports){ +// 19.1.3.19 Object.setPrototypeOf(O, proto) +var $export = require('./_export'); +$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set }); + +},{"./_export":133,"./_set-proto":196}],304:[function(require,module,exports){ +'use strict'; +// 19.1.3.6 Object.prototype.toString() +var classof = require('./_classof'); +var test = {}; +test[require('./_wks')('toStringTag')] = 'z'; +if (test + '' != '[object z]') { + require('./_redefine')(Object.prototype, 'toString', function toString() { + return '[object ' + classof(this) + ']'; + }, true); +} + +},{"./_classof":117,"./_redefine":191,"./_wks":226}],305:[function(require,module,exports){ +var $export = require('./_export'); +var $parseFloat = require('./_parse-float'); +// 18.2.4 parseFloat(string) +$export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat }); + +},{"./_export":133,"./_parse-float":185}],306:[function(require,module,exports){ +var $export = require('./_export'); +var $parseInt = require('./_parse-int'); +// 18.2.5 parseInt(string, radix) +$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); + +},{"./_export":133,"./_parse-int":186}],307:[function(require,module,exports){ +arguments[4][95][0].apply(exports,arguments) +},{"./_a-function":103,"./_an-instance":106,"./_classof":117,"./_core":123,"./_ctx":125,"./_export":133,"./_for-of":139,"./_global":140,"./_is-object":151,"./_iter-detect":156,"./_library":159,"./_microtask":167,"./_new-promise-capability":168,"./_perform":187,"./_promise-resolve":188,"./_redefine-all":190,"./_set-species":197,"./_set-to-string-tag":198,"./_species-constructor":201,"./_task":210,"./_user-agent":222,"./_wks":226,"dup":95}],308:[function(require,module,exports){ +// 26.1.1 Reflect.apply(target, thisArgument, argumentsList) +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var rApply = (require('./_global').Reflect || {}).apply; +var fApply = Function.apply; +// MS Edge argumentsList argument is optional +$export($export.S + $export.F * !require('./_fails')(function () { + rApply(function () { /* empty */ }); +}), 'Reflect', { + apply: function apply(target, thisArgument, argumentsList) { + var T = aFunction(target); + var L = anObject(argumentsList); + return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); + } +}); + +},{"./_a-function":103,"./_an-object":107,"./_export":133,"./_fails":135,"./_global":140}],309:[function(require,module,exports){ +// 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) +var $export = require('./_export'); +var create = require('./_object-create'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var bind = require('./_bind'); +var rConstruct = (require('./_global').Reflect || {}).construct; + +// MS Edge supports only 2 arguments and argumentsList argument is optional +// FF Nightly sets third argument as `new.target`, but does not create `this` from it +var NEW_TARGET_BUG = fails(function () { + function F() { /* empty */ } + return !(rConstruct(function () { /* empty */ }, [], F) instanceof F); +}); +var ARGS_BUG = !fails(function () { + rConstruct(function () { /* empty */ }); +}); + +$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { + construct: function construct(Target, args /* , newTarget */) { + aFunction(Target); + anObject(args); + var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); + if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget); + if (Target == newTarget) { + // w/o altered newTarget, optimization for 0-4 arguments + switch (args.length) { + case 0: return new Target(); + case 1: return new Target(args[0]); + case 2: return new Target(args[0], args[1]); + case 3: return new Target(args[0], args[1], args[2]); + case 4: return new Target(args[0], args[1], args[2], args[3]); + } + // w/o altered newTarget, lot of arguments case + var $args = [null]; + $args.push.apply($args, args); + return new (bind.apply(Target, $args))(); + } + // with altered newTarget, not support built-in constructors + var proto = newTarget.prototype; + var instance = create(isObject(proto) ? proto : Object.prototype); + var result = Function.apply.call(Target, instance, args); + return isObject(result) ? result : instance; + } +}); + +},{"./_a-function":103,"./_an-object":107,"./_bind":116,"./_export":133,"./_fails":135,"./_global":140,"./_is-object":151,"./_object-create":170}],310:[function(require,module,exports){ +// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) +var dP = require('./_object-dp'); +var $export = require('./_export'); +var anObject = require('./_an-object'); +var toPrimitive = require('./_to-primitive'); + +// MS Edge has broken Reflect.defineProperty - throwing instead of returning false +$export($export.S + $export.F * require('./_fails')(function () { + // eslint-disable-next-line no-undef + Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); +}), 'Reflect', { + defineProperty: function defineProperty(target, propertyKey, attributes) { + anObject(target); + propertyKey = toPrimitive(propertyKey, true); + anObject(attributes); + try { + dP.f(target, propertyKey, attributes); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_an-object":107,"./_export":133,"./_fails":135,"./_object-dp":171,"./_to-primitive":217}],311:[function(require,module,exports){ +// 26.1.4 Reflect.deleteProperty(target, propertyKey) +var $export = require('./_export'); +var gOPD = require('./_object-gopd').f; +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + deleteProperty: function deleteProperty(target, propertyKey) { + var desc = gOPD(anObject(target), propertyKey); + return desc && !desc.configurable ? false : delete target[propertyKey]; + } +}); + +},{"./_an-object":107,"./_export":133,"./_object-gopd":174}],312:[function(require,module,exports){ +'use strict'; +// 26.1.5 Reflect.enumerate(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var Enumerate = function (iterated) { + this._t = anObject(iterated); // target + this._i = 0; // next index + var keys = this._k = []; // keys + var key; + for (key in iterated) keys.push(key); +}; +require('./_iter-create')(Enumerate, 'Object', function () { + var that = this; + var keys = that._k; + var key; + do { + if (that._i >= keys.length) return { value: undefined, done: true }; + } while (!((key = keys[that._i++]) in that._t)); + return { value: key, done: false }; +}); + +$export($export.S, 'Reflect', { + enumerate: function enumerate(target) { + return new Enumerate(target); + } +}); + +},{"./_an-object":107,"./_export":133,"./_iter-create":154}],313:[function(require,module,exports){ +// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) +var gOPD = require('./_object-gopd'); +var $export = require('./_export'); +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { + return gOPD.f(anObject(target), propertyKey); + } +}); + +},{"./_an-object":107,"./_export":133,"./_object-gopd":174}],314:[function(require,module,exports){ +// 26.1.8 Reflect.getPrototypeOf(target) +var $export = require('./_export'); +var getProto = require('./_object-gpo'); +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + getPrototypeOf: function getPrototypeOf(target) { + return getProto(anObject(target)); + } +}); + +},{"./_an-object":107,"./_export":133,"./_object-gpo":178}],315:[function(require,module,exports){ +// 26.1.6 Reflect.get(target, propertyKey [, receiver]) +var gOPD = require('./_object-gopd'); +var getPrototypeOf = require('./_object-gpo'); +var has = require('./_has'); +var $export = require('./_export'); +var isObject = require('./_is-object'); +var anObject = require('./_an-object'); + +function get(target, propertyKey /* , receiver */) { + var receiver = arguments.length < 3 ? target : arguments[2]; + var desc, proto; + if (anObject(target) === receiver) return target[propertyKey]; + if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') + ? desc.value + : desc.get !== undefined + ? desc.get.call(receiver) + : undefined; + if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver); +} + +$export($export.S, 'Reflect', { get: get }); + +},{"./_an-object":107,"./_export":133,"./_has":141,"./_is-object":151,"./_object-gopd":174,"./_object-gpo":178}],316:[function(require,module,exports){ +// 26.1.9 Reflect.has(target, propertyKey) +var $export = require('./_export'); + +$export($export.S, 'Reflect', { + has: function has(target, propertyKey) { + return propertyKey in target; + } +}); + +},{"./_export":133}],317:[function(require,module,exports){ +// 26.1.10 Reflect.isExtensible(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var $isExtensible = Object.isExtensible; + +$export($export.S, 'Reflect', { + isExtensible: function isExtensible(target) { + anObject(target); + return $isExtensible ? $isExtensible(target) : true; + } +}); + +},{"./_an-object":107,"./_export":133}],318:[function(require,module,exports){ +// 26.1.11 Reflect.ownKeys(target) +var $export = require('./_export'); + +$export($export.S, 'Reflect', { ownKeys: require('./_own-keys') }); + +},{"./_export":133,"./_own-keys":184}],319:[function(require,module,exports){ +// 26.1.12 Reflect.preventExtensions(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var $preventExtensions = Object.preventExtensions; + +$export($export.S, 'Reflect', { + preventExtensions: function preventExtensions(target) { + anObject(target); + try { + if ($preventExtensions) $preventExtensions(target); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_an-object":107,"./_export":133}],320:[function(require,module,exports){ +// 26.1.14 Reflect.setPrototypeOf(target, proto) +var $export = require('./_export'); +var setProto = require('./_set-proto'); + +if (setProto) $export($export.S, 'Reflect', { + setPrototypeOf: function setPrototypeOf(target, proto) { + setProto.check(target, proto); + try { + setProto.set(target, proto); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_export":133,"./_set-proto":196}],321:[function(require,module,exports){ +// 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) +var dP = require('./_object-dp'); +var gOPD = require('./_object-gopd'); +var getPrototypeOf = require('./_object-gpo'); +var has = require('./_has'); +var $export = require('./_export'); +var createDesc = require('./_property-desc'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); + +function set(target, propertyKey, V /* , receiver */) { + var receiver = arguments.length < 4 ? target : arguments[3]; + var ownDesc = gOPD.f(anObject(target), propertyKey); + var existingDescriptor, proto; + if (!ownDesc) { + if (isObject(proto = getPrototypeOf(target))) { + return set(proto, propertyKey, V, receiver); + } + ownDesc = createDesc(0); + } + if (has(ownDesc, 'value')) { + if (ownDesc.writable === false || !isObject(receiver)) return false; + if (existingDescriptor = gOPD.f(receiver, propertyKey)) { + if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false; + existingDescriptor.value = V; + dP.f(receiver, propertyKey, existingDescriptor); + } else dP.f(receiver, propertyKey, createDesc(0, V)); + return true; + } + return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); +} + +$export($export.S, 'Reflect', { set: set }); + +},{"./_an-object":107,"./_export":133,"./_has":141,"./_is-object":151,"./_object-dp":171,"./_object-gopd":174,"./_object-gpo":178,"./_property-desc":189}],322:[function(require,module,exports){ +var global = require('./_global'); +var inheritIfRequired = require('./_inherit-if-required'); +var dP = require('./_object-dp').f; +var gOPN = require('./_object-gopn').f; +var isRegExp = require('./_is-regexp'); +var $flags = require('./_flags'); +var $RegExp = global.RegExp; +var Base = $RegExp; +var proto = $RegExp.prototype; +var re1 = /a/g; +var re2 = /a/g; +// "new" creates a new object, old webkit buggy here +var CORRECT_NEW = new $RegExp(re1) !== re1; + +if (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () { + re2[require('./_wks')('match')] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; +}))) { + $RegExp = function RegExp(p, f) { + var tiRE = this instanceof $RegExp; + var piRE = isRegExp(p); + var fiU = f === undefined; + return !tiRE && piRE && p.constructor === $RegExp && fiU ? p + : inheritIfRequired(CORRECT_NEW + ? new Base(piRE && !fiU ? p.source : p, f) + : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) + , tiRE ? this : proto, $RegExp); + }; + var proxy = function (key) { + key in $RegExp || dP($RegExp, key, { + configurable: true, + get: function () { return Base[key]; }, + set: function (it) { Base[key] = it; } + }); + }; + for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]); + proto.constructor = $RegExp; + $RegExp.prototype = proto; + require('./_redefine')(global, 'RegExp', $RegExp); +} + +require('./_set-species')('RegExp'); + +},{"./_descriptors":129,"./_fails":135,"./_flags":137,"./_global":140,"./_inherit-if-required":145,"./_is-regexp":152,"./_object-dp":171,"./_object-gopn":176,"./_redefine":191,"./_set-species":197,"./_wks":226}],323:[function(require,module,exports){ +// 21.2.5.3 get RegExp.prototype.flags() +if (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', { + configurable: true, + get: require('./_flags') +}); + +},{"./_descriptors":129,"./_flags":137,"./_object-dp":171}],324:[function(require,module,exports){ +// @@match logic +require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) { + // 21.1.3.11 String.prototype.match(regexp) + return [function match(regexp) { + 'use strict'; + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, $match]; +}); + +},{"./_fix-re-wks":136}],325:[function(require,module,exports){ +// @@replace logic +require('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace) { + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [function replace(searchValue, replaceValue) { + 'use strict'; + var O = defined(this); + var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, $replace]; +}); + +},{"./_fix-re-wks":136}],326:[function(require,module,exports){ +// @@search logic +require('./_fix-re-wks')('search', 1, function (defined, SEARCH, $search) { + // 21.1.3.15 String.prototype.search(regexp) + return [function search(regexp) { + 'use strict'; + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, $search]; +}); + +},{"./_fix-re-wks":136}],327:[function(require,module,exports){ +// @@split logic +require('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split) { + 'use strict'; + var isRegExp = require('./_is-regexp'); + var _split = $split; + var $push = [].push; + var $SPLIT = 'split'; + var LENGTH = 'length'; + var LAST_INDEX = 'lastIndex'; + if ( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ) { + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function (separator, limit) { + var string = String(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!isRegExp(separator)) return _split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + while (match = separatorCopy.exec(string)) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + // eslint-disable-next-line no-loop-func + if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { + for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; + }); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + $split = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); + }; + } + // 21.1.3.17 String.prototype.split(separator, limit) + return [function split(separator, limit) { + var O = defined(this); + var fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); + }, $split]; +}); + +},{"./_fix-re-wks":136,"./_is-regexp":152}],328:[function(require,module,exports){ +'use strict'; +require('./es6.regexp.flags'); +var anObject = require('./_an-object'); +var $flags = require('./_flags'); +var DESCRIPTORS = require('./_descriptors'); +var TO_STRING = 'toString'; +var $toString = /./[TO_STRING]; + +var define = function (fn) { + require('./_redefine')(RegExp.prototype, TO_STRING, fn, true); +}; + +// 21.2.5.14 RegExp.prototype.toString() +if (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { + define(function toString() { + var R = anObject(this); + return '/'.concat(R.source, '/', + 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); + }); +// FF44- RegExp#toString has a wrong name +} else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); +} + +},{"./_an-object":107,"./_descriptors":129,"./_fails":135,"./_flags":137,"./_redefine":191,"./es6.regexp.flags":323}],329:[function(require,module,exports){ +'use strict'; +var strong = require('./_collection-strong'); +var validate = require('./_validate-collection'); +var SET = 'Set'; + +// 23.2 Set Objects +module.exports = require('./_collection')(SET, function (get) { + return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value) { + return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value); + } +}, strong); + +},{"./_collection":122,"./_collection-strong":119,"./_validate-collection":223}],330:[function(require,module,exports){ +'use strict'; +// B.2.3.2 String.prototype.anchor(name) +require('./_string-html')('anchor', function (createHTML) { + return function anchor(name) { + return createHTML(this, 'a', 'name', name); + }; +}); + +},{"./_string-html":205}],331:[function(require,module,exports){ +'use strict'; +// B.2.3.3 String.prototype.big() +require('./_string-html')('big', function (createHTML) { + return function big() { + return createHTML(this, 'big', '', ''); + }; +}); + +},{"./_string-html":205}],332:[function(require,module,exports){ +'use strict'; +// B.2.3.4 String.prototype.blink() +require('./_string-html')('blink', function (createHTML) { + return function blink() { + return createHTML(this, 'blink', '', ''); + }; +}); + +},{"./_string-html":205}],333:[function(require,module,exports){ +'use strict'; +// B.2.3.5 String.prototype.bold() +require('./_string-html')('bold', function (createHTML) { + return function bold() { + return createHTML(this, 'b', '', ''); + }; +}); + +},{"./_string-html":205}],334:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $at = require('./_string-at')(false); +$export($export.P, 'String', { + // 21.1.3.3 String.prototype.codePointAt(pos) + codePointAt: function codePointAt(pos) { + return $at(this, pos); + } +}); + +},{"./_export":133,"./_string-at":203}],335:[function(require,module,exports){ +// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) +'use strict'; +var $export = require('./_export'); +var toLength = require('./_to-length'); +var context = require('./_string-context'); +var ENDS_WITH = 'endsWith'; +var $endsWith = ''[ENDS_WITH]; + +$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', { + endsWith: function endsWith(searchString /* , endPosition = @length */) { + var that = context(this, searchString, ENDS_WITH); + var endPosition = arguments.length > 1 ? arguments[1] : undefined; + var len = toLength(that.length); + var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); + var search = String(searchString); + return $endsWith + ? $endsWith.call(that, search, end) + : that.slice(end - search.length, end) === search; + } +}); + +},{"./_export":133,"./_fails-is-regexp":134,"./_string-context":204,"./_to-length":215}],336:[function(require,module,exports){ +'use strict'; +// B.2.3.6 String.prototype.fixed() +require('./_string-html')('fixed', function (createHTML) { + return function fixed() { + return createHTML(this, 'tt', '', ''); + }; +}); + +},{"./_string-html":205}],337:[function(require,module,exports){ +'use strict'; +// B.2.3.7 String.prototype.fontcolor(color) +require('./_string-html')('fontcolor', function (createHTML) { + return function fontcolor(color) { + return createHTML(this, 'font', 'color', color); + }; +}); + +},{"./_string-html":205}],338:[function(require,module,exports){ +'use strict'; +// B.2.3.8 String.prototype.fontsize(size) +require('./_string-html')('fontsize', function (createHTML) { + return function fontsize(size) { + return createHTML(this, 'font', 'size', size); + }; +}); + +},{"./_string-html":205}],339:[function(require,module,exports){ +var $export = require('./_export'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var fromCharCode = String.fromCharCode; +var $fromCodePoint = String.fromCodePoint; + +// length should be 1, old FF problem +$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars + var res = []; + var aLen = arguments.length; + var i = 0; + var code; + while (aLen > i) { + code = +arguments[i++]; + if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); + res.push(code < 0x10000 + ? fromCharCode(code) + : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) + ); + } return res.join(''); + } +}); + +},{"./_export":133,"./_to-absolute-index":211}],340:[function(require,module,exports){ +// 21.1.3.7 String.prototype.includes(searchString, position = 0) +'use strict'; +var $export = require('./_export'); +var context = require('./_string-context'); +var INCLUDES = 'includes'; + +$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', { + includes: function includes(searchString /* , position = 0 */) { + return !!~context(this, searchString, INCLUDES) + .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +},{"./_export":133,"./_fails-is-regexp":134,"./_string-context":204}],341:[function(require,module,exports){ +'use strict'; +// B.2.3.9 String.prototype.italics() +require('./_string-html')('italics', function (createHTML) { + return function italics() { + return createHTML(this, 'i', '', ''); + }; +}); + +},{"./_string-html":205}],342:[function(require,module,exports){ +arguments[4][96][0].apply(exports,arguments) +},{"./_iter-define":155,"./_string-at":203,"dup":96}],343:[function(require,module,exports){ +'use strict'; +// B.2.3.10 String.prototype.link(url) +require('./_string-html')('link', function (createHTML) { + return function link(url) { + return createHTML(this, 'a', 'href', url); + }; +}); + +},{"./_string-html":205}],344:[function(require,module,exports){ +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); + +$export($export.S, 'String', { + // 21.1.2.4 String.raw(callSite, ...substitutions) + raw: function raw(callSite) { + var tpl = toIObject(callSite.raw); + var len = toLength(tpl.length); + var aLen = arguments.length; + var res = []; + var i = 0; + while (len > i) { + res.push(String(tpl[i++])); + if (i < aLen) res.push(String(arguments[i])); + } return res.join(''); + } +}); + +},{"./_export":133,"./_to-iobject":214,"./_to-length":215}],345:[function(require,module,exports){ +var $export = require('./_export'); + +$export($export.P, 'String', { + // 21.1.3.13 String.prototype.repeat(count) + repeat: require('./_string-repeat') +}); + +},{"./_export":133,"./_string-repeat":207}],346:[function(require,module,exports){ +'use strict'; +// B.2.3.11 String.prototype.small() +require('./_string-html')('small', function (createHTML) { + return function small() { + return createHTML(this, 'small', '', ''); + }; +}); + +},{"./_string-html":205}],347:[function(require,module,exports){ +// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) +'use strict'; +var $export = require('./_export'); +var toLength = require('./_to-length'); +var context = require('./_string-context'); +var STARTS_WITH = 'startsWith'; +var $startsWith = ''[STARTS_WITH]; + +$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', { + startsWith: function startsWith(searchString /* , position = 0 */) { + var that = context(this, searchString, STARTS_WITH); + var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var search = String(searchString); + return $startsWith + ? $startsWith.call(that, search, index) + : that.slice(index, index + search.length) === search; + } +}); + +},{"./_export":133,"./_fails-is-regexp":134,"./_string-context":204,"./_to-length":215}],348:[function(require,module,exports){ +'use strict'; +// B.2.3.12 String.prototype.strike() +require('./_string-html')('strike', function (createHTML) { + return function strike() { + return createHTML(this, 'strike', '', ''); + }; +}); + +},{"./_string-html":205}],349:[function(require,module,exports){ +'use strict'; +// B.2.3.13 String.prototype.sub() +require('./_string-html')('sub', function (createHTML) { + return function sub() { + return createHTML(this, 'sub', '', ''); + }; +}); + +},{"./_string-html":205}],350:[function(require,module,exports){ +'use strict'; +// B.2.3.14 String.prototype.sup() +require('./_string-html')('sup', function (createHTML) { + return function sup() { + return createHTML(this, 'sup', '', ''); + }; +}); + +},{"./_string-html":205}],351:[function(require,module,exports){ +'use strict'; +// 21.1.3.25 String.prototype.trim() +require('./_string-trim')('trim', function ($trim) { + return function trim() { + return $trim(this, 3); + }; +}); + +},{"./_string-trim":208}],352:[function(require,module,exports){ +arguments[4][97][0].apply(exports,arguments) +},{"./_an-object":107,"./_descriptors":129,"./_enum-keys":132,"./_export":133,"./_fails":135,"./_global":140,"./_has":141,"./_hide":142,"./_is-array":149,"./_is-object":151,"./_library":159,"./_meta":165,"./_object-create":170,"./_object-dp":171,"./_object-gopd":174,"./_object-gopn":176,"./_object-gopn-ext":175,"./_object-gops":177,"./_object-keys":180,"./_object-pie":181,"./_property-desc":189,"./_redefine":191,"./_set-to-string-tag":198,"./_shared":200,"./_to-iobject":214,"./_to-primitive":217,"./_uid":221,"./_wks":226,"./_wks-define":224,"./_wks-ext":225,"dup":97}],353:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $typed = require('./_typed'); +var buffer = require('./_typed-buffer'); +var anObject = require('./_an-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +var isObject = require('./_is-object'); +var ArrayBuffer = require('./_global').ArrayBuffer; +var speciesConstructor = require('./_species-constructor'); +var $ArrayBuffer = buffer.ArrayBuffer; +var $DataView = buffer.DataView; +var $isView = $typed.ABV && ArrayBuffer.isView; +var $slice = $ArrayBuffer.prototype.slice; +var VIEW = $typed.VIEW; +var ARRAY_BUFFER = 'ArrayBuffer'; + +$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer }); + +$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { + // 24.1.3.1 ArrayBuffer.isView(arg) + isView: function isView(it) { + return $isView && $isView(it) || isObject(it) && VIEW in it; + } +}); + +$export($export.P + $export.U + $export.F * require('./_fails')(function () { + return !new $ArrayBuffer(2).slice(1, undefined).byteLength; +}), ARRAY_BUFFER, { + // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) + slice: function slice(start, end) { + if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix + var len = anObject(this).byteLength; + var first = toAbsoluteIndex(start, len); + var fin = toAbsoluteIndex(end === undefined ? len : end, len); + var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first)); + var viewS = new $DataView(this); + var viewT = new $DataView(result); + var index = 0; + while (first < fin) { + viewT.setUint8(index++, viewS.getUint8(first++)); + } return result; + } +}); + +require('./_set-species')(ARRAY_BUFFER); + +},{"./_an-object":107,"./_export":133,"./_fails":135,"./_global":140,"./_is-object":151,"./_set-species":197,"./_species-constructor":201,"./_to-absolute-index":211,"./_to-length":215,"./_typed":220,"./_typed-buffer":219}],354:[function(require,module,exports){ +var $export = require('./_export'); +$export($export.G + $export.W + $export.F * !require('./_typed').ABV, { + DataView: require('./_typed-buffer').DataView +}); + +},{"./_export":133,"./_typed":220,"./_typed-buffer":219}],355:[function(require,module,exports){ +require('./_typed-array')('Float32', 4, function (init) { + return function Float32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],356:[function(require,module,exports){ +require('./_typed-array')('Float64', 8, function (init) { + return function Float64Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],357:[function(require,module,exports){ +require('./_typed-array')('Int16', 2, function (init) { + return function Int16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],358:[function(require,module,exports){ +require('./_typed-array')('Int32', 4, function (init) { + return function Int32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],359:[function(require,module,exports){ +require('./_typed-array')('Int8', 1, function (init) { + return function Int8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],360:[function(require,module,exports){ +require('./_typed-array')('Uint16', 2, function (init) { + return function Uint16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],361:[function(require,module,exports){ +require('./_typed-array')('Uint32', 4, function (init) { + return function Uint32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],362:[function(require,module,exports){ +require('./_typed-array')('Uint8', 1, function (init) { + return function Uint8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":218}],363:[function(require,module,exports){ +require('./_typed-array')('Uint8', 1, function (init) { + return function Uint8ClampedArray(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}, true); + +},{"./_typed-array":218}],364:[function(require,module,exports){ +'use strict'; +var each = require('./_array-methods')(0); +var redefine = require('./_redefine'); +var meta = require('./_meta'); +var assign = require('./_object-assign'); +var weak = require('./_collection-weak'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var validate = require('./_validate-collection'); +var WEAK_MAP = 'WeakMap'; +var getWeak = meta.getWeak; +var isExtensible = Object.isExtensible; +var uncaughtFrozenStore = weak.ufstore; +var tmp = {}; +var InternalMap; + +var wrapper = function (get) { + return function WeakMap() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; +}; + +var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key) { + if (isObject(key)) { + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value) { + return weak.def(validate(this, WEAK_MAP), key, value); + } +}; + +// 23.3 WeakMap Objects +var $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true); + +// IE11 WeakMap frozen keys fix +if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) { + InternalMap = weak.getConstructor(wrapper, WEAK_MAP); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function (key) { + var proto = $WeakMap.prototype; + var method = proto[key]; + redefine(proto, key, function (a, b) { + // store frozen objects on internal weakmap shim + if (isObject(a) && !isExtensible(a)) { + if (!this._f) this._f = new InternalMap(); + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + } return method.call(this, a, b); + }); + }); +} + +},{"./_array-methods":112,"./_collection":122,"./_collection-weak":121,"./_fails":135,"./_is-object":151,"./_meta":165,"./_object-assign":169,"./_redefine":191,"./_validate-collection":223}],365:[function(require,module,exports){ +'use strict'; +var weak = require('./_collection-weak'); +var validate = require('./_validate-collection'); +var WEAK_SET = 'WeakSet'; + +// 23.4 WeakSet Objects +require('./_collection')(WEAK_SET, function (get) { + return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.4.3.1 WeakSet.prototype.add(value) + add: function add(value) { + return weak.def(validate(this, WEAK_SET), value, true); + } +}, weak, false, true); + +},{"./_collection":122,"./_collection-weak":121,"./_validate-collection":223}],366:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap +var $export = require('./_export'); +var flattenIntoArray = require('./_flatten-into-array'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var aFunction = require('./_a-function'); +var arraySpeciesCreate = require('./_array-species-create'); + +$export($export.P, 'Array', { + flatMap: function flatMap(callbackfn /* , thisArg */) { + var O = toObject(this); + var sourceLen, A; + aFunction(callbackfn); + sourceLen = toLength(O.length); + A = arraySpeciesCreate(O, 0); + flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]); + return A; + } +}); + +require('./_add-to-unscopables')('flatMap'); + +},{"./_a-function":103,"./_add-to-unscopables":105,"./_array-species-create":115,"./_export":133,"./_flatten-into-array":138,"./_to-length":215,"./_to-object":216}],367:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten +var $export = require('./_export'); +var flattenIntoArray = require('./_flatten-into-array'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var toInteger = require('./_to-integer'); +var arraySpeciesCreate = require('./_array-species-create'); + +$export($export.P, 'Array', { + flatten: function flatten(/* depthArg = 1 */) { + var depthArg = arguments[0]; + var O = toObject(this); + var sourceLen = toLength(O.length); + var A = arraySpeciesCreate(O, 0); + flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); + return A; + } +}); + +require('./_add-to-unscopables')('flatten'); + +},{"./_add-to-unscopables":105,"./_array-species-create":115,"./_export":133,"./_flatten-into-array":138,"./_to-integer":213,"./_to-length":215,"./_to-object":216}],368:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/Array.prototype.includes +var $export = require('./_export'); +var $includes = require('./_array-includes')(true); + +$export($export.P, 'Array', { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +require('./_add-to-unscopables')('includes'); + +},{"./_add-to-unscopables":105,"./_array-includes":111,"./_export":133}],369:[function(require,module,exports){ +// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask +var $export = require('./_export'); +var microtask = require('./_microtask')(); +var process = require('./_global').process; +var isNode = require('./_cof')(process) == 'process'; + +$export($export.G, { + asap: function asap(fn) { + var domain = isNode && process.domain; + microtask(domain ? domain.bind(fn) : fn); + } +}); + +},{"./_cof":118,"./_export":133,"./_global":140,"./_microtask":167}],370:[function(require,module,exports){ +// https://github.com/ljharb/proposal-is-error +var $export = require('./_export'); +var cof = require('./_cof'); + +$export($export.S, 'Error', { + isError: function isError(it) { + return cof(it) === 'Error'; + } +}); + +},{"./_cof":118,"./_export":133}],371:[function(require,module,exports){ +// https://github.com/tc39/proposal-global +var $export = require('./_export'); + +$export($export.G, { global: require('./_global') }); + +},{"./_export":133,"./_global":140}],372:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from +require('./_set-collection-from')('Map'); + +},{"./_set-collection-from":194}],373:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of +require('./_set-collection-of')('Map'); + +},{"./_set-collection-of":195}],374:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $export = require('./_export'); + +$export($export.P + $export.R, 'Map', { toJSON: require('./_collection-to-json')('Map') }); + +},{"./_collection-to-json":120,"./_export":133}],375:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { + clamp: function clamp(x, lower, upper) { + return Math.min(upper, Math.max(lower, x)); + } +}); + +},{"./_export":133}],376:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 }); + +},{"./_export":133}],377:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var RAD_PER_DEG = 180 / Math.PI; + +$export($export.S, 'Math', { + degrees: function degrees(radians) { + return radians * RAD_PER_DEG; + } +}); + +},{"./_export":133}],378:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var scale = require('./_math-scale'); +var fround = require('./_math-fround'); + +$export($export.S, 'Math', { + fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { + return fround(scale(x, inLow, inHigh, outLow, outHigh)); + } +}); + +},{"./_export":133,"./_math-fround":161,"./_math-scale":163}],379:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + iaddh: function iaddh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0; + var $x1 = x1 >>> 0; + var $y0 = y0 >>> 0; + return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; + } +}); + +},{"./_export":133}],380:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + imulh: function imulh(u, v) { + var UINT16 = 0xffff; + var $u = +u; + var $v = +v; + var u0 = $u & UINT16; + var v0 = $v & UINT16; + var u1 = $u >> 16; + var v1 = $v >> 16; + var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); + return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); + } +}); + +},{"./_export":133}],381:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + isubh: function isubh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0; + var $x1 = x1 >>> 0; + var $y0 = y0 >>> 0; + return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; + } +}); + +},{"./_export":133}],382:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI }); + +},{"./_export":133}],383:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var DEG_PER_RAD = Math.PI / 180; + +$export($export.S, 'Math', { + radians: function radians(degrees) { + return degrees * DEG_PER_RAD; + } +}); + +},{"./_export":133}],384:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { scale: require('./_math-scale') }); + +},{"./_export":133,"./_math-scale":163}],385:[function(require,module,exports){ +// http://jfbastien.github.io/papers/Math.signbit.html +var $export = require('./_export'); + +$export($export.S, 'Math', { signbit: function signbit(x) { + // eslint-disable-next-line no-self-compare + return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0; +} }); + +},{"./_export":133}],386:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + umulh: function umulh(u, v) { + var UINT16 = 0xffff; + var $u = +u; + var $v = +v; + var u0 = $u & UINT16; + var v0 = $v & UINT16; + var u1 = $u >>> 16; + var v1 = $v >>> 16; + var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); + return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); + } +}); + +},{"./_export":133}],387:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var aFunction = require('./_a-function'); +var $defineProperty = require('./_object-dp'); + +// B.2.2.2 Object.prototype.__defineGetter__(P, getter) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __defineGetter__: function __defineGetter__(P, getter) { + $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); + } +}); + +},{"./_a-function":103,"./_descriptors":129,"./_export":133,"./_object-dp":171,"./_object-forced-pam":173,"./_to-object":216}],388:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var aFunction = require('./_a-function'); +var $defineProperty = require('./_object-dp'); + +// B.2.2.3 Object.prototype.__defineSetter__(P, setter) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __defineSetter__: function __defineSetter__(P, setter) { + $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); + } +}); + +},{"./_a-function":103,"./_descriptors":129,"./_export":133,"./_object-dp":171,"./_object-forced-pam":173,"./_to-object":216}],389:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export'); +var $entries = require('./_object-to-array')(true); + +$export($export.S, 'Object', { + entries: function entries(it) { + return $entries(it); + } +}); + +},{"./_export":133,"./_object-to-array":183}],390:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-getownpropertydescriptors +var $export = require('./_export'); +var ownKeys = require('./_own-keys'); +var toIObject = require('./_to-iobject'); +var gOPD = require('./_object-gopd'); +var createProperty = require('./_create-property'); + +$export($export.S, 'Object', { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIObject(object); + var getDesc = gOPD.f; + var keys = ownKeys(O); + var result = {}; + var i = 0; + var key, desc; + while (keys.length > i) { + desc = getDesc(O, key = keys[i++]); + if (desc !== undefined) createProperty(result, key, desc); + } + return result; + } +}); + +},{"./_create-property":124,"./_export":133,"./_object-gopd":174,"./_own-keys":184,"./_to-iobject":214}],391:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); +var getPrototypeOf = require('./_object-gpo'); +var getOwnPropertyDescriptor = require('./_object-gopd').f; + +// B.2.2.4 Object.prototype.__lookupGetter__(P) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __lookupGetter__: function __lookupGetter__(P) { + var O = toObject(this); + var K = toPrimitive(P, true); + var D; + do { + if (D = getOwnPropertyDescriptor(O, K)) return D.get; + } while (O = getPrototypeOf(O)); + } +}); + +},{"./_descriptors":129,"./_export":133,"./_object-forced-pam":173,"./_object-gopd":174,"./_object-gpo":178,"./_to-object":216,"./_to-primitive":217}],392:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); +var getPrototypeOf = require('./_object-gpo'); +var getOwnPropertyDescriptor = require('./_object-gopd').f; + +// B.2.2.5 Object.prototype.__lookupSetter__(P) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __lookupSetter__: function __lookupSetter__(P) { + var O = toObject(this); + var K = toPrimitive(P, true); + var D; + do { + if (D = getOwnPropertyDescriptor(O, K)) return D.set; + } while (O = getPrototypeOf(O)); + } +}); + +},{"./_descriptors":129,"./_export":133,"./_object-forced-pam":173,"./_object-gopd":174,"./_object-gpo":178,"./_to-object":216,"./_to-primitive":217}],393:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export'); +var $values = require('./_object-to-array')(false); + +$export($export.S, 'Object', { + values: function values(it) { + return $values(it); + } +}); + +},{"./_export":133,"./_object-to-array":183}],394:[function(require,module,exports){ +'use strict'; +// https://github.com/zenparsing/es-observable +var $export = require('./_export'); +var global = require('./_global'); +var core = require('./_core'); +var microtask = require('./_microtask')(); +var OBSERVABLE = require('./_wks')('observable'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var anInstance = require('./_an-instance'); +var redefineAll = require('./_redefine-all'); +var hide = require('./_hide'); +var forOf = require('./_for-of'); +var RETURN = forOf.RETURN; + +var getMethod = function (fn) { + return fn == null ? undefined : aFunction(fn); +}; + +var cleanupSubscription = function (subscription) { + var cleanup = subscription._c; + if (cleanup) { + subscription._c = undefined; + cleanup(); + } +}; + +var subscriptionClosed = function (subscription) { + return subscription._o === undefined; +}; + +var closeSubscription = function (subscription) { + if (!subscriptionClosed(subscription)) { + subscription._o = undefined; + cleanupSubscription(subscription); + } +}; + +var Subscription = function (observer, subscriber) { + anObject(observer); + this._c = undefined; + this._o = observer; + observer = new SubscriptionObserver(this); + try { + var cleanup = subscriber(observer); + var subscription = cleanup; + if (cleanup != null) { + if (typeof cleanup.unsubscribe === 'function') cleanup = function () { subscription.unsubscribe(); }; + else aFunction(cleanup); + this._c = cleanup; + } + } catch (e) { + observer.error(e); + return; + } if (subscriptionClosed(this)) cleanupSubscription(this); +}; + +Subscription.prototype = redefineAll({}, { + unsubscribe: function unsubscribe() { closeSubscription(this); } +}); + +var SubscriptionObserver = function (subscription) { + this._s = subscription; +}; + +SubscriptionObserver.prototype = redefineAll({}, { + next: function next(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + try { + var m = getMethod(observer.next); + if (m) return m.call(observer, value); + } catch (e) { + try { + closeSubscription(subscription); + } finally { + throw e; + } + } + } + }, + error: function error(value) { + var subscription = this._s; + if (subscriptionClosed(subscription)) throw value; + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.error); + if (!m) throw value; + value = m.call(observer, value); + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } cleanupSubscription(subscription); + return value; + }, + complete: function complete(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.complete); + value = m ? m.call(observer, value) : undefined; + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } cleanupSubscription(subscription); + return value; + } + } +}); + +var $Observable = function Observable(subscriber) { + anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); +}; + +redefineAll($Observable.prototype, { + subscribe: function subscribe(observer) { + return new Subscription(observer, this._f); + }, + forEach: function forEach(fn) { + var that = this; + return new (core.Promise || global.Promise)(function (resolve, reject) { + aFunction(fn); + var subscription = that.subscribe({ + next: function (value) { + try { + return fn(value); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + }); + } +}); + +redefineAll($Observable, { + from: function from(x) { + var C = typeof this === 'function' ? this : $Observable; + var method = getMethod(anObject(x)[OBSERVABLE]); + if (method) { + var observable = anObject(method.call(x)); + return observable.constructor === C ? observable : new C(function (observer) { + return observable.subscribe(observer); + }); + } + return new C(function (observer) { + var done = false; + microtask(function () { + if (!done) { + try { + if (forOf(x, false, function (it) { + observer.next(it); + if (done) return RETURN; + }) === RETURN) return; + } catch (e) { + if (done) throw e; + observer.error(e); + return; + } observer.complete(); + } + }); + return function () { done = true; }; + }); + }, + of: function of() { + for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++]; + return new (typeof this === 'function' ? this : $Observable)(function (observer) { + var done = false; + microtask(function () { + if (!done) { + for (var j = 0; j < items.length; ++j) { + observer.next(items[j]); + if (done) return; + } observer.complete(); + } + }); + return function () { done = true; }; + }); + } +}); + +hide($Observable.prototype, OBSERVABLE, function () { return this; }); + +$export($export.G, { Observable: $Observable }); + +require('./_set-species')('Observable'); + +},{"./_a-function":103,"./_an-instance":106,"./_an-object":107,"./_core":123,"./_export":133,"./_for-of":139,"./_global":140,"./_hide":142,"./_microtask":167,"./_redefine-all":190,"./_set-species":197,"./_wks":226}],395:[function(require,module,exports){ +arguments[4][98][0].apply(exports,arguments) +},{"./_core":123,"./_export":133,"./_global":140,"./_promise-resolve":188,"./_species-constructor":201,"dup":98}],396:[function(require,module,exports){ +arguments[4][99][0].apply(exports,arguments) +},{"./_export":133,"./_new-promise-capability":168,"./_perform":187,"dup":99}],397:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var toMetaKey = metadata.key; +var ordinaryDefineOwnMetadata = metadata.set; + +metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) { + ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); +} }); + +},{"./_an-object":107,"./_metadata":166}],398:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var toMetaKey = metadata.key; +var getOrCreateMetadataMap = metadata.map; +var store = metadata.store; + +metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { + var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]); + var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); + if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; + if (metadataMap.size) return true; + var targetMetadata = store.get(target); + targetMetadata['delete'](targetKey); + return !!targetMetadata.size || store['delete'](target); +} }); + +},{"./_an-object":107,"./_metadata":166}],399:[function(require,module,exports){ +var Set = require('./es6.set'); +var from = require('./_array-from-iterable'); +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +var ordinaryMetadataKeys = function (O, P) { + var oKeys = ordinaryOwnMetadataKeys(O, P); + var parent = getPrototypeOf(O); + if (parent === null) return oKeys; + var pKeys = ordinaryMetadataKeys(parent, P); + return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; +}; + +metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { + return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + +},{"./_an-object":107,"./_array-from-iterable":110,"./_metadata":166,"./_object-gpo":178,"./es6.set":329}],400:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryHasOwnMetadata = metadata.has; +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +var ordinaryGetMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; +}; + +metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":107,"./_metadata":166,"./_object-gpo":178}],401:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { + return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + +},{"./_an-object":107,"./_metadata":166}],402:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":107,"./_metadata":166}],403:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +var ordinaryHasMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return true; + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; +}; + +metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":107,"./_metadata":166,"./_object-gpo":178}],404:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":107,"./_metadata":166}],405:[function(require,module,exports){ +var $metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var aFunction = require('./_a-function'); +var toMetaKey = $metadata.key; +var ordinaryDefineOwnMetadata = $metadata.set; + +$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) { + return function decorator(target, targetKey) { + ordinaryDefineOwnMetadata( + metadataKey, metadataValue, + (targetKey !== undefined ? anObject : aFunction)(target), + toMetaKey(targetKey) + ); + }; +} }); + +},{"./_a-function":103,"./_an-object":107,"./_metadata":166}],406:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-set.from +require('./_set-collection-from')('Set'); + +},{"./_set-collection-from":194}],407:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-set.of +require('./_set-collection-of')('Set'); + +},{"./_set-collection-of":195}],408:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $export = require('./_export'); + +$export($export.P + $export.R, 'Set', { toJSON: require('./_collection-to-json')('Set') }); + +},{"./_collection-to-json":120,"./_export":133}],409:[function(require,module,exports){ +'use strict'; +// https://github.com/mathiasbynens/String.prototype.at +var $export = require('./_export'); +var $at = require('./_string-at')(true); + +$export($export.P, 'String', { + at: function at(pos) { + return $at(this, pos); + } +}); + +},{"./_export":133,"./_string-at":203}],410:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/String.prototype.matchAll/ +var $export = require('./_export'); +var defined = require('./_defined'); +var toLength = require('./_to-length'); +var isRegExp = require('./_is-regexp'); +var getFlags = require('./_flags'); +var RegExpProto = RegExp.prototype; + +var $RegExpStringIterator = function (regexp, string) { + this._r = regexp; + this._s = string; +}; + +require('./_iter-create')($RegExpStringIterator, 'RegExp String', function next() { + var match = this._r.exec(this._s); + return { value: match, done: match === null }; +}); + +$export($export.P, 'String', { + matchAll: function matchAll(regexp) { + defined(this); + if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!'); + var S = String(this); + var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp); + var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); + rx.lastIndex = toLength(regexp.lastIndex); + return new $RegExpStringIterator(rx, S); + } +}); + +},{"./_defined":128,"./_export":133,"./_flags":137,"./_is-regexp":152,"./_iter-create":154,"./_to-length":215}],411:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = require('./_export'); +var $pad = require('./_string-pad'); +var userAgent = require('./_user-agent'); + +// https://github.com/zloirock/core-js/issues/280 +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padEnd: function padEnd(maxLength /* , fillString = ' ' */) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); + } +}); + +},{"./_export":133,"./_string-pad":206,"./_user-agent":222}],412:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = require('./_export'); +var $pad = require('./_string-pad'); +var userAgent = require('./_user-agent'); + +// https://github.com/zloirock/core-js/issues/280 +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padStart: function padStart(maxLength /* , fillString = ' ' */) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); + } +}); + +},{"./_export":133,"./_string-pad":206,"./_user-agent":222}],413:[function(require,module,exports){ +'use strict'; +// https://github.com/sebmarkbage/ecmascript-string-left-right-trim +require('./_string-trim')('trimLeft', function ($trim) { + return function trimLeft() { + return $trim(this, 1); + }; +}, 'trimStart'); + +},{"./_string-trim":208}],414:[function(require,module,exports){ +'use strict'; +// https://github.com/sebmarkbage/ecmascript-string-left-right-trim +require('./_string-trim')('trimRight', function ($trim) { + return function trimRight() { + return $trim(this, 2); + }; +}, 'trimEnd'); + +},{"./_string-trim":208}],415:[function(require,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"./_wks-define":224,"dup":100}],416:[function(require,module,exports){ +arguments[4][101][0].apply(exports,arguments) +},{"./_wks-define":224,"dup":101}],417:[function(require,module,exports){ +// https://github.com/tc39/proposal-global +var $export = require('./_export'); + +$export($export.S, 'System', { global: require('./_global') }); + +},{"./_export":133,"./_global":140}],418:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from +require('./_set-collection-from')('WeakMap'); + +},{"./_set-collection-from":194}],419:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of +require('./_set-collection-of')('WeakMap'); + +},{"./_set-collection-of":195}],420:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from +require('./_set-collection-from')('WeakSet'); + +},{"./_set-collection-from":194}],421:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of +require('./_set-collection-of')('WeakSet'); + +},{"./_set-collection-of":195}],422:[function(require,module,exports){ +var $iterators = require('./es6.array.iterator'); +var getKeys = require('./_object-keys'); +var redefine = require('./_redefine'); +var global = require('./_global'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var wks = require('./_wks'); +var ITERATOR = wks('iterator'); +var TO_STRING_TAG = wks('toStringTag'); +var ArrayValues = Iterators.Array; + +var DOMIterables = { + CSSRuleList: true, // TODO: Not spec compliant, should be false. + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, // TODO: Not spec compliant, should be false. + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, // TODO: Not spec compliant, should be false. + TextTrackCueList: false, + TextTrackList: false, + TouchList: false +}; + +for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { + var NAME = collections[i]; + var explicit = DOMIterables[NAME]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); + if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = ArrayValues; + if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); + } +} + +},{"./_global":140,"./_hide":142,"./_iterators":158,"./_object-keys":180,"./_redefine":191,"./_wks":226,"./es6.array.iterator":239}],423:[function(require,module,exports){ +var $export = require('./_export'); +var $task = require('./_task'); +$export($export.G + $export.B, { + setImmediate: $task.set, + clearImmediate: $task.clear +}); + +},{"./_export":133,"./_task":210}],424:[function(require,module,exports){ +// ie9- setTimeout & setInterval additional parameters fix +var global = require('./_global'); +var $export = require('./_export'); +var userAgent = require('./_user-agent'); +var slice = [].slice; +var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check +var wrap = function (set) { + return function (fn, time /* , ...args */) { + var boundArgs = arguments.length > 2; + var args = boundArgs ? slice.call(arguments, 2) : false; + return set(boundArgs ? function () { + // eslint-disable-next-line no-new-func + (typeof fn == 'function' ? fn : Function(fn)).apply(this, args); + } : fn, time); + }; +}; +$export($export.G + $export.B + $export.F * MSIE, { + setTimeout: wrap(global.setTimeout), + setInterval: wrap(global.setInterval) +}); + +},{"./_export":133,"./_global":140,"./_user-agent":222}],425:[function(require,module,exports){ +require('./modules/es6.symbol'); +require('./modules/es6.object.create'); +require('./modules/es6.object.define-property'); +require('./modules/es6.object.define-properties'); +require('./modules/es6.object.get-own-property-descriptor'); +require('./modules/es6.object.get-prototype-of'); +require('./modules/es6.object.keys'); +require('./modules/es6.object.get-own-property-names'); +require('./modules/es6.object.freeze'); +require('./modules/es6.object.seal'); +require('./modules/es6.object.prevent-extensions'); +require('./modules/es6.object.is-frozen'); +require('./modules/es6.object.is-sealed'); +require('./modules/es6.object.is-extensible'); +require('./modules/es6.object.assign'); +require('./modules/es6.object.is'); +require('./modules/es6.object.set-prototype-of'); +require('./modules/es6.object.to-string'); +require('./modules/es6.function.bind'); +require('./modules/es6.function.name'); +require('./modules/es6.function.has-instance'); +require('./modules/es6.parse-int'); +require('./modules/es6.parse-float'); +require('./modules/es6.number.constructor'); +require('./modules/es6.number.to-fixed'); +require('./modules/es6.number.to-precision'); +require('./modules/es6.number.epsilon'); +require('./modules/es6.number.is-finite'); +require('./modules/es6.number.is-integer'); +require('./modules/es6.number.is-nan'); +require('./modules/es6.number.is-safe-integer'); +require('./modules/es6.number.max-safe-integer'); +require('./modules/es6.number.min-safe-integer'); +require('./modules/es6.number.parse-float'); +require('./modules/es6.number.parse-int'); +require('./modules/es6.math.acosh'); +require('./modules/es6.math.asinh'); +require('./modules/es6.math.atanh'); +require('./modules/es6.math.cbrt'); +require('./modules/es6.math.clz32'); +require('./modules/es6.math.cosh'); +require('./modules/es6.math.expm1'); +require('./modules/es6.math.fround'); +require('./modules/es6.math.hypot'); +require('./modules/es6.math.imul'); +require('./modules/es6.math.log10'); +require('./modules/es6.math.log1p'); +require('./modules/es6.math.log2'); +require('./modules/es6.math.sign'); +require('./modules/es6.math.sinh'); +require('./modules/es6.math.tanh'); +require('./modules/es6.math.trunc'); +require('./modules/es6.string.from-code-point'); +require('./modules/es6.string.raw'); +require('./modules/es6.string.trim'); +require('./modules/es6.string.iterator'); +require('./modules/es6.string.code-point-at'); +require('./modules/es6.string.ends-with'); +require('./modules/es6.string.includes'); +require('./modules/es6.string.repeat'); +require('./modules/es6.string.starts-with'); +require('./modules/es6.string.anchor'); +require('./modules/es6.string.big'); +require('./modules/es6.string.blink'); +require('./modules/es6.string.bold'); +require('./modules/es6.string.fixed'); +require('./modules/es6.string.fontcolor'); +require('./modules/es6.string.fontsize'); +require('./modules/es6.string.italics'); +require('./modules/es6.string.link'); +require('./modules/es6.string.small'); +require('./modules/es6.string.strike'); +require('./modules/es6.string.sub'); +require('./modules/es6.string.sup'); +require('./modules/es6.date.now'); +require('./modules/es6.date.to-json'); +require('./modules/es6.date.to-iso-string'); +require('./modules/es6.date.to-string'); +require('./modules/es6.date.to-primitive'); +require('./modules/es6.array.is-array'); +require('./modules/es6.array.from'); +require('./modules/es6.array.of'); +require('./modules/es6.array.join'); +require('./modules/es6.array.slice'); +require('./modules/es6.array.sort'); +require('./modules/es6.array.for-each'); +require('./modules/es6.array.map'); +require('./modules/es6.array.filter'); +require('./modules/es6.array.some'); +require('./modules/es6.array.every'); +require('./modules/es6.array.reduce'); +require('./modules/es6.array.reduce-right'); +require('./modules/es6.array.index-of'); +require('./modules/es6.array.last-index-of'); +require('./modules/es6.array.copy-within'); +require('./modules/es6.array.fill'); +require('./modules/es6.array.find'); +require('./modules/es6.array.find-index'); +require('./modules/es6.array.species'); +require('./modules/es6.array.iterator'); +require('./modules/es6.regexp.constructor'); +require('./modules/es6.regexp.to-string'); +require('./modules/es6.regexp.flags'); +require('./modules/es6.regexp.match'); +require('./modules/es6.regexp.replace'); +require('./modules/es6.regexp.search'); +require('./modules/es6.regexp.split'); +require('./modules/es6.promise'); +require('./modules/es6.map'); +require('./modules/es6.set'); +require('./modules/es6.weak-map'); +require('./modules/es6.weak-set'); +require('./modules/es6.typed.array-buffer'); +require('./modules/es6.typed.data-view'); +require('./modules/es6.typed.int8-array'); +require('./modules/es6.typed.uint8-array'); +require('./modules/es6.typed.uint8-clamped-array'); +require('./modules/es6.typed.int16-array'); +require('./modules/es6.typed.uint16-array'); +require('./modules/es6.typed.int32-array'); +require('./modules/es6.typed.uint32-array'); +require('./modules/es6.typed.float32-array'); +require('./modules/es6.typed.float64-array'); +require('./modules/es6.reflect.apply'); +require('./modules/es6.reflect.construct'); +require('./modules/es6.reflect.define-property'); +require('./modules/es6.reflect.delete-property'); +require('./modules/es6.reflect.enumerate'); +require('./modules/es6.reflect.get'); +require('./modules/es6.reflect.get-own-property-descriptor'); +require('./modules/es6.reflect.get-prototype-of'); +require('./modules/es6.reflect.has'); +require('./modules/es6.reflect.is-extensible'); +require('./modules/es6.reflect.own-keys'); +require('./modules/es6.reflect.prevent-extensions'); +require('./modules/es6.reflect.set'); +require('./modules/es6.reflect.set-prototype-of'); +require('./modules/es7.array.includes'); +require('./modules/es7.array.flat-map'); +require('./modules/es7.array.flatten'); +require('./modules/es7.string.at'); +require('./modules/es7.string.pad-start'); +require('./modules/es7.string.pad-end'); +require('./modules/es7.string.trim-left'); +require('./modules/es7.string.trim-right'); +require('./modules/es7.string.match-all'); +require('./modules/es7.symbol.async-iterator'); +require('./modules/es7.symbol.observable'); +require('./modules/es7.object.get-own-property-descriptors'); +require('./modules/es7.object.values'); +require('./modules/es7.object.entries'); +require('./modules/es7.object.define-getter'); +require('./modules/es7.object.define-setter'); +require('./modules/es7.object.lookup-getter'); +require('./modules/es7.object.lookup-setter'); +require('./modules/es7.map.to-json'); +require('./modules/es7.set.to-json'); +require('./modules/es7.map.of'); +require('./modules/es7.set.of'); +require('./modules/es7.weak-map.of'); +require('./modules/es7.weak-set.of'); +require('./modules/es7.map.from'); +require('./modules/es7.set.from'); +require('./modules/es7.weak-map.from'); +require('./modules/es7.weak-set.from'); +require('./modules/es7.global'); +require('./modules/es7.system.global'); +require('./modules/es7.error.is-error'); +require('./modules/es7.math.clamp'); +require('./modules/es7.math.deg-per-rad'); +require('./modules/es7.math.degrees'); +require('./modules/es7.math.fscale'); +require('./modules/es7.math.iaddh'); +require('./modules/es7.math.isubh'); +require('./modules/es7.math.imulh'); +require('./modules/es7.math.rad-per-deg'); +require('./modules/es7.math.radians'); +require('./modules/es7.math.scale'); +require('./modules/es7.math.umulh'); +require('./modules/es7.math.signbit'); +require('./modules/es7.promise.finally'); +require('./modules/es7.promise.try'); +require('./modules/es7.reflect.define-metadata'); +require('./modules/es7.reflect.delete-metadata'); +require('./modules/es7.reflect.get-metadata'); +require('./modules/es7.reflect.get-metadata-keys'); +require('./modules/es7.reflect.get-own-metadata'); +require('./modules/es7.reflect.get-own-metadata-keys'); +require('./modules/es7.reflect.has-metadata'); +require('./modules/es7.reflect.has-own-metadata'); +require('./modules/es7.reflect.metadata'); +require('./modules/es7.asap'); +require('./modules/es7.observable'); +require('./modules/web.timers'); +require('./modules/web.immediate'); +require('./modules/web.dom.iterable'); +module.exports = require('./modules/_core'); + +},{"./modules/_core":123,"./modules/es6.array.copy-within":229,"./modules/es6.array.every":230,"./modules/es6.array.fill":231,"./modules/es6.array.filter":232,"./modules/es6.array.find":234,"./modules/es6.array.find-index":233,"./modules/es6.array.for-each":235,"./modules/es6.array.from":236,"./modules/es6.array.index-of":237,"./modules/es6.array.is-array":238,"./modules/es6.array.iterator":239,"./modules/es6.array.join":240,"./modules/es6.array.last-index-of":241,"./modules/es6.array.map":242,"./modules/es6.array.of":243,"./modules/es6.array.reduce":245,"./modules/es6.array.reduce-right":244,"./modules/es6.array.slice":246,"./modules/es6.array.some":247,"./modules/es6.array.sort":248,"./modules/es6.array.species":249,"./modules/es6.date.now":250,"./modules/es6.date.to-iso-string":251,"./modules/es6.date.to-json":252,"./modules/es6.date.to-primitive":253,"./modules/es6.date.to-string":254,"./modules/es6.function.bind":255,"./modules/es6.function.has-instance":256,"./modules/es6.function.name":257,"./modules/es6.map":258,"./modules/es6.math.acosh":259,"./modules/es6.math.asinh":260,"./modules/es6.math.atanh":261,"./modules/es6.math.cbrt":262,"./modules/es6.math.clz32":263,"./modules/es6.math.cosh":264,"./modules/es6.math.expm1":265,"./modules/es6.math.fround":266,"./modules/es6.math.hypot":267,"./modules/es6.math.imul":268,"./modules/es6.math.log10":269,"./modules/es6.math.log1p":270,"./modules/es6.math.log2":271,"./modules/es6.math.sign":272,"./modules/es6.math.sinh":273,"./modules/es6.math.tanh":274,"./modules/es6.math.trunc":275,"./modules/es6.number.constructor":276,"./modules/es6.number.epsilon":277,"./modules/es6.number.is-finite":278,"./modules/es6.number.is-integer":279,"./modules/es6.number.is-nan":280,"./modules/es6.number.is-safe-integer":281,"./modules/es6.number.max-safe-integer":282,"./modules/es6.number.min-safe-integer":283,"./modules/es6.number.parse-float":284,"./modules/es6.number.parse-int":285,"./modules/es6.number.to-fixed":286,"./modules/es6.number.to-precision":287,"./modules/es6.object.assign":288,"./modules/es6.object.create":289,"./modules/es6.object.define-properties":290,"./modules/es6.object.define-property":291,"./modules/es6.object.freeze":292,"./modules/es6.object.get-own-property-descriptor":293,"./modules/es6.object.get-own-property-names":294,"./modules/es6.object.get-prototype-of":295,"./modules/es6.object.is":299,"./modules/es6.object.is-extensible":296,"./modules/es6.object.is-frozen":297,"./modules/es6.object.is-sealed":298,"./modules/es6.object.keys":300,"./modules/es6.object.prevent-extensions":301,"./modules/es6.object.seal":302,"./modules/es6.object.set-prototype-of":303,"./modules/es6.object.to-string":304,"./modules/es6.parse-float":305,"./modules/es6.parse-int":306,"./modules/es6.promise":307,"./modules/es6.reflect.apply":308,"./modules/es6.reflect.construct":309,"./modules/es6.reflect.define-property":310,"./modules/es6.reflect.delete-property":311,"./modules/es6.reflect.enumerate":312,"./modules/es6.reflect.get":315,"./modules/es6.reflect.get-own-property-descriptor":313,"./modules/es6.reflect.get-prototype-of":314,"./modules/es6.reflect.has":316,"./modules/es6.reflect.is-extensible":317,"./modules/es6.reflect.own-keys":318,"./modules/es6.reflect.prevent-extensions":319,"./modules/es6.reflect.set":321,"./modules/es6.reflect.set-prototype-of":320,"./modules/es6.regexp.constructor":322,"./modules/es6.regexp.flags":323,"./modules/es6.regexp.match":324,"./modules/es6.regexp.replace":325,"./modules/es6.regexp.search":326,"./modules/es6.regexp.split":327,"./modules/es6.regexp.to-string":328,"./modules/es6.set":329,"./modules/es6.string.anchor":330,"./modules/es6.string.big":331,"./modules/es6.string.blink":332,"./modules/es6.string.bold":333,"./modules/es6.string.code-point-at":334,"./modules/es6.string.ends-with":335,"./modules/es6.string.fixed":336,"./modules/es6.string.fontcolor":337,"./modules/es6.string.fontsize":338,"./modules/es6.string.from-code-point":339,"./modules/es6.string.includes":340,"./modules/es6.string.italics":341,"./modules/es6.string.iterator":342,"./modules/es6.string.link":343,"./modules/es6.string.raw":344,"./modules/es6.string.repeat":345,"./modules/es6.string.small":346,"./modules/es6.string.starts-with":347,"./modules/es6.string.strike":348,"./modules/es6.string.sub":349,"./modules/es6.string.sup":350,"./modules/es6.string.trim":351,"./modules/es6.symbol":352,"./modules/es6.typed.array-buffer":353,"./modules/es6.typed.data-view":354,"./modules/es6.typed.float32-array":355,"./modules/es6.typed.float64-array":356,"./modules/es6.typed.int16-array":357,"./modules/es6.typed.int32-array":358,"./modules/es6.typed.int8-array":359,"./modules/es6.typed.uint16-array":360,"./modules/es6.typed.uint32-array":361,"./modules/es6.typed.uint8-array":362,"./modules/es6.typed.uint8-clamped-array":363,"./modules/es6.weak-map":364,"./modules/es6.weak-set":365,"./modules/es7.array.flat-map":366,"./modules/es7.array.flatten":367,"./modules/es7.array.includes":368,"./modules/es7.asap":369,"./modules/es7.error.is-error":370,"./modules/es7.global":371,"./modules/es7.map.from":372,"./modules/es7.map.of":373,"./modules/es7.map.to-json":374,"./modules/es7.math.clamp":375,"./modules/es7.math.deg-per-rad":376,"./modules/es7.math.degrees":377,"./modules/es7.math.fscale":378,"./modules/es7.math.iaddh":379,"./modules/es7.math.imulh":380,"./modules/es7.math.isubh":381,"./modules/es7.math.rad-per-deg":382,"./modules/es7.math.radians":383,"./modules/es7.math.scale":384,"./modules/es7.math.signbit":385,"./modules/es7.math.umulh":386,"./modules/es7.object.define-getter":387,"./modules/es7.object.define-setter":388,"./modules/es7.object.entries":389,"./modules/es7.object.get-own-property-descriptors":390,"./modules/es7.object.lookup-getter":391,"./modules/es7.object.lookup-setter":392,"./modules/es7.object.values":393,"./modules/es7.observable":394,"./modules/es7.promise.finally":395,"./modules/es7.promise.try":396,"./modules/es7.reflect.define-metadata":397,"./modules/es7.reflect.delete-metadata":398,"./modules/es7.reflect.get-metadata":400,"./modules/es7.reflect.get-metadata-keys":399,"./modules/es7.reflect.get-own-metadata":402,"./modules/es7.reflect.get-own-metadata-keys":401,"./modules/es7.reflect.has-metadata":403,"./modules/es7.reflect.has-own-metadata":404,"./modules/es7.reflect.metadata":405,"./modules/es7.set.from":406,"./modules/es7.set.of":407,"./modules/es7.set.to-json":408,"./modules/es7.string.at":409,"./modules/es7.string.match-all":410,"./modules/es7.string.pad-end":411,"./modules/es7.string.pad-start":412,"./modules/es7.string.trim-left":413,"./modules/es7.string.trim-right":414,"./modules/es7.symbol.async-iterator":415,"./modules/es7.symbol.observable":416,"./modules/es7.system.global":417,"./modules/es7.weak-map.from":418,"./modules/es7.weak-map.of":419,"./modules/es7.weak-set.from":420,"./modules/es7.weak-set.of":421,"./modules/web.dom.iterable":422,"./modules/web.immediate":423,"./modules/web.timers":424}],426:[function(require,module,exports){ +(function (global){ +module.exports = false; + +// Only Node.JS has a process variable that is of [[Class]] process +try { + module.exports = Object.prototype.toString.call(global.process) === '[object process]' +} catch(e) {} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],427:[function(require,module,exports){ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// This method of obtaining a reference to the global object needs to be +// kept identical to the way it is obtained in runtime.js +var g = (function() { return this })() || Function("return this")(); + +// Use `getOwnPropertyNames` because not all browsers support calling +// `hasOwnProperty` on the global `self` object in a worker. See #183. +var hadRuntime = g.regeneratorRuntime && + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; + +// Save the old regeneratorRuntime in case it needs to be restored later. +var oldRuntime = hadRuntime && g.regeneratorRuntime; + +// Force reevalutation of runtime.js. +g.regeneratorRuntime = undefined; + +module.exports = require("./runtime"); + +if (hadRuntime) { + // Restore the original runtime. + g.regeneratorRuntime = oldRuntime; +} else { + // Remove the global property added by runtime.js. + try { + delete g.regeneratorRuntime; + } catch(e) { + g.regeneratorRuntime = undefined; + } +} + +},{"./runtime":428}],428:[function(require,module,exports){ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // In sloppy mode, unbound `this` refers to the global object, fallback to + // Function constructor if we're in global strict mode. That is sadly a form + // of indirect eval which violates Content Security Policy. + (function() { return this })() || Function("return this")() +); + +},{}],429:[function(require,module,exports){ +'use strict'; + +var _regenerator = require('babel-runtime/regenerator'); + +var _regenerator2 = _interopRequireDefault(_regenerator); + +var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); + +var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); + +var _typeof2 = require('babel-runtime/helpers/typeof'); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _util = require('./util.js'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/* eslint-disable */ +/** + * used in docs/index.html + */ +require('babel-polyfill'); +var BroadcastChannel = require('../../'); + + +var methodType = (0, _util.getParameterByName)('methodType'); +if (!methodType || methodType === '' || methodType === 'default') methodType = undefined; + +// set select-input +var selectEl = document.getElementById('method-type-select'); +selectEl.onchange = function (ev) { + var newValue = selectEl.value; + var newUrl = location.origin + location.pathname + '?methodType=' + newValue; + location = newUrl; +}; +if (methodType) { + selectEl.value = methodType; +} + +var TEST_MESSAGES = 50; +var body = document.getElementById('body'); +var msgContainer = document.getElementById('messages'); +var rightContainer = document.getElementById('right'); +var messageCountContainer = document.getElementById('msg-count'); +var stateContainer = document.getElementById('state'); +var iframeEl = document.getElementById('test-iframe'); + +document.getElementById('user-agent').innerHTML = navigator.userAgent; + +var startTime; +var options = {}; +console.log('++++++'); +console.log(typeof BroadcastChannel === 'undefined' ? 'undefined' : (0, _typeof3['default'])(BroadcastChannel)); +var channel = new BroadcastChannel('foobar', { + type: methodType +}); +document.getElementById('method').innerHTML = channel.type; + +/** + * to measure the speed, we: + * 1. send message + * 2. wait until iframe and worker answers + * 3. repeat from 1. for TEST_MESSAGES times + */ +var messagesSend = 0; +var answerPool = {}; +var useWorker = false; + +function gotAllAnswers(answerPool) { + if (!answerPool.iframe) return false; + if (useWorker && !answerPool.worker) return false; + return true; +} + +channel.onmessage = function (msg) { + console.log('main: recieved msg' + JSON.stringify(msg)); + + answerPool[msg.from] = msg; + var textnode = document.createTextNode(JSON.stringify(msg) + '
'); + msgContainer.appendChild(textnode); + + if (gotAllAnswers(answerPool)) { + answerPool = {}; // reset + + if (messagesSend >= TEST_MESSAGES) { + // sucess + console.log('main: sucess'); + body.style.backgroundColor = 'green'; + stateContainer.innerHTML = 'SUCCESS'; + var amountTime = new Date().getTime() - startTime; + document.getElementById('time-amount').innerHTML = amountTime + 'ms'; + } else { + // send next message + messagesSend++; + console.log('main: send next message (' + messagesSend + ') ===================='); + messageCountContainer.innerHTML = messagesSend; + channel.postMessage({ + from: 'main', + foo: 'bar', + step: messagesSend + }); + } + } +}; + +var run = function () { + var _ref = (0, _asyncToGenerator3['default'])( /*#__PURE__*/_regenerator2['default'].mark(function _callee() { + var rand, worker; + return _regenerator2['default'].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + rand = new Date().getTime(); + + console.log('aaaa'); + + // load iframe + iframeEl.src = './iframe.html?channelName=' + channel.name + '&methodType=' + channel.type + '&t=' + rand; + _context.next = 5; + return new Promise(function (res) { + return iframeEl.onload = function () { + return res(); + }; + }); + + case 5: + console.log('main: Iframe has loaded'); + + // spawn web-worker if possible + + if (!(channel.type !== 'localstorage' && typeof window.Worker === 'function')) { + _context.next = 12; + break; + } + + useWorker = true; + worker = new Worker('worker.js?t=' + rand); + + worker.onerror = function (event) { + throw new Error('worker: ' + event.message + " (" + event.filename + ":" + event.lineno + ")"); + }; + _context.next = 12; + return new Promise(function (res) { + worker.addEventListener('message', function (e) { + // run when message returned, so we know the worker has started + console.log('main: Worker has started'); + res(); + }, false); + worker.postMessage({ + 'cmd': 'start', + 'msg': { + channelName: channel.name, + methodType: channel.type + } + }); + }); + + case 12: + console.log('========== START SENDING MESSAGES ' + channel.type); + startTime = new Date().getTime(); + channel.postMessage({ + from: 'main', + step: 0 + }); + console.log('main: message send (0)'); + + case 16: + case 'end': + return _context.stop(); + } + } + }, _callee, this); + })); + + return function run() { + return _ref.apply(this, arguments); + }; +}(); +run(); +},{"../../":1,"./util.js":430,"babel-polyfill":9,"babel-runtime/helpers/asyncToGenerator":14,"babel-runtime/helpers/typeof":15,"babel-runtime/regenerator":16}],430:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getParameterByName = getParameterByName; +// https://stackoverflow.com/a/901144/3443137 +function getParameterByName(name, url) { + if (!url) url = window.location.href; + name = name.replace(/[\[\]]/g, '\\$&'); + var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); + var results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, ' ')); +} +},{}]},{},[429]); diff --git a/docs/kirby.gif b/docs/kirby.gif new file mode 100644 index 00000000..5adbfb9f Binary files /dev/null and b/docs/kirby.gif differ diff --git a/docs/worker.js b/docs/worker.js new file mode 100644 index 00000000..2ebd2f07 --- /dev/null +++ b/docs/worker.js @@ -0,0 +1,8423 @@ +(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 setTimeout(res, this.options.prepareDelay)); + }*/ + channel._state = s; + }); + } else { + channel._state = maybePromise; + } +} + +function _hasMessageListeners(channel) { + if (channel._addEventListeners.message.length > 0) return true; + if (channel._addEventListeners.internal.length > 0) return true; + return false; +} + +function _addListenerObject(channel, type, obj) { + channel._addEventListeners[type].push(obj); + _startListening(channel); +} +function _removeListenerObject(channel, type, obj) { + channel._addEventListeners[type] = channel._addEventListeners[type].filter(function (o) { + return o !== obj; + }); + _stopListening(channel); +} + +function _startListening(channel) { + if (!channel._isListening && _hasMessageListeners(channel)) { + // someone is listening, start subscribing + + var listenerFn = function listenerFn(msgObj) { + channel._addEventListeners[msgObj.type].forEach(function (obj) { + if (msgObj.time >= obj.time) { + obj.fn(msgObj.data); + }; + }); + }; + + var time = new Date().getTime() - 5; + if (channel._preparePromise) { + channel._preparePromise.then(function () { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + }); + } else { + channel._isListening = true; + channel.method.onMessage(channel._state, listenerFn, time); + } + } +} + +function _stopListening(channel) { + if (channel._isListening && !_hasMessageListeners(channel)) { + // noone is listening, stop subscribing + channel._isListening = false; + var time = new Date().getTime() - 5; + channel.method.onMessage(channel._state, null, time); + } +} + +exports['default'] = BroadcastChannel; +},{"./method-chooser.js":3,"./options.js":7,"./util.js":8}],3:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.chooseMethod = chooseMethod; +var isNode = require('detect-node'); + +var NativeMethod = require('./methods/native.js'); +var IndexeDbMethod = require('./methods/indexed-db.js'); +var LocalstorageMethod = require('./methods/localstorage.js'); + +// order is important +var METHODS = [NativeMethod, // fastest +IndexeDbMethod, LocalstorageMethod]; + +var REQUIRE_FUN = require; + +/** + * The NodeMethod is loaded lazy + * so it will not get bundled in browser-builds + */ +if (isNode) { + var NodeMethod = REQUIRE_FUN('./methods/node.js'); + METHODS.push(NodeMethod); +} + +function chooseMethod(options) { + // directly chosen + if (options.type) { + var ret = METHODS.find(function (m) { + return m.type === options.type; + }); + if (!ret) throw new Error('method-type ' + options.type + ' not found');else return ret; + } + + var chooseMethods = METHODS; + if (!options.webWorkerSupport && !isNode) { + // prefer localstorage over idb when no webworker-support needed + chooseMethods = METHODS.filter(function (m) { + return m.type !== 'idb'; + }); + } + + var useMethod = chooseMethods.find(function (method) { + return method.canBeUsed(); + }); + if (!useMethod) throw new Error('No useable methode found:' + JSON.stringify(METHODS.map(function (m) { + return m.type; + })));else return useMethod; +} +},{"./methods/indexed-db.js":4,"./methods/localstorage.js":5,"./methods/native.js":6,"detect-node":335}],4:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getIdb = getIdb; +exports.createDatabase = createDatabase; +exports.writeMessage = writeMessage; +exports.getAllMessages = getAllMessages; +exports.getMessagesHigherThen = getMessagesHigherThen; +exports.removeMessageById = removeMessageById; +exports.getOldMessages = getOldMessages; +exports.cleanOldMessages = cleanOldMessages; +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _util = require('../util.js'); + +var _options = require('../options'); + +/** + * this method uses indexeddb to store the messages + * There is currently no observerAPI for idb + * @link https://github.com/w3c/IndexedDB/issues/51 + */ + +var isNode = require('detect-node'); + +var DB_PREFIX = 'pubkey.broadcast-channel-0-'; +var OBJECT_STORE_ID = 'messages'; + +var type = exports.type = 'idb'; + +function getIdb() { + if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof mozIndexedDB !== 'undefined') return mozIndexedDB; + if (typeof webkitIndexedDB !== 'undefined') return webkitIndexedDB; + if (typeof msIndexedDB !== 'undefined') return msIndexedDB; + + return false; +} + +function createDatabase(channelName) { + var IndexedDB = getIdb(); + + // create table + var dbName = DB_PREFIX + channelName; + var openRequest = IndexedDB.open(dbName, 1); + + openRequest.onupgradeneeded = function (ev) { + var db = ev.target.result; + db.createObjectStore(OBJECT_STORE_ID, { + keyPath: 'id', + autoIncrement: true + }); + }; + var dbPromise = new Promise(function (res, rej) { + openRequest.onerror = function (ev) { + return rej(ev); + }; + openRequest.onsuccess = function () { + res(openRequest.result); + }; + }); + + return dbPromise; +} + +/** + * writes the new message to the database + * so other readers can find it + */ +function writeMessage(db, readerUuid, messageJson) { + var time = new Date().getTime(); + var writeObject = { + uuid: readerUuid, + time: time, + data: messageJson + }; + + var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); + + return new Promise(function (res, rej) { + transaction.oncomplete = function () { + return res(); + }; + transaction.onerror = function (ev) { + return rej(ev); + }; + + var objectStore = transaction.objectStore(OBJECT_STORE_ID); + objectStore.add(writeObject); + }); +} + +function getAllMessages(db) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function getMessagesHigherThen(db, lastCursorId) { + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity); + return new Promise(function (res) { + objectStore.openCursor(keyRangeValue).onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + res(ret); + } + }; + }); +} + +function removeMessageById(db, id) { + var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)['delete'](id); + return new Promise(function (res) { + request.onsuccess = function () { + return res(); + }; + }); +} + +function getOldMessages(db, ttl) { + var olderThen = new Date().getTime() - ttl; + var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + var ret = []; + return new Promise(function (res) { + objectStore.openCursor().onsuccess = function (ev) { + var cursor = ev.target.result; + if (cursor) { + var msgObk = cursor.value; + if (msgObk.time < olderThen) { + ret.push(msgObk); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor['continue'](); + } else { + // no more old messages, + res(ret); + return; + } + } else { + res(ret); + } + }; + }); +} + +function cleanOldMessages(db, ttl) { + return getOldMessages(db, ttl).then(function (tooOld) { + return Promise.all(tooOld.map(function (msgObj) { + return removeMessageById(db, msgObj.id); + })); + }); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + + var uuid = (0, _util.randomToken)(10); + + return createDatabase(channelName).then(function (db) { + var state = { + closed: false, + lastCursorId: 0, + channelName: channelName, + options: options, + uuid: uuid, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallback: null, + readQueuePromises: [], + db: db + }; + + /** + * if service-workers are used, + * we have no 'storage'-event if they post a message, + * therefore we also have to set an interval + */ + _readLoop(state); + + return state; + }); +} + +function _readLoop(state) { + if (state.closed) return; + + return readNewMessages(state).then(function () { + return (0, _util.sleep)(state.options.idb.fallbackInterval); + }).then(function () { + return _readLoop(state); + }); +} + +/** + * reads all new messages from the database and emits them + */ +function readNewMessages(state) { + return getMessagesHigherThen(state.db, state.lastCursorId).then(function (newerMessages) { + var useMessages = newerMessages.map(function (msgObj) { + if (msgObj.id > state.lastCursorId) { + state.lastCursorId = msgObj.id; + } + return msgObj; + }).filter(function (msgObj) { + return msgObj.uuid !== state.uuid; + }) // not send by own + .filter(function (msgObj) { + return !state.emittedMessagesIds.has(msgObj.id); + }) // not already emitted + .filter(function (msgObj) { + return msgObj.time >= state.messagesCallbackTime; + }) // not older then onMessageCallback + .sort(function (msgObjA, msgObjB) { + return msgObjA.time - msgObjB.time; + }); // sort by time + + + useMessages.forEach(function (msgObj) { + if (state.messagesCallback) { + state.emittedMessagesIds.add(msgObj.id); + setTimeout(function () { + return state.emittedMessagesIds['delete'](msgObj.id); + }, state.options.idb.ttl * 2); + + state.messagesCallback(msgObj.data); + } + }); + + return Promise.resolve(); + }); +} + +function close(channelState) { + channelState.closed = true; + channelState.db.close(); +} + +function postMessage(channelState, messageJson) { + return writeMessage(channelState.db, channelState.uuid, messageJson).then(function () { + if ((0, _util.randomInt)(0, 10) === 0) { + /* await (do not await) */cleanOldMessages(channelState.db, channelState.options.idb.ttl); + } + }); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + readNewMessages(channelState); +} + +function canBeUsed() { + if (isNode) return false; + var idb = getIdb(); + + if (!idb) return false; + return true; +}; +},{"../options":7,"../util.js":8,"detect-node":335}],5:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.type = undefined; +exports.getLocalStorage = getLocalStorage; +exports.storageKey = storageKey; +exports.postMessage = postMessage; +exports.addStorageEventListener = addStorageEventListener; +exports.removeStorageEventListener = removeStorageEventListener; +exports.create = create; +exports.close = close; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; + +var _options = require('../options'); + +var _util = require('../util'); + +/** + * A localStorage-only method which uses localstorage and its 'storage'-event + * This does not work inside of webworkers because they have no access to locastorage + * This is basically implemented to support IE9 or your grandmothers toaster. + * @link https://caniuse.com/#feat=namevalue-storage + * @link https://caniuse.com/#feat=indexeddb + */ + +var isNode = require('detect-node'); + +var KEY_PREFIX = 'pubkey.broadcastChannel-'; +var type = exports.type = 'localstorage'; + +/** + * copied from crosstab + * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32 + */ +function getLocalStorage() { + var localStorage = void 0; + if (typeof window === 'undefined') return null; + try { + localStorage = window.localStorage; + localStorage = window['ie8-eventlistener/storage'] || window.localStorage; + } catch (e) { + // New versions of Firefox throw a Security exception + // if cookies are disabled. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153 + } + return localStorage; +} + +function storageKey(channelName) { + return KEY_PREFIX + channelName; +} + +/** +* writes the new message to the storage +* and fires the storage-event so other readers can find it +*/ +function postMessage(channelState, messageJson) { + return new Promise(function (res) { + (0, _util.sleep)().then(function () { + var key = storageKey(channelState.channelName); + var writeObj = { + token: (0, _util.randomToken)(10), + time: new Date().getTime(), + data: messageJson, + uuid: channelState.uuid + }; + var value = JSON.stringify(writeObj); + localStorage.setItem(key, value); + + /** + * StorageEvent does not fire the 'storage' event + * in the window that changes the state of the local storage. + * So we fire it manually + */ + var ev = document.createEvent('Event'); + ev.initEvent('storage', true, true); + ev.key = key; + ev.newValue = value; + window.dispatchEvent(ev); + + res(); + }); + }); +} + +function addStorageEventListener(channelName, fn) { + var key = storageKey(channelName); + var listener = function listener(ev) { + if (ev.key === key) { + fn(JSON.parse(ev.newValue)); + } + }; + window.addEventListener('storage', listener); + return listener; +} +function removeStorageEventListener(listener) { + window.removeEventListener('storage', listener); +} + +function create(channelName, options) { + options = (0, _options.fillOptionsWithDefaults)(options); + if (!canBeUsed()) { + throw new Error('BroadcastChannel: localstorage cannot be used'); + } + + var startTime = new Date().getTime(); + var uuid = (0, _util.randomToken)(10); + + // contains all messages that have been emitted before + var emittedMessagesIds = new Set(); + + var state = { + startTime: startTime, + channelName: channelName, + options: options, + uuid: uuid, + emittedMessagesIds: emittedMessagesIds + }; + + state.listener = addStorageEventListener(channelName, function (msgObj) { + if (!state.messagesCallback) return; // no listener + if (msgObj.uuid === uuid) return; // own message + if (!msgObj.token || emittedMessagesIds.has(msgObj.token)) return; // already emitted + if (msgObj.time && msgObj.time < state.messagesCallbackTime) return; // too old + + emittedMessagesIds.add(msgObj.token); + setTimeout(function () { + return emittedMessagesIds['delete'](msgObj.token); + }, options.localstorage.removeTimeout); + state.messagesCallback(msgObj.data); + }); + + return state; +} + +function close(channelState) { + removeStorageEventListener(channelState.listener); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + var ls = getLocalStorage(); + + if (!ls) return false; + return true; +}; +},{"../options":7,"../util":8,"detect-node":335}],6:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.create = create; +exports.close = close; +exports.postMessage = postMessage; +exports.onMessage = onMessage; +exports.canBeUsed = canBeUsed; +var isNode = require('detect-node'); + +var type = exports.type = 'native'; + +function create(channelName, options) { + if (!options) options = {}; + var state = { + channelName: channelName, + options: options, + messagesCallback: null, + bc: new BroadcastChannel(channelName), + subscriberFunctions: [] + }; + + state.bc.onmessage = function (msg) { + if (state.messagesCallback) { + state.messagesCallback(msg.data); + } + }; + + return state; +}; + +function close(channelState) { + channelState.bc.close(); + channelState.subscriberFunctions = []; +} + +function postMessage(channelState, messageJson) { + channelState.bc.postMessage(messageJson, false); +} + +function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +function canBeUsed() { + if (isNode) return false; + + if (typeof BroadcastChannel === 'function') return true; +}; +},{"detect-node":335}],7:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.fillOptionsWithDefaults = fillOptionsWithDefaults; +function fillOptionsWithDefaults(options) { + if (!options) options = {}; + options = JSON.parse(JSON.stringify(options)); + + // main + if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; + + // indexed-db + if (!options.idb) options.idb = {}; + // after this time the messages get deleted + if (!options.idb.ttl) options.idb.ttl = 1000 * 45; + if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 50; + + // localstorage + if (!options.localstorage) options.localstorage = {}; + if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; + + // node + if (!options.node) options.node = {}; + if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes; + + return options; +} +},{}],8:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isPromise = isPromise; +exports.sleep = sleep; +exports.randomInt = randomInt; +exports.randomToken = randomToken; +/** + * returns true if the given object is a promise + */ +function isPromise(obj) { + if (obj && typeof obj.then === 'function') { + return true; + } else { + return false; + } +} + +function sleep(time) { + if (!time) time = 0; + return new Promise(function (res) { + return setTimeout(res, time); + }); +} + +function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +/** + * https://stackoverflow.com/a/1349426/3443137 + */ +function randomToken(length) { + var text = ''; + var possible = 'abcdefghijklmnopqrstuvwxzy0123456789'; + + for (var i = 0; i < 5; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + }return text; +} +},{}],9:[function(require,module,exports){ +(function (global){ +"use strict"; + +require("core-js/shim"); + +require("regenerator-runtime/runtime"); + +require("core-js/fn/regexp/escape"); + +if (global._babelPolyfill) { + throw new Error("only one instance of babel-polyfill is allowed"); +} +global._babelPolyfill = true; + +var DEFINE_PROPERTY = "defineProperty"; +function define(O, key, value) { + O[key] || Object[DEFINE_PROPERTY](O, key, { + writable: true, + configurable: true, + value: value + }); +} + +define(String.prototype, "padLeft", "".padStart); +define(String.prototype, "padRight", "".padEnd); + +"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) { + [][key] && define(Array, key, Function.call.bind([][key])); +}); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"core-js/fn/regexp/escape":11,"core-js/shim":334,"regenerator-runtime/runtime":10}],10:[function(require,module,exports){ +(function (global){ +/** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * https://raw.github.com/facebook/regenerator/master/LICENSE file. An + * additional grant of patent rights can be found in the PATENTS file in + * the same directory. + */ + +!(function(global) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + var inModule = typeof module === "object"; + var runtime = global.regeneratorRuntime; + if (runtime) { + if (inModule) { + // If regeneratorRuntime is defined globally and we're in a module, + // make the exports object identical to regeneratorRuntime. + module.exports = runtime; + } + // Don't bother evaluating the rest of this file if the runtime was + // already defined globally. + return; + } + + // Define the runtime globally (as expected by generated code) as either + // module.exports (if we're in a module) or a new, empty object. + runtime = global.regeneratorRuntime = inModule ? module.exports : {}; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + runtime.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + runtime.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + runtime.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + runtime.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. If the Promise is rejected, however, the + // result for this iteration will be rejected with the same + // reason. Note that rejections of yielded Promises are not + // thrown back into the generator function, as is the case + // when an awaited Promise is rejected. This difference in + // behavior between yield and await is important, because it + // allows the consumer to decide what to do with the yielded + // rejection (swallow it and continue, manually .throw it back + // into the generator, abandon iteration, whatever). With + // await, by contrast, there is no opportunity to examine the + // rejection reason outside the generator function, so the + // only option is to throw it from the await expression, and + // let the generator function handle the exception. + result.value = unwrapped; + resolve(result); + }, reject); + } + } + + if (typeof global.process === "object" && global.process.domain) { + invoke = global.process.domain.bind(invoke); + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + runtime.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + runtime.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return runtime.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + runtime.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + runtime.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; +})( + // Among the various tricks for obtaining a reference to the global + // object, this seems to be the most reliable technique that does not + // use indirect eval (which violates Content Security Policy). + typeof global === "object" ? global : + typeof window === "object" ? window : + typeof self === "object" ? self : this +); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],11:[function(require,module,exports){ +require('../../modules/core.regexp.escape'); +module.exports = require('../../modules/_core').RegExp.escape; + +},{"../../modules/_core":32,"../../modules/core.regexp.escape":137}],12:[function(require,module,exports){ +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; + +},{}],13:[function(require,module,exports){ +var cof = require('./_cof'); +module.exports = function (it, msg) { + if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg); + return +it; +}; + +},{"./_cof":27}],14:[function(require,module,exports){ +// 22.1.3.31 Array.prototype[@@unscopables] +var UNSCOPABLES = require('./_wks')('unscopables'); +var ArrayProto = Array.prototype; +if (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {}); +module.exports = function (key) { + ArrayProto[UNSCOPABLES][key] = true; +}; + +},{"./_hide":51,"./_wks":135}],15:[function(require,module,exports){ +module.exports = function (it, Constructor, name, forbiddenField) { + if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { + throw TypeError(name + ': incorrect invocation!'); + } return it; +}; + +},{}],16:[function(require,module,exports){ +var isObject = require('./_is-object'); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; + +},{"./_is-object":60}],17:[function(require,module,exports){ +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +'use strict'; +var toObject = require('./_to-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); + +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 = Math.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; +}; + +},{"./_to-absolute-index":120,"./_to-length":124,"./_to-object":125}],18:[function(require,module,exports){ +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +'use strict'; +var toObject = require('./_to-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +module.exports = function fill(value /* , start = 0, end = @length */) { + var O = toObject(this); + var length = toLength(O.length); + var aLen = arguments.length; + var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); + var end = aLen > 2 ? arguments[2] : undefined; + var endPos = end === undefined ? length : toAbsoluteIndex(end, length); + while (endPos > index) O[index++] = value; + return O; +}; + +},{"./_to-absolute-index":120,"./_to-length":124,"./_to-object":125}],19:[function(require,module,exports){ +var forOf = require('./_for-of'); + +module.exports = function (iter, ITERATOR) { + var result = []; + forOf(iter, false, result.push, result, ITERATOR); + return result; +}; + +},{"./_for-of":48}],20:[function(require,module,exports){ +// false -> Array#indexOf +// true -> Array#includes +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); +var toAbsoluteIndex = require('./_to-absolute-index'); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($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) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; + +},{"./_to-absolute-index":120,"./_to-iobject":123,"./_to-length":124}],21:[function(require,module,exports){ +// 0 -> Array#forEach +// 1 -> Array#map +// 2 -> Array#filter +// 3 -> Array#some +// 4 -> Array#every +// 5 -> Array#find +// 6 -> Array#findIndex +var ctx = require('./_ctx'); +var IObject = require('./_iobject'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var asc = require('./_array-species-create'); +module.exports = function (TYPE, $create) { + 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; + var create = $create || asc; + return function ($this, callbackfn, that) { + var O = toObject($this); + var self = IObject(O); + var f = ctx(callbackfn, that, 3); + var length = toLength(self.length); + var index = 0; + var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; + var val, res; + for (;length > index; index++) if (NO_HOLES || index in self) { + val = self[index]; + res = f(val, index, O); + if (TYPE) { + if (IS_MAP) result[index] = res; // map + else if (res) switch (TYPE) { + case 3: return true; // some + case 5: return val; // find + case 6: return index; // findIndex + case 2: result.push(val); // filter + } else if (IS_EVERY) return false; // every + } + } + return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; + }; +}; + +},{"./_array-species-create":24,"./_ctx":34,"./_iobject":56,"./_to-length":124,"./_to-object":125}],22:[function(require,module,exports){ +var aFunction = require('./_a-function'); +var toObject = require('./_to-object'); +var IObject = require('./_iobject'); +var toLength = require('./_to-length'); + +module.exports = function (that, callbackfn, aLen, memo, isRight) { + aFunction(callbackfn); + var O = toObject(that); + var self = IObject(O); + var length = toLength(O.length); + var index = isRight ? length - 1 : 0; + var i = isRight ? -1 : 1; + if (aLen < 2) for (;;) { + if (index in self) { + memo = self[index]; + index += i; + break; + } + index += i; + if (isRight ? index < 0 : length <= index) { + throw TypeError('Reduce of empty array with no initial value'); + } + } + for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { + memo = callbackfn(memo, self[index], index, O); + } + return memo; +}; + +},{"./_a-function":12,"./_iobject":56,"./_to-length":124,"./_to-object":125}],23:[function(require,module,exports){ +var isObject = require('./_is-object'); +var isArray = require('./_is-array'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (original) { + var C; + if (isArray(original)) { + C = original.constructor; + // cross-realm fallback + if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; + if (isObject(C)) { + C = C[SPECIES]; + if (C === null) C = undefined; + } + } return C === undefined ? Array : C; +}; + +},{"./_is-array":58,"./_is-object":60,"./_wks":135}],24:[function(require,module,exports){ +// 9.4.2.3 ArraySpeciesCreate(originalArray, length) +var speciesConstructor = require('./_array-species-constructor'); + +module.exports = function (original, length) { + return new (speciesConstructor(original))(length); +}; + +},{"./_array-species-constructor":23}],25:[function(require,module,exports){ +'use strict'; +var aFunction = require('./_a-function'); +var isObject = require('./_is-object'); +var invoke = require('./_invoke'); +var arraySlice = [].slice; +var factories = {}; + +var construct = function (F, len, args) { + if (!(len in factories)) { + for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; + // eslint-disable-next-line no-new-func + factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); + } return factories[len](F, args); +}; + +module.exports = Function.bind || function bind(that /* , ...args */) { + var fn = aFunction(this); + var partArgs = arraySlice.call(arguments, 1); + var bound = function (/* args... */) { + var args = partArgs.concat(arraySlice.call(arguments)); + return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); + }; + if (isObject(fn.prototype)) bound.prototype = fn.prototype; + return bound; +}; + +},{"./_a-function":12,"./_invoke":55,"./_is-object":60}],26:[function(require,module,exports){ +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = require('./_cof'); +var TAG = require('./_wks')('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; + +},{"./_cof":27,"./_wks":135}],27:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; + +},{}],28:[function(require,module,exports){ +'use strict'; +var dP = require('./_object-dp').f; +var create = require('./_object-create'); +var redefineAll = require('./_redefine-all'); +var ctx = require('./_ctx'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var $iterDefine = require('./_iter-define'); +var step = require('./_iter-step'); +var setSpecies = require('./_set-species'); +var DESCRIPTORS = require('./_descriptors'); +var fastKey = require('./_meta').fastKey; +var validate = require('./_validate-collection'); +var SIZE = DESCRIPTORS ? '_s' : 'size'; + +var getEntry = function (that, key) { + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return that._i[index]; + // frozen object case + for (entry = that._f; entry; entry = entry.n) { + if (entry.k == key) return entry; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = create(null); // index + that._f = undefined; // first entry + that._l = undefined; // last entry + that[SIZE] = 0; // size + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.1.3.1 Map.prototype.clear() + // 23.2.3.2 Set.prototype.clear() + clear: function clear() { + for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { + entry.r = true; + if (entry.p) entry.p = entry.p.n = undefined; + delete data[entry.i]; + } + that._f = that._l = undefined; + that[SIZE] = 0; + }, + // 23.1.3.3 Map.prototype.delete(key) + // 23.2.3.4 Set.prototype.delete(value) + 'delete': function (key) { + var that = validate(this, NAME); + var entry = getEntry(that, key); + if (entry) { + var next = entry.n; + var prev = entry.p; + delete that._i[entry.i]; + entry.r = true; + if (prev) prev.n = next; + if (next) next.p = prev; + if (that._f == entry) that._f = next; + if (that._l == entry) that._l = prev; + 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 */) { + validate(this, NAME); + var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var entry; + while (entry = entry ? entry.n : this._f) { + f(entry.v, entry.k, this); + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + } + }, + // 23.1.3.7 Map.prototype.has(key) + // 23.2.3.7 Set.prototype.has(value) + has: function has(key) { + return !!getEntry(validate(this, NAME), key); + } + }); + if (DESCRIPTORS) dP(C.prototype, 'size', { + get: function () { + return validate(this, NAME)[SIZE]; + } + }); + return C; + }, + def: function (that, key, value) { + var entry = getEntry(that, key); + var prev, index; + // change existing entry + if (entry) { + entry.v = value; + // create new entry + } else { + that._l = entry = { + i: index = fastKey(key, true), // <- index + k: key, // <- key + v: value, // <- value + p: prev = that._l, // <- previous entry + n: undefined, // <- next entry + r: false // <- removed + }; + if (!that._f) that._f = entry; + if (prev) prev.n = entry; + that[SIZE]++; + // add to index + if (index !== 'F') that._i[index] = entry; + } return that; + }, + getEntry: getEntry, + setStrong: function (C, NAME, IS_MAP) { + // 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 + $iterDefine(C, NAME, function (iterated, kind) { + this._t = validate(iterated, NAME); // target + this._k = kind; // kind + this._l = undefined; // previous + }, function () { + var that = this; + var kind = that._k; + var entry = that._l; + // revert to the last existing entry + while (entry && entry.r) entry = entry.p; + // get next entry + if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { + // or finish the iteration + that._t = undefined; + return step(1); + } + // return step by kind + if (kind == 'keys') return step(0, entry.k); + if (kind == 'values') return step(0, entry.v); + return step(0, [entry.k, entry.v]); + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + + // add [@@species], 23.1.2.2, 23.2.2.2 + setSpecies(NAME); + } +}; + +},{"./_an-instance":15,"./_ctx":34,"./_descriptors":38,"./_for-of":48,"./_iter-define":64,"./_iter-step":66,"./_meta":74,"./_object-create":79,"./_object-dp":80,"./_redefine-all":99,"./_set-species":106,"./_validate-collection":132}],29:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var classof = require('./_classof'); +var from = require('./_array-from-iterable'); +module.exports = function (NAME) { + return function toJSON() { + if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); + return from(this); + }; +}; + +},{"./_array-from-iterable":19,"./_classof":26}],30:[function(require,module,exports){ +'use strict'; +var redefineAll = require('./_redefine-all'); +var getWeak = require('./_meta').getWeak; +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var createArrayMethod = require('./_array-methods'); +var $has = require('./_has'); +var validate = require('./_validate-collection'); +var arrayFind = createArrayMethod(5); +var arrayFindIndex = createArrayMethod(6); +var id = 0; + +// fallback for uncaught frozen keys +var uncaughtFrozenStore = function (that) { + return that._l || (that._l = new UncaughtFrozenStore()); +}; +var UncaughtFrozenStore = function () { + this.a = []; +}; +var findUncaughtFrozen = function (store, key) { + return arrayFind(store.a, function (it) { + return it[0] === key; + }); +}; +UncaughtFrozenStore.prototype = { + get: function (key) { + var entry = findUncaughtFrozen(this, key); + if (entry) return entry[1]; + }, + has: function (key) { + return !!findUncaughtFrozen(this, key); + }, + set: function (key, value) { + var entry = findUncaughtFrozen(this, key); + if (entry) entry[1] = value; + else this.a.push([key, value]); + }, + 'delete': function (key) { + var index = arrayFindIndex(this.a, function (it) { + return it[0] === key; + }); + if (~index) this.a.splice(index, 1); + return !!~index; + } +}; + +module.exports = { + getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { + var C = wrapper(function (that, iterable) { + anInstance(that, C, NAME, '_i'); + that._t = NAME; // collection type + that._i = id++; // collection id + that._l = undefined; // leak store for uncaught frozen objects + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + }); + redefineAll(C.prototype, { + // 23.3.3.2 WeakMap.prototype.delete(key) + // 23.4.3.3 WeakSet.prototype.delete(value) + 'delete': function (key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); + return data && $has(data, this._i) && delete data[this._i]; + }, + // 23.3.3.4 WeakMap.prototype.has(key) + // 23.4.3.4 WeakSet.prototype.has(value) + has: function has(key) { + if (!isObject(key)) return false; + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); + return data && $has(data, this._i); + } + }); + return C; + }, + def: function (that, key, value) { + var data = getWeak(anObject(key), true); + if (data === true) uncaughtFrozenStore(that).set(key, value); + else data[that._i] = value; + return that; + }, + ufstore: uncaughtFrozenStore +}; + +},{"./_an-instance":15,"./_an-object":16,"./_array-methods":21,"./_for-of":48,"./_has":50,"./_is-object":60,"./_meta":74,"./_redefine-all":99,"./_validate-collection":132}],31:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var redefineAll = require('./_redefine-all'); +var meta = require('./_meta'); +var forOf = require('./_for-of'); +var anInstance = require('./_an-instance'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var $iterDetect = require('./_iter-detect'); +var setToStringTag = require('./_set-to-string-tag'); +var inheritIfRequired = require('./_inherit-if-required'); + +module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { + var Base = global[NAME]; + var C = Base; + var ADDER = IS_MAP ? 'set' : 'add'; + var proto = C && C.prototype; + var O = {}; + var fixMethod = function (KEY) { + var fn = proto[KEY]; + redefine(proto, KEY, + KEY == 'delete' ? function (a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'has' ? function has(a) { + return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'get' ? function get(a) { + return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); + } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } + : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } + ); + }; + if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { + new C().entries().next(); + }))) { + // create collection constructor + C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); + redefineAll(C.prototype, methods); + meta.NEED = true; + } else { + var instance = new C(); + // 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 + var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new + // 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 C(); + var index = 5; + while (index--) $instance[ADDER](index, index); + return !$instance.has(-0); + }); + if (!ACCEPT_ITERABLES) { + C = wrapper(function (target, iterable) { + anInstance(target, C, NAME); + var that = inheritIfRequired(new Base(), target, C); + if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); + return that; + }); + C.prototype = proto; + proto.constructor = C; + } + 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 && proto.clear) delete proto.clear; + } + + setToStringTag(C, NAME); + + O[NAME] = C; + $export($export.G + $export.W + $export.F * (C != Base), O); + + if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); + + return C; +}; + +},{"./_an-instance":15,"./_export":42,"./_fails":44,"./_for-of":48,"./_global":49,"./_inherit-if-required":54,"./_is-object":60,"./_iter-detect":65,"./_meta":74,"./_redefine":100,"./_redefine-all":99,"./_set-to-string-tag":107}],32:[function(require,module,exports){ +var core = module.exports = { version: '2.5.7' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + +},{}],33:[function(require,module,exports){ +'use strict'; +var $defineProperty = require('./_object-dp'); +var createDesc = require('./_property-desc'); + +module.exports = function (object, index, value) { + if (index in object) $defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; +}; + +},{"./_object-dp":80,"./_property-desc":98}],34:[function(require,module,exports){ +// optional / simple context binding +var aFunction = require('./_a-function'); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + 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); + }; +}; + +},{"./_a-function":12}],35:[function(require,module,exports){ +'use strict'; +// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() +var fails = require('./_fails'); +var getTime = Date.prototype.getTime; +var $toISOString = Date.prototype.toISOString; + +var lz = function (num) { + return num > 9 ? num : '0' + num; +}; + +// PhantomJS / old WebKit has a broken implementations +module.exports = (fails(function () { + return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; +}) || !fails(function () { + $toISOString.call(new Date(NaN)); +})) ? function toISOString() { + if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); + var d = this; + var y = d.getUTCFullYear(); + var m = d.getUTCMilliseconds(); + var s = y < 0 ? '-' : y > 9999 ? '+' : ''; + return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; +} : $toISOString; + +},{"./_fails":44}],36:[function(require,module,exports){ +'use strict'; +var anObject = require('./_an-object'); +var toPrimitive = require('./_to-primitive'); +var NUMBER = 'number'; + +module.exports = function (hint) { + if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint'); + return toPrimitive(anObject(this), hint != NUMBER); +}; + +},{"./_an-object":16,"./_to-primitive":126}],37:[function(require,module,exports){ +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; + +},{}],38:[function(require,module,exports){ +// Thank's IE8 for his funny defineProperty +module.exports = !require('./_fails')(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_fails":44}],39:[function(require,module,exports){ +var isObject = require('./_is-object'); +var document = require('./_global').document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; + +},{"./_global":49,"./_is-object":60}],40:[function(require,module,exports){ +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); + +},{}],41:[function(require,module,exports){ +// all enumerable object keys, includes symbols +var getKeys = require('./_object-keys'); +var gOPS = require('./_object-gops'); +var pIE = require('./_object-pie'); +module.exports = function (it) { + var result = getKeys(it); + var getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it); + var isEnum = pIE.f; + var i = 0; + var key; + while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); + } return result; +}; + +},{"./_object-gops":86,"./_object-keys":89,"./_object-pie":90}],42:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var hide = require('./_hide'); +var redefine = require('./_redefine'); +var ctx = require('./_ctx'); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); + var key, own, out, exp; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + // export native or passed + out = (own ? target : source)[key]; + // bind timers to global for call from export context + exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // extend global + if (target) redefine(target, key, out, type & $export.U); + // export + if (exports[key] != out) hide(exports, key, exp); + if (IS_PROTO && expProto[key] != out) expProto[key] = out; + } +}; +global.core = core; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; + +},{"./_core":32,"./_ctx":34,"./_global":49,"./_hide":51,"./_redefine":100}],43:[function(require,module,exports){ +var MATCH = require('./_wks')('match'); +module.exports = function (KEY) { + var re = /./; + try { + '/./'[KEY](re); + } catch (e) { + try { + re[MATCH] = false; + return !'/./'[KEY](re); + } catch (f) { /* empty */ } + } return true; +}; + +},{"./_wks":135}],44:[function(require,module,exports){ +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; + +},{}],45:[function(require,module,exports){ +'use strict'; +var hide = require('./_hide'); +var redefine = require('./_redefine'); +var fails = require('./_fails'); +var defined = require('./_defined'); +var wks = require('./_wks'); + +module.exports = function (KEY, length, exec) { + var SYMBOL = wks(KEY); + var fns = exec(defined, SYMBOL, ''[KEY]); + var strfn = fns[0]; + var rxfn = fns[1]; + if (fails(function () { + var O = {}; + O[SYMBOL] = function () { return 7; }; + return ''[KEY](O) != 7; + })) { + redefine(String.prototype, KEY, strfn); + hide(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 rxfn.call(string, this, arg); } + // 21.2.5.6 RegExp.prototype[@@match](string) + // 21.2.5.9 RegExp.prototype[@@search](string) + : function (string) { return rxfn.call(string, this); } + ); + } +}; + +},{"./_defined":37,"./_fails":44,"./_hide":51,"./_redefine":100,"./_wks":135}],46:[function(require,module,exports){ +'use strict'; +// 21.2.5.3 get RegExp.prototype.flags +var anObject = require('./_an-object'); +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.unicode) result += 'u'; + if (that.sticky) result += 'y'; + return result; +}; + +},{"./_an-object":16}],47:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray +var isArray = require('./_is-array'); +var isObject = require('./_is-object'); +var toLength = require('./_to-length'); +var ctx = require('./_ctx'); +var IS_CONCAT_SPREADABLE = require('./_wks')('isConcatSpreadable'); + +function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) { + var targetIndex = start; + var sourceIndex = 0; + var mapFn = mapper ? ctx(mapper, thisArg, 3) : false; + var element, spreadable; + + while (sourceIndex < sourceLen) { + if (sourceIndex in source) { + element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; + + spreadable = false; + if (isObject(element)) { + spreadable = element[IS_CONCAT_SPREADABLE]; + spreadable = spreadable !== undefined ? !!spreadable : isArray(element); + } + + if (spreadable && depth > 0) { + targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; + } else { + if (targetIndex >= 0x1fffffffffffff) throw TypeError(); + target[targetIndex] = element; + } + + targetIndex++; + } + sourceIndex++; + } + return targetIndex; +} + +module.exports = flattenIntoArray; + +},{"./_ctx":34,"./_is-array":58,"./_is-object":60,"./_to-length":124,"./_wks":135}],48:[function(require,module,exports){ +var ctx = require('./_ctx'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var anObject = require('./_an-object'); +var toLength = require('./_to-length'); +var getIterFn = require('./core.get-iterator-method'); +var BREAK = {}; +var RETURN = {}; +var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { + var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); + var f = ctx(fn, that, entries ? 2 : 1); + var index = 0; + var length, step, iterator, result; + if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); + // fast case for arrays with default iterator + if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { + result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); + if (result === BREAK || result === RETURN) return result; + } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { + result = call(iterator, f, step.value, entries); + if (result === BREAK || result === RETURN) return result; + } +}; +exports.BREAK = BREAK; +exports.RETURN = RETURN; + +},{"./_an-object":16,"./_ctx":34,"./_is-array-iter":57,"./_iter-call":62,"./_to-length":124,"./core.get-iterator-method":136}],49:[function(require,module,exports){ +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef + +},{}],50:[function(require,module,exports){ +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; + +},{}],51:[function(require,module,exports){ +var dP = require('./_object-dp'); +var createDesc = require('./_property-desc'); +module.exports = require('./_descriptors') ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; + +},{"./_descriptors":38,"./_object-dp":80,"./_property-desc":98}],52:[function(require,module,exports){ +var document = require('./_global').document; +module.exports = document && document.documentElement; + +},{"./_global":49}],53:[function(require,module,exports){ +module.exports = !require('./_descriptors') && !require('./_fails')(function () { + return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7; +}); + +},{"./_descriptors":38,"./_dom-create":39,"./_fails":44}],54:[function(require,module,exports){ +var isObject = require('./_is-object'); +var setPrototypeOf = require('./_set-proto').set; +module.exports = function (that, target, C) { + var S = target.constructor; + var P; + if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { + setPrototypeOf(that, P); + } return that; +}; + +},{"./_is-object":60,"./_set-proto":105}],55:[function(require,module,exports){ +// fast apply, http://jsperf.lnkit.com/fast-apply/5 +module.exports = function (fn, args, that) { + var un = that === undefined; + switch (args.length) { + case 0: return un ? fn() + : fn.call(that); + case 1: return un ? fn(args[0]) + : fn.call(that, args[0]); + case 2: return un ? fn(args[0], args[1]) + : fn.call(that, args[0], args[1]); + case 3: return un ? fn(args[0], args[1], args[2]) + : fn.call(that, args[0], args[1], args[2]); + case 4: return un ? fn(args[0], args[1], args[2], args[3]) + : fn.call(that, args[0], args[1], args[2], args[3]); + } return fn.apply(that, args); +}; + +},{}],56:[function(require,module,exports){ +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = require('./_cof'); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; + +},{"./_cof":27}],57:[function(require,module,exports){ +// check on default Array iterator +var Iterators = require('./_iterators'); +var ITERATOR = require('./_wks')('iterator'); +var ArrayProto = Array.prototype; + +module.exports = function (it) { + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); +}; + +},{"./_iterators":67,"./_wks":135}],58:[function(require,module,exports){ +// 7.2.2 IsArray(argument) +var cof = require('./_cof'); +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; + +},{"./_cof":27}],59:[function(require,module,exports){ +// 20.1.2.3 Number.isInteger(number) +var isObject = require('./_is-object'); +var floor = Math.floor; +module.exports = function isInteger(it) { + return !isObject(it) && isFinite(it) && floor(it) === it; +}; + +},{"./_is-object":60}],60:[function(require,module,exports){ +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; + +},{}],61:[function(require,module,exports){ +// 7.2.8 IsRegExp(argument) +var isObject = require('./_is-object'); +var cof = require('./_cof'); +var MATCH = require('./_wks')('match'); +module.exports = function (it) { + var isRegExp; + return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); +}; + +},{"./_cof":27,"./_is-object":60,"./_wks":135}],62:[function(require,module,exports){ +// call something on iterator step with safe closing on error +var anObject = require('./_an-object'); +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 (e) { + var ret = iterator['return']; + if (ret !== undefined) anObject(ret.call(iterator)); + throw e; + } +}; + +},{"./_an-object":16}],63:[function(require,module,exports){ +'use strict'; +var create = require('./_object-create'); +var descriptor = require('./_property-desc'); +var setToStringTag = require('./_set-to-string-tag'); +var IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; }); + +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; + +},{"./_hide":51,"./_object-create":79,"./_property-desc":98,"./_set-to-string-tag":107,"./_wks":135}],64:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var $iterCreate = require('./_iter-create'); +var setToStringTag = require('./_set-to-string-tag'); +var getPrototypeOf = require('./_object-gpo'); +var ITERATOR = require('./_wks')('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; + +},{"./_export":42,"./_hide":51,"./_iter-create":63,"./_iterators":67,"./_library":68,"./_object-gpo":87,"./_redefine":100,"./_set-to-string-tag":107,"./_wks":135}],65:[function(require,module,exports){ +var ITERATOR = require('./_wks')('iterator'); +var SAFE_CLOSING = false; + +try { + var riter = [7][ITERATOR](); + riter['return'] = function () { SAFE_CLOSING = true; }; + // eslint-disable-next-line no-throw-literal + Array.from(riter, function () { throw 2; }); +} catch (e) { /* empty */ } + +module.exports = function (exec, skipClosing) { + if (!skipClosing && !SAFE_CLOSING) return false; + var safe = false; + try { + var arr = [7]; + var iter = arr[ITERATOR](); + iter.next = function () { return { done: safe = true }; }; + arr[ITERATOR] = function () { return iter; }; + exec(arr); + } catch (e) { /* empty */ } + return safe; +}; + +},{"./_wks":135}],66:[function(require,module,exports){ +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; + +},{}],67:[function(require,module,exports){ +module.exports = {}; + +},{}],68:[function(require,module,exports){ +module.exports = false; + +},{}],69:[function(require,module,exports){ +// 20.2.2.14 Math.expm1(x) +var $expm1 = Math.expm1; +module.exports = (!$expm1 + // Old FF bug + || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 + // Tor Browser bug + || $expm1(-2e-17) != -2e-17 +) ? function expm1(x) { + return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; +} : $expm1; + +},{}],70:[function(require,module,exports){ +// 20.2.2.16 Math.fround(x) +var sign = require('./_math-sign'); +var pow = Math.pow; +var EPSILON = pow(2, -52); +var EPSILON32 = pow(2, -23); +var MAX32 = pow(2, 127) * (2 - EPSILON32); +var MIN32 = pow(2, -126); + +var roundTiesToEven = function (n) { + return n + 1 / EPSILON - 1 / EPSILON; +}; + +module.exports = Math.fround || function fround(x) { + var $abs = Math.abs(x); + var $sign = sign(x); + var a, result; + if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; + a = (1 + EPSILON32 / EPSILON) * $abs; + result = a - (a - $abs); + // eslint-disable-next-line no-self-compare + if (result > MAX32 || result != result) return $sign * Infinity; + return $sign * result; +}; + +},{"./_math-sign":73}],71:[function(require,module,exports){ +// 20.2.2.20 Math.log1p(x) +module.exports = Math.log1p || function log1p(x) { + return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); +}; + +},{}],72:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { + if ( + arguments.length === 0 + // eslint-disable-next-line no-self-compare + || x != x + // eslint-disable-next-line no-self-compare + || inLow != inLow + // eslint-disable-next-line no-self-compare + || inHigh != inHigh + // eslint-disable-next-line no-self-compare + || outLow != outLow + // eslint-disable-next-line no-self-compare + || outHigh != outHigh + ) return NaN; + if (x === Infinity || x === -Infinity) return x; + return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; +}; + +},{}],73:[function(require,module,exports){ +// 20.2.2.28 Math.sign(x) +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; +}; + +},{}],74:[function(require,module,exports){ +var META = require('./_uid')('meta'); +var isObject = require('./_is-object'); +var has = require('./_has'); +var setDesc = require('./_object-dp').f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !require('./_fails')(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // 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 + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!has(it, META)) { + // 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 + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; + +},{"./_fails":44,"./_has":50,"./_is-object":60,"./_object-dp":80,"./_uid":130}],75:[function(require,module,exports){ +var Map = require('./es6.map'); +var $export = require('./_export'); +var shared = require('./_shared')('metadata'); +var store = shared.store || (shared.store = new (require('./es6.weak-map'))()); + +var getOrCreateMetadataMap = function (target, targetKey, create) { + var targetMetadata = store.get(target); + if (!targetMetadata) { + if (!create) return undefined; + store.set(target, targetMetadata = new Map()); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) return undefined; + targetMetadata.set(targetKey, keyMetadata = new Map()); + } return keyMetadata; +}; +var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? false : metadataMap.has(MetadataKey); +}; +var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { + var metadataMap = getOrCreateMetadataMap(O, P, false); + return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); +}; +var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { + getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); +}; +var ordinaryOwnMetadataKeys = function (target, targetKey) { + var metadataMap = getOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); + return keys; +}; +var toMetaKey = function (it) { + return it === undefined || typeof it == 'symbol' ? it : String(it); +}; +var exp = function (O) { + $export($export.S, 'Reflect', O); +}; + +module.exports = { + store: store, + map: getOrCreateMetadataMap, + has: ordinaryHasOwnMetadata, + get: ordinaryGetOwnMetadata, + set: ordinaryDefineOwnMetadata, + keys: ordinaryOwnMetadataKeys, + key: toMetaKey, + exp: exp +}; + +},{"./_export":42,"./_shared":109,"./es6.map":167,"./es6.weak-map":273}],76:[function(require,module,exports){ +var global = require('./_global'); +var macrotask = require('./_task').set; +var Observer = global.MutationObserver || global.WebKitMutationObserver; +var process = global.process; +var Promise = global.Promise; +var isNode = require('./_cof')(process) == 'process'; + +module.exports = function () { + var head, last, notify; + + var flush = function () { + var parent, fn; + if (isNode && (parent = process.domain)) parent.exit(); + while (head) { + fn = head.fn; + head = head.next; + try { + fn(); + } catch (e) { + if (head) notify(); + else last = undefined; + throw e; + } + } last = undefined; + if (parent) parent.enter(); + }; + + // Node.js + if (isNode) { + notify = function () { + process.nextTick(flush); + }; + // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 + } else if (Observer && !(global.navigator && global.navigator.standalone)) { + var toggle = true; + var node = document.createTextNode(''); + new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new + 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 + var promise = Promise.resolve(undefined); + notify = function () { + promise.then(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); + }; + } + + return function (fn) { + var task = { fn: fn, next: undefined }; + if (last) last.next = task; + if (!head) { + head = task; + notify(); + } last = task; + }; +}; + +},{"./_cof":27,"./_global":49,"./_task":119}],77:[function(require,module,exports){ +'use strict'; +// 25.4.1.5 NewPromiseCapability(C) +var aFunction = require('./_a-function'); + +function PromiseCapability(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); +} + +module.exports.f = function (C) { + return new PromiseCapability(C); +}; + +},{"./_a-function":12}],78:[function(require,module,exports){ +'use strict'; +// 19.1.2.1 Object.assign(target, source, ...) +var getKeys = require('./_object-keys'); +var gOPS = require('./_object-gops'); +var pIE = require('./_object-pie'); +var toObject = require('./_to-object'); +var IObject = require('./_iobject'); +var $assign = Object.assign; + +// should work with symbols and should have deterministic property order (V8 bug) +module.exports = !$assign || require('./_fails')(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = gOPS.f; + var isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]); + var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } return T; +} : $assign; + +},{"./_fails":44,"./_iobject":56,"./_object-gops":86,"./_object-keys":89,"./_object-pie":90,"./_to-object":125}],79:[function(require,module,exports){ +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = require('./_an-object'); +var dPs = require('./_object-dps'); +var enumBugKeys = require('./_enum-bug-keys'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = require('./_dom-create')('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + require('./_html').appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; + +},{"./_an-object":16,"./_dom-create":39,"./_enum-bug-keys":40,"./_html":52,"./_object-dps":81,"./_shared-key":108}],80:[function(require,module,exports){ +var anObject = require('./_an-object'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var toPrimitive = require('./_to-primitive'); +var dP = Object.defineProperty; + +exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; + +},{"./_an-object":16,"./_descriptors":38,"./_ie8-dom-define":53,"./_to-primitive":126}],81:[function(require,module,exports){ +var dP = require('./_object-dp'); +var anObject = require('./_an-object'); +var getKeys = require('./_object-keys'); + +module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; + +},{"./_an-object":16,"./_descriptors":38,"./_object-dp":80,"./_object-keys":89}],82:[function(require,module,exports){ +'use strict'; +// Forced replacement prototype accessors methods +module.exports = require('./_library') || !require('./_fails')(function () { + var K = Math.random(); + // In FF throws only define methods + // eslint-disable-next-line no-undef, no-useless-call + __defineSetter__.call(null, K, function () { /* empty */ }); + delete require('./_global')[K]; +}); + +},{"./_fails":44,"./_global":49,"./_library":68}],83:[function(require,module,exports){ +var pIE = require('./_object-pie'); +var createDesc = require('./_property-desc'); +var toIObject = require('./_to-iobject'); +var toPrimitive = require('./_to-primitive'); +var has = require('./_has'); +var IE8_DOM_DEFINE = require('./_ie8-dom-define'); +var gOPD = Object.getOwnPropertyDescriptor; + +exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); +}; + +},{"./_descriptors":38,"./_has":50,"./_ie8-dom-define":53,"./_object-pie":90,"./_property-desc":98,"./_to-iobject":123,"./_to-primitive":126}],84:[function(require,module,exports){ +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var toIObject = require('./_to-iobject'); +var gOPN = require('./_object-gopn').f; +var toString = {}.toString; + +var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + +var getWindowNames = function (it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } +}; + +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +}; + +},{"./_object-gopn":85,"./_to-iobject":123}],85:[function(require,module,exports){ +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = require('./_object-keys-internal'); +var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype'); + +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); +}; + +},{"./_enum-bug-keys":40,"./_object-keys-internal":88}],86:[function(require,module,exports){ +exports.f = Object.getOwnPropertySymbols; + +},{}],87:[function(require,module,exports){ +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = require('./_has'); +var toObject = require('./_to-object'); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); +var ObjectProto = Object.prototype; + +module.exports = 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 ? ObjectProto : null; +}; + +},{"./_has":50,"./_shared-key":108,"./_to-object":125}],88:[function(require,module,exports){ +var has = require('./_has'); +var toIObject = require('./_to-iobject'); +var arrayIndexOf = require('./_array-includes')(false); +var IE_PROTO = require('./_shared-key')('IE_PROTO'); + +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; + +},{"./_array-includes":20,"./_has":50,"./_shared-key":108,"./_to-iobject":123}],89:[function(require,module,exports){ +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = require('./_object-keys-internal'); +var enumBugKeys = require('./_enum-bug-keys'); + +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; + +},{"./_enum-bug-keys":40,"./_object-keys-internal":88}],90:[function(require,module,exports){ +exports.f = {}.propertyIsEnumerable; + +},{}],91:[function(require,module,exports){ +// most Object methods by ES6 should accept primitives +var $export = require('./_export'); +var core = require('./_core'); +var fails = require('./_fails'); +module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); +}; + +},{"./_core":32,"./_export":42,"./_fails":44}],92:[function(require,module,exports){ +var getKeys = require('./_object-keys'); +var toIObject = require('./_to-iobject'); +var isEnum = require('./_object-pie').f; +module.exports = function (isEntries) { + return function (it) { + var O = toIObject(it); + var keys = getKeys(O); + var length = keys.length; + var i = 0; + var result = []; + var key; + while (length > i) if (isEnum.call(O, key = keys[i++])) { + result.push(isEntries ? [key, O[key]] : O[key]); + } return result; + }; +}; + +},{"./_object-keys":89,"./_object-pie":90,"./_to-iobject":123}],93:[function(require,module,exports){ +// all object keys, includes non-enumerable and symbols +var gOPN = require('./_object-gopn'); +var gOPS = require('./_object-gops'); +var anObject = require('./_an-object'); +var Reflect = require('./_global').Reflect; +module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) { + var keys = gOPN.f(anObject(it)); + var getSymbols = gOPS.f; + return getSymbols ? keys.concat(getSymbols(it)) : keys; +}; + +},{"./_an-object":16,"./_global":49,"./_object-gopn":85,"./_object-gops":86}],94:[function(require,module,exports){ +var $parseFloat = require('./_global').parseFloat; +var $trim = require('./_string-trim').trim; + +module.exports = 1 / $parseFloat(require('./_string-ws') + '-0') !== -Infinity ? function parseFloat(str) { + var string = $trim(String(str), 3); + var result = $parseFloat(string); + return result === 0 && string.charAt(0) == '-' ? -0 : result; +} : $parseFloat; + +},{"./_global":49,"./_string-trim":117,"./_string-ws":118}],95:[function(require,module,exports){ +var $parseInt = require('./_global').parseInt; +var $trim = require('./_string-trim').trim; +var ws = require('./_string-ws'); +var hex = /^[-+]?0[xX]/; + +module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) { + var string = $trim(String(str), 3); + return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); +} : $parseInt; + +},{"./_global":49,"./_string-trim":117,"./_string-ws":118}],96:[function(require,module,exports){ +module.exports = function (exec) { + try { + return { e: false, v: exec() }; + } catch (e) { + return { e: true, v: e }; + } +}; + +},{}],97:[function(require,module,exports){ +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var newPromiseCapability = require('./_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; +}; + +},{"./_an-object":16,"./_is-object":60,"./_new-promise-capability":77}],98:[function(require,module,exports){ +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; + +},{}],99:[function(require,module,exports){ +var redefine = require('./_redefine'); +module.exports = function (target, src, safe) { + for (var key in src) redefine(target, key, src[key], safe); + return target; +}; + +},{"./_redefine":100}],100:[function(require,module,exports){ +var global = require('./_global'); +var hide = require('./_hide'); +var has = require('./_has'); +var SRC = require('./_uid')('src'); +var TO_STRING = 'toString'; +var $toString = Function[TO_STRING]; +var TPL = ('' + $toString).split(TO_STRING); + +require('./_core').inspectSource = function (it) { + return $toString.call(it); +}; + +(module.exports = function (O, key, val, safe) { + var isFunction = typeof val == 'function'; + if (isFunction) has(val, 'name') || hide(val, 'name', key); + if (O[key] === val) return; + if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); + if (O === global) { + O[key] = val; + } else if (!safe) { + delete O[key]; + hide(O, key, val); + } else if (O[key]) { + O[key] = val; + } else { + hide(O, key, val); + } +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +})(Function.prototype, TO_STRING, function toString() { + return typeof this == 'function' && this[SRC] || $toString.call(this); +}); + +},{"./_core":32,"./_global":49,"./_has":50,"./_hide":51,"./_uid":130}],101:[function(require,module,exports){ +module.exports = function (regExp, replace) { + var replacer = replace === Object(replace) ? function (part) { + return replace[part]; + } : replace; + return function (it) { + return String(it).replace(regExp, replacer); + }; +}; + +},{}],102:[function(require,module,exports){ +// 7.2.9 SameValue(x, y) +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; +}; + +},{}],103:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-setmap-offrom/ +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var ctx = require('./_ctx'); +var forOf = require('./_for-of'); + +module.exports = function (COLLECTION) { + $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) { + var mapFn = arguments[1]; + var mapping, A, n, cb; + aFunction(this); + mapping = mapFn !== undefined; + if (mapping) aFunction(mapFn); + if (source == undefined) return new this(); + A = []; + if (mapping) { + n = 0; + cb = ctx(mapFn, arguments[2], 2); + forOf(source, false, function (nextItem) { + A.push(cb(nextItem, n++)); + }); + } else { + forOf(source, false, A.push, A); + } + return new this(A); + } }); +}; + +},{"./_a-function":12,"./_ctx":34,"./_export":42,"./_for-of":48}],104:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-setmap-offrom/ +var $export = require('./_export'); + +module.exports = function (COLLECTION) { + $export($export.S, COLLECTION, { of: function of() { + var length = arguments.length; + var A = new Array(length); + while (length--) A[length] = arguments[length]; + return new this(A); + } }); +}; + +},{"./_export":42}],105:[function(require,module,exports){ +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var isObject = require('./_is-object'); +var anObject = require('./_an-object'); +var check = function (O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; + +},{"./_an-object":16,"./_ctx":34,"./_is-object":60,"./_object-gopd":83}],106:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var dP = require('./_object-dp'); +var DESCRIPTORS = require('./_descriptors'); +var SPECIES = require('./_wks')('species'); + +module.exports = function (KEY) { + var C = global[KEY]; + if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { + configurable: true, + get: function () { return this; } + }); +}; + +},{"./_descriptors":38,"./_global":49,"./_object-dp":80,"./_wks":135}],107:[function(require,module,exports){ +var def = require('./_object-dp').f; +var has = require('./_has'); +var TAG = require('./_wks')('toStringTag'); + +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; + +},{"./_has":50,"./_object-dp":80,"./_wks":135}],108:[function(require,module,exports){ +var shared = require('./_shared')('keys'); +var uid = require('./_uid'); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; + +},{"./_shared":109,"./_uid":130}],109:[function(require,module,exports){ +var core = require('./_core'); +var global = require('./_global'); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: core.version, + mode: require('./_library') ? 'pure' : 'global', + copyright: '© 2018 Denis Pushkarev (zloirock.ru)' +}); + +},{"./_core":32,"./_global":49,"./_library":68}],110:[function(require,module,exports){ +// 7.3.20 SpeciesConstructor(O, defaultConstructor) +var anObject = require('./_an-object'); +var aFunction = require('./_a-function'); +var SPECIES = require('./_wks')('species'); +module.exports = function (O, D) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); +}; + +},{"./_a-function":12,"./_an-object":16,"./_wks":135}],111:[function(require,module,exports){ +'use strict'; +var fails = require('./_fails'); + +module.exports = function (method, arg) { + return !!method && fails(function () { + // eslint-disable-next-line no-useless-call + arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); + }); +}; + +},{"./_fails":44}],112:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; + +},{"./_defined":37,"./_to-integer":122}],113:[function(require,module,exports){ +// helper for String#{startsWith, endsWith, includes} +var isRegExp = require('./_is-regexp'); +var defined = require('./_defined'); + +module.exports = function (that, searchString, NAME) { + if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); + return String(defined(that)); +}; + +},{"./_defined":37,"./_is-regexp":61}],114:[function(require,module,exports){ +var $export = require('./_export'); +var fails = require('./_fails'); +var defined = require('./_defined'); +var quot = /"/g; +// B.2.3.2.1 CreateHTML(string, tag, attribute, value) +var createHTML = function (string, tag, attribute, value) { + var S = String(defined(string)); + var p1 = '<' + tag; + if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; + return p1 + '>' + S + ''; +}; +module.exports = function (NAME, exec) { + var O = {}; + O[NAME] = exec(createHTML); + $export($export.P + $export.F * fails(function () { + var test = ''[NAME]('"'); + return test !== test.toLowerCase() || test.split('"').length > 3; + }), 'String', O); +}; + +},{"./_defined":37,"./_export":42,"./_fails":44}],115:[function(require,module,exports){ +// https://github.com/tc39/proposal-string-pad-start-end +var toLength = require('./_to-length'); +var repeat = require('./_string-repeat'); +var defined = require('./_defined'); + +module.exports = function (that, maxLength, fillString, left) { + var S = String(defined(that)); + var stringLength = S.length; + var fillStr = fillString === undefined ? ' ' : String(fillString); + var intMaxLength = toLength(maxLength); + if (intMaxLength <= stringLength || fillStr == '') return S; + var fillLen = intMaxLength - stringLength; + var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); + return left ? stringFiller + S : S + stringFiller; +}; + +},{"./_defined":37,"./_string-repeat":116,"./_to-length":124}],116:[function(require,module,exports){ +'use strict'; +var toInteger = require('./_to-integer'); +var defined = require('./_defined'); + +module.exports = function repeat(count) { + var str = String(defined(this)); + var res = ''; + var n = toInteger(count); + if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); + for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; + return res; +}; + +},{"./_defined":37,"./_to-integer":122}],117:[function(require,module,exports){ +var $export = require('./_export'); +var defined = require('./_defined'); +var fails = require('./_fails'); +var spaces = require('./_string-ws'); +var space = '[' + spaces + ']'; +var non = '\u200b\u0085'; +var ltrim = RegExp('^' + space + space + '*'); +var rtrim = RegExp(space + space + '*$'); + +var exporter = function (KEY, exec, ALIAS) { + var exp = {}; + var FORCE = fails(function () { + return !!spaces[KEY]() || non[KEY]() != non; + }); + var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; + if (ALIAS) exp[ALIAS] = fn; + $export($export.P + $export.F * FORCE, 'String', exp); +}; + +// 1 -> String#trimLeft +// 2 -> String#trimRight +// 3 -> String#trim +var trim = exporter.trim = function (string, TYPE) { + string = String(defined(string)); + if (TYPE & 1) string = string.replace(ltrim, ''); + if (TYPE & 2) string = string.replace(rtrim, ''); + return string; +}; + +module.exports = exporter; + +},{"./_defined":37,"./_export":42,"./_fails":44,"./_string-ws":118}],118:[function(require,module,exports){ +module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; + +},{}],119:[function(require,module,exports){ +var ctx = require('./_ctx'); +var invoke = require('./_invoke'); +var html = require('./_html'); +var cel = require('./_dom-create'); +var global = require('./_global'); +var process = global.process; +var setTask = global.setImmediate; +var clearTask = global.clearImmediate; +var MessageChannel = global.MessageChannel; +var Dispatch = global.Dispatch; +var counter = 0; +var queue = {}; +var ONREADYSTATECHANGE = 'onreadystatechange'; +var defer, channel, port; +var run = function () { + var id = +this; + // eslint-disable-next-line no-prototype-builtins + if (queue.hasOwnProperty(id)) { + var fn = queue[id]; + delete queue[id]; + fn(); + } +}; +var listener = function (event) { + run.call(event.data); +}; +// Node.js 0.9+ & IE10+ has setImmediate, otherwise: +if (!setTask || !clearTask) { + setTask = 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 + invoke(typeof fn == 'function' ? fn : Function(fn), args); + }; + defer(counter); + return counter; + }; + clearTask = function clearImmediate(id) { + delete queue[id]; + }; + // Node.js 0.8- + if (require('./_cof')(process) == 'process') { + defer = function (id) { + process.nextTick(ctx(run, id, 1)); + }; + // Sphere (JS game engine) Dispatch API + } else if (Dispatch && Dispatch.now) { + defer = function (id) { + Dispatch.now(ctx(run, id, 1)); + }; + // Browsers with MessageChannel, includes WebWorkers + } else if (MessageChannel) { + channel = new MessageChannel(); + port = channel.port2; + channel.port1.onmessage = listener; + defer = ctx(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) { + defer = function (id) { + global.postMessage(id + '', '*'); + }; + global.addEventListener('message', listener, false); + // IE8- + } else if (ONREADYSTATECHANGE in cel('script')) { + defer = function (id) { + html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { + html.removeChild(this); + run.call(id); + }; + }; + // Rest old browsers + } else { + defer = function (id) { + setTimeout(ctx(run, id, 1), 0); + }; + } +} +module.exports = { + set: setTask, + clear: clearTask +}; + +},{"./_cof":27,"./_ctx":34,"./_dom-create":39,"./_global":49,"./_html":52,"./_invoke":55}],120:[function(require,module,exports){ +var toInteger = require('./_to-integer'); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; + +},{"./_to-integer":122}],121:[function(require,module,exports){ +// https://tc39.github.io/ecma262/#sec-toindex +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +module.exports = function (it) { + if (it === undefined) return 0; + var number = toInteger(it); + var length = toLength(number); + if (number !== length) throw RangeError('Wrong length!'); + return length; +}; + +},{"./_to-integer":122,"./_to-length":124}],122:[function(require,module,exports){ +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; + +},{}],123:[function(require,module,exports){ +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = require('./_iobject'); +var defined = require('./_defined'); +module.exports = function (it) { + return IObject(defined(it)); +}; + +},{"./_defined":37,"./_iobject":56}],124:[function(require,module,exports){ +// 7.1.15 ToLength +var toInteger = require('./_to-integer'); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; + +},{"./_to-integer":122}],125:[function(require,module,exports){ +// 7.1.13 ToObject(argument) +var defined = require('./_defined'); +module.exports = function (it) { + return Object(defined(it)); +}; + +},{"./_defined":37}],126:[function(require,module,exports){ +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = require('./_is-object'); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +},{"./_is-object":60}],127:[function(require,module,exports){ +'use strict'; +if (require('./_descriptors')) { + var LIBRARY = require('./_library'); + var global = require('./_global'); + var fails = require('./_fails'); + var $export = require('./_export'); + var $typed = require('./_typed'); + var $buffer = require('./_typed-buffer'); + var ctx = require('./_ctx'); + var anInstance = require('./_an-instance'); + var propertyDesc = require('./_property-desc'); + var hide = require('./_hide'); + var redefineAll = require('./_redefine-all'); + var toInteger = require('./_to-integer'); + var toLength = require('./_to-length'); + var toIndex = require('./_to-index'); + var toAbsoluteIndex = require('./_to-absolute-index'); + var toPrimitive = require('./_to-primitive'); + var has = require('./_has'); + var classof = require('./_classof'); + var isObject = require('./_is-object'); + var toObject = require('./_to-object'); + var isArrayIter = require('./_is-array-iter'); + var create = require('./_object-create'); + var getPrototypeOf = require('./_object-gpo'); + var gOPN = require('./_object-gopn').f; + var getIterFn = require('./core.get-iterator-method'); + var uid = require('./_uid'); + var wks = require('./_wks'); + var createArrayMethod = require('./_array-methods'); + var createArrayIncludes = require('./_array-includes'); + var speciesConstructor = require('./_species-constructor'); + var ArrayIterators = require('./es6.array.iterator'); + var Iterators = require('./_iterators'); + var $iterDetect = require('./_iter-detect'); + var setSpecies = require('./_set-species'); + var arrayFill = require('./_array-fill'); + var arrayCopyWithin = require('./_array-copy-within'); + var $DP = require('./_object-dp'); + var $GOPD = require('./_object-gopd'); + var dP = $DP.f; + var gOPD = $GOPD.f; + var RangeError = global.RangeError; + var TypeError = global.TypeError; + var Uint8Array = global.Uint8Array; + var ARRAY_BUFFER = 'ArrayBuffer'; + var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; + var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; + var PROTOTYPE = 'prototype'; + var ArrayProto = Array[PROTOTYPE]; + var $ArrayBuffer = $buffer.ArrayBuffer; + var $DataView = $buffer.DataView; + var arrayForEach = createArrayMethod(0); + var arrayFilter = createArrayMethod(2); + var arraySome = createArrayMethod(3); + var arrayEvery = createArrayMethod(4); + var arrayFind = createArrayMethod(5); + var arrayFindIndex = createArrayMethod(6); + var arrayIncludes = createArrayIncludes(true); + var arrayIndexOf = createArrayIncludes(false); + var arrayValues = ArrayIterators.values; + var arrayKeys = ArrayIterators.keys; + var arrayEntries = ArrayIterators.entries; + var arrayLastIndexOf = ArrayProto.lastIndexOf; + var arrayReduce = ArrayProto.reduce; + var arrayReduceRight = ArrayProto.reduceRight; + var arrayJoin = ArrayProto.join; + var arraySort = ArrayProto.sort; + var arraySlice = ArrayProto.slice; + var arrayToString = ArrayProto.toString; + var arrayToLocaleString = ArrayProto.toLocaleString; + var ITERATOR = wks('iterator'); + var TAG = wks('toStringTag'); + var TYPED_CONSTRUCTOR = uid('typed_constructor'); + var DEF_CONSTRUCTOR = uid('def_constructor'); + var ALL_CONSTRUCTORS = $typed.CONSTR; + var TYPED_ARRAY = $typed.TYPED; + var VIEW = $typed.VIEW; + var WRONG_LENGTH = 'Wrong length!'; + + var $map = createArrayMethod(1, function (O, length) { + return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); + }); + + var LITTLE_ENDIAN = fails(function () { + // eslint-disable-next-line no-undef + return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; + }); + + var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { + new Uint8Array(1).set({}); + }); + + var toOffset = function (it, BYTES) { + var offset = toInteger(it); + if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); + return offset; + }; + + var validate = function (it) { + if (isObject(it) && TYPED_ARRAY in it) return it; + throw TypeError(it + ' is not a typed array!'); + }; + + var allocate = function (C, length) { + if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { + throw TypeError('It is not a typed array constructor!'); + } return new C(length); + }; + + var speciesFromList = function (O, list) { + return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); + }; + + var fromList = function (C, list) { + var index = 0; + var length = list.length; + var result = allocate(C, length); + while (length > index) result[index] = list[index++]; + return result; + }; + + var addGetter = function (it, key, internal) { + dP(it, key, { get: function () { return this._d[internal]; } }); + }; + + var $from = function from(source /* , mapfn, thisArg */) { + var O = toObject(source); + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var iterFn = getIterFn(O); + var i, length, values, result, step, iterator; + if (iterFn != undefined && !isArrayIter(iterFn)) { + for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { + values.push(step.value); + } O = values; + } + if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); + for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { + result[i] = mapping ? mapfn(O[i], i) : O[i]; + } + return result; + }; + + var $of = function of(/* ...items */) { + var index = 0; + var length = arguments.length; + var result = allocate(this, length); + while (length > index) result[index] = arguments[index++]; + return result; + }; + + // iOS Safari 6.x fails here + var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); + + var $toLocaleString = function toLocaleString() { + return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); + }; + + var proto = { + copyWithin: function copyWithin(target, start /* , end */) { + return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + }, + every: function every(callbackfn /* , thisArg */) { + return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars + return arrayFill.apply(validate(this), arguments); + }, + filter: function filter(callbackfn /* , thisArg */) { + return speciesFromList(this, arrayFilter(validate(this), callbackfn, + arguments.length > 1 ? arguments[1] : undefined)); + }, + find: function find(predicate /* , thisArg */) { + return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + findIndex: function findIndex(predicate /* , thisArg */) { + return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); + }, + forEach: function forEach(callbackfn /* , thisArg */) { + arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + indexOf: function indexOf(searchElement /* , fromIndex */) { + return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + includes: function includes(searchElement /* , fromIndex */) { + return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); + }, + join: function join(separator) { // eslint-disable-line no-unused-vars + return arrayJoin.apply(validate(this), arguments); + }, + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars + return arrayLastIndexOf.apply(validate(this), arguments); + }, + map: function map(mapfn /* , thisArg */) { + return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); + }, + reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduce.apply(validate(this), arguments); + }, + reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars + return arrayReduceRight.apply(validate(this), arguments); + }, + reverse: function reverse() { + var that = this; + var length = validate(that).length; + var middle = Math.floor(length / 2); + var index = 0; + var value; + while (index < middle) { + value = that[index]; + that[index++] = that[--length]; + that[length] = value; + } return that; + }, + some: function some(callbackfn /* , thisArg */) { + return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); + }, + sort: function sort(comparefn) { + return arraySort.call(validate(this), comparefn); + }, + subarray: function subarray(begin, end) { + var O = validate(this); + var length = O.length; + var $begin = toAbsoluteIndex(begin, length); + return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( + O.buffer, + O.byteOffset + $begin * O.BYTES_PER_ELEMENT, + toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) + ); + } + }; + + var $slice = function slice(start, end) { + return speciesFromList(this, arraySlice.call(validate(this), start, end)); + }; + + var $set = function set(arrayLike /* , offset */) { + validate(this); + var offset = toOffset(arguments[1], 1); + var length = this.length; + var src = toObject(arrayLike); + var len = toLength(src.length); + var index = 0; + if (len + offset > length) throw RangeError(WRONG_LENGTH); + while (index < len) this[offset + index] = src[index++]; + }; + + var $iterators = { + entries: function entries() { + return arrayEntries.call(validate(this)); + }, + keys: function keys() { + return arrayKeys.call(validate(this)); + }, + values: function values() { + return arrayValues.call(validate(this)); + } + }; + + var isTAIndex = function (target, key) { + return isObject(target) + && target[TYPED_ARRAY] + && typeof key != 'symbol' + && key in target + && String(+key) == String(key); + }; + var $getDesc = function getOwnPropertyDescriptor(target, key) { + return isTAIndex(target, key = toPrimitive(key, true)) + ? propertyDesc(2, target[key]) + : gOPD(target, key); + }; + var $setDesc = function defineProperty(target, key, desc) { + if (isTAIndex(target, key = toPrimitive(key, true)) + && isObject(desc) + && has(desc, 'value') + && !has(desc, 'get') + && !has(desc, 'set') + // TODO: add validation descriptor w/o calling accessors + && !desc.configurable + && (!has(desc, 'writable') || desc.writable) + && (!has(desc, 'enumerable') || desc.enumerable) + ) { + target[key] = desc.value; + return target; + } return dP(target, key, desc); + }; + + if (!ALL_CONSTRUCTORS) { + $GOPD.f = $getDesc; + $DP.f = $setDesc; + } + + $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { + getOwnPropertyDescriptor: $getDesc, + defineProperty: $setDesc + }); + + if (fails(function () { arrayToString.call({}); })) { + arrayToString = arrayToLocaleString = function toString() { + return arrayJoin.call(this); + }; + } + + var $TypedArrayPrototype$ = redefineAll({}, proto); + redefineAll($TypedArrayPrototype$, $iterators); + hide($TypedArrayPrototype$, ITERATOR, $iterators.values); + redefineAll($TypedArrayPrototype$, { + slice: $slice, + set: $set, + constructor: function () { /* noop */ }, + toString: arrayToString, + toLocaleString: $toLocaleString + }); + addGetter($TypedArrayPrototype$, 'buffer', 'b'); + addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); + addGetter($TypedArrayPrototype$, 'byteLength', 'l'); + addGetter($TypedArrayPrototype$, 'length', 'e'); + dP($TypedArrayPrototype$, TAG, { + get: function () { return this[TYPED_ARRAY]; } + }); + + // eslint-disable-next-line max-statements + module.exports = function (KEY, BYTES, wrapper, CLAMPED) { + CLAMPED = !!CLAMPED; + var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; + var GETTER = 'get' + KEY; + var SETTER = 'set' + KEY; + var TypedArray = global[NAME]; + var Base = TypedArray || {}; + var TAC = TypedArray && getPrototypeOf(TypedArray); + var FORCED = !TypedArray || !$typed.ABV; + var O = {}; + var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; + var getter = function (that, index) { + var data = that._d; + return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); + }; + var setter = function (that, index, value) { + var data = that._d; + if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; + data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); + }; + var addElement = function (that, index) { + dP(that, index, { + get: function () { + return getter(this, index); + }, + set: function (value) { + return setter(this, index, value); + }, + enumerable: true + }); + }; + if (FORCED) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME, '_d'); + var index = 0; + var offset = 0; + var buffer, byteLength, length, klass; + if (!isObject(data)) { + length = toIndex(data); + byteLength = length * BYTES; + buffer = new $ArrayBuffer(byteLength); + } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + buffer = data; + offset = toOffset($offset, BYTES); + var $len = data.byteLength; + if ($length === undefined) { + if ($len % BYTES) throw RangeError(WRONG_LENGTH); + byteLength = $len - offset; + if (byteLength < 0) throw RangeError(WRONG_LENGTH); + } else { + byteLength = toLength($length) * BYTES; + if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); + } + length = byteLength / BYTES; + } else if (TYPED_ARRAY in data) { + return fromList(TypedArray, data); + } else { + return $from.call(TypedArray, data); + } + hide(that, '_d', { + b: buffer, + o: offset, + l: byteLength, + e: length, + v: new $DataView(buffer) + }); + while (index < length) addElement(that, index++); + }); + TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); + hide(TypedArrayPrototype, 'constructor', TypedArray); + } else if (!fails(function () { + TypedArray(1); + }) || !fails(function () { + new TypedArray(-1); // eslint-disable-line no-new + }) || !$iterDetect(function (iter) { + new TypedArray(); // eslint-disable-line no-new + new TypedArray(null); // eslint-disable-line no-new + new TypedArray(1.5); // eslint-disable-line no-new + new TypedArray(iter); // eslint-disable-line no-new + }, true)) { + TypedArray = wrapper(function (that, data, $offset, $length) { + anInstance(that, TypedArray, NAME); + var klass; + // `ws` module bug, temporarily remove validation length for Uint8Array + // https://github.com/websockets/ws/pull/645 + if (!isObject(data)) return new Base(toIndex(data)); + if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { + return $length !== undefined + ? new Base(data, toOffset($offset, BYTES), $length) + : $offset !== undefined + ? new Base(data, toOffset($offset, BYTES)) + : new Base(data); + } + if (TYPED_ARRAY in data) return fromList(TypedArray, data); + return $from.call(TypedArray, data); + }); + arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { + if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); + }); + TypedArray[PROTOTYPE] = TypedArrayPrototype; + if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; + } + var $nativeIterator = TypedArrayPrototype[ITERATOR]; + var CORRECT_ITER_NAME = !!$nativeIterator + && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); + var $iterator = $iterators.values; + hide(TypedArray, TYPED_CONSTRUCTOR, true); + hide(TypedArrayPrototype, TYPED_ARRAY, NAME); + hide(TypedArrayPrototype, VIEW, true); + hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); + + if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { + dP(TypedArrayPrototype, TAG, { + get: function () { return NAME; } + }); + } + + O[NAME] = TypedArray; + + $export($export.G + $export.W + $export.F * (TypedArray != Base), O); + + $export($export.S, NAME, { + BYTES_PER_ELEMENT: BYTES + }); + + $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { + from: $from, + of: $of + }); + + if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); + + $export($export.P, NAME, proto); + + setSpecies(NAME); + + $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); + + $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); + + if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; + + $export($export.P + $export.F * fails(function () { + new TypedArray(1).slice(); + }), NAME, { slice: $slice }); + + $export($export.P + $export.F * (fails(function () { + return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); + }) || !fails(function () { + TypedArrayPrototype.toLocaleString.call([1, 2]); + })), NAME, { toLocaleString: $toLocaleString }); + + Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; + if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); + }; +} else module.exports = function () { /* empty */ }; + +},{"./_an-instance":15,"./_array-copy-within":17,"./_array-fill":18,"./_array-includes":20,"./_array-methods":21,"./_classof":26,"./_ctx":34,"./_descriptors":38,"./_export":42,"./_fails":44,"./_global":49,"./_has":50,"./_hide":51,"./_is-array-iter":57,"./_is-object":60,"./_iter-detect":65,"./_iterators":67,"./_library":68,"./_object-create":79,"./_object-dp":80,"./_object-gopd":83,"./_object-gopn":85,"./_object-gpo":87,"./_property-desc":98,"./_redefine-all":99,"./_set-species":106,"./_species-constructor":110,"./_to-absolute-index":120,"./_to-index":121,"./_to-integer":122,"./_to-length":124,"./_to-object":125,"./_to-primitive":126,"./_typed":129,"./_typed-buffer":128,"./_uid":130,"./_wks":135,"./core.get-iterator-method":136,"./es6.array.iterator":148}],128:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var DESCRIPTORS = require('./_descriptors'); +var LIBRARY = require('./_library'); +var $typed = require('./_typed'); +var hide = require('./_hide'); +var redefineAll = require('./_redefine-all'); +var fails = require('./_fails'); +var anInstance = require('./_an-instance'); +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +var toIndex = require('./_to-index'); +var gOPN = require('./_object-gopn').f; +var dP = require('./_object-dp').f; +var arrayFill = require('./_array-fill'); +var setToStringTag = require('./_set-to-string-tag'); +var ARRAY_BUFFER = 'ArrayBuffer'; +var DATA_VIEW = 'DataView'; +var PROTOTYPE = 'prototype'; +var WRONG_LENGTH = 'Wrong length!'; +var WRONG_INDEX = 'Wrong index!'; +var $ArrayBuffer = global[ARRAY_BUFFER]; +var $DataView = global[DATA_VIEW]; +var Math = global.Math; +var RangeError = global.RangeError; +// eslint-disable-next-line no-shadow-restricted-names +var Infinity = global.Infinity; +var BaseBuffer = $ArrayBuffer; +var abs = Math.abs; +var pow = Math.pow; +var floor = Math.floor; +var log = Math.log; +var LN2 = Math.LN2; +var BUFFER = 'buffer'; +var BYTE_LENGTH = 'byteLength'; +var BYTE_OFFSET = 'byteOffset'; +var $BUFFER = DESCRIPTORS ? '_b' : BUFFER; +var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH; +var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; + +// IEEE754 conversions based on https://github.com/feross/ieee754 +function packIEEE754(value, mLen, nBytes) { + var buffer = new Array(nBytes); + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; + var i = 0; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + var e, m, c; + value = abs(value); + // eslint-disable-next-line no-self-compare + if (value != value || value === Infinity) { + // eslint-disable-next-line no-self-compare + m = value != value ? 1 : 0; + e = eMax; + } else { + e = floor(log(value) / LN2); + if (value * (c = pow(2, -e)) < 1) { + e--; + c *= 2; + } + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * pow(2, 1 - eBias); + } + if (value * c >= 2) { + e++; + c /= 2; + } + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * pow(2, mLen); + e = e + eBias; + } else { + m = value * pow(2, eBias - 1) * pow(2, mLen); + e = 0; + } + } + for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); + e = e << mLen | m; + eLen += mLen; + for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); + buffer[--i] |= s * 128; + return buffer; +} +function unpackIEEE754(buffer, mLen, nBytes) { + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = eLen - 7; + var i = nBytes - 1; + var s = buffer[i--]; + var e = s & 127; + var m; + s >>= 7; + for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : s ? -Infinity : Infinity; + } else { + m = m + pow(2, mLen); + e = e - eBias; + } return (s ? -1 : 1) * m * pow(2, e - mLen); +} + +function unpackI32(bytes) { + return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; +} +function packI8(it) { + return [it & 0xff]; +} +function packI16(it) { + return [it & 0xff, it >> 8 & 0xff]; +} +function packI32(it) { + return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; +} +function packF64(it) { + return packIEEE754(it, 52, 8); +} +function packF32(it) { + return packIEEE754(it, 23, 4); +} + +function addGetter(C, key, internal) { + dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); +} + +function get(view, bytes, index, isLittleEndian) { + var numIndex = +index; + var intIndex = toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = store.slice(start, start + bytes); + return isLittleEndian ? pack : pack.reverse(); +} +function set(view, bytes, index, conversion, value, isLittleEndian) { + var numIndex = +index; + var intIndex = toIndex(numIndex); + if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); + var store = view[$BUFFER]._b; + var start = intIndex + view[$OFFSET]; + var pack = conversion(+value); + for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; +} + +if (!$typed.ABV) { + $ArrayBuffer = function ArrayBuffer(length) { + anInstance(this, $ArrayBuffer, ARRAY_BUFFER); + var byteLength = toIndex(length); + this._b = arrayFill.call(new Array(byteLength), 0); + this[$LENGTH] = byteLength; + }; + + $DataView = function DataView(buffer, byteOffset, byteLength) { + anInstance(this, $DataView, DATA_VIEW); + anInstance(buffer, $ArrayBuffer, DATA_VIEW); + var bufferLength = buffer[$LENGTH]; + 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); + this[$BUFFER] = buffer; + this[$OFFSET] = offset; + this[$LENGTH] = byteLength; + }; + + if (DESCRIPTORS) { + addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); + addGetter($DataView, BUFFER, '_b'); + addGetter($DataView, BYTE_LENGTH, '_l'); + addGetter($DataView, BYTE_OFFSET, '_o'); + } + + 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[1]); + return (bytes[1] << 8 | bytes[0]) << 16 >> 16; + }, + getUint16: function getUint16(byteOffset /* , littleEndian */) { + var bytes = get(this, 2, byteOffset, arguments[1]); + return bytes[1] << 8 | bytes[0]; + }, + getInt32: function getInt32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])); + }, + getUint32: function getUint32(byteOffset /* , littleEndian */) { + return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; + }, + getFloat32: function getFloat32(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); + }, + getFloat64: function getFloat64(byteOffset /* , littleEndian */) { + return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); + }, + setInt8: function setInt8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setUint8: function setUint8(byteOffset, value) { + set(this, 1, byteOffset, packI8, value); + }, + setInt16: function setInt16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setUint16: function setUint16(byteOffset, value /* , littleEndian */) { + set(this, 2, byteOffset, packI16, value, arguments[2]); + }, + setInt32: function setInt32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setUint32: function setUint32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packI32, value, arguments[2]); + }, + setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { + set(this, 4, byteOffset, packF32, value, arguments[2]); + }, + setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { + set(this, 8, byteOffset, packF64, value, arguments[2]); + } + }); +} else { + if (!fails(function () { + $ArrayBuffer(1); + }) || !fails(function () { + new $ArrayBuffer(-1); // eslint-disable-line no-new + }) || fails(function () { + new $ArrayBuffer(); // eslint-disable-line no-new + new $ArrayBuffer(1.5); // eslint-disable-line no-new + new $ArrayBuffer(NaN); // eslint-disable-line no-new + return $ArrayBuffer.name != ARRAY_BUFFER; + })) { + $ArrayBuffer = function ArrayBuffer(length) { + anInstance(this, $ArrayBuffer); + return new BaseBuffer(toIndex(length)); + }; + var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; + for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { + if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]); + } + if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; + } + // iOS Safari 7.x bug + var view = new $DataView(new $ArrayBuffer(2)); + var $setInt8 = $DataView[PROTOTYPE].setInt8; + view.setInt8(0, 2147483648); + view.setInt8(1, 2147483649); + if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], { + setInt8: function setInt8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + }, + setUint8: function setUint8(byteOffset, value) { + $setInt8.call(this, byteOffset, value << 24 >> 24); + } + }, true); +} +setToStringTag($ArrayBuffer, ARRAY_BUFFER); +setToStringTag($DataView, DATA_VIEW); +hide($DataView[PROTOTYPE], $typed.VIEW, true); +exports[ARRAY_BUFFER] = $ArrayBuffer; +exports[DATA_VIEW] = $DataView; + +},{"./_an-instance":15,"./_array-fill":18,"./_descriptors":38,"./_fails":44,"./_global":49,"./_hide":51,"./_library":68,"./_object-dp":80,"./_object-gopn":85,"./_redefine-all":99,"./_set-to-string-tag":107,"./_to-index":121,"./_to-integer":122,"./_to-length":124,"./_typed":129}],129:[function(require,module,exports){ +var global = require('./_global'); +var hide = require('./_hide'); +var uid = require('./_uid'); +var TYPED = uid('typed_array'); +var VIEW = uid('view'); +var ABV = !!(global.ArrayBuffer && global.DataView); +var CONSTR = ABV; +var i = 0; +var l = 9; +var Typed; + +var TypedArrayConstructors = ( + 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' +).split(','); + +while (i < l) { + if (Typed = global[TypedArrayConstructors[i++]]) { + hide(Typed.prototype, TYPED, true); + hide(Typed.prototype, VIEW, true); + } else CONSTR = false; +} + +module.exports = { + ABV: ABV, + CONSTR: CONSTR, + TYPED: TYPED, + VIEW: VIEW +}; + +},{"./_global":49,"./_hide":51,"./_uid":130}],130:[function(require,module,exports){ +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; + +},{}],131:[function(require,module,exports){ +var global = require('./_global'); +var navigator = global.navigator; + +module.exports = navigator && navigator.userAgent || ''; + +},{"./_global":49}],132:[function(require,module,exports){ +var isObject = require('./_is-object'); +module.exports = function (it, TYPE) { + if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); + return it; +}; + +},{"./_is-object":60}],133:[function(require,module,exports){ +var global = require('./_global'); +var core = require('./_core'); +var LIBRARY = require('./_library'); +var wksExt = require('./_wks-ext'); +var defineProperty = require('./_object-dp').f; +module.exports = function (name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +}; + +},{"./_core":32,"./_global":49,"./_library":68,"./_object-dp":80,"./_wks-ext":134}],134:[function(require,module,exports){ +exports.f = require('./_wks'); + +},{"./_wks":135}],135:[function(require,module,exports){ +var store = require('./_shared')('wks'); +var uid = require('./_uid'); +var Symbol = require('./_global').Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; + +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; + +$exports.store = store; + +},{"./_global":49,"./_shared":109,"./_uid":130}],136:[function(require,module,exports){ +var classof = require('./_classof'); +var ITERATOR = require('./_wks')('iterator'); +var Iterators = require('./_iterators'); +module.exports = require('./_core').getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; + +},{"./_classof":26,"./_core":32,"./_iterators":67,"./_wks":135}],137:[function(require,module,exports){ +// https://github.com/benjamingr/RexExp.escape +var $export = require('./_export'); +var $re = require('./_replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + +$export($export.S, 'RegExp', { escape: function escape(it) { return $re(it); } }); + +},{"./_export":42,"./_replacer":101}],138:[function(require,module,exports){ +// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) +var $export = require('./_export'); + +$export($export.P, 'Array', { copyWithin: require('./_array-copy-within') }); + +require('./_add-to-unscopables')('copyWithin'); + +},{"./_add-to-unscopables":14,"./_array-copy-within":17,"./_export":42}],139:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $every = require('./_array-methods')(4); + +$export($export.P + $export.F * !require('./_strict-method')([].every, true), 'Array', { + // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) + every: function every(callbackfn /* , thisArg */) { + return $every(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],140:[function(require,module,exports){ +// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) +var $export = require('./_export'); + +$export($export.P, 'Array', { fill: require('./_array-fill') }); + +require('./_add-to-unscopables')('fill'); + +},{"./_add-to-unscopables":14,"./_array-fill":18,"./_export":42}],141:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $filter = require('./_array-methods')(2); + +$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', { + // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) + filter: function filter(callbackfn /* , thisArg */) { + return $filter(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],142:[function(require,module,exports){ +'use strict'; +// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) +var $export = require('./_export'); +var $find = require('./_array-methods')(6); +var KEY = 'findIndex'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + findIndex: function findIndex(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +require('./_add-to-unscopables')(KEY); + +},{"./_add-to-unscopables":14,"./_array-methods":21,"./_export":42}],143:[function(require,module,exports){ +'use strict'; +// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) +var $export = require('./_export'); +var $find = require('./_array-methods')(5); +var KEY = 'find'; +var forced = true; +// Shouldn't skip holes +if (KEY in []) Array(1)[KEY](function () { forced = false; }); +$export($export.P + $export.F * forced, 'Array', { + find: function find(callbackfn /* , that = undefined */) { + return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); + } +}); +require('./_add-to-unscopables')(KEY); + +},{"./_add-to-unscopables":14,"./_array-methods":21,"./_export":42}],144:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $forEach = require('./_array-methods')(0); +var STRICT = require('./_strict-method')([].forEach, true); + +$export($export.P + $export.F * !STRICT, 'Array', { + // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) + forEach: function forEach(callbackfn /* , thisArg */) { + return $forEach(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],145:[function(require,module,exports){ +'use strict'; +var ctx = require('./_ctx'); +var $export = require('./_export'); +var toObject = require('./_to-object'); +var call = require('./_iter-call'); +var isArrayIter = require('./_is-array-iter'); +var toLength = require('./_to-length'); +var createProperty = require('./_create-property'); +var getIterFn = require('./core.get-iterator-method'); + +$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { + var O = toObject(arrayLike); + var C = typeof this == 'function' ? this : Array; + var aLen = arguments.length; + var mapfn = aLen > 1 ? arguments[1] : undefined; + var mapping = mapfn !== undefined; + var index = 0; + var iterFn = getIterFn(O); + var length, result, step, iterator; + if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { + for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for (result = new C(length); length > index; index++) { + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } +}); + +},{"./_create-property":33,"./_ctx":34,"./_export":42,"./_is-array-iter":57,"./_iter-call":62,"./_iter-detect":65,"./_to-length":124,"./_to-object":125,"./core.get-iterator-method":136}],146:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $indexOf = require('./_array-includes')(false); +var $native = [].indexOf; +var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; + +$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', { + // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) + indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { + return NEGATIVE_ZERO + // convert -0 to +0 + ? $native.apply(this, arguments) || 0 + : $indexOf(this, searchElement, arguments[1]); + } +}); + +},{"./_array-includes":20,"./_export":42,"./_strict-method":111}],147:[function(require,module,exports){ +// 22.1.2.2 / 15.4.3.2 Array.isArray(arg) +var $export = require('./_export'); + +$export($export.S, 'Array', { isArray: require('./_is-array') }); + +},{"./_export":42,"./_is-array":58}],148:[function(require,module,exports){ +'use strict'; +var addToUnscopables = require('./_add-to-unscopables'); +var step = require('./_iter-step'); +var Iterators = require('./_iterators'); +var toIObject = require('./_to-iobject'); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + +},{"./_add-to-unscopables":14,"./_iter-define":64,"./_iter-step":66,"./_iterators":67,"./_to-iobject":123}],149:[function(require,module,exports){ +'use strict'; +// 22.1.3.13 Array.prototype.join(separator) +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var arrayJoin = [].join; + +// fallback for not array-like strings +$export($export.P + $export.F * (require('./_iobject') != Object || !require('./_strict-method')(arrayJoin)), 'Array', { + join: function join(separator) { + return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); + } +}); + +},{"./_export":42,"./_iobject":56,"./_strict-method":111,"./_to-iobject":123}],150:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var toInteger = require('./_to-integer'); +var toLength = require('./_to-length'); +var $native = [].lastIndexOf; +var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; + +$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', { + // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) + lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { + // convert -0 to +0 + if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0; + var O = toIObject(this); + var length = toLength(O.length); + var index = length - 1; + if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1])); + if (index < 0) index = length + index; + for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; + return -1; + } +}); + +},{"./_export":42,"./_strict-method":111,"./_to-integer":122,"./_to-iobject":123,"./_to-length":124}],151:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $map = require('./_array-methods')(1); + +$export($export.P + $export.F * !require('./_strict-method')([].map, true), 'Array', { + // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) + map: function map(callbackfn /* , thisArg */) { + return $map(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],152:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var createProperty = require('./_create-property'); + +// WebKit Array.of isn't generic +$export($export.S + $export.F * require('./_fails')(function () { + function F() { /* empty */ } + return !(Array.of.call(F) instanceof F); +}), 'Array', { + // 22.1.2.3 Array.of( ...items) + of: function of(/* ...args */) { + var index = 0; + var aLen = arguments.length; + var result = new (typeof this == 'function' ? this : Array)(aLen); + while (aLen > index) createProperty(result, index, arguments[index++]); + result.length = aLen; + return result; + } +}); + +},{"./_create-property":33,"./_export":42,"./_fails":44}],153:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $reduce = require('./_array-reduce'); + +$export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', { + // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) + reduceRight: function reduceRight(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], true); + } +}); + +},{"./_array-reduce":22,"./_export":42,"./_strict-method":111}],154:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $reduce = require('./_array-reduce'); + +$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', { + // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) + reduce: function reduce(callbackfn /* , initialValue */) { + return $reduce(this, callbackfn, arguments.length, arguments[1], false); + } +}); + +},{"./_array-reduce":22,"./_export":42,"./_strict-method":111}],155:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var html = require('./_html'); +var cof = require('./_cof'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +var arraySlice = [].slice; + +// fallback for not array-like ES3 strings and DOM objects +$export($export.P + $export.F * require('./_fails')(function () { + if (html) arraySlice.call(html); +}), 'Array', { + slice: function slice(begin, end) { + var len = toLength(this.length); + var klass = cof(this); + end = end === undefined ? len : end; + if (klass == 'Array') return arraySlice.call(this, begin, end); + var start = toAbsoluteIndex(begin, len); + var upTo = toAbsoluteIndex(end, len); + var size = toLength(upTo - start); + var cloned = new Array(size); + var i = 0; + for (; i < size; i++) cloned[i] = klass == 'String' + ? this.charAt(start + i) + : this[start + i]; + return cloned; + } +}); + +},{"./_cof":27,"./_export":42,"./_fails":44,"./_html":52,"./_to-absolute-index":120,"./_to-length":124}],156:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $some = require('./_array-methods')(3); + +$export($export.P + $export.F * !require('./_strict-method')([].some, true), 'Array', { + // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) + some: function some(callbackfn /* , thisArg */) { + return $some(this, callbackfn, arguments[1]); + } +}); + +},{"./_array-methods":21,"./_export":42,"./_strict-method":111}],157:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var toObject = require('./_to-object'); +var fails = require('./_fails'); +var $sort = [].sort; +var test = [1, 2, 3]; + +$export($export.P + $export.F * (fails(function () { + // IE8- + test.sort(undefined); +}) || !fails(function () { + // V8 bug + test.sort(null); + // Old WebKit +}) || !require('./_strict-method')($sort)), 'Array', { + // 22.1.3.25 Array.prototype.sort(comparefn) + sort: function sort(comparefn) { + return comparefn === undefined + ? $sort.call(toObject(this)) + : $sort.call(toObject(this), aFunction(comparefn)); + } +}); + +},{"./_a-function":12,"./_export":42,"./_fails":44,"./_strict-method":111,"./_to-object":125}],158:[function(require,module,exports){ +require('./_set-species')('Array'); + +},{"./_set-species":106}],159:[function(require,module,exports){ +// 20.3.3.1 / 15.9.4.4 Date.now() +var $export = require('./_export'); + +$export($export.S, 'Date', { now: function () { return new Date().getTime(); } }); + +},{"./_export":42}],160:[function(require,module,exports){ +// 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() +var $export = require('./_export'); +var toISOString = require('./_date-to-iso-string'); + +// PhantomJS / old WebKit has a broken implementations +$export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', { + toISOString: toISOString +}); + +},{"./_date-to-iso-string":35,"./_export":42}],161:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); + +$export($export.P + $export.F * require('./_fails')(function () { + return new Date(NaN).toJSON() !== null + || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; +}), 'Date', { + // eslint-disable-next-line no-unused-vars + toJSON: function toJSON(key) { + var O = toObject(this); + var pv = toPrimitive(O); + return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); + } +}); + +},{"./_export":42,"./_fails":44,"./_to-object":125,"./_to-primitive":126}],162:[function(require,module,exports){ +var TO_PRIMITIVE = require('./_wks')('toPrimitive'); +var proto = Date.prototype; + +if (!(TO_PRIMITIVE in proto)) require('./_hide')(proto, TO_PRIMITIVE, require('./_date-to-primitive')); + +},{"./_date-to-primitive":36,"./_hide":51,"./_wks":135}],163:[function(require,module,exports){ +var DateProto = Date.prototype; +var INVALID_DATE = 'Invalid Date'; +var TO_STRING = 'toString'; +var $toString = DateProto[TO_STRING]; +var getTime = DateProto.getTime; +if (new Date(NaN) + '' != INVALID_DATE) { + require('./_redefine')(DateProto, TO_STRING, function toString() { + var value = getTime.call(this); + // eslint-disable-next-line no-self-compare + return value === value ? $toString.call(this) : INVALID_DATE; + }); +} + +},{"./_redefine":100}],164:[function(require,module,exports){ +// 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) +var $export = require('./_export'); + +$export($export.P, 'Function', { bind: require('./_bind') }); + +},{"./_bind":25,"./_export":42}],165:[function(require,module,exports){ +'use strict'; +var isObject = require('./_is-object'); +var getPrototypeOf = require('./_object-gpo'); +var HAS_INSTANCE = require('./_wks')('hasInstance'); +var FunctionProto = Function.prototype; +// 19.2.3.6 Function.prototype[@@hasInstance](V) +if (!(HAS_INSTANCE in FunctionProto)) require('./_object-dp').f(FunctionProto, HAS_INSTANCE, { value: function (O) { + if (typeof this != 'function' || !isObject(O)) return false; + if (!isObject(this.prototype)) return O instanceof this; + // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + while (O = getPrototypeOf(O)) if (this.prototype === O) return true; + return false; +} }); + +},{"./_is-object":60,"./_object-dp":80,"./_object-gpo":87,"./_wks":135}],166:[function(require,module,exports){ +var dP = require('./_object-dp').f; +var FProto = Function.prototype; +var nameRE = /^\s*function ([^ (]*)/; +var NAME = 'name'; + +// 19.2.4.2 name +NAME in FProto || require('./_descriptors') && dP(FProto, NAME, { + configurable: true, + get: function () { + try { + return ('' + this).match(nameRE)[1]; + } catch (e) { + return ''; + } + } +}); + +},{"./_descriptors":38,"./_object-dp":80}],167:[function(require,module,exports){ +'use strict'; +var strong = require('./_collection-strong'); +var validate = require('./_validate-collection'); +var MAP = 'Map'; + +// 23.1 Map Objects +module.exports = require('./_collection')(MAP, function (get) { + return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.1.3.6 Map.prototype.get(key) + get: function get(key) { + var entry = strong.getEntry(validate(this, MAP), key); + return entry && entry.v; + }, + // 23.1.3.9 Map.prototype.set(key, value) + set: function set(key, value) { + return strong.def(validate(this, MAP), key === 0 ? 0 : key, value); + } +}, strong, true); + +},{"./_collection":31,"./_collection-strong":28,"./_validate-collection":132}],168:[function(require,module,exports){ +// 20.2.2.3 Math.acosh(x) +var $export = require('./_export'); +var log1p = require('./_math-log1p'); +var sqrt = Math.sqrt; +var $acosh = Math.acosh; + +$export($export.S + $export.F * !($acosh + // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 + && Math.floor($acosh(Number.MAX_VALUE)) == 710 + // Tor Browser bug: Math.acosh(Infinity) -> NaN + && $acosh(Infinity) == Infinity +), 'Math', { + acosh: function acosh(x) { + return (x = +x) < 1 ? NaN : x > 94906265.62425156 + ? Math.log(x) + Math.LN2 + : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); + } +}); + +},{"./_export":42,"./_math-log1p":71}],169:[function(require,module,exports){ +// 20.2.2.5 Math.asinh(x) +var $export = require('./_export'); +var $asinh = Math.asinh; + +function asinh(x) { + return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); +} + +// Tor Browser bug: Math.asinh(0) -> -0 +$export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh }); + +},{"./_export":42}],170:[function(require,module,exports){ +// 20.2.2.7 Math.atanh(x) +var $export = require('./_export'); +var $atanh = Math.atanh; + +// Tor Browser bug: Math.atanh(-0) -> 0 +$export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { + atanh: function atanh(x) { + return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; + } +}); + +},{"./_export":42}],171:[function(require,module,exports){ +// 20.2.2.9 Math.cbrt(x) +var $export = require('./_export'); +var sign = require('./_math-sign'); + +$export($export.S, 'Math', { + cbrt: function cbrt(x) { + return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); + } +}); + +},{"./_export":42,"./_math-sign":73}],172:[function(require,module,exports){ +// 20.2.2.11 Math.clz32(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + clz32: function clz32(x) { + return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; + } +}); + +},{"./_export":42}],173:[function(require,module,exports){ +// 20.2.2.12 Math.cosh(x) +var $export = require('./_export'); +var exp = Math.exp; + +$export($export.S, 'Math', { + cosh: function cosh(x) { + return (exp(x = +x) + exp(-x)) / 2; + } +}); + +},{"./_export":42}],174:[function(require,module,exports){ +// 20.2.2.14 Math.expm1(x) +var $export = require('./_export'); +var $expm1 = require('./_math-expm1'); + +$export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 }); + +},{"./_export":42,"./_math-expm1":69}],175:[function(require,module,exports){ +// 20.2.2.16 Math.fround(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { fround: require('./_math-fround') }); + +},{"./_export":42,"./_math-fround":70}],176:[function(require,module,exports){ +// 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) +var $export = require('./_export'); +var abs = Math.abs; + +$export($export.S, 'Math', { + hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars + var sum = 0; + var i = 0; + var aLen = arguments.length; + var larg = 0; + var arg, div; + while (i < aLen) { + arg = abs(arguments[i++]); + if (larg < arg) { + div = larg / arg; + sum = sum * div * div + 1; + larg = arg; + } else if (arg > 0) { + div = arg / larg; + sum += div * div; + } else sum += arg; + } + return larg === Infinity ? Infinity : larg * Math.sqrt(sum); + } +}); + +},{"./_export":42}],177:[function(require,module,exports){ +// 20.2.2.18 Math.imul(x, y) +var $export = require('./_export'); +var $imul = Math.imul; + +// some WebKit versions fails with big numbers, some has wrong arity +$export($export.S + $export.F * require('./_fails')(function () { + return $imul(0xffffffff, 5) != -5 || $imul.length != 2; +}), 'Math', { + imul: function imul(x, y) { + var UINT16 = 0xffff; + var xn = +x; + var yn = +y; + var xl = UINT16 & xn; + var yl = UINT16 & yn; + return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); + } +}); + +},{"./_export":42,"./_fails":44}],178:[function(require,module,exports){ +// 20.2.2.21 Math.log10(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + log10: function log10(x) { + return Math.log(x) * Math.LOG10E; + } +}); + +},{"./_export":42}],179:[function(require,module,exports){ +// 20.2.2.20 Math.log1p(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { log1p: require('./_math-log1p') }); + +},{"./_export":42,"./_math-log1p":71}],180:[function(require,module,exports){ +// 20.2.2.22 Math.log2(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + log2: function log2(x) { + return Math.log(x) / Math.LN2; + } +}); + +},{"./_export":42}],181:[function(require,module,exports){ +// 20.2.2.28 Math.sign(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { sign: require('./_math-sign') }); + +},{"./_export":42,"./_math-sign":73}],182:[function(require,module,exports){ +// 20.2.2.30 Math.sinh(x) +var $export = require('./_export'); +var expm1 = require('./_math-expm1'); +var exp = Math.exp; + +// V8 near Chromium 38 has a problem with very small numbers +$export($export.S + $export.F * require('./_fails')(function () { + return !Math.sinh(-2e-17) != -2e-17; +}), 'Math', { + sinh: function sinh(x) { + return Math.abs(x = +x) < 1 + ? (expm1(x) - expm1(-x)) / 2 + : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); + } +}); + +},{"./_export":42,"./_fails":44,"./_math-expm1":69}],183:[function(require,module,exports){ +// 20.2.2.33 Math.tanh(x) +var $export = require('./_export'); +var expm1 = require('./_math-expm1'); +var exp = Math.exp; + +$export($export.S, 'Math', { + tanh: function tanh(x) { + var a = expm1(x = +x); + var b = expm1(-x); + return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); + } +}); + +},{"./_export":42,"./_math-expm1":69}],184:[function(require,module,exports){ +// 20.2.2.34 Math.trunc(x) +var $export = require('./_export'); + +$export($export.S, 'Math', { + trunc: function trunc(it) { + return (it > 0 ? Math.floor : Math.ceil)(it); + } +}); + +},{"./_export":42}],185:[function(require,module,exports){ +'use strict'; +var global = require('./_global'); +var has = require('./_has'); +var cof = require('./_cof'); +var inheritIfRequired = require('./_inherit-if-required'); +var toPrimitive = require('./_to-primitive'); +var fails = require('./_fails'); +var gOPN = require('./_object-gopn').f; +var gOPD = require('./_object-gopd').f; +var dP = require('./_object-dp').f; +var $trim = require('./_string-trim').trim; +var NUMBER = 'Number'; +var $Number = global[NUMBER]; +var Base = $Number; +var proto = $Number.prototype; +// Opera ~12 has broken Object#toString +var BROKEN_COF = cof(require('./_object-create')(proto)) == NUMBER; +var TRIM = 'trim' in String.prototype; + +// 7.1.3 ToNumber(argument) +var toNumber = function (argument) { + var it = toPrimitive(argument, false); + if (typeof it == 'string' && it.length > 2) { + it = TRIM ? it.trim() : $trim(it, 3); + var first = it.charCodeAt(0); + var third, radix, maxCode; + if (first === 43 || first === 45) { + third = it.charCodeAt(2); + if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix + } else if (first === 48) { + switch (it.charCodeAt(1)) { + case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i + case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i + default: return +it; + } + for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { + code = digits.charCodeAt(i); + // parseInt parses a string to a first unavailable symbol + // but ToNumber should return NaN if a string contains unavailable symbols + if (code < 48 || code > maxCode) return NaN; + } return parseInt(digits, radix); + } + } return +it; +}; + +if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { + $Number = function Number(value) { + var it = arguments.length < 1 ? 0 : value; + var that = this; + return that instanceof $Number + // check on 1..constructor(foo) case + && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) + ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); + }; + for (var keys = require('./_descriptors') ? gOPN(Base) : ( + // ES3: + 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + + // ES6 (in case, if modules with ES6 Number statics required before): + 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' + ).split(','), j = 0, key; keys.length > j; j++) { + if (has(Base, key = keys[j]) && !has($Number, key)) { + dP($Number, key, gOPD(Base, key)); + } + } + $Number.prototype = proto; + proto.constructor = $Number; + require('./_redefine')(global, NUMBER, $Number); +} + +},{"./_cof":27,"./_descriptors":38,"./_fails":44,"./_global":49,"./_has":50,"./_inherit-if-required":54,"./_object-create":79,"./_object-dp":80,"./_object-gopd":83,"./_object-gopn":85,"./_redefine":100,"./_string-trim":117,"./_to-primitive":126}],186:[function(require,module,exports){ +// 20.1.2.1 Number.EPSILON +var $export = require('./_export'); + +$export($export.S, 'Number', { EPSILON: Math.pow(2, -52) }); + +},{"./_export":42}],187:[function(require,module,exports){ +// 20.1.2.2 Number.isFinite(number) +var $export = require('./_export'); +var _isFinite = require('./_global').isFinite; + +$export($export.S, 'Number', { + isFinite: function isFinite(it) { + return typeof it == 'number' && _isFinite(it); + } +}); + +},{"./_export":42,"./_global":49}],188:[function(require,module,exports){ +// 20.1.2.3 Number.isInteger(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { isInteger: require('./_is-integer') }); + +},{"./_export":42,"./_is-integer":59}],189:[function(require,module,exports){ +// 20.1.2.4 Number.isNaN(number) +var $export = require('./_export'); + +$export($export.S, 'Number', { + isNaN: function isNaN(number) { + // eslint-disable-next-line no-self-compare + return number != number; + } +}); + +},{"./_export":42}],190:[function(require,module,exports){ +// 20.1.2.5 Number.isSafeInteger(number) +var $export = require('./_export'); +var isInteger = require('./_is-integer'); +var abs = Math.abs; + +$export($export.S, 'Number', { + isSafeInteger: function isSafeInteger(number) { + return isInteger(number) && abs(number) <= 0x1fffffffffffff; + } +}); + +},{"./_export":42,"./_is-integer":59}],191:[function(require,module,exports){ +// 20.1.2.6 Number.MAX_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); + +},{"./_export":42}],192:[function(require,module,exports){ +// 20.1.2.10 Number.MIN_SAFE_INTEGER +var $export = require('./_export'); + +$export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); + +},{"./_export":42}],193:[function(require,module,exports){ +var $export = require('./_export'); +var $parseFloat = require('./_parse-float'); +// 20.1.2.12 Number.parseFloat(string) +$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat }); + +},{"./_export":42,"./_parse-float":94}],194:[function(require,module,exports){ +var $export = require('./_export'); +var $parseInt = require('./_parse-int'); +// 20.1.2.13 Number.parseInt(string, radix) +$export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt }); + +},{"./_export":42,"./_parse-int":95}],195:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toInteger = require('./_to-integer'); +var aNumberValue = require('./_a-number-value'); +var repeat = require('./_string-repeat'); +var $toFixed = 1.0.toFixed; +var floor = Math.floor; +var data = [0, 0, 0, 0, 0, 0]; +var ERROR = 'Number.toFixed: incorrect invocation!'; +var ZERO = '0'; + +var multiply = function (n, c) { + var i = -1; + var c2 = c; + while (++i < 6) { + c2 += n * data[i]; + data[i] = c2 % 1e7; + c2 = floor(c2 / 1e7); + } +}; +var divide = function (n) { + var i = 6; + var c = 0; + while (--i >= 0) { + c += data[i]; + data[i] = floor(c / n); + c = (c % n) * 1e7; + } +}; +var numToString = function () { + var i = 6; + var s = ''; + while (--i >= 0) { + if (s !== '' || i === 0 || data[i] !== 0) { + var t = String(data[i]); + s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; + } + } return s; +}; +var pow = function (x, n, acc) { + return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); +}; +var log = function (x) { + var n = 0; + var x2 = x; + while (x2 >= 4096) { + n += 12; + x2 /= 4096; + } + while (x2 >= 2) { + n += 1; + x2 /= 2; + } return n; +}; + +$export($export.P + $export.F * (!!$toFixed && ( + 0.00008.toFixed(3) !== '0.000' || + 0.9.toFixed(0) !== '1' || + 1.255.toFixed(2) !== '1.25' || + 1000000000000000128.0.toFixed(0) !== '1000000000000000128' +) || !require('./_fails')(function () { + // V8 ~ Android 4.3- + $toFixed.call({}); +})), 'Number', { + toFixed: function toFixed(fractionDigits) { + var x = aNumberValue(this, ERROR); + var f = toInteger(fractionDigits); + var s = ''; + var m = ZERO; + var e, z, j, k; + if (f < 0 || f > 20) throw RangeError(ERROR); + // eslint-disable-next-line no-self-compare + if (x != x) return 'NaN'; + if (x <= -1e21 || x >= 1e21) return String(x); + if (x < 0) { + s = '-'; + x = -x; + } + if (x > 1e-21) { + e = log(x * pow(2, 69, 1)) - 69; + z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); + z *= 0x10000000000000; + e = 52 - e; + if (e > 0) { + multiply(0, z); + j = f; + while (j >= 7) { + multiply(1e7, 0); + j -= 7; + } + multiply(pow(10, j, 1), 0); + j = e - 1; + while (j >= 23) { + divide(1 << 23); + j -= 23; + } + divide(1 << j); + multiply(1, 1); + divide(2); + m = numToString(); + } else { + multiply(0, z); + multiply(1 << -e, 0); + m = numToString() + repeat.call(ZERO, f); + } + } + if (f > 0) { + k = m.length; + m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); + } else { + m = s + m; + } return m; + } +}); + +},{"./_a-number-value":13,"./_export":42,"./_fails":44,"./_string-repeat":116,"./_to-integer":122}],196:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $fails = require('./_fails'); +var aNumberValue = require('./_a-number-value'); +var $toPrecision = 1.0.toPrecision; + +$export($export.P + $export.F * ($fails(function () { + // IE7- + return $toPrecision.call(1, undefined) !== '1'; +}) || !$fails(function () { + // V8 ~ Android 4.3- + $toPrecision.call({}); +})), 'Number', { + toPrecision: function toPrecision(precision) { + var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); + return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); + } +}); + +},{"./_a-number-value":13,"./_export":42,"./_fails":44}],197:[function(require,module,exports){ +// 19.1.3.1 Object.assign(target, source) +var $export = require('./_export'); + +$export($export.S + $export.F, 'Object', { assign: require('./_object-assign') }); + +},{"./_export":42,"./_object-assign":78}],198:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +$export($export.S, 'Object', { create: require('./_object-create') }); + +},{"./_export":42,"./_object-create":79}],199:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') }); + +},{"./_descriptors":38,"./_export":42,"./_object-dps":81}],200:[function(require,module,exports){ +var $export = require('./_export'); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) +$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f }); + +},{"./_descriptors":38,"./_export":42,"./_object-dp":80}],201:[function(require,module,exports){ +// 19.1.2.5 Object.freeze(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('freeze', function ($freeze) { + return function freeze(it) { + return $freeze && isObject(it) ? $freeze(meta(it)) : it; + }; +}); + +},{"./_is-object":60,"./_meta":74,"./_object-sap":91}],202:[function(require,module,exports){ +// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) +var toIObject = require('./_to-iobject'); +var $getOwnPropertyDescriptor = require('./_object-gopd').f; + +require('./_object-sap')('getOwnPropertyDescriptor', function () { + return function getOwnPropertyDescriptor(it, key) { + return $getOwnPropertyDescriptor(toIObject(it), key); + }; +}); + +},{"./_object-gopd":83,"./_object-sap":91,"./_to-iobject":123}],203:[function(require,module,exports){ +// 19.1.2.7 Object.getOwnPropertyNames(O) +require('./_object-sap')('getOwnPropertyNames', function () { + return require('./_object-gopn-ext').f; +}); + +},{"./_object-gopn-ext":84,"./_object-sap":91}],204:[function(require,module,exports){ +// 19.1.2.9 Object.getPrototypeOf(O) +var toObject = require('./_to-object'); +var $getPrototypeOf = require('./_object-gpo'); + +require('./_object-sap')('getPrototypeOf', function () { + return function getPrototypeOf(it) { + return $getPrototypeOf(toObject(it)); + }; +}); + +},{"./_object-gpo":87,"./_object-sap":91,"./_to-object":125}],205:[function(require,module,exports){ +// 19.1.2.11 Object.isExtensible(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isExtensible', function ($isExtensible) { + return function isExtensible(it) { + return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; + }; +}); + +},{"./_is-object":60,"./_object-sap":91}],206:[function(require,module,exports){ +// 19.1.2.12 Object.isFrozen(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isFrozen', function ($isFrozen) { + return function isFrozen(it) { + return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + }; +}); + +},{"./_is-object":60,"./_object-sap":91}],207:[function(require,module,exports){ +// 19.1.2.13 Object.isSealed(O) +var isObject = require('./_is-object'); + +require('./_object-sap')('isSealed', function ($isSealed) { + return function isSealed(it) { + return isObject(it) ? $isSealed ? $isSealed(it) : false : true; + }; +}); + +},{"./_is-object":60,"./_object-sap":91}],208:[function(require,module,exports){ +// 19.1.3.10 Object.is(value1, value2) +var $export = require('./_export'); +$export($export.S, 'Object', { is: require('./_same-value') }); + +},{"./_export":42,"./_same-value":102}],209:[function(require,module,exports){ +// 19.1.2.14 Object.keys(O) +var toObject = require('./_to-object'); +var $keys = require('./_object-keys'); + +require('./_object-sap')('keys', function () { + return function keys(it) { + return $keys(toObject(it)); + }; +}); + +},{"./_object-keys":89,"./_object-sap":91,"./_to-object":125}],210:[function(require,module,exports){ +// 19.1.2.15 Object.preventExtensions(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('preventExtensions', function ($preventExtensions) { + return function preventExtensions(it) { + return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; + }; +}); + +},{"./_is-object":60,"./_meta":74,"./_object-sap":91}],211:[function(require,module,exports){ +// 19.1.2.17 Object.seal(O) +var isObject = require('./_is-object'); +var meta = require('./_meta').onFreeze; + +require('./_object-sap')('seal', function ($seal) { + return function seal(it) { + return $seal && isObject(it) ? $seal(meta(it)) : it; + }; +}); + +},{"./_is-object":60,"./_meta":74,"./_object-sap":91}],212:[function(require,module,exports){ +// 19.1.3.19 Object.setPrototypeOf(O, proto) +var $export = require('./_export'); +$export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set }); + +},{"./_export":42,"./_set-proto":105}],213:[function(require,module,exports){ +'use strict'; +// 19.1.3.6 Object.prototype.toString() +var classof = require('./_classof'); +var test = {}; +test[require('./_wks')('toStringTag')] = 'z'; +if (test + '' != '[object z]') { + require('./_redefine')(Object.prototype, 'toString', function toString() { + return '[object ' + classof(this) + ']'; + }, true); +} + +},{"./_classof":26,"./_redefine":100,"./_wks":135}],214:[function(require,module,exports){ +var $export = require('./_export'); +var $parseFloat = require('./_parse-float'); +// 18.2.4 parseFloat(string) +$export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat }); + +},{"./_export":42,"./_parse-float":94}],215:[function(require,module,exports){ +var $export = require('./_export'); +var $parseInt = require('./_parse-int'); +// 18.2.5 parseInt(string, radix) +$export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); + +},{"./_export":42,"./_parse-int":95}],216:[function(require,module,exports){ +'use strict'; +var LIBRARY = require('./_library'); +var global = require('./_global'); +var ctx = require('./_ctx'); +var classof = require('./_classof'); +var $export = require('./_export'); +var isObject = require('./_is-object'); +var aFunction = require('./_a-function'); +var anInstance = require('./_an-instance'); +var forOf = require('./_for-of'); +var speciesConstructor = require('./_species-constructor'); +var task = require('./_task').set; +var microtask = require('./_microtask')(); +var newPromiseCapabilityModule = require('./_new-promise-capability'); +var perform = require('./_perform'); +var userAgent = require('./_user-agent'); +var promiseResolve = require('./_promise-resolve'); +var PROMISE = 'Promise'; +var TypeError = global.TypeError; +var process = global.process; +var versions = process && process.versions; +var v8 = versions && versions.v8 || ''; +var $Promise = global[PROMISE]; +var isNode = classof(process) == 'process'; +var empty = function () { /* empty */ }; +var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; +var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; + +var USE_NATIVE = !!function () { + try { + // correct subclassing with @@species support + var promise = $Promise.resolve(1); + var FakePromise = (promise.constructor = {})[require('./_wks')('species')] = function (exec) { + exec(empty, empty); + }; + // unhandled rejections tracking support, NodeJS Promise without it fails @@species test + return (isNode || typeof PromiseRejectionEvent == 'function') + && promise.then(empty) instanceof FakePromise + // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables + // https://bugs.chromium.org/p/chromium/issues/detail?id=830565 + // we can't detect it synchronously, so just check versions + && v8.indexOf('6.6') !== 0 + && userAgent.indexOf('Chrome/66') === -1; + } catch (e) { /* empty */ } +}(); + +// helpers +var isThenable = function (it) { + var then; + return isObject(it) && typeof (then = it.then) == 'function' ? then : false; +}; +var notify = function (promise, isReject) { + if (promise._n) return; + promise._n = true; + var chain = promise._c; + microtask(function () { + var value = promise._v; + var ok = promise._s == 1; + var i = 0; + var run = function (reaction) { + var handler = ok ? reaction.ok : reaction.fail; + var resolve = reaction.resolve; + var reject = reaction.reject; + var domain = reaction.domain; + var result, then, exited; + try { + if (handler) { + if (!ok) { + if (promise._h == 2) onHandleUnhandled(promise); + promise._h = 1; + } + if (handler === true) result = value; + else { + if (domain) domain.enter(); + result = handler(value); // may throw + if (domain) { + domain.exit(); + exited = true; + } + } + if (result === reaction.promise) { + reject(TypeError('Promise-chain cycle')); + } else if (then = isThenable(result)) { + then.call(result, resolve, reject); + } else resolve(result); + } else reject(value); + } catch (e) { + if (domain && !exited) domain.exit(); + reject(e); + } + }; + while (chain.length > i) run(chain[i++]); // variable length - can't use forEach + promise._c = []; + promise._n = false; + if (isReject && !promise._h) onUnhandled(promise); + }); +}; +var onUnhandled = function (promise) { + task.call(global, function () { + var value = promise._v; + var unhandled = isUnhandled(promise); + var result, handler, console; + if (unhandled) { + result = perform(function () { + if (isNode) { + process.emit('unhandledRejection', value, promise); + } else if (handler = global.onunhandledrejection) { + handler({ promise: promise, reason: value }); + } else if ((console = global.console) && console.error) { + console.error('Unhandled promise rejection', value); + } + }); + // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should + promise._h = isNode || isUnhandled(promise) ? 2 : 1; + } promise._a = undefined; + if (unhandled && result.e) throw result.v; + }); +}; +var isUnhandled = function (promise) { + return promise._h !== 1 && (promise._a || promise._c).length === 0; +}; +var onHandleUnhandled = function (promise) { + task.call(global, function () { + var handler; + if (isNode) { + process.emit('rejectionHandled', promise); + } else if (handler = global.onrejectionhandled) { + handler({ promise: promise, reason: promise._v }); + } + }); +}; +var $reject = function (value) { + var promise = this; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + promise._v = value; + promise._s = 2; + if (!promise._a) promise._a = promise._c.slice(); + notify(promise, true); +}; +var $resolve = function (value) { + var promise = this; + var then; + if (promise._d) return; + promise._d = true; + promise = promise._w || promise; // unwrap + try { + if (promise === value) throw TypeError("Promise can't be resolved itself"); + if (then = isThenable(value)) { + microtask(function () { + var wrapper = { _w: promise, _d: false }; // wrap + try { + then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); + } catch (e) { + $reject.call(wrapper, e); + } + }); + } else { + promise._v = value; + promise._s = 1; + notify(promise, false); + } + } catch (e) { + $reject.call({ _w: promise, _d: false }, e); // wrap + } +}; + +// constructor polyfill +if (!USE_NATIVE) { + // 25.4.3.1 Promise(executor) + $Promise = function Promise(executor) { + anInstance(this, $Promise, PROMISE, '_h'); + aFunction(executor); + Internal.call(this); + try { + executor(ctx($resolve, this, 1), ctx($reject, this, 1)); + } catch (err) { + $reject.call(this, err); + } + }; + // eslint-disable-next-line no-unused-vars + Internal = function Promise(executor) { + this._c = []; // <- awaiting reactions + this._a = undefined; // <- checked in isUnhandled reactions + this._s = 0; // <- state + this._d = false; // <- done + this._v = undefined; // <- value + this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled + this._n = false; // <- notify + }; + Internal.prototype = require('./_redefine-all')($Promise.prototype, { + // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) + then: function then(onFulfilled, onRejected) { + var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); + reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; + reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.domain = isNode ? process.domain : undefined; + this._c.push(reaction); + if (this._a) this._a.push(reaction); + if (this._s) notify(this, false); + return reaction.promise; + }, + // 25.4.5.1 Promise.prototype.catch(onRejected) + 'catch': function (onRejected) { + return this.then(undefined, onRejected); + } + }); + OwnPromiseCapability = function () { + var promise = new Internal(); + this.promise = promise; + this.resolve = ctx($resolve, promise, 1); + this.reject = ctx($reject, promise, 1); + }; + newPromiseCapabilityModule.f = newPromiseCapability = function (C) { + return C === $Promise || C === Wrapper + ? new OwnPromiseCapability(C) + : newGenericPromiseCapability(C); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); +require('./_set-to-string-tag')($Promise, PROMISE); +require('./_set-species')(PROMISE); +Wrapper = require('./_core')[PROMISE]; + +// statics +$export($export.S + $export.F * !USE_NATIVE, PROMISE, { + // 25.4.4.5 Promise.reject(r) + reject: function reject(r) { + var capability = newPromiseCapability(this); + var $$reject = capability.reject; + $$reject(r); + return capability.promise; + } +}); +$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { + // 25.4.4.6 Promise.resolve(x) + resolve: function resolve(x) { + return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); + } +}); +$export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) { + $Promise.all(iter)['catch'](empty); +})), PROMISE, { + // 25.4.4.1 Promise.all(iterable) + all: function all(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var resolve = capability.resolve; + var reject = capability.reject; + var result = perform(function () { + var values = []; + var index = 0; + var remaining = 1; + forOf(iterable, false, function (promise) { + var $index = index++; + var alreadyCalled = false; + values.push(undefined); + remaining++; + C.resolve(promise).then(function (value) { + if (alreadyCalled) return; + alreadyCalled = true; + values[$index] = value; + --remaining || resolve(values); + }, reject); + }); + --remaining || resolve(values); + }); + if (result.e) reject(result.v); + return capability.promise; + }, + // 25.4.4.4 Promise.race(iterable) + race: function race(iterable) { + var C = this; + var capability = newPromiseCapability(C); + var reject = capability.reject; + var result = perform(function () { + forOf(iterable, false, function (promise) { + C.resolve(promise).then(capability.resolve, reject); + }); + }); + if (result.e) reject(result.v); + return capability.promise; + } +}); + +},{"./_a-function":12,"./_an-instance":15,"./_classof":26,"./_core":32,"./_ctx":34,"./_export":42,"./_for-of":48,"./_global":49,"./_is-object":60,"./_iter-detect":65,"./_library":68,"./_microtask":76,"./_new-promise-capability":77,"./_perform":96,"./_promise-resolve":97,"./_redefine-all":99,"./_set-species":106,"./_set-to-string-tag":107,"./_species-constructor":110,"./_task":119,"./_user-agent":131,"./_wks":135}],217:[function(require,module,exports){ +// 26.1.1 Reflect.apply(target, thisArgument, argumentsList) +var $export = require('./_export'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var rApply = (require('./_global').Reflect || {}).apply; +var fApply = Function.apply; +// MS Edge argumentsList argument is optional +$export($export.S + $export.F * !require('./_fails')(function () { + rApply(function () { /* empty */ }); +}), 'Reflect', { + apply: function apply(target, thisArgument, argumentsList) { + var T = aFunction(target); + var L = anObject(argumentsList); + return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); + } +}); + +},{"./_a-function":12,"./_an-object":16,"./_export":42,"./_fails":44,"./_global":49}],218:[function(require,module,exports){ +// 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) +var $export = require('./_export'); +var create = require('./_object-create'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var bind = require('./_bind'); +var rConstruct = (require('./_global').Reflect || {}).construct; + +// MS Edge supports only 2 arguments and argumentsList argument is optional +// FF Nightly sets third argument as `new.target`, but does not create `this` from it +var NEW_TARGET_BUG = fails(function () { + function F() { /* empty */ } + return !(rConstruct(function () { /* empty */ }, [], F) instanceof F); +}); +var ARGS_BUG = !fails(function () { + rConstruct(function () { /* empty */ }); +}); + +$export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { + construct: function construct(Target, args /* , newTarget */) { + aFunction(Target); + anObject(args); + var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); + if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget); + if (Target == newTarget) { + // w/o altered newTarget, optimization for 0-4 arguments + switch (args.length) { + case 0: return new Target(); + case 1: return new Target(args[0]); + case 2: return new Target(args[0], args[1]); + case 3: return new Target(args[0], args[1], args[2]); + case 4: return new Target(args[0], args[1], args[2], args[3]); + } + // w/o altered newTarget, lot of arguments case + var $args = [null]; + $args.push.apply($args, args); + return new (bind.apply(Target, $args))(); + } + // with altered newTarget, not support built-in constructors + var proto = newTarget.prototype; + var instance = create(isObject(proto) ? proto : Object.prototype); + var result = Function.apply.call(Target, instance, args); + return isObject(result) ? result : instance; + } +}); + +},{"./_a-function":12,"./_an-object":16,"./_bind":25,"./_export":42,"./_fails":44,"./_global":49,"./_is-object":60,"./_object-create":79}],219:[function(require,module,exports){ +// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) +var dP = require('./_object-dp'); +var $export = require('./_export'); +var anObject = require('./_an-object'); +var toPrimitive = require('./_to-primitive'); + +// MS Edge has broken Reflect.defineProperty - throwing instead of returning false +$export($export.S + $export.F * require('./_fails')(function () { + // eslint-disable-next-line no-undef + Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); +}), 'Reflect', { + defineProperty: function defineProperty(target, propertyKey, attributes) { + anObject(target); + propertyKey = toPrimitive(propertyKey, true); + anObject(attributes); + try { + dP.f(target, propertyKey, attributes); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_an-object":16,"./_export":42,"./_fails":44,"./_object-dp":80,"./_to-primitive":126}],220:[function(require,module,exports){ +// 26.1.4 Reflect.deleteProperty(target, propertyKey) +var $export = require('./_export'); +var gOPD = require('./_object-gopd').f; +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + deleteProperty: function deleteProperty(target, propertyKey) { + var desc = gOPD(anObject(target), propertyKey); + return desc && !desc.configurable ? false : delete target[propertyKey]; + } +}); + +},{"./_an-object":16,"./_export":42,"./_object-gopd":83}],221:[function(require,module,exports){ +'use strict'; +// 26.1.5 Reflect.enumerate(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var Enumerate = function (iterated) { + this._t = anObject(iterated); // target + this._i = 0; // next index + var keys = this._k = []; // keys + var key; + for (key in iterated) keys.push(key); +}; +require('./_iter-create')(Enumerate, 'Object', function () { + var that = this; + var keys = that._k; + var key; + do { + if (that._i >= keys.length) return { value: undefined, done: true }; + } while (!((key = keys[that._i++]) in that._t)); + return { value: key, done: false }; +}); + +$export($export.S, 'Reflect', { + enumerate: function enumerate(target) { + return new Enumerate(target); + } +}); + +},{"./_an-object":16,"./_export":42,"./_iter-create":63}],222:[function(require,module,exports){ +// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) +var gOPD = require('./_object-gopd'); +var $export = require('./_export'); +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { + return gOPD.f(anObject(target), propertyKey); + } +}); + +},{"./_an-object":16,"./_export":42,"./_object-gopd":83}],223:[function(require,module,exports){ +// 26.1.8 Reflect.getPrototypeOf(target) +var $export = require('./_export'); +var getProto = require('./_object-gpo'); +var anObject = require('./_an-object'); + +$export($export.S, 'Reflect', { + getPrototypeOf: function getPrototypeOf(target) { + return getProto(anObject(target)); + } +}); + +},{"./_an-object":16,"./_export":42,"./_object-gpo":87}],224:[function(require,module,exports){ +// 26.1.6 Reflect.get(target, propertyKey [, receiver]) +var gOPD = require('./_object-gopd'); +var getPrototypeOf = require('./_object-gpo'); +var has = require('./_has'); +var $export = require('./_export'); +var isObject = require('./_is-object'); +var anObject = require('./_an-object'); + +function get(target, propertyKey /* , receiver */) { + var receiver = arguments.length < 3 ? target : arguments[2]; + var desc, proto; + if (anObject(target) === receiver) return target[propertyKey]; + if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') + ? desc.value + : desc.get !== undefined + ? desc.get.call(receiver) + : undefined; + if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver); +} + +$export($export.S, 'Reflect', { get: get }); + +},{"./_an-object":16,"./_export":42,"./_has":50,"./_is-object":60,"./_object-gopd":83,"./_object-gpo":87}],225:[function(require,module,exports){ +// 26.1.9 Reflect.has(target, propertyKey) +var $export = require('./_export'); + +$export($export.S, 'Reflect', { + has: function has(target, propertyKey) { + return propertyKey in target; + } +}); + +},{"./_export":42}],226:[function(require,module,exports){ +// 26.1.10 Reflect.isExtensible(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var $isExtensible = Object.isExtensible; + +$export($export.S, 'Reflect', { + isExtensible: function isExtensible(target) { + anObject(target); + return $isExtensible ? $isExtensible(target) : true; + } +}); + +},{"./_an-object":16,"./_export":42}],227:[function(require,module,exports){ +// 26.1.11 Reflect.ownKeys(target) +var $export = require('./_export'); + +$export($export.S, 'Reflect', { ownKeys: require('./_own-keys') }); + +},{"./_export":42,"./_own-keys":93}],228:[function(require,module,exports){ +// 26.1.12 Reflect.preventExtensions(target) +var $export = require('./_export'); +var anObject = require('./_an-object'); +var $preventExtensions = Object.preventExtensions; + +$export($export.S, 'Reflect', { + preventExtensions: function preventExtensions(target) { + anObject(target); + try { + if ($preventExtensions) $preventExtensions(target); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_an-object":16,"./_export":42}],229:[function(require,module,exports){ +// 26.1.14 Reflect.setPrototypeOf(target, proto) +var $export = require('./_export'); +var setProto = require('./_set-proto'); + +if (setProto) $export($export.S, 'Reflect', { + setPrototypeOf: function setPrototypeOf(target, proto) { + setProto.check(target, proto); + try { + setProto.set(target, proto); + return true; + } catch (e) { + return false; + } + } +}); + +},{"./_export":42,"./_set-proto":105}],230:[function(require,module,exports){ +// 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) +var dP = require('./_object-dp'); +var gOPD = require('./_object-gopd'); +var getPrototypeOf = require('./_object-gpo'); +var has = require('./_has'); +var $export = require('./_export'); +var createDesc = require('./_property-desc'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); + +function set(target, propertyKey, V /* , receiver */) { + var receiver = arguments.length < 4 ? target : arguments[3]; + var ownDesc = gOPD.f(anObject(target), propertyKey); + var existingDescriptor, proto; + if (!ownDesc) { + if (isObject(proto = getPrototypeOf(target))) { + return set(proto, propertyKey, V, receiver); + } + ownDesc = createDesc(0); + } + if (has(ownDesc, 'value')) { + if (ownDesc.writable === false || !isObject(receiver)) return false; + if (existingDescriptor = gOPD.f(receiver, propertyKey)) { + if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false; + existingDescriptor.value = V; + dP.f(receiver, propertyKey, existingDescriptor); + } else dP.f(receiver, propertyKey, createDesc(0, V)); + return true; + } + return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); +} + +$export($export.S, 'Reflect', { set: set }); + +},{"./_an-object":16,"./_export":42,"./_has":50,"./_is-object":60,"./_object-dp":80,"./_object-gopd":83,"./_object-gpo":87,"./_property-desc":98}],231:[function(require,module,exports){ +var global = require('./_global'); +var inheritIfRequired = require('./_inherit-if-required'); +var dP = require('./_object-dp').f; +var gOPN = require('./_object-gopn').f; +var isRegExp = require('./_is-regexp'); +var $flags = require('./_flags'); +var $RegExp = global.RegExp; +var Base = $RegExp; +var proto = $RegExp.prototype; +var re1 = /a/g; +var re2 = /a/g; +// "new" creates a new object, old webkit buggy here +var CORRECT_NEW = new $RegExp(re1) !== re1; + +if (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () { + re2[require('./_wks')('match')] = false; + // RegExp constructor can alter flags and IsRegExp works correct with @@match + return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; +}))) { + $RegExp = function RegExp(p, f) { + var tiRE = this instanceof $RegExp; + var piRE = isRegExp(p); + var fiU = f === undefined; + return !tiRE && piRE && p.constructor === $RegExp && fiU ? p + : inheritIfRequired(CORRECT_NEW + ? new Base(piRE && !fiU ? p.source : p, f) + : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) + , tiRE ? this : proto, $RegExp); + }; + var proxy = function (key) { + key in $RegExp || dP($RegExp, key, { + configurable: true, + get: function () { return Base[key]; }, + set: function (it) { Base[key] = it; } + }); + }; + for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]); + proto.constructor = $RegExp; + $RegExp.prototype = proto; + require('./_redefine')(global, 'RegExp', $RegExp); +} + +require('./_set-species')('RegExp'); + +},{"./_descriptors":38,"./_fails":44,"./_flags":46,"./_global":49,"./_inherit-if-required":54,"./_is-regexp":61,"./_object-dp":80,"./_object-gopn":85,"./_redefine":100,"./_set-species":106,"./_wks":135}],232:[function(require,module,exports){ +// 21.2.5.3 get RegExp.prototype.flags() +if (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', { + configurable: true, + get: require('./_flags') +}); + +},{"./_descriptors":38,"./_flags":46,"./_object-dp":80}],233:[function(require,module,exports){ +// @@match logic +require('./_fix-re-wks')('match', 1, function (defined, MATCH, $match) { + // 21.1.3.11 String.prototype.match(regexp) + return [function match(regexp) { + 'use strict'; + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[MATCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); + }, $match]; +}); + +},{"./_fix-re-wks":45}],234:[function(require,module,exports){ +// @@replace logic +require('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace) { + // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) + return [function replace(searchValue, replaceValue) { + 'use strict'; + var O = defined(this); + var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; + return fn !== undefined + ? fn.call(searchValue, O, replaceValue) + : $replace.call(String(O), searchValue, replaceValue); + }, $replace]; +}); + +},{"./_fix-re-wks":45}],235:[function(require,module,exports){ +// @@search logic +require('./_fix-re-wks')('search', 1, function (defined, SEARCH, $search) { + // 21.1.3.15 String.prototype.search(regexp) + return [function search(regexp) { + 'use strict'; + var O = defined(this); + var fn = regexp == undefined ? undefined : regexp[SEARCH]; + return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); + }, $search]; +}); + +},{"./_fix-re-wks":45}],236:[function(require,module,exports){ +// @@split logic +require('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split) { + 'use strict'; + var isRegExp = require('./_is-regexp'); + var _split = $split; + var $push = [].push; + var $SPLIT = 'split'; + var LENGTH = 'length'; + var LAST_INDEX = 'lastIndex'; + if ( + 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || + 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || + 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || + '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || + '.'[$SPLIT](/()()/)[LENGTH] > 1 || + ''[$SPLIT](/.?/)[LENGTH] + ) { + var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group + // based on es5-shim implementation, need to rework it + $split = function (separator, limit) { + var string = String(this); + if (separator === undefined && limit === 0) return []; + // If `separator` is not a regex, use native split + if (!isRegExp(separator)) return _split.call(string, separator, limit); + var output = []; + var flags = (separator.ignoreCase ? 'i' : '') + + (separator.multiline ? 'm' : '') + + (separator.unicode ? 'u' : '') + + (separator.sticky ? 'y' : ''); + var lastLastIndex = 0; + var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; + // Make `global` and avoid `lastIndex` issues by working with a copy + var separatorCopy = new RegExp(separator.source, flags + 'g'); + var separator2, match, lastIndex, lastLength, i; + // Doesn't need flags gy, but they don't hurt + if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); + while (match = separatorCopy.exec(string)) { + // `separatorCopy.lastIndex` is not reliable cross-browser + lastIndex = match.index + match[0][LENGTH]; + if (lastIndex > lastLastIndex) { + output.push(string.slice(lastLastIndex, match.index)); + // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG + // eslint-disable-next-line no-loop-func + if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { + for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; + }); + if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); + lastLength = match[0][LENGTH]; + lastLastIndex = lastIndex; + if (output[LENGTH] >= splitLimit) break; + } + if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop + } + if (lastLastIndex === string[LENGTH]) { + if (lastLength || !separatorCopy.test('')) output.push(''); + } else output.push(string.slice(lastLastIndex)); + return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; + }; + // Chakra, V8 + } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { + $split = function (separator, limit) { + return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); + }; + } + // 21.1.3.17 String.prototype.split(separator, limit) + return [function split(separator, limit) { + var O = defined(this); + var fn = separator == undefined ? undefined : separator[SPLIT]; + return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); + }, $split]; +}); + +},{"./_fix-re-wks":45,"./_is-regexp":61}],237:[function(require,module,exports){ +'use strict'; +require('./es6.regexp.flags'); +var anObject = require('./_an-object'); +var $flags = require('./_flags'); +var DESCRIPTORS = require('./_descriptors'); +var TO_STRING = 'toString'; +var $toString = /./[TO_STRING]; + +var define = function (fn) { + require('./_redefine')(RegExp.prototype, TO_STRING, fn, true); +}; + +// 21.2.5.14 RegExp.prototype.toString() +if (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { + define(function toString() { + var R = anObject(this); + return '/'.concat(R.source, '/', + 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); + }); +// FF44- RegExp#toString has a wrong name +} else if ($toString.name != TO_STRING) { + define(function toString() { + return $toString.call(this); + }); +} + +},{"./_an-object":16,"./_descriptors":38,"./_fails":44,"./_flags":46,"./_redefine":100,"./es6.regexp.flags":232}],238:[function(require,module,exports){ +'use strict'; +var strong = require('./_collection-strong'); +var validate = require('./_validate-collection'); +var SET = 'Set'; + +// 23.2 Set Objects +module.exports = require('./_collection')(SET, function (get) { + return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.2.3.1 Set.prototype.add(value) + add: function add(value) { + return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value); + } +}, strong); + +},{"./_collection":31,"./_collection-strong":28,"./_validate-collection":132}],239:[function(require,module,exports){ +'use strict'; +// B.2.3.2 String.prototype.anchor(name) +require('./_string-html')('anchor', function (createHTML) { + return function anchor(name) { + return createHTML(this, 'a', 'name', name); + }; +}); + +},{"./_string-html":114}],240:[function(require,module,exports){ +'use strict'; +// B.2.3.3 String.prototype.big() +require('./_string-html')('big', function (createHTML) { + return function big() { + return createHTML(this, 'big', '', ''); + }; +}); + +},{"./_string-html":114}],241:[function(require,module,exports){ +'use strict'; +// B.2.3.4 String.prototype.blink() +require('./_string-html')('blink', function (createHTML) { + return function blink() { + return createHTML(this, 'blink', '', ''); + }; +}); + +},{"./_string-html":114}],242:[function(require,module,exports){ +'use strict'; +// B.2.3.5 String.prototype.bold() +require('./_string-html')('bold', function (createHTML) { + return function bold() { + return createHTML(this, 'b', '', ''); + }; +}); + +},{"./_string-html":114}],243:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $at = require('./_string-at')(false); +$export($export.P, 'String', { + // 21.1.3.3 String.prototype.codePointAt(pos) + codePointAt: function codePointAt(pos) { + return $at(this, pos); + } +}); + +},{"./_export":42,"./_string-at":112}],244:[function(require,module,exports){ +// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) +'use strict'; +var $export = require('./_export'); +var toLength = require('./_to-length'); +var context = require('./_string-context'); +var ENDS_WITH = 'endsWith'; +var $endsWith = ''[ENDS_WITH]; + +$export($export.P + $export.F * require('./_fails-is-regexp')(ENDS_WITH), 'String', { + endsWith: function endsWith(searchString /* , endPosition = @length */) { + var that = context(this, searchString, ENDS_WITH); + var endPosition = arguments.length > 1 ? arguments[1] : undefined; + var len = toLength(that.length); + var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); + var search = String(searchString); + return $endsWith + ? $endsWith.call(that, search, end) + : that.slice(end - search.length, end) === search; + } +}); + +},{"./_export":42,"./_fails-is-regexp":43,"./_string-context":113,"./_to-length":124}],245:[function(require,module,exports){ +'use strict'; +// B.2.3.6 String.prototype.fixed() +require('./_string-html')('fixed', function (createHTML) { + return function fixed() { + return createHTML(this, 'tt', '', ''); + }; +}); + +},{"./_string-html":114}],246:[function(require,module,exports){ +'use strict'; +// B.2.3.7 String.prototype.fontcolor(color) +require('./_string-html')('fontcolor', function (createHTML) { + return function fontcolor(color) { + return createHTML(this, 'font', 'color', color); + }; +}); + +},{"./_string-html":114}],247:[function(require,module,exports){ +'use strict'; +// B.2.3.8 String.prototype.fontsize(size) +require('./_string-html')('fontsize', function (createHTML) { + return function fontsize(size) { + return createHTML(this, 'font', 'size', size); + }; +}); + +},{"./_string-html":114}],248:[function(require,module,exports){ +var $export = require('./_export'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var fromCharCode = String.fromCharCode; +var $fromCodePoint = String.fromCodePoint; + +// length should be 1, old FF problem +$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { + // 21.1.2.2 String.fromCodePoint(...codePoints) + fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars + var res = []; + var aLen = arguments.length; + var i = 0; + var code; + while (aLen > i) { + code = +arguments[i++]; + if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); + res.push(code < 0x10000 + ? fromCharCode(code) + : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) + ); + } return res.join(''); + } +}); + +},{"./_export":42,"./_to-absolute-index":120}],249:[function(require,module,exports){ +// 21.1.3.7 String.prototype.includes(searchString, position = 0) +'use strict'; +var $export = require('./_export'); +var context = require('./_string-context'); +var INCLUDES = 'includes'; + +$export($export.P + $export.F * require('./_fails-is-regexp')(INCLUDES), 'String', { + includes: function includes(searchString /* , position = 0 */) { + return !!~context(this, searchString, INCLUDES) + .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +},{"./_export":42,"./_fails-is-regexp":43,"./_string-context":113}],250:[function(require,module,exports){ +'use strict'; +// B.2.3.9 String.prototype.italics() +require('./_string-html')('italics', function (createHTML) { + return function italics() { + return createHTML(this, 'i', '', ''); + }; +}); + +},{"./_string-html":114}],251:[function(require,module,exports){ +'use strict'; +var $at = require('./_string-at')(true); + +// 21.1.3.27 String.prototype[@@iterator]() +require('./_iter-define')(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); + +},{"./_iter-define":64,"./_string-at":112}],252:[function(require,module,exports){ +'use strict'; +// B.2.3.10 String.prototype.link(url) +require('./_string-html')('link', function (createHTML) { + return function link(url) { + return createHTML(this, 'a', 'href', url); + }; +}); + +},{"./_string-html":114}],253:[function(require,module,exports){ +var $export = require('./_export'); +var toIObject = require('./_to-iobject'); +var toLength = require('./_to-length'); + +$export($export.S, 'String', { + // 21.1.2.4 String.raw(callSite, ...substitutions) + raw: function raw(callSite) { + var tpl = toIObject(callSite.raw); + var len = toLength(tpl.length); + var aLen = arguments.length; + var res = []; + var i = 0; + while (len > i) { + res.push(String(tpl[i++])); + if (i < aLen) res.push(String(arguments[i])); + } return res.join(''); + } +}); + +},{"./_export":42,"./_to-iobject":123,"./_to-length":124}],254:[function(require,module,exports){ +var $export = require('./_export'); + +$export($export.P, 'String', { + // 21.1.3.13 String.prototype.repeat(count) + repeat: require('./_string-repeat') +}); + +},{"./_export":42,"./_string-repeat":116}],255:[function(require,module,exports){ +'use strict'; +// B.2.3.11 String.prototype.small() +require('./_string-html')('small', function (createHTML) { + return function small() { + return createHTML(this, 'small', '', ''); + }; +}); + +},{"./_string-html":114}],256:[function(require,module,exports){ +// 21.1.3.18 String.prototype.startsWith(searchString [, position ]) +'use strict'; +var $export = require('./_export'); +var toLength = require('./_to-length'); +var context = require('./_string-context'); +var STARTS_WITH = 'startsWith'; +var $startsWith = ''[STARTS_WITH]; + +$export($export.P + $export.F * require('./_fails-is-regexp')(STARTS_WITH), 'String', { + startsWith: function startsWith(searchString /* , position = 0 */) { + var that = context(this, searchString, STARTS_WITH); + var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); + var search = String(searchString); + return $startsWith + ? $startsWith.call(that, search, index) + : that.slice(index, index + search.length) === search; + } +}); + +},{"./_export":42,"./_fails-is-regexp":43,"./_string-context":113,"./_to-length":124}],257:[function(require,module,exports){ +'use strict'; +// B.2.3.12 String.prototype.strike() +require('./_string-html')('strike', function (createHTML) { + return function strike() { + return createHTML(this, 'strike', '', ''); + }; +}); + +},{"./_string-html":114}],258:[function(require,module,exports){ +'use strict'; +// B.2.3.13 String.prototype.sub() +require('./_string-html')('sub', function (createHTML) { + return function sub() { + return createHTML(this, 'sub', '', ''); + }; +}); + +},{"./_string-html":114}],259:[function(require,module,exports){ +'use strict'; +// B.2.3.14 String.prototype.sup() +require('./_string-html')('sup', function (createHTML) { + return function sup() { + return createHTML(this, 'sup', '', ''); + }; +}); + +},{"./_string-html":114}],260:[function(require,module,exports){ +'use strict'; +// 21.1.3.25 String.prototype.trim() +require('./_string-trim')('trim', function ($trim) { + return function trim() { + return $trim(this, 3); + }; +}); + +},{"./_string-trim":117}],261:[function(require,module,exports){ +'use strict'; +// ECMAScript 6 symbols shim +var global = require('./_global'); +var has = require('./_has'); +var DESCRIPTORS = require('./_descriptors'); +var $export = require('./_export'); +var redefine = require('./_redefine'); +var META = require('./_meta').KEY; +var $fails = require('./_fails'); +var shared = require('./_shared'); +var setToStringTag = require('./_set-to-string-tag'); +var uid = require('./_uid'); +var wks = require('./_wks'); +var wksExt = require('./_wks-ext'); +var wksDefine = require('./_wks-define'); +var enumKeys = require('./_enum-keys'); +var isArray = require('./_is-array'); +var anObject = require('./_an-object'); +var isObject = require('./_is-object'); +var toIObject = require('./_to-iobject'); +var toPrimitive = require('./_to-primitive'); +var createDesc = require('./_property-desc'); +var _create = require('./_object-create'); +var gOPNExt = require('./_object-gopn-ext'); +var $GOPD = require('./_object-gopd'); +var $DP = require('./_object-dp'); +var $keys = require('./_object-keys'); +var gOPD = $GOPD.f; +var dP = $DP.f; +var gOPN = gOPNExt.f; +var $Symbol = global.Symbol; +var $JSON = global.JSON; +var _stringify = $JSON && $JSON.stringify; +var PROTOTYPE = 'prototype'; +var HIDDEN = wks('_hidden'); +var TO_PRIMITIVE = wks('toPrimitive'); +var isEnum = {}.propertyIsEnumerable; +var SymbolRegistry = shared('symbol-registry'); +var AllSymbols = shared('symbols'); +var OPSymbols = shared('op-symbols'); +var ObjectProto = Object[PROTOTYPE]; +var USE_NATIVE = typeof $Symbol == 'function'; +var QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = DESCRIPTORS && $fails(function () { + return _create(dP({}, 'a', { + get: function () { return dP(this, 'a', { value: 7 }).a; } + })).a != 7; +}) ? function (it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); +} : dP; + +var wrap = function (tag) { + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; +}; + +var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + } return setSymbolDesc(it, key, D); + } return dP(it, key, D); +}; +var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys(P = toIObject(P)); + var i = 0; + var l = keys.length; + var key; + while (l > i) $defineProperty(it, key = keys[i++], P[key]); + return it; +}; +var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = toPrimitive(key, true)); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + } return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto; + var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + } return result; +}; + +// 19.4.1.1 Symbol([description]) +if (!USE_NATIVE) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function (value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames; + require('./_object-pie').f = $propertyIsEnumerable; + require('./_object-gops').f = $getOwnPropertySymbols; + + if (DESCRIPTORS && !require('./_library')) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function (name) { + return wrap(wks(name)); + }; +} + +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); + +for (var es6Symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' +).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); + +for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); + +$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function (key) { + return has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); + for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; + }, + useSetter: function () { setter = true; }, + useSimple: function () { setter = false; } +}); + +$export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); + +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it) { + var args = [it]; + var i = 1; + var replacer, $replacer; + while (arguments.length > i) args.push(arguments[i++]); + $replacer = replacer = args[1]; + if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + if (!isArray(replacer)) replacer = function (key, value) { + if (typeof $replacer == 'function') value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); + +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +setToStringTag(global.JSON, 'JSON', true); + +},{"./_an-object":16,"./_descriptors":38,"./_enum-keys":41,"./_export":42,"./_fails":44,"./_global":49,"./_has":50,"./_hide":51,"./_is-array":58,"./_is-object":60,"./_library":68,"./_meta":74,"./_object-create":79,"./_object-dp":80,"./_object-gopd":83,"./_object-gopn":85,"./_object-gopn-ext":84,"./_object-gops":86,"./_object-keys":89,"./_object-pie":90,"./_property-desc":98,"./_redefine":100,"./_set-to-string-tag":107,"./_shared":109,"./_to-iobject":123,"./_to-primitive":126,"./_uid":130,"./_wks":135,"./_wks-define":133,"./_wks-ext":134}],262:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var $typed = require('./_typed'); +var buffer = require('./_typed-buffer'); +var anObject = require('./_an-object'); +var toAbsoluteIndex = require('./_to-absolute-index'); +var toLength = require('./_to-length'); +var isObject = require('./_is-object'); +var ArrayBuffer = require('./_global').ArrayBuffer; +var speciesConstructor = require('./_species-constructor'); +var $ArrayBuffer = buffer.ArrayBuffer; +var $DataView = buffer.DataView; +var $isView = $typed.ABV && ArrayBuffer.isView; +var $slice = $ArrayBuffer.prototype.slice; +var VIEW = $typed.VIEW; +var ARRAY_BUFFER = 'ArrayBuffer'; + +$export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer }); + +$export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { + // 24.1.3.1 ArrayBuffer.isView(arg) + isView: function isView(it) { + return $isView && $isView(it) || isObject(it) && VIEW in it; + } +}); + +$export($export.P + $export.U + $export.F * require('./_fails')(function () { + return !new $ArrayBuffer(2).slice(1, undefined).byteLength; +}), ARRAY_BUFFER, { + // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) + slice: function slice(start, end) { + if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix + var len = anObject(this).byteLength; + var first = toAbsoluteIndex(start, len); + var fin = toAbsoluteIndex(end === undefined ? len : end, len); + var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first)); + var viewS = new $DataView(this); + var viewT = new $DataView(result); + var index = 0; + while (first < fin) { + viewT.setUint8(index++, viewS.getUint8(first++)); + } return result; + } +}); + +require('./_set-species')(ARRAY_BUFFER); + +},{"./_an-object":16,"./_export":42,"./_fails":44,"./_global":49,"./_is-object":60,"./_set-species":106,"./_species-constructor":110,"./_to-absolute-index":120,"./_to-length":124,"./_typed":129,"./_typed-buffer":128}],263:[function(require,module,exports){ +var $export = require('./_export'); +$export($export.G + $export.W + $export.F * !require('./_typed').ABV, { + DataView: require('./_typed-buffer').DataView +}); + +},{"./_export":42,"./_typed":129,"./_typed-buffer":128}],264:[function(require,module,exports){ +require('./_typed-array')('Float32', 4, function (init) { + return function Float32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],265:[function(require,module,exports){ +require('./_typed-array')('Float64', 8, function (init) { + return function Float64Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],266:[function(require,module,exports){ +require('./_typed-array')('Int16', 2, function (init) { + return function Int16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],267:[function(require,module,exports){ +require('./_typed-array')('Int32', 4, function (init) { + return function Int32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],268:[function(require,module,exports){ +require('./_typed-array')('Int8', 1, function (init) { + return function Int8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],269:[function(require,module,exports){ +require('./_typed-array')('Uint16', 2, function (init) { + return function Uint16Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],270:[function(require,module,exports){ +require('./_typed-array')('Uint32', 4, function (init) { + return function Uint32Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],271:[function(require,module,exports){ +require('./_typed-array')('Uint8', 1, function (init) { + return function Uint8Array(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}); + +},{"./_typed-array":127}],272:[function(require,module,exports){ +require('./_typed-array')('Uint8', 1, function (init) { + return function Uint8ClampedArray(data, byteOffset, length) { + return init(this, data, byteOffset, length); + }; +}, true); + +},{"./_typed-array":127}],273:[function(require,module,exports){ +'use strict'; +var each = require('./_array-methods')(0); +var redefine = require('./_redefine'); +var meta = require('./_meta'); +var assign = require('./_object-assign'); +var weak = require('./_collection-weak'); +var isObject = require('./_is-object'); +var fails = require('./_fails'); +var validate = require('./_validate-collection'); +var WEAK_MAP = 'WeakMap'; +var getWeak = meta.getWeak; +var isExtensible = Object.isExtensible; +var uncaughtFrozenStore = weak.ufstore; +var tmp = {}; +var InternalMap; + +var wrapper = function (get) { + return function WeakMap() { + return get(this, arguments.length > 0 ? arguments[0] : undefined); + }; +}; + +var methods = { + // 23.3.3.3 WeakMap.prototype.get(key) + get: function get(key) { + if (isObject(key)) { + var data = getWeak(key); + if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); + return data ? data[this._i] : undefined; + } + }, + // 23.3.3.5 WeakMap.prototype.set(key, value) + set: function set(key, value) { + return weak.def(validate(this, WEAK_MAP), key, value); + } +}; + +// 23.3 WeakMap Objects +var $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true); + +// IE11 WeakMap frozen keys fix +if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) { + InternalMap = weak.getConstructor(wrapper, WEAK_MAP); + assign(InternalMap.prototype, methods); + meta.NEED = true; + each(['delete', 'has', 'get', 'set'], function (key) { + var proto = $WeakMap.prototype; + var method = proto[key]; + redefine(proto, key, function (a, b) { + // store frozen objects on internal weakmap shim + if (isObject(a) && !isExtensible(a)) { + if (!this._f) this._f = new InternalMap(); + var result = this._f[key](a, b); + return key == 'set' ? this : result; + // store all the rest on native weakmap + } return method.call(this, a, b); + }); + }); +} + +},{"./_array-methods":21,"./_collection":31,"./_collection-weak":30,"./_fails":44,"./_is-object":60,"./_meta":74,"./_object-assign":78,"./_redefine":100,"./_validate-collection":132}],274:[function(require,module,exports){ +'use strict'; +var weak = require('./_collection-weak'); +var validate = require('./_validate-collection'); +var WEAK_SET = 'WeakSet'; + +// 23.4 WeakSet Objects +require('./_collection')(WEAK_SET, function (get) { + return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; +}, { + // 23.4.3.1 WeakSet.prototype.add(value) + add: function add(value) { + return weak.def(validate(this, WEAK_SET), value, true); + } +}, weak, false, true); + +},{"./_collection":31,"./_collection-weak":30,"./_validate-collection":132}],275:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap +var $export = require('./_export'); +var flattenIntoArray = require('./_flatten-into-array'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var aFunction = require('./_a-function'); +var arraySpeciesCreate = require('./_array-species-create'); + +$export($export.P, 'Array', { + flatMap: function flatMap(callbackfn /* , thisArg */) { + var O = toObject(this); + var sourceLen, A; + aFunction(callbackfn); + sourceLen = toLength(O.length); + A = arraySpeciesCreate(O, 0); + flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]); + return A; + } +}); + +require('./_add-to-unscopables')('flatMap'); + +},{"./_a-function":12,"./_add-to-unscopables":14,"./_array-species-create":24,"./_export":42,"./_flatten-into-array":47,"./_to-length":124,"./_to-object":125}],276:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten +var $export = require('./_export'); +var flattenIntoArray = require('./_flatten-into-array'); +var toObject = require('./_to-object'); +var toLength = require('./_to-length'); +var toInteger = require('./_to-integer'); +var arraySpeciesCreate = require('./_array-species-create'); + +$export($export.P, 'Array', { + flatten: function flatten(/* depthArg = 1 */) { + var depthArg = arguments[0]; + var O = toObject(this); + var sourceLen = toLength(O.length); + var A = arraySpeciesCreate(O, 0); + flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); + return A; + } +}); + +require('./_add-to-unscopables')('flatten'); + +},{"./_add-to-unscopables":14,"./_array-species-create":24,"./_export":42,"./_flatten-into-array":47,"./_to-integer":122,"./_to-length":124,"./_to-object":125}],277:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/Array.prototype.includes +var $export = require('./_export'); +var $includes = require('./_array-includes')(true); + +$export($export.P, 'Array', { + includes: function includes(el /* , fromIndex = 0 */) { + return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); + } +}); + +require('./_add-to-unscopables')('includes'); + +},{"./_add-to-unscopables":14,"./_array-includes":20,"./_export":42}],278:[function(require,module,exports){ +// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask +var $export = require('./_export'); +var microtask = require('./_microtask')(); +var process = require('./_global').process; +var isNode = require('./_cof')(process) == 'process'; + +$export($export.G, { + asap: function asap(fn) { + var domain = isNode && process.domain; + microtask(domain ? domain.bind(fn) : fn); + } +}); + +},{"./_cof":27,"./_export":42,"./_global":49,"./_microtask":76}],279:[function(require,module,exports){ +// https://github.com/ljharb/proposal-is-error +var $export = require('./_export'); +var cof = require('./_cof'); + +$export($export.S, 'Error', { + isError: function isError(it) { + return cof(it) === 'Error'; + } +}); + +},{"./_cof":27,"./_export":42}],280:[function(require,module,exports){ +// https://github.com/tc39/proposal-global +var $export = require('./_export'); + +$export($export.G, { global: require('./_global') }); + +},{"./_export":42,"./_global":49}],281:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from +require('./_set-collection-from')('Map'); + +},{"./_set-collection-from":103}],282:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of +require('./_set-collection-of')('Map'); + +},{"./_set-collection-of":104}],283:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $export = require('./_export'); + +$export($export.P + $export.R, 'Map', { toJSON: require('./_collection-to-json')('Map') }); + +},{"./_collection-to-json":29,"./_export":42}],284:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { + clamp: function clamp(x, lower, upper) { + return Math.min(upper, Math.max(lower, x)); + } +}); + +},{"./_export":42}],285:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 }); + +},{"./_export":42}],286:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var RAD_PER_DEG = 180 / Math.PI; + +$export($export.S, 'Math', { + degrees: function degrees(radians) { + return radians * RAD_PER_DEG; + } +}); + +},{"./_export":42}],287:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var scale = require('./_math-scale'); +var fround = require('./_math-fround'); + +$export($export.S, 'Math', { + fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { + return fround(scale(x, inLow, inHigh, outLow, outHigh)); + } +}); + +},{"./_export":42,"./_math-fround":70,"./_math-scale":72}],288:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + iaddh: function iaddh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0; + var $x1 = x1 >>> 0; + var $y0 = y0 >>> 0; + return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; + } +}); + +},{"./_export":42}],289:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + imulh: function imulh(u, v) { + var UINT16 = 0xffff; + var $u = +u; + var $v = +v; + var u0 = $u & UINT16; + var v0 = $v & UINT16; + var u1 = $u >> 16; + var v1 = $v >> 16; + var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); + return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); + } +}); + +},{"./_export":42}],290:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + isubh: function isubh(x0, x1, y0, y1) { + var $x0 = x0 >>> 0; + var $x1 = x1 >>> 0; + var $y0 = y0 >>> 0; + return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; + } +}); + +},{"./_export":42}],291:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI }); + +},{"./_export":42}],292:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); +var DEG_PER_RAD = Math.PI / 180; + +$export($export.S, 'Math', { + radians: function radians(degrees) { + return degrees * DEG_PER_RAD; + } +}); + +},{"./_export":42}],293:[function(require,module,exports){ +// https://rwaldron.github.io/proposal-math-extensions/ +var $export = require('./_export'); + +$export($export.S, 'Math', { scale: require('./_math-scale') }); + +},{"./_export":42,"./_math-scale":72}],294:[function(require,module,exports){ +// http://jfbastien.github.io/papers/Math.signbit.html +var $export = require('./_export'); + +$export($export.S, 'Math', { signbit: function signbit(x) { + // eslint-disable-next-line no-self-compare + return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0; +} }); + +},{"./_export":42}],295:[function(require,module,exports){ +// https://gist.github.com/BrendanEich/4294d5c212a6d2254703 +var $export = require('./_export'); + +$export($export.S, 'Math', { + umulh: function umulh(u, v) { + var UINT16 = 0xffff; + var $u = +u; + var $v = +v; + var u0 = $u & UINT16; + var v0 = $v & UINT16; + var u1 = $u >>> 16; + var v1 = $v >>> 16; + var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); + return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); + } +}); + +},{"./_export":42}],296:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var aFunction = require('./_a-function'); +var $defineProperty = require('./_object-dp'); + +// B.2.2.2 Object.prototype.__defineGetter__(P, getter) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __defineGetter__: function __defineGetter__(P, getter) { + $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); + } +}); + +},{"./_a-function":12,"./_descriptors":38,"./_export":42,"./_object-dp":80,"./_object-forced-pam":82,"./_to-object":125}],297:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var aFunction = require('./_a-function'); +var $defineProperty = require('./_object-dp'); + +// B.2.2.3 Object.prototype.__defineSetter__(P, setter) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __defineSetter__: function __defineSetter__(P, setter) { + $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); + } +}); + +},{"./_a-function":12,"./_descriptors":38,"./_export":42,"./_object-dp":80,"./_object-forced-pam":82,"./_to-object":125}],298:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export'); +var $entries = require('./_object-to-array')(true); + +$export($export.S, 'Object', { + entries: function entries(it) { + return $entries(it); + } +}); + +},{"./_export":42,"./_object-to-array":92}],299:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-getownpropertydescriptors +var $export = require('./_export'); +var ownKeys = require('./_own-keys'); +var toIObject = require('./_to-iobject'); +var gOPD = require('./_object-gopd'); +var createProperty = require('./_create-property'); + +$export($export.S, 'Object', { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { + var O = toIObject(object); + var getDesc = gOPD.f; + var keys = ownKeys(O); + var result = {}; + var i = 0; + var key, desc; + while (keys.length > i) { + desc = getDesc(O, key = keys[i++]); + if (desc !== undefined) createProperty(result, key, desc); + } + return result; + } +}); + +},{"./_create-property":33,"./_export":42,"./_object-gopd":83,"./_own-keys":93,"./_to-iobject":123}],300:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); +var getPrototypeOf = require('./_object-gpo'); +var getOwnPropertyDescriptor = require('./_object-gopd').f; + +// B.2.2.4 Object.prototype.__lookupGetter__(P) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __lookupGetter__: function __lookupGetter__(P) { + var O = toObject(this); + var K = toPrimitive(P, true); + var D; + do { + if (D = getOwnPropertyDescriptor(O, K)) return D.get; + } while (O = getPrototypeOf(O)); + } +}); + +},{"./_descriptors":38,"./_export":42,"./_object-forced-pam":82,"./_object-gopd":83,"./_object-gpo":87,"./_to-object":125,"./_to-primitive":126}],301:[function(require,module,exports){ +'use strict'; +var $export = require('./_export'); +var toObject = require('./_to-object'); +var toPrimitive = require('./_to-primitive'); +var getPrototypeOf = require('./_object-gpo'); +var getOwnPropertyDescriptor = require('./_object-gopd').f; + +// B.2.2.5 Object.prototype.__lookupSetter__(P) +require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', { + __lookupSetter__: function __lookupSetter__(P) { + var O = toObject(this); + var K = toPrimitive(P, true); + var D; + do { + if (D = getOwnPropertyDescriptor(O, K)) return D.set; + } while (O = getPrototypeOf(O)); + } +}); + +},{"./_descriptors":38,"./_export":42,"./_object-forced-pam":82,"./_object-gopd":83,"./_object-gpo":87,"./_to-object":125,"./_to-primitive":126}],302:[function(require,module,exports){ +// https://github.com/tc39/proposal-object-values-entries +var $export = require('./_export'); +var $values = require('./_object-to-array')(false); + +$export($export.S, 'Object', { + values: function values(it) { + return $values(it); + } +}); + +},{"./_export":42,"./_object-to-array":92}],303:[function(require,module,exports){ +'use strict'; +// https://github.com/zenparsing/es-observable +var $export = require('./_export'); +var global = require('./_global'); +var core = require('./_core'); +var microtask = require('./_microtask')(); +var OBSERVABLE = require('./_wks')('observable'); +var aFunction = require('./_a-function'); +var anObject = require('./_an-object'); +var anInstance = require('./_an-instance'); +var redefineAll = require('./_redefine-all'); +var hide = require('./_hide'); +var forOf = require('./_for-of'); +var RETURN = forOf.RETURN; + +var getMethod = function (fn) { + return fn == null ? undefined : aFunction(fn); +}; + +var cleanupSubscription = function (subscription) { + var cleanup = subscription._c; + if (cleanup) { + subscription._c = undefined; + cleanup(); + } +}; + +var subscriptionClosed = function (subscription) { + return subscription._o === undefined; +}; + +var closeSubscription = function (subscription) { + if (!subscriptionClosed(subscription)) { + subscription._o = undefined; + cleanupSubscription(subscription); + } +}; + +var Subscription = function (observer, subscriber) { + anObject(observer); + this._c = undefined; + this._o = observer; + observer = new SubscriptionObserver(this); + try { + var cleanup = subscriber(observer); + var subscription = cleanup; + if (cleanup != null) { + if (typeof cleanup.unsubscribe === 'function') cleanup = function () { subscription.unsubscribe(); }; + else aFunction(cleanup); + this._c = cleanup; + } + } catch (e) { + observer.error(e); + return; + } if (subscriptionClosed(this)) cleanupSubscription(this); +}; + +Subscription.prototype = redefineAll({}, { + unsubscribe: function unsubscribe() { closeSubscription(this); } +}); + +var SubscriptionObserver = function (subscription) { + this._s = subscription; +}; + +SubscriptionObserver.prototype = redefineAll({}, { + next: function next(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + try { + var m = getMethod(observer.next); + if (m) return m.call(observer, value); + } catch (e) { + try { + closeSubscription(subscription); + } finally { + throw e; + } + } + } + }, + error: function error(value) { + var subscription = this._s; + if (subscriptionClosed(subscription)) throw value; + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.error); + if (!m) throw value; + value = m.call(observer, value); + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } cleanupSubscription(subscription); + return value; + }, + complete: function complete(value) { + var subscription = this._s; + if (!subscriptionClosed(subscription)) { + var observer = subscription._o; + subscription._o = undefined; + try { + var m = getMethod(observer.complete); + value = m ? m.call(observer, value) : undefined; + } catch (e) { + try { + cleanupSubscription(subscription); + } finally { + throw e; + } + } cleanupSubscription(subscription); + return value; + } + } +}); + +var $Observable = function Observable(subscriber) { + anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); +}; + +redefineAll($Observable.prototype, { + subscribe: function subscribe(observer) { + return new Subscription(observer, this._f); + }, + forEach: function forEach(fn) { + var that = this; + return new (core.Promise || global.Promise)(function (resolve, reject) { + aFunction(fn); + var subscription = that.subscribe({ + next: function (value) { + try { + return fn(value); + } catch (e) { + reject(e); + subscription.unsubscribe(); + } + }, + error: reject, + complete: resolve + }); + }); + } +}); + +redefineAll($Observable, { + from: function from(x) { + var C = typeof this === 'function' ? this : $Observable; + var method = getMethod(anObject(x)[OBSERVABLE]); + if (method) { + var observable = anObject(method.call(x)); + return observable.constructor === C ? observable : new C(function (observer) { + return observable.subscribe(observer); + }); + } + return new C(function (observer) { + var done = false; + microtask(function () { + if (!done) { + try { + if (forOf(x, false, function (it) { + observer.next(it); + if (done) return RETURN; + }) === RETURN) return; + } catch (e) { + if (done) throw e; + observer.error(e); + return; + } observer.complete(); + } + }); + return function () { done = true; }; + }); + }, + of: function of() { + for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++]; + return new (typeof this === 'function' ? this : $Observable)(function (observer) { + var done = false; + microtask(function () { + if (!done) { + for (var j = 0; j < items.length; ++j) { + observer.next(items[j]); + if (done) return; + } observer.complete(); + } + }); + return function () { done = true; }; + }); + } +}); + +hide($Observable.prototype, OBSERVABLE, function () { return this; }); + +$export($export.G, { Observable: $Observable }); + +require('./_set-species')('Observable'); + +},{"./_a-function":12,"./_an-instance":15,"./_an-object":16,"./_core":32,"./_export":42,"./_for-of":48,"./_global":49,"./_hide":51,"./_microtask":76,"./_redefine-all":99,"./_set-species":106,"./_wks":135}],304:[function(require,module,exports){ +// https://github.com/tc39/proposal-promise-finally +'use strict'; +var $export = require('./_export'); +var core = require('./_core'); +var global = require('./_global'); +var speciesConstructor = require('./_species-constructor'); +var promiseResolve = require('./_promise-resolve'); + +$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) { + var C = speciesConstructor(this, core.Promise || global.Promise); + var isFunction = typeof onFinally == 'function'; + return this.then( + isFunction ? function (x) { + return promiseResolve(C, onFinally()).then(function () { return x; }); + } : onFinally, + isFunction ? function (e) { + return promiseResolve(C, onFinally()).then(function () { throw e; }); + } : onFinally + ); +} }); + +},{"./_core":32,"./_export":42,"./_global":49,"./_promise-resolve":97,"./_species-constructor":110}],305:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-promise-try +var $export = require('./_export'); +var newPromiseCapability = require('./_new-promise-capability'); +var perform = require('./_perform'); + +$export($export.S, 'Promise', { 'try': function (callbackfn) { + var promiseCapability = newPromiseCapability.f(this); + var result = perform(callbackfn); + (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); + return promiseCapability.promise; +} }); + +},{"./_export":42,"./_new-promise-capability":77,"./_perform":96}],306:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var toMetaKey = metadata.key; +var ordinaryDefineOwnMetadata = metadata.set; + +metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) { + ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); +} }); + +},{"./_an-object":16,"./_metadata":75}],307:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var toMetaKey = metadata.key; +var getOrCreateMetadataMap = metadata.map; +var store = metadata.store; + +metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { + var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]); + var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); + if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; + if (metadataMap.size) return true; + var targetMetadata = store.get(target); + targetMetadata['delete'](targetKey); + return !!targetMetadata.size || store['delete'](target); +} }); + +},{"./_an-object":16,"./_metadata":75}],308:[function(require,module,exports){ +var Set = require('./es6.set'); +var from = require('./_array-from-iterable'); +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +var ordinaryMetadataKeys = function (O, P) { + var oKeys = ordinaryOwnMetadataKeys(O, P); + var parent = getPrototypeOf(O); + if (parent === null) return oKeys; + var pKeys = ordinaryMetadataKeys(parent, P); + return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; +}; + +metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { + return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + +},{"./_an-object":16,"./_array-from-iterable":19,"./_metadata":75,"./_object-gpo":87,"./es6.set":238}],309:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryHasOwnMetadata = metadata.has; +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +var ordinaryGetMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; +}; + +metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75,"./_object-gpo":87}],310:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryOwnMetadataKeys = metadata.keys; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { + return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); +} }); + +},{"./_an-object":16,"./_metadata":75}],311:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryGetOwnMetadata = metadata.get; +var toMetaKey = metadata.key; + +metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryGetOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75}],312:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var getPrototypeOf = require('./_object-gpo'); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +var ordinaryHasMetadata = function (MetadataKey, O, P) { + var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) return true; + var parent = getPrototypeOf(O); + return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; +}; + +metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75,"./_object-gpo":87}],313:[function(require,module,exports){ +var metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var ordinaryHasOwnMetadata = metadata.has; +var toMetaKey = metadata.key; + +metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { + return ordinaryHasOwnMetadata(metadataKey, anObject(target) + , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); +} }); + +},{"./_an-object":16,"./_metadata":75}],314:[function(require,module,exports){ +var $metadata = require('./_metadata'); +var anObject = require('./_an-object'); +var aFunction = require('./_a-function'); +var toMetaKey = $metadata.key; +var ordinaryDefineOwnMetadata = $metadata.set; + +$metadata.exp({ metadata: function metadata(metadataKey, metadataValue) { + return function decorator(target, targetKey) { + ordinaryDefineOwnMetadata( + metadataKey, metadataValue, + (targetKey !== undefined ? anObject : aFunction)(target), + toMetaKey(targetKey) + ); + }; +} }); + +},{"./_a-function":12,"./_an-object":16,"./_metadata":75}],315:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-set.from +require('./_set-collection-from')('Set'); + +},{"./_set-collection-from":103}],316:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-set.of +require('./_set-collection-of')('Set'); + +},{"./_set-collection-of":104}],317:[function(require,module,exports){ +// https://github.com/DavidBruant/Map-Set.prototype.toJSON +var $export = require('./_export'); + +$export($export.P + $export.R, 'Set', { toJSON: require('./_collection-to-json')('Set') }); + +},{"./_collection-to-json":29,"./_export":42}],318:[function(require,module,exports){ +'use strict'; +// https://github.com/mathiasbynens/String.prototype.at +var $export = require('./_export'); +var $at = require('./_string-at')(true); + +$export($export.P, 'String', { + at: function at(pos) { + return $at(this, pos); + } +}); + +},{"./_export":42,"./_string-at":112}],319:[function(require,module,exports){ +'use strict'; +// https://tc39.github.io/String.prototype.matchAll/ +var $export = require('./_export'); +var defined = require('./_defined'); +var toLength = require('./_to-length'); +var isRegExp = require('./_is-regexp'); +var getFlags = require('./_flags'); +var RegExpProto = RegExp.prototype; + +var $RegExpStringIterator = function (regexp, string) { + this._r = regexp; + this._s = string; +}; + +require('./_iter-create')($RegExpStringIterator, 'RegExp String', function next() { + var match = this._r.exec(this._s); + return { value: match, done: match === null }; +}); + +$export($export.P, 'String', { + matchAll: function matchAll(regexp) { + defined(this); + if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!'); + var S = String(this); + var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp); + var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); + rx.lastIndex = toLength(regexp.lastIndex); + return new $RegExpStringIterator(rx, S); + } +}); + +},{"./_defined":37,"./_export":42,"./_flags":46,"./_is-regexp":61,"./_iter-create":63,"./_to-length":124}],320:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = require('./_export'); +var $pad = require('./_string-pad'); +var userAgent = require('./_user-agent'); + +// https://github.com/zloirock/core-js/issues/280 +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padEnd: function padEnd(maxLength /* , fillString = ' ' */) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); + } +}); + +},{"./_export":42,"./_string-pad":115,"./_user-agent":131}],321:[function(require,module,exports){ +'use strict'; +// https://github.com/tc39/proposal-string-pad-start-end +var $export = require('./_export'); +var $pad = require('./_string-pad'); +var userAgent = require('./_user-agent'); + +// https://github.com/zloirock/core-js/issues/280 +$export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { + padStart: function padStart(maxLength /* , fillString = ' ' */) { + return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); + } +}); + +},{"./_export":42,"./_string-pad":115,"./_user-agent":131}],322:[function(require,module,exports){ +'use strict'; +// https://github.com/sebmarkbage/ecmascript-string-left-right-trim +require('./_string-trim')('trimLeft', function ($trim) { + return function trimLeft() { + return $trim(this, 1); + }; +}, 'trimStart'); + +},{"./_string-trim":117}],323:[function(require,module,exports){ +'use strict'; +// https://github.com/sebmarkbage/ecmascript-string-left-right-trim +require('./_string-trim')('trimRight', function ($trim) { + return function trimRight() { + return $trim(this, 2); + }; +}, 'trimEnd'); + +},{"./_string-trim":117}],324:[function(require,module,exports){ +require('./_wks-define')('asyncIterator'); + +},{"./_wks-define":133}],325:[function(require,module,exports){ +require('./_wks-define')('observable'); + +},{"./_wks-define":133}],326:[function(require,module,exports){ +// https://github.com/tc39/proposal-global +var $export = require('./_export'); + +$export($export.S, 'System', { global: require('./_global') }); + +},{"./_export":42,"./_global":49}],327:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from +require('./_set-collection-from')('WeakMap'); + +},{"./_set-collection-from":103}],328:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of +require('./_set-collection-of')('WeakMap'); + +},{"./_set-collection-of":104}],329:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from +require('./_set-collection-from')('WeakSet'); + +},{"./_set-collection-from":103}],330:[function(require,module,exports){ +// https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of +require('./_set-collection-of')('WeakSet'); + +},{"./_set-collection-of":104}],331:[function(require,module,exports){ +var $iterators = require('./es6.array.iterator'); +var getKeys = require('./_object-keys'); +var redefine = require('./_redefine'); +var global = require('./_global'); +var hide = require('./_hide'); +var Iterators = require('./_iterators'); +var wks = require('./_wks'); +var ITERATOR = wks('iterator'); +var TO_STRING_TAG = wks('toStringTag'); +var ArrayValues = Iterators.Array; + +var DOMIterables = { + CSSRuleList: true, // TODO: Not spec compliant, should be false. + CSSStyleDeclaration: false, + CSSValueList: false, + ClientRectList: false, + DOMRectList: false, + DOMStringList: false, + DOMTokenList: true, + DataTransferItemList: false, + FileList: false, + HTMLAllCollection: false, + HTMLCollection: false, + HTMLFormElement: false, + HTMLSelectElement: false, + MediaList: true, // TODO: Not spec compliant, should be false. + MimeTypeArray: false, + NamedNodeMap: false, + NodeList: true, + PaintRequestList: false, + Plugin: false, + PluginArray: false, + SVGLengthList: false, + SVGNumberList: false, + SVGPathSegList: false, + SVGPointList: false, + SVGStringList: false, + SVGTransformList: false, + SourceBufferList: false, + StyleSheetList: true, // TODO: Not spec compliant, should be false. + TextTrackCueList: false, + TextTrackList: false, + TouchList: false +}; + +for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { + var NAME = collections[i]; + var explicit = DOMIterables[NAME]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + var key; + if (proto) { + if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); + if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = ArrayValues; + if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); + } +} + +},{"./_global":49,"./_hide":51,"./_iterators":67,"./_object-keys":89,"./_redefine":100,"./_wks":135,"./es6.array.iterator":148}],332:[function(require,module,exports){ +var $export = require('./_export'); +var $task = require('./_task'); +$export($export.G + $export.B, { + setImmediate: $task.set, + clearImmediate: $task.clear +}); + +},{"./_export":42,"./_task":119}],333:[function(require,module,exports){ +// ie9- setTimeout & setInterval additional parameters fix +var global = require('./_global'); +var $export = require('./_export'); +var userAgent = require('./_user-agent'); +var slice = [].slice; +var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check +var wrap = function (set) { + return function (fn, time /* , ...args */) { + var boundArgs = arguments.length > 2; + var args = boundArgs ? slice.call(arguments, 2) : false; + return set(boundArgs ? function () { + // eslint-disable-next-line no-new-func + (typeof fn == 'function' ? fn : Function(fn)).apply(this, args); + } : fn, time); + }; +}; +$export($export.G + $export.B + $export.F * MSIE, { + setTimeout: wrap(global.setTimeout), + setInterval: wrap(global.setInterval) +}); + +},{"./_export":42,"./_global":49,"./_user-agent":131}],334:[function(require,module,exports){ +require('./modules/es6.symbol'); +require('./modules/es6.object.create'); +require('./modules/es6.object.define-property'); +require('./modules/es6.object.define-properties'); +require('./modules/es6.object.get-own-property-descriptor'); +require('./modules/es6.object.get-prototype-of'); +require('./modules/es6.object.keys'); +require('./modules/es6.object.get-own-property-names'); +require('./modules/es6.object.freeze'); +require('./modules/es6.object.seal'); +require('./modules/es6.object.prevent-extensions'); +require('./modules/es6.object.is-frozen'); +require('./modules/es6.object.is-sealed'); +require('./modules/es6.object.is-extensible'); +require('./modules/es6.object.assign'); +require('./modules/es6.object.is'); +require('./modules/es6.object.set-prototype-of'); +require('./modules/es6.object.to-string'); +require('./modules/es6.function.bind'); +require('./modules/es6.function.name'); +require('./modules/es6.function.has-instance'); +require('./modules/es6.parse-int'); +require('./modules/es6.parse-float'); +require('./modules/es6.number.constructor'); +require('./modules/es6.number.to-fixed'); +require('./modules/es6.number.to-precision'); +require('./modules/es6.number.epsilon'); +require('./modules/es6.number.is-finite'); +require('./modules/es6.number.is-integer'); +require('./modules/es6.number.is-nan'); +require('./modules/es6.number.is-safe-integer'); +require('./modules/es6.number.max-safe-integer'); +require('./modules/es6.number.min-safe-integer'); +require('./modules/es6.number.parse-float'); +require('./modules/es6.number.parse-int'); +require('./modules/es6.math.acosh'); +require('./modules/es6.math.asinh'); +require('./modules/es6.math.atanh'); +require('./modules/es6.math.cbrt'); +require('./modules/es6.math.clz32'); +require('./modules/es6.math.cosh'); +require('./modules/es6.math.expm1'); +require('./modules/es6.math.fround'); +require('./modules/es6.math.hypot'); +require('./modules/es6.math.imul'); +require('./modules/es6.math.log10'); +require('./modules/es6.math.log1p'); +require('./modules/es6.math.log2'); +require('./modules/es6.math.sign'); +require('./modules/es6.math.sinh'); +require('./modules/es6.math.tanh'); +require('./modules/es6.math.trunc'); +require('./modules/es6.string.from-code-point'); +require('./modules/es6.string.raw'); +require('./modules/es6.string.trim'); +require('./modules/es6.string.iterator'); +require('./modules/es6.string.code-point-at'); +require('./modules/es6.string.ends-with'); +require('./modules/es6.string.includes'); +require('./modules/es6.string.repeat'); +require('./modules/es6.string.starts-with'); +require('./modules/es6.string.anchor'); +require('./modules/es6.string.big'); +require('./modules/es6.string.blink'); +require('./modules/es6.string.bold'); +require('./modules/es6.string.fixed'); +require('./modules/es6.string.fontcolor'); +require('./modules/es6.string.fontsize'); +require('./modules/es6.string.italics'); +require('./modules/es6.string.link'); +require('./modules/es6.string.small'); +require('./modules/es6.string.strike'); +require('./modules/es6.string.sub'); +require('./modules/es6.string.sup'); +require('./modules/es6.date.now'); +require('./modules/es6.date.to-json'); +require('./modules/es6.date.to-iso-string'); +require('./modules/es6.date.to-string'); +require('./modules/es6.date.to-primitive'); +require('./modules/es6.array.is-array'); +require('./modules/es6.array.from'); +require('./modules/es6.array.of'); +require('./modules/es6.array.join'); +require('./modules/es6.array.slice'); +require('./modules/es6.array.sort'); +require('./modules/es6.array.for-each'); +require('./modules/es6.array.map'); +require('./modules/es6.array.filter'); +require('./modules/es6.array.some'); +require('./modules/es6.array.every'); +require('./modules/es6.array.reduce'); +require('./modules/es6.array.reduce-right'); +require('./modules/es6.array.index-of'); +require('./modules/es6.array.last-index-of'); +require('./modules/es6.array.copy-within'); +require('./modules/es6.array.fill'); +require('./modules/es6.array.find'); +require('./modules/es6.array.find-index'); +require('./modules/es6.array.species'); +require('./modules/es6.array.iterator'); +require('./modules/es6.regexp.constructor'); +require('./modules/es6.regexp.to-string'); +require('./modules/es6.regexp.flags'); +require('./modules/es6.regexp.match'); +require('./modules/es6.regexp.replace'); +require('./modules/es6.regexp.search'); +require('./modules/es6.regexp.split'); +require('./modules/es6.promise'); +require('./modules/es6.map'); +require('./modules/es6.set'); +require('./modules/es6.weak-map'); +require('./modules/es6.weak-set'); +require('./modules/es6.typed.array-buffer'); +require('./modules/es6.typed.data-view'); +require('./modules/es6.typed.int8-array'); +require('./modules/es6.typed.uint8-array'); +require('./modules/es6.typed.uint8-clamped-array'); +require('./modules/es6.typed.int16-array'); +require('./modules/es6.typed.uint16-array'); +require('./modules/es6.typed.int32-array'); +require('./modules/es6.typed.uint32-array'); +require('./modules/es6.typed.float32-array'); +require('./modules/es6.typed.float64-array'); +require('./modules/es6.reflect.apply'); +require('./modules/es6.reflect.construct'); +require('./modules/es6.reflect.define-property'); +require('./modules/es6.reflect.delete-property'); +require('./modules/es6.reflect.enumerate'); +require('./modules/es6.reflect.get'); +require('./modules/es6.reflect.get-own-property-descriptor'); +require('./modules/es6.reflect.get-prototype-of'); +require('./modules/es6.reflect.has'); +require('./modules/es6.reflect.is-extensible'); +require('./modules/es6.reflect.own-keys'); +require('./modules/es6.reflect.prevent-extensions'); +require('./modules/es6.reflect.set'); +require('./modules/es6.reflect.set-prototype-of'); +require('./modules/es7.array.includes'); +require('./modules/es7.array.flat-map'); +require('./modules/es7.array.flatten'); +require('./modules/es7.string.at'); +require('./modules/es7.string.pad-start'); +require('./modules/es7.string.pad-end'); +require('./modules/es7.string.trim-left'); +require('./modules/es7.string.trim-right'); +require('./modules/es7.string.match-all'); +require('./modules/es7.symbol.async-iterator'); +require('./modules/es7.symbol.observable'); +require('./modules/es7.object.get-own-property-descriptors'); +require('./modules/es7.object.values'); +require('./modules/es7.object.entries'); +require('./modules/es7.object.define-getter'); +require('./modules/es7.object.define-setter'); +require('./modules/es7.object.lookup-getter'); +require('./modules/es7.object.lookup-setter'); +require('./modules/es7.map.to-json'); +require('./modules/es7.set.to-json'); +require('./modules/es7.map.of'); +require('./modules/es7.set.of'); +require('./modules/es7.weak-map.of'); +require('./modules/es7.weak-set.of'); +require('./modules/es7.map.from'); +require('./modules/es7.set.from'); +require('./modules/es7.weak-map.from'); +require('./modules/es7.weak-set.from'); +require('./modules/es7.global'); +require('./modules/es7.system.global'); +require('./modules/es7.error.is-error'); +require('./modules/es7.math.clamp'); +require('./modules/es7.math.deg-per-rad'); +require('./modules/es7.math.degrees'); +require('./modules/es7.math.fscale'); +require('./modules/es7.math.iaddh'); +require('./modules/es7.math.isubh'); +require('./modules/es7.math.imulh'); +require('./modules/es7.math.rad-per-deg'); +require('./modules/es7.math.radians'); +require('./modules/es7.math.scale'); +require('./modules/es7.math.umulh'); +require('./modules/es7.math.signbit'); +require('./modules/es7.promise.finally'); +require('./modules/es7.promise.try'); +require('./modules/es7.reflect.define-metadata'); +require('./modules/es7.reflect.delete-metadata'); +require('./modules/es7.reflect.get-metadata'); +require('./modules/es7.reflect.get-metadata-keys'); +require('./modules/es7.reflect.get-own-metadata'); +require('./modules/es7.reflect.get-own-metadata-keys'); +require('./modules/es7.reflect.has-metadata'); +require('./modules/es7.reflect.has-own-metadata'); +require('./modules/es7.reflect.metadata'); +require('./modules/es7.asap'); +require('./modules/es7.observable'); +require('./modules/web.timers'); +require('./modules/web.immediate'); +require('./modules/web.dom.iterable'); +module.exports = require('./modules/_core'); + +},{"./modules/_core":32,"./modules/es6.array.copy-within":138,"./modules/es6.array.every":139,"./modules/es6.array.fill":140,"./modules/es6.array.filter":141,"./modules/es6.array.find":143,"./modules/es6.array.find-index":142,"./modules/es6.array.for-each":144,"./modules/es6.array.from":145,"./modules/es6.array.index-of":146,"./modules/es6.array.is-array":147,"./modules/es6.array.iterator":148,"./modules/es6.array.join":149,"./modules/es6.array.last-index-of":150,"./modules/es6.array.map":151,"./modules/es6.array.of":152,"./modules/es6.array.reduce":154,"./modules/es6.array.reduce-right":153,"./modules/es6.array.slice":155,"./modules/es6.array.some":156,"./modules/es6.array.sort":157,"./modules/es6.array.species":158,"./modules/es6.date.now":159,"./modules/es6.date.to-iso-string":160,"./modules/es6.date.to-json":161,"./modules/es6.date.to-primitive":162,"./modules/es6.date.to-string":163,"./modules/es6.function.bind":164,"./modules/es6.function.has-instance":165,"./modules/es6.function.name":166,"./modules/es6.map":167,"./modules/es6.math.acosh":168,"./modules/es6.math.asinh":169,"./modules/es6.math.atanh":170,"./modules/es6.math.cbrt":171,"./modules/es6.math.clz32":172,"./modules/es6.math.cosh":173,"./modules/es6.math.expm1":174,"./modules/es6.math.fround":175,"./modules/es6.math.hypot":176,"./modules/es6.math.imul":177,"./modules/es6.math.log10":178,"./modules/es6.math.log1p":179,"./modules/es6.math.log2":180,"./modules/es6.math.sign":181,"./modules/es6.math.sinh":182,"./modules/es6.math.tanh":183,"./modules/es6.math.trunc":184,"./modules/es6.number.constructor":185,"./modules/es6.number.epsilon":186,"./modules/es6.number.is-finite":187,"./modules/es6.number.is-integer":188,"./modules/es6.number.is-nan":189,"./modules/es6.number.is-safe-integer":190,"./modules/es6.number.max-safe-integer":191,"./modules/es6.number.min-safe-integer":192,"./modules/es6.number.parse-float":193,"./modules/es6.number.parse-int":194,"./modules/es6.number.to-fixed":195,"./modules/es6.number.to-precision":196,"./modules/es6.object.assign":197,"./modules/es6.object.create":198,"./modules/es6.object.define-properties":199,"./modules/es6.object.define-property":200,"./modules/es6.object.freeze":201,"./modules/es6.object.get-own-property-descriptor":202,"./modules/es6.object.get-own-property-names":203,"./modules/es6.object.get-prototype-of":204,"./modules/es6.object.is":208,"./modules/es6.object.is-extensible":205,"./modules/es6.object.is-frozen":206,"./modules/es6.object.is-sealed":207,"./modules/es6.object.keys":209,"./modules/es6.object.prevent-extensions":210,"./modules/es6.object.seal":211,"./modules/es6.object.set-prototype-of":212,"./modules/es6.object.to-string":213,"./modules/es6.parse-float":214,"./modules/es6.parse-int":215,"./modules/es6.promise":216,"./modules/es6.reflect.apply":217,"./modules/es6.reflect.construct":218,"./modules/es6.reflect.define-property":219,"./modules/es6.reflect.delete-property":220,"./modules/es6.reflect.enumerate":221,"./modules/es6.reflect.get":224,"./modules/es6.reflect.get-own-property-descriptor":222,"./modules/es6.reflect.get-prototype-of":223,"./modules/es6.reflect.has":225,"./modules/es6.reflect.is-extensible":226,"./modules/es6.reflect.own-keys":227,"./modules/es6.reflect.prevent-extensions":228,"./modules/es6.reflect.set":230,"./modules/es6.reflect.set-prototype-of":229,"./modules/es6.regexp.constructor":231,"./modules/es6.regexp.flags":232,"./modules/es6.regexp.match":233,"./modules/es6.regexp.replace":234,"./modules/es6.regexp.search":235,"./modules/es6.regexp.split":236,"./modules/es6.regexp.to-string":237,"./modules/es6.set":238,"./modules/es6.string.anchor":239,"./modules/es6.string.big":240,"./modules/es6.string.blink":241,"./modules/es6.string.bold":242,"./modules/es6.string.code-point-at":243,"./modules/es6.string.ends-with":244,"./modules/es6.string.fixed":245,"./modules/es6.string.fontcolor":246,"./modules/es6.string.fontsize":247,"./modules/es6.string.from-code-point":248,"./modules/es6.string.includes":249,"./modules/es6.string.italics":250,"./modules/es6.string.iterator":251,"./modules/es6.string.link":252,"./modules/es6.string.raw":253,"./modules/es6.string.repeat":254,"./modules/es6.string.small":255,"./modules/es6.string.starts-with":256,"./modules/es6.string.strike":257,"./modules/es6.string.sub":258,"./modules/es6.string.sup":259,"./modules/es6.string.trim":260,"./modules/es6.symbol":261,"./modules/es6.typed.array-buffer":262,"./modules/es6.typed.data-view":263,"./modules/es6.typed.float32-array":264,"./modules/es6.typed.float64-array":265,"./modules/es6.typed.int16-array":266,"./modules/es6.typed.int32-array":267,"./modules/es6.typed.int8-array":268,"./modules/es6.typed.uint16-array":269,"./modules/es6.typed.uint32-array":270,"./modules/es6.typed.uint8-array":271,"./modules/es6.typed.uint8-clamped-array":272,"./modules/es6.weak-map":273,"./modules/es6.weak-set":274,"./modules/es7.array.flat-map":275,"./modules/es7.array.flatten":276,"./modules/es7.array.includes":277,"./modules/es7.asap":278,"./modules/es7.error.is-error":279,"./modules/es7.global":280,"./modules/es7.map.from":281,"./modules/es7.map.of":282,"./modules/es7.map.to-json":283,"./modules/es7.math.clamp":284,"./modules/es7.math.deg-per-rad":285,"./modules/es7.math.degrees":286,"./modules/es7.math.fscale":287,"./modules/es7.math.iaddh":288,"./modules/es7.math.imulh":289,"./modules/es7.math.isubh":290,"./modules/es7.math.rad-per-deg":291,"./modules/es7.math.radians":292,"./modules/es7.math.scale":293,"./modules/es7.math.signbit":294,"./modules/es7.math.umulh":295,"./modules/es7.object.define-getter":296,"./modules/es7.object.define-setter":297,"./modules/es7.object.entries":298,"./modules/es7.object.get-own-property-descriptors":299,"./modules/es7.object.lookup-getter":300,"./modules/es7.object.lookup-setter":301,"./modules/es7.object.values":302,"./modules/es7.observable":303,"./modules/es7.promise.finally":304,"./modules/es7.promise.try":305,"./modules/es7.reflect.define-metadata":306,"./modules/es7.reflect.delete-metadata":307,"./modules/es7.reflect.get-metadata":309,"./modules/es7.reflect.get-metadata-keys":308,"./modules/es7.reflect.get-own-metadata":311,"./modules/es7.reflect.get-own-metadata-keys":310,"./modules/es7.reflect.has-metadata":312,"./modules/es7.reflect.has-own-metadata":313,"./modules/es7.reflect.metadata":314,"./modules/es7.set.from":315,"./modules/es7.set.of":316,"./modules/es7.set.to-json":317,"./modules/es7.string.at":318,"./modules/es7.string.match-all":319,"./modules/es7.string.pad-end":320,"./modules/es7.string.pad-start":321,"./modules/es7.string.trim-left":322,"./modules/es7.string.trim-right":323,"./modules/es7.symbol.async-iterator":324,"./modules/es7.symbol.observable":325,"./modules/es7.system.global":326,"./modules/es7.weak-map.from":327,"./modules/es7.weak-map.of":328,"./modules/es7.weak-set.from":329,"./modules/es7.weak-set.of":330,"./modules/web.dom.iterable":331,"./modules/web.immediate":332,"./modules/web.timers":333}],335:[function(require,module,exports){ +(function (global){ +module.exports = false; + +// Only Node.JS has a process variable that is of [[Class]] process +try { + module.exports = Object.prototype.toString.call(global.process) === '[object process]' +} catch(e) {} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],336:[function(require,module,exports){ +'use strict'; + +/* eslint-disable */ +/** + * used in the test-docs as web-worker + */ +require('babel-polyfill'); +var BroadcastChannel = require('../../'); + +// overwrite console.log +try { + var logBefore = console.log; + // console.log = function (str) { logBefore('worker: ' + str); } +} catch (err) {} +// does not work in IE11 + + +/** + * because shitware microsof-edge stucks the worker + * when initialisation is done, + * we have to set a interval here. + */ +setInterval(function () {}, 10 * 1000); + +var channel; +self.addEventListener('message', function (e) { + var data = e.data; + switch (data.cmd) { + case 'start': + console.log('Worker started'); + console.log(JSON.stringify(data.msg)); + + channel = new BroadcastChannel(data.msg.channelName, { + type: data.msg.methodType + }); + var messages = []; + channel.onmessage = function (msg) { + console.log('recieved message(' + msg.step + ') from ' + msg.from + ': ' + JSON.stringify(msg)); + if (!msg.answer) { + console.log('(' + msg.step + ') answer back'); + channel.postMessage({ + answer: true, + from: 'worker', + original: msg + }); + } + }; + + self.postMessage('WORKER STARTED: '); + break; + case 'stop': + self.postMessage('WORKER STOPPED: ' + data.msg + '. (buttons will no longer work)'); + channel.close(); + self.close(); // Terminates the worker. + break; + default: + self.postMessage('Unknown command: ' + data.msg); + }; +}, false); +},{"../../":1,"babel-polyfill":9}]},{},[336]); diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..b226c663 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,48 @@ +declare type MethodType = 'node' | 'idb' | 'native' | 'localstorage'; + + + +interface BroadcastChannelEventMap { + "message": MessageEvent; + "messageerror": MessageEvent; +} + +export type BroadcastChannelOptions = { + type?: MethodType, + webWorkerSupport?: boolean; + prepareDelay?: number; + node?: { + ttl?: number; + }; + idb?: { + ttl?: number; + fallbackInterval?: number; + }; +}; + +declare type EventType = 'message' | 'error' | 'internal'; + +declare type OnMessageHandler = ((this: BroadcastChannel, ev: T) => any) | null; + +/** + * api as defined in + * @link https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts + * @link https://github.com/Microsoft/TypeScript/blob/master/src/lib/webworker.generated.d.ts#L325 + */ +declare class BroadcastChannel { + constructor(name: string, opts?: BroadcastChannelOptions); + readonly name: string; + readonly options: BroadcastChannelOptions; + readonly type: MethodType; + + postMessage(msg: T): Promise; + close(): Promise; + + onmessage: OnMessageHandler; + + // not defined in the offical standard + addEventListener(type: EventType, OnMessageHandler): void; + removeEventListener(type: EventType, OnMessageHandler): void; +} + +export default BroadcastChannel; diff --git a/package.json b/package.json new file mode 100644 index 00000000..29598dbf --- /dev/null +++ b/package.json @@ -0,0 +1,117 @@ +{ + "name": "broadcast-channel", + "version": "1.1.0", + "description": "A BroadcastChannel implementation that works with new browsers, older browsers and Node.js", + "homepage": "https://github.com/pubkey/broadcast-channel#readme", + "keywords": [ + "broadcast-channel", + "broadcastchannel", + "broadcast", + "polyfill", + "localstorage", + "indexeddb", + "postMessage", + "crosstab", + "ipc" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/pubkey/broadcast-channel.git" + }, + "author": "pubkey", + "license": "ISC", + "bugs": { + "url": "https://github.com/pubkey/broadcast-channel/issues" + }, + "main": "./dist/lib/index.es5.js", + "jsnext:main": "./dist/es/index.js", + "module": "./dist/es/index.js", + "types": "index.d.ts", + "scripts": { + "test": "npm run test:node && npm run test:browser && npm run test:e2e", + "test:node": "npm run build && mocha ./test/index.test.js -b --timeout 6000 --exit", + "test:browser": "npm run build && karma start ./config/karma.conf.js --single-run", + "test:e2e": "concurrently \"npm run docs:serve\" \"testcafe all test/e2e.test.js\" --kill-others --success first", + "test:typings": "npm run build && mocha ./test/typings.test.js -b --timeout 12000 --exit", + "test:size": "npm run build && rimraf test_tmp/browserify.js && browserify --no-builtins dist/lib/browserify.index.js > test_tmp/browserify.js && uglifyjs --compress --mangle --output test_tmp/browserify.min.js -- test_tmp/browserify.js && echo \"Build-Size (minified+gzip):\" && gzip-size --raw test_tmp/browserify.min.js", + "lint": "eslint --ignore-path ./config/.eslintignore src test config scripts", + "clear": "rimraf -rf ./dist && rimraf -rf ./gen", + "build:es6": "rimraf -rf dist/es && cross-env NODE_ENV=es6 babel src --out-dir dist/es", + "build:es5": "cross-env NODE_ENV=es5 node node_modules/babel-cli/bin/babel.js src --out-dir dist/lib", + "build:test": "cross-env NODE_ENV=es5 node node_modules/babel-cli/bin/babel.js test --out-dir test_tmp", + "build:browser": "browserify test_tmp/scripts/index.js > docs/index.js", + "build:worker": "browserify test_tmp/scripts/worker.js > docs/worker.js", + "build:iframe": "browserify test_tmp/scripts/iframe.js > docs/iframe.js", + "build": "npm run clear && concurrently \"npm run build:es6\" \"npm run build:es5\" \"npm run build:test\" && concurrently \"npm run build:browser\" \"npm run build:worker\" \"npm run build:iframe\"", + "build:min": "uglifyjs --compress --mangle --output dist/lib/browserify.min.js -- dist/lib/browserify.index.js", + "docs:only": "http-server ./docs", + "docs:serve": "npm run build && npm run docs:only" + }, + "pre-commit": [ + "lint" + ], + "dependencies": { + "@types/core-js": "^2.5.0", + "babel-runtime": "6.26.0", + "custom-idle-queue": "2.0.1", + "detect-node": "2.0.3", + "js-sha3": "0.7.0", + "unload": "1.3.7" + }, + "devDependencies": { + "@babel/types": "^7.0.0-beta.51", + "assert": "1.4.1", + "async-test-util": "1.6.1", + "babel-cli": "6.26.0", + "babel-core": "6.26.3", + "babel-eslint": "8.2.5", + "babel-loader": "7.1.4", + "babel-plugin-transform-async-to-generator": "6.24.1", + "babel-plugin-transform-class-properties": "6.24.1", + "babel-plugin-transform-es2015-block-scoping": "6.26.0", + "babel-plugin-transform-es2015-constants": "6.1.4", + "babel-plugin-transform-es3-member-expression-literals": "6.22.0", + "babel-plugin-transform-es3-property-literals": "6.22.0", + "babel-plugin-transform-object-rest-spread": "6.26.0", + "babel-plugin-transform-regenerator": "6.26.0", + "babel-plugin-transform-runtime": "6.23.0", + "babel-polyfill": "6.26.0", + "babel-preset-es2015": "6.24.1", + "babel-preset-es2015-native-modules": "6.9.4", + "babel-preset-es2015-rollup": "3.0.0", + "babel-preset-es2016": "6.24.1", + "babel-preset-es2017": "6.24.1", + "babel-preset-latest": "6.24.1", + "browserify": "16.2.2", + "child-process-promise": "^2.2.1", + "clone": "2.1.1", + "concurrently": "3.6.0", + "convert-hrtime": "2.0.0", + "copyfiles": "2.0.0", + "cross-env": "5.2.0", + "eslint": "4.19.1", + "gzip-size-cli": "^2.1.0", + "http-server": "0.11.1", + "karma": "2.0.4", + "karma-babel-preprocessor": "7.0.0", + "karma-browserify": "5.3.0", + "karma-chrome-launcher": "2.2.0", + "karma-coverage": "1.1.2", + "karma-detect-browsers": "2.3.2", + "karma-edge-launcher": "0.4.2", + "karma-firefox-launcher": "1.1.0", + "karma-ie-launcher": "1.0.0", + "karma-mocha": "1.3.0", + "karma-opera-launcher": "1.0.0", + "karma-safari-launcher": "1.0.0", + "mocha": "5.2.0", + "pre-commit": "1.2.2", + "random-int": "1.0.0", + "random-token": "0.0.8", + "rimraf": "2.6.2", + "testcafe": "0.20.3", + "testcafe-hammerhead": "14.0.0", + "ts-node": "6.1.2", + "typescript": "2.9.2" + } +} diff --git a/perf.txt b/perf.txt new file mode 100644 index 00000000..ab8a2630 --- /dev/null +++ b/perf.txt @@ -0,0 +1,68 @@ +BEFORE: + +(clean application state), exmpty idb +- intervall-timeout set to zero +2220ms +2494ms +2235ms + +// series run without cleaning the state +2385 +4813 +6079 +7553 +9573 + + +AFTER: +(clear state) +1370 +1281 +1212 + +(non clear) +1312 +1314 +1362 +1448 +1450 +1397 + + + + + +=================================== +20.06.2018 +=================================== +IndexedDB + +BEFORE: +3610 +3380 +3489 + + +AFTER (with localstorage ping): +4183 +3962 +3821 + +=> sending localstorage-pings is slower + + + + +====== build-size +BEFORE: 37251 +AFTER: 4077 + + +====== build-size 2 +BEFORE: 4077 +AFTER: 3795 + + +====== build-size 3 +BEFORE: 3795 +AFTER: 3110 \ No newline at end of file diff --git a/src/browserify.index.js b/src/browserify.index.js new file mode 100644 index 00000000..2c7bb3df --- /dev/null +++ b/src/browserify.index.js @@ -0,0 +1,3 @@ +const BroadcastChannel = require('./index.es5.js'); + +window['BroadcastChannel2'] = BroadcastChannel; diff --git a/src/index.es5.js b/src/index.es5.js new file mode 100644 index 00000000..e94ea060 --- /dev/null +++ b/src/index.es5.js @@ -0,0 +1,12 @@ +/** + * because babel can only export on default-attribute, + * we use this for the non-module-build + * this ensures that users do not have to use + * var BroadcastChannel = require('broadcast-channel').default; + * but + * var BroadcastChannel = require('broadcast-channel'); + */ + +import BroadcastChannel from './index.js'; + +module.exports = BroadcastChannel; \ No newline at end of file diff --git a/src/index.js b/src/index.js new file mode 100644 index 00000000..6327f8d8 --- /dev/null +++ b/src/index.js @@ -0,0 +1,184 @@ +import { + isPromise +} from './util.js'; + +import { + chooseMethod +} from './method-chooser.js'; + +import { + fillOptionsWithDefaults +} from './options.js'; + + + +const BroadcastChannel = function (name, options) { + this.name = name; + this.options = fillOptionsWithDefaults(options); + this.method = chooseMethod(this.options); + + this._isListening = false; + + /** + * setting onmessage twice, + * will overwrite the first listener + */ + this._onMessageListener = null; + + this._addEventListeners = { + message: [], + internal: [] + }; + + this._preparePromise = null; + _prepareChannel(this); +}; + +BroadcastChannel.prototype = { + postMessage(msg) { + const msgObj = { + time: new Date().getTime(), + type: 'message', + data: msg + }; + + if (this.closed) { + throw new Error( + 'BroadcastChannel.postMessage(): ' + + 'Cannot post message after channel has closed' + ); + } + + const awaitPrepare = this._preparePromise ? this._preparePromise : Promise.resolve(); + return awaitPrepare.then(() => { + return this.method.postMessage( + this._state, + msgObj + ); + }); + }, + set onmessage(fn) { + const time = new Date().getTime() - 5; + const listenObj = { + time, + fn + }; + _removeListenerObject(this, 'message', this._onMessageListener); + if (fn && typeof fn === 'function') { + this._onMessageListener = listenObj; + _addListenerObject(this, 'message', listenObj); + } else { + this._onMessageListener = null; + } + }, + + addEventListener(type, fn) { + const time = new Date().getTime() - 5; + const listenObj = { + time, + fn + }; + _addListenerObject(this, type, listenObj); + }, + removeEventListener(type, fn) { + const obj = this._addEventListeners[type].find(obj => obj.fn === fn); + _removeListenerObject(this, type, obj); + }, + + close() { + this.closed = true; + const awaitPrepare = this._preparePromise ? this._preparePromise : Promise.resolve(); + + this._onMessageListener = null; + this._addEventListeners.message = []; + + return awaitPrepare.then(() => { + return this.method.close( + this._state + ); + }); + }, + get type() { + return this.method.type; + } +}; + +function _prepareChannel(channel) { + const maybePromise = channel.method.create(channel.name, channel.options); + if (isPromise(maybePromise)) { + channel._preparePromise = maybePromise; + maybePromise.then(s => { + // used in tests to simulate slow runtime + /*if (channel.options.prepareDelay) { + await new Promise(res => setTimeout(res, this.options.prepareDelay)); + }*/ + channel._state = s; + }); + } else { + channel._state = maybePromise; + } +} + + +function _hasMessageListeners(channel) { + if (channel._addEventListeners.message.length > 0) return true; + if (channel._addEventListeners.internal.length > 0) return true; + return false; +} + +function _addListenerObject(channel, type, obj) { + channel._addEventListeners[type].push(obj); + _startListening(channel); +} +function _removeListenerObject(channel, type, obj) { + channel._addEventListeners[type] = channel._addEventListeners[type].filter(o => o !== obj); + _stopListening(channel); +} + +function _startListening(channel) { + if (!channel._isListening && _hasMessageListeners(channel)) { + // someone is listening, start subscribing + + const listenerFn = msgObj => { + channel._addEventListeners[msgObj.type].forEach(obj => { + if (msgObj.time >= obj.time) { + obj.fn(msgObj.data); + }; + }); + }; + + const time = new Date().getTime() - 5; + if (channel._preparePromise) { + channel._preparePromise.then(() => { + channel._isListening = true; + channel.method.onMessage( + channel._state, + listenerFn, + time + ); + }); + } else { + channel._isListening = true; + channel.method.onMessage( + channel._state, + listenerFn, + time + ); + } + } +} + +function _stopListening(channel) { + if (channel._isListening && !_hasMessageListeners(channel)) { + // noone is listening, stop subscribing + channel._isListening = false; + const time = new Date().getTime() - 5; + channel.method.onMessage( + channel._state, + null, + time + ); + } +} + +export default BroadcastChannel; \ No newline at end of file diff --git a/src/method-chooser.js b/src/method-chooser.js new file mode 100644 index 00000000..7416969b --- /dev/null +++ b/src/method-chooser.js @@ -0,0 +1,45 @@ +const isNode = require('detect-node'); + +const NativeMethod = require('./methods/native.js'); +const IndexeDbMethod = require('./methods/indexed-db.js'); +const LocalstorageMethod = require('./methods/localstorage.js'); + +// order is important +let METHODS = [ + NativeMethod, // fastest + IndexeDbMethod, + LocalstorageMethod +]; + +const REQUIRE_FUN = require; + +/** + * The NodeMethod is loaded lazy + * so it will not get bundled in browser-builds + */ +if (isNode) { + const NodeMethod = REQUIRE_FUN('./methods/node.js'); + METHODS.push(NodeMethod); +} + + +export function chooseMethod(options) { + // directly chosen + if (options.type) { + const ret = METHODS.find(m => m.type === options.type); + if (!ret) throw new Error('method-type ' + options.type + ' not found'); + else return ret; + } + + let chooseMethods = METHODS; + if (!options.webWorkerSupport && !isNode) { + // prefer localstorage over idb when no webworker-support needed + chooseMethods = METHODS.filter(m => m.type !== 'idb'); + } + + const useMethod = chooseMethods.find(method => method.canBeUsed()); + if (!useMethod) + throw new Error('No useable methode found:' + JSON.stringify(METHODS.map(m => m.type))); + else + return useMethod; +} \ No newline at end of file diff --git a/src/methods/cookies.js b/src/methods/cookies.js new file mode 100644 index 00000000..f0cf25c8 --- /dev/null +++ b/src/methods/cookies.js @@ -0,0 +1,4 @@ +/** + * if you really need this method, + * implement it + */ \ No newline at end of file diff --git a/src/methods/indexed-db.js b/src/methods/indexed-db.js new file mode 100644 index 00000000..a123cb36 --- /dev/null +++ b/src/methods/indexed-db.js @@ -0,0 +1,263 @@ +/** + * this method uses indexeddb to store the messages + * There is currently no observerAPI for idb + * @link https://github.com/w3c/IndexedDB/issues/51 + */ + +const isNode = require('detect-node'); + +import { + sleep, + randomInt, + randomToken +} from '../util.js'; + +import { + fillOptionsWithDefaults +} from '../options'; + +const DB_PREFIX = 'pubkey.broadcast-channel-0-'; +const OBJECT_STORE_ID = 'messages'; + +export const type = 'idb'; + +export function getIdb() { + if (typeof indexedDB !== 'undefined') return indexedDB; + if (typeof mozIndexedDB !== 'undefined') return mozIndexedDB; + if (typeof webkitIndexedDB !== 'undefined') return webkitIndexedDB; + if (typeof msIndexedDB !== 'undefined') return msIndexedDB; + + return false; +} + +export function createDatabase(channelName) { + const IndexedDB = getIdb(); + + // create table + const dbName = DB_PREFIX + channelName; + const openRequest = IndexedDB.open(dbName, 1); + + openRequest.onupgradeneeded = ev => { + const db = ev.target.result; + db.createObjectStore(OBJECT_STORE_ID, { + keyPath: 'id', + autoIncrement: true + }); + }; + const dbPromise = new Promise((res, rej) => { + openRequest.onerror = ev => rej(ev); + openRequest.onsuccess = () => { + res(openRequest.result); + }; + }); + + return dbPromise; +} + +/** + * writes the new message to the database + * so other readers can find it + */ +export function writeMessage(db, readerUuid, messageJson) { + const time = new Date().getTime(); + const writeObject = { + uuid: readerUuid, + time, + data: messageJson + }; + + const transaction = db.transaction([OBJECT_STORE_ID], 'readwrite'); + + return new Promise((res, rej) => { + transaction.oncomplete = () => res(); + transaction.onerror = ev => rej(ev); + + const objectStore = transaction.objectStore(OBJECT_STORE_ID); + objectStore.add(writeObject); + }); +} + +export function getAllMessages(db) { + const objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + const ret = []; + return new Promise(res => { + objectStore.openCursor().onsuccess = ev => { + const cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor.continue(); + } else { + res(ret); + } + }; + }); +} + +export function getMessagesHigherThen(db, lastCursorId) { + const objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + const ret = []; + const keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity); + return new Promise(res => { + objectStore.openCursor(keyRangeValue).onsuccess = ev => { + const cursor = ev.target.result; + if (cursor) { + ret.push(cursor.value); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor.continue(); + } else { + res(ret); + } + }; + }); +} + +export function removeMessageById(db, id) { + const request = db.transaction([OBJECT_STORE_ID], 'readwrite') + .objectStore(OBJECT_STORE_ID) + .delete(id); + return new Promise(res => { + request.onsuccess = () => res(); + }); +} + +export function getOldMessages(db, ttl) { + const olderThen = new Date().getTime() - ttl; + const objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID); + const ret = []; + return new Promise(res => { + objectStore.openCursor().onsuccess = ev => { + const cursor = ev.target.result; + if (cursor) { + const msgObk = cursor.value; + if (msgObk.time < olderThen) { + ret.push(msgObk); + //alert("Name for SSN " + cursor.key + " is " + cursor.value.name); + cursor.continue(); + } else { + // no more old messages, + res(ret); + return; + } + } else { + res(ret); + } + }; + }); +} + +export function cleanOldMessages(db, ttl) { + return getOldMessages(db, ttl) + .then(tooOld => { + return Promise.all( + tooOld.map(msgObj => removeMessageById(db, msgObj.id)) + ); + }); +} + +export function create(channelName, options) { + options = fillOptionsWithDefaults(options); + + const uuid = randomToken(10); + + return createDatabase(channelName).then(db => { + const state = { + closed: false, + lastCursorId: 0, + channelName, + options, + uuid, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallback: null, + readQueuePromises: [], + db + }; + + /** + * if service-workers are used, + * we have no 'storage'-event if they post a message, + * therefore we also have to set an interval + */ + _readLoop(state); + + return state; + }); +} + +function _readLoop(state) { + if (state.closed) return; + + return readNewMessages(state) + .then(() => sleep(state.options.idb.fallbackInterval)) + .then(() => _readLoop(state)); +} + +/** + * reads all new messages from the database and emits them + */ +function readNewMessages(state) { + return getMessagesHigherThen(state.db, state.lastCursorId) + .then(newerMessages => { + const useMessages = newerMessages + .map(msgObj => { + if (msgObj.id > state.lastCursorId) { + state.lastCursorId = msgObj.id; + } + return msgObj; + }) + .filter(msgObj => msgObj.uuid !== state.uuid) // not send by own + .filter(msgObj => !state.emittedMessagesIds.has(msgObj.id)) // not already emitted + .filter(msgObj => msgObj.time >= state.messagesCallbackTime) // not older then onMessageCallback + .sort((msgObjA, msgObjB) => msgObjA.time - msgObjB.time); // sort by time + + + useMessages.forEach(msgObj => { + if (state.messagesCallback) { + state.emittedMessagesIds.add(msgObj.id); + setTimeout( + () => state.emittedMessagesIds.delete(msgObj.id), + state.options.idb.ttl * 2 + ); + + state.messagesCallback(msgObj.data); + } + }); + + return Promise.resolve(); + }); +} + +export function close(channelState) { + channelState.closed = true; + channelState.db.close(); +} + +export function postMessage(channelState, messageJson) { + return writeMessage( + channelState.db, + channelState.uuid, + messageJson + ).then(() => { + if (randomInt(0, 10) === 0) { + /* await (do not await) */ cleanOldMessages( + channelState.db, + channelState.options.idb.ttl + ); + } + }); +} + +export function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + readNewMessages(channelState); +} + +export function canBeUsed() { + if (isNode) return false; + const idb = getIdb(); + + if (!idb) return false; + return true; +}; diff --git a/src/methods/localstorage.js b/src/methods/localstorage.js new file mode 100644 index 00000000..cf73cf4c --- /dev/null +++ b/src/methods/localstorage.js @@ -0,0 +1,150 @@ +/** + * A localStorage-only method which uses localstorage and its 'storage'-event + * This does not work inside of webworkers because they have no access to locastorage + * This is basically implemented to support IE9 or your grandmothers toaster. + * @link https://caniuse.com/#feat=namevalue-storage + * @link https://caniuse.com/#feat=indexeddb + */ + +const isNode = require('detect-node'); + +import { + fillOptionsWithDefaults +} from '../options'; + +import { + sleep, + randomToken +} from '../util'; + +const KEY_PREFIX = 'pubkey.broadcastChannel-'; +export const type = 'localstorage'; + +/** + * copied from crosstab + * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32 + */ +export function getLocalStorage() { + let localStorage; + if (typeof window === 'undefined') return null; + try { + localStorage = window.localStorage; + localStorage = window['ie8-eventlistener/storage'] || window.localStorage; + } catch (e) { + // New versions of Firefox throw a Security exception + // if cookies are disabled. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153 + } + return localStorage; +} + +export function storageKey(channelName) { + return KEY_PREFIX + channelName; +} + + +/** +* writes the new message to the storage +* and fires the storage-event so other readers can find it +*/ +export function postMessage(channelState, messageJson) { + return new Promise(res => { + sleep().then(() => { + const key = storageKey(channelState.channelName); + const writeObj = { + token: randomToken(10), + time: new Date().getTime(), + data: messageJson, + uuid: channelState.uuid + }; + const value = JSON.stringify(writeObj); + localStorage.setItem(key, value); + + /** + * StorageEvent does not fire the 'storage' event + * in the window that changes the state of the local storage. + * So we fire it manually + */ + const ev = document.createEvent('Event'); + ev.initEvent('storage', true, true); + ev.key = key; + ev.newValue = value; + window.dispatchEvent(ev); + + res(); + }); + }); +} + +export function addStorageEventListener(channelName, fn) { + const key = storageKey(channelName); + const listener = ev => { + if (ev.key === key) { + fn(JSON.parse(ev.newValue)); + } + }; + window.addEventListener('storage', listener); + return listener; +} +export function removeStorageEventListener(listener) { + window.removeEventListener('storage', listener); +} + +export function create(channelName, options) { + options = fillOptionsWithDefaults(options); + if (!canBeUsed()) { + throw new Error('BroadcastChannel: localstorage cannot be used'); + } + + const startTime = new Date().getTime(); + const uuid = randomToken(10); + + // contains all messages that have been emitted before + const emittedMessagesIds = new Set(); + + const state = { + startTime, + channelName, + options, + uuid, + emittedMessagesIds + }; + + + state.listener = addStorageEventListener( + channelName, + (msgObj) => { + if (!state.messagesCallback) return; // no listener + if (msgObj.uuid === uuid) return; // own message + if (!msgObj.token || emittedMessagesIds.has(msgObj.token)) return; // already emitted + if (msgObj.time && msgObj.time < state.messagesCallbackTime) return; // too old + + emittedMessagesIds.add(msgObj.token); + setTimeout( + () => emittedMessagesIds.delete(msgObj.token), + options.localstorage.removeTimeout + ); + state.messagesCallback(msgObj.data); + } + ); + + + return state; +} + +export function close(channelState) { + removeStorageEventListener(channelState.listener); +} + +export function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +export function canBeUsed() { + if (isNode) return false; + const ls = getLocalStorage(); + + if (!ls) return false; + return true; +}; diff --git a/src/methods/native.js b/src/methods/native.js new file mode 100644 index 00000000..3151469c --- /dev/null +++ b/src/methods/native.js @@ -0,0 +1,42 @@ +const isNode = require('detect-node'); + +export const type = 'native'; + +export function create(channelName, options) { + if(!options) options = {}; + const state = { + channelName, + options, + messagesCallback: null, + bc: new BroadcastChannel(channelName), + subscriberFunctions: [] + }; + + state.bc.onmessage = msg => { + if (state.messagesCallback) { + state.messagesCallback(msg.data); + } + }; + + return state; +}; + +export function close(channelState) { + channelState.bc.close(); + channelState.subscriberFunctions = []; +} + +export function postMessage(channelState, messageJson) { + channelState.bc.postMessage(messageJson, false); +} + +export function onMessage(channelState, fn, time) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; +} + +export function canBeUsed() { + if (isNode) return false; + + if (typeof BroadcastChannel === 'function') return true; +}; diff --git a/src/methods/node.js b/src/methods/node.js new file mode 100644 index 00000000..2b3015ce --- /dev/null +++ b/src/methods/node.js @@ -0,0 +1,492 @@ +/** + * this method is used in nodejs-environments. + * The ipc is handled via sockets and file-writes to the tmp-folder + */ + +import * as util from 'util'; +import * as fs from 'fs'; +import * as os from 'os'; +import * as events from 'events'; +import * as net from 'net'; +import * as path from 'path'; +import { + sha3_224 +} from 'js-sha3'; + +import isNode from 'detect-node'; +import IdleQueue from 'custom-idle-queue'; +import unload from 'unload'; + +import { + fillOptionsWithDefaults +} from '../options'; + +import { + randomInt, + randomToken +} from '../util'; + +/** + * windows sucks, so we have handle windows-type of socket-paths + * @link https://gist.github.com/domenic/2790533#gistcomment-331356 + */ +export function cleanPipeName(str) { + if ( + process.platform === 'win32' && + !str.startsWith('\\\\.\\pipe\\') + ) { + str = str.replace(/^\//, ''); + str = str.replace(/\//g, '-'); + return '\\\\.\\pipe\\' + str; + } else { + return str; + } +}; + +const mkdir = util.promisify(fs.mkdir); +const writeFile = util.promisify(fs.writeFile); +const readFile = util.promisify(fs.readFile); +const unlink = util.promisify(fs.unlink); +const readdir = util.promisify(fs.readdir); + + +const TMP_FOLDER_NAME = 'pubkey.broadcast-channel'; + +export function getPaths(channelName) { + const folderPathBase = path.join( + os.tmpdir(), + TMP_FOLDER_NAME + ); + const channelPathBase = path.join( + os.tmpdir(), + TMP_FOLDER_NAME, + sha3_224(channelName) // use hash incase of strange characters + ); + const folderPathReaders = path.join( + channelPathBase, + 'readers' + ); + const folderPathMessages = path.join( + channelPathBase, + 'messages' + ); + + return { + base: folderPathBase, + channelBase: channelPathBase, + readers: folderPathReaders, + messages: folderPathMessages + }; +} + +export async function ensureFoldersExist(channelName) { + + const paths = getPaths(channelName); + + + await mkdir(paths.base).catch(() => null); + await mkdir(paths.channelBase).catch(() => null); + await Promise.all([ + await mkdir(paths.readers).catch(() => null), + await mkdir(paths.messages).catch(() => null) + ]); +}; + +export function socketPath(channelName, readerUuid) { + + const paths = getPaths(channelName); + const socketPath = path.join( + paths.readers, + readerUuid + '.s' + ); + return cleanPipeName(socketPath); +} + +export function socketInfoPath(channelName, readerUuid) { + const paths = getPaths(channelName); + const socketPath = path.join( + paths.readers, + readerUuid + '.json' + ); + return socketPath; +} + + +/** + * Because it is not possible to get all socket-files in a folder, + * when used under fucking windows, + * we have to set a normal file so other readers know our socket exists + */ +export async function createSocketInfoFile(channelName, readerUuid) { + await ensureFoldersExist(channelName); + const pathToFile = socketInfoPath(channelName, readerUuid); + await writeFile( + pathToFile, + JSON.stringify({ + time: new Date().getTime() + }) + ); + return pathToFile; +} + +/** + * creates the socket-file and subscribes to it + * @return {{emitter: EventEmitter, server: any}} + */ +export async function createSocketEventEmitter(channelName, readerUuid) { + const pathToSocket = socketPath(channelName, readerUuid); + + const emitter = new events.EventEmitter(); + const server = net + .createServer(stream => { + stream.on('end', function () { + // console.log('server: end'); + }); + + stream.on('data', function (msg) { + // console.log('server: got data:'); + // console.dir(msg.toString()); + emitter.emit('data', msg.toString()); + }); + }); + + await new Promise(res => { + server.listen(pathToSocket, () => { + res(); + }); + }); + server.on('connection', () => { + // console.log('server: Client connected.'); + }); + + return { + path: pathToSocket, + emitter, + server + }; +} + +export async function openClientConnection(channelName, readerUuid) { + const pathToSocket = socketPath(channelName, readerUuid); + const client = new net.Socket(); + await new Promise(res => { + client.connect( + pathToSocket, + res + ); + }); + return client; +} + + +/** + * writes the new message to the file-system + * so other readers can find it + */ +export async function writeMessage(channelName, readerUuid, messageJson) { + const time = new Date().getTime(); + const writeObject = { + uuid: readerUuid, + time, + data: messageJson + }; + + const token = randomToken(12); + const fileName = time + '_' + readerUuid + '_' + token + '.json'; + + const msgPath = path.join( + getPaths(channelName).messages, + fileName + ); + + await writeFile( + msgPath, + JSON.stringify(writeObject) + ); + + return { + time, + uuid: readerUuid, + token, + path: msgPath + }; +} + +/** + * returns the uuids of all readers + * @return {string[]} + */ +export async function getReadersUuids(channelName) { + const readersPath = getPaths(channelName).readers; + const files = await readdir(readersPath); + + return files + .map(file => file.split('.')) + .filter(split => split[1] === 'json') // do not scan .socket-files + .map(split => split[0]); +} + +export async function messagePath(channelName, time, token, writerUuid) { + const fileName = time + '_' + writerUuid + '_' + token + '.json'; + + const msgPath = path.join( + getPaths(channelName).messages, + fileName + ); + return msgPath; +} + +export async function getAllMessages(channelName) { + const messagesPath = getPaths(channelName).messages; + const files = await readdir(messagesPath); + return files.map(file => { + const fileName = file.split('.')[0]; + const split = fileName.split('_'); + + return { + path: path.join( + messagesPath, + file + ), + time: parseInt(split[0]), + senderUuid: split[1], + token: split[2] + }; + }); +} + +export function getSingleMessage(channelName, msgObj) { + const messagesPath = getPaths(channelName).messages; + + return { + path: path.join( + messagesPath, + msgObj.t + '_' + msgObj.u + '_' + msgObj.to + '.json' + ), + time: msgObj.t, + senderUuid: msgObj.u, + token: msgObj.to + }; +} + + +export async function readMessage(messageObj) { + const content = await readFile(messageObj.path, 'utf8'); + return JSON.parse(content); +} + +export async function cleanOldMessages(messageObjects, ttl) { + const olderThen = new Date().getTime() - ttl; + + await Promise.all( + messageObjects + .filter(obj => obj.time < olderThen) + .map(obj => unlink(obj.path).catch(() => null)) + ); +} + + + +export const type = 'node'; + +export async function create(channelName, options = {}) { + options = fillOptionsWithDefaults(options); + + await ensureFoldersExist(channelName); + const uuid = randomToken(10); + + const [ + otherReaderUuids, + socketEE, + infoFilePath + ] = await Promise.all([ + getReadersUuids(channelName), + createSocketEventEmitter(channelName, uuid), + createSocketInfoFile(channelName, uuid) + ]); + + const otherReaderClients = {}; + await Promise.all( + otherReaderUuids + .filter(readerUuid => readerUuid !== uuid) // not own + .map(async (readerUuid) => { + const client = await openClientConnection(channelName, readerUuid); + otherReaderClients[readerUuid] = client; + }) + ); + + // ensures we do not read messages in parrallel + const readQueue = new IdleQueue(1); + const writeQueue = new IdleQueue(1); + + const state = { + channelName, + options, + uuid, + socketEE, + infoFilePath, + // contains all messages that have been emitted before + emittedMessagesIds: new Set(), + messagesCallbackTime: null, + messagesCallback: null, + readQueue, + writeQueue, + otherReaderUuids, + otherReaderClients, + // ensure if process crashes, everything is cleaned up + removeUnload: unload.add(() => close(state)) + }; + + // when new message comes in, we read it and emit it + socketEE.emitter.on('data', data => { + const obj = JSON.parse(data); + if (obj.a === 'msg') { + handleMessagePing(state, obj.d); + return; + } + }); + + return state; +} + + +/** + * when the socket pings, so that we now new messages came, + * run this + */ +export async function handleMessagePing(state, msgObj = null) { + /** + * when there are no listener, we do nothing + */ + if (!state.messagesCallback) return; + + await state.readQueue.requestIdlePromise(); + await state.readQueue.wrapCall( + async () => { + + + let messages; + if (!msgObj) { + // get all + messages = await getAllMessages(state.channelName); + } else { + // get single message + messages = [ + getSingleMessage(state.channelName, msgObj) + ]; + } + + const useMessages = messages + .filter(msgObj => msgObj.senderUuid !== state.uuid) // not send by own + .filter(msgObj => !state.emittedMessagesIds.has(msgObj.token)) // not already emitted + .filter(msgObj => msgObj.time >= state.messagesCallbackTime) // not older then onMessageCallback + .sort((msgObjA, msgObjB) => msgObjA.time - msgObjB.time); // sort by time + + if (state.messagesCallback) { + for (const msgObj of useMessages) { + const content = await readMessage(msgObj); + state.emittedMessagesIds.add(msgObj.token); + setTimeout( + () => state.emittedMessagesIds.delete(msgObj.token), + state.options.node.ttl * 2 + ); + + if (state.messagesCallback) { + state.messagesCallback(content.data); + } + } + } + } + ); +} + +export async function refreshReaderClients(channelState) { + // ensure we have subscribed to all readers + const otherReaders = await getReadersUuids(channelState.channelName); + + // remove subscriptions to closed readers + Object.keys(channelState.otherReaderClients) + .filter(readerUuid => !otherReaders.includes(readerUuid)) + .forEach(readerUuid => { + channelState.otherReaderClients[readerUuid].close(); + delete channelState.otherReaderClients[readerUuid]; + }); + + await Promise.all( + otherReaders + .filter(readerUuid => readerUuid !== channelState.uuid) // not own + .filter(readerUuid => !channelState.otherReaderClients[readerUuid]) // not already has client + .map(async (readerUuid) => { + const client = await openClientConnection(channelState.channelName, readerUuid); + channelState.otherReaderClients[readerUuid] = client; + }) + ); +} + +export async function postMessage(channelState, messageJson) { + + // ensure we do this not in parallel + await channelState.writeQueue.requestIdlePromise(); + await channelState.writeQueue.wrapCall( + async () => { + await refreshReaderClients(channelState); + const msgObj = await writeMessage( + channelState.channelName, + channelState.uuid, + messageJson + ); + + // ping other readers + const pingObj = { + a: 'msg', + d: { + t: msgObj.time, + u: msgObj.uuid, + to: msgObj.token + } + }; + await Promise.all( + Object.values(channelState.otherReaderClients) + .map(client => client.write(JSON.stringify(pingObj))) + ); + + /** + * clean up old messages + * to not waste resources on cleaning up, + * only if random-int matches, we clean up old messages + */ + if (randomInt(0, 10) === 0) { + const messages = await getAllMessages(channelState.channelName); + await cleanOldMessages(messages, channelState.options.node.ttl); + } + + // emit to own eventEmitter + // channelState.socketEE.emitter.emit('data', JSON.parse(JSON.stringify(messageJson))); + } + ); +} + + +export function onMessage(channelState, fn, time = new Date().getTime()) { + channelState.messagesCallbackTime = time; + channelState.messagesCallback = fn; + handleMessagePing(channelState); +} + +export async function close(channelState) { + channelState.removeUnload(); + channelState.socketEE.server.close(); + channelState.socketEE.emitter.removeAllListeners(); + channelState.readQueue.clear(); + channelState.writeQueue.clear(); + + await unlink(channelState.infoFilePath); + + Object.values(channelState.otherReaderClients) + .forEach(client => client.destroy()); +} + + +export function canBeUsed() { + return isNode; +}; diff --git a/src/options.js b/src/options.js new file mode 100644 index 00000000..90db0009 --- /dev/null +++ b/src/options.js @@ -0,0 +1,24 @@ +export function fillOptionsWithDefaults(options) { + if(!options) options = {}; + options = JSON.parse(JSON.stringify(options)); + + // main + if (typeof options.webWorkerSupport === 'undefined') options.webWorkerSupport = true; + + + // indexed-db + if (!options.idb) options.idb = {}; + // after this time the messages get deleted + if (!options.idb.ttl) options.idb.ttl = 1000 * 45; + if (!options.idb.fallbackInterval) options.idb.fallbackInterval = 50; + + // localstorage + if (!options.localstorage) options.localstorage = {}; + if (!options.localstorage.removeTimeout) options.localstorage.removeTimeout = 1000 * 60; + + // node + if (!options.node) options.node = {}; + if (!options.node.ttl) options.node.ttl = 1000 * 60 * 2; // 2 minutes; + + return options; +} \ No newline at end of file diff --git a/src/util.js b/src/util.js new file mode 100644 index 00000000..0f92f55a --- /dev/null +++ b/src/util.js @@ -0,0 +1,33 @@ +/** + * returns true if the given object is a promise + */ +export function isPromise(obj) { + if (obj && + typeof obj.then === 'function') { + return true; + } else { + return false; + } +} + +export function sleep(time) { + if (!time) time = 0; + return new Promise(res => setTimeout(res, time)); +} + +export function randomInt(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} + +/** + * https://stackoverflow.com/a/1349426/3443137 + */ +export function randomToken(length) { + let text = ''; + const possible = 'abcdefghijklmnopqrstuvwxzy0123456789'; + + for (let i = 0; i < 5; i++) + text += possible.charAt(Math.floor(Math.random() * possible.length)); + + return text; +} \ No newline at end of file diff --git a/test/e2e.test.js b/test/e2e.test.js new file mode 100644 index 00000000..5dfcac6d --- /dev/null +++ b/test/e2e.test.js @@ -0,0 +1,33 @@ +import { + Selector +} from 'testcafe'; +import AsyncTestUtil from 'async-test-util'; + +const BASE_PAGE = 'http://127.0.0.1:8080/'; + +fixture `Example page` + .page `http://127.0.0.1:8080/`; + + +[ + 'idb', + 'native', + 'localstorage', + 'default' +].forEach(methodType => { + test.page(BASE_PAGE + '?methodType=' + methodType)('test with method: ' + methodType, async () => { + console.log('##### START TEST WITH ' + methodType); + const stateContainer = Selector('#state'); + + await AsyncTestUtil.waitUntil(async () => { + const value = await stateContainer.innerText; + // console.log(value); + + // const out = await t.getBrowserConsoleMessages(); + // console.log('out:'); + // console.log(JSON.stringify(out)); + + return value === 'SUCCESS'; + }); + }); +}); diff --git a/test/index.test.js b/test/index.test.js new file mode 100644 index 00000000..24f4d749 --- /dev/null +++ b/test/index.test.js @@ -0,0 +1,12 @@ +const isNode = require('detect-node'); + +if (!isNode) { + // if browsers + console.dir = obj => console.log(JSON.stringify(obj, null, 2)); +} + +require('./unit.test'); +require('./integration.test'); +require('./issues.test'); + +require('./performance.test'); diff --git a/test/integration.test.js b/test/integration.test.js new file mode 100644 index 00000000..9ee5a697 --- /dev/null +++ b/test/integration.test.js @@ -0,0 +1,371 @@ +const AsyncTestUtil = require('async-test-util'); +const assert = require('assert'); +const isNode = require('detect-node'); +const clone = require('clone'); +const BroadcastChannel = require('../'); + +/** + * we run this test once per method + */ +function runTest(channelType) { + const channelOptions = { + type: channelType + }; + + describe('integration.test.js', () => { + describe('.constructor()', () => { + it('asdf', () => { + console.log('Started: ' + channelType); + }); + it('should create a channel', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + channel.close(); + }); + }); + describe('.postMessage()', () => { + it('should post a message', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + await channel.postMessage('foobar'); + channel.close(); + }); + it('should throw if channel is already closed', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + channel.close(); + await AsyncTestUtil.assertThrows( + () => channel.postMessage('foobar'), + Error, + 'closed' + ); + }); + }); + describe('.onmessage', () => { + /** + * the window.BroadcastChannel + * does not emit postMessage to own subscribers, + * if you want to do that, you have to create another channel + */ + it('should NOT recieve the message on own', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + + const emitted = []; + channel.onmessage = msg => emitted.push(msg); + await channel.postMessage({ + foo: 'bar' + }); + + await AsyncTestUtil.wait(100); + assert.equal(emitted.length, 0); + + channel.close(); + }); + it('should recieve the message on other channel', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + const otherChannel = new BroadcastChannel(channelName, channelOptions); + + const emitted = []; + otherChannel.onmessage = msg => emitted.push(msg); + await channel.postMessage({ + foo: 'bar' + }); + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.equal(emitted[0].foo, 'bar'); + channel.close(); + otherChannel.close(); + }); + it('should work with strange channelName', async () => { + const channelName = ' asdf / ' + AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + const otherChannel = new BroadcastChannel(channelName, channelOptions); + + const emitted = []; + otherChannel.onmessage = msg => emitted.push(msg); + await channel.postMessage({ + foo: 'bar' + }); + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.equal(emitted[0].foo, 'bar'); + channel.close(); + otherChannel.close(); + }); + it('should have the same message-data', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel1 = new BroadcastChannel(channelName, channelOptions); + const channel2 = new BroadcastChannel(channelName, channelOptions); + + const emitted = []; + channel2.onmessage = msg => emitted.push(msg); + + const msgJson = { + foo: 'bar' + }; + await channel1.postMessage(msgJson); + + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.deepEqual(emitted[0], msgJson); + + channel1.close(); + channel2.close(); + }); + it('should work with big message-data', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel1 = new BroadcastChannel(channelName, channelOptions); + const channel2 = new BroadcastChannel(channelName, channelOptions); + + const emitted = []; + channel2.onmessage = msg => emitted.push(msg); + + const msgJson = { + one: AsyncTestUtil.randomString(1000), + two: AsyncTestUtil.randomString(1000), + three: AsyncTestUtil.randomString(1000), + }; + await channel1.postMessage(msgJson); + + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.deepEqual(emitted[0], msgJson); + + channel1.close(); + channel2.close(); + }); + it('should not loose the message if _prepare() takes a while', async () => { + const channelName = AsyncTestUtil.randomString(12); + const slowerOptions = clone(channelOptions); + slowerOptions.prepareDelay = 300; + const channel1 = new BroadcastChannel(channelName, channelOptions); + const channel2 = new BroadcastChannel(channelName, slowerOptions); + + const emitted = []; + channel2.onmessage = msg => emitted.push(msg); + + const msgJson = { + foo: 'bar' + }; + await channel1.postMessage(msgJson); + + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.deepEqual(emitted[0], msgJson); + + channel1.close(); + channel2.close(); + }); + it('should emit all events if subscribed directly after postMessage', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel1 = new BroadcastChannel(channelName, channelOptions); + const channel2 = new BroadcastChannel(channelName, channelOptions); + + channel1.postMessage('foo1'); + channel1.postMessage('foo2'); + + const emitted = []; + channel2.onmessage = msg => emitted.push(msg); + + channel1.postMessage('foo3'); + + await AsyncTestUtil.waitUntil(() => emitted.length === 3); + assert.equal(emitted.length, 3); + + channel1.close(); + channel2.close(); + }); + it('should not emit messages, send before onmessage was set, when one tick was done', async () => { + const channelName = AsyncTestUtil.randomString(12); + + const channel1 = new BroadcastChannel(channelName, channelOptions); + const channel2 = new BroadcastChannel(channelName, channelOptions); + + channel1.postMessage('foo1'); + channel1.postMessage('foo2'); + + + await AsyncTestUtil.wait(50); + + const emitted = []; + channel2.onmessage = msg => emitted.push(msg); + + const msgJson = { + foo: 'bar' + }; + channel1.postMessage(msgJson); + + await AsyncTestUtil.waitUntil(() => emitted.length >= 1); + assert.equal(emitted.length, 1); + assert.deepEqual(emitted[0], msgJson); + + channel1.close(); + channel2.close(); + }); + it('should not confuse messages between different channels', async () => { + const channel = new BroadcastChannel(AsyncTestUtil.randomString(12), channelOptions); + const otherChannel = new BroadcastChannel(AsyncTestUtil.randomString(12), channelOptions); + + const emitted = []; + otherChannel.onmessage = msg => emitted.push(msg); + await channel.postMessage({ + foo: 'bar' + }); + await AsyncTestUtil.wait(100); + assert.equal(emitted.length, 0); + + channel.close(); + otherChannel.close(); + }); + it('should not read messages created before the channel was created', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + + const msgJson = { + foo: 'bar' + }; + + await channel.postMessage(msgJson); + await AsyncTestUtil.wait(50); + + const otherChannel = new BroadcastChannel(channelName, channelOptions); + const emittedOther = []; + otherChannel.onmessage = msg => emittedOther.push(msg); + + await channel.postMessage(msgJson); + await channel.postMessage(msgJson); + + await AsyncTestUtil.waitUntil(() => emittedOther.length >= 2); + await AsyncTestUtil.wait(100); + + assert.equal(emittedOther.length, 2); + + channel.close(); + otherChannel.close(); + }); + it('should only run the last onmessage-callback', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + const channel2 = new BroadcastChannel(channelName, channelOptions); + + const emitted1 = []; + const emitted2 = []; + + channel2.onmessage = msg => { + emitted1.push(msg); + }; + channel2.onmessage = msg => { + emitted2.push(msg); + }; + + await channel.postMessage('foobar'); + + await AsyncTestUtil.waitUntil(() => emitted2.length >= 1); + await AsyncTestUtil.wait(100); + + assert.equal(emitted1.length, 0); + assert.equal(emitted2.length, 1); + + channel.close(); + channel2.close(); + }); + }); + describe('.addEventListener()', () => { + it('should emit events to all subscribers', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + const otherChannel = new BroadcastChannel(channelName, channelOptions); + + const emitted1 = []; + const emitted2 = []; + + otherChannel.addEventListener('message', msg => emitted1.push(msg)); + otherChannel.addEventListener('message', msg => emitted2.push(msg)); + + const msg = { + foo: 'bar' + }; + await channel.postMessage(msg); + + await AsyncTestUtil.waitUntil(() => emitted1.length === 1); + await AsyncTestUtil.waitUntil(() => emitted2.length === 1); + + assert.deepEqual(msg, emitted1[0]); + assert.deepEqual(msg, emitted2[0]); + + channel.close(); + otherChannel.close(); + }); + }); + describe('.removeEventListener()', () => { + it('should no longer emit the message', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channel = new BroadcastChannel(channelName, channelOptions); + const otherChannel = new BroadcastChannel(channelName, channelOptions); + + const emitted = []; + const fn = msg => emitted.push(msg); + otherChannel.addEventListener('message', fn); + + const msg = { + foo: 'bar' + }; + await channel.postMessage(msg); + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + + otherChannel.removeEventListener('message', fn); + + await channel.postMessage(msg); + await AsyncTestUtil.wait(100); + + assert.equal(emitted.length, 1); + + channel.close(); + otherChannel.close(); + }); + }); + describe('.type', () => { + it('should get a type', async () => { + const channel = new BroadcastChannel(AsyncTestUtil.randomString(12), channelOptions); + const type = channel.type; + assert.equal(typeof type, 'string'); + assert.notEqual(type, ''); + + channel.close(); + }); + }); + describe('other', () => { + it('should prefer localstorage if webWorkerSupport: false', async () => { + if (isNode) return; + // disable BroadcastChannel + const broadcastChannelBefore = window.BroadcastChannel; + Object.defineProperty(window, 'BroadcastChannel', { + enumerable: false, + configurable: false, + writable: true, + value: false + }); + + const options = { + webWorkerSupport: false + }; + const channel = new BroadcastChannel(AsyncTestUtil.randomString(12), options); + assert.equal(channel.type, 'localstorage'); + + window.BroadcastChannel = broadcastChannelBefore; + }); + it('', () => { + console.log('Finiished: ' + channelType); + }); + }); + }); +}; + +if (isNode) { + runTest('node'); +} else { + runTest('native'); + runTest('idb'); + runTest('localstorage'); +} diff --git a/test/issues.test.js b/test/issues.test.js new file mode 100644 index 00000000..4708bfb8 --- /dev/null +++ b/test/issues.test.js @@ -0,0 +1,4 @@ +// const BroadcastChannel = require('../dist/lib/index'); + +describe('issues.test.js', () => { +}); diff --git a/test/performance.test.js b/test/performance.test.js new file mode 100644 index 00000000..967dd13f --- /dev/null +++ b/test/performance.test.js @@ -0,0 +1,2 @@ +describe('performance.test.js', () => { +}); diff --git a/test/scripts/iframe.js b/test/scripts/iframe.js new file mode 100644 index 00000000..1fa502bf --- /dev/null +++ b/test/scripts/iframe.js @@ -0,0 +1,37 @@ +/* eslint-disable */ +/** + * used in docs/iframe.html + */ +require('babel-polyfill'); +import { + getParameterByName +} from './util.js'; + +var BroadcastChannel = require('../../'); + +const channelName = getParameterByName('channelName'); +const methodType = getParameterByName('methodType'); + +// overwrite console.log +const logBefore = console.log; +console.log = function (str) { logBefore('iframe: ' + str); } + +var channel = new BroadcastChannel(channelName, { + type: methodType +}); +var msgContainer = document.getElementById('messages'); +channel.onmessage = function (msg) { + console.log('recieved message(' + msg.step + ') from ' + msg.from + ': ' + JSON.stringify(msg)); + + var textnode = document.createTextNode(JSON.stringify(msg) + '
'); + msgContainer.appendChild(textnode); + + if (!msg.answer) { + console.log('answer back(' + msg.step + ')'); + channel.postMessage({ + answer: true, + from: 'iframe', + original: msg + }); + } +}; \ No newline at end of file diff --git a/test/scripts/index.js b/test/scripts/index.js new file mode 100644 index 00000000..537f7d44 --- /dev/null +++ b/test/scripts/index.js @@ -0,0 +1,132 @@ +/* eslint-disable */ +/** + * used in docs/index.html + */ +require('babel-polyfill'); +var BroadcastChannel = require('../../'); +import { + getParameterByName +} from './util.js'; + +var methodType = getParameterByName('methodType'); +if (!methodType || methodType === '' || methodType === 'default') methodType = undefined; + +// set select-input +var selectEl = document.getElementById('method-type-select'); +selectEl.onchange = function (ev) { + var newValue = selectEl.value; + var newUrl = location.origin + location.pathname + '?methodType=' + newValue; + location = newUrl; +}; +if (methodType) { + selectEl.value = methodType; +} + +var TEST_MESSAGES = 50; +var body = document.getElementById('body'); +var msgContainer = document.getElementById('messages'); +var rightContainer = document.getElementById('right'); +var messageCountContainer = document.getElementById('msg-count'); +var stateContainer = document.getElementById('state'); +const iframeEl = document.getElementById('test-iframe'); + +document.getElementById('user-agent').innerHTML = navigator.userAgent; + +var startTime; +const options = {}; +console.log('++++++'); +console.log(typeof BroadcastChannel); +var channel = new BroadcastChannel('foobar', { + type: methodType +}); +document.getElementById('method').innerHTML = channel.type; + +/** + * to measure the speed, we: + * 1. send message + * 2. wait until iframe and worker answers + * 3. repeat from 1. for TEST_MESSAGES times + */ +var messagesSend = 0; +var answerPool = {}; +let useWorker = false; + +function gotAllAnswers(answerPool) { + if (!answerPool.iframe) return false; + if (useWorker && !answerPool.worker) return false; + return true; +} + +channel.onmessage = function (msg) { + console.log('main: recieved msg' + JSON.stringify(msg)); + + answerPool[msg.from] = msg; + var textnode = document.createTextNode(JSON.stringify(msg) + '
'); + msgContainer.appendChild(textnode); + + if (gotAllAnswers(answerPool)) { + answerPool = {}; // reset + + if (messagesSend >= TEST_MESSAGES) { + // sucess + console.log('main: sucess'); + body.style.backgroundColor = 'green'; + stateContainer.innerHTML = 'SUCCESS' + const amountTime = new Date().getTime() - startTime; + document.getElementById('time-amount').innerHTML = amountTime + 'ms'; + } else { + // send next message + messagesSend++; + console.log('main: send next message (' + messagesSend + ') ===================='); + messageCountContainer.innerHTML = messagesSend; + channel.postMessage({ + from: 'main', + foo: 'bar', + step: messagesSend + }); + } + } +}; + +const run = async function () { + const rand = new Date().getTime(); + console.log('aaaa'); + + + + // load iframe + iframeEl.src = './iframe.html?channelName=' + channel.name + '&methodType=' + channel.type + '&t=' + rand; + await new Promise(res => iframeEl.onload = () => res()); + console.log('main: Iframe has loaded'); + + // spawn web-worker if possible + if (channel.type !== 'localstorage' && typeof window.Worker === 'function') { + useWorker = true; + const worker = new Worker('worker.js?t=' + rand); + worker.onerror = event => { + throw new Error('worker: ' + event.message + " (" + event.filename + ":" + event.lineno + ")"); + }; + await new Promise(res => { + worker.addEventListener('message', e => { + // run when message returned, so we know the worker has started + console.log('main: Worker has started'); + res(); + }, false); + worker.postMessage({ + 'cmd': 'start', + 'msg': { + channelName: channel.name, + methodType: channel.type + } + }); + }); + } + console.log('========== START SENDING MESSAGES ' + channel.type); + startTime = new Date().getTime(); + channel.postMessage({ + from: 'main', + step: 0 + }); + console.log('main: message send (0)'); +} +run(); \ No newline at end of file diff --git a/test/scripts/util.js b/test/scripts/util.js new file mode 100644 index 00000000..560d69b1 --- /dev/null +++ b/test/scripts/util.js @@ -0,0 +1,10 @@ +// https://stackoverflow.com/a/901144/3443137 +export function getParameterByName(name, url) { + if (!url) url = window.location.href; + name = name.replace(/[\[\]]/g, '\\$&'); + const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'); + const results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, ' ')); +} diff --git a/test/scripts/windows.sh b/test/scripts/windows.sh new file mode 100644 index 00000000..2c0833e9 --- /dev/null +++ b/test/scripts/windows.sh @@ -0,0 +1,11 @@ +# because windows sucks, we have to install some things localy in the test-vms +npm i -g rimraf +npm i -g cross-env +npm i -g concurrently +npm i -g babel-cli +npm i -g browserify +npm i -g testcafe +npm i -g karma +npm i -g http-server +npm i -g copyfiles +npm i -g mocha diff --git a/test/scripts/worker.js b/test/scripts/worker.js new file mode 100644 index 00000000..b9ad2472 --- /dev/null +++ b/test/scripts/worker.js @@ -0,0 +1,58 @@ +/* eslint-disable */ +/** + * used in the test-docs as web-worker + */ +require('babel-polyfill'); +var BroadcastChannel = require('../../'); + +// overwrite console.log +try{ + var logBefore = console.log; +// console.log = function (str) { logBefore('worker: ' + str); } +}catch(err){ + // does not work in IE11 +} + + +/** + * because shitware microsof-edge stucks the worker + * when initialisation is done, + * we have to set a interval here. + */ +setInterval(function () { }, 10 * 1000); + +var channel; +self.addEventListener('message', function (e) { + var data = e.data; + switch (data.cmd) { + case 'start': + console.log('Worker started'); + console.log(JSON.stringify(data.msg)); + + channel = new BroadcastChannel(data.msg.channelName, { + type: data.msg.methodType + }); + var messages = []; + channel.onmessage = function (msg) { + console.log('recieved message(' + msg.step + ') from ' + msg.from + ': ' + JSON.stringify(msg)); + if (!msg.answer) { + console.log('(' + msg.step + ') answer back'); + channel.postMessage({ + answer: true, + from: 'worker', + original: msg + }); + } + }; + + self.postMessage('WORKER STARTED: '); + break; + case 'stop': + self.postMessage('WORKER STOPPED: ' + data.msg + '. (buttons will no longer work)'); + channel.close(); + self.close(); // Terminates the worker. + break; + default: + self.postMessage('Unknown command: ' + data.msg); + }; +}, false); diff --git a/test/typings.test.js b/test/typings.test.js new file mode 100644 index 00000000..a75c9400 --- /dev/null +++ b/test/typings.test.js @@ -0,0 +1,122 @@ +/** + * checks if the typings are correct + * run via 'npm run test:typings' + */ +const assert = require('assert'); +const path = require('path'); +const AsyncTestUtil = require('async-test-util'); + +describe('typings.test.ts', () => { + const mainPath = path.join(__dirname, '../'); + const codeBase = ` + import BroadcastChannel from '${mainPath}'; + declare type Message = { + foo: string; + }; + `; + const transpileCode = async (code) => { + const spawn = require('child-process-promise').spawn; + const stdout = []; + const stderr = []; + const promise = spawn('ts-node', [ + '--no-cache', + '--compilerOptions', '{"target":"es6", "strict": true, "strictNullChecks": true}', + '--type-check', + '-p', codeBase + '\n' + code + ]); + const childProcess = promise.childProcess; + childProcess.stdout.on('data', data => stdout.push(data.toString())); + childProcess.stderr.on('data', data => stderr.push(data.toString())); + try { + await promise; + } catch (err) { + throw new Error(`could not run + # Error: ${err} + # Output: ${stdout} + # ErrOut: ${stderr} + `); + } + }; + describe('basic', () => { + it('should sucess on basic test', async () => { + await transpileCode('console.log("Hello, world!")'); + }); + it('should fail on broken code', async () => { + const brokenCode = ` + let x: string = 'foo'; + x = 1337; + `; + let thrown = false; + try { + await transpileCode(brokenCode); + } catch (err) { + thrown = true; + } + assert.ok(thrown); + }); + }); + describe('non-typed channel', () => { + it('should be ok to create post and recieve', async () => { + const code = ` + (async()=>{ + const channel = new BroadcastChannel('foobar'); + + const emitted: any[] = []; + channel.onmessage = msg => emitted.push(msg); + await channel.postMessage({foo: 'bar'}); + })(); + `; + await transpileCode(code); + }); + it('should not allow to set wrong onmessage', async () => { + const code = ` + (async()=>{ + const channel = new BroadcastChannel('foobar'); + + const emitted: any[] = []; + channel.onmessage = {}; + await channel.postMessage({foo: 'bar'}); + })(); + `; + await AsyncTestUtil.assertThrows( + () => transpileCode(code) + ); + }); + }); + describe('typed channel', () => { + it('should be ok to create and post', async () => { + const code = ` + (async()=>{ + const channel = new BroadcastChannel('foobar'); + await channel.postMessage({foo: 'bar'}); + })(); + `; + await transpileCode(code); + }); + it('should be ok to recieve', async () => { + const code = ` + (async()=>{ + const channel: BroadcastChannel = new BroadcastChannel('foobar'); + const emitted: Message[] = []; + channel.onmessage = msg => { + const f: string = msg.foo; + emitted.push(msg); + }; + })(); + `; + await transpileCode(code); + }); + it('should not allow to post wrong message', async () => { + const code = ` + (async()=>{ + const channel = new BroadcastChannel('foobar'); + await channel.postMessage({x: 42}); + })(); + `; + await AsyncTestUtil.assertThrows( + () => transpileCode(code) + ); + }); + + }); +}); \ No newline at end of file diff --git a/test/unit.test.js b/test/unit.test.js new file mode 100644 index 00000000..d53cbc00 --- /dev/null +++ b/test/unit.test.js @@ -0,0 +1,4 @@ +require('./unit/node.method.test.js'); +require('./unit/native.method.test.js'); +require('./unit/indexed-db.method.test.js'); +require('./unit/localstorage.method.test.js'); \ No newline at end of file diff --git a/test/unit/indexed-db.method.test.js b/test/unit/indexed-db.method.test.js new file mode 100644 index 00000000..7921d831 --- /dev/null +++ b/test/unit/indexed-db.method.test.js @@ -0,0 +1,272 @@ +const AsyncTestUtil = require('async-test-util'); +const assert = require('assert'); +const isNode = require('detect-node'); +const IndexedDbMethod = require('../../dist/lib/methods/indexed-db.js'); + +describe('unit/indexed-db.method.test.js', () => { + if (isNode) return; + + describe('.getIdb()', () => { + it('should get an object', () => { + const idb = IndexedDbMethod.getIdb(); + assert.ok(idb); + }); + }); + describe('.createDatabase()', () => { + it('should create a database', async () => { + const channelName = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + assert.ok(db); + }); + it('should be able to call twice', async () => { + const channelName = AsyncTestUtil.randomString(10); + const db1 = await IndexedDbMethod.createDatabase(channelName); + const db2 = await IndexedDbMethod.createDatabase(channelName); + assert.ok(db1); + assert.ok(db2); + }); + }); + describe('.writeMessage()', () => { + it('should write the message to the db', async () => { + const channelName = AsyncTestUtil.randomString(10); + const readerUuid = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + await IndexedDbMethod.writeMessage(db, readerUuid, { + foo: 'bar' + }); + }); + }); + describe('.getAllMessages()', () => { + it('should get the message', async () => { + const channelName = AsyncTestUtil.randomString(10); + const readerUuid = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + await IndexedDbMethod.writeMessage(db, readerUuid, { + foo: 'bar' + }); + + const messages = await IndexedDbMethod.getAllMessages(db); + assert.equal(messages.length, 1); + assert.equal(messages[0].data.foo, 'bar'); + }); + it('should get the messages', async () => { + const channelName = AsyncTestUtil.randomString(10); + const readerUuid = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + await IndexedDbMethod.writeMessage(db, readerUuid, { + foo: 'bar' + }); + await IndexedDbMethod.writeMessage(db, readerUuid, { + foo: 'bar2' + }); + + const messages = await IndexedDbMethod.getAllMessages(db); + assert.equal(messages.length, 2); + }); + }); + describe('.getOldMessages()', () => { + it('should only get too old messages', async () => { + const channelName = AsyncTestUtil.randomString(10); + const readerUuid = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + const msgJson = { + foo: 'old' + }; + + // write 10 messages + await Promise.all( + new Array(10).fill() + .map(() => IndexedDbMethod.writeMessage(db, readerUuid, msgJson)) + ); + await AsyncTestUtil.wait(500); + + // write 2 new messages + await Promise.all( + new Array(10).fill() + .map(() => IndexedDbMethod.writeMessage(db, readerUuid, msgJson)) + ); + + const tooOld = await IndexedDbMethod.getOldMessages(db, 200); + assert.equal(tooOld.length, 10); + tooOld.forEach(msg => { + assert.equal(msg.data.foo, 'old'); + }); + }); + }); + describe('.cleanOldMessages()', () => { + it('should clean up old messages', async () => { + const channelName = AsyncTestUtil.randomString(10); + const readerUuid = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + const msgJson = { + foo: 'bar' + }; + await IndexedDbMethod.writeMessage(db, readerUuid, msgJson); + + await AsyncTestUtil.wait(500); + + await IndexedDbMethod.cleanOldMessages(db, 200); + + IndexedDbMethod.getAllMessages(db); // call parallel + const messagesAfter = await IndexedDbMethod.getAllMessages(db); + assert.equal(messagesAfter.length, 0); + }); + }); + describe('.getMessagesHigherThen()', () => { + it('should only get messages with higher id', async () => { + const channelName = AsyncTestUtil.randomString(10); + const readerUuid = AsyncTestUtil.randomString(10); + const db = await IndexedDbMethod.createDatabase(channelName); + const msgJson = { + foo: 'bar' + }; + + // write 10 messages + await Promise.all( + new Array(10).fill() + .map(() => IndexedDbMethod.writeMessage(db, readerUuid, msgJson)) + ); + + // get last 5 messages + const lastFive = await IndexedDbMethod.getMessagesHigherThen(db, 5); + assert.equal(lastFive.length, 5); + assert.equal(lastFive[0].id, 6); + assert.equal(lastFive[4].id, 10); + }); + }); + describe('core-functions', () => { + describe('.create()', () => { + it('should create a channelState', async () => { + const channelName = AsyncTestUtil.randomString(10); + const channelState = await IndexedDbMethod.create(channelName); + assert.ok(channelState); + IndexedDbMethod.close(channelState); + }); + it('should be called twice', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelState1 = await IndexedDbMethod.create(channelName); + const channelState2 = await IndexedDbMethod.create(channelName); + assert.ok(channelState1); + assert.ok(channelState2); + + await IndexedDbMethod.close(channelState1); + await IndexedDbMethod.close(channelState2); + }); + }); + describe('.postMessage()', () => { + it('should not crash', async () => { + const channelName = AsyncTestUtil.randomString(10); + const channelState = await IndexedDbMethod.create(channelName); + assert.ok(channelState); + await IndexedDbMethod.postMessage(channelState, { + foo: 'bar' + }); + IndexedDbMethod.close(channelState); + }); + }); + describe('.canBeUsed()', () => { + it('should be true on browsers', async () => { + const ok = IndexedDbMethod.canBeUsed(); + assert.ok(ok); + }); + }); + describe('.onMessage()', () => { + it('should emit the message on other', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelStateOther = await IndexedDbMethod.create(channelName); + const channelStateOwn = await IndexedDbMethod.create(channelName); + + const emittedOther = []; + const msgJson = { + foo: 'bar' + }; + + IndexedDbMethod.onMessage(channelStateOther, msg => emittedOther.push(msg), new Date().getTime()); + await IndexedDbMethod.postMessage(channelStateOwn, msgJson); + + await AsyncTestUtil.waitUntil(() => emittedOther.length === 1); + assert.deepEqual(emittedOther[0], msgJson); + + await IndexedDbMethod.close(channelStateOther); + await IndexedDbMethod.close(channelStateOwn); + }); + /** + * localstorage-pings do not work in a web-workers, + * which means this should be detected and work over intervall + * @link https://stackoverflow.com/a/6179599/3443137 + */ + it('should also work if localstorage does not work', async () => { + const channelName = AsyncTestUtil.randomString(12); + + // disable localStorage + const localStorageBefore = window.localStorage; + assert.ok(localStorageBefore); + Object.defineProperty(window, 'localStorage', { + enumerable: false, + configurable: false, + writable: true, + value: false + }); + + + const emittedOther = []; + const channelStateOther = await IndexedDbMethod.create(channelName); + IndexedDbMethod.onMessage(channelStateOther, msg => emittedOther.push(msg), new Date().getTime()); + await AsyncTestUtil.wait(100); + + const channelStateOwn = await IndexedDbMethod.create(channelName); + const msgJson = { + foo: 'bar' + }; + await IndexedDbMethod.postMessage(channelStateOwn, msgJson); + + await AsyncTestUtil.waitUntil(() => emittedOther.length === 1); + assert.deepEqual(emittedOther[0], msgJson); + + await IndexedDbMethod.close(channelStateOther); + await IndexedDbMethod.close(channelStateOwn); + window.localStorage = localStorageBefore; + }); + }); + }); + describe('other', () => { + it('should have cleaned up the messages', async function() { + const channelOptions = { + idb: { + ttl: 500 + } + }; + const channelName = AsyncTestUtil.randomString(12); + const channelStateOther = await IndexedDbMethod.create(channelName, channelOptions); + const channelStateOwn = await IndexedDbMethod.create(channelName, channelOptions); + const msgJson = { + foo: 'bar' + }; + + // send 100 messages + await Promise.all( + new Array(100).fill(0) + .map(() => IndexedDbMethod.postMessage(channelStateOwn, msgJson)) + ); + + // w8 until ttl has reached + await AsyncTestUtil.wait(channelOptions.idb.ttl); + + // send 100 messages again to trigger cleanup + for (let x = 0; x < 100; x++) { + await IndexedDbMethod.postMessage(channelStateOwn, msgJson); + } + + await AsyncTestUtil.wait(channelOptions.idb.ttl); + + // ensure only the last 100 messages are here + await AsyncTestUtil.waitUntil(async () => { + const messages = await IndexedDbMethod.getAllMessages(channelStateOwn.db); + return messages.length <= 100; + }); + + await IndexedDbMethod.close(channelStateOther); + await IndexedDbMethod.close(channelStateOwn); + }); + }); +}); diff --git a/test/unit/localstorage.method.test.js b/test/unit/localstorage.method.test.js new file mode 100644 index 00000000..bf821e6e --- /dev/null +++ b/test/unit/localstorage.method.test.js @@ -0,0 +1,94 @@ +const AsyncTestUtil = require('async-test-util'); +const assert = require('assert'); +const isNode = require('detect-node'); +const LocalstorageMethod = require('../../dist/lib/methods/localstorage.js'); + +describe('unit/localstorage.method.test.js', () => { + if (isNode) return; + describe('.getLocalStorage()', () => { + it('should always get a object', () => { + const ls = LocalstorageMethod.getLocalStorage(); + assert.ok(ls); + assert.equal(typeof ls.setItem, 'function'); + }); + }); + describe('.postMessage()', () => { + it('should set the message', async () => { + const channelState = { + channelName: AsyncTestUtil.randomString(10), + uuid: AsyncTestUtil.randomString(10) + }; + const json = { foo: 'bar' }; + await LocalstorageMethod.postMessage( + channelState, + json + ); + const ls = LocalstorageMethod.getLocalStorage(); + const key = LocalstorageMethod.storageKey(channelState.channelName); + const value = JSON.parse(ls.getItem(key)); + console.dir(value); + assert.equal(value.data.foo, 'bar'); + }); + it('should fire an event', async () => { + const channelState = { + channelName: AsyncTestUtil.randomString(10), + uuid: AsyncTestUtil.randomString(10) + }; + const json = { foo: 'bar' }; + + const emitted = []; + const listener = LocalstorageMethod.addStorageEventListener( + channelState.channelName, + ev => { + emitted.push(ev); + } + ); + + LocalstorageMethod.postMessage( + channelState, + json + ); + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.equal(emitted[0].data.foo, 'bar'); + + LocalstorageMethod.removeStorageEventListener(listener); + }); + }); + describe('.create()', () => { + it('create an instance', async () => { + const channelName = AsyncTestUtil.randomString(10); + const state = LocalstorageMethod.create(channelName); + assert.ok(state.uuid); + LocalstorageMethod.close(state); + }); + }); + describe('.onMessage()', () => { + it('should emit to the other channel', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelState1 = await LocalstorageMethod.create(channelName); + const channelState2 = await LocalstorageMethod.create(channelName); + + const emitted = []; + LocalstorageMethod.onMessage( + channelState2, + msg => { + emitted.push(msg); + console.log('was emitted'); + }, + new Date().getTime() + ); + const json = { + foo: 'bar' + }; + LocalstorageMethod.postMessage(channelState1, json); + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + + assert.deepEqual(emitted[0], json); + + LocalstorageMethod.close(channelState1); + LocalstorageMethod.close(channelState2); + }); + }); +}); \ No newline at end of file diff --git a/test/unit/native.method.test.js b/test/unit/native.method.test.js new file mode 100644 index 00000000..be5f650c --- /dev/null +++ b/test/unit/native.method.test.js @@ -0,0 +1,10 @@ +// const AsyncTestUtil = require('async-test-util'); +// const assert = require('assert'); +const isNode = require('detect-node'); + +describe('unit/native.method.test.js', () => { + /** + * do not run in node-tests + */ + if (isNode) return; +}); diff --git a/test/unit/node.method.test.js b/test/unit/node.method.test.js new file mode 100644 index 00000000..15ec4e83 --- /dev/null +++ b/test/unit/node.method.test.js @@ -0,0 +1,445 @@ +const AsyncTestUtil = require('async-test-util'); +const assert = require('assert'); +const isNode = require('detect-node'); + +const util = require('../../dist/lib/util.js'); + +describe('unit/node.method.test.js', () => { + /** + * do not run in browser-tests + */ + if (!isNode) return; + const NodeMethod = require('../../dist/lib/methods/node.js'); + + it('init', () => { + process.setMaxListeners(0); + }); + describe('.getPaths()', () => { + it('should get the correct paths', () => { + const channelName = AsyncTestUtil.randomString(12); + const paths = NodeMethod.getPaths(channelName); + assert.ok(paths.messages); + assert.ok(!paths.messages.includes(channelName)); + }); + }); + describe('.ensureFoldersExist()', () => { + it('.ensureFoldersExist()', async () => { + const channelName = AsyncTestUtil.randomString(12); + await NodeMethod.ensureFoldersExist(channelName); + + const paths = NodeMethod.getPaths(channelName); + const exists = require('fs').existsSync(paths.messages); + assert.ok(exists); + }); + it('should not crash when called twice', async () => { + const channelName = AsyncTestUtil.randomString(12); + await NodeMethod.ensureFoldersExist(channelName); + await NodeMethod.ensureFoldersExist(channelName); + }); + }); + describe('.createSocketInfoFile()', () => { + it('should create the file', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(12); + const path = await NodeMethod.createSocketInfoFile(channelName, readerUuid); + + assert.ok(path.endsWith(readerUuid + '.json')); + + const exists = require('fs').existsSync(path); + assert.ok(exists); + }); + }); + describe('.createSocketEventEmitter()', () => { + it('should create the socket and subscribe', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + const socket = await NodeMethod.createSocketEventEmitter(channelName, readerUuid); + assert.ok(socket); + }); + it('should be able to connect to the socket and send data', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + const socket = await NodeMethod.createSocketEventEmitter(channelName, readerUuid); + + const emitted = []; + socket.emitter.on('data', msg => emitted.push(msg)); + + const net = require('net'); + + const client = new net.Socket(); + await new Promise(res => { + client.connect( + NodeMethod.cleanPipeName(socket.path), + () => { + res(); + } + ); + }); + + client.write('foobar'); + + await AsyncTestUtil.waitUntil(() => emitted.length, 1); + assert.equal(emitted[0], 'foobar'); + + client.destroy(); + socket.server.close(); + }); + }); + describe('.writeMessage()', () => { + it('should write the message', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + const messageJson = { + foo: 'bar' + }; + + const msgObj = await NodeMethod.writeMessage(channelName, readerUuid, messageJson); + + const exists = require('fs').existsSync(msgObj.path); + assert.ok(exists); + + const content = require(msgObj.path); + assert.equal(content.uuid, readerUuid); + assert.deepEqual(content.data, messageJson); + }); + }); + describe('.getReadersUuids()', () => { + it('should get all uuids', async () => { + const channelName = AsyncTestUtil.randomString(12); + await NodeMethod.ensureFoldersExist(channelName); + + const sockets = await Promise.all( + new Array(5).fill(0) + .map(() => AsyncTestUtil.randomString(6)) + .map(async (readerUuid) => { + await NodeMethod.createSocketInfoFile(channelName, readerUuid); + const s = await NodeMethod.createSocketEventEmitter(channelName, readerUuid); + return s; + }) + ); + + const uuids = await NodeMethod.getReadersUuids(channelName); + assert.equal(uuids.length, 5); + + sockets.map(socket => socket.server.close()); + }); + }); + describe('.openClientConnection()', () => { + it('should open a connection and send data', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + + const socket = await NodeMethod.createSocketEventEmitter(channelName, readerUuid); + const client = await NodeMethod.openClientConnection(channelName, readerUuid); + + const emitted = []; + socket.emitter.on('data', d => emitted.push(d)); + + client.write('foo bar'); + + await AsyncTestUtil.waitUntil(() => emitted.length === 1); + assert.equal(emitted[0], 'foo bar'); + + socket.server.close(); + client.destroy(); + }); + }); + describe('.getAllMessages()', () => { + it('should get all messages', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + + const messageJson = { + foo: 'bar' + }; + await NodeMethod.writeMessage(channelName, readerUuid, messageJson); + await NodeMethod.writeMessage(channelName, readerUuid, messageJson); + + const messages = await NodeMethod.getAllMessages(channelName); + assert.equal(messages.length, 2); + assert.ok(messages[0].path); + assert.ok(messages[0].time); + assert.ok(messages[0].senderUuid); + assert.ok(messages[0].token); + }); + }); + describe('.readMessage()', () => { + it('should get the content', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + + const messageJson = { + foo: 'bar' + }; + await NodeMethod.writeMessage(channelName, readerUuid, messageJson); + const messages = await NodeMethod.getAllMessages(channelName); + + const content = await NodeMethod.readMessage(messages[0]); + assert.deepEqual(content.data, messageJson); + }); + }); + describe('.cleanOldMessages()', () => { + it('should clean up the old messages', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readerUuid = AsyncTestUtil.randomString(6); + await NodeMethod.ensureFoldersExist(channelName); + const messageJson = { + foo: 'bar' + }; + + // write 5 messages + await Promise.all( + new Array(5).fill(0) + .map(() => NodeMethod.writeMessage(channelName, readerUuid, messageJson)) + ); + + // w8 until they time out + await AsyncTestUtil.wait(500); + + // write a new one + await NodeMethod.writeMessage(channelName, readerUuid, messageJson); + + const messages = await NodeMethod.getAllMessages(channelName); + await NodeMethod.cleanOldMessages(messages, 100); + + const messages2 = await NodeMethod.getAllMessages(channelName); + assert.equal(messages2.length, 1); + }); + }); + describe('core-functions', () => { + describe('.create()', () => { + it('should open a channel', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelState = await NodeMethod.create(channelName); + assert.ok(channelState); + await NodeMethod.close(channelState); + }); + it('should have connected to other readers', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelState1 = await NodeMethod.create(channelName); + const channelState2 = await NodeMethod.create(channelName); + assert.ok(channelState1); + assert.ok(channelState2); + + await NodeMethod.close(channelState1); + await NodeMethod.close(channelState2); + }); + }); + describe('.close()', () => { + it('should have cleaned up all', async () => { + const readdir = require('util').promisify(require('fs').readdir); + + const channelName = AsyncTestUtil.randomString(12); + const channelState = await NodeMethod.create(channelName); + await NodeMethod.close(channelState); + await AsyncTestUtil.wait(200); + + const paths = NodeMethod.getPaths(channelName); + const files = await readdir(paths.readers); + assert.equal(files.length, 0); + }); + }); + describe('.postMessage()', () => { + it('should get a ping on other side', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelStateOther = await NodeMethod.create(channelName); + const channelStateOwn = await NodeMethod.create(channelName); + const emittedOther = []; + channelStateOther.socketEE.emitter.on('data', d => emittedOther.push(d)); + + await NodeMethod.postMessage(channelStateOwn, 'foo bar'); + await AsyncTestUtil.waitUntil(() => emittedOther.length === 1); + + assert.equal(JSON.parse(emittedOther[0]).a, 'msg'); + assert.equal(typeof JSON.parse(emittedOther[0]).d.t, 'number'); + + await NodeMethod.close(channelStateOther); + await NodeMethod.close(channelStateOwn); + }); + it('should send the message', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelStateOther = await NodeMethod.create(channelName); + const channelStateOwn = await NodeMethod.create(channelName); + await AsyncTestUtil.wait(100); + + const emittedOther = []; + NodeMethod.onMessage(channelStateOther, msg => emittedOther.push(msg), new Date().getTime()); + + const msgJson = { + foo: 'bar2' + }; + await NodeMethod.postMessage(channelStateOwn, msgJson); + + await AsyncTestUtil.waitUntil(() => emittedOther.length === 1); + + assert.deepEqual(emittedOther[0], msgJson); + + await NodeMethod.close(channelStateOther); + await NodeMethod.close(channelStateOwn); + }); + }); + describe('.onMessage()', () => { + it('should emit the message on other', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelStateOther = await NodeMethod.create(channelName); + const channelStateOwn = await NodeMethod.create(channelName); + + const emittedOther = []; + const emittedOwn = []; + const msgJson = { + foo: 'bar' + }; + + NodeMethod.onMessage(channelStateOther, msg => emittedOther.push(msg), new Date().getTime()); + NodeMethod.onMessage(channelStateOwn, msg => emittedOwn.push(msg), new Date().getTime()); + + await NodeMethod.postMessage(channelStateOwn, msgJson); + + await AsyncTestUtil.waitUntil(() => emittedOther.length === 1); + assert.deepEqual(emittedOther[0], msgJson); + assert.equal(emittedOwn.length, 0); + + await NodeMethod.close(channelStateOther); + await NodeMethod.close(channelStateOwn); + }); + it('should have sorted the messages by time', async () => { + const channelName = AsyncTestUtil.randomString(12); + const channelStateOwn = await NodeMethod.create(channelName); + const channelStateOther = await NodeMethod.create(channelName); + + const emitted = []; + NodeMethod.onMessage(channelStateOther, msg => emitted.push(msg), new Date().getTime()); + + NodeMethod.postMessage(channelStateOwn, { + foo: 0 + }); + NodeMethod.postMessage(channelStateOwn, { + foo: 1 + }); + + await AsyncTestUtil.waitUntil(() => emitted.length === 2); + + assert.equal(emitted[0].foo, 0); + assert.equal(emitted[1].foo, 1); + + await NodeMethod.close(channelStateOwn); + await NodeMethod.close(channelStateOther); + }); + }); + }); + describe('other', () => { + it('should have cleaned up the messages', async function () { + this.timeout(1000 * 20); // slow on windows + const channelOptions = { + node: { + ttl: 500 + } + }; + const channelName = AsyncTestUtil.randomString(12); + const channelStateOther = await NodeMethod.create(channelName, channelOptions); + const channelStateOwn = await NodeMethod.create(channelName, channelOptions); + const msgJson = { + foo: 'bar' + }; + + // send 100 messages + await Promise.all( + new Array(100).fill(0) + .map(() => NodeMethod.postMessage(channelStateOwn, msgJson)) + ); + + // w8 until ttl has reached + await AsyncTestUtil.wait(channelOptions.node.ttl); + + // send 100 messages again to trigger cleanup + await Promise.all( + new Array(100).fill(0) + .map(() => NodeMethod.postMessage(channelStateOwn, msgJson)) + ); + + // ensure only the last 100 messages are here + const messages = await NodeMethod.getAllMessages(channelName); + assert.ok(messages.length <= 100); + + + await NodeMethod.close(channelStateOther); + await NodeMethod.close(channelStateOwn); + }); + it('should not read messages created before the channel was created', async () => { + const channelOptions = { + node: { + ttl: 5000 + } + }; + const channelName = AsyncTestUtil.randomString(12); + const channelStateOwn = await NodeMethod.create(channelName, channelOptions); + const msgJson = { + foo: 'bar' + }; + + + await NodeMethod.postMessage(channelStateOwn, msgJson); + + const emittedOther = []; + const channelStateOther = await NodeMethod.create(channelName, channelOptions); + NodeMethod.onMessage(channelStateOther, msg => emittedOther.push(msg), new Date().getTime()); + + await NodeMethod.postMessage(channelStateOwn, msgJson); + await NodeMethod.postMessage(channelStateOwn, msgJson); + + await AsyncTestUtil.waitUntil(() => emittedOther.length >= 2); + await AsyncTestUtil.wait(100); + + assert.equal(emittedOther.length, 2); + + await NodeMethod.close(channelStateOther); + await NodeMethod.close(channelStateOwn); + }); + it('should work with many readers', async () => { + const channelName = AsyncTestUtil.randomString(12); + const readers = await Promise.all( + new Array(50).fill(0) + .map(async () => { + const channelState = await NodeMethod.create(channelName); + const emitted = []; + NodeMethod.onMessage(channelState, msg => emitted.push(msg), new Date().getTime()); + return { + channelState, + emitted + }; + }) + ); + + const senderState = await NodeMethod.create(channelName); + + // send 100 messages + await Promise.all( + new Array(100).fill(0) + .map(() => NodeMethod.postMessage(senderState, { + foo: 'bar' + })) + ); + + await AsyncTestUtil.waitUntil(() => { + let ok = true; + readers.forEach(reader => { + if (reader.emitted.length !== 100) + ok = false; + }); + + return ok; + }); + + await Promise.all( + readers.map(reader => NodeMethod.close(reader.channelState)) + ); + NodeMethod.close(senderState); + }); + }); +});