Repository: raychenfj/vue-uweb Branch: master Commit: 579605e9a6ed Files: 79 Total size: 1.7 MB Directory structure: gitextract_yj9gbp5a/ ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── .stylelintrc ├── .travis.yml ├── .vscode/ │ └── settings.json ├── LICENSE ├── README.md ├── README_EN.md ├── build/ │ ├── build.js │ ├── utils/ │ │ ├── index.js │ │ ├── log.js │ │ ├── style.js │ │ └── write.js │ ├── webpack.config.base.js │ ├── webpack.config.dev.js │ └── webpack.config.dll.js ├── dist/ │ ├── vue-uweb.common.js │ ├── vue-uweb.esm.js │ └── vue-uweb.js ├── examples/ │ ├── simple/ │ │ ├── index.html │ │ ├── prism.css │ │ ├── prism.js │ │ ├── script.js │ │ └── styles.css │ └── webpack/ │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── .postcssrc.js │ ├── .vscode/ │ │ └── settings.json │ ├── README.md │ ├── build/ │ │ ├── build.js │ │ ├── check-versions.js │ │ ├── dev-client.js │ │ ├── dev-server.js │ │ ├── utils.js │ │ ├── vue-loader.conf.js │ │ ├── webpack.base.conf.js │ │ ├── webpack.dev.conf.js │ │ └── webpack.prod.conf.js │ ├── config/ │ │ ├── dev.env.js │ │ ├── index.js │ │ └── prod.env.js │ ├── index.html │ ├── package.json │ ├── src/ │ │ ├── app.css │ │ ├── app.js │ │ ├── app.vue │ │ ├── main.js │ │ └── uweb.js │ └── static/ │ └── .gitkeep ├── package.json ├── src/ │ ├── directives/ │ │ ├── auto-pageview.js │ │ ├── track-event.js │ │ ├── track-pageview.js │ │ └── util.js │ ├── index.js │ └── install.js └── test/ ├── .eslintrc ├── dist/ │ ├── vuePluginTemplateDeps.dll.js │ └── vuePluginTemplateDeps.json ├── helpers/ │ ├── Test.vue │ ├── index.js │ ├── utils.js │ └── wait-for-update.js ├── index.js ├── karma.conf.js ├── mocks.js ├── specs/ │ ├── directives/ │ │ ├── auto-pageview.spec.js │ │ ├── track-event.spec.js │ │ ├── track-pageview.spec.js │ │ └── util.spec.js │ └── index.spec.js └── visual.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc ================================================ { "presets": [ [ "env", { "targets": { "browsers": [ "last 2 versions" ] } } ] ], "plugins": [ "transform-vue-jsx", "transform-object-rest-spread", "transform-runtime" ], "env": { "test": { "plugins": [ "istanbul" ] } } } ================================================ FILE: .editorconfig ================================================ root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true ================================================ FILE: .eslintignore ================================================ dist/*.js build/* ================================================ FILE: .eslintrc.js ================================================ module.exports = { root: true, parser: 'babel-eslint', parserOptions: { sourceType: 'module' }, extends: 'vue', // add your custom rules here 'rules': { // allow async-await 'generator-star-spacing': 0, // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 }, globals: { requestAnimationFrame: true, performance: true } } ================================================ FILE: .gitignore ================================================ .DS_Store node_modules/ npm-debug.log yarn-error.log test/coverage *.tgz package ================================================ FILE: .postcssrc.js ================================================ // https://github.com/michael-ciniawsky/postcss-load-config module.exports = { "plugins": { // to edit target browsers: use "browserlist" field in package.json "autoprefixer": {} } } ================================================ FILE: .stylelintrc ================================================ { "processors": ["stylelint-processor-html"], "extends": "stylelint-config-standard", "rules": { "no-empty-source": null } } ================================================ FILE: .travis.yml ================================================ language: node_js node_js: "node" ================================================ FILE: .vscode/settings.json ================================================ { "vsicons.presets.angular": false } ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2017 Ray Chen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # vue-uweb [![Build Status](https://travis-ci.org/raychenfj/vue-uweb.svg?branch=master)](https://travis-ci.org/raychenfj/vue-uweb) > vuejs 友盟统计埋点插件 ## 1. 安装 ```shell npm install vue-uweb --save ``` 直接在页面中引用 ```html

欢迎使用vue-uweb插件

1. 安装

npm

npm install vue-uweb --save

直接在页面中引用

<script src="../node_modules/vue-uweb/dist/index.js"></script>

通过es6模块加载

import uweb from 'vue-uweb'

使用 vue-uweb

Vue.use(uweb,'YOUR_SITEID_HERE')

通过传递 options 参数进行更多设置

Vue.use(uweb,options)
options

2. uweb API

查看官方文档
注意: 所有this均为 Vue 实例

2.1 ready

当需要严格控制加载时序时,可使用 ready 方法。该方法返回一个 promise,当外部统计脚本加载完毕,全局 _czc 对象存在时,promise 被 resolve。

2.2 trackPageview

用于发送某个URL的PV统计请求,适用于统计AJAX、异步加载页面,友情链接,下载链接的流量。

2.3 trackEvent

用于发送页面上按钮等交互元素被触发时的事件统计请求。如视频的“播放、暂停、调整音量”,页面上的“返回顶部”、“赞”、“收藏”等。也可用于发送Flash事件统计请求。

2.4 setCustomVar

用于发送为访客打自定义标记的请求,用来统计会员访客、登录访客、不同来源访客的浏览数据。

2.5 setAccount

当您的页面上添加了多个CNZZ统计代码时,需要用到本方法绑定需要哪个siteid对应的统计代码来接受API发送的请求。未绑定的siteid将忽略相关请求。

2.6 setAutoPageview

如果您使用_trackPageview改写了已有页面的URL,那么建议您在CNZZ的JS统计代码执行前先调用_setAutoPageview,将该页面的自动PV统计关闭,防止页面的流量被统计双倍。

2.7 deleteCustomVar

发送删除自定义访客标签的请求。将访客身上已被标记的自定义访客类型去掉,去掉后不再继续统计。

3. uweb 指令

3.1 track-event

使用指令 v-track-event 监听事件, 通过modifiers指定事件类型,将自动为绑定元素添加事件监听,当事件触发调用统计代码。 如不指定,默认监听 click 事件。 可通过逗号分隔的字符串或对象字面量传递参数,以字符串传递时请注意参数顺序,可参考 trackEvent API

<button v-track-event.click="'event, click''"></button>
<button v-track-event="'event, shortcut'"></button>
<input v-track-event.keypress="'event, keypress'">
关于参数和顺序
<button v-track-event="'event, click'"></button>
<button v-track-event="{category:'event', action:'click'}"></button>

3.2 track-pageview

使用 v-show 跟踪虚拟pv
bar
<div v-show="vshow" v-track-pageview="'/bar'"></div>
使用 v-if 跟踪虚拟pv
foo
<div v-if="vif" v-track-pageview="'/foo'"></div>
以字符串指定受访页面和来源
<div v-track-pageview="'/tar, https://github.com/raychenfj'"></div>
以对象字面量指定受访页面和来源
<div v-track-pageview="{content_url:'/zoo', referer_url:'https://github.com/raychenfj'}"></div>

3.3 auto-pageview

autoPageView: {{auto}}
启用 auto-pageview
<div v-auto-pageview=true></div>
停止 auto-pageview
<div v-auto-pageview=false></div>

4. 默认参数和改变参数顺序

默认情况下,vue-uweb 并不提供默认参数和参数顺序的设置,但开发者可以根据需求,使用装饰器模式,来提供默认参数和改变参数顺序。例如:我们想在监听事件时默认category,只需要传递action,则代码如下
import uweb from 'vue-uweb'

let trackEvent = uweb.trackEvent
uweb.trackEvent = (action, category='default'') => {
  trackEvent.call(uweb, category, action, '', '', '')
}

Vue.use(uweb)
      
注意:由于所有 uweb指令 最终都将调用 uweb api 中的方法,所以对默认参数和参数顺序的修改同样会影响指令的参数和顺序
================================================ FILE: examples/simple/prism.css ================================================ /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript&plugins=toolbar+highlight-keywords+show-language */ /** * prism.js default theme for JavaScript, CSS and HTML * Based on dabblet (http://dabblet.com) * @author Lea Verou */ code[class*="language-"], pre[class*="language-"] { color: black; background: none; text-shadow: 0 1px white; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; word-wrap: normal; line-height: 1.5; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; } pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { text-shadow: none; background: #b3d4fc; } pre[class*="language-"]::selection, pre[class*="language-"] ::selection, code[class*="language-"]::selection, code[class*="language-"] ::selection { text-shadow: none; background: #b3d4fc; } @media print { code[class*="language-"], pre[class*="language-"] { text-shadow: none; } } /* Code blocks */ pre[class*="language-"] { padding: 1em; margin: .5em 0; overflow: auto; } :not(pre) > code[class*="language-"], pre[class*="language-"] { background: #f5f2f0; } /* Inline code */ :not(pre) > code[class*="language-"] { padding: .1em; border-radius: .3em; white-space: normal; } .token.comment, .token.prolog, .token.doctype, .token.cdata { color: slategray; } .token.punctuation { color: #999; } .namespace { opacity: .7; } .token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #905; } .token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #690; } .token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #a67f59; background: hsla(0, 0%, 100%, .5); } .token.atrule, .token.attr-value, .token.keyword { color: #07a; } .token.function { color: #DD4A68; } .token.regex, .token.important, .token.variable { color: #e90; } .token.important, .token.bold { font-weight: bold; } .token.italic { font-style: italic; } .token.entity { cursor: help; } pre.code-toolbar { position: relative; } pre.code-toolbar > .toolbar { position: absolute; top: .3em; right: .2em; transition: opacity 0.3s ease-in-out; opacity: 0; } pre.code-toolbar:hover > .toolbar { opacity: 1; } pre.code-toolbar > .toolbar .toolbar-item { display: inline-block; } pre.code-toolbar > .toolbar a { cursor: pointer; } pre.code-toolbar > .toolbar button { background: none; border: 0; color: inherit; font: inherit; line-height: normal; overflow: visible; padding: 0; -webkit-user-select: none; /* for button */ -moz-user-select: none; -ms-user-select: none; } pre.code-toolbar > .toolbar a, pre.code-toolbar > .toolbar button, pre.code-toolbar > .toolbar span { color: #bbb; font-size: .8em; padding: 0 .5em; background: #f5f2f0; background: rgba(224, 224, 224, 0.2); box-shadow: 0 2px 0 0 rgba(0,0,0,0.2); border-radius: .5em; } pre.code-toolbar > .toolbar a:hover, pre.code-toolbar > .toolbar a:focus, pre.code-toolbar > .toolbar button:hover, pre.code-toolbar > .toolbar button:focus, pre.code-toolbar > .toolbar span:hover, pre.code-toolbar > .toolbar span:focus { color: inherit; text-decoration: none; } ================================================ FILE: examples/simple/prism.js ================================================ /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript&plugins=highlight-keywords */ var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(c?b[1].length:0),_=b.index+b[0].length,P=m,A=y,j=r.length;j>P&&_>A;++P)A+=r[P].length,w>=A&&(++m,y=A);if(r[m]instanceof a||r[P-1].greedy)continue;k=P-m,v=e.slice(y,A),b.index-=y}if(b){c&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,x=v.slice(0,w),O=v.slice(_),S=[m,k];x&&S.push(x);var N=new a(i,g?n.tokenize(b,g):b,d,b,h);S.push(N),O&&S.push(O),Array.prototype.splice.apply(r,S)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(o?" "+o:"")+">"+l.content+""},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,l=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,!document.addEventListener||n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript; !function(){"undefined"!=typeof self&&!self.Prism||"undefined"!=typeof global&&!global.Prism||Prism.hooks.add("wrap",function(e){"keyword"===e.type&&e.classes.push("keyword-"+e.content)})}(); ================================================ FILE: examples/simple/script.js ================================================ var Vue = window.Vue var uweb = window.uweb Vue.use(uweb, '1261414301') new Vue({ el: '#app', data: { content: '', auto: true, vshow: false, vif: false }, methods: { humanizeURL: function (url) { return url .replace(/^https?:\/\//, '') .replace(/\/$/, '') } } }) ================================================ FILE: examples/simple/styles.css ================================================ body { font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; -webkit-font-smoothing: antialiased; color: #34495e; background-color: #fff; font-size: 14px; } #app { width: 800px; min-width: 800px; max-width: 800px; overflow-x: hidden; margin: 0 auto; } #logo { width: 400px; margin: 0 auto; display: block; } a { color: #34495e } ================================================ FILE: examples/webpack/.babelrc ================================================ { "presets": [ ["env", { "modules": false }], "stage-2" ], "plugins": ["transform-runtime"], "comments": false, "env": { "test": { "presets": ["env", "stage-2"], "plugins": [ "istanbul" ] } } } ================================================ FILE: examples/webpack/.editorconfig ================================================ root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true ================================================ FILE: examples/webpack/.eslintignore ================================================ build/*.js config/*.js ================================================ FILE: examples/webpack/.eslintrc.js ================================================ // http://eslint.org/docs/user-guide/configuring module.exports = { root: true, parser: 'babel-eslint', parserOptions: { sourceType: 'module' }, env: { browser: true, }, // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style extends: 'standard', // required to lint *.vue files plugins: [ 'html' ], // add your custom rules here 'rules': { // allow paren-less arrow functions 'arrow-parens': 0, // allow async-await 'generator-star-spacing': 0, // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 } } ================================================ FILE: examples/webpack/.gitignore ================================================ .DS_Store node_modules/ dist/ npm-debug.log yarn-error.log ================================================ FILE: examples/webpack/.postcssrc.js ================================================ // https://github.com/michael-ciniawsky/postcss-load-config module.exports = { "plugins": { // to edit target browsers: use "browserlist" field in package.json "autoprefixer": {} } } ================================================ FILE: examples/webpack/.vscode/settings.json ================================================ { "vsicons.presets.angular": false } ================================================ FILE: examples/webpack/README.md ================================================ # vue-uweb-webpack > A Vue.js project ## Build Setup ``` bash # install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report ``` For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). ================================================ FILE: examples/webpack/build/build.js ================================================ require('./check-versions')() process.env.NODE_ENV = 'production' var ora = require('ora') var rm = require('rimraf') var path = require('path') var chalk = require('chalk') var webpack = require('webpack') var config = require('../config') var webpackConfig = require('./webpack.prod.conf') var spinner = ora('building for production...') spinner.start() rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { if (err) throw err webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n\n') console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.yellow( ' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' )) }) }) ================================================ FILE: examples/webpack/build/check-versions.js ================================================ var chalk = require('chalk') var semver = require('semver') var packageConfig = require('../package.json') function exec (cmd) { return require('child_process').execSync(cmd).toString().trim() } var versionRequirements = [ { name: 'node', currentVersion: semver.clean(process.version), versionRequirement: packageConfig.engines.node }, { name: 'npm', currentVersion: exec('npm --version'), versionRequirement: packageConfig.engines.npm } ] module.exports = function () { var warnings = [] for (var i = 0; i < versionRequirements.length; i++) { var mod = versionRequirements[i] if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { warnings.push(mod.name + ': ' + chalk.red(mod.currentVersion) + ' should be ' + chalk.green(mod.versionRequirement) ) } } if (warnings.length) { console.log('') console.log(chalk.yellow('To use this template, you must update following to modules:')) console.log() for (var i = 0; i < warnings.length; i++) { var warning = warnings[i] console.log(' ' + warning) } console.log() process.exit(1) } } ================================================ FILE: examples/webpack/build/dev-client.js ================================================ /* eslint-disable */ require('eventsource-polyfill') var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') hotClient.subscribe(function (event) { if (event.action === 'reload') { window.location.reload() } }) ================================================ FILE: examples/webpack/build/dev-server.js ================================================ require('./check-versions')() var config = require('../config') if (!process.env.NODE_ENV) { process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) } var opn = require('opn') var path = require('path') var express = require('express') var webpack = require('webpack') var proxyMiddleware = require('http-proxy-middleware') var webpackConfig = require('./webpack.dev.conf') // default port where dev server listens for incoming traffic var port = process.env.PORT || config.dev.port // automatically open browser, if not set will be false var autoOpenBrowser = !!config.dev.autoOpenBrowser // Define HTTP proxies to your custom API backend // https://github.com/chimurai/http-proxy-middleware var proxyTable = config.dev.proxyTable var app = express() var compiler = webpack(webpackConfig) var devMiddleware = require('webpack-dev-middleware')(compiler, { publicPath: webpackConfig.output.publicPath, quiet: true }) var hotMiddleware = require('webpack-hot-middleware')(compiler, { log: () => {} }) // force page reload when html-webpack-plugin template changes compiler.plugin('compilation', function (compilation) { compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { hotMiddleware.publish({ action: 'reload' }) cb() }) }) // proxy api requests Object.keys(proxyTable).forEach(function (context) { var options = proxyTable[context] if (typeof options === 'string') { options = { target: options } } app.use(proxyMiddleware(options.filter || context, options)) }) // handle fallback for HTML5 history API app.use(require('connect-history-api-fallback')()) // serve webpack bundle output app.use(devMiddleware) // enable hot-reload and state-preserving // compilation error display app.use(hotMiddleware) // serve pure static assets var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) app.use(staticPath, express.static('./static')) var uri = 'http://localhost:' + port devMiddleware.waitUntilValid(function () { console.log('> Listening at ' + uri + '\n') }) module.exports = app.listen(port, function (err) { if (err) { console.log(err) return } // when env is testing, don't need open it if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { opn(uri) } }) ================================================ FILE: examples/webpack/build/utils.js ================================================ var path = require('path') var config = require('../config') var ExtractTextPlugin = require('extract-text-webpack-plugin') exports.assetsPath = function (_path) { var assetsSubDirectory = process.env.NODE_ENV === 'production' ? config.build.assetsSubDirectory : config.dev.assetsSubDirectory return path.posix.join(assetsSubDirectory, _path) } exports.cssLoaders = function (options) { options = options || {} var cssLoader = { loader: 'css-loader', options: { minimize: process.env.NODE_ENV === 'production', sourceMap: options.sourceMap } } // generate loader string to be used with extract text plugin function generateLoaders (loader, loaderOptions) { var loaders = [cssLoader] if (loader) { loaders.push({ loader: loader + '-loader', options: Object.assign({}, loaderOptions, { sourceMap: options.sourceMap }) }) } // Extract CSS when that option is specified // (which is the case during production build) if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader' }) } else { return ['vue-style-loader'].concat(loaders) } } // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html return { css: generateLoaders(), postcss: generateLoaders(), less: generateLoaders('less'), sass: generateLoaders('sass', { indentedSyntax: true }), scss: generateLoaders('sass'), stylus: generateLoaders('stylus'), styl: generateLoaders('stylus') } } // Generate loaders for standalone style files (outside of .vue) exports.styleLoaders = function (options) { var output = [] var loaders = exports.cssLoaders(options) for (var extension in loaders) { var loader = loaders[extension] output.push({ test: new RegExp('\\.' + extension + '$'), use: loader }) } return output } ================================================ FILE: examples/webpack/build/vue-loader.conf.js ================================================ var utils = require('./utils') var config = require('../config') var isProduction = process.env.NODE_ENV === 'production' module.exports = { loaders: utils.cssLoaders({ sourceMap: isProduction ? config.build.productionSourceMap : config.dev.cssSourceMap, extract: isProduction }) } ================================================ FILE: examples/webpack/build/webpack.base.conf.js ================================================ var path = require('path') var utils = require('./utils') var config = require('../config') var vueLoaderConfig = require('./vue-loader.conf') function resolve (dir) { return path.join(__dirname, '..', dir) } module.exports = { entry: { app: './src/main.js' }, output: { path: config.build.assetsRoot, filename: '[name].js', publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath }, resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), } }, module: { rules: [ { test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: "pre", include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter') } }, { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, { test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test')] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', query: { limit: 10000, name: utils.assetsPath('img/[name].[hash:7].[ext]') } }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url-loader', query: { limit: 10000, name: utils.assetsPath('fonts/[name].[hash:7].[ext]') } } ] } } ================================================ FILE: examples/webpack/build/webpack.dev.conf.js ================================================ var utils = require('./utils') var webpack = require('webpack') var config = require('../config') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var HtmlWebpackPlugin = require('html-webpack-plugin') var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') // add hot-reload related code to entry chunks Object.keys(baseWebpackConfig.entry).forEach(function (name) { baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) }) module.exports = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) }, // cheap-module-eval-source-map is faster for development devtool: '#cheap-module-eval-source-map', plugins: [ new webpack.DefinePlugin({ 'process.env': config.dev.env }), // https://github.com/glenjamin/webpack-hot-middleware#installation--usage new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin(), // https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ filename: 'index.html', template: 'index.html', inject: true }), new FriendlyErrorsPlugin() ] }) ================================================ FILE: examples/webpack/build/webpack.prod.conf.js ================================================ var path = require('path') var utils = require('./utils') var webpack = require('webpack') var config = require('../config') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var CopyWebpackPlugin = require('copy-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin') var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') var env = config.build.env var webpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true }) }, devtool: config.build.productionSourceMap ? '#source-map' : false, output: { path: config.build.assetsRoot, filename: utils.assetsPath('js/[name].[chunkhash].js'), chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') }, plugins: [ // http://vuejs.github.io/vue-loader/en/workflow/production.html new webpack.DefinePlugin({ 'process.env': env }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, sourceMap: true }), // extract css into its own file new ExtractTextPlugin({ filename: utils.assetsPath('css/[name].[contenthash].css') }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. new OptimizeCSSPlugin(), // generate dist index.html with correct asset hash for caching. // you can customize output by editing /index.html // see https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ filename: config.build.index, template: 'index.html', inject: true, minify: { removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true // more options: // https://github.com/kangax/html-minifier#options-quick-reference }, // necessary to consistently work with multiple chunks via CommonsChunkPlugin chunksSortMode: 'dependency' }), // split vendor js into its own file new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks: function (module, count) { // any required modules inside node_modules are extracted to vendor return ( module.resource && /\.js$/.test(module.resource) && module.resource.indexOf( path.join(__dirname, '../node_modules') ) === 0 ) } }), // extract webpack runtime and module manifest to its own file in order to // prevent vendor hash from being updated whenever app bundle is updated new webpack.optimize.CommonsChunkPlugin({ name: 'manifest', chunks: ['vendor'] }), // copy custom static assets new CopyWebpackPlugin([ { from: path.resolve(__dirname, '../static'), to: config.build.assetsSubDirectory, ignore: ['.*'] } ]) ] }) if (config.build.productionGzip) { var CompressionWebpackPlugin = require('compression-webpack-plugin') webpackConfig.plugins.push( new CompressionWebpackPlugin({ asset: '[path].gz[query]', algorithm: 'gzip', test: new RegExp( '\\.(' + config.build.productionGzipExtensions.join('|') + ')$' ), threshold: 10240, minRatio: 0.8 }) ) } if (config.build.bundleAnalyzerReport) { var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin webpackConfig.plugins.push(new BundleAnalyzerPlugin()) } module.exports = webpackConfig ================================================ FILE: examples/webpack/config/dev.env.js ================================================ var merge = require('webpack-merge') var prodEnv = require('./prod.env') module.exports = merge(prodEnv, { NODE_ENV: '"development"' }) ================================================ FILE: examples/webpack/config/index.js ================================================ // see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module.exports = { build: { env: require('./prod.env'), index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', productionSourceMap: true, // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report }, dev: { env: require('./dev.env'), port: 8080, autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {}, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. cssSourceMap: false } } ================================================ FILE: examples/webpack/config/prod.env.js ================================================ module.exports = { NODE_ENV: '"production"' } ================================================ FILE: examples/webpack/index.html ================================================ vue-uweb-webpack
================================================ FILE: examples/webpack/package.json ================================================ { "name": "vue-uweb-webpack", "version": "1.0.0", "description": "vue uweb webpack example", "author": "raychenfj", "private": true, "scripts": { "dev": "node build/dev-server.js", "build": "node build/build.js", "lint": "eslint --ext .js,.vue src" }, "dependencies": { "prismjs": "^1.6.0", "vue": "^2.2.2", "vue-uweb": "0.0.3" }, "devDependencies": { "autoprefixer": "^6.7.2", "babel-core": "^6.22.1", "babel-eslint": "^7.1.1", "babel-loader": "^6.2.10", "babel-plugin-transform-runtime": "^6.22.0", "babel-preset-env": "^1.2.1", "babel-preset-stage-2": "^6.22.0", "babel-register": "^6.22.0", "chalk": "^1.1.3", "connect-history-api-fallback": "^1.3.0", "copy-webpack-plugin": "^4.0.1", "css-loader": "^0.26.1", "eslint": "^4.18.2", "eslint-config-standard": "^6.2.1", "eslint-config-vue": "^2.0.2", "eslint-friendly-formatter": "^2.0.7", "eslint-loader": "^1.6.1", "eslint-plugin-html": "^4.0.0", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^2.0.1", "eventsource-polyfill": "^0.9.6", "express": "^4.14.1", "extract-text-webpack-plugin": "^2.0.0", "file-loader": "^0.10.0", "friendly-errors-webpack-plugin": "^1.1.3", "function-bind": "^1.1.0", "html-webpack-plugin": "^2.28.0", "http-proxy-middleware": "^0.17.3", "opn": "^4.0.2", "optimize-css-assets-webpack-plugin": "^1.3.0", "ora": "^1.1.0", "rimraf": "^2.6.0", "semver": "^5.3.0", "url-loader": "^0.5.7", "vue-loader": "^11.1.4", "vue-style-loader": "^2.0.0", "vue-template-compiler": "^2.2.4", "webpack": "^2.2.1", "webpack-bundle-analyzer": "^3.3.2", "webpack-dev-middleware": "^1.10.0", "webpack-hot-middleware": "^2.16.1", "webpack-merge": "^2.6.1" }, "engines": { "node": ">= 4.0.0", "npm": ">= 3.0.0" }, "browserslist": [ "> 1%", "last 2 versions", "not ie <= 8" ] } ================================================ FILE: examples/webpack/src/app.css ================================================ body { font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif; -webkit-font-smoothing: antialiased; color: #34495e; background-color: #fff; font-size: 14px; } #app { width: 800px; min-width: 800px; max-width: 800px; overflow-x: hidden; margin: 0 auto; } #logo { width: 400px; margin: 0 auto; display: block; } a { color: #34495e } ================================================ FILE: examples/webpack/src/app.js ================================================ export default { name: 'app', data () { return { content: '', auto: true, vshow: false, vif: false } } } ================================================ FILE: examples/webpack/src/app.vue ================================================ ================================================ FILE: examples/webpack/src/main.js ================================================ // The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './app.vue' import './uweb' import 'prismjs' import '../node_modules/prismjs/themes/prism.css' Vue.config.productionTip = false /* eslint-disable no-new */ new Vue({ el: '#app', template: '', components: { App } }) ================================================ FILE: examples/webpack/src/uweb.js ================================================ import uweb from 'vue-uweb' import Vue from 'vue' Vue.use(uweb, '1261414301') ================================================ FILE: examples/webpack/static/.gitkeep ================================================ ================================================ FILE: package.json ================================================ { "name": "vue-uweb", "version": "0.2.2", "description": "A vuejs plugin for uweb statistics", "author": "raychenfj", "main": "dist/vue-uweb.common.js", "module": "dist/vue-uweb.esm.js", "browser": "dist/vue-uweb.js", "unpkg": "dist/vue-uweb.js", "homepage": "https://github.com/raychenfj/vue-uweb", "keywords": [ "uweb", "statistics", "vue-plugin" ], "repository": { "type": "git", "url": "https://github.com/raychenfj/vue-uweb.git" }, "url": "https://github.com/raychenfj/vue-uweb/issues", "email": "raychenfj@gmail.com", "files": [ "dist", "src" ], "scripts": { "clean": "rimraf dist", "build": "node build/build.js", "build:dll": "webpack --progress --config build/webpack.config.dll.js", "lint": "yon run lint:js", "lint:js": "eslint --ext js --ext jsx --ext vue src test/**/*.spec.js test/*.js build", "lint:js:fix": "yon run lint:js -- --fix", "lint:staged": "lint-staged", "pretest": "yon run lint", "test": "cross-env BABEL_ENV=test karma start test/karma.conf.js --single-run", "dev": "webpack-dashboard -- webpack-dev-server --config build/webpack.config.dev.js --open", "dev:coverage": "cross-env BABEL_ENV=test karma start test/karma.conf.js", "prepublishOnly": "yon run build" }, "dependencies": { "deep-equal": "^1.0.1" }, "devDependencies": { "add-asset-html-webpack-plugin": "^2.0.0", "babel-core": "^6.24.0", "babel-eslint": "^7.2.0", "babel-helper-vue-jsx-merge-props": "^2.0.0", "babel-loader": "^7.0.0", "babel-plugin-istanbul": "^4.1.0", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-vue-jsx": "^3.4.0", "babel-preset-env": "^1.4.0", "buble": "^0.15.2", "chai": "^3.5.0", "chai-dom": "^1.4.0", "clean-css": "^4.0.0", "cross-env": "^4.0.0", "css-loader": "^0.28.0", "eslint": "^4.18.2", "eslint-config-vue": "^2.0.0", "eslint-plugin-vue": "^2.0.0", "extract-text-webpack-plugin": "^2.1.0", "html-webpack-plugin": "^2.28.0", "karma": "^1.7.0", "karma-chai-dom": "^1.1.0", "karma-chrome-launcher": "^2.1.0", "karma-coverage": "^1.1.0", "karma-mocha": "^1.3.0", "karma-phantomjs-launcher": "^1.0.4", "karma-sinon-chai": "^1.3.0", "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "^0.0.31", "karma-webpack": "^2.0.0", "lint-staged": "^3.4.0", "mkdirp": "^0.5.1", "mocha": "^3.3.0", "mocha-css": "^1.0.1", "phantomjs-polyfill-find": "github:ptim/phantomjs-polyfill-find", "phantomjs-polyfill-find-index": "^1.0.1", "postcss": "^6.0.0", "postcss-cssnext": "^2.10.0", "pre-commit": "^1.2.0", "rimraf": "^2.6.0", "rollup": "^0.41.6", "rollup-plugin-buble": "^0.15.0", "rollup-plugin-commonjs": "^8.0.0", "rollup-plugin-jsx": "^1.0.0", "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-postcss": "^0.4.1", "rollup-plugin-replace": "^1.1.0", "rollup-plugin-vue": "^2.3.0", "sinon": "2.2.0", "sinon-chai": "^2.10.0", "style-loader": "^0.17.0", "stylefmt": "^5.3.0", "stylelint": "^7.10.0", "stylelint-config-standard": "^16.0.0", "stylelint-processor-html": "^1.0.0", "uglify-js": "^3.0.0", "uppercamelcase": "^3.0.0", "vue": "^2.3.0", "vue-loader": "^12.0.0", "vue-template-compiler": "^2.3.0", "webpack": "^2.5.0", "webpack-bundle-analyzer": "^3.3.2", "webpack-dashboard": "^0.4.0", "webpack-dev-server": "^3.1.11", "webpack-merge": "^4.0.0", "yarn-or-npm": "^2.0.0" }, "peerDependencies": { "vue": "^2.3.0" }, "dllPlugin": { "name": "vuePluginTemplateDeps", "include": [ "mocha/mocha.js", "style-loader!css-loader!mocha-css", "html-entities", "vue/dist/vue.js", "chai", "core-js/library", "url", "sockjs-client", "vue-style-loader/lib/addStylesClient.js", "events", "ansi-html", "style-loader/addStyles.js" ] }, "license": "MIT" } ================================================ FILE: src/directives/auto-pageview.js ================================================ import uweb from '../index' import { notChanged } from './util' export default function (el, binding) { if (notChanged(binding)) return const args = [] if (binding.value === false || binding.value === 'false') args.push(false) else args.push(true) uweb.setAutoPageview(...args) } ================================================ FILE: src/directives/track-event.js ================================================ import uweb from '../index' import { notChanged, isEmpty } from './util' export default function (el, binding) { if (notChanged(binding) || isEmpty(binding)) return if (el.removeEventListeners && typeof el.removeEventListeners === 'function') { el.removeEventListeners() } let args = [] // use modifier as events const events = Object.keys(binding.modifiers).map(modifier => { if (binding.modifiers[modifier]) { return modifier } }) // passing parameters as object if (typeof binding.value === 'object') { const value = binding.value if (value.category) args.push(value.category) if (value.action) args.push(value.action) if (value.label) args.push(value.label) if (value.value) args.push(value.value) if (value.nodeid) args.push(value.nodeid) // passing parameters as string separate by comma } else if (typeof binding.value === 'string') { args = binding.value.split(',') args.forEach((arg, i) => (args[i] = arg.trim())) } if (!events.length) events.push('click') // listen click event by default // addEventListener for each event, call trackEvent api const listeners = [] events.forEach((event, index) => { listeners[index] = () => uweb.trackEvent(...args) el.addEventListener(event, listeners[index], false) }) // a function to remove all previous event listeners in update cycle to prevent duplication el.removeEventListeners = () => { events.forEach((event, index) => { el.removeEventListener(event, listeners[index]) }) } } ================================================ FILE: src/directives/track-pageview.js ================================================ import uweb from '../index' import { notChanged, isEmpty } from './util' export const watch = [] const trackPageview = { bind (el, binding) { const index = watch.findIndex(element => element === el) const isWatched = index !== -1 // watch for a v-show binded element, push it to watch queue when v-show is false if (el.style.display === 'none') { if (!isWatched) watch.push(el) return } else { // remove from watch queue when v-show is true if (isWatched) watch.splice(index, 1) } if (!isWatched && (notChanged(binding) || isEmpty(binding))) return let args = [] // passing parameters as object if (typeof binding.value === 'object') { const value = binding.value if (value.content_url) args.push(value.content_url) if (value.referer_url) args.push(value.referer_url) // passing parameters as string separate by comma } else if (typeof binding.value === 'string' && binding.value) { args = binding.value.split(',') args.forEach((arg, i) => (args[i] = arg.trim())) } uweb.trackPageview(...args) }, unbind (el, binding) { const index = watch.findIndex(element => element === el) if (index !== -1) watch.splice(index, 1) } } trackPageview.update = trackPageview.bind export default trackPageview ================================================ FILE: src/directives/util.js ================================================ import deepEqual from 'deep-equal' /** * if the binding value is equal to oldeValue */ export function notChanged (binding) { if (binding.oldValue !== undefined) { if (typeof binding.value === 'object') { return deepEqual(binding.value, binding.oldValue) } else { return binding.value === binding.oldValue } } else { return false } } /** * if the binding value is empty */ export function isEmpty (binding) { return binding.value === '' || binding.value === undefined || binding.value === null } ================================================ FILE: src/index.js ================================================ import install from './install' // deferred promise const deferred = {} deferred.promise = new Promise((resolve, reject) => { deferred.resolve = resolve deferred.reject = reject }) // uweb apis const methods = [ 'trackPageview', // http://open.cnzz.com/a/api/trackpageview/ 'trackEvent', // http://open.cnzz.com/a/api/trackevent/ 'setCustomVar', // http://open.cnzz.com/a/api/setcustomvar/ 'setAccount', // http://open.cnzz.com/a/api/setaccount/ 'setAutoPageview', // http://open.cnzz.com/a/api/setautopageview/ 'deleteCustomVar' // http://open.cnzz.com/a/api/deletecustomvar/ ] const uweb = { /** * internal user only */ _cache: [], /** * internal user only, resolve the promise */ _resolve () { deferred.resolve() }, /** * internal user only, reject the promise */ _reject () { deferred.reject() }, /** * push the args into _czc, or _cache if the script is not loaded yet */ _push () { this.debug(arguments) if (window._czc) { window._czc.push.apply(window._czc, arguments) } else { this._cache.push.apply(this._cache, arguments) } }, /** * general method to create uweb apis */ _createMethod (method) { return function () { const args = Array.prototype.slice.apply(arguments) this._push([`_${method}`, ...args]) } }, /** * debug */ debug () {}, /** * the plugins is ready when the script is loaded */ ready () { return deferred.promise }, /** * install function */ install, /** * patch up to create new api */ patch (method) { this[method] = this._createMethod(method) } } // uweb apis methods.forEach((method) => (uweb[method] = uweb._createMethod(method))) if (window.Vue) { window.uweb = uweb } export default uweb ================================================ FILE: src/install.js ================================================ import autoPageview from './directives/auto-pageview' import trackEvent from '././directives/track-event' import trackPageview from '././directives/track-pageview' /** * install * * @param {Vue} Vue * @param {Object} options * @returns */ export default function install (Vue, options) { if (!window) { if (process.env.NODE_ENV !== 'production') { console.warn('vue-uweb can only be used in browser') } return } if (this.install.installed) return if (options.debug) { this.debug = console.debug } else { this.debug = () => {} } let siteId = null // passsing siteId through object or string if (typeof options === 'object') { siteId = options.siteId if (options.autoPageview !== false) { options.autoPageview = true } } else { siteId = options } if (!siteId) { return console.error('siteId is missing') } this.install.installed = true // insert u-web statistics script const script = document.createElement('script') const src = `https://s11.cnzz.com/z_stat.php?id=${siteId}&web_id=${siteId}` script.src = options.src || src // callback when the script is loaded script.onload = () => { // if the global object is exist, resolve the promise, otherwise reject it if (window._czc) { this._resolve() } else { console.error('loading uweb statistics script failed, please check src and siteId') return this._reject() } // load from cache this._cache.forEach((cache) => { window._czc.push(cache) }) this._cache = [] } this.setAccount(options.siteId) this.setAutoPageview(options.autoPageview) document.body.appendChild(script) // store into cache when the script is not fully loaded // add $czc to Vue prototype Object.defineProperty(Vue.prototype, '$uweb', { get: () => this }) Vue.directive('auto-pageview', autoPageview) Vue.directive('track-event', trackEvent) Vue.directive('track-pageview', trackPageview) } ================================================ FILE: test/.eslintrc ================================================ { "env": { "mocha": true }, "globals": { "expect": true, "sinon": true } } ================================================ FILE: test/dist/vuePluginTemplateDeps.dll.js ================================================ var vuePluginTemplateDeps = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 463); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2); var core = __webpack_require__(15); var ctx = __webpack_require__(20); var hide = __webpack_require__(22); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var IS_WRAP = type & $export.W; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE]; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; var key, own, out; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; if (own && key in exports) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] // bind timers to global for call from export context : IS_BIND && own ? ctx(out, global) // wrap global constructors for prevent change them in library : IS_WRAP && target[key] == out ? (function (C) { var F = function (a, b, c) { if (this instanceof C) { switch (arguments.length) { case 0: return new C(); case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); } return C.apply(this, arguments); }; F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% if (IS_PROTO) { (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); } } }; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(3); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 2 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 4 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor var TempCtor = function () {} TempCtor.prototype = superCtor.prototype ctor.prototype = new TempCtor() ctor.prototype.constructor = ctor } } /***/ }), /* 5 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /* 6 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 7 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(29); var min = Math.min; module.exports = function (it) { return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__(73)('wks'); var uid = __webpack_require__(52); var Symbol = __webpack_require__(2).Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {/** * This is the web browser implementation of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = __webpack_require__(417); exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage(); /** * Colors. */ exports.colors = [ 'lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson' ]; /** * Currently only WebKit-based Web Inspectors, Firefox >= v31, * and the Firebug extension (any Firefox version) are known * to support "%c" CSS customizations. * * TODO: add a `localStorage` variable to explicitly enable/disable colors */ function useColors() { // NB: In an Electron preload script, document will be defined but not fully // initialized. Since we know we're in Chrome, we'll just detect this case // explicitly if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { return true; } // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // is firebug? http://stackoverflow.com/a/398120/376773 (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || // double check webkit in userAgent just in case we are in a worker (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } /** * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ exports.formatters.j = function(v) { try { return JSON.stringify(v); } catch (err) { return '[UnexpectedJSONParseError]: ' + err.message; } }; /** * Colorize log arguments if enabled. * * @api public */ function formatArgs(args) { var useColors = this.useColors; args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); if (!useColors) return; var c = 'color: ' + this.color; args.splice(1, 0, c, 'color: inherit') // the final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; args[0].replace(/%[a-zA-Z%]/g, function(match) { if ('%%' === match) return; index++; if ('%c' === match) { // we only are interested in the *last* %c // (the user may have provided their own) lastC = index; } }); args.splice(lastC, 0, c); } /** * Invokes `console.log()` when available. * No-op when `console.log` is not a "function". * * @api public */ function log() { // this hackery is required for IE8/9, where // the `console.log` function doesn't have 'apply' return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (null == namespaces) { exports.storage.removeItem('debug'); } else { exports.storage.debug = namespaces; } } catch(e) {} } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { var r; try { r = exports.storage.debug; } catch(e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (!r && typeof process !== 'undefined' && 'env' in process) { r = process.env.DEBUG; } return r; } /** * Enable namespaces listed in `localStorage.debug` initially. */ exports.enable(load()); /** * Localstorage attempts to return the localstorage. * * This is necessary because safari throws * when a user disables cookies/localstorage * and you attempt to access it. * * @return {LocalStorage} * @api private */ function localstorage() { try { return window.localStorage; } catch (e) {} } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(1); var IE8_DOM_DEFINE = __webpack_require__(131); var toPrimitive = __webpack_require__(40); var dP = Object.defineProperty; exports.f = __webpack_require__(12) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(5)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(30); module.exports = function (it) { return Object(defined(it)); }; /***/ }), /* 14 */ /***/ (function(module, exports) { module.exports = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /* 15 */ /***/ (function(module, exports) { var core = module.exports = { version: '2.5.3' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(56); var defined = __webpack_require__(30); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var inherits = __webpack_require__(4) , EventTarget = __webpack_require__(158) ; function EventEmitter() { EventTarget.call(this); } inherits(EventEmitter, EventTarget); EventEmitter.prototype.removeAllListeners = function(type) { if (type) { delete this._listeners[type]; } else { this._listeners = {}; } }; EventEmitter.prototype.once = function(type, listener) { var self = this , fired = false; function g() { self.removeListener(type, g); if (!fired) { fired = true; listener.apply(this, arguments); } } this.on(type, g); }; EventEmitter.prototype.emit = function() { var type = arguments[0]; var listeners = this._listeners[type]; if (!listeners) { return; } // equivalent of Array.prototype.slice.call(arguments, 1); var l = arguments.length; var args = new Array(l - 1); for (var ai = 1; ai < l; ai++) { args[ai - 1] = arguments[ai]; } for (var i = 0; i < listeners.length; i++) { listeners[i].apply(this, args); } }; EventEmitter.prototype.on = EventEmitter.prototype.addListener = EventTarget.prototype.addEventListener; EventEmitter.prototype.removeListener = EventTarget.prototype.removeEventListener; module.exports.EventEmitter = EventEmitter; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = __webpack_require__(21); var toObject = __webpack_require__(13); var IE_PROTO = __webpack_require__(98)('IE_PROTO'); var ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function (O) { O = toObject(O); if (has(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var fails = __webpack_require__(5); var defined = __webpack_require__(30); var quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) var createHTML = function (string, tag, attribute, value) { var S = String(defined(string)); var p1 = '<' + tag; if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; return p1 + '>' + S + ''; }; module.exports = function (NAME, exec) { var O = {}; O[NAME] = exec(createHTML); $export($export.P + $export.F * fails(function () { var test = ''[NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }), 'String', O); }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(14); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 21 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(11); var createDesc = __webpack_require__(39); module.exports = __webpack_require__(12) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { var pIE = __webpack_require__(58); var createDesc = __webpack_require__(39); var toIObject = __webpack_require__(16); var toPrimitive = __webpack_require__(40); var has = __webpack_require__(21); var IE8_DOM_DEFINE = __webpack_require__(131); var gOPD = Object.getOwnPropertyDescriptor; exports.f = __webpack_require__(12) ? gOPD : function getOwnPropertyDescriptor(O, P) { O = toIObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return gOPD(O, P); } catch (e) { /* empty */ } if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { var URL = __webpack_require__(172); var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = __webpack_require__(10)('sockjs-client:utils:url'); } module.exports = { getOrigin: function(url) { if (!url) { return null; } var p = new URL(url); if (p.protocol === 'file:') { return null; } var port = p.port; if (!port) { port = (p.protocol === 'https:') ? '443' : '80'; } return p.protocol + '//' + p.hostname + ':' + port; } , isOriginEqual: function(a, b) { var res = this.getOrigin(a) === this.getOrigin(b); debug('same', a, b, res); return res; } , isSchemeEqual: function(a, b) { return (a.split(':')[0] === b.split(':')[0]); } , addPath: function (url, path) { var qs = url.split('?'); return qs[0] + path + (qs[1] ? '?' + qs[1] : ''); } , addQuery: function (url, q) { return url + (url.indexOf('?') === -1 ? ('?' + q) : ('&' + q)); } }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { // 0 -> Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var ctx = __webpack_require__(20); var IObject = __webpack_require__(56); var toObject = __webpack_require__(13); var toLength = __webpack_require__(8); var asc = __webpack_require__(80); module.exports = function (TYPE, $create) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; var create = $create || asc; return function ($this, callbackfn, that) { var O = toObject($this); var self = IObject(O); var f = ctx(callbackfn, that, 3); var length = toLength(self.length); var index = 0; var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var val, res; for (;length > index; index++) if (NO_HOLES || index in self) { val = self[index]; res = f(val, index, O); if (TYPE) { if (IS_MAP) result[index] = res; // map else if (res) switch (TYPE) { case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if (IS_EVERY) return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(5); module.exports = function (method, arg) { return !!method && fails(function () { // eslint-disable-next-line no-useless-call arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); }); }; /***/ }), /* 27 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives var $export = __webpack_require__(0); var core = __webpack_require__(15); var fails = __webpack_require__(5); module.exports = function (KEY, exec) { var fn = (core.Object || {})[KEY] || Object[KEY]; var exp = {}; exp[KEY] = exec(fn); $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); }; /***/ }), /* 29 */ /***/ (function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; module.exports = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 30 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { var Map = __webpack_require__(154); var $export = __webpack_require__(0); var shared = __webpack_require__(73)('metadata'); var store = shared.store || (shared.store = new (__webpack_require__(156))()); var getOrCreateMetadataMap = function (target, targetKey, create) { var targetMetadata = store.get(target); if (!targetMetadata) { if (!create) return undefined; store.set(target, targetMetadata = new Map()); } var keyMetadata = targetMetadata.get(targetKey); if (!keyMetadata) { if (!create) return undefined; targetMetadata.set(targetKey, keyMetadata = new Map()); } return keyMetadata; }; var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? false : metadataMap.has(MetadataKey); }; var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); }; var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); }; var ordinaryOwnMetadataKeys = function (target, targetKey) { var metadataMap = getOrCreateMetadataMap(target, targetKey, false); var keys = []; if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); return keys; }; var toMetaKey = function (it) { return it === undefined || typeof it == 'symbol' ? it : String(it); }; var exp = function (O) { $export($export.S, 'Reflect', O); }; module.exports = { store: store, map: getOrCreateMetadataMap, has: ordinaryHasOwnMetadata, get: ordinaryGetOwnMetadata, set: ordinaryDefineOwnMetadata, keys: ordinaryOwnMetadataKeys, key: toMetaKey, exp: exp }; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; if (__webpack_require__(12)) { var LIBRARY = __webpack_require__(46); var global = __webpack_require__(2); var fails = __webpack_require__(5); var $export = __webpack_require__(0); var $typed = __webpack_require__(75); var $buffer = __webpack_require__(104); var ctx = __webpack_require__(20); var anInstance = __webpack_require__(43); var propertyDesc = __webpack_require__(39); var hide = __webpack_require__(22); var redefineAll = __webpack_require__(47); var toInteger = __webpack_require__(29); var toLength = __webpack_require__(8); var toIndex = __webpack_require__(151); var toAbsoluteIndex = __webpack_require__(49); var toPrimitive = __webpack_require__(40); var has = __webpack_require__(21); var classof = __webpack_require__(44); var isObject = __webpack_require__(3); var toObject = __webpack_require__(13); var isArrayIter = __webpack_require__(87); var create = __webpack_require__(37); var getPrototypeOf = __webpack_require__(18); var gOPN = __webpack_require__(57).f; var getIterFn = __webpack_require__(60); var uid = __webpack_require__(52); var wks = __webpack_require__(9); var createArrayMethod = __webpack_require__(25); var createArrayIncludes = __webpack_require__(64); var speciesConstructor = __webpack_require__(74); var ArrayIterators = __webpack_require__(107); var Iterators = __webpack_require__(45); var $iterDetect = __webpack_require__(88); var setSpecies = __webpack_require__(48); var arrayFill = __webpack_require__(79); var arrayCopyWithin = __webpack_require__(122); var $DP = __webpack_require__(11); var $GOPD = __webpack_require__(23); var dP = $DP.f; var gOPD = $GOPD.f; var RangeError = global.RangeError; var TypeError = global.TypeError; var Uint8Array = global.Uint8Array; var ARRAY_BUFFER = 'ArrayBuffer'; var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; var PROTOTYPE = 'prototype'; var ArrayProto = Array[PROTOTYPE]; var $ArrayBuffer = $buffer.ArrayBuffer; var $DataView = $buffer.DataView; var arrayForEach = createArrayMethod(0); var arrayFilter = createArrayMethod(2); var arraySome = createArrayMethod(3); var arrayEvery = createArrayMethod(4); var arrayFind = createArrayMethod(5); var arrayFindIndex = createArrayMethod(6); var arrayIncludes = createArrayIncludes(true); var arrayIndexOf = createArrayIncludes(false); var arrayValues = ArrayIterators.values; var arrayKeys = ArrayIterators.keys; var arrayEntries = ArrayIterators.entries; var arrayLastIndexOf = ArrayProto.lastIndexOf; var arrayReduce = ArrayProto.reduce; var arrayReduceRight = ArrayProto.reduceRight; var arrayJoin = ArrayProto.join; var arraySort = ArrayProto.sort; var arraySlice = ArrayProto.slice; var arrayToString = ArrayProto.toString; var arrayToLocaleString = ArrayProto.toLocaleString; var ITERATOR = wks('iterator'); var TAG = wks('toStringTag'); var TYPED_CONSTRUCTOR = uid('typed_constructor'); var DEF_CONSTRUCTOR = uid('def_constructor'); var ALL_CONSTRUCTORS = $typed.CONSTR; var TYPED_ARRAY = $typed.TYPED; var VIEW = $typed.VIEW; var WRONG_LENGTH = 'Wrong length!'; var $map = createArrayMethod(1, function (O, length) { return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); }); var LITTLE_ENDIAN = fails(function () { // eslint-disable-next-line no-undef return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; }); var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { new Uint8Array(1).set({}); }); var toOffset = function (it, BYTES) { var offset = toInteger(it); if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); return offset; }; var validate = function (it) { if (isObject(it) && TYPED_ARRAY in it) return it; throw TypeError(it + ' is not a typed array!'); }; var allocate = function (C, length) { if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { throw TypeError('It is not a typed array constructor!'); } return new C(length); }; var speciesFromList = function (O, list) { return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); }; var fromList = function (C, list) { var index = 0; var length = list.length; var result = allocate(C, length); while (length > index) result[index] = list[index++]; return result; }; var addGetter = function (it, key, internal) { dP(it, key, { get: function () { return this._d[internal]; } }); }; var $from = function from(source /* , mapfn, thisArg */) { var O = toObject(source); var aLen = arguments.length; var mapfn = aLen > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var iterFn = getIterFn(O); var i, length, values, result, step, iterator; if (iterFn != undefined && !isArrayIter(iterFn)) { for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { values.push(step.value); } O = values; } if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { result[i] = mapping ? mapfn(O[i], i) : O[i]; } return result; }; var $of = function of(/* ...items */) { var index = 0; var length = arguments.length; var result = allocate(this, length); while (length > index) result[index] = arguments[index++]; return result; }; // iOS Safari 6.x fails here var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); var $toLocaleString = function toLocaleString() { return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); }; var proto = { copyWithin: function copyWithin(target, start /* , end */) { return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }, every: function every(callbackfn /* , thisArg */) { return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars return arrayFill.apply(validate(this), arguments); }, filter: function filter(callbackfn /* , thisArg */) { return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined)); }, find: function find(predicate /* , thisArg */) { return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, findIndex: function findIndex(predicate /* , thisArg */) { return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, forEach: function forEach(callbackfn /* , thisArg */) { arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, indexOf: function indexOf(searchElement /* , fromIndex */) { return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, includes: function includes(searchElement /* , fromIndex */) { return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, join: function join(separator) { // eslint-disable-line no-unused-vars return arrayJoin.apply(validate(this), arguments); }, lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars return arrayLastIndexOf.apply(validate(this), arguments); }, map: function map(mapfn /* , thisArg */) { return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); }, reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars return arrayReduce.apply(validate(this), arguments); }, reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars return arrayReduceRight.apply(validate(this), arguments); }, reverse: function reverse() { var that = this; var length = validate(that).length; var middle = Math.floor(length / 2); var index = 0; var value; while (index < middle) { value = that[index]; that[index++] = that[--length]; that[length] = value; } return that; }, some: function some(callbackfn /* , thisArg */) { return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, sort: function sort(comparefn) { return arraySort.call(validate(this), comparefn); }, subarray: function subarray(begin, end) { var O = validate(this); var length = O.length; var $begin = toAbsoluteIndex(begin, length); return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) ); } }; var $slice = function slice(start, end) { return speciesFromList(this, arraySlice.call(validate(this), start, end)); }; var $set = function set(arrayLike /* , offset */) { validate(this); var offset = toOffset(arguments[1], 1); var length = this.length; var src = toObject(arrayLike); var len = toLength(src.length); var index = 0; if (len + offset > length) throw RangeError(WRONG_LENGTH); while (index < len) this[offset + index] = src[index++]; }; var $iterators = { entries: function entries() { return arrayEntries.call(validate(this)); }, keys: function keys() { return arrayKeys.call(validate(this)); }, values: function values() { return arrayValues.call(validate(this)); } }; var isTAIndex = function (target, key) { return isObject(target) && target[TYPED_ARRAY] && typeof key != 'symbol' && key in target && String(+key) == String(key); }; var $getDesc = function getOwnPropertyDescriptor(target, key) { return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key); }; var $setDesc = function defineProperty(target, key, desc) { if (isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set') // TODO: add validation descriptor w/o calling accessors && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable) ) { target[key] = desc.value; return target; } return dP(target, key, desc); }; if (!ALL_CONSTRUCTORS) { $GOPD.f = $getDesc; $DP.f = $setDesc; } $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { getOwnPropertyDescriptor: $getDesc, defineProperty: $setDesc }); if (fails(function () { arrayToString.call({}); })) { arrayToString = arrayToLocaleString = function toString() { return arrayJoin.call(this); }; } var $TypedArrayPrototype$ = redefineAll({}, proto); redefineAll($TypedArrayPrototype$, $iterators); hide($TypedArrayPrototype$, ITERATOR, $iterators.values); redefineAll($TypedArrayPrototype$, { slice: $slice, set: $set, constructor: function () { /* noop */ }, toString: arrayToString, toLocaleString: $toLocaleString }); addGetter($TypedArrayPrototype$, 'buffer', 'b'); addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); addGetter($TypedArrayPrototype$, 'byteLength', 'l'); addGetter($TypedArrayPrototype$, 'length', 'e'); dP($TypedArrayPrototype$, TAG, { get: function () { return this[TYPED_ARRAY]; } }); // eslint-disable-next-line max-statements module.exports = function (KEY, BYTES, wrapper, CLAMPED) { CLAMPED = !!CLAMPED; var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; var GETTER = 'get' + KEY; var SETTER = 'set' + KEY; var TypedArray = global[NAME]; var Base = TypedArray || {}; var TAC = TypedArray && getPrototypeOf(TypedArray); var FORCED = !TypedArray || !$typed.ABV; var O = {}; var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; var getter = function (that, index) { var data = that._d; return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); }; var setter = function (that, index, value) { var data = that._d; if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); }; var addElement = function (that, index) { dP(that, index, { get: function () { return getter(this, index); }, set: function (value) { return setter(this, index, value); }, enumerable: true }); }; if (FORCED) { TypedArray = wrapper(function (that, data, $offset, $length) { anInstance(that, TypedArray, NAME, '_d'); var index = 0; var offset = 0; var buffer, byteLength, length, klass; if (!isObject(data)) { length = toIndex(data); byteLength = length * BYTES; buffer = new $ArrayBuffer(byteLength); } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { buffer = data; offset = toOffset($offset, BYTES); var $len = data.byteLength; if ($length === undefined) { if ($len % BYTES) throw RangeError(WRONG_LENGTH); byteLength = $len - offset; if (byteLength < 0) throw RangeError(WRONG_LENGTH); } else { byteLength = toLength($length) * BYTES; if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); } length = byteLength / BYTES; } else if (TYPED_ARRAY in data) { return fromList(TypedArray, data); } else { return $from.call(TypedArray, data); } hide(that, '_d', { b: buffer, o: offset, l: byteLength, e: length, v: new $DataView(buffer) }); while (index < length) addElement(that, index++); }); TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); hide(TypedArrayPrototype, 'constructor', TypedArray); } else if (!fails(function () { TypedArray(1); }) || !fails(function () { new TypedArray(-1); // eslint-disable-line no-new }) || !$iterDetect(function (iter) { new TypedArray(); // eslint-disable-line no-new new TypedArray(null); // eslint-disable-line no-new new TypedArray(1.5); // eslint-disable-line no-new new TypedArray(iter); // eslint-disable-line no-new }, true)) { TypedArray = wrapper(function (that, data, $offset, $length) { anInstance(that, TypedArray, NAME); var klass; // `ws` module bug, temporarily remove validation length for Uint8Array // https://github.com/websockets/ws/pull/645 if (!isObject(data)) return new Base(toIndex(data)); if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data); } if (TYPED_ARRAY in data) return fromList(TypedArray, data); return $from.call(TypedArray, data); }); arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); }); TypedArray[PROTOTYPE] = TypedArrayPrototype; if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; } var $nativeIterator = TypedArrayPrototype[ITERATOR]; var CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); var $iterator = $iterators.values; hide(TypedArray, TYPED_CONSTRUCTOR, true); hide(TypedArrayPrototype, TYPED_ARRAY, NAME); hide(TypedArrayPrototype, VIEW, true); hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { dP(TypedArrayPrototype, TAG, { get: function () { return NAME; } }); } O[NAME] = TypedArray; $export($export.G + $export.W + $export.F * (TypedArray != Base), O); $export($export.S, NAME, { BYTES_PER_ELEMENT: BYTES }); $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { from: $from, of: $of }); if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); $export($export.P, NAME, proto); setSpecies(NAME); $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; $export($export.P + $export.F * fails(function () { new TypedArray(1).slice(); }), NAME, { slice: $slice }); $export($export.P + $export.F * (fails(function () { return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); }) || !fails(function () { TypedArrayPrototype.toLocaleString.call([1, 2]); })), NAME, { toLocaleString: $toLocaleString }); Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); }; } else module.exports = function () { /* empty */ }; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ ;(function () { // Detect the `define` function exposed by asynchronous module loaders. The // strict `define` check is necessary for compatibility with `r.js`. var isLoader = "function" === "function" && __webpack_require__(462); // A set of types used to distinguish objects from primitives. var objectTypes = { "function": true, "object": true }; // Detect the `exports` object exposed by CommonJS implementations. var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via // `insert-module-globals`), Narwhal, and Ringo as the default context, // and the `window` object in browsers. Rhino exports a `global` function // instead. var root = objectTypes[typeof window] && window || this, freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global; if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) { root = freeGlobal; } // Public: Initializes JSON 3 using the given `context` object, attaching the // `stringify` and `parse` functions to the specified `exports` object. function runInContext(context, exports) { context || (context = root["Object"]()); exports || (exports = root["Object"]()); // Native constructor aliases. var Number = context["Number"] || root["Number"], String = context["String"] || root["String"], Object = context["Object"] || root["Object"], Date = context["Date"] || root["Date"], SyntaxError = context["SyntaxError"] || root["SyntaxError"], TypeError = context["TypeError"] || root["TypeError"], Math = context["Math"] || root["Math"], nativeJSON = context["JSON"] || root["JSON"]; // Delegate to the native `stringify` and `parse` implementations. if (typeof nativeJSON == "object" && nativeJSON) { exports.stringify = nativeJSON.stringify; exports.parse = nativeJSON.parse; } // Convenience aliases. var objectProto = Object.prototype, getClass = objectProto.toString, isProperty, forEach, undef; // Test the `Date#getUTC*` methods. Based on work by @Yaffle. var isExtended = new Date(-3509827334573292); try { // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical // results for certain dates in Opera >= 10.53. isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && // Safari < 2.0.2 stores the internal millisecond time value correctly, // but clips the values returned by the date methods to the range of // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; } catch (exception) {} // Internal: Determines whether the native `JSON.stringify` and `parse` // implementations are spec-compliant. Based on work by Ken Snyder. function has(name) { if (has[name] !== undef) { // Return cached feature test result. return has[name]; } var isSupported; if (name == "bug-string-char-index") { // IE <= 7 doesn't support accessing string characters using square // bracket notation. IE 8 only supports this for primitives. isSupported = "a"[0] != "a"; } else if (name == "json") { // Indicates whether both `JSON.stringify` and `JSON.parse` are // supported. isSupported = has("json-stringify") && has("json-parse"); } else { var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; // Test `JSON.stringify`. if (name == "json-stringify") { var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended; if (stringifySupported) { // A test function object with a custom `toJSON` method. (value = function () { return 1; }).toJSON = value; try { stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean // primitives as object literals. stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object // literals. stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or // does not define a canonical JSON representation (this applies to // objects with `toJSON` properties as well, *unless* they are nested // within an object or array). stringify(getClass) === undef && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and // FF 3.1b3 pass this test. stringify(undef) === undef && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, // respectively, if the value is omitted entirely. stringify() === undef && // FF 3.1b1, 2 throw an error if the given value is not a number, // string, array, object, Boolean, or `null` literal. This applies to // objects with custom `toJSON` methods as well, unless they are nested // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` // methods entirely. stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of // `"[null]"`. stringify([undef]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 // elides non-JSON values from objects and arrays, unless they // define custom `toJSON` methods. stringify([undef, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences // where character escape codes are expected (e.g., `\b` => `\u0008`). stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly // serialize extended years. stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative // four-digit years instead of six-digit years. Credits: @Yaffle. stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond // values less than 1000. Credits: @Yaffle. stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; } catch (exception) { stringifySupported = false; } } isSupported = stringifySupported; } // Test `JSON.parse`. if (name == "json-parse") { var parse = exports.parse; if (typeof parse == "function") { try { // FF 3.1b1, b2 will throw an exception if a bare literal is provided. // Conforming implementations should also coerce the initial argument to // a string prior to parsing. if (parse("0") === 0 && !parse(false)) { // Simple parsing test. value = parse(serialized); var parseSupported = value["a"].length == 5 && value["a"][0] === 1; if (parseSupported) { try { // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. parseSupported = !parse('"\t"'); } catch (exception) {} if (parseSupported) { try { // FF 4.0 and 4.0.1 allow leading `+` signs and leading // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow // certain octal literals. parseSupported = parse("01") !== 1; } catch (exception) {} } if (parseSupported) { try { // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal // points. These environments, along with FF 3.1b1 and 2, // also allow trailing commas in JSON objects and arrays. parseSupported = parse("1.") !== 1; } catch (exception) {} } } } } catch (exception) { parseSupported = false; } } isSupported = parseSupported; } } return has[name] = !!isSupported; } if (!has("json")) { // Common `[[Class]]` name aliases. var functionClass = "[object Function]", dateClass = "[object Date]", numberClass = "[object Number]", stringClass = "[object String]", arrayClass = "[object Array]", booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. var charIndexBuggy = has("bug-string-char-index"); // Define additional utility methods if the `Date` methods are buggy. if (!isExtended) { var floor = Math.floor; // A mapping between the months of the year and the number of days between // January 1st and the first of the respective month. var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the // first day of the given month. var getDay = function (year, month) { return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); }; } // Internal: Determines if a property is a direct property of the given // object. Delegates to the native `Object#hasOwnProperty` method. if (!(isProperty = objectProto.hasOwnProperty)) { isProperty = function (property) { var members = {}, constructor; if ((members.__proto__ = null, members.__proto__ = { // The *proto* property cannot be set multiple times in recent // versions of Firefox and SeaMonkey. "toString": 1 }, members).toString != getClass) { // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but // supports the mutable *proto* property. isProperty = function (property) { // Capture and break the object's prototype chain (see section 8.6.2 // of the ES 5.1 spec). The parenthesized expression prevents an // unsafe transformation by the Closure Compiler. var original = this.__proto__, result = property in (this.__proto__ = null, this); // Restore the original prototype chain. this.__proto__ = original; return result; }; } else { // Capture a reference to the top-level `Object` constructor. constructor = members.constructor; // Use the `constructor` property to simulate `Object#hasOwnProperty` in // other environments. isProperty = function (property) { var parent = (this.constructor || constructor).prototype; return property in this && !(property in parent && this[property] === parent[property]); }; } members = null; return isProperty.call(this, property); }; } // Internal: Normalizes the `for...in` iteration algorithm across // environments. Each enumerated key is yielded to a `callback` function. forEach = function (object, callback) { var size = 0, Properties, members, property; // Tests for bugs in the current environment's `for...in` algorithm. The // `valueOf` property inherits the non-enumerable flag from // `Object.prototype` in older versions of IE, Netscape, and Mozilla. (Properties = function () { this.valueOf = 0; }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. members = new Properties(); for (property in members) { // Ignore all properties inherited from `Object.prototype`. if (isProperty.call(members, property)) { size++; } } Properties = members = null; // Normalize the iteration algorithm. if (!size) { // A list of non-enumerable properties inherited from `Object.prototype`. members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable // properties. forEach = function (object, callback) { var isFunction = getClass.call(object) == functionClass, property, length; var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty; for (property in object) { // Gecko <= 1.0 enumerates the `prototype` property of functions under // certain conditions; IE does not. if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { callback(property); } } // Manually invoke the callback for each non-enumerable property. for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); }; } else if (size == 2) { // Safari <= 2.0.4 enumerates shadowed properties twice. forEach = function (object, callback) { // Create a set of iterated properties. var members = {}, isFunction = getClass.call(object) == functionClass, property; for (property in object) { // Store each property name to prevent double enumeration. The // `prototype` property of functions is not enumerated due to cross- // environment inconsistencies. if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { callback(property); } } }; } else { // No bugs detected; use the standard `for...in` algorithm. forEach = function (object, callback) { var isFunction = getClass.call(object) == functionClass, property, isConstructor; for (property in object) { if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { callback(property); } } // Manually invoke the callback for the `constructor` property due to // cross-environment inconsistencies. if (isConstructor || isProperty.call(object, (property = "constructor"))) { callback(property); } }; } return forEach(object, callback); }; // Public: Serializes a JavaScript `value` as a JSON string. The optional // `filter` argument may specify either a function that alters how object and // array members are serialized, or an array of strings and numbers that // indicates which properties should be serialized. The optional `width` // argument may be either a string or number that specifies the indentation // level of the output. if (!has("json-stringify")) { // Internal: A map of control characters and their escaped equivalents. var Escapes = { 92: "\\\\", 34: '\\"', 8: "\\b", 12: "\\f", 10: "\\n", 13: "\\r", 9: "\\t" }; // Internal: Converts `value` into a zero-padded string such that its // length is at least equal to `width`. The `width` must be <= 6. var leadingZeroes = "000000"; var toPaddedString = function (width, value) { // The `|| 0` expression is necessary to work around a bug in // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. return (leadingZeroes + (value || 0)).slice(-width); }; // Internal: Double-quotes a string `value`, replacing all ASCII control // characters (characters with code unit values between 0 and 31) with // their escaped equivalents. This is an implementation of the // `Quote(value)` operation defined in ES 5.1 section 15.12.3. var unicodePrefix = "\\u00"; var quote = function (value) { var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); for (; index < length; index++) { var charCode = value.charCodeAt(index); // If the character is a control character, append its Unicode or // shorthand escape sequence; otherwise, append the character as-is. switch (charCode) { case 8: case 9: case 10: case 12: case 13: case 34: case 92: result += Escapes[charCode]; break; default: if (charCode < 32) { result += unicodePrefix + toPaddedString(2, charCode.toString(16)); break; } result += useCharIndex ? symbols[index] : value.charAt(index); } } return result + '"'; }; // Internal: Recursively serializes an object. Implements the // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; try { // Necessary for host object support. value = object[property]; } catch (exception) {} if (typeof value == "object" && value) { className = getClass.call(value); if (className == dateClass && !isProperty.call(value, "toJSON")) { if (value > -1 / 0 && value < 1 / 0) { // Dates are serialized according to the `Date#toJSON` method // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 // for the ISO 8601 date time string format. if (getDay) { // Manually compute the year, month, date, hours, minutes, // seconds, and milliseconds if the `getUTC*` methods are // buggy. Adapted from @Yaffle's `date-shim` project. date = floor(value / 864e5); for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used // to compute `A modulo B`, as the `%` operator does not // correspond to the `modulo` operation for negative numbers. time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by // decomposing the time within the day. See section 15.9.1.10. hours = floor(time / 36e5) % 24; minutes = floor(time / 6e4) % 60; seconds = floor(time / 1e3) % 60; milliseconds = time % 1e3; } else { year = value.getUTCFullYear(); month = value.getUTCMonth(); date = value.getUTCDate(); hours = value.getUTCHours(); minutes = value.getUTCMinutes(); seconds = value.getUTCSeconds(); milliseconds = value.getUTCMilliseconds(); } // Serialize extended years correctly. value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two // digits; milliseconds should have three. "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. "." + toPaddedString(3, milliseconds) + "Z"; } else { value = null; } } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 // ignores all `toJSON` methods on these objects unless they are // defined directly on an instance. value = value.toJSON(property); } } if (callback) { // If a replacement function was provided, call it to obtain the value // for serialization. value = callback.call(object, property, value); } if (value === null) { return "null"; } className = getClass.call(value); if (className == booleanClass) { // Booleans are represented literally. return "" + value; } else if (className == numberClass) { // JSON numbers must be finite. `Infinity` and `NaN` are serialized as // `"null"`. return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; } else if (className == stringClass) { // Strings are double-quoted and escaped. return quote("" + value); } // Recursively serialize objects and arrays. if (typeof value == "object") { // Check for cyclic structures. This is a linear search; performance // is inversely proportional to the number of unique nested objects. for (length = stack.length; length--;) { if (stack[length] === value) { // Cyclic structures cannot be serialized by `JSON.stringify`. throw TypeError(); } } // Add the object to the stack of traversed objects. stack.push(value); results = []; // Save the current indentation level and indent one additional level. prefix = indentation; indentation += whitespace; if (className == arrayClass) { // Recursively serialize array elements. for (index = 0, length = value.length; index < length; index++) { element = serialize(index, value, callback, properties, whitespace, indentation, stack); results.push(element === undef ? "null" : element); } result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; } else { // Recursively serialize object members. Members are selected from // either a user-specified list of property names, or the object // itself. forEach(properties || value, function (property) { var element = serialize(property, value, callback, properties, whitespace, indentation, stack); if (element !== undef) { // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} // is not the empty string, let `member` {quote(property) + ":"} // be the concatenation of `member` and the `space` character." // The "`space` character" refers to the literal space // character, not the `space` {width} argument provided to // `JSON.stringify`. results.push(quote(property) + ":" + (whitespace ? " " : "") + element); } }); result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; } // Remove the object from the traversed object stack. stack.pop(); return result; } }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. exports.stringify = function (source, filter, width) { var whitespace, callback, properties, className; if (objectTypes[typeof filter] && filter) { if ((className = getClass.call(filter)) == functionClass) { callback = filter; } else if (className == arrayClass) { // Convert the property names array into a makeshift set. properties = {}; for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); } } if (width) { if ((className = getClass.call(width)) == numberClass) { // Convert the `width` to an integer and create a string containing // `width` number of space characters. if ((width -= width % 1) > 0) { for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); } } else if (className == stringClass) { whitespace = width.length <= 10 ? width : width.slice(0, 10); } } // Opera <= 7.54u2 discards the values associated with empty string keys // (`""`) only if they are used directly within an object member list // (e.g., `!("" in { "": 1})`). return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); }; } // Public: Parses a JSON source string. if (!has("json-parse")) { var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped // equivalents. var Unescapes = { 92: "\\", 34: '"', 47: "/", 98: "\b", 116: "\t", 110: "\n", 102: "\f", 114: "\r" }; // Internal: Stores the parser state. var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. var abort = function () { Index = Source = null; throw SyntaxError(); }; // Internal: Returns the next token, or `"$"` if the parser has reached // the end of the source string. A token may be a string, number, `null` // literal, or Boolean literal. var lex = function () { var source = Source, length = source.length, value, begin, position, isSigned, charCode; while (Index < length) { charCode = source.charCodeAt(Index); switch (charCode) { case 9: case 10: case 13: case 32: // Skip whitespace tokens, including tabs, carriage returns, line // feeds, and space characters. Index++; break; case 123: case 125: case 91: case 93: case 58: case 44: // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at // the current position. value = charIndexBuggy ? source.charAt(Index) : source[Index]; Index++; return value; case 34: // `"` delimits a JSON string; advance to the next character and // begin parsing the string. String tokens are prefixed with the // sentinel `@` character to distinguish them from punctuators and // end-of-string tokens. for (value = "@", Index++; Index < length;) { charCode = source.charCodeAt(Index); if (charCode < 32) { // Unescaped ASCII control characters (those with a code unit // less than the space character) are not permitted. abort(); } else if (charCode == 92) { // A reverse solidus (`\`) marks the beginning of an escaped // control character (including `"`, `\`, and `/`) or Unicode // escape sequence. charCode = source.charCodeAt(++Index); switch (charCode) { case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: // Revive escaped control characters. value += Unescapes[charCode]; Index++; break; case 117: // `\u` marks the beginning of a Unicode escape sequence. // Advance to the first character and validate the // four-digit code point. begin = ++Index; for (position = Index + 4; Index < position; Index++) { charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- // insensitive) that form a single hexadecimal value. if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { // Invalid Unicode escape sequence. abort(); } } // Revive the escaped character. value += fromCharCode("0x" + source.slice(begin, Index)); break; default: // Invalid escape sequence. abort(); } } else { if (charCode == 34) { // An unescaped double-quote character marks the end of the // string. break; } charCode = source.charCodeAt(Index); begin = Index; // Optimize for the common case where a string is valid. while (charCode >= 32 && charCode != 92 && charCode != 34) { charCode = source.charCodeAt(++Index); } // Append the string as-is. value += source.slice(begin, Index); } } if (source.charCodeAt(Index) == 34) { // Advance to the next character and return the revived string. Index++; return value; } // Unterminated string. abort(); default: // Parse numbers and literals. begin = Index; // Advance past the negative sign, if one is specified. if (charCode == 45) { isSigned = true; charCode = source.charCodeAt(++Index); } // Parse an integer or floating-point value. if (charCode >= 48 && charCode <= 57) { // Leading zeroes are interpreted as octal literals. if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { // Illegal octal literal. abort(); } isSigned = false; // Parse the integer component. for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); // Floats cannot contain a leading decimal point; however, this // case is already accounted for by the parser. if (source.charCodeAt(Index) == 46) { position = ++Index; // Parse the decimal component. for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); if (position == Index) { // Illegal trailing decimal. abort(); } Index = position; } // Parse exponents. The `e` denoting the exponent is // case-insensitive. charCode = source.charCodeAt(Index); if (charCode == 101 || charCode == 69) { charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is // specified. if (charCode == 43 || charCode == 45) { Index++; } // Parse the exponential component. for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); if (position == Index) { // Illegal empty exponent. abort(); } Index = position; } // Coerce the parsed value to a JavaScript number. return +source.slice(begin, Index); } // A negative sign may only precede numbers. if (isSigned) { abort(); } // `true`, `false`, and `null` literals. if (source.slice(Index, Index + 4) == "true") { Index += 4; return true; } else if (source.slice(Index, Index + 5) == "false") { Index += 5; return false; } else if (source.slice(Index, Index + 4) == "null") { Index += 4; return null; } // Unrecognized token. abort(); } } // Return the sentinel `$` character if the parser has reached the end // of the source string. return "$"; }; // Internal: Parses a JSON `value` token. var get = function (value) { var results, hasMembers; if (value == "$") { // Unexpected end of input. abort(); } if (typeof value == "string") { if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { // Remove the sentinel `@` character. return value.slice(1); } // Parse object and array literals. if (value == "[") { // Parses a JSON array, returning a new JavaScript array. results = []; for (;; hasMembers || (hasMembers = true)) { value = lex(); // A closing square bracket marks the end of the array literal. if (value == "]") { break; } // If the array literal contains elements, the current token // should be a comma separating the previous element from the // next. if (hasMembers) { if (value == ",") { value = lex(); if (value == "]") { // Unexpected trailing `,` in array literal. abort(); } } else { // A `,` must separate each array element. abort(); } } // Elisions and leading commas are not permitted. if (value == ",") { abort(); } results.push(get(value)); } return results; } else if (value == "{") { // Parses a JSON object, returning a new JavaScript object. results = {}; for (;; hasMembers || (hasMembers = true)) { value = lex(); // A closing curly brace marks the end of the object literal. if (value == "}") { break; } // If the object literal contains members, the current token // should be a comma separator. if (hasMembers) { if (value == ",") { value = lex(); if (value == "}") { // Unexpected trailing `,` in object literal. abort(); } } else { // A `,` must separate each object member. abort(); } } // Leading commas are not permitted, object property names must be // double-quoted strings, and a `:` must separate each property // name and value. if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { abort(); } results[value.slice(1)] = get(lex()); } return results; } // Unexpected token encountered. abort(); } return value; }; // Internal: Updates a traversed object member. var update = function (source, property, callback) { var element = walk(source, property, callback); if (element === undef) { delete source[property]; } else { source[property] = element; } }; // Internal: Recursively traverses a parsed JSON object, invoking the // `callback` function for each value. This is an implementation of the // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. var walk = function (source, property, callback) { var value = source[property], length; if (typeof value == "object" && value) { // `forEach` can't be used to traverse an array in Opera <= 8.54 // because its `Object#hasOwnProperty` implementation returns `false` // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). if (getClass.call(value) == arrayClass) { for (length = value.length; length--;) { update(value, length, callback); } } else { forEach(value, function (property) { update(value, property, callback); }); } } return callback.call(source, property, value); }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. exports.parse = function (source, callback) { var result, value; Index = 0; Source = "" + source; result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. if (lex() != "$") { abort(); } // Reset the parser state. Index = Source = null; return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; }; } } exports["runInContext"] = runInContext; return exports; } if (freeExports && !isLoader) { // Export for CommonJS environments. runInContext(root, freeExports); } else { // Export for web browsers and JavaScript engines. var nativeJSON = root.JSON, previousJSON = root["JSON3"], isRestored = false; var JSON3 = runInContext(root, (root["JSON3"] = { // Public: Restores the original value of the global `JSON` object and // returns a reference to the `JSON3` object. "noConflict": function () { if (!isRestored) { isRestored = true; root.JSON = nativeJSON; root["JSON3"] = previousJSON; nativeJSON = previousJSON = null; } return JSON3; } })); root.JSON = { "parse": JSON3.parse, "stringify": JSON3.stringify }; } // Export for asynchronous module loaders. if (isLoader) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return JSON3; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } }).call(this); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(173)(module), __webpack_require__(6))) /***/ }), /* 34 */ /***/ (function(module, exports) { module.exports = function () { /* empty */ }; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(20); var call = __webpack_require__(134); var isArrayIter = __webpack_require__(87); var anObject = __webpack_require__(1); var toLength = __webpack_require__(8); var getIterFn = __webpack_require__(60); var BREAK = {}; var RETURN = {}; var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); var f = ctx(fn, that, entries ? 2 : 1); var index = 0; var length, step, iterator, result; if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); // fast case for arrays with default iterator if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); if (result === BREAK || result === RETURN) return result; } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { result = call(iterator, f, step.value, entries); if (result === BREAK || result === RETURN) return result; } }; exports.BREAK = BREAK; exports.RETURN = RETURN; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { var META = __webpack_require__(52)('meta'); var isObject = __webpack_require__(3); var has = __webpack_require__(21); var setDesc = __webpack_require__(11).f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var FREEZE = !__webpack_require__(5)(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function (it) { setDesc(it, META, { value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!has(it, META)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMeta(it); // return object ID } return it[META].i; }; var getWeak = function (it, create) { if (!has(it, META)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMeta(it); // return hash weak collections IDs } return it[META].w; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(1); var dPs = __webpack_require__(139); var enumBugKeys = __webpack_require__(83); var IE_PROTO = __webpack_require__(98)('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__(82)('iframe'); var i = enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; __webpack_require__(85).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE] = anObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(141); var enumBugKeys = __webpack_require__(83); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }), /* 39 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(3); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (it, S) { if (!isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { var random = __webpack_require__(55); var onUnload = {} , afterUnload = false // detect google chrome packaged apps because they don't allow the 'unload' event , isChromePackagedApp = global.chrome && global.chrome.app && global.chrome.app.runtime ; module.exports = { attachEvent: function(event, listener) { if (typeof global.addEventListener !== 'undefined') { global.addEventListener(event, listener, false); } else if (global.document && global.attachEvent) { // IE quirks. // According to: http://stevesouders.com/misc/test-postmessage.php // the message gets delivered only to 'document', not 'window'. global.document.attachEvent('on' + event, listener); // I get 'window' for ie8. global.attachEvent('on' + event, listener); } } , detachEvent: function(event, listener) { if (typeof global.addEventListener !== 'undefined') { global.removeEventListener(event, listener, false); } else if (global.document && global.detachEvent) { global.document.detachEvent('on' + event, listener); global.detachEvent('on' + event, listener); } } , unloadAdd: function(listener) { if (isChromePackagedApp) { return null; } var ref = random.string(8); onUnload[ref] = listener; if (afterUnload) { setTimeout(this.triggerUnloadCallbacks, 0); } return ref; } , unloadDel: function(ref) { if (ref in onUnload) { delete onUnload[ref]; } } , triggerUnloadCallbacks: function() { for (var ref in onUnload) { onUnload[ref](); delete onUnload[ref]; } } }; var unloadTriggered = function() { if (afterUnload) { return; } afterUnload = true; module.exports.triggerUnloadCallbacks(); }; // 'unload' alone is not reliable in opera within an iframe, but we // can't use `beforeunload` as IE fires it on javascript: links. if (!isChromePackagedApp) { module.exports.attachEvent('unload', unloadTriggered); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), /* 42 */ /***/ (function(module, exports) { /*! * Chai - flag utility * Copyright(c) 2012-2014 Jake Luer * MIT Licensed */ /** * ### flag(object, key, [value]) * * Get or set a flag value on an object. If a * value is provided it will be set, else it will * return the currently set value or `undefined` if * the value is not set. * * utils.flag(this, 'foo', 'bar'); // setter * utils.flag(this, 'foo'); // getter, returns `bar` * * @param {Object} object constructed Assertion * @param {String} key * @param {Mixed} value (optional) * @namespace Utils * @name flag * @api private */ module.exports = function (obj, key, value) { var flags = obj.__flags || (obj.__flags = Object.create(null)); if (arguments.length === 3) { flags[key] = value; } else { return flags[key]; } }; /***/ }), /* 43 */ /***/ (function(module, exports) { module.exports = function (it, Constructor, name, forbiddenField) { if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { throw TypeError(name + ': incorrect invocation!'); } return it; }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(27); var TAG = __webpack_require__(9)('toStringTag'); // ES3 wrong here var ARG = cof(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (e) { /* empty */ } }; module.exports = function (it) { var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /* 45 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 46 */ /***/ (function(module, exports) { module.exports = true; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { var hide = __webpack_require__(22); module.exports = function (target, src, safe) { for (var key in src) { if (safe && target[key]) target[key] = src[key]; else hide(target, key, src[key]); } return target; }; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(2); var core = __webpack_require__(15); var dP = __webpack_require__(11); var DESCRIPTORS = __webpack_require__(12); var SPECIES = __webpack_require__(9)('species'); module.exports = function (KEY) { var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY]; if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { configurable: true, get: function () { return this; } }); }; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(29); var max = Math.max; var min = Math.min; module.exports = function (index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }), /* 50 */ /***/ (function(module, exports) { module.exports = { /** * ### config.includeStack * * User configurable property, influences whether stack trace * is included in Assertion error message. Default of false * suppresses stack trace in the error message. * * chai.config.includeStack = true; // enable stack on error * * @param {Boolean} * @api public */ includeStack: false, /** * ### config.showDiff * * User configurable property, influences whether or not * the `showDiff` flag should be included in the thrown * AssertionErrors. `false` will always be `false`; `true` * will be true when the assertion has requested a diff * be shown. * * @param {Boolean} * @api public */ showDiff: true, /** * ### config.truncateThreshold * * User configurable property, sets length threshold for actual and * expected values in assertion errors. If this threshold is exceeded, for * example for large data structures, the value is replaced with something * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`. * * Set it to zero if you want to disable truncating altogether. * * This is especially userful when doing assertions on arrays: having this * set to a reasonable large value makes the failure messages readily * inspectable. * * chai.config.truncateThreshold = 0; // disable truncating * * @param {Number} * @api public */ truncateThreshold: 40 }; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { var def = __webpack_require__(11).f; var has = __webpack_require__(21); var TAG = __webpack_require__(9)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; /***/ }), /* 52 */ /***/ (function(module, exports) { var id = 0; var px = Math.random(); module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(3); module.exports = function (it, TYPE) { if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); return it; }; /***/ }), /* 54 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { var inherits = __webpack_require__(4) , urlUtils = __webpack_require__(24) , SenderReceiver = __webpack_require__(167) ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = __webpack_require__(10)('sockjs-client:ajax-based'); } function createAjaxSender(AjaxObject) { return function(url, payload, callback) { debug('create ajax sender', url, payload); var opt = {}; if (typeof payload === 'string') { opt.headers = {'Content-type': 'text/plain'}; } var ajaxUrl = urlUtils.addPath(url, '/xhr_send'); var xo = new AjaxObject('POST', ajaxUrl, payload, opt); xo.once('finish', function(status) { debug('finish', status); xo = null; if (status !== 200 && status !== 204) { return callback(new Error('http status ' + status)); } callback(); }); return function() { debug('abort'); xo.close(); xo = null; var err = new Error('Aborted'); err.code = 1000; callback(err); }; }; } function AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) { SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject); } inherits(AjaxBasedTransport, SenderReceiver); module.exports = AjaxBasedTransport; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* global crypto:true */ var crypto = __webpack_require__(454); // This string has length 32, a power of 2, so the modulus doesn't introduce a // bias. var _randomStringChars = 'abcdefghijklmnopqrstuvwxyz012345'; module.exports = { string: function(length) { var max = _randomStringChars.length; var bytes = crypto.randomBytes(length); var ret = []; for (var i = 0; i < length; i++) { ret.push(_randomStringChars.substr(bytes[i] % max, 1)); } return ret.join(''); } , number: function(max) { return Math.floor(Math.random() * max); } , numberString: function(max) { var t = ('' + (max - 1)).length; var p = new Array(t + 1).join('0'); return (p + this.number(max)).slice(-t); } }; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(27); // eslint-disable-next-line no-prototype-builtins module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys = __webpack_require__(141); var hiddenKeys = __webpack_require__(83).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return $keys(O, hiddenKeys); }; /***/ }), /* 58 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var defined = __webpack_require__(30); var fails = __webpack_require__(5); var spaces = __webpack_require__(102); var space = '[' + spaces + ']'; var non = '\u200b\u0085'; var ltrim = RegExp('^' + space + space + '*'); var rtrim = RegExp(space + space + '*$'); var exporter = function (KEY, exec, ALIAS) { var exp = {}; var FORCE = fails(function () { return !!spaces[KEY]() || non[KEY]() != non; }); var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; if (ALIAS) exp[ALIAS] = fn; $export($export.P + $export.F * FORCE, 'String', exp); }; // 1 -> String#trimLeft // 2 -> String#trimRight // 3 -> String#trim var trim = exporter.trim = function (string, TYPE) { string = String(defined(string)); if (TYPE & 1) string = string.replace(ltrim, ''); if (TYPE & 2) string = string.replace(rtrim, ''); return string; }; module.exports = exporter; /***/ }), /* 60 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(44); var ITERATOR = __webpack_require__(9)('iterator'); var Iterators = __webpack_require__(45); module.exports = __webpack_require__(15).getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var inherits = __webpack_require__(4) , XhrDriver = __webpack_require__(162) ; function XHRLocalObject(method, url, payload /*, opts */) { XhrDriver.call(this, method, url, payload, { noCredentials: true }); } inherits(XHRLocalObject, XhrDriver); XHRLocalObject.enabled = XhrDriver.enabled; module.exports = XHRLocalObject; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { module.exports = { isOpera: function() { return global.navigator && /opera/i.test(global.navigator.userAgent); } , isKonqueror: function() { return global.navigator && /konqueror/i.test(global.navigator.userAgent); } // #187 wrap document.domain in try/catch because of WP8 from file:/// , hasDomain: function () { // non-browser client always has a domain if (!global.document) { return true; } try { return !!global.document.domain; } catch (e) { return false; } } }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process, global) { var eventUtils = __webpack_require__(41) , JSON3 = __webpack_require__(33) , browser = __webpack_require__(62) ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = __webpack_require__(10)('sockjs-client:utils:iframe'); } module.exports = { WPrefix: '_jp' , currentWindowId: null , polluteGlobalNamespace: function() { if (!(module.exports.WPrefix in global)) { global[module.exports.WPrefix] = {}; } } , postMessage: function(type, data) { if (global.parent !== global) { global.parent.postMessage(JSON3.stringify({ windowId: module.exports.currentWindowId , type: type , data: data || '' }), '*'); } else { debug('Cannot postMessage, no parent window.', type, data); } } , createIframe: function(iframeUrl, errorCallback) { var iframe = global.document.createElement('iframe'); var tref, unloadRef; var unattach = function() { debug('unattach'); clearTimeout(tref); // Explorer had problems with that. try { iframe.onload = null; } catch (x) { // intentionally empty } iframe.onerror = null; }; var cleanup = function() { debug('cleanup'); if (iframe) { unattach(); // This timeout makes chrome fire onbeforeunload event // within iframe. Without the timeout it goes straight to // onunload. setTimeout(function() { if (iframe) { iframe.parentNode.removeChild(iframe); } iframe = null; }, 0); eventUtils.unloadDel(unloadRef); } }; var onerror = function(err) { debug('onerror', err); if (iframe) { cleanup(); errorCallback(err); } }; var post = function(msg, origin) { debug('post', msg, origin); try { // When the iframe is not loaded, IE raises an exception // on 'contentWindow'. setTimeout(function() { if (iframe && iframe.contentWindow) { iframe.contentWindow.postMessage(msg, origin); } }, 0); } catch (x) { // intentionally empty } }; iframe.src = iframeUrl; iframe.style.display = 'none'; iframe.style.position = 'absolute'; iframe.onerror = function() { onerror('onerror'); }; iframe.onload = function() { debug('onload'); // `onload` is triggered before scripts on the iframe are // executed. Give it few seconds to actually load stuff. clearTimeout(tref); tref = setTimeout(function() { onerror('onload timeout'); }, 2000); }; global.document.body.appendChild(iframe); tref = setTimeout(function() { onerror('timeout'); }, 15000); unloadRef = eventUtils.unloadAdd(cleanup); return { post: post , cleanup: cleanup , loaded: unattach }; } /* eslint no-undef: "off", new-cap: "off" */ , createHtmlfile: function(iframeUrl, errorCallback) { var axo = ['Active'].concat('Object').join('X'); var doc = new global[axo]('htmlfile'); var tref, unloadRef; var iframe; var unattach = function() { clearTimeout(tref); iframe.onerror = null; }; var cleanup = function() { if (doc) { unattach(); eventUtils.unloadDel(unloadRef); iframe.parentNode.removeChild(iframe); iframe = doc = null; CollectGarbage(); } }; var onerror = function(r) { debug('onerror', r); if (doc) { cleanup(); errorCallback(r); } }; var post = function(msg, origin) { try { // When the iframe is not loaded, IE raises an exception // on 'contentWindow'. setTimeout(function() { if (iframe && iframe.contentWindow) { iframe.contentWindow.postMessage(msg, origin); } }, 0); } catch (x) { // intentionally empty } }; doc.open(); doc.write('' + 'document.domain="' + global.document.domain + '";' + ''); doc.close(); doc.parentWindow[module.exports.WPrefix] = global[module.exports.WPrefix]; var c = doc.createElement('div'); doc.body.appendChild(c); iframe = doc.createElement('iframe'); c.appendChild(iframe); iframe.src = iframeUrl; iframe.onerror = function() { onerror('onerror'); }; tref = setTimeout(function() { onerror('timeout'); }, 15000); unloadRef = eventUtils.unloadAdd(cleanup); return { post: post , cleanup: cleanup , loaded: unattach }; } }; module.exports.iframeEnabled = false; if (global.document) { // postMessage misbehaves in konqueror 4.6.5 - the messages are delivered with // huge delay, or not at all. module.exports.iframeEnabled = (typeof global.postMessage === 'function' || typeof global.postMessage === 'object') && (!browser.isKonqueror()); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(6))) /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(16); var toLength = __webpack_require__(8); var toAbsoluteIndex = __webpack_require__(49); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(2); var $export = __webpack_require__(0); var meta = __webpack_require__(36); var fails = __webpack_require__(5); var hide = __webpack_require__(22); var redefineAll = __webpack_require__(47); var forOf = __webpack_require__(35); var anInstance = __webpack_require__(43); var isObject = __webpack_require__(3); var setToStringTag = __webpack_require__(51); var dP = __webpack_require__(11).f; var each = __webpack_require__(25)(0); var DESCRIPTORS = __webpack_require__(12); module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { var Base = global[NAME]; var C = Base; var ADDER = IS_MAP ? 'set' : 'add'; var proto = C && C.prototype; var O = {}; if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { new C().entries().next(); }))) { // create collection constructor C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); redefineAll(C.prototype, methods); meta.NEED = true; } else { C = wrapper(function (target, iterable) { anInstance(target, C, NAME, '_c'); target._c = new Base(); if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target); }); each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) { var IS_ADDER = KEY == 'add' || KEY == 'set'; if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) { anInstance(this, C, KEY); if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false; var result = this._c[KEY](a === 0 ? 0 : a, b); return IS_ADDER ? this : result; }); }); IS_WEAK || dP(C.prototype, 'size', { get: function () { return this._c.size; } }); } setToStringTag(C, NAME); O[NAME] = C; $export($export.G + $export.W + $export.F, O); if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); return C; }; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) var cof = __webpack_require__(27); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var create = __webpack_require__(37); var descriptor = __webpack_require__(39); var setToStringTag = __webpack_require__(51); var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() __webpack_require__(22)(IteratorPrototype, __webpack_require__(9)('iterator'), function () { return this; }); module.exports = function (Constructor, NAME, next) { Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(46); var $export = __webpack_require__(0); var redefine = __webpack_require__(96); var hide = __webpack_require__(22); var has = __webpack_require__(21); var Iterators = __webpack_require__(45); var $iterCreate = __webpack_require__(67); var setToStringTag = __webpack_require__(51); var getPrototypeOf = __webpack_require__(18); var ITERATOR = __webpack_require__(9)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function () { return this; }; module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { $iterCreate(Constructor, NAME, next); var getMethod = function (kind) { if (!BUGGY && kind in proto) return proto[kind]; switch (kind) { case KEYS: return function keys() { return new Constructor(this, kind); }; case VALUES: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = (!BUGGY && $native) || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; // Fix native if ($anyNative) { IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEF_VALUES && $native && $native.name !== VALUES) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } // Define iterator if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Forced replacement prototype accessors methods module.exports = __webpack_require__(46) || !__webpack_require__(5)(function () { var K = Math.random(); // In FF throws only define methods // eslint-disable-next-line no-undef, no-useless-call __defineSetter__.call(null, K, function () { /* empty */ }); delete __webpack_require__(2)[K]; }); /***/ }), /* 70 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-setmap-offrom/ var $export = __webpack_require__(0); var aFunction = __webpack_require__(14); var ctx = __webpack_require__(20); var forOf = __webpack_require__(35); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) { var mapFn = arguments[1]; var mapping, A, n, cb; aFunction(this); mapping = mapFn !== undefined; if (mapping) aFunction(mapFn); if (source == undefined) return new this(); A = []; if (mapping) { n = 0; cb = ctx(mapFn, arguments[2], 2); forOf(source, false, function (nextItem) { A.push(cb(nextItem, n++)); }); } else { forOf(source, false, A.push, A); } return new this(A); } }); }; /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-setmap-offrom/ var $export = __webpack_require__(0); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { of: function of() { var length = arguments.length; var A = new Array(length); while (length--) A[length] = arguments[length]; return new this(A); } }); }; /***/ }), /* 73 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); module.exports = function (key) { return store[key] || (store[key] = {}); }; /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject = __webpack_require__(1); var aFunction = __webpack_require__(14); var SPECIES = __webpack_require__(9)('species'); module.exports = function (O, D) { var C = anObject(O).constructor; var S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); }; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2); var hide = __webpack_require__(22); var uid = __webpack_require__(52); var TYPED = uid('typed_array'); var VIEW = uid('view'); var ABV = !!(global.ArrayBuffer && global.DataView); var CONSTR = ABV; var i = 0; var l = 9; var Typed; var TypedArrayConstructors = ( 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' ).split(','); while (i < l) { if (Typed = global[TypedArrayConstructors[i++]]) { hide(Typed.prototype, TYPED, true); hide(Typed.prototype, VIEW, true); } else CONSTR = false; } module.exports = { ABV: ABV, CONSTR: CONSTR, TYPED: TYPED, VIEW: VIEW }; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) { var inherits = __webpack_require__(4) , EventEmitter = __webpack_require__(17).EventEmitter ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = __webpack_require__(10)('sockjs-client:receiver:xhr'); } function XhrReceiver(url, AjaxObject) { debug(url); EventEmitter.call(this); var self = this; this.bufferPosition = 0; this.xo = new AjaxObject('POST', url, null); this.xo.on('chunk', this._chunkHandler.bind(this)); this.xo.once('finish', function(status, text) { debug('finish', status, text); self._chunkHandler(status, text); self.xo = null; var reason = status === 200 ? 'network' : 'permanent'; debug('close', reason); self.emit('close', null, reason); self._cleanup(); }); } inherits(XhrReceiver, EventEmitter); XhrReceiver.prototype._chunkHandler = function(status, text) { debug('_chunkHandler', status); if (status !== 200 || !text) { return; } for (var idx = -1; ; this.bufferPosition += idx + 1) { var buf = text.slice(this.bufferPosition); idx = buf.indexOf('\n'); if (idx === -1) { break; } var msg = buf.slice(0, idx); if (msg) { debug('message', msg); this.emit('message', msg); } } }; XhrReceiver.prototype._cleanup = function() { debug('_cleanup'); this.removeAllListeners(); }; XhrReceiver.prototype.abort = function() { debug('abort'); if (this.xo) { this.xo.close(); debug('close'); this.emit('close', null, 'user'); this.xo = null; } this._cleanup(); }; module.exports = XhrReceiver; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var inherits = __webpack_require__(4) , XhrDriver = __webpack_require__(162) ; function XHRCorsObject(method, url, payload, opts) { XhrDriver.call(this, method, url, payload, opts); } inherits(XHRCorsObject, XhrDriver); XHRCorsObject.enabled = XhrDriver.enabled && XhrDriver.supportsCORS; module.exports = XHRCorsObject; /***/ }), /* 78 */ /***/ (function(module, exports, __webpack_require__) { // This is (almost) directly from Node.js utils // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js var getName = __webpack_require__(116); var getProperties = __webpack_require__(199); var getEnumerableProperties = __webpack_require__(196); module.exports = inspect; /** * Echos the value of a value. Trys to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. * @param {Boolean} showHidden Flag that shows hidden (not enumerable) * properties of objects. * @param {Number} depth Depth in which to descend in object. Default is 2. * @param {Boolean} colors Flag to turn on ANSI escape codes to color the * output. Default is false (no coloring). * @namespace Utils * @name inspect */ function inspect(obj, showHidden, depth, colors) { var ctx = { showHidden: showHidden, seen: [], stylize: function (str) { return str; } }; return formatValue(ctx, obj, (typeof depth === 'undefined' ? 2 : depth)); } // Returns true if object is a DOM element. var isDOMElement = function (object) { if (typeof HTMLElement === 'object') { return object instanceof HTMLElement; } else { return object && typeof object === 'object' && object.nodeType === 1 && typeof object.nodeName === 'string'; } }; function formatValue(ctx, value, recurseTimes) { // Provide a hook for user-specified inspect functions. // Check that value is an object with an inspect function on it if (value && typeof value.inspect === 'function' && // Filter out the util module, it's inspect function is special value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check. !(value.constructor && value.constructor.prototype === value)) { var ret = value.inspect(recurseTimes); if (typeof ret !== 'string') { ret = formatValue(ctx, ret, recurseTimes); } return ret; } // Primitive types cannot have properties var primitive = formatPrimitive(ctx, value); if (primitive) { return primitive; } // If this is a DOM element, try to get the outer HTML. if (isDOMElement(value)) { if ('outerHTML' in value) { return value.outerHTML; // This value does not have an outerHTML attribute, // it could still be an XML element } else { // Attempt to serialize it try { if (document.xmlVersion) { var xmlSerializer = new XMLSerializer(); return xmlSerializer.serializeToString(value); } else { // Firefox 11- do not support outerHTML // It does, however, support innerHTML // Use the following to render the element var ns = "http://www.w3.org/1999/xhtml"; var container = document.createElementNS(ns, '_'); container.appendChild(value.cloneNode(false)); html = container.innerHTML .replace('><', '>' + value.innerHTML + '<'); container.innerHTML = ''; return html; } } catch (err) { // This could be a non-native DOM implementation, // continue with the normal flow: // printing the element as if it is an object. } } } // Look up the keys of the object. var visibleKeys = getEnumerableProperties(value); var keys = ctx.showHidden ? getProperties(value) : visibleKeys; // Some type of object without properties can be shortcutted. // In IE, errors have a single `stack` property, or if they are vanilla `Error`, // a `stack` plus `description` property; ignore those for consistency. if (keys.length === 0 || (isError(value) && ( (keys.length === 1 && keys[0] === 'stack') || (keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack') ))) { if (typeof value === 'function') { var name = getName(value); var nameSuffix = name ? ': ' + name : ''; return ctx.stylize('[Function' + nameSuffix + ']', 'special'); } if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } if (isDate(value)) { return ctx.stylize(Date.prototype.toUTCString.call(value), 'date'); } if (isError(value)) { return formatError(value); } } var base = '', array = false, braces = ['{', '}']; // Make Array say that they are Array if (isArray(value)) { array = true; braces = ['[', ']']; } // Make functions say that they are functions if (typeof value === 'function') { var name = getName(value); var nameSuffix = name ? ': ' + name : ''; base = ' [Function' + nameSuffix + ']'; } // Make RegExps say that they are RegExps if (isRegExp(value)) { base = ' ' + RegExp.prototype.toString.call(value); } // Make dates with properties first say the date if (isDate(value)) { base = ' ' + Date.prototype.toUTCString.call(value); } // Make error with message first say the error if (isError(value)) { return formatError(value); } if (keys.length === 0 && (!array || value.length == 0)) { return braces[0] + base + braces[1]; } if (recurseTimes < 0) { if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } else { return ctx.stylize('[Object]', 'special'); } } ctx.seen.push(value); var output; if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { output = keys.map(function(key) { return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); }); } ctx.seen.pop(); return reduceToSingleString(output, base, braces); } function formatPrimitive(ctx, value) { switch (typeof value) { case 'undefined': return ctx.stylize('undefined', 'undefined'); case 'string': var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') .replace(/'/g, "\\'") .replace(/\\"/g, '"') + '\''; return ctx.stylize(simple, 'string'); case 'number': if (value === 0 && (1/value) === -Infinity) { return ctx.stylize('-0', 'number'); } return ctx.stylize('' + value, 'number'); case 'boolean': return ctx.stylize('' + value, 'boolean'); } // For some reason typeof null is "object", so special case here. if (value === null) { return ctx.stylize('null', 'null'); } } function formatError(value) { return '[' + Error.prototype.toString.call(value) + ']'; } function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { var output = []; for (var i = 0, l = value.length; i < l; ++i) { if (Object.prototype.hasOwnProperty.call(value, String(i))) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); } else { output.push(''); } } keys.forEach(function(key) { if (!key.match(/^\d+$/)) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); } }); return output; } function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { var name, str; if (value.__lookupGetter__) { if (value.__lookupGetter__(key)) { if (value.__lookupSetter__(key)) { str = ctx.stylize('[Getter/Setter]', 'special'); } else { str = ctx.stylize('[Getter]', 'special'); } } else { if (value.__lookupSetter__(key)) { str = ctx.stylize('[Setter]', 'special'); } } } if (visibleKeys.indexOf(key) < 0) { name = '[' + key + ']'; } if (!str) { if (ctx.seen.indexOf(value[key]) < 0) { if (recurseTimes === null) { str = formatValue(ctx, value[key], null); } else { str = formatValue(ctx, value[key], recurseTimes - 1); } if (str.indexOf('\n') > -1) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; }).join('\n').substr(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; }).join('\n'); } } } else { str = ctx.stylize('[Circular]', 'special'); } } if (typeof name === 'undefined') { if (array && key.match(/^\d+$/)) { return str; } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { name = name.substr(1, name.length - 2); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") .replace(/\\"/g, '"') .replace(/(^"|"$)/g, "'"); name = ctx.stylize(name, 'string'); } } return name + ': ' + str; } function reduceToSingleString(output, base, braces) { var numLinesEst = 0; var length = output.reduce(function(prev, cur) { numLinesEst++; if (cur.indexOf('\n') >= 0) numLinesEst++; return prev + cur.length + 1; }, 0); if (length > 60) { return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; } return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } function isArray(ar) { return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]'); } function isRegExp(re) { return typeof re === 'object' && objectToString(re) === '[object RegExp]'; } function isDate(d) { return typeof d === 'object' && objectToString(d) === '[object Date]'; } function isError(e) { return typeof e === 'object' && objectToString(e) === '[object Error]'; } function objectToString(o) { return Object.prototype.toString.call(o); } /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var toObject = __webpack_require__(13); var toAbsoluteIndex = __webpack_require__(49); var toLength = __webpack_require__(8); module.exports = function fill(value /* , start = 0, end = @length */) { var O = toObject(this); var length = toLength(O.length); var aLen = arguments.length; var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); var end = aLen > 2 ? arguments[2] : undefined; var endPos = end === undefined ? length : toAbsoluteIndex(end, length); while (endPos > index) O[index++] = value; return O; }; /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var speciesConstructor = __webpack_require__(205); module.exports = function (original, length) { return new (speciesConstructor(original))(length); }; /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $defineProperty = __webpack_require__(11); var createDesc = __webpack_require__(39); module.exports = function (object, index, value) { if (index in object) $defineProperty.f(object, index, createDesc(0, value)); else object[index] = value; }; /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(3); var document = __webpack_require__(2).document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /* 83 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { var MATCH = __webpack_require__(9)('match'); module.exports = function (KEY) { var re = /./; try { '/./'[KEY](re); } catch (e) { try { re[MATCH] = false; return !'/./'[KEY](re); } catch (f) { /* empty */ } } return true; }; /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { var document = __webpack_require__(2).document; module.exports = document && document.documentElement; /***/ }), /* 86 */ /***/ (function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 module.exports = function (fn, args, that) { var un = that === undefined; switch (args.length) { case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { // check on default Array iterator var Iterators = __webpack_require__(45); var ITERATOR = __webpack_require__(9)('iterator'); var ArrayProto = Array.prototype; module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(9)('iterator'); var SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function () { SAFE_CLOSING = true; }; // eslint-disable-next-line no-throw-literal Array.from(riter, function () { throw 2; }); } catch (e) { /* empty */ } module.exports = function (exec, skipClosing) { if (!skipClosing && !SAFE_CLOSING) return false; var safe = false; try { var arr = [7]; var iter = arr[ITERATOR](); iter.next = function () { return { done: safe = true }; }; arr[ITERATOR] = function () { return iter; }; exec(arr); } catch (e) { /* empty */ } return safe; }; /***/ }), /* 89 */ /***/ (function(module, exports) { module.exports = function (done, value) { return { value: value, done: !!done }; }; /***/ }), /* 90 */ /***/ (function(module, exports) { // 20.2.2.14 Math.expm1(x) var $expm1 = Math.expm1; module.exports = (!$expm1 // Old FF bug || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 // Tor Browser bug || $expm1(-2e-17) != -2e-17 ) ? function expm1(x) { return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; } : $expm1; /***/ }), /* 91 */ /***/ (function(module, exports) { // 20.2.2.28 Math.sign(x) module.exports = Math.sign || function sign(x) { // eslint-disable-next-line no-self-compare return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2); var macrotask = __webpack_require__(103).set; var Observer = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; var Promise = global.Promise; var isNode = __webpack_require__(27)(process) == 'process'; module.exports = function () { var head, last, notify; var flush = function () { var parent, fn; if (isNode && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (e) { if (head) notify(); else last = undefined; throw e; } } last = undefined; if (parent) parent.enter(); }; // Node.js if (isNode) { notify = function () { process.nextTick(flush); }; // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 } else if (Observer && !(global.navigator && global.navigator.standalone)) { var toggle = true; var node = document.createTextNode(''); new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (Promise && Promise.resolve) { var promise = Promise.resolve(); notify = function () { promise.then(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function () { // strange IE + webpack dev server bug - use .call(global) macrotask.call(global, flush); }; } return function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; }; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 25.4.1.5 NewPromiseCapability(C) var aFunction = __webpack_require__(14); function PromiseCapability(C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); } module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = __webpack_require__(38); var gOPS = __webpack_require__(70); var pIE = __webpack_require__(58); var toObject = __webpack_require__(13); var IObject = __webpack_require__(56); var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) module.exports = !$assign || __webpack_require__(5)(function () { var A = {}; var B = {}; // eslint-disable-next-line no-undef var S = Symbol(); var K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function (k) { B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars var T = toObject(target); var aLen = arguments.length; var index = 1; var getSymbols = gOPS.f; var isEnum = pIE.f; while (aLen > index) { var S = IObject(arguments[index++]); var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); var length = keys.length; var j = 0; var key; while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; } return T; } : $assign; /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { // all object keys, includes non-enumerable and symbols var gOPN = __webpack_require__(57); var gOPS = __webpack_require__(70); var anObject = __webpack_require__(1); var Reflect = __webpack_require__(2).Reflect; module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) { var keys = gOPN.f(anObject(it)); var getSymbols = gOPS.f; return getSymbols ? keys.concat(getSymbols(it)) : keys; }; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(22); /***/ }), /* 97 */ /***/ (function(module, exports) { module.exports = function (regExp, replace) { var replacer = replace === Object(replace) ? function (part) { return replace[part]; } : replace; return function (it) { return String(it).replace(regExp, replacer); }; }; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(73)('keys'); var uid = __webpack_require__(52); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(29); var defined = __webpack_require__(30); // true -> String#at // false -> String#codePointAt module.exports = function (TO_STRING) { return function (that, pos) { var s = String(defined(that)); var i = toInteger(pos); var l = s.length; var a, b; if (i < 0 || i >= l) return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { // helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(133); var defined = __webpack_require__(30); module.exports = function (that, searchString, NAME) { if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toInteger = __webpack_require__(29); var defined = __webpack_require__(30); module.exports = function repeat(count) { var str = String(defined(this)); var res = ''; var n = toInteger(count); if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; return res; }; /***/ }), /* 102 */ /***/ (function(module, exports) { module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(20); var invoke = __webpack_require__(86); var html = __webpack_require__(85); var cel = __webpack_require__(82); var global = __webpack_require__(2); var process = global.process; var setTask = global.setImmediate; var clearTask = global.clearImmediate; var MessageChannel = global.MessageChannel; var Dispatch = global.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var defer, channel, port; var run = function () { var id = +this; // eslint-disable-next-line no-prototype-builtins if (queue.hasOwnProperty(id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function (event) { run.call(event.data); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!setTask || !clearTask) { setTask = function setImmediate(fn) { var args = []; var i = 1; while (arguments.length > i) args.push(arguments[i++]); queue[++counter] = function () { // eslint-disable-next-line no-new-func invoke(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (__webpack_require__(27)(process) == 'process') { defer = function (id) { process.nextTick(ctx(run, id, 1)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(ctx(run, id, 1)); }; // Browsers with MessageChannel, includes WebWorkers } else if (MessageChannel) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { defer = function (id) { global.postMessage(id + '', '*'); }; global.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in cel('script')) { defer = function (id) { html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run.call(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(ctx(run, id, 1), 0); }; } } module.exports = { set: setTask, clear: clearTask }; /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(12); var LIBRARY = __webpack_require__(46); var $typed = __webpack_require__(75); var hide = __webpack_require__(22); var redefineAll = __webpack_require__(47); var fails = __webpack_require__(5); var anInstance = __webpack_require__(43); var toInteger = __webpack_require__(29); var toLength = __webpack_require__(8); var toIndex = __webpack_require__(151); var gOPN = __webpack_require__(57).f; var dP = __webpack_require__(11).f; var arrayFill = __webpack_require__(79); var setToStringTag = __webpack_require__(51); var ARRAY_BUFFER = 'ArrayBuffer'; var DATA_VIEW = 'DataView'; var PROTOTYPE = 'prototype'; var WRONG_LENGTH = 'Wrong length!'; var WRONG_INDEX = 'Wrong index!'; var $ArrayBuffer = global[ARRAY_BUFFER]; var $DataView = global[DATA_VIEW]; var Math = global.Math; var RangeError = global.RangeError; // eslint-disable-next-line no-shadow-restricted-names var Infinity = global.Infinity; var BaseBuffer = $ArrayBuffer; var abs = Math.abs; var pow = Math.pow; var floor = Math.floor; var log = Math.log; var LN2 = Math.LN2; var BUFFER = 'buffer'; var BYTE_LENGTH = 'byteLength'; var BYTE_OFFSET = 'byteOffset'; var $BUFFER = DESCRIPTORS ? '_b' : BUFFER; var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH; var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; // IEEE754 conversions based on https://github.com/feross/ieee754 function packIEEE754(value, mLen, nBytes) { var buffer = new Array(nBytes); var eLen = nBytes * 8 - mLen - 1; var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; var i = 0; var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; var e, m, c; value = abs(value); // eslint-disable-next-line no-self-compare if (value != value || value === Infinity) { // eslint-disable-next-line no-self-compare m = value != value ? 1 : 0; e = eMax; } else { e = floor(log(value) / LN2); if (value * (c = pow(2, -e)) < 1) { e--; c *= 2; } if (e + eBias >= 1) { value += rt / c; } else { value += rt * pow(2, 1 - eBias); } if (value * c >= 2) { e++; c /= 2; } if (e + eBias >= eMax) { m = 0; e = eMax; } else if (e + eBias >= 1) { m = (value * c - 1) * pow(2, mLen); e = e + eBias; } else { m = value * pow(2, eBias - 1) * pow(2, mLen); e = 0; } } for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); e = e << mLen | m; eLen += mLen; for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); buffer[--i] |= s * 128; return buffer; } function unpackIEEE754(buffer, mLen, nBytes) { var eLen = nBytes * 8 - mLen - 1; var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var nBits = eLen - 7; var i = nBytes - 1; var s = buffer[i--]; var e = s & 127; var m; s >>= 7; for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); m = e & (1 << -nBits) - 1; e >>= -nBits; nBits += mLen; for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); if (e === 0) { e = 1 - eBias; } else if (e === eMax) { return m ? NaN : s ? -Infinity : Infinity; } else { m = m + pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * pow(2, e - mLen); } function unpackI32(bytes) { return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; } function packI8(it) { return [it & 0xff]; } function packI16(it) { return [it & 0xff, it >> 8 & 0xff]; } function packI32(it) { return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; } function packF64(it) { return packIEEE754(it, 52, 8); } function packF32(it) { return packIEEE754(it, 23, 4); } function addGetter(C, key, internal) { dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); } function get(view, bytes, index, isLittleEndian) { var numIndex = +index; var intIndex = toIndex(numIndex); if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b; var start = intIndex + view[$OFFSET]; var pack = store.slice(start, start + bytes); return isLittleEndian ? pack : pack.reverse(); } function set(view, bytes, index, conversion, value, isLittleEndian) { var numIndex = +index; var intIndex = toIndex(numIndex); if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b; var start = intIndex + view[$OFFSET]; var pack = conversion(+value); for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; } if (!$typed.ABV) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, $ArrayBuffer, ARRAY_BUFFER); var byteLength = toIndex(length); this._b = arrayFill.call(new Array(byteLength), 0); this[$LENGTH] = byteLength; }; $DataView = function DataView(buffer, byteOffset, byteLength) { anInstance(this, $DataView, DATA_VIEW); anInstance(buffer, $ArrayBuffer, DATA_VIEW); var bufferLength = buffer[$LENGTH]; var offset = toInteger(byteOffset); if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!'); byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); this[$BUFFER] = buffer; this[$OFFSET] = offset; this[$LENGTH] = byteLength; }; if (DESCRIPTORS) { addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); addGetter($DataView, BUFFER, '_b'); addGetter($DataView, BYTE_LENGTH, '_l'); addGetter($DataView, BYTE_OFFSET, '_o'); } redefineAll($DataView[PROTOTYPE], { getInt8: function getInt8(byteOffset) { return get(this, 1, byteOffset)[0] << 24 >> 24; }, getUint8: function getUint8(byteOffset) { return get(this, 1, byteOffset)[0]; }, getInt16: function getInt16(byteOffset /* , littleEndian */) { var bytes = get(this, 2, byteOffset, arguments[1]); return (bytes[1] << 8 | bytes[0]) << 16 >> 16; }, getUint16: function getUint16(byteOffset /* , littleEndian */) { var bytes = get(this, 2, byteOffset, arguments[1]); return bytes[1] << 8 | bytes[0]; }, getInt32: function getInt32(byteOffset /* , littleEndian */) { return unpackI32(get(this, 4, byteOffset, arguments[1])); }, getUint32: function getUint32(byteOffset /* , littleEndian */) { return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; }, getFloat32: function getFloat32(byteOffset /* , littleEndian */) { return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); }, getFloat64: function getFloat64(byteOffset /* , littleEndian */) { return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); }, setInt8: function setInt8(byteOffset, value) { set(this, 1, byteOffset, packI8, value); }, setUint8: function setUint8(byteOffset, value) { set(this, 1, byteOffset, packI8, value); }, setInt16: function setInt16(byteOffset, value /* , littleEndian */) { set(this, 2, byteOffset, packI16, value, arguments[2]); }, setUint16: function setUint16(byteOffset, value /* , littleEndian */) { set(this, 2, byteOffset, packI16, value, arguments[2]); }, setInt32: function setInt32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packI32, value, arguments[2]); }, setUint32: function setUint32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packI32, value, arguments[2]); }, setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packF32, value, arguments[2]); }, setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { set(this, 8, byteOffset, packF64, value, arguments[2]); } }); } else { if (!fails(function () { $ArrayBuffer(1); }) || !fails(function () { new $ArrayBuffer(-1); // eslint-disable-line no-new }) || fails(function () { new $ArrayBuffer(); // eslint-disable-line no-new new $ArrayBuffer(1.5); // eslint-disable-line no-new new $ArrayBuffer(NaN); // eslint-disable-line no-new return $ArrayBuffer.name != ARRAY_BUFFER; })) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, $ArrayBuffer); return new BaseBuffer(toIndex(length)); }; var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]); } if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; } // iOS Safari 7.x bug var view = new $DataView(new $ArrayBuffer(2)); var $setInt8 = $DataView[PROTOTYPE].setInt8; view.setInt8(0, 2147483648); view.setInt8(1, 2147483649); if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], { setInt8: function setInt8(byteOffset, value) { $setInt8.call(this, byteOffset, value << 24 >> 24); }, setUint8: function setUint8(byteOffset, value) { $setInt8.call(this, byteOffset, value << 24 >> 24); } }, true); } setToStringTag($ArrayBuffer, ARRAY_BUFFER); setToStringTag($DataView, DATA_VIEW); hide($DataView[PROTOTYPE], $typed.VIEW, true); exports[ARRAY_BUFFER] = $ArrayBuffer; exports[DATA_VIEW] = $DataView; /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2); var navigator = global.navigator; module.exports = navigator && navigator.userAgent || ''; /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(2); var core = __webpack_require__(15); var LIBRARY = __webpack_require__(46); var wksExt = __webpack_require__(152); var defineProperty = __webpack_require__(11).f; module.exports = function (name) { var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); }; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var addToUnscopables = __webpack_require__(34); var step = __webpack_require__(89); var Iterators = __webpack_require__(45); var toIObject = __webpack_require__(16); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() module.exports = __webpack_require__(68)(Array, 'Array', function (iterated, kind) { this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function () { var O = this._t; var kind = this._k; var index = this._i++; if (!O || index >= O.length) { this._t = undefined; return step(1); } if (kind == 'keys') return step(0, index); if (kind == 'values') return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function Event(eventType) { this.type = eventType; } Event.prototype.initEvent = function(eventType, canBubble, cancelable) { this.type = eventType; this.bubbles = canBubble; this.cancelable = cancelable; this.timeStamp = +new Date(); return this; }; Event.prototype.stopPropagation = function() {}; Event.prototype.preventDefault = function() {}; Event.CAPTURING_PHASE = 1; Event.AT_TARGET = 2; Event.BUBBLING_PHASE = 3; module.exports = Event; /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { var inherits = __webpack_require__(4) , IframeTransport = __webpack_require__(166) , objectUtils = __webpack_require__(111) ; module.exports = function(transport) { function IframeWrapTransport(transUrl, baseUrl) { IframeTransport.call(this, transport.transportName, transUrl, baseUrl); } inherits(IframeWrapTransport, IframeTransport); IframeWrapTransport.enabled = function(url, info) { if (!global.document) { return false; } var iframeInfo = objectUtils.extend({}, info); iframeInfo.sameOrigin = true; return transport.enabled(iframeInfo) && IframeTransport.enabled(); }; IframeWrapTransport.transportName = 'iframe-' + transport.transportName; IframeWrapTransport.needBody = true; IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1; // html, javascript (2) + transport - no CORS (1) IframeWrapTransport.facadeTransport = transport; return IframeWrapTransport; }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6))) /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process, global) { var EventEmitter = __webpack_require__(17).EventEmitter , inherits = __webpack_require__(4) , eventUtils = __webpack_require__(41) , browser = __webpack_require__(62) , urlUtils = __webpack_require__(24) ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = __webpack_require__(10)('sockjs-client:sender:xdr'); } // References: // http://ajaxian.com/archives/100-line-ajax-wrapper // http://msdn.microsoft.com/en-us/library/cc288060(v=VS.85).aspx function XDRObject(method, url, payload) { debug(method, url); var self = this; EventEmitter.call(this); setTimeout(function() { self._start(method, url, payload); }, 0); } inherits(XDRObject, EventEmitter); XDRObject.prototype._start = function(method, url, payload) { debug('_start'); var self = this; var xdr = new global.XDomainRequest(); // IE caches even POSTs url = urlUtils.addQuery(url, 't=' + (+new Date())); xdr.onerror = function() { debug('onerror'); self._error(); }; xdr.ontimeout = function() { debug('ontimeout'); self._error(); }; xdr.onprogress = function() { debug('progress', xdr.responseText); self.emit('chunk', 200, xdr.responseText); }; xdr.onload = function() { debug('load'); self.emit('finish', 200, xdr.responseText); self._cleanup(false); }; this.xdr = xdr; this.unloadRef = eventUtils.unloadAdd(function() { self._cleanup(true); }); try { // Fails with AccessDenied if port number is bogus this.xdr.open(method, url); if (this.timeout) { this.xdr.timeout = this.timeout; } this.xdr.send(payload); } catch (x) { this._error(); } }; XDRObject.prototype._error = function() { this.emit('finish', 0, ''); this._cleanup(false); }; XDRObject.prototype._cleanup = function(abort) { debug('cleanup', abort); if (!this.xdr) { return; } this.removeAllListeners(); eventUtils.unloadDel(this.unloadRef); this.xdr.ontimeout = this.xdr.onerror = this.xdr.onprogress = this.xdr.onload = null; if (abort) { try { this.xdr.abort(); } catch (x) { // intentionally empty } } this.unloadRef = this.xdr = null; }; XDRObject.prototype.close = function() { debug('close'); this._cleanup(true); }; // IE 8/9 if the request target uses the same scheme - #79 XDRObject.enabled = !!(global.XDomainRequest && browser.hasDomain()); module.exports = XDRObject; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(6))) /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { isObject: function(obj) { var type = typeof obj; return type === 'function' || type === 'object' && !!obj; } , extend: function(obj) { if (!this.isObject(obj)) { return obj; } var source, prop; for (var i = 1, length = arguments.length; i < length; i++) { source = arguments[i]; for (prop in source) { if (Object.prototype.hasOwnProperty.call(source, prop)) { obj[prop] = source[prop]; } } } return obj; } }; /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(459); /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}, memoize = function(fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }, isOldIE = memoize(function() { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 return window && document && document.all && !window.atob; }), getElement = (function(fn) { var memo = {}; return function(selector) { if (typeof memo[selector] === "undefined") { memo[selector] = fn.call(this, selector); } return memo[selector] }; })(function (styleTarget) { return document.querySelector(styleTarget) }), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = [], fixUrls = __webpack_require__(458); module.exports = function(list, options) { if(typeof DEBUG !== "undefined" && DEBUG) { if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; options.attrs = typeof options.attrs === "object" ? options.attrs : {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of ================================================ FILE: test/helpers/index.js ================================================ import camelcase from 'camelcase' import { createVM, Vue } from './utils' import { nextTick } from './wait-for-update' export function dataPropagationTest (Component) { return function () { const spy = sinon.spy() const vm = createVM(this, function (h) { return ( Hello ) }) spy.should.have.not.been.called vm.$('.custom').should.exist vm.$('.custom').click() spy.should.have.been.calledOnce } } export function attrTest (it, base, Component, attr) { const attrs = Array.isArray(attr) ? attr : [attr] attrs.forEach(attr => { it(attr, function (done) { const vm = createVM(this, function (h) { const opts = { props: { [camelcase(attr)]: this.active } } return ( {attr} ) }, { data: { active: true } }) vm.$(`.${base}`).should.have.class(`${base}--${attr}`) vm.active = false nextTick().then(() => { vm.$(`.${base}`).should.not.have.class(`${base}--${attr}`) vm.active = true }).then(done) }) }) } export { createVM, Vue, nextTick } ================================================ FILE: test/helpers/utils.js ================================================ import Vue from 'vue/dist/vue.js' import Test from './Test.vue' Vue.config.productionTip = false const isKarma = !!window.__karma__ export function createVM (context, template, opts = {}) { return isKarma ? createKarmaTest(context, template, opts) : createVisualTest(context, template, opts) } const emptyNodes = document.querySelectorAll('nonexistant') Vue.prototype.$$ = function $$ (selector) { const els = document.querySelectorAll(selector) const vmEls = this.$el.querySelectorAll(selector) const fn = vmEls.length ? el => vmEls.find(el) : el => this.$el === el const found = Array.from(els).filter(fn) return found.length ? found : emptyNodes } Vue.prototype.$ = function $ (selector) { const els = document.querySelectorAll(selector) const vmEl = this.$el.querySelector(selector) const fn = vmEl ? el => el === vmEl : el => el === this.$el // Allow should chaining for tests return Array.from(els).find(fn) || emptyNodes } export function createKarmaTest (context, template, opts) { const el = document.createElement('div') document.getElementById('tests').appendChild(el) const render = typeof template === 'string' ? { template: `
${template}
` } : { render: template } return new Vue({ el, name: 'Test', ...render, ...opts }) } export function createVisualTest (context, template, opts) { let vm if (typeof template === 'string') { opts.components = opts.components || {} // Let the user define a test component if (!opts.components.Test) { opts.components.Test = Test } vm = new Vue({ name: 'TestContainer', el: context.DOMElement, template: `${template}`, ...opts }) } else { // TODO allow redefinition of Test component vm = new Vue({ name: 'TestContainer', el: context.DOMElement, render (h) { return h(Test, { attrs: { id: context.DOMElement.id } // render the passed component with this scope }, [template.call(this, h)]) }, ...opts }) } context.DOMElement.vm = vm return vm } export function register (name, component) { Vue.component(name, component) } export { isKarma, Vue } ================================================ FILE: test/helpers/wait-for-update.js ================================================ import Vue from 'vue/dist/vue.js' // Testing helper // nextTick().then(() => { // // Automatically waits for nextTick // }).then(() => { // return a promise or value to skip the wait // }) function nextTick () { const jobs = [] let done const chainer = { then (cb) { jobs.push(cb) return chainer } } function shift (...args) { const job = jobs.shift() let result try { result = job(...args) } catch (e) { jobs.length = 0 done(e) } // wait for nextTick if (result !== undefined) { if (result.then) { result.then(shift) } else { shift(result) } } else if (jobs.length) { requestAnimationFrame(() => Vue.nextTick(shift)) } } // First time Vue.nextTick(() => { done = jobs[jobs.length - 1] if (done.toString().slice(0, 14) !== 'function (err)') { throw new Error('waitForUpdate chain is missing .then(done)') } shift() }) return chainer } exports.nextTick = nextTick exports.delay = time => new Promise(resolve => setTimeout(resolve, time)) ================================================ FILE: test/index.js ================================================ // Polyfill fn.bind() for PhantomJS import bind from 'function-bind' /* eslint-disable no-extend-native */ Function.prototype.bind = bind // Polyfill array.findIndex() for PhantomJS import 'phantomjs-polyfill-find-index' import 'phantomjs-polyfill-find' // Polyfill Object.assign for PhantomJS import objectAssign from 'object-assign' Object.assign = objectAssign // require all src files for coverage. // you can also change this to match only the subset of files that // you want coverage for. const srcContext = require.context('../src', true, /^\.\/(?!index(\.js)?$)/) srcContext.keys().forEach(srcContext) // Use a div to insert elements before(function () { const el = document.createElement('DIV') el.id = 'tests' document.body.appendChild(el) }) // Remove every test html scenario afterEach(function () { const el = document.getElementById('tests') for (let i = 0; i < el.children.length; ++i) { el.removeChild(el.children[i]) } }) const specsContext = require.context('./specs', true) specsContext.keys().forEach(specsContext) ================================================ FILE: test/karma.conf.js ================================================ const merge = require('webpack-merge') const baseConfig = require('../build/webpack.config.dev.js') const webpackConfig = merge(baseConfig, { // use inline sourcemap for karma-sourcemap-loader devtool: '#inline-source-map' }) webpackConfig.plugins = [] const vueRule = webpackConfig.module.rules.find(rule => rule.loader === 'vue-loader') vueRule.options = vueRule.options || {} vueRule.options.loaders = vueRule.options.loaders || {} vueRule.options.loaders.js = 'babel-loader' // no need for app entry during tests delete webpackConfig.entry module.exports = function (config) { config.set({ // to run in additional browsers: // 1. install corresponding karma launcher // http://karma-runner.github.io/0.13/config/browsers.html // 2. add it to the `browsers` array below. browsers: ['PhantomJS'], frameworks: ['mocha', 'chai-dom', 'sinon-chai'], reporters: ['spec', 'coverage'], files: ['./index.js'], preprocessors: { './index.js': ['webpack', 'sourcemap'] }, webpack: webpackConfig, webpackMiddleware: { noInfo: true }, coverageReporter: { dir: './coverage', reporters: [ { type: 'lcov', subdir: '.' }, { type: 'text-summary' } ] } }) } ================================================ FILE: test/mocks.js ================================================ export function htmlElement () { return { listeners: [], tagName: 'HTML', addEventListener (event, fn) { this.listeners.push({ event, listener: fn }) }, removeEventListener (event, fn) { const index = this.listeners.find(listener => listener.event === event && listener.listener === fn) if (index !== -1) { this.listeners.splice(index, 1) } }, style: {} } } ================================================ FILE: test/specs/directives/auto-pageview.spec.js ================================================ import autoPageview from 'src/directives/auto-pageview' import uweb from 'src/index' import { htmlElement } from '../../mocks' describe('directives.auto-pageview', () => { let el = htmlElement() let binding = {} let setAutoPageviewSpy = null let sandbox = null before(() => { sandbox = sinon.sandbox.create() }) beforeEach(() => { el = htmlElement() binding = {} setAutoPageviewSpy = sandbox.spy(uweb, 'setAutoPageview') }) afterEach(() => { sandbox.restore() }) it('should enable autoPageview by default', () => { binding.value = '' autoPageview(el, binding) setAutoPageviewSpy.withArgs(true).calledOnce.should.be.true }) it('should set the autoPageview to true', () => { binding.value = true autoPageview(el, binding) setAutoPageviewSpy.withArgs(true).calledOnce.should.be.true }) it('should set the autoPageview to false', () => { binding.value = false autoPageview(el, binding) setAutoPageviewSpy.withArgs(false).calledOnce.should.be.true }) it('should set the autoPageview to false when given "false"', () => { binding.value = 'false' autoPageview(el, binding) setAutoPageviewSpy.withArgs(false).calledOnce.should.be.true }) it('should skip when value not changed', () => { binding.value = binding.oldValue = 'same' autoPageview(el, binding) setAutoPageviewSpy.notCalled.should.be.true }) }) ================================================ FILE: test/specs/directives/track-event.spec.js ================================================ import trackEvent from 'src/directives/track-event' import uweb from 'src/index' import { htmlElement } from '../../mocks' function hasEvent (listeners, event) { return !!listeners.find(listener => listener.event === event) } function getEventListener (listeners, event) { const listener = listeners.find(listener => listener.event === event) if (listener && typeof listener.listener === 'function') { return listener.listener } } describe('directives.track-event', () => { let el = htmlElement() let binding = null let sandbox = null let trackEventSpy = null before(() => { sandbox = sinon.sandbox.create() }) beforeEach(() => { el = htmlElement() binding = { modifiers: {} } trackEventSpy = sandbox.spy(uweb, 'trackEvent') }) afterEach(() => { sandbox.restore() }) it('should track click by default', () => { binding.value = 'category, action' trackEvent(el, binding) trackEventSpy.notCalled.should.be.true hasEvent(el.listeners, 'click').should.be.true getEventListener(el.listeners, 'click')() trackEventSpy.withArgs('category', 'action').calledOnce.should.be.true }) it('should use modifiers as event', () => { binding.value = 'category, action, label' binding.modifiers = { keypress: true } trackEvent(el, binding) trackEventSpy.notCalled.should.be.true hasEvent(el.listeners, 'keypress').should.be.true getEventListener(el.listeners, 'keypress')() trackEventSpy.withArgs('category', 'action', 'label').calledOnce.should.be.true }) it('should be able to chain multi modifiers as events', () => { binding.value = 'category, action, label, 666' binding.modifiers = { keypress: true, mouseup: true, mousedown: true } trackEvent(el, binding) trackEventSpy.notCalled.should.be.true hasEvent(el.listeners, 'keypress').should.be.true getEventListener(el.listeners, 'keypress')() hasEvent(el.listeners, 'mouseup').should.be.true getEventListener(el.listeners, 'mouseup')() hasEvent(el.listeners, 'mousedown').should.be.true getEventListener(el.listeners, 'mousedown')() trackEventSpy.withArgs('category', 'action', 'label', '666').calledThrice.should.be.true }) it('should be able to pass an object as value', () => { binding.value = { category: 'category', action: 'action', label: 'label', value: 666, nodeid: 'node' } trackEvent(el, binding) trackEventSpy.notCalled.should.be.true hasEvent(el.listeners, 'click').should.be.true getEventListener(el.listeners, 'click')() trackEventSpy.withArgs('category', 'action', 'label', 666, 'node').calledOnce.should.be.true }) it('should skip when value is not changed', () => { binding.value = binding.oldValue = { category: 'category', action: 'action', label: 'label', value: 666, nodeid: 'node' } const addEventListener = sandbox.spy(el, 'addEventListener') trackEvent(el, binding) trackEventSpy.notCalled.should.be.true addEventListener.notCalled.should.be.true }) it('should skip when value is empty', () => { const addEventListener = sandbox.spy(el, 'addEventListener') trackEvent(el, binding) trackEventSpy.notCalled.should.be.true addEventListener.notCalled.should.be.true }) it('should prevent duplicated binding when update', () => { binding.value = 'category, action' trackEvent(el, binding) binding.oldValue = { category: 'category', action: 'action' } binding.value = 'new-category, new-action' trackEvent(el, binding) hasEvent(el.listeners, 'click').should.be.true el.listeners.filter(listener => listener.event === 'click').length.should.equal(1) }) }) ================================================ FILE: test/specs/directives/track-pageview.spec.js ================================================ import trackPageview, { watch } from 'src/directives/track-pageview' import uweb from 'src/index' import { htmlElement } from '../../mocks' describe('directives.track-pageview', () => { let el = htmlElement() let binding = null let sandbox = null let trackPageviewSpy = null before(() => { sandbox = sinon.sandbox.create() }) beforeEach(() => { el = htmlElement() binding = { } trackPageviewSpy = sandbox.spy(uweb, 'trackPageview') }) afterEach(() => { sandbox.restore() }) describe('should work with v-show', () => { beforeEach(() => { binding.value = 'v-show' }) it('should watch a v-show binded element when it is not displayed', () => { el.style.display = 'none' trackPageview.bind(el, binding) trackPageviewSpy.notCalled.should.be.true watch.should.have.lengthOf(1) watch[0].should.equal(el) }) it('should send request when a v-show binded element it is displayed', () => { el = watch[0] el.style.display = 'block' trackPageview.update(el, binding) trackPageviewSpy.withArgs('v-show').calledOnce.should.be.true watch.should.have.lengthOf(0) watch.should.not.include(el) }) it('should remove from watch queue when a v-show binded element is unbinded', () => { watch.push(el) trackPageview.unbind(el, binding) watch.should.have.lengthOf(0) watch.should.not.include(el) }) }) it('should be able to pass an object as value', () => { binding.value = { content_url: '/foo', referer_url: 'vue-uweb.com' } trackPageview.bind(el, binding) trackPageviewSpy.withArgs(binding.value.content_url, binding.value.referer_url).calledOnce.should.be.true watch.should.have.lengthOf(0) }) it('should return when value is empty', () => { trackPageview.bind(el, binding) trackPageviewSpy.notCalled.should.be.true watch.should.have.lengthOf(0) }) it('should return when value is not changed', () => { binding.value = binding.oldValue = 'same' trackPageview.bind(el, binding) trackPageviewSpy.notCalled.should.be.true watch.should.have.lengthOf(0) }) }) ================================================ FILE: test/specs/directives/util.spec.js ================================================ import { isEmpty, notChanged } from 'src/directives/util' describe('directives.util', () => { describe('skip', () => { const binding = {} it('should be empty when value is empty', () => { binding.value = '' isEmpty(binding).should.be.true binding.value = undefined isEmpty(binding).should.be.true binding.value = null isEmpty(binding).should.be.true }) it('should be not empty when value is false', () => { binding.value = false isEmpty(binding).should.be.false }) it('should be not changed when value is equal to oldValue', () => { binding.value = binding.oldValue = 'notChanged' notChanged(binding).should.be.true binding.value = binding.oldValue = { a: 'notChanged' } notChanged(binding).should.be.true }) it('should not changed when oldValue is undefined', () => { binding.value = binding.oldValue = undefined notChanged(binding).should.be.false }) it('should not be changed when value and oldValue are deep equal', () => { const binding = { value: { foo: 'foo', bar: 'bar' }, oldValue: { foo: 'foo', bar: 'bar' } } notChanged(binding).should.be.true }) }) }) ================================================ FILE: test/specs/index.spec.js ================================================ import Vue from 'vue' import uweb from 'src/index' import chai from 'chai' describe('vue-uweb', () => { let sandbox = null const should = chai.should() const method = 'new' const methods = [ 'trackPageview', 'trackEvent', 'setCustomVar', 'setAccount', 'setAutoPageview', 'deleteCustomVar' ] before(() => { sandbox = sinon.sandbox.create() }) afterEach(() => { sandbox.restore() }) it('should contain uweb apis', () => { methods.forEach((method) => { uweb.should.have.property(method) uweb[method].should.be.a('function') }) }) describe('install', function () { it('should load script successfully', function (done) { this.timeout(30 * 1000) const _resolve = sandbox.spy(uweb, '_resolve') const setAccount = sandbox.spy(uweb, 'setAccount') const setAutoPageview = sandbox.spy(uweb, 'setAutoPageview') const siteId = '1261414301' Vue.use(uweb, siteId) uweb.ready().then(() => { Vue.prototype.should.have.property('$uweb') Vue.prototype.$uweb.should.eql(uweb) Vue.directive('auto-pageview').should.exist Vue.directive('track-event').should.exist Vue.directive('track-pageview').should.exist uweb._cache.should.eql([]) _resolve.calledOnce.should.be.true setAccount.calledOnce.should.be.true setAutoPageview.calledOnce.should.be.true uweb.install.installed.should.be.true window._czc.should.exist const scripts = document.body.getElementsByTagName('script') scripts[scripts.length - 1].src.indexOf(siteId).should.not.equal(-1) done() }) }) }) it('should provide default parameters', () => { const _czc = window._czc window._czc = [] const args = ['category', 'aciton', 'label', 999, 'nodeid'] const trackEvent = uweb.trackEvent uweb.trackEvent = (category, action = args[1], label = args[2], value = args[3], nodeid = args[4]) => { trackEvent.call(uweb, category, action, label, value, nodeid) } uweb.trackEvent(args[0]) window._czc.should.have.lengthOf(1) window._czc[0].should.eql(['_trackEvent', ...args]) window._czc = _czc uweb.trackEvent = trackEvent }) describe('_createMethod', () => { let array = null beforeEach(() => { array = null sandbox.stub(uweb, '_push').callsFake((arr) => { array = arr }) }) after(() => { delete uweb[method] }) it('should reurn a new method', () => { uweb[method] = uweb._createMethod(method) uweb[method].should.be.a('function') }) it('should pass 1 parameters to _push', () => { uweb[method]('1') array[0].should.equal(`_${method}`) array[1].should.equal('1') should.not.exist(array[2]) }) it('should pass 2 parameters to _push', () => { uweb[method]('1', '2') array[0].should.equal(`_${method}`) array[1].should.equal('1') array[2].should.equal('2') should.not.exist(array[3]) }) it('should pass 3 parameters to _push', () => { uweb[method]('1', '2', '3') array[0].should.equal(`_${method}`) array[1].should.equal('1') array[2].should.equal('2') array[3].should.equal('3') }) }) describe('patch', () => { it('should create a new method', () => { const _createMethod = sandbox.spy(uweb, '_createMethod') uweb.patch(method) _createMethod.calledOnce.should.be.true uweb[method].should.be.a('function') }) }) describe('_push', () => { let _czc = null const arg = ['_trackEvent', 'click', 'event'] before(() => { _czc = window._czc }) afterEach(() => { window._czc = _czc uweb._cache = [] }) it('should push into cache', () => { window._czc = undefined uweb._push(arg) uweb._cache.should.have.lengthOf(1) uweb._cache[0].should.equal(arg) }) it('should push into _czc', () => { window._czc = [] uweb._push(arg) window._czc.should.have.lengthOf(1) window._czc[0].should.equal(arg) }) }) }) ================================================ FILE: test/visual.js ================================================ import 'style-loader!css-loader!mocha-css' // create a div where mocha can add its stuff const mochaDiv = document.createElement('DIV') mochaDiv.id = 'mocha' document.body.appendChild(mochaDiv) import 'mocha/mocha.js' import sinon from 'sinon' import chai from 'chai' window.mocha.setup({ ui: 'bdd', slow: 750, timeout: 5000, globals: [ '__VUE_DEVTOOLS_INSTANCE_MAP__', 'script', 'inject', 'originalOpenFunction' ] }) window.sinon = sinon chai.use(require('chai-dom')) chai.use(require('sinon-chai')) chai.should() let vms = [] let testId = 0 beforeEach(function () { this.DOMElement = document.createElement('DIV') this.DOMElement.id = `test-${++testId}` document.body.appendChild(this.DOMElement) }) afterEach(function () { const testReportElements = document.getElementsByClassName('test') const lastReportElement = testReportElements[testReportElements.length - 1] if (!lastReportElement) return const el = document.getElementById(this.DOMElement.id) if (el) lastReportElement.appendChild(el) // Save the vm to hide it later if (this.DOMElement.vm) vms.push(this.DOMElement.vm) }) // Hide all tests at the end to prevent some weird bugs before(function () { vms = [] testId = 0 }) after(function () { requestAnimationFrame(function () { setTimeout(function () { vms.forEach(vm => { // Hide if test passed if (!vm.$el.parentElement.classList.contains('fail')) { vm.$children[0].visible = false } }) }, 100) }) }) const specsContext = require.context('./specs', true) specsContext.keys().forEach(specsContext) window.mocha.checkLeaks() window.mocha.run()