├── .eslintignore ├── .npmrc ├── src ├── index.js ├── index-full.js └── pasta.js ├── .travis.yml ├── examples ├── images.js ├── images │ └── 300x200.png ├── index.html ├── ex01 │ ├── app.js │ └── index.html ├── server.js └── webpack.config.js ├── .gitignore ├── .eslintrc.json ├── bin ├── test.js └── test-ci.js ├── .babelrc ├── zuul.config.js ├── webpack.test.config.js ├── LICENSE ├── webpack.config.js ├── README.md ├── package.json ├── dist ├── pasta.js └── pasta-full.min.js └── test └── pastaSpec.js /.eslintignore: -------------------------------------------------------------------------------- 1 | server.js 2 | webpack*.js 3 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | scope=polydice 2 | access=public 3 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export Pasta from './pasta'; 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" -------------------------------------------------------------------------------- /examples/images.js: -------------------------------------------------------------------------------- 1 | import './images/300x200.png'; 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | es 2 | lib 3 | umd 4 | node_modules 5 | npm-debug.log 6 | coverage 7 | yarn.lock 8 | .nyc_output 9 | -------------------------------------------------------------------------------- /examples/images/300x200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/polydice/pasta-js/master/examples/images/300x200.png -------------------------------------------------------------------------------- /src/index-full.js: -------------------------------------------------------------------------------- 1 | import 'es5-shim'; 2 | import 'es6-shim'; 3 | import 'whatwg-fetch'; 4 | 5 | export default from './pasta'; 6 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": "airbnb", 4 | "globals": { 5 | "document": true, 6 | "fetch": true, 7 | "location": true, 8 | "navigator": true, 9 | "window": true 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /bin/test.js: -------------------------------------------------------------------------------- 1 | #!/user/bin/env node 2 | 3 | var cp = require('child_process'); 4 | 5 | var script = process.env.CI ? 'test-ci' : 'test-local'; 6 | var node = cp.spawn('npm', ['run', script], { stdio: 'inherit' }); 7 | node.on('close', function(code) { 8 | process.exit(code); 9 | }); 10 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "stage-1", 5 | "stage-2", 6 | "react" 7 | ], 8 | "plugins": ["dev-expression"], 9 | "env": { 10 | "cjs": { 11 | "plugins": ["add-module-exports"] 12 | }, 13 | "test": { 14 | "plugins": ["istanbul"] 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /zuul.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ui: 'jasmine2', 3 | browsers: [ 4 | { 5 | name: 'chrome', 6 | version: 'latest', 7 | }, 8 | { 9 | name: 'firefox', 10 | version: 'latest', 11 | }, 12 | { 13 | name: 'safari', 14 | version: 'latest', 15 | } 16 | ], 17 | builder: 'zuul-builder-webpack', 18 | webpack: require('./webpack.test.config.js') 19 | }; 20 | -------------------------------------------------------------------------------- /webpack.test.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-var */ 2 | 3 | const path = require('path'); 4 | const webpack = require('webpack'); 5 | 6 | module.exports = { 7 | devtool: 'inline-source-map', 8 | module: { 9 | loaders: [ 10 | { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }, 11 | ], 12 | }, 13 | resolve: { 14 | alias: { 15 | 'pasta-js': path.join(__dirname, 'src'), 16 | }, 17 | }, 18 | } 19 | 20 | -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | pasta 5 | 6 | 7 | 8 | 9 |

pasta

10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bin/test-ci.js: -------------------------------------------------------------------------------- 1 | #!/user/bin/env node 2 | 3 | var chalk = require('chalk'); 4 | var Zuul = require('zuul'); 5 | var config = require('../zuul.config'); 6 | 7 | var zuul = Zuul(Object.assign({ 8 | concurrency: 1, 9 | files: [ 10 | __dirname + '/../test/pastaSpec.js', 11 | ], 12 | phantom: true, 13 | tunnel: 'ngrok', 14 | prj_dir: __dirname + '/../src', 15 | }, config)); 16 | 17 | zuul.on('browser', function(browser) { 18 | browser.on('done', function(results) { 19 | var log = [ 20 | chalk.green(`passed: ${results.passed}`), 21 | chalk.red(`failed: ${results.failed}`), 22 | ].join(' '); 23 | console.log(`\n${log}`); 24 | process.exit(); 25 | }); 26 | }); 27 | 28 | zuul.run(function() {}); 29 | -------------------------------------------------------------------------------- /examples/ex01/app.js: -------------------------------------------------------------------------------- 1 | import 'es5-shim'; 2 | import 'es6-shim'; 3 | import 'whatwg-fetch'; 4 | import '../images'; 5 | import { Pasta } from 'pasta-js'; 6 | 7 | document.querySelector('h1').innerHTML = 'EXAMPLE'; 8 | const tracking = new Pasta({ 9 | endpoint: 'http://localhost:8000/icook.homepage-event.web', 10 | username: 'username', 11 | customInfo: { 12 | viewport: false, 13 | }, 14 | }); 15 | 16 | let count = 0; 17 | const addnode = document.querySelector('#add'); 18 | addnode.addEventListener('click', () => { 19 | count++; 20 | tracking.push({ 21 | content: `測試${count}`, 22 | event: 'test', 23 | }); 24 | }); 25 | 26 | const btnnode = document.querySelector('#send'); 27 | btnnode.addEventListener('click', () => { 28 | tracking.send(); 29 | }); 30 | -------------------------------------------------------------------------------- /examples/ex01/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ex01 5 | 6 | 7 | 8 | 9 |
10 |

11 |
12 | back examples 13 | 14 | 15 |
16 |
17 | item 23 |
24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Polydice, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-var */ 2 | 3 | const path = require('path'); 4 | const webpack = require('webpack'); 5 | 6 | module.exports = { 7 | entry: process.env.NODE_ENV === 'production' ? { 8 | 'pasta-full': __dirname + '/src/index-full.js', 9 | } : { 10 | 'pasta': __dirname + '/src/index.js', 11 | 'pasta-full': __dirname + '/src/index-full.js', 12 | }, 13 | output: { 14 | filename: process.env.NODE_ENV === 'production' ? '[name].min.js' : '[name].js', 15 | library: 'Pasta', 16 | libraryTarget: 'umd', 17 | path: __dirname + '/dist', 18 | publicPath: '/dist/', 19 | }, 20 | target: 'web', 21 | plugins: process.env.NODE_ENV === 'production' ? [ 22 | new webpack.optimize.UglifyJsPlugin(), 23 | new webpack.DefinePlugin({ 24 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production') 25 | }), 26 | ]: [], 27 | module: { 28 | loaders: [ 29 | { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }, 30 | ], 31 | }, 32 | resolve: { 33 | alias: { 34 | 'pasta-js': path.join(__dirname, 'src'), 35 | }, 36 | }, 37 | } 38 | 39 | -------------------------------------------------------------------------------- /examples/server.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-console, no-var */ 2 | 3 | var fs = require('fs'); 4 | var path = require('path'); 5 | var express = require('express'); 6 | var rewrite = require('express-urlrewrite'); 7 | var bodyParser = require('body-parser'); 8 | var webpack = require('webpack'); 9 | var webpackDevMiddleware = require('webpack-dev-middleware'); 10 | var WebpackConfig = require('./webpack.config'); 11 | 12 | var app = express(); 13 | 14 | app.use(webpackDevMiddleware(webpack(WebpackConfig), { 15 | publicPath: '/__build__/', 16 | stats: { 17 | colors: true, 18 | }, 19 | })); 20 | 21 | fs.readdirSync(__dirname).forEach(function (file) { 22 | if (fs.statSync(path.join(__dirname, file)).isDirectory()) { 23 | app.use(rewrite('/' + file + '/*', '/' + file + '/index.html')); 24 | } 25 | }); 26 | 27 | app.use(express.static(__dirname)); 28 | app.use(bodyParser.text()); 29 | app.use(function(req, res, next) { 30 | if(req.method.toLowerCase() === 'post') { 31 | console.log(req.body); 32 | res.status(200).send({ ok: true }); 33 | } 34 | }); 35 | 36 | app.listen(8000, function () { 37 | console.log('Server listening on http://localhost:8000, Ctrl+C to stop'); 38 | }); 39 | -------------------------------------------------------------------------------- /examples/webpack.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-var */ 2 | 3 | var fs = require('fs'); 4 | var path = require('path'); 5 | var webpack = require('webpack'); 6 | 7 | module.exports = { 8 | 9 | devtool: 'inline-source-map', 10 | 11 | entry: fs.readdirSync(__dirname).reduce(function (entries, dir) { 12 | if (dir !== 'images' && fs.statSync(path.join(__dirname, dir)).isDirectory()) { 13 | entries[dir] = path.join(__dirname, dir, 'app.js'); 14 | } 15 | 16 | return entries; 17 | }, {}), 18 | 19 | output: { 20 | path: __dirname + '/__build__', 21 | filename: '[name].js', 22 | chunkFilename: '[id].chunk.js', 23 | publicPath: '/__build__/', 24 | }, 25 | 26 | module: { 27 | loaders: [ 28 | { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }, 29 | { test: /\.css$/, loaders: ['style-loader', 'css-loader'] }, 30 | { 31 | test: /\.(jpe?g|png|gif|svg)$/i, 32 | loaders: [ 33 | 'file-loader?name=[path][name].[ext]', 34 | { 35 | loader: 'image-webpack-loader', 36 | query: { 37 | progressive: true, 38 | // optimizationLevel: 7, 39 | // interlaced: false, 40 | pngquant: { 41 | quality: '65-90', 42 | speed: 4, 43 | }, 44 | }, 45 | }, 46 | ], 47 | }, 48 | ], 49 | }, 50 | 51 | resolve: { 52 | alias: { 53 | 'pasta-js': path.join(__dirname, '..', 'src'), 54 | }, 55 | }, 56 | 57 | // Expose __dirname to allow automatically setting basename. 58 | context: __dirname, 59 | node: { 60 | __dirname: true, 61 | }, 62 | 63 | plugins: [ 64 | new webpack.optimize.CommonsChunkPlugin('shared'), 65 | new webpack.DefinePlugin({ 66 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), 67 | }), 68 | ], 69 | }; 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## pasta-js 2 | 3 | [![Build Status](https://travis-ci.org/polydice/pasta-js.svg)](https://travis-ci.org/polydice/pasta-js) 4 | 5 | It makes easy to collect data to send. 6 | 7 | ### How to run examples? 8 | - `npm install` 9 | - `npm start` 10 | - Open `http://localhost:8000/ex01`, and show log in the terminal. 11 | 12 | ### Installation 13 | 14 | Using npm: 15 | 16 | ``` 17 | $ npm install --save @polydice/pasta-js 18 | ``` 19 | 20 | Then with a module bundler like webpack 21 | 22 | ``` 23 | // using ES6 modules 24 | import {Pasta} from 'pasta-js' 25 | 26 | // using CommonJS modules 27 | var Pasta = require('pasta-js').pasta; 28 | ``` 29 | 30 | Or UMD build in `dist/pasta-full.min.js` in the installed folder. 31 | 32 | ### Browser Support 33 | It should use some polyfills expect for modern browsers, such as Chrome, Firefox, Microsoft Edge and Safari. 34 | 35 | ### API 36 | 37 | #### Initialization - Pasta(config) 38 | - *config* : Object(required) 39 | 40 | core parameters 41 | 42 | - endpoint: String(required). 43 | - maxBuff: Number(option), default: `10`. It is the limit for the buffer to send. 44 | - username: Any(option), default: `null`. 45 | 46 | 47 | ``` 48 | var tracking = new Pasta({ 49 | endpoint: '', 50 | }); 51 | ``` 52 | 53 | #### push(data) 54 | 55 | - *data*: Object(required), any tracked data. 56 | 57 | After initialization, use push to candidated queue. It will send automatically if buffer is up to limit (default: 10). 58 | 59 | ``` 60 | tracking.push({ 61 | event: 'click-button', 62 | count: 4 63 | }); 64 | ``` 65 | 66 | #### send() 67 | 68 | Send data to host by manually. 69 | 70 | ``` 71 | tracking.send(); 72 | ``` 73 | 74 | #### Tracked information 75 | 76 | Every time a track is called, the following information is sent: 77 | 78 | - page_path 79 | - page_title 80 | - page_url 81 | - referrer 82 | - time 83 | - user_agent 84 | - username 85 | - viewport 86 | 87 | They can disable or overwrite at initialization. But `time` can not disable or overwrite. 88 | 89 | ``` 90 | var tracking = new Pasta({ 91 | endpoint: '', 92 | customInfo: { 93 | viewport: false, // disable to send 94 | page_title() { return 'test title'; } // overwrite the data 95 | } 96 | }); 97 | ``` 98 | 99 | It can set other information to send every time. 100 | 101 | ``` 102 | var tracking = new Pasta({ 103 | endpoint: '', 104 | customInfo: { 105 | customKey() { return 'custom value'; } 106 | } 107 | }); 108 | ``` 109 | 110 | ### License 111 | Check license [here](https://github.com/polydice/pasta-js/blob/master/LICENSE). 112 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@polydice/pasta-js", 3 | "version": "1.0.0", 4 | "license": "MIT", 5 | "description": "It makes easy to collect data to send.", 6 | "authors": { 7 | "name": "ichi", 8 | "email": "ichi1234567@gmail.com" 9 | }, 10 | "maintainers": [ 11 | "ichi " 12 | ], 13 | "homepage": "https://github.com/polydice/pasta-js", 14 | "bugs": { 15 | "url": "https://github.com/polydice/pasta-js/issues" 16 | }, 17 | "respository": { 18 | "type": "git", 19 | "url": "git+https://github.com/polydice/pasta-js.git" 20 | }, 21 | "readmeFilename": "README.md", 22 | "keywords": [ 23 | "fetch", 24 | "pasta", 25 | "collect data" 26 | ], 27 | "files": [ 28 | "dist" 29 | ], 30 | "main": "./dist/pasta.js", 31 | "dependencies": { 32 | "es5-shim": "^4.5.9", 33 | "es6-shim": "^0.35.3", 34 | "whatwg-fetch": "^2.0.3" 35 | }, 36 | "devDependencies": { 37 | "babel-cli": "^6.11.4", 38 | "babel-core": "^6.13.2", 39 | "babel-eslint": "^7.1.1", 40 | "babel-loader": "^6.3.2", 41 | "babel-plugin-add-module-exports": "^0.2.1", 42 | "babel-plugin-dev-expression": "^0.2.1", 43 | "babel-plugin-istanbul": "^4.1.1", 44 | "babel-polyfill": "^6.13.0", 45 | "babel-preset-es2015": "~6.22.0", 46 | "babel-preset-react": "^6.11.1", 47 | "babel-preset-stage-1": "^6.13.0", 48 | "babel-preset-stage-2": "~6.22.0", 49 | "babel-register": "^6.11.6", 50 | "bundle-loader": "^0.5.4", 51 | "cross-env": "^3.1.4", 52 | "css-loader": "^0.26.1", 53 | "eslint": "^3.15.0", 54 | "eslint-config-airbnb": "^14.1.0", 55 | "eslint-import-resolver-webpack": "^0.8.1", 56 | "eslint-plugin-import": "^2.2.0", 57 | "eslint-plugin-jsx-a11y": "^4.0.0", 58 | "eslint-plugin-react": "^6.10.0", 59 | "expect": "^1.20.2", 60 | "express": "^4.14.0", 61 | "express-urlrewrite": "^1.2.0", 62 | "file-loader": "^0.10.0", 63 | "html-loader": "^0.4.4", 64 | "image-webpack-loader": "~3.2.0", 65 | "nyc": "^10.2.0", 66 | "phantomjs-prebuilt": "^2.1.14", 67 | "style-loader": "^0.13.1", 68 | "url-loader": "^0.5.7", 69 | "webpack": "^2.4.1", 70 | "webpack-dev-middleware": "^1.6.1", 71 | "zuul": "^3.11.1", 72 | "zuul-builder-webpack": "^1.2.0", 73 | "zuul-ngrok": "^4.0.0" 74 | }, 75 | "scripts": { 76 | "build": "npm run build-dev && npm run build-prod", 77 | "build-dev": "NODE_ENV=dev ./node_modules/.bin/webpack", 78 | "build-prod": "NODE_ENV=production ./node_modules/.bin/webpack", 79 | "lint": "eslint src", 80 | "start": "node examples/server.js", 81 | "test": "NODE_ENV=test node ./bin/test.js", 82 | "test-ci": "node bin/test-ci.js", 83 | "test-local": "./node_modules/.bin/zuul --local 8080 -- test/*Spec.js" 84 | }, 85 | "nyc": { 86 | "cache": false, 87 | "include": [ 88 | "src/" 89 | ], 90 | "require": [ 91 | "babel-register", 92 | "babel-polyfill" 93 | ], 94 | "reporter": [ 95 | "lcov", 96 | "text", 97 | "text-summary" 98 | ] 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/pasta.js: -------------------------------------------------------------------------------- 1 | class Pasta { 2 | static config = { 3 | maxBuff: 10, 4 | endpoint: '', 5 | username: null, 6 | customInfo: {}, 7 | } 8 | 9 | static customInfo = {} 10 | 11 | static defaultCustomInfo = { 12 | page_path() { 13 | return location.pathname; 14 | }, 15 | page_title() { 16 | return document.title; 17 | }, 18 | page_url() { 19 | return location.href; 20 | }, 21 | referrer() { 22 | return document.referrer; 23 | }, 24 | user_agent() { 25 | return navigator.userAgent; 26 | }, 27 | username(config) { 28 | return config.username; 29 | }, 30 | viewport() { 31 | const clientHeight = document.documentElement && document.documentElement.clientHeight; 32 | const clientWidth = document.documentElement && document.documentElement.clientWidth; 33 | const innerHeight = window.innerHeight; 34 | const innerWidth = window.innerWidth; 35 | const height = clientHeight < innerHeight ? innerHeight : clientHeight; 36 | const width = clientWidth < innerWidth ? innerWidth : clientWidth; 37 | return `${width}x${height}`; 38 | }, 39 | } 40 | 41 | static updateCustomInfo(more) { 42 | Pasta.customInfo = Object.assign({}, Pasta.defaultCustomInfo, more); 43 | } 44 | 45 | static customConfig(opts) { 46 | let result = {}; 47 | const customInfo = Pasta.customInfo; 48 | const keys = Object.keys(customInfo); 49 | keys.forEach((key) => { 50 | if (customInfo[key]) { 51 | result = Object.assign({}, result, { 52 | [key]: customInfo[key](opts), 53 | }); 54 | } 55 | }); 56 | return result; 57 | } 58 | 59 | constructor(config = {}) { 60 | const tmpConfig = Object.assign({}, Pasta.config, config); 61 | Pasta.updateCustomInfo(tmpConfig.customInfo); 62 | const customInfo = Pasta.customConfig(tmpConfig); 63 | 64 | this.buffer = []; // [{...}, {...}] 65 | this.config = Object.assign({}, tmpConfig, customInfo); 66 | this.customInfo = customInfo; 67 | this.pending = false; 68 | } 69 | 70 | push(data) { 71 | const { maxBuff } = this.config; 72 | this.buffer.push(Object.assign({ 73 | time: (new Date()).getTime() / 1000, 74 | }, data, this.customInfo)); 75 | if (this.buffer.length >= maxBuff && !this.pending) { 76 | this.send('auto'); 77 | } 78 | } 79 | 80 | pop() { 81 | const { maxBuff } = this.config; 82 | const length = Math.min(this.buffer.length, maxBuff); 83 | this.buffer.splice(0, length); 84 | if (this.buffer.length >= maxBuff) { 85 | this.send('auto'); 86 | } 87 | } 88 | 89 | send(isAuto = false) { 90 | const { maxBuff, endpoint } = this.config; 91 | const { length: bufLen } = this.buffer; 92 | const length = isAuto ? (Math.min(bufLen, maxBuff)) : bufLen; 93 | const data = this.buffer.slice(0, length); 94 | if (data.length === 0) { return false; } 95 | // sending 96 | this.pending = true; 97 | return fetch(endpoint, { 98 | async: false, 99 | body: JSON.stringify(data), 100 | header: { 101 | 'Accept-Charset': 'utf-8', 102 | 'Content-Type': 'application/json', 103 | }, 104 | method: 'POST', 105 | mode: 'cors', 106 | }).then((res) => { 107 | this.pending = false; 108 | if (res.ok) { this.pop(); } 109 | }).catch(() => { 110 | this.pending = false; 111 | }); 112 | } 113 | } 114 | 115 | export default Pasta; 116 | -------------------------------------------------------------------------------- /dist/pasta.js: -------------------------------------------------------------------------------- 1 | (function webpackUniversalModuleDefinition(root, factory) { 2 | if(typeof exports === 'object' && typeof module === 'object') 3 | module.exports = factory(); 4 | else if(typeof define === 'function' && define.amd) 5 | define([], factory); 6 | else if(typeof exports === 'object') 7 | exports["Pasta"] = factory(); 8 | else 9 | root["Pasta"] = factory(); 10 | })(this, function() { 11 | return /******/ (function(modules) { // webpackBootstrap 12 | /******/ // The module cache 13 | /******/ var installedModules = {}; 14 | /******/ 15 | /******/ // The require function 16 | /******/ function __webpack_require__(moduleId) { 17 | /******/ 18 | /******/ // Check if module is in cache 19 | /******/ if(installedModules[moduleId]) { 20 | /******/ return installedModules[moduleId].exports; 21 | /******/ } 22 | /******/ // Create a new module (and put it into the cache) 23 | /******/ var module = installedModules[moduleId] = { 24 | /******/ i: moduleId, 25 | /******/ l: false, 26 | /******/ exports: {} 27 | /******/ }; 28 | /******/ 29 | /******/ // Execute the module function 30 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 31 | /******/ 32 | /******/ // Flag the module as loaded 33 | /******/ module.l = true; 34 | /******/ 35 | /******/ // Return the exports of the module 36 | /******/ return module.exports; 37 | /******/ } 38 | /******/ 39 | /******/ 40 | /******/ // expose the modules object (__webpack_modules__) 41 | /******/ __webpack_require__.m = modules; 42 | /******/ 43 | /******/ // expose the module cache 44 | /******/ __webpack_require__.c = installedModules; 45 | /******/ 46 | /******/ // identity function for calling harmony imports with the correct context 47 | /******/ __webpack_require__.i = function(value) { return value; }; 48 | /******/ 49 | /******/ // define getter function for harmony exports 50 | /******/ __webpack_require__.d = function(exports, name, getter) { 51 | /******/ if(!__webpack_require__.o(exports, name)) { 52 | /******/ Object.defineProperty(exports, name, { 53 | /******/ configurable: false, 54 | /******/ enumerable: true, 55 | /******/ get: getter 56 | /******/ }); 57 | /******/ } 58 | /******/ }; 59 | /******/ 60 | /******/ // getDefaultExport function for compatibility with non-harmony modules 61 | /******/ __webpack_require__.n = function(module) { 62 | /******/ var getter = module && module.__esModule ? 63 | /******/ function getDefault() { return module['default']; } : 64 | /******/ function getModuleExports() { return module; }; 65 | /******/ __webpack_require__.d(getter, 'a', getter); 66 | /******/ return getter; 67 | /******/ }; 68 | /******/ 69 | /******/ // Object.prototype.hasOwnProperty.call 70 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 71 | /******/ 72 | /******/ // __webpack_public_path__ 73 | /******/ __webpack_require__.p = "/dist/"; 74 | /******/ 75 | /******/ // Load entry module and return exports 76 | /******/ return __webpack_require__(__webpack_require__.s = 5); 77 | /******/ }) 78 | /************************************************************************/ 79 | /******/ ({ 80 | 81 | /***/ 0: 82 | /***/ (function(module, exports, __webpack_require__) { 83 | 84 | "use strict"; 85 | 86 | 87 | Object.defineProperty(exports, "__esModule", { 88 | value: true 89 | }); 90 | 91 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 92 | 93 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 94 | 95 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 96 | 97 | var Pasta = function () { 98 | _createClass(Pasta, null, [{ 99 | key: 'updateCustomInfo', 100 | value: function updateCustomInfo(more) { 101 | Pasta.customInfo = Object.assign({}, Pasta.defaultCustomInfo, more); 102 | } 103 | }, { 104 | key: 'customConfig', 105 | value: function customConfig(opts) { 106 | var result = {}; 107 | var customInfo = Pasta.customInfo; 108 | var keys = Object.keys(customInfo); 109 | keys.forEach(function (key) { 110 | if (customInfo[key]) { 111 | result = Object.assign({}, result, _defineProperty({}, key, customInfo[key](opts))); 112 | } 113 | }); 114 | return result; 115 | } 116 | }]); 117 | 118 | function Pasta() { 119 | var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 120 | 121 | _classCallCheck(this, Pasta); 122 | 123 | var tmpConfig = Object.assign({}, Pasta.config, config); 124 | Pasta.updateCustomInfo(tmpConfig.customInfo); 125 | var customInfo = Pasta.customConfig(tmpConfig); 126 | 127 | this.buffer = []; // [{...}, {...}] 128 | this.config = Object.assign({}, tmpConfig, customInfo); 129 | this.customInfo = customInfo; 130 | this.pending = false; 131 | } 132 | 133 | _createClass(Pasta, [{ 134 | key: 'push', 135 | value: function push(data) { 136 | var maxBuff = this.config.maxBuff; 137 | 138 | this.buffer.push(Object.assign({ 139 | time: new Date().getTime() / 1000 140 | }, data, this.customInfo)); 141 | if (this.buffer.length >= maxBuff && !this.pending) { 142 | this.send('auto'); 143 | } 144 | } 145 | }, { 146 | key: 'pop', 147 | value: function pop() { 148 | var maxBuff = this.config.maxBuff; 149 | 150 | var length = Math.min(this.buffer.length, maxBuff); 151 | this.buffer.splice(0, length); 152 | if (this.buffer.length >= maxBuff) { 153 | this.send('auto'); 154 | } 155 | } 156 | }, { 157 | key: 'send', 158 | value: function send() { 159 | var _this = this; 160 | 161 | var isAuto = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 162 | var _config = this.config, 163 | maxBuff = _config.maxBuff, 164 | endpoint = _config.endpoint; 165 | var bufLen = this.buffer.length; 166 | 167 | var length = isAuto ? Math.min(bufLen, maxBuff) : bufLen; 168 | var data = this.buffer.slice(0, length); 169 | if (data.length === 0) { 170 | return false; 171 | } 172 | // sending 173 | this.pending = true; 174 | return fetch(endpoint, { 175 | async: false, 176 | body: JSON.stringify(data), 177 | header: { 178 | 'Accept-Charset': 'utf-8', 179 | 'Content-Type': 'application/json' 180 | }, 181 | method: 'POST', 182 | mode: 'cors' 183 | }).then(function (res) { 184 | _this.pending = false; 185 | if (res.ok) { 186 | _this.pop(); 187 | } 188 | }).catch(function () { 189 | _this.pending = false; 190 | }); 191 | } 192 | }]); 193 | 194 | return Pasta; 195 | }(); 196 | 197 | Pasta.config = { 198 | maxBuff: 10, 199 | endpoint: '', 200 | username: null, 201 | customInfo: {} 202 | }; 203 | Pasta.customInfo = {}; 204 | Pasta.defaultCustomInfo = { 205 | page_path: function page_path() { 206 | return location.pathname; 207 | }, 208 | page_title: function page_title() { 209 | return document.title; 210 | }, 211 | page_url: function page_url() { 212 | return location.href; 213 | }, 214 | referrer: function referrer() { 215 | return document.referrer; 216 | }, 217 | user_agent: function user_agent() { 218 | return navigator.userAgent; 219 | }, 220 | username: function username(config) { 221 | return config.username; 222 | }, 223 | viewport: function viewport() { 224 | var clientHeight = document.documentElement && document.documentElement.clientHeight; 225 | var clientWidth = document.documentElement && document.documentElement.clientWidth; 226 | var innerHeight = window.innerHeight; 227 | var innerWidth = window.innerWidth; 228 | var height = clientHeight < innerHeight ? innerHeight : clientHeight; 229 | var width = clientWidth < innerWidth ? innerWidth : clientWidth; 230 | return width + 'x' + height; 231 | } 232 | }; 233 | exports.default = Pasta; 234 | 235 | /***/ }), 236 | 237 | /***/ 5: 238 | /***/ (function(module, exports, __webpack_require__) { 239 | 240 | "use strict"; 241 | 242 | 243 | Object.defineProperty(exports, "__esModule", { 244 | value: true 245 | }); 246 | exports.Pasta = undefined; 247 | 248 | var _pasta = __webpack_require__(0); 249 | 250 | var _pasta2 = _interopRequireDefault(_pasta); 251 | 252 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 253 | 254 | exports.Pasta = _pasta2.default; 255 | 256 | /***/ }) 257 | 258 | /******/ }); 259 | }); -------------------------------------------------------------------------------- /test/pastaSpec.js: -------------------------------------------------------------------------------- 1 | import 'es5-shim'; 2 | import 'es6-shim'; 3 | import 'whatwg-fetch'; 4 | import Pasta from '../src/pasta'; 5 | 6 | describe('Pasta', () => { 7 | it('should be defined', () => { 8 | expect(Pasta).toBeDefined(); 9 | }); 10 | 11 | it('should init right', () => { 12 | const instance = new Pasta(); 13 | 14 | // static 15 | expect(Pasta.config).toBeDefined(); 16 | expect(Pasta.customInfo).toBeDefined(); 17 | expect(Pasta.defaultCustomInfo).toBeDefined(); 18 | expect(Pasta.updateCustomInfo).toBeDefined(); 19 | expect(Pasta.customConfig).toBeDefined(); 20 | // data 21 | expect(instance.buffer).toBeDefined(); 22 | expect(instance.config).toBeDefined(); 23 | expect(instance.customInfo).toBeDefined(); 24 | expect(instance.pending).toBeDefined(); 25 | // method 26 | expect(instance.push).toBeDefined(); 27 | expect(instance.pop).toBeDefined(); 28 | expect(instance.send).toBeDefined(); 29 | }); 30 | 31 | it('should Pasta.updateCustomInfo work', () => { 32 | const oriCustomInfo = Object.keys(Pasta.defaultCustomInfo); 33 | Pasta.updateCustomInfo({ 34 | more1() { return 'more1'; }, 35 | }); 36 | 37 | expect(Object.keys(Pasta.customInfo).length).toEqual(oriCustomInfo.length + 1); 38 | expect(Object.keys(Pasta.customInfo.more1)).toBeDefined(); 39 | }); 40 | 41 | it('should customConfig work', () => { 42 | const instance = new Pasta(); 43 | Pasta.updateCustomInfo({ 44 | more2(opts) { return opts.more2; }, 45 | viewport: false 46 | }); 47 | const opts = { 48 | more2: 'more2', 49 | }; 50 | 51 | const result = Pasta.customConfig(opts); 52 | expect(result.viewport).not.toBeDefined(); 53 | expect(result.more2).toEqual(opts.more2); 54 | }); 55 | 56 | it('should push work', () => { 57 | const instance = new Pasta(); 58 | 59 | expect(instance.buffer.length).toEqual(0); 60 | instance.push({ 61 | evtName: 'test-evt', 62 | }); 63 | expect(instance.buffer.length).toEqual(1); 64 | expect(instance.buffer[0].evtName).toBeDefined(); 65 | expect(instance.buffer[0].time).toBeDefined(); 66 | }); 67 | 68 | it('should push work, [buffer.length pending]=[ { 69 | const instance = new Pasta(); 70 | 71 | spyOn(instance, 'send'); 72 | 73 | expect(instance.pending).toEqual(false); 74 | expect(instance.buffer.length).toEqual(0); 75 | instance.push({ 76 | evtName: 'test-evt', 77 | }); 78 | expect(instance.buffer.length).toEqual(1); 79 | expect(instance.buffer.length).toBeLessThan(instance.config.maxBuff); 80 | expect(instance.send).not.toHaveBeenCalled(); 81 | }); 82 | 83 | it('should push work, [buffer.length pending]=[ { 84 | const instance = new Pasta(); 85 | 86 | instance.pending = true; 87 | spyOn(instance, 'send'); 88 | 89 | expect(instance.pending).toEqual(true); 90 | expect(instance.buffer.length).toEqual(0); 91 | instance.push({ 92 | evtName: 'test-evt', 93 | }); 94 | expect(instance.buffer.length).toEqual(1); 95 | expect(instance.buffer.length).toBeLessThan(instance.config.maxBuff); 96 | expect(instance.send).not.toHaveBeenCalled(); 97 | }); 98 | 99 | it('should push work, [buffer.length pending]=[>=maxBuff, !pending]', () => { 100 | const instance = new Pasta({ 101 | maxBuff: 1, 102 | }); 103 | 104 | instance.pending = false; 105 | spyOn(instance, 'send'); 106 | 107 | expect(instance.pending).toEqual(false); 108 | expect(instance.buffer.length).toEqual(0); 109 | instance.push({ 110 | evtName: 'test-evt', 111 | }); 112 | expect(instance.buffer.length).toEqual(1); 113 | expect(instance.buffer.length).not.toBeLessThan(instance.config.maxBuff); 114 | expect(instance.send).toHaveBeenCalled(); 115 | }); 116 | 117 | it('should push work, [buffer.length pending]=[>=maxBuff, pending]', () => { 118 | const instance = new Pasta({ 119 | maxBuff: 1, 120 | }); 121 | 122 | instance.pending = true; 123 | spyOn(instance, 'send'); 124 | 125 | expect(instance.pending).toEqual(true); 126 | expect(instance.buffer.length).toEqual(0); 127 | instance.push({ 128 | evtName: 'test-evt', 129 | }); 130 | expect(instance.buffer.length).toEqual(1); 131 | expect(instance.buffer.length).not.toBeLessThan(instance.config.maxBuff); 132 | expect(instance.send).not.toHaveBeenCalled(); 133 | }); 134 | 135 | it('should pop work, [buffer.length]=[ { 136 | const instance = new Pasta(); 137 | 138 | spyOn(instance, 'send'); 139 | instance.push({ 140 | evtName: 'test-evt', 141 | }); 142 | expect(instance.buffer.length).toEqual(1); 143 | expect(instance.buffer.length).toBeLessThan(instance.config.maxBuff); 144 | instance.pop(); 145 | expect(instance.buffer.length).toEqual(0); 146 | expect(instance.send).not.toHaveBeenCalled(); 147 | }); 148 | 149 | it('should pop work, [buffer.length]=[=maxBuff]', () => { 150 | const instance = new Pasta({ 151 | maxBuff: 1, 152 | }); 153 | 154 | spyOn(instance, 'send'); 155 | instance.buffer.push({ 156 | evtName: 'test-evt', 157 | }); 158 | expect(instance.buffer.length).toEqual(instance.config.maxBuff); 159 | instance.pop(); 160 | expect(instance.buffer.length).toEqual(0); 161 | expect(instance.send).not.toHaveBeenCalled(); 162 | }); 163 | 164 | it('should pop work, [buffer.length]=[>maxBuff]', () => { 165 | const instance = new Pasta({ 166 | maxBuff: 1, 167 | }); 168 | 169 | spyOn(instance, 'send'); 170 | instance.buffer = [ 171 | { evtName: 'test-evt' }, { evtName: 'test-evt' }, 172 | ]; 173 | expect(instance.buffer.length).toBeGreaterThan(instance.config.maxBuff); 174 | instance.pop(); 175 | expect(instance.buffer.length).toEqual(Math.abs(2 - instance.config.maxBuff)); 176 | expect(instance.send).toHaveBeenCalled(); 177 | }); 178 | 179 | it('should send work, [isAuto]=[f]', () => { 180 | const instance = new Pasta({ 181 | maxBuff: 2, 182 | }); 183 | 184 | spyOn(self, 'fetch').and.callFake(() => { 185 | const p = new Promise((resolve, reject) => { 186 | resolve({ ok: true }); 187 | }); 188 | return p; 189 | }); 190 | 191 | instance.buffer = [ 192 | { evtName: 'testEvt', id: 1}, 193 | { evtName: 'testEvt', id: 2}, 194 | { evtName: 'testEvt', id: 3}, 195 | ]; 196 | 197 | instance.send(); 198 | expect(JSON.parse(fetch.calls.argsFor(0)[1].body)).toEqual(instance.buffer); 199 | }); 200 | 201 | it('should send work, [isAuto]=[t]', () => { 202 | const instance = new Pasta({ 203 | maxBuff: 2, 204 | }); 205 | 206 | spyOn(self, 'fetch').and.callFake(() => { 207 | const p = new Promise((resolve, reject) => { 208 | resolve({ ok: true }); 209 | }); 210 | return p; 211 | }); 212 | 213 | instance.buffer = [ 214 | { evtName: 'testEvt', id: 1}, 215 | { evtName: 'testEvt', id: 2}, 216 | { evtName: 'testEvt', id: 3}, 217 | ]; 218 | 219 | instance.send('isAuto'); 220 | expect(JSON.parse(fetch.calls.argsFor(0)[1].body)).toEqual(instance.buffer.slice(0, 2)); 221 | }); 222 | 223 | it('should send work, [buffer]=[empty]', () => { 224 | const instance = new Pasta(); 225 | 226 | spyOn(self, 'fetch').and.callFake(() => { 227 | const p = new Promise((resolve, reject) => { 228 | throw 'error'; 229 | }); 230 | return p; 231 | }); 232 | 233 | expect(instance.buffer.length).toEqual(0); 234 | expect(instance.send()).toEqual(false); 235 | expect(fetch).not.toHaveBeenCalled(); 236 | }); 237 | 238 | it('should send work, [buffer]=[!empty], resolved and ok', () => { 239 | const instance = new Pasta(); 240 | spyOn(instance, 'pop'); 241 | spyOn(self, 'fetch').and.callFake(() => { 242 | return { 243 | then(cb) { cb({ ok: true }); return this; }, 244 | catch(cb) { cb(); return this; }, 245 | } 246 | }); 247 | 248 | instance.push({ 249 | evtName: 'test-evt', 250 | }); 251 | const p = instance.send(); 252 | expect(p).not.toEqual(false); 253 | expect(fetch).toHaveBeenCalled(); 254 | expect(instance.pop).toHaveBeenCalled(); 255 | }); 256 | 257 | it('should send work, [buffer]=[!empty], resolved and !ok', () => { 258 | const instance = new Pasta(); 259 | spyOn(instance, 'pop'); 260 | spyOn(self, 'fetch').and.callFake(() => { 261 | return { 262 | then(cb) { cb({ ok: false }); return this; }, 263 | catch(cb) { cb(); return this; }, 264 | } 265 | }); 266 | 267 | instance.push({ 268 | evtName: 'test-evt', 269 | }); 270 | const p = instance.send(); 271 | expect(p).not.toEqual(false); 272 | expect(fetch).toHaveBeenCalled(); 273 | expect(instance.pop).not.toHaveBeenCalled(); 274 | }); 275 | 276 | it('should send work, [buffer]=[!empty], rejected', () => { 277 | const instance = new Pasta(); 278 | spyOn(instance, 'pop'); 279 | spyOn(self, 'fetch').and.callFake(() => { 280 | return { 281 | then(cb) { return this; }, 282 | catch(cb) { cb(); return this; }, 283 | } 284 | }); 285 | 286 | instance.push({ 287 | evtName: 'test-evt', 288 | }); 289 | expect(instance.send()).not.toEqual(false); 290 | expect(fetch).toHaveBeenCalled(); 291 | expect(instance.pop).not.toHaveBeenCalled(); 292 | }); 293 | }); 294 | -------------------------------------------------------------------------------- /dist/pasta-full.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pasta=e():t.Pasta=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=4)}([function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};o(this,t);var r=Object.assign({},t.config,e);t.updateCustomInfo(r.customInfo);var n=t.customConfig(r);this.buffer=[],this.config=Object.assign({},r,n),this.customInfo=n,this.pending=!1}return i(t,null,[{key:"updateCustomInfo",value:function(e){t.customInfo=Object.assign({},t.defaultCustomInfo,e)}},{key:"customConfig",value:function(e){var r={},o=t.customInfo;return Object.keys(o).forEach(function(t){o[t]&&(r=Object.assign({},r,n({},t,o[t](e))))}),r}}]),i(t,[{key:"push",value:function(t){var e=this.config.maxBuff;this.buffer.push(Object.assign({time:(new Date).getTime()/1e3},t,this.customInfo)),this.buffer.length>=e&&!this.pending&&this.send("auto")}},{key:"pop",value:function(){var t=this.config.maxBuff,e=Math.min(this.buffer.length,t);this.buffer.splice(0,e),this.buffer.length>=t&&this.send("auto")}},{key:"send",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.config,n=r.maxBuff,o=r.endpoint,i=this.buffer.length,a=e?Math.min(i,n):i,u=this.buffer.slice(0,a);return 0!==u.length&&(this.pending=!0,fetch(o,{async:!1,body:JSON.stringify(u),header:{"Accept-Charset":"utf-8","Content-Type":"application/json"},method:"POST",mode:"cors"}).then(function(e){t.pending=!1,e.ok&&t.pop()}).catch(function(){t.pending=!1}))}}]),t}();a.config={maxBuff:10,endpoint:"",username:null,customInfo:{}},a.customInfo={},a.defaultCustomInfo={page_path:function(){return location.pathname},page_title:function(){return document.title},page_url:function(){return location.href},referrer:function(){return document.referrer},user_agent:function(){return navigator.userAgent},username:function(t){return t.username},viewport:function(){var t=document.documentElement&&document.documentElement.clientHeight,e=document.documentElement&&document.documentElement.clientWidth,r=window.innerHeight,n=window.innerWidth,o=t0||-1)*Math.floor(Math.abs(e))),e},ToPrimitive:function(e){var r,n,o;if(R(e))return e;if(n=e.valueOf,t(n)&&(r=n.call(e),R(r)))return r;if(o=e.toString,t(o)&&(r=o.call(e),R(r)))return r;throw new TypeError},ToObject:function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return o(t)},ToUint32:function(t){return t>>>0}},U=function(){};D(u,{bind:function(e){var r=this;if(!t(r))throw new TypeError("Function.prototype.bind called on incompatible "+r);for(var n,i=p.call(arguments,1),u=function(){if(this instanceof n){var t=m.call(r,this,d.call(i,p.call(arguments)));return o(t)===t?t:this}return m.call(r,e,d.call(i,p.call(arguments)))},s=w(0,r.length-i.length),c=[],f=0;f1&&(r=arguments[1]),!t(e))throw new TypeError("Array.prototype.forEach callback must be a function");for(;++i1&&(n=arguments[1]),!t(e))throw new TypeError("Array.prototype.map callback must be a function");for(var s=0;s1&&(n=arguments[1]),!t(e))throw new TypeError("Array.prototype.filter callback must be a function");for(var s=0;s1&&(r=arguments[1]),!t(e))throw new TypeError("Array.prototype.every callback must be a function");for(var a=0;a1&&(r=arguments[1]),!t(e))throw new TypeError("Array.prototype.some callback must be a function");for(var a=0;a=2)i=arguments[1];else for(;;){if(a in n){i=n[a++];break}if(++a>=o)throw new TypeError("reduce of empty array with no initial value")}for(;a=2)i=arguments[1];else for(;;){if(a in n){i=n[a--];break}if(--a<0)throw new TypeError("reduceRight of empty array with no initial value")}if(a<0)return i;do{a in n&&(i=e(i,n[a],a,r))}while(a--);return i}},!et);var rt=n.indexOf&&-1!==[0,1].indexOf(1,2);D(n,{indexOf:function(t){var e=K&&M(this)?q(this,""):F.ToObject(this),r=F.ToUint32(e.length);if(0===r)return-1;var n=0;for(arguments.length>1&&(n=F.ToInteger(arguments[1])),n=n>=0?n:w(0,r+n);n1&&(n=O(n,F.ToInteger(arguments[1]))),n=n>=0?n:r-Math.abs(n);n>=0;n--)if(n in e&&t===e[n])return n;return-1}},nt);var ot=function(){var t=[1,2],e=t.splice();return 2===t.length&&Z(e)&&0===e.length}();D(n,{splice:function(t,e){return 0===arguments.length?[]:h.apply(this,arguments)}},!ot);var it=function(){var t={};return n.splice.call(t,0,0,1),1===t.length}();D(n,{splice:function(t,e){if(0===arguments.length)return[];var r=arguments;return this.length=w(F.ToInteger(this.length),0),arguments.length>0&&"number"!=typeof e&&(r=z(arguments),r.length<2?W(r,this.length-t):r[1]=F.ToInteger(e)),h.apply(this,r)}},!it);var at=function(){var t=new r(1e5);return t[8]="x",t.splice(1,1),7===t.indexOf("x")}(),ut=function(){var t=[];return t[256]="a",t.splice(257,0,"b"),"a"===t[256]}();D(n,{splice:function(t,e){for(var r,n=F.ToObject(this),o=[],i=F.ToUint32(n.length),a=F.ToInteger(t),u=a<0?w(i+a,0):O(a,i),c=O(w(F.ToInteger(e),0),i-u),f=0;fv;)delete n[f-1],f-=1}else if(h>c)for(f=i-c;f>u;)r=s(f+c-1),l=s(f+h-1),L(n,r)?n[l]=n[r]:delete n[l],f-=1;f=u;for(var d=0;d=0&&!Z(e)&&t(e.callee)},Pt=It(arguments)?It:xt;D(o,{keys:function(e){var r=t(e),n=Pt(e),o=null!==e&&"object"==typeof e,i=o&&M(e);if(!o&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var a=[],u=gt&&r;if(i&&mt||n)for(var c=0;c11?t+1:t},getMonth:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=Ut(this),e=Lt(this);return t<0&&e>11?0:e},getDate:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=Ut(this),e=Lt(this),r=Bt(this);if(t<0&&e>11){if(12===e)return r;return Yt(0,t+1)-r+1}return r},getUTCFullYear:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=zt(this);return t<0&&Gt(this)>11?t+1:t},getUTCMonth:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=zt(this),e=Gt(this);return t<0&&e>11?0:e},getUTCDate:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=zt(this),e=Gt(this),r=Ht(this);if(t<0&&e>11){if(12===e)return r;return Yt(0,t+1)-r+1}return r}},Dt),D(Date.prototype,{toUTCString:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=qt(this),e=Ht(this),r=Gt(this),n=zt(this),o=$t(this),i=Wt(this),a=Vt(this);return Zt[t]+", "+(e<10?"0"+e:e)+" "+Xt[r]+" "+n+" "+(o<10?"0"+o:o)+":"+(i<10?"0"+i:i)+":"+(a<10?"0"+a:a)+" GMT"}},Dt||Ft),D(Date.prototype,{toDateString:function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=this.getDay(),e=this.getDate(),r=this.getMonth(),n=this.getFullYear();return Zt[t]+" "+Xt[r]+" "+(e<10?"0"+e:e)+" "+n}},Dt||At),(Dt||Nt)&&(Date.prototype.toString=function(){if(!(this&&this instanceof Date))throw new TypeError("this is not a Date object.");var t=this.getDay(),e=this.getDate(),r=this.getMonth(),n=this.getFullYear(),o=this.getHours(),i=this.getMinutes(),a=this.getSeconds(),u=this.getTimezoneOffset(),s=Math.floor(Math.abs(u)/60),c=Math.floor(Math.abs(u)%60);return Zt[t]+" "+Xt[r]+" "+(e<10?"0"+e:e)+" "+n+" "+(o<10?"0"+o:o)+":"+(i<10?"0"+i:i)+":"+(a<10?"0"+a:a)+" GMT"+(u>0?"-":"+")+(s<10?"0"+s:s)+(c<10?"0"+c:c)},N&&o.defineProperty(Date.prototype,"toString",{configurable:!0,enumerable:!1,writable:!0}));var Kt=Date.prototype.toISOString&&-1===new Date(-621987552e5).toISOString().indexOf("-000001"),Qt=Date.prototype.toISOString&&"1969-12-31T23:59:59.999Z"!==new Date(-1).toISOString(),te=g.bind(Date.prototype.getTime);D(Date.prototype,{toISOString:function(){if(!isFinite(this)||!isFinite(te(this)))throw new RangeError("Date.prototype.toISOString called on non-finite value.");var t=zt(this),e=Gt(this);t+=Math.floor(e/12),e=(e%12+12)%12;var r=[e+1,Ht(this),$t(this),Wt(this),Vt(this)];t=(t<0?"-":t>9999?"+":"")+H("00000"+Math.abs(t),0<=t&&t<=9999?-4:-6);for(var n=0;n=7&&c>ne){var y=Math.floor(c/ne)*ne,v=Math.floor(y/1e3);p+=v,h-=1e3*v}f=1===l&&s(r)===r?new t(e.parse(r)):l>=7?new t(r,n,o,i,a,p,h):l>=6?new t(r,n,o,i,a,p):l>=5?new t(r,n,o,i,a):l>=4?new t(r,n,o,i):l>=3?new t(r,n,o):l>=2?new t(r,n):l>=1?new t(r instanceof t?+r:r):new t}else f=t.apply(this,arguments);return R(f)||D(f,{constructor:e},!0),f},r=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),n=[0,31,59,90,120,151,181,212,243,273,304,334,365],o=function(t,e){var r=e>1?1:0;return n[e]+Math.floor((t-1969+r)/4)-Math.floor((t-1901+r)/100)+Math.floor((t-1601+r)/400)+365*(t-1970)},i=function(e){var r=0,n=e;if(oe&&n>ne){var o=Math.floor(n/ne)*ne,i=Math.floor(o/1e3);r+=i,n-=1e3*i}return f(new t(1970,0,1,0,0,r,n))};for(var a in t)L(t,a)&&(e[a]=t[a]);return D(e,{now:t.now,UTC:t.UTC},!0),e.prototype=t.prototype,D(e.prototype,{constructor:e},!0),D(e,{parse:function(e){var n=r.exec(e);if(n){var a,u=f(n[1]),s=f(n[2]||1)-1,c=f(n[3]||1)-1,l=f(n[4]||0),p=f(n[5]||0),h=f(n[6]||0),y=Math.floor(1e3*f(n[7]||0)),v=Boolean(n[4]&&!n[8]),d="-"===n[9]?1:-1,b=f(n[10]||0),g=f(n[11]||0);return l<(p>0||h>0||y>0?24:25)&&p<60&&h<60&&y<1e3&&s>-1&&s<12&&b<24&&g<60&&c>-1&&c=0;)r+=ae.data[e],ae.data[e]=Math.floor(r/t),r=r%t*ae.base},numToString:function(){for(var t=ae.size,e="";--t>=0;)if(""!==e||0===t||0!==ae.data[t]){var r=s(ae.data[t]);""===e?e=r:e+=H("0000000",0,7-r.length)+r}return e},pow:function t(e,r,n){return 0===r?n:r%2==1?t(e,r-1,n*e):t(e*e,r/2,n)},log:function(t){for(var e=0,r=t;r>=4096;)e+=12,r/=4096;for(;r>=2;)e+=1,r/=2;return e}};D(l,{toFixed:function(t){var e,r,n,o,i,a,u,c;if(e=f(t),(e=k(e)?0:Math.floor(e))<0||e>20)throw new RangeError("Number.toFixed called with invalid number of decimals");if(r=f(this),k(r))return"NaN";if(r<=-1e21||r>=1e21)return s(r);if(n="",r<0&&(n="-",r=-r),o="0",r>1e-21)if(i=ae.log(r*ae.pow(2,69,1))-69,a=i<0?r*ae.pow(2,-i,1):r/ae.pow(2,i,1),a*=4503599627370496,(i=52-i)>0){for(ae.multiply(0,a),u=e;u>=7;)ae.multiply(1e7,0),u-=7;for(ae.multiply(ae.pow(10,u,1),0),u=i-1;u>=23;)ae.divide(1<<23),u-=23;ae.divide(1<0?(c=o.length,o=c<=e?n+H("0.0000000000000000000",0,e-c+2)+o:n+H(o,0,c-e)+"."+H(o,c-e)):o=n+o,o}},ie);var ue=function(){try{return"1"===1..toPrecision(void 0)}catch(t){return!0}}(),se=l.toPrecision;D(l,{toPrecision:function(t){return void 0===t?se.call(this):se.call(this,t)}},ue),2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?function(){var t=void 0===/()??/.exec("")[1],r=Math.pow(2,32)-1;c.split=function(n,o){var i=String(this);if(void 0===n&&0===o)return[];if(!e(n))return q(this,n,o);var a,u,s,c,f=[],l=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(n.sticky?"y":""),p=0,h=new RegExp(n.source,l+"g");t||(a=new RegExp("^"+h.source+"$(?!\\s)",l));var v=void 0===o?r:F.ToUint32(o);for(u=h.exec(i);u&&!((s=u.index+u[0].length)>p&&(W(f,H(i,p,u.index)),!t&&u.length>1&&u[0].replace(a,function(){for(var t=1;t1&&u.index=v));)h.lastIndex===u.index&&h.lastIndex++,u=h.exec(i);return p===i.length?!c&&h.test("")||W(f,""):W(f,H(i,p)),f.length>v?z(f,0,v):f}}():"0".split(void 0,0).length&&(c.split=function(t,e){return void 0===t&&0===e?[]:q(this,t,e)});var ce=c.replace;(function(){var t=[];return"x".replace(/x(.)?/g,function(e,r){W(t,r)}),1===t.length&&void 0===t[0]})()||(c.replace=function(r,n){var o=t(n),i=e(r)&&/\)[*?]/.test(r.source);if(o&&i){var a=function(t){var e=arguments.length,o=r.lastIndex;r.lastIndex=0;var i=r.exec(t)||[];return r.lastIndex=o,W(i,arguments[e-2],arguments[e-1]),n.apply(this,i)};return ce.call(this,r,a)}return ce.call(this,r,n)});var fe=c.substr,le="".substr&&"b"!=="0b".substr(-1);D(c,{substr:function(t,e){var r=t;return t<0&&(r=w(this.length+t,0)),fe.call(this,r,e)}},le);var pe="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff",he="​",ye="["+pe+"]",ve=new RegExp("^"+ye+ye+"*"),de=new RegExp(ye+ye+"*$"),be=c.trim&&(pe.trim()||!he.trim());D(c,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return s(this).replace(ve,"").replace(de,"")}},be);var ge=g.bind(String.prototype.trim),me=c.lastIndexOf&&-1!=="abcあい".lastIndexOf("あい",2);D(c,{lastIndexOf:function(t){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");for(var e=s(this),r=s(t),n=arguments.length>1?f(arguments[1]):NaN,o=k(n)?1/0:F.ToInteger(n),i=O(w(o,0),e.length),a=r.length,u=i+a;u>0;){u=w(0,u-a);var c=$(H(e,u,i+a),r);if(-1!==c)return u+c}return-1}},me);var we=c.lastIndexOf;if(D(c,{lastIndexOf:function(t){return we.apply(this,arguments)}},1!==c.lastIndexOf.length),8===parseInt(pe+"08")&&22===parseInt(pe+"0x16")||(parseInt=function(t){var e=/^[\-+]?0[xX]/;return function(r,n){var o=ge(String(r)),i=f(n)||(e.test(o)?16:10);return t(o,i)}}(parseInt)),1/parseFloat("-0")!=-1/0&&(parseFloat=function(t){return function(e){var r=ge(String(e)),n=t(r);return 0===n&&"-"===H(r,0,1)?-0:n}}(parseFloat)),"RangeError: test"!==String(new RangeError("test"))){var Oe=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");var t=this.name;void 0===t?t="Error":"string"!=typeof t&&(t=s(t));var e=this.message;return void 0===e?e="":"string"!=typeof e&&(e=s(e)),t?e?t+": "+e:t:e};Error.prototype.toString=Oe}if(N){var Te=function(t,e){if(V(t,e)){var r=Object.getOwnPropertyDescriptor(t,e);r.configurable&&(r.enumerable=!1,Object.defineProperty(t,e,r))}};Te(Error.prototype,"message"),""!==Error.prototype.message&&(Error.prototype.message=""),Te(Error.prototype,"name")}if("/a/gim"!==String(/a/gim)){var je=function(){var t="/"+this.source+"/";return this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),t};RegExp.prototype.toString=je}})},function(t,e,r){(function(n,o){var i,a;/*! 2 | * https://github.com/paulmillr/es6-shim 3 | * @license es6-shim Copyright 2013-2016 by Paul Miller (http://paulmillr.com) 4 | * and contributors, MIT License 5 | * es6-shim: v0.35.1 6 | * see https://github.com/paulmillr/es6-shim/blob/0.35.1/LICENSE 7 | * Details and documentation: 8 | * https://github.com/paulmillr/es6-shim/ 9 | */ 10 | !function(n,o){i=o,void 0!==(a="function"==typeof i?i.call(e,r,e,t):i)&&(t.exports=a)}(0,function(){"use strict";var t,e=Function.call.bind(Function.apply),r=Function.call.bind(Function.call),i=Array.isArray,a=Object.keys,u=function(t){try{return t(),!1}catch(t){return!0}},s=function(t){try{return t()}catch(t){return!1}},c=function(t){return function(){return!e(t,this,arguments)}}(u),f=!!Object.defineProperty&&function(){return!u(function(){Object.defineProperty({},"x",{get:function(){}})})}(),l="foo"===function(){}.name,p=Function.call.bind(Array.prototype.forEach),h=Function.call.bind(Array.prototype.reduce),y=Function.call.bind(Array.prototype.filter),v=Function.call.bind(Array.prototype.some),d=function(t,e,r,n){!n&&e in t||(f?Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:r}):t[e]=r)},b=function(t,e,r){p(a(e),function(n){var o=e[n];d(t,n,o,!!r)})},g=Function.call.bind(Object.prototype.toString),m=function(t){return"function"==typeof t},w={getter:function(t,e,r){if(!f)throw new TypeError("getters require true ES5 support");Object.defineProperty(t,e,{configurable:!0,enumerable:!1,get:r})},proxy:function(t,e,r){if(!f)throw new TypeError("getters require true ES5 support");var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,{configurable:n.configurable,enumerable:n.enumerable,get:function(){return t[e]},set:function(r){t[e]=r}})},redefine:function(t,e,r){if(f){var n=Object.getOwnPropertyDescriptor(t,e);n.value=r,Object.defineProperty(t,e,n)}else t[e]=r},defineByDescriptor:function(t,e,r){f?Object.defineProperty(t,e,r):"value"in r&&(t[e]=r.value)},preserveToString:function(t,e){e&&m(e.toString)&&d(t,"toString",e.toString.bind(e),!0)}},O=Object.create||function(t,e){var r=function(){};r.prototype=t;var n=new r;return void 0!==e&&a(e).forEach(function(t){w.defineByDescriptor(n,t,e[t])}),n},T=function(t,e){return!!Object.setPrototypeOf&&s(function(){var r=function e(r){var n=new t(r);return Object.setPrototypeOf(n,e.prototype),n};return Object.setPrototypeOf(r,t),r.prototype=O(t.prototype,{constructor:{value:r}}),e(r)})},j=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}(),S=j.isFinite,E=Function.call.bind(String.prototype.indexOf),I=Function.apply.bind(Array.prototype.indexOf),x=Function.call.bind(Array.prototype.concat),P=Function.call.bind(String.prototype.slice),C=Function.call.bind(Array.prototype.push),M=Function.apply.bind(Array.prototype.push),_=Function.call.bind(Array.prototype.shift),A=Math.max,N=Math.min,D=Math.floor,R=Math.abs,k=Math.exp,F=Math.log,U=Math.sqrt,L=Function.call.bind(Object.prototype.hasOwnProperty),B=function(){},z=j.Map,G=z&&z.prototype.delete,H=z&&z.prototype.get,q=z&&z.prototype.has,$=z&&z.prototype.set,W=j.Symbol||{},V=W.species||"@@species",J=Number.isNaN||function(t){return t!==t},Z=Number.isFinite||function(t){return"number"==typeof t&&S(t)},X=m(Math.sign)?Math.sign:function(t){var e=Number(t);return 0===e?e:J(e)?e:e<0?-1:1},Y=function(t){return"[object Arguments]"===g(t)},K=function(t){return null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==g(t)&&"[object Function]"===g(t.callee)},Q=Y(arguments)?Y:K,tt={primitive:function(t){return null===t||"function"!=typeof t&&"object"!=typeof t},string:function(t){return"[object String]"===g(t)},regex:function(t){return"[object RegExp]"===g(t)},symbol:function(t){return"function"==typeof j.Symbol&&"symbol"==typeof t}},et=function(t,e,r){var n=t[e];d(t,e,r,!0),w.preserveToString(t[e],n)},rt="function"==typeof W&&"function"==typeof W.for&&tt.symbol(W()),nt=tt.symbol(W.iterator)?W.iterator:"_es6-shim iterator_";j.Set&&"function"==typeof(new j.Set)["@@iterator"]&&(nt="@@iterator"),j.Reflect||d(j,"Reflect",{},!0);var ot=j.Reflect,it=String,at="undefined"!=typeof document&&document?document.all:null,ut=null==at?function(t){return null==t}:function(t){return null==t&&t!==at},st={Call:function(t,r){var n=arguments.length>2?arguments[2]:[];if(!st.IsCallable(t))throw new TypeError(t+" is not a function");return e(t,r,n)},RequireObjectCoercible:function(t,e){if(ut(t))throw new TypeError(e||"Cannot call method on "+t);return t},TypeIsObject:function(t){return void 0!==t&&null!==t&&!0!==t&&!1!==t&&("function"==typeof t||"object"==typeof t||t===at)},ToObject:function(t,e){return Object(st.RequireObjectCoercible(t,e))},IsCallable:m,IsConstructor:function(t){return st.IsCallable(t)},ToInt32:function(t){return st.ToNumber(t)>>0},ToUint32:function(t){return st.ToNumber(t)>>>0},ToNumber:function(t){if("[object Symbol]"===g(t))throw new TypeError("Cannot convert a Symbol value to a number");return+t},ToInteger:function(t){var e=st.ToNumber(t);return J(e)?0:0!==e&&Z(e)?(e>0?1:-1)*D(R(e)):e},ToLength:function(t){var e=st.ToInteger(t);return e<=0?0:e>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e},SameValue:function(t,e){return t===e?0!==t||1/t==1/e:J(t)&&J(e)},SameValueZero:function(t,e){return t===e||J(t)&&J(e)},IsIterable:function(t){return st.TypeIsObject(t)&&(void 0!==t[nt]||Q(t))},GetIterator:function(e){if(Q(e))return new t(e,"value");var r=st.GetMethod(e,nt);if(!st.IsCallable(r))throw new TypeError("value is not an iterable");var n=st.Call(r,e);if(!st.TypeIsObject(n))throw new TypeError("bad iterator");return n},GetMethod:function(t,e){var r=st.ToObject(t)[e];if(!ut(r)){if(!st.IsCallable(r))throw new TypeError("Method not callable: "+e);return r}},IteratorComplete:function(t){return!!t.done},IteratorClose:function(t,e){var r=st.GetMethod(t,"return");if(void 0!==r){var n,o;try{n=st.Call(r,t)}catch(t){o=t}if(!e){if(o)throw o;if(!st.TypeIsObject(n))throw new TypeError("Iterator's return method returned a non-object.")}}},IteratorNext:function(t){var e=arguments.length>1?t.next(arguments[1]):t.next();if(!st.TypeIsObject(e))throw new TypeError("bad iterator");return e},IteratorStep:function(t){var e=st.IteratorNext(t);return!st.IteratorComplete(e)&&e},Construct:function(t,e,r,n){var o=void 0===r?t:r;if(!n&&ot.construct)return ot.construct(t,e,o);var i=o.prototype;st.TypeIsObject(i)||(i=Object.prototype);var a=O(i),u=st.Call(t,a,e);return st.TypeIsObject(u)?u:a},SpeciesConstructor:function(t,e){var r=t.constructor;if(void 0===r)return e;if(!st.TypeIsObject(r))throw new TypeError("Bad constructor");var n=r[V];if(ut(n))return e;if(!st.IsConstructor(n))throw new TypeError("Bad @@species");return n},CreateHTML:function(t,e,r,n){var o=st.ToString(t),i="<"+e;if(""!==r){i+=" "+r+'="'+st.ToString(n).replace(/"/g,""")+'"'}return i+">"+o+""},IsRegExp:function(t){if(!st.TypeIsObject(t))return!1;var e=t[W.match];return void 0!==e?!!e:tt.regex(t)},ToString:function(t){return it(t)}};if(f&&rt){var ct=function(t){if(tt.symbol(W[t]))return W[t];var e=W.for("Symbol."+t);return Object.defineProperty(W,t,{configurable:!1,enumerable:!1,writable:!1,value:e}),e};if(!tt.symbol(W.search)){var ft=ct("search"),lt=String.prototype.search;d(RegExp.prototype,ft,function(t){return st.Call(lt,t,[this])});var pt=function(t){var e=st.RequireObjectCoercible(this);if(!ut(t)){var r=st.GetMethod(t,ft);if(void 0!==r)return st.Call(r,t,[e])}return st.Call(lt,e,[st.ToString(t)])};et(String.prototype,"search",pt)}if(!tt.symbol(W.replace)){var ht=ct("replace"),yt=String.prototype.replace;d(RegExp.prototype,ht,function(t,e){return st.Call(yt,t,[this,e])});var vt=function(t,e){var r=st.RequireObjectCoercible(this);if(!ut(t)){var n=st.GetMethod(t,ht);if(void 0!==n)return st.Call(n,t,[r,e])}return st.Call(yt,r,[st.ToString(t),e])};et(String.prototype,"replace",vt)}if(!tt.symbol(W.split)){var dt=ct("split"),bt=String.prototype.split;d(RegExp.prototype,dt,function(t,e){return st.Call(bt,t,[this,e])});var gt=function(t,e){var r=st.RequireObjectCoercible(this);if(!ut(t)){var n=st.GetMethod(t,dt);if(void 0!==n)return st.Call(n,t,[r,e])}return st.Call(bt,r,[st.ToString(t),e])};et(String.prototype,"split",gt)}var mt=tt.symbol(W.match),wt=mt&&function(){var t={};return t[W.match]=function(){return 42},42!=="a".match(t)}();if(!mt||wt){var Ot=ct("match"),Tt=String.prototype.match;d(RegExp.prototype,Ot,function(t){return st.Call(Tt,t,[this])});var jt=function(t){var e=st.RequireObjectCoercible(this);if(!ut(t)){var r=st.GetMethod(t,Ot);if(void 0!==r)return st.Call(r,t,[e])}return st.Call(Tt,e,[st.ToString(t)])};et(String.prototype,"match",jt)}}var St=function(t,e,r){w.preserveToString(e,t),Object.setPrototypeOf&&Object.setPrototypeOf(t,e),f?p(Object.getOwnPropertyNames(t),function(n){n in B||r[n]||w.proxy(t,n,e)}):p(Object.keys(t),function(n){n in B||r[n]||(e[n]=t[n])}),e.prototype=t.prototype,w.redefine(t.prototype,"constructor",e)},Et=function(){return this},It=function(t){f&&!L(t,V)&&w.getter(t,V,Et)},xt=function(t,e){var r=e||function(){return this};d(t,nt,r),!t[nt]&&tt.symbol(nt)&&(t[nt]=r)},Pt=function(t,e,r){f?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,writable:!0,value:r}):t[e]=r},Ct=function(t,e,r){if(Pt(t,e,r),!st.SameValue(t[e],r))throw new TypeError("property is nonconfigurable")},Mt=function(t,e,r,n){if(!st.TypeIsObject(t))throw new TypeError("Constructor requires `new`: "+e.name);var o=e.prototype;st.TypeIsObject(o)||(o=r);var i=O(o);for(var a in n)if(L(n,a)){var u=n[a];d(i,a,u,!0)}return i};if(String.fromCodePoint&&1!==String.fromCodePoint.length){var _t=String.fromCodePoint;et(String,"fromCodePoint",function(t){return st.Call(_t,this,arguments)})}var At={fromCodePoint:function(t){for(var e,r=[],n=0,o=arguments.length;n1114111)throw new RangeError("Invalid code point "+e);e<65536?C(r,String.fromCharCode(e)):(e-=65536,C(r,String.fromCharCode(55296+(e>>10))),C(r,String.fromCharCode(e%1024+56320)))}return r.join("")},raw:function(t){var e=st.ToObject(t,"bad callSite"),r=st.ToObject(e.raw,"bad raw value"),n=r.length,o=st.ToLength(n);if(o<=0)return"";for(var i,a,u,s,c=[],f=0;f=o));)a=f+1=1/0)throw new RangeError("repeat count must be less than infinity and not overflow maximum string size");return Nt(e,r)},startsWith:function(t){var e=st.ToString(st.RequireObjectCoercible(this));if(st.IsRegExp(t))throw new TypeError('Cannot call method "startsWith" with a regex');var r,n=st.ToString(t);arguments.length>1&&(r=arguments[1]);var o=A(st.ToInteger(r),0);return P(e,o,o+n.length)===n},endsWith:function(t){var e=st.ToString(st.RequireObjectCoercible(this));if(st.IsRegExp(t))throw new TypeError('Cannot call method "endsWith" with a regex');var r,n=st.ToString(t),o=e.length;arguments.length>1&&(r=arguments[1]);var i=void 0===r?o:st.ToInteger(r),a=N(A(i,0),o);return P(e,a-n.length,a)===n},includes:function(t){if(st.IsRegExp(t))throw new TypeError('"includes" does not accept a RegExp');var e,r=st.ToString(t);return arguments.length>1&&(e=arguments[1]),-1!==E(this,r,e)},codePointAt:function(t){var e=st.ToString(st.RequireObjectCoercible(this)),r=st.ToInteger(t),n=e.length;if(r>=0&&r56319||i)return o;var a=e.charCodeAt(r+1);return a<56320||a>57343?o:1024*(o-55296)+(a-56320)+65536}}};if(String.prototype.includes&&!1!=="a".includes("a",1/0)&&et(String.prototype,"includes",Dt.includes),String.prototype.startsWith&&String.prototype.endsWith){var Rt=u(function(){"/a/".startsWith(/a/)}),kt=s(function(){return!1==="abc".startsWith("a",1/0)});Rt&&kt||(et(String.prototype,"startsWith",Dt.startsWith),et(String.prototype,"endsWith",Dt.endsWith))}if(rt){s(function(){var t=/a/;return t[W.match]=!1,"/a/".startsWith(t)})||et(String.prototype,"startsWith",Dt.startsWith);s(function(){var t=/a/;return t[W.match]=!1,"/a/".endsWith(t)})||et(String.prototype,"endsWith",Dt.endsWith);s(function(){var t=/a/;return t[W.match]=!1,"/a/".includes(t)})||et(String.prototype,"includes",Dt.includes)}b(String.prototype,Dt);var Ft=["\t\n\v\f\r   ᠎    ","          \u2028","\u2029\ufeff"].join(""),Ut=new RegExp("(^["+Ft+"]+)|(["+Ft+"]+$)","g"),Lt=function(){return st.ToString(st.RequireObjectCoercible(this)).replace(Ut,"")},Bt=["…","​","￾"].join(""),zt=new RegExp("["+Bt+"]","g"),Gt=/^[-+]0x[0-9a-f]+$/i,Ht=Bt.trim().length!==Bt.length;d(String.prototype,"trim",Lt,Ht);var qt=function(t){return{value:t,done:0===arguments.length}},$t=function(t){st.RequireObjectCoercible(t),this._s=st.ToString(t),this._i=0};$t.prototype.next=function(){var t=this._s,e=this._i;if(void 0===t||e>=t.length)return this._s=void 0,qt();var r,n,o=t.charCodeAt(e);return o<55296||o>56319||e+1===t.length?n=1:(r=t.charCodeAt(e+1),n=r<56320||r>57343?1:2),this._i=e+n,qt(t.substr(e,n))},xt($t.prototype),xt(String.prototype,function(){return new $t(this)});var Wt={from:function(t){var e,n=this;arguments.length>1&&(e=arguments[1]);var o,i;if(void 0===e)o=!1;else{if(!st.IsCallable(e))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2]),o=!0}var a,u,s,c=void 0!==(Q(t)||st.GetMethod(t,nt));if(c){u=st.IsConstructor(n)?Object(new n):[];var f,l,p=st.GetIterator(t);for(s=0;;){if(!1===(f=st.IteratorStep(p)))break;l=f.value;try{o&&(l=void 0===i?e(l,s):r(e,i,l,s)),u[s]=l}catch(t){throw st.IteratorClose(p,!0),t}s+=1}a=s}else{var h=st.ToObject(t);a=st.ToLength(h.length),u=st.IsConstructor(n)?Object(new n(a)):new Array(a);var y;for(s=0;s2&&(r=arguments[2]);var c=void 0===r?o:st.ToInteger(r),f=c<0?A(o+c,0):N(c,o),l=N(f-s,o-u),p=1;for(s0;)s in n?n[u]=n[s]:delete n[u],s+=p,u+=p,l-=1;return n},fill:function(t){var e;arguments.length>1&&(e=arguments[1]);var r;arguments.length>2&&(r=arguments[2]);var n=st.ToObject(this),o=st.ToLength(n.length);e=st.ToInteger(void 0===e?0:e),r=st.ToInteger(void 0===r?o:r);for(var i=e<0?A(o+e,0):N(e,o),a=r<0?o+r:r,u=i;u1?arguments[1]:null,a=0;a1?arguments[1]:null,i=0;i1&&void 0!==arguments[1]?st.Call(Yt,this,arguments):r(Yt,this,t)})}var Kt=-(Math.pow(2,32)-1),Qt=function(t,e){var n={length:Kt};return n[e?(n.length>>>0)-1:0]=!0,s(function(){return r(t,n,function(){throw new RangeError("should not reach here")},[]),!0})};if(!Qt(Array.prototype.forEach)){var te=Array.prototype.forEach;et(Array.prototype,"forEach",function(t){return st.Call(te,this.length>=0?this:[],arguments)})}if(!Qt(Array.prototype.map)){var ee=Array.prototype.map;et(Array.prototype,"map",function(t){return st.Call(ee,this.length>=0?this:[],arguments)})}if(!Qt(Array.prototype.filter)){var re=Array.prototype.filter;et(Array.prototype,"filter",function(t){return st.Call(re,this.length>=0?this:[],arguments)})}if(!Qt(Array.prototype.some)){var ne=Array.prototype.some;et(Array.prototype,"some",function(t){return st.Call(ne,this.length>=0?this:[],arguments)})}if(!Qt(Array.prototype.every)){var oe=Array.prototype.every;et(Array.prototype,"every",function(t){return st.Call(oe,this.length>=0?this:[],arguments)})}if(!Qt(Array.prototype.reduce)){var ie=Array.prototype.reduce;et(Array.prototype,"reduce",function(t){return st.Call(ie,this.length>=0?this:[],arguments)})}if(!Qt(Array.prototype.reduceRight,!0)){var ae=Array.prototype.reduceRight;et(Array.prototype,"reduceRight",function(t){return st.Call(ae,this.length>=0?this:[],arguments)})}var ue=8!==Number("0o10"),se=2!==Number("0b10"),ce=v(Bt,function(t){return 0===Number(t+0+t)});if(ue||se||ce){var fe=Number,le=/^0b[01]+$/i,pe=/^0o[0-7]+$/i,he=le.test.bind(le),ye=pe.test.bind(pe),ve=function(t){var e;if("function"==typeof t.valueOf&&(e=t.valueOf(),tt.primitive(e)))return e;if("function"==typeof t.toString&&(e=t.toString(),tt.primitive(e)))return e;throw new TypeError("No default value")},de=zt.test.bind(zt),be=Gt.test.bind(Gt),ge=function(){var t=function(e){var r;"string"==typeof(r=arguments.length>0?tt.primitive(e)?e:ve(e):0)&&(r=st.Call(Lt,r),he(r)?r=parseInt(P(r,2),2):ye(r)?r=parseInt(P(r,2),8):(de(r)||be(r))&&(r=NaN));var n=this,o=s(function(){return fe.prototype.valueOf.call(n),!0});return n instanceof t&&!o?new fe(r):fe(r)};return t}();St(fe,ge,{}),b(ge,{NaN:fe.NaN,MAX_VALUE:fe.MAX_VALUE,MIN_VALUE:fe.MIN_VALUE,NEGATIVE_INFINITY:fe.NEGATIVE_INFINITY,POSITIVE_INFINITY:fe.POSITIVE_INFINITY}),Number=ge,w.redefine(j,"Number",ge)}var me=Math.pow(2,53)-1;b(Number,{MAX_SAFE_INTEGER:me,MIN_SAFE_INTEGER:-me,EPSILON:2.220446049250313e-16,parseInt:j.parseInt,parseFloat:j.parseFloat,isFinite:Z,isInteger:function(t){return Z(t)&&st.ToInteger(t)===t},isSafeInteger:function(t){return Number.isInteger(t)&&R(t)<=Number.MAX_SAFE_INTEGER},isNaN:J}),d(Number,"parseInt",j.parseInt,Number.parseInt!==j.parseInt),1===[,1].find(function(){return!0})&&et(Array.prototype,"find",Vt.find),0!==[,1].findIndex(function(){return!0})&&et(Array.prototype,"findIndex",Vt.findIndex);var we=Function.bind.call(Function.bind,Object.prototype.propertyIsEnumerable),Oe=function(t,e){f&&we(t,e)&&Object.defineProperty(t,e,{enumerable:!1})},Te=function(){for(var t=Number(this),e=arguments.length,r=e-t,n=new Array(r<0?0:r),o=t;o1?NaN:-1===e?-1/0:1===e?1/0:0===e?e:.5*F((1+e)/(1-e))},cbrt:function(t){var e=Number(t);if(0===e)return e;var r,n=e<0;return n&&(e=-e),e===1/0?r=1/0:(r=k(F(e)/3),r=(e/(r*r)+2*r)/3),n?-r:r},clz32:function(t){var e=Number(t),r=st.ToUint32(e);return 0===r?32:ur?st.Call(ur,r):31-D(F(r+.5)*ir)},cosh:function(t){var e=Number(t);return 0===e?1:J(e)?NaN:S(e)?(e<0&&(e=-e),e>21?k(e)/2:(k(e)+k(-e))/2):1/0},expm1:function(t){var e=Number(t);if(e===-1/0)return-1;if(!S(e)||0===e)return e;if(R(e)>.5)return k(e)-1;for(var r=e,n=0,o=1;n+r!==n;)n+=r,o+=1,r*=e/o;return n},hypot:function(t,e){for(var r=0,n=0,o=0;o0?i/n*(i/n):i}return n===1/0?1/0:n*U(r)},log2:function(t){return F(t)*ir},log10:function(t){return F(t)*ar},log1p:function(t){var e=Number(t);return e<-1||J(e)?NaN:0===e||e===1/0?e:-1===e?-1/0:1+e-1==0?e:e*(F(1+e)/(1+e-1))},sign:X,sinh:function(t){var e=Number(t);return S(e)&&0!==e?R(e)<1?(Math.expm1(e)-Math.expm1(-e))/2:(k(e-1)-k(-e-1))*or/2:e},tanh:function(t){var e=Number(t);return J(e)||0===e?e:e>=20?1:e<=-20?-1:(Math.expm1(e)-Math.expm1(-e))/(k(e)+k(-e))},trunc:function(t){var e=Number(t);return e<0?-D(-e):D(e)},imul:function(t,e){var r=st.ToUint32(t),n=st.ToUint32(e),o=r>>>16&65535,i=65535&r,a=n>>>16&65535,u=65535&n;return i*u+(o*u+i*a<<16>>>0)|0},fround:function(t){var e=Number(t);if(0===e||e===1/0||e===-1/0||J(e))return e;var r=X(e),n=R(e);if(nrr||J(i)?r*(1/0):r*i}};b(Math,sr),d(Math,"log1p",sr.log1p,-1e-17!==Math.log1p(-1e-17)),d(Math,"asinh",sr.asinh,Math.asinh(-1e7)!==-Math.asinh(1e7)),d(Math,"tanh",sr.tanh,-2e-17!==Math.tanh(-2e-17)),d(Math,"acosh",sr.acosh,Math.acosh(Number.MAX_VALUE)===1/0),d(Math,"cbrt",sr.cbrt,Math.abs(1-Math.cbrt(1e-300)/1e-100)/Number.EPSILON>8),d(Math,"sinh",sr.sinh,-2e-17!==Math.sinh(-2e-17));var cr=Math.expm1(10);d(Math,"expm1",sr.expm1,cr>22025.465794806718||cr<22025.465794806718);var fr=Math.round,lr=0===Math.round(.5-Number.EPSILON/4)&&1===Math.round(Number.EPSILON/3.99-.5),pr=Qe+1,hr=2*Qe-1,yr=[pr,hr].every(function(t){return Math.round(t)===t});d(Math,"round",function(t){var e=D(t),r=-1===e?-0:e+1;return t-e<.5?e:r},!lr||!yr),w.preserveToString(Math.round,fr);var vr=Math.imul;-5!==Math.imul(4294967295,5)&&(Math.imul=sr.imul,w.preserveToString(Math.imul,vr)),2!==Math.imul.length&&et(Math,"imul",function(t,e){return st.Call(vr,Math,arguments)});var dr=function(){var t=j.setTimeout;if("function"==typeof t||"object"==typeof t){st.IsPromise=function(t){return!!st.TypeIsObject(t)&&void 0!==t._promise};var e,n=function(t){if(!st.IsConstructor(t))throw new TypeError("Bad promise constructor");var e=this,r=function(t,r){if(void 0!==e.resolve||void 0!==e.reject)throw new TypeError("Bad Promise implementation!");e.resolve=t,e.reject=r};if(e.resolve=void 0,e.reject=void 0,e.promise=new t(r),!st.IsCallable(e.resolve)||!st.IsCallable(e.reject))throw new TypeError("Bad promise constructor")};"undefined"!=typeof window&&st.IsCallable(window.postMessage)&&(e=function(){var t=[],e=function(e){C(t,e),window.postMessage("zero-timeout-message","*")},r=function(e){if(e.source===window&&"zero-timeout-message"===e.data){if(e.stopPropagation(),0===t.length)return;_(t)()}};return window.addEventListener("message",r,!0),e});var i,a,u=st.IsCallable(j.setImmediate)?j.setImmediate:"object"==typeof o&&o.nextTick?o.nextTick:function(){var t=j.Promise,e=t&&t.resolve&&t.resolve();return e&&function(t){return e.then(t)}}()||(st.IsCallable(e)?e():function(e){t(e,0)}),s=function(t){return t},c=function(t){throw t},f={},l=function(t,e,r){u(function(){p(t,e,r)})},p=function(t,e,r){var n,o;if(e===f)return t(r);try{n=t(r),o=e.resolve}catch(t){n=t,o=e.reject}o(n)},h=function(t,e){var r=t._promise,n=r.reactionLength;if(n>0&&(l(r.fulfillReactionHandler0,r.reactionCapability0,e),r.fulfillReactionHandler0=void 0,r.rejectReactions0=void 0,r.reactionCapability0=void 0,n>1))for(var o=1,i=0;o0&&(l(r.rejectReactionHandler0,r.reactionCapability0,e),r.fulfillReactionHandler0=void 0,r.rejectReactions0=void 0,r.reactionCapability0=void 0,n>1))for(var o=1,i=0;o2&&arguments[2]===f&&i===m?f:new n(i);var a,u=st.IsCallable(t)?t:s,p=st.IsCallable(e)?e:c,h=r._promise;if(0===h.state){if(0===h.reactionLength)h.fulfillReactionHandler0=u,h.rejectReactionHandler0=p,h.reactionCapability0=o;else{var y=3*(h.reactionLength-1);h[y+0]=u,h[y+1]=p,h[y+2]=o}h.reactionLength+=1}else if(1===h.state)a=h.result,l(u,o,a);else{if(2!==h.state)throw new TypeError("unexpected Promise state");a=h.result,l(p,o,a)}return o.promise}}),f=new n(m),a=i.then,m}}();if(j.Promise&&(delete j.Promise.accept,delete j.Promise.defer,delete j.Promise.prototype.chain),"function"==typeof dr){b(j,{Promise:dr});var br=T(j.Promise,function(t){return t.resolve(42).then(function(){})instanceof t}),gr=!u(function(){j.Promise.reject(42).then(null,5).then(null,B)}),mr=u(function(){j.Promise.call(3,B)}),wr=function(t){var e=t.resolve(5);e.constructor={};var r=t.resolve(e);try{r.then(null,B).then(null,B)}catch(t){return!0}return e===r}(j.Promise),Or=f&&function(){var t=0,e=Object.defineProperty({},"then",{get:function(){t+=1}});return Promise.resolve(e),1===t}(),Tr=function t(e){var r=new Promise(e);e(3,function(){}),this.then=r.then,this.constructor=t};Tr.prototype=Promise.prototype,Tr.all=Promise.all;var jr=s(function(){return!!Tr.all([1,2])});if(br&&gr&&mr&&!wr&&Or&&!jr||(Promise=dr,et(j,"Promise",dr)),1!==Promise.all.length){var Sr=Promise.all;et(Promise,"all",function(t){return st.Call(Sr,this,arguments)})}if(1!==Promise.race.length){var Er=Promise.race;et(Promise,"race",function(t){return st.Call(Er,this,arguments)})}if(1!==Promise.resolve.length){var Ir=Promise.resolve;et(Promise,"resolve",function(t){return st.Call(Ir,this,arguments)})}if(1!==Promise.reject.length){var xr=Promise.reject;et(Promise,"reject",function(t){return st.Call(xr,this,arguments)})}Oe(Promise,"all"),Oe(Promise,"race"),Oe(Promise,"resolve"),Oe(Promise,"reject"),It(Promise)}var Pr=function(t){var e=a(h(t,function(t,e){return t[e]=!0,t},{}));return t.join(":")===e.join(":")},Cr=Pr(["z","a","bb"]),Mr=Pr(["z",1,"a","3",2]);if(f){var _r=function(t,e){return e||Cr?ut(t)?"^"+st.ToString(t):"string"==typeof t?"$"+t:"number"==typeof t?Mr?t:"n"+t:"boolean"==typeof t?"b"+t:null:null},Ar=function(){return Object.create?Object.create(null):{}},Nr=function(t,e,n){if(i(n)||tt.string(n))p(n,function(t){if(!st.TypeIsObject(t))throw new TypeError("Iterator value "+t+" is not an entry object");e.set(t[0],t[1])});else if(n instanceof t)r(t.prototype.forEach,n,function(t,r){e.set(r,t)});else{var o,a;if(!ut(n)){if(a=e.set,!st.IsCallable(a))throw new TypeError("bad map");o=st.GetIterator(n)}if(void 0!==o)for(;;){var u=st.IteratorStep(o);if(!1===u)break;var s=u.value;try{if(!st.TypeIsObject(s))throw new TypeError("Iterator value "+s+" is not an entry object");r(a,e,s[0],s[1])}catch(t){throw st.IteratorClose(o,!0),t}}}},Dr=function(t,e,n){if(i(n)||tt.string(n))p(n,function(t){e.add(t)});else if(n instanceof t)r(t.prototype.forEach,n,function(t){e.add(t)});else{var o,a;if(!ut(n)){if(a=e.add,!st.IsCallable(a))throw new TypeError("bad set");o=st.GetIterator(n)}if(void 0!==o)for(;;){var u=st.IteratorStep(o);if(!1===u)break;var s=u.value;try{r(a,e,s)}catch(t){throw st.IteratorClose(o,!0),t}}}},Rr={Map:function(){var t={},e=function(t,e){this.key=t,this.value=e,this.next=null,this.prev=null};e.prototype.isRemoved=function(){return this.key===t};var n=function(t){return!!t._es6map},o=function(t,e){if(!st.TypeIsObject(t)||!n(t))throw new TypeError("Method Map.prototype."+e+" called on incompatible receiver "+st.ToString(t))},i=function(t,e){o(t,"[[MapIterator]]"),this.head=t._head,this.i=this.head,this.kind=e};i.prototype={next:function(){var t=this.i,e=this.kind,r=this.head;if(void 0===this.i)return qt();for(;t.isRemoved()&&t!==r;)t=t.prev;for(var n;t.next!==r;)if(t=t.next,!t.isRemoved())return n="key"===e?t.key:"value"===e?t.value:[t.key,t.value],this.i=t,qt(n);return this.i=void 0,qt()}},xt(i.prototype);var a,u=function t(){if(!(this instanceof t))throw new TypeError('Constructor Map requires "new"');if(this&&this._es6map)throw new TypeError("Bad construction");var r=Mt(this,t,a,{_es6map:!0,_head:null,_map:z?new z:null,_size:0,_storage:Ar()}),n=new e(null,null);return n.next=n.prev=n,r._head=n,arguments.length>0&&Nr(t,r,arguments[0]),r};return a=u.prototype,w.getter(a,"size",function(){if(void 0===this._size)throw new TypeError("size method called on incompatible Map");return this._size}),b(a,{get:function(t){o(this,"get");var e,r=_r(t,!0);if(null!==r)return e=this._storage[r],e?e.value:void 0;if(this._map)return e=H.call(this._map,t),e?e.value:void 0;for(var n=this._head,i=n;(i=i.next)!==n;)if(st.SameValueZero(i.key,t))return i.value},has:function(t){o(this,"has");var e=_r(t,!0);if(null!==e)return void 0!==this._storage[e];if(this._map)return q.call(this._map,t);for(var r=this._head,n=r;(n=n.next)!==r;)if(st.SameValueZero(n.key,t))return!0;return!1},set:function(t,r){o(this,"set");var n,i=this._head,a=i,u=_r(t,!0);if(null!==u){if(void 0!==this._storage[u])return this._storage[u].value=r,this;n=this._storage[u]=new e(t,r),a=i.prev}else this._map&&(q.call(this._map,t)?H.call(this._map,t).value=r:(n=new e(t,r),$.call(this._map,t,n),a=i.prev));for(;(a=a.next)!==i;)if(st.SameValueZero(a.key,t))return a.value=r,this;return n=n||new e(t,r),st.SameValue(-0,t)&&(n.key=0),n.next=this._head,n.prev=this._head.prev,n.prev.next=n,n.next.prev=n,this._size+=1,this},delete:function(e){o(this,"delete");var r=this._head,n=r,i=_r(e,!0);if(null!==i){if(void 0===this._storage[i])return!1;n=this._storage[i].prev,delete this._storage[i]}else if(this._map){if(!q.call(this._map,e))return!1;n=H.call(this._map,e).prev,G.call(this._map,e)}for(;(n=n.next)!==r;)if(st.SameValueZero(n.key,e))return n.key=t,n.value=t,n.prev.next=n.next,n.next.prev=n.prev,this._size-=1,!0;return!1},clear:function(){o(this,"clear"),this._map=z?new z:null,this._size=0,this._storage=Ar();for(var e=this._head,r=e,n=r.next;(r=n)!==e;)r.key=t,r.value=t,n=r.next,r.next=r.prev=e;e.next=e.prev=e},keys:function(){return o(this,"keys"),new i(this,"key")},values:function(){return o(this,"values"),new i(this,"value")},entries:function(){return o(this,"entries"),new i(this,"key+value")},forEach:function(t){o(this,"forEach");for(var e=arguments.length>1?arguments[1]:null,n=this.entries(),i=n.next();!i.done;i=n.next())e?r(t,e,i.value[1],i.value[0],this):t(i.value[1],i.value[0],this)}}),xt(a,a.entries),u}(),Set:function(){var t,e=function(t){return t._es6set&&void 0!==t._storage},n=function(t,r){if(!st.TypeIsObject(t)||!e(t))throw new TypeError("Set.prototype."+r+" called on incompatible receiver "+st.ToString(t))},o=function e(){if(!(this instanceof e))throw new TypeError('Constructor Set requires "new"');if(this&&this._es6set)throw new TypeError("Bad construction");var r=Mt(this,e,t,{_es6set:!0,"[[SetData]]":null,_storage:Ar()});if(!r._es6set)throw new TypeError("bad set");return arguments.length>0&&Dr(e,r,arguments[0]),r};t=o.prototype;var i=function(t){var e=t;if("^null"===e)return null;if("^undefined"!==e){var r=e.charAt(0);return"$"===r?P(e,1):"n"===r?+P(e,1):"b"===r?"btrue"===e:+e}},u=function(t){if(!t["[[SetData]]"]){var e=new Rr.Map;t["[[SetData]]"]=e,p(a(t._storage),function(t){var r=i(t);e.set(r,r)}),t["[[SetData]]"]=e}t._storage=null};return w.getter(o.prototype,"size",function(){return n(this,"size"),this._storage?a(this._storage).length:(u(this),this["[[SetData]]"].size)}),b(o.prototype,{has:function(t){n(this,"has");var e;return this._storage&&null!==(e=_r(t))?!!this._storage[e]:(u(this),this["[[SetData]]"].has(t))},add:function(t){n(this,"add");var e;return this._storage&&null!==(e=_r(t))?(this._storage[e]=!0,this):(u(this),this["[[SetData]]"].set(t,t),this)},delete:function(t){n(this,"delete");var e;if(this._storage&&null!==(e=_r(t))){var r=L(this._storage,e);return delete this._storage[e]&&r}return u(this),this["[[SetData]]"].delete(t)},clear:function(){n(this,"clear"),this._storage&&(this._storage=Ar()),this["[[SetData]]"]&&this["[[SetData]]"].clear()},values:function(){return n(this,"values"),u(this),this["[[SetData]]"].values()},entries:function(){return n(this,"entries"),u(this),this["[[SetData]]"].entries()},forEach:function(t){n(this,"forEach");var e=arguments.length>1?arguments[1]:null,o=this;u(o),this["[[SetData]]"].forEach(function(n,i){e?r(t,e,i,i,o):t(i,i,o)})}}),d(o.prototype,"keys",o.prototype.values,!0),xt(o.prototype,o.prototype.values),o}()};if(j.Map||j.Set){s(function(){return 2===new Map([[1,2]]).get(1)})||(j.Map=function t(){if(!(this instanceof t))throw new TypeError('Constructor Map requires "new"');var e=new z;return arguments.length>0&&Nr(t,e,arguments[0]),delete e.constructor,Object.setPrototypeOf(e,j.Map.prototype),e},j.Map.prototype=O(z.prototype),d(j.Map.prototype,"constructor",j.Map,!0),w.preserveToString(j.Map,z));var kr=new Map,Fr=function(){var t=new Map([[1,0],[2,0],[3,0],[4,0]]);return t.set(-0,t),t.get(0)===t&&t.get(-0)===t&&t.has(0)&&t.has(-0)}(),Ur=kr.set(1,2)===kr;Fr&&Ur||et(Map.prototype,"set",function(t,e){return r($,this,0===t?0:t,e),this}),Fr||(b(Map.prototype,{get:function(t){return r(H,this,0===t?0:t)},has:function(t){return r(q,this,0===t?0:t)}},!0),w.preserveToString(Map.prototype.get,H),w.preserveToString(Map.prototype.has,q));var Lr=new Set,Br=function(t){return t.delete(0),t.add(-0),!t.has(0)}(Lr),zr=Lr.add(1)===Lr;if(!Br||!zr){var Gr=Set.prototype.add;Set.prototype.add=function(t){return r(Gr,this,0===t?0:t),this},w.preserveToString(Set.prototype.add,Gr)}if(!Br){var Hr=Set.prototype.has;Set.prototype.has=function(t){return r(Hr,this,0===t?0:t)},w.preserveToString(Set.prototype.has,Hr);var qr=Set.prototype.delete;Set.prototype.delete=function(t){return r(qr,this,0===t?0:t)},w.preserveToString(Set.prototype.delete,qr)}var $r=T(j.Map,function(t){var e=new t([]);return e.set(42,42),e instanceof t}),Wr=Object.setPrototypeOf&&!$r,Vr=function(){try{return!(j.Map()instanceof j.Map)}catch(t){return t instanceof TypeError}}();0===j.Map.length&&!Wr&&Vr||(j.Map=function t(){if(!(this instanceof t))throw new TypeError('Constructor Map requires "new"');var e=new z;return arguments.length>0&&Nr(t,e,arguments[0]),delete e.constructor,Object.setPrototypeOf(e,t.prototype),e},j.Map.prototype=z.prototype,d(j.Map.prototype,"constructor",j.Map,!0),w.preserveToString(j.Map,z));var Jr=T(j.Set,function(t){var e=new t([]);return e.add(42,42),e instanceof t}),Zr=Object.setPrototypeOf&&!Jr,Xr=function(){try{return!(j.Set()instanceof j.Set)}catch(t){return t instanceof TypeError}}();if(0!==j.Set.length||Zr||!Xr){var Yr=j.Set;j.Set=function t(){if(!(this instanceof t))throw new TypeError('Constructor Set requires "new"');var e=new Yr;return arguments.length>0&&Dr(t,e,arguments[0]),delete e.constructor,Object.setPrototypeOf(e,t.prototype),e},j.Set.prototype=Yr.prototype,d(j.Set.prototype,"constructor",j.Set,!0),w.preserveToString(j.Set,Yr)}var Kr=new j.Map,Qr=!s(function(){return Kr.keys().next().done});if(("function"!=typeof j.Map.prototype.clear||0!==(new j.Set).size||0!==Kr.size||"function"!=typeof j.Map.prototype.keys||"function"!=typeof j.Set.prototype.keys||"function"!=typeof j.Map.prototype.forEach||"function"!=typeof j.Set.prototype.forEach||c(j.Map)||c(j.Set)||"function"!=typeof Kr.keys().next||Qr||!$r)&&b(j,{Map:Rr.Map,Set:Rr.Set},!0),j.Set.prototype.keys!==j.Set.prototype.values&&d(j.Set.prototype,"keys",j.Set.prototype.values,!0),xt(Object.getPrototypeOf((new j.Map).keys())),xt(Object.getPrototypeOf((new j.Set).keys())),l&&"has"!==j.Set.prototype.has.name){var tn=j.Set.prototype.has;et(j.Set.prototype,"has",function(t){return r(tn,this,t)})}}b(j,Rr),It(j.Map),It(j.Set)}var en=function(t){if(!st.TypeIsObject(t))throw new TypeError("target must be an object")},rn={apply:function(){return st.Call(st.Call,null,arguments)},construct:function(t,e){if(!st.IsConstructor(t))throw new TypeError("First argument must be a constructor.");var r=arguments.length>2?arguments[2]:t;if(!st.IsConstructor(r))throw new TypeError("new.target must be a constructor.");return st.Construct(t,e,r,"internal")},deleteProperty:function(t,e){if(en(t),f){var r=Object.getOwnPropertyDescriptor(t,e);if(r&&!r.configurable)return!1}return delete t[e]},has:function(t,e){return en(t),e in t}};Object.getOwnPropertyNames&&Object.assign(rn,{ownKeys:function(t){en(t);var e=Object.getOwnPropertyNames(t);return st.IsCallable(Object.getOwnPropertySymbols)&&M(e,Object.getOwnPropertySymbols(t)),e}});var nn=function(t){return!u(t)};if(Object.preventExtensions&&Object.assign(rn,{isExtensible:function(t){return en(t),Object.isExtensible(t)},preventExtensions:function(t){return en(t),nn(function(){Object.preventExtensions(t)})}}),f){var on=function(t,e,r){var n=Object.getOwnPropertyDescriptor(t,e);if(!n){var o=Object.getPrototypeOf(t);if(null===o)return;return on(o,e,r)}return"value"in n?n.value:n.get?st.Call(n.get,r):void 0},an=function(t,e,n,o){var i=Object.getOwnPropertyDescriptor(t,e);if(!i){var a=Object.getPrototypeOf(t);if(null!==a)return an(a,e,n,o);i={value:void 0,writable:!0,enumerable:!0,configurable:!0}}if("value"in i){if(!i.writable)return!1;if(!st.TypeIsObject(o))return!1;return Object.getOwnPropertyDescriptor(o,e)?ot.defineProperty(o,e,{value:n}):ot.defineProperty(o,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}return!!i.set&&(r(i.set,o,n),!0)};Object.assign(rn,{defineProperty:function(t,e,r){return en(t),nn(function(){Object.defineProperty(t,e,r)})},getOwnPropertyDescriptor:function(t,e){return en(t),Object.getOwnPropertyDescriptor(t,e)},get:function(t,e){en(t);var r=arguments.length>2?arguments[2]:t;return on(t,e,r)},set:function(t,e,r){en(t);var n=arguments.length>3?arguments[3]:t;return an(t,e,r,n)}})}if(Object.getPrototypeOf){var un=Object.getPrototypeOf;rn.getPrototypeOf=function(t){return en(t),un(t)}}if(Object.setPrototypeOf&&rn.getPrototypeOf){var sn=function(t,e){for(var r=e;r;){if(t===r)return!0;r=rn.getPrototypeOf(r)}return!1};Object.assign(rn,{setPrototypeOf:function(t,e){if(en(t),null!==e&&!st.TypeIsObject(e))throw new TypeError("proto must be an object or null");return e===ot.getPrototypeOf(t)||!(ot.isExtensible&&!ot.isExtensible(t))&&(!sn(t,e)&&(Object.setPrototypeOf(t,e),!0))}})}var cn=function(t,e){if(st.IsCallable(j.Reflect[t])){s(function(){return j.Reflect[t](1),j.Reflect[t](NaN),j.Reflect[t](!0),!0})&&et(j.Reflect,t,e)}else d(j.Reflect,t,e)};Object.keys(rn).forEach(function(t){cn(t,rn[t])});var fn=j.Reflect.getPrototypeOf;if(l&&fn&&"getPrototypeOf"!==fn.name&&et(j.Reflect,"getPrototypeOf",function(t){return r(fn,j.Reflect,t)}),j.Reflect.setPrototypeOf&&s(function(){return j.Reflect.setPrototypeOf(1,{}),!0})&&et(j.Reflect,"setPrototypeOf",rn.setPrototypeOf),j.Reflect.defineProperty&&(s(function(){var t=!j.Reflect.defineProperty(1,"test",{value:1}),e="function"!=typeof Object.preventExtensions||!j.Reflect.defineProperty(Object.preventExtensions({}),"test",{});return t&&e})||et(j.Reflect,"defineProperty",rn.defineProperty)),j.Reflect.construct&&(s(function(){var t=function(){};return j.Reflect.construct(function(){},[],t)instanceof t})||et(j.Reflect,"construct",rn.construct)),"Invalid Date"!==String(new Date(NaN))){var ln=Date.prototype.toString,pn=function(){var t=+this;return t!==t?"Invalid Date":st.Call(ln,this)};et(Date.prototype,"toString",pn)}var hn={anchor:function(t){return st.CreateHTML(this,"a","name",t)},big:function(){return st.CreateHTML(this,"big","","")},blink:function(){return st.CreateHTML(this,"blink","","")},bold:function(){return st.CreateHTML(this,"b","","")},fixed:function(){return st.CreateHTML(this,"tt","","")},fontcolor:function(t){return st.CreateHTML(this,"font","color",t)},fontsize:function(t){return st.CreateHTML(this,"font","size",t)},italics:function(){return st.CreateHTML(this,"i","","")},link:function(t){return st.CreateHTML(this,"a","href",t)},small:function(){return st.CreateHTML(this,"small","","")},strike:function(){return st.CreateHTML(this,"strike","","")},sub:function(){return st.CreateHTML(this,"sub","","")},sup:function(){return st.CreateHTML(this,"sup","","")}};p(Object.keys(hn),function(t){var e=String.prototype[t],n=!1;if(st.IsCallable(e)){var o=r(e,"",' " '),i=x([],o.match(/"/g)).length;n=o!==o.toLowerCase()||i>2}else n=!0;n&&et(String.prototype,t,hn[t])});var yn=function(){if(!rt)return!1;var t="object"==typeof JSON&&"function"==typeof JSON.stringify?JSON.stringify:null;if(!t)return!1;if(void 0!==t(W()))return!0;if("[null]"!==t([W()]))return!0;var e={a:W()};return e[W()]=!0,"{}"!==t(e)}(),vn=s(function(){return!rt||"{}"===JSON.stringify(Object(W()))&&"[{}]"===JSON.stringify([Object(W())])});if(yn||!vn){var dn=JSON.stringify;et(JSON,"stringify",function(t){if("symbol"!=typeof t){var e;arguments.length>1&&(e=arguments[1]);var n=[t];if(i(e))n.push(e);else{var o=st.IsCallable(e)?e:null,a=function(t,e){var n=o?r(o,this,t,e):e;if("symbol"!=typeof n)return tt.symbol(n)?je({})(n):n};n.push(a)}return arguments.length>2&&n.push(arguments[2]),dn.apply(this,n)}})}return j})}).call(e,r(6),r(5))},function(t,e){!function(t){"use strict";function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function r(t){return"string"!=typeof t&&(t=String(t)),t}function n(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return b.iterable&&(e[Symbol.iterator]=function(){return e}),e}function o(t){this.map={},t instanceof o?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function i(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function u(t){var e=new FileReader,r=a(e);return e.readAsArrayBuffer(t),r}function s(t){var e=new FileReader,r=a(e);return e.readAsText(t),r}function c(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?e:t}function h(t,e){e=e||{};var r=e.body;if(t instanceof h){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new o(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new o(e.headers)),this.method=p(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function y(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}}),e}function v(t){var e=new o;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}}),e}function d(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new o(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var b={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(b.arrayBuffer)var g=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=function(t){return t&&DataView.prototype.isPrototypeOf(t)},w=ArrayBuffer.isView||function(t){return t&&g.indexOf(Object.prototype.toString.call(t))>-1};o.prototype.append=function(t,n){t=e(t),n=r(n);var o=this.map[t];this.map[t]=o?o+","+n:n},o.prototype.delete=function(t){delete this.map[e(t)]},o.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},o.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},o.prototype.set=function(t,n){this.map[e(t)]=r(n)},o.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},o.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),n(t)},o.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),n(t)},o.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),n(t)},b.iterable&&(o.prototype[Symbol.iterator]=o.prototype.entries);var O=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];h.prototype.clone=function(){return new h(this,{body:this._bodyInit})},l.call(h.prototype),l.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},d.error=function(){var t=new d(null,{status:0,statusText:""});return t.type="error",t};var T=[301,302,303,307,308];d.redirect=function(t,e){if(-1===T.indexOf(e))throw new RangeError("Invalid status code");return new d(null,{status:e,headers:{location:t}})},t.Headers=o,t.Request=h,t.Response=d,t.fetch=function(t,e){return new Promise(function(r,n){var o=new h(t,e),i=new XMLHttpRequest;i.onload=function(){var t={status:i.status,statusText:i.statusText,headers:v(i.getAllResponseHeaders()||"")};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;r(new d(e,t))},i.onerror=function(){n(new TypeError("Network request failed"))},i.ontimeout=function(){n(new TypeError("Network request failed"))},i.open(o.method,o.url,!0),"include"===o.credentials&&(i.withCredentials=!0),"responseType"in i&&b.blob&&(i.responseType="blob"),o.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send(void 0===o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,r(1),r(2),r(3);var n=r(0),o=function(t){return t&&t.__esModule?t:{default:t}}(n);e.default=o.default},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(t){if(f===setTimeout)return setTimeout(t,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(e){try{return f.call(null,t,0)}catch(e){return f.call(this,t,0)}}}function i(t){if(l===clearTimeout)return clearTimeout(t);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function a(){v&&h&&(v=!1,h.length?y=h.concat(y):d=-1,y.length&&u())}function u(){if(!v){var t=o(a);v=!0;for(var e=y.length;e;){for(h=y,y=[];++d1)for(var r=1;r