[
  {
    "path": ".eslintignore",
    "content": "dist/*\nbuild/*\ntests/html/lib/sockjs.js\ntests/html/static/*\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n  \"extends\": [\"eslint:recommended\"],\n  \"env\": {\n    \"node\": true,\n    \"browser\": true\n  },\n  \"rules\": {\n    \"consistent-this\": [\"error\", \"self\"],\n    \"quotes\": [\"warn\", \"single\", \"avoid-escape\"],\n    \"no-space-before-semi\": \"off\",\n    \"no-underscore-dangle\": \"off\",\n    \"no-mixed-requires\": \"off\"\n  },\n  \"globals\": {\n    \"Uint8Array\": true\n  }\n}\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ntidelift: npm/sockjs-client\n"
  },
  {
    "path": ".github/workflows/node.js.yml",
    "content": "# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node\n# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs\n\nname: Node.js CI\n\non:\n  push:\n    branches: [ \"main\" ]\n  pull_request:\n    branches: [ \"main\" ]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        node-version: [18.x, 20.x, 22.x]\n        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/\n\n    steps:\n    - uses: actions/checkout@v4\n    - name: Use Node.js ${{ matrix.node-version }}\n      uses: actions/setup-node@v4\n      with:\n        node-version: ${{ matrix.node-version }}\n        cache: 'npm'\n    - run: npm ci\n    - run: npm run build --if-present\n    - run: npm test\n"
  },
  {
    "path": ".github/workflows/stale.yml",
    "content": "name: Mark stale issues\n\non:\n  schedule:\n  - cron: \"0 0 * * *\"\n\njobs:\n  stale:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/stale@v3\n      with:\n        repo-token: ${{ secrets.GITHUB_TOKEN }}\n        days-before-stale: 30\n        days-before-close: 5\n        stale-issue-message: 'This issue has been inactive for 30 days. It will be in closed in 5 days without any new activity.'\n        stale-issue-label: 'no-issue-activity'\n        any-of-labels: 'inactive'\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea\n.pidfile.pid\nnode_modules\nnpm-debug.log\nsockjs.js\nsockjs.min.js\nbuild/\ntests/html/lib/sockjs.js.map\nlocal.log\n"
  },
  {
    "path": ".jscsrc",
    "content": "{\n  \"requireCurlyBraces\": [\"if\", \"else\", \"for\", \"while\", \"do\", \"try\", \"catch\"],\n  \"requireSpaceAfterKeywords\": [\"do\", \"for\", \"if\", \"else\", \"switch\", \"case\", \"try\", \"catch\", \"void\", \"while\", \"with\", \"return\", \"typeof\"],\n  \"requireSpaceBeforeBlockStatements\": true,\n  \"requireParenthesesAroundIIFE\": true,\n  \"requireSpacesInConditionalExpression\": true,\n  \"requireSpacesInFunction\": {\n    \"beforeOpeningCurlyBrace\": true\n  },\n  \"disallowSpacesInFunction\": {\n    \"beforeOpeningRoundBrace\": true\n  },\n  \"disallowSpacesInCallExpression\": true,\n  \"requireBlocksOnNewline\": true,\n  \"disallowCommaBeforeLineBreak\": true,\n  \"requireCapitalizedConstructors\": true,\n  \"validateQuoteMarks\": { \"escape\": true, \"mark\": \"'\" },\n  \"validateIndentation\": 2,\n  \"validateParameterSeparator\": \", \"\n}"
  },
  {
    "path": ".npmignore",
    "content": "tests/\ndist/\n!dist/sockjs.js\n!dist/sockjs.js.map\n!dist/sockjs.min.js\n!dist/sockjs.min.js.map\nbuild/\n.eslintrc\n.eslintignore\n.jscsrc\n.nvmrc\nbower.json\ngulpfile.js\nMakefile\nimg/\nkarma.conf.js\nbuild.sh\n.github/\nlocal.log\n"
  },
  {
    "path": ".nvmrc",
    "content": "12\n"
  },
  {
    "path": "AUTHORS",
    "content": "# This is the list of sockjs-client authors for copyright purposes.\n#\n# This does not necessarily list everyone who has contributed code, since in\n# some cases, their employer may be the copyright holder.  To see the full list\n# of contributors, see the revision history in source control.\nBryce Kahle\nMarek Majkowski\nVMWare\nLearnBoost\nJulian Aubourg\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors and maintainers pledge to making participation in our project and\nour community a harassment-free experience for everyone, regardless of age, body\nsize, disability, ethnicity, sex characteristics, gender identity and expression,\nlevel of experience, education, socio-economic status, nationality, personal\nappearance, race, religion, or sexual identity and orientation.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment\ninclude:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or\n advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic\n address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n professional setting\n\n## Our Responsibilities\n\nProject maintainers are responsible for clarifying the standards of acceptable\nbehavior and are expected to take appropriate and fair corrective action in\nresponse to any instances of unacceptable behavior.\n\nProject maintainers have the right and responsibility to remove, edit, or\nreject comments, commits, code, wiki edits, issues, and other contributions\nthat are not aligned to this Code of Conduct, or to ban temporarily or\npermanently any contributor for other behaviors that they deem inappropriate,\nthreatening, offensive, or harmful.\n\n## Scope\n\nThis Code of Conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community. Examples of\nrepresenting a project or community include using an official project e-mail\naddress, posting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event. Representation of a project may be\nfurther defined and clarified by project maintainers.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by contacting the project team at sockjs@brycekahle.com. All\ncomplaints will be reviewed and investigated and will result in a response that\nis deemed necessary and appropriate to the circumstances. The project team is\nobligated to maintain confidentiality with regard to the reporter of an incident.\nFurther details of specific enforcement policies may be posted separately.\n\nProject maintainers who do not follow or enforce the Code of Conduct in good\nfaith may face temporary or permanent repercussions as determined by other\nmembers of the project's leadership.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,\navailable at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html\n\n[homepage]: https://www.contributor-covenant.org\n\nFor answers to common questions about this code of conduct, see\nhttps://www.contributor-covenant.org/faq\n"
  },
  {
    "path": "Changelog.md",
    "content": "1.6.2\n==\n * Added ECMAScript build with TypeScript types.\n\n1.6.1\n==\nFixes\n * Update `eventsource` to `2.0.2` due to CVE-2022-1650. Fixes #590\n * Update `minimist` to `1.2.6`. Fixes #585\n\n1.6.0\n==\nFixes\n * Remove `agent: false` to allow usage of `globalAgent`. Fixes #421\n\ndependencies\n * Update `url-parse` due to CVE-2022-0686, CVE-2022-0639, and CVE-2022-0512. Fixes #576\n * Remove `json3` dependency. Fixes #476\n * Update `eventsource` to `1.1.0`\n * Update `faye-websocket` to `0.11.4`\n * Update `debug` to `3.2.7`\n\ndevDependencies\n * Update `follow-redirects` (devDep) due to CVE-2022-0536 and CVE-2022-0155\n * Update `karma` (devDep) due to CVE-2022-0437\n * Update `cached-path-relative` (devDep) due to CVE-2021-23518\n * Update `fsevents` (devDep) to fix:\n   * `ini` CVE-2020-7788\n   * `minimist` CVE-2020-7598\n   * `tar` CVE-2021-37713, CVE-2021-37701, CVE-2021-32804, CVE-2021-32803\n * Update `copy-props` (devDep) due to CVE-2020-28503\n * Update `eslint`, `mocha`, `gulp-replace`, `karma-browserify`, `gulp-sourcemaps`, and `browserify`\n\nOther Changes\n * Remove bower\n * Remove Travis CI\n * Require Node.js 12\n\n1.5.2\n==\n * Update `url-parse` due to CVE-2021-3664.\n\n1.5.1\n==\n * Update `url-parse` due to CVE-2021-27515.\n\n1.5.0\n==\n * Update `url-parse`, `kind-of`, `minimist`, `websocket-extensions` due to security vulnerabilies.\n * Update dev dependencies.\n * Allow loopback address hostnames on a secure page. Fixes #486\n * Enable eventsource transport for node.js clients.\n\n1.4.0\n==\n * Add `timeout` option to set a minimum transport timeout. Fixes #403\n * Update dev deps to fix security warnings from `npm audit`\n * Guard against null `this._transport` in `debug` statement. Fixes #448\n\n1.3.0\n==\n * Revert `debug` to `^3` because v4 starts using ES6. Fixes #457\n\n1.2.0\n==\n * Update all outdated dependencies\n * Switch to karma and browserstack for running automated browser tests\n\n1.1.5\n==\n * Wrap the the contentWindow access in a try/catch block when in setTimeout #363\n * Revised example in README #356\n * Fix connection close when Transport timeout #358\n * Fixed crash with react-native@0.45.1 on Android #386\n * Update jsDelivr link #404, #405\n * Remove Sauce Labs unsupported browsers\n * Add link to rust server implementation #411\n * location.protocol should include final `:` #396\n\n1.1.4\n==\n * Upgrade `debug` and fix object key literal mangling, fixes regression in Opera 11.10 #359\n * Trim descriptions in package.json and bower.json - #372\n\n1.1.3\n==\n  * Bad publish to NPM (removed)\n\n1.1.2\n==\n\n * Ensure both sender and receiver are cleaned upon close - #342\n * Remove event listeners before calling `close` - #344\n * Update documentation links - #351, #339, #316\n * Explicitly export `undefined` when `WebSocket` does not exist. Fixes Webpack. #321\n * Include `dist` folder on npm - #265\n * Simplify build setup\n * Update to Node.js 6.9\n * Add sourcemap for minified version\n * Remove unused String.trim shim\n\n1.1.1\n==\n\n * Do not pass `protocols` or `options` arguments to browser WebSocket constructor - #309\n\n1.1.0\n==\n\n * Fix IE7/8 usage of `console.log` which does not have `apply` - #279\n * Remove `dbg` global variable - #282\n * Bump `faye-websocket` version to `0.11.0` - #267\n * Optimize `arguments` usage - #263\n * Add sourcemap file to dist folder - #237\n * Add way to transparently pass transport-specific options - #272\n\n1.0.3\n==\n\n * Use `https` module for xhr requests in node when url uses https - #254\n\n1.0.2\n==\n\n * Fix iframe info receiver url\n * Move iframe.contentWindow check inside setTimeout - #246\n\n1.0.1\n==\n\n * Use proper base url for iframe-based info receiver - #249\n * Don't register unload event in chrome packaged app - #223\n * Allow custom session ids - #250\n * Remove version property from bower.json - #247\n * Update example CDN url - #244\n\n1.0.0\n===\n\n * Simplify url handling by delegating to `url-parse` - #242\n * Upgrade to `url-parse` 1.0.1 to fix colon issue if auth has no password\n\n1.0.0-beta.13\n===\n\n * Transport timeout on connection should fallback - #238\n\n1.0.0-beta.12\n====\n\n * Upgrade `url-parse` to 1.0.0 to fix #218 again\n\n1.0.0-beta.10\n====\n\n * Upgrade `url-parse` to 0.2.3 to fix #222\n\n1.0.0-beta.9\n====\n\n * Upgrade `url-parse` to 0.2.1 to fix 'too much recursion' errors\n\n1.0.0-beta.8\n====\n\n * Upgrade `url-parse` to 0.2.0 to fix inheritance issues\n\n1.0.0-beta.7\n====\n\n * Upgrade `url-parse` to 0.1.5 to fix #218\n * Don't strip basic auth from url - #219\n\n1.0.0-beta.6\n====\n\n * Upgrade `url-parse` to 0.1.3 to avoid CSP issues\n\n1.0.0-beta.5\n=====\n\n * Upgrade `url-parse` to 0.1.1 to fix #214\n\n1.0.0-beta.4\n=====\n\n * Upgrade `url-parse` to 0.1.0 and `sockjs` to 0.3.11\n * Update .npmignore\n\n1.0.0-beta.3\n=====\n\n * Move `debug` from devDependencies to dependencies\n\n1.0.0-beta.2\n=====\n\n * Relax requirements when using same origin XHR - #80\n * Upgrade to JSON3 from JSON2 - #123\n * Package library with browserify supporting the UMD pattern - #184\n * Move tests to JavaScript\n * Add Gulp.js build script\n * Fix getOrigin for file:/// urls and standard ports - #173\n * Add onerror event handlers to Websockets - #169\n * Increase RTO lower bound to prevent spurious timeouts on IE8/9 - #161\n * Use window.crypto for random values when available - #128\n * Fix handling of listeners added and removed mid-dispatch - #127\n * Fix XHR Streaming for IE8 - #83\n * Remove explicit AMD name - #107\n * Check for an empty response from /info request - #143\n * Add Content-Type to XHR requests to fix issue over HTTPS on Galaxy S4 - #164\n * Fix iframe fallback when message is sent from a popup in IE7/8 - #166\n * Add support for query strings on the url - #72\n * Now works inside of Web Workers - #181\n * Support EventSource / Server Sent Events outside of iframes - #201\n * Rename protocols to transports - #65\n * Allow transports which need the body to trigger on 'interactive' readyState - #175\n * try/catch access to document.domain - #187\n * Use `window.location` instead of `document.location` - #195\n * Allow usage from node.js with same API\n\n0.3.4\n=====\n\n * Mentioned njoyce's fork of sockjs-gevent.\n * #90 - Don't catch onbeforeunload event - it breaks javascript://\n   links in IE.\n * IE mangles 204 response code for 1223 on ajax, see:\n   http://bugs.jquery.com/ticket/1450\n * Make `new` optional for SockJS constructor (via substack).\n * It is impossible to cancel JSONP polling request - compensate for that.\n * Refactored EventEmitter prototype (used only internally)\n * #66 - Failure to post data to /xhr_send should kill the session\n\n\n0.3.2\n=====\n\n * #77 - Getting /info on modern browsers when html is served from\n         file:// urls was broken.\n\n0.3.1\n=====\n\n * #61 - Meteor guys found that we unintentionally catch \"onopen\" errors.\n * #63 - Meteorjs guys found that xhr-streaming on Safari sometimes\n   left busy cursor running.\n * Increased allowed time for websocket transport (from 1 rtt to 2),\n   this should make ws transport more reliable over SSL, at the cost\n   of slightly longer connection time for users with blocked ws.\n * #57 - previous fix didn't really work, sockjs-client still left\n   a mess in browsers history when using iframe transports. This\n   is fixed now.\n * #60 - Opera 12 (next) claims to do AJAX2 / CORS, but can't\n   do xhr-streaming.\n * #58 - onunload test sometimes failed on Safari on windows\n * Updated readme WRT websocket protocols\n * Updated readme WRT deployments on heroku\n * Add minimalistic license block to every source file.\n\n\n0.3.0\n=====\n\n * Temporarily disabled iframe tests - they are failing unpredictably.\n * #57 - pointing an iframe to \"about:blank\" during cleanup caused\n   Opera to messup history.\n * #55 - Improved iframe abstraction (reduced a possible mem leak)\n * Refactored AJAX abstractions, for better CORS handing - again.\n * Add additional parent origin security check to an iframe.\n * Urls with hashes or query strings can't be passed to SockJS.\n * #18 - Mention workaround for Firefox ESC key issue\n * #53 - AMD compliance\n * sockjs/sockjs-protocol#28 - always use square brackets for\n   websocket frames\n * #51 - initial support for IE10 - try XHR before XDR\n * #28 - handle onunload / onbeforeunload in a more robust fashion\n * #49 - support SockJS-client being used from files served from\n   file:// urls.\n\n\n0.2.1\n=====\n\n * \"smoke-latency.html\" test was unnecesairly sending too much data.\n * Bumped core dependencies (coffee-script and uglify-js)\n * Minor updates to the README, few cosmetic changes in the code.\n\n\n0.2.0\n=====\n\n * The API had changed - use `protocols_whitelist` option instead of\n   passing  an array of protocols as a second argument to SockJS constructor.\n * Dropped 'chunking-test' functionality and replace it with 'info'.\n * Rewritten protocol-choosing alogirthm, see \"utils.detectProtocols\" method.\n * Use dynamic protocol timeouts based on RTT, not hardcoded 5 seconds\n * #34 - Don't ever reuse `session_id`, especially when trying\n   fallback protocols.\n * The test server got moved from SockJS-client to SockJS-node.\n * Don't test unicode surrogates - it can't work in some environments.\n * XHR/XDR helpers were rewritten, ajax transports were simplified.\n * Added a domain check in the iframe to improve security.\n * SockJS will now trigger 1002 error if there is a problem during handshake\n   instead of 2000 error.\n * Smoke-throughput test is renamed to smoke-latency.\n\n0.1.2\n=====\n\n * #29 - Allow all unicode characters to be send over SockJS.\n * #15 - SockJS should now work fine even if the connection is started\n   in HEAD, before BODY is loaded.\n * #28 - In rare circumstances WebSocket connection can be left intact\n   after the page is unloaded in FireFox.\n * Updated scripts to work with Node 0.6.\n * Initial work to do better QUnit testing.\n * Updated the minifying script (always escape unicode chars, remove\n   trailing comment).\n * Use string instead of array of chars (utils.js:random_number_string).\n\n\n0.1.1\n=====\n\n * #21 Get JsonP transport working on IE9 (Vladimir Dronnikov).\n * #26 Emit heartbeat event.\n * #27 Include license inline.\n\n\n0.1.0\n=====\n\n * SockJS-client can only send UTF-8 encodable strings.  Previously we\n   took advantage of rich data structures and automatically\n   json-encoded them, but this got removed.  Now, all data passed to\n   `send` will be converted to string. This is also how native\n * `status` property on `EventClose` is renamed to `code`\n   as per Websocket API\n   WebSockets behave.\n * The test server was updated to new `sockjs-node` API\n * Fixed problem with Jsonp-polling transport on IE9\n * Repository was moved - updated links.\n\n\n0.0.4\n=====\n\n * All transports were refactored, some transports were introduced:\n   htmlfile and separate xhr-streaming.\n * Added logic to detect support for http chunking, and thus a\n   possibility to rule out streaming transports before running them.\n * Added 'cookie' option, useful for cookie-based load balancing\n   (currently, it make a difference only for IE).\n * Added hack to prevent EventSource from crashing Safari and Chrome.\n * Loads and loads of other small and medium changes.\n\n\n0.0.2\n=====\n\n * Initial support for JSESSIONID based load balancing. Currently\n   doesn't play nicely with IE XDomainRequest transport.\n\n\n0.0.1\n=====\n\n * Initial release.\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2011-2018 The sockjs-client Authors.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "\n# SockJS-client\n\n[![npm version](https://img.shields.io/npm/v/sockjs-client.svg?style=flat-square)](https://www.npmjs.com/package/sockjs-client)[![Dependencies](https://img.shields.io/librariesio/release/npm/sockjs-client.svg?style=flat-square)](https://libraries.io/npm/sockjs-client)[![Chat](https://img.shields.io/badge/Chat-gitter.im-blue.svg?style=flat-square)](https://gitter.im/sockjs/sockjs-client)[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](CODE_OF_CONDUCT.md)\n[![BrowserStack Status](https://automate.browserstack.com/badge.svg?badge_key=N3V0cStKM3RtUy9Bb2l2cHFhMVdobTZnUitBZ1lLcUkwYnl2TWgyMHppQT0tLWxncU5UeTdLb0Rqc1VQQTI5SklRelE9PQ==--596ccf9d3cd2f462f1043ee6803a9405e00446ac)](https://automate.browserstack.com/public-build/N3V0cStKM3RtUy9Bb2l2cHFhMVdobTZnUitBZ1lLcUkwYnl2TWgyMHppQT0tLWxncU5UeTdLb0Rqc1VQQTI5SklRelE9PQ==--596ccf9d3cd2f462f1043ee6803a9405e00446ac)\n\n<a href=\"https://www.netlify.com\">\n  <img src=\"https://www.netlify.com/img/global/badges/netlify-color-accent.svg\"/>\n</a>\n\n# SockJS for enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of SockJS and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-sockjs-client?utm_source=npm-sockjs-client&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)\n\n# Summary\n\nSockJS is a browser JavaScript library that provides a WebSocket-like\nobject. SockJS gives you a coherent, cross-browser, Javascript API\nwhich creates a low latency, full duplex, cross-domain communication\nchannel between the browser and the web server.\n\nUnder the hood SockJS tries to use native WebSockets first. If that\nfails it can use a variety of browser-specific transport protocols and\npresents them through WebSocket-like abstractions.\n\nSockJS is intended to work for all modern browsers and in environments\nwhich don't support the WebSocket protocol -- for example, behind restrictive\ncorporate proxies.\n\nSockJS-client does require a server counterpart:\n\n * [SockJS-node](https://github.com/sockjs/sockjs-node) is a SockJS\n   server for Node.js.\n\n\nPhilosophy:\n\n * The API should follow\n   [HTML5 Websockets API](https://www.w3.org/TR/websockets/) as\n   closely as possible.\n * All the transports must support cross domain connections out of the\n   box. It's possible and recommended to host a SockJS server on a\n   different server than your main web site.\n * There is support for at least one streaming protocol for every\n   major browser.\n * Streaming transports should work cross-domain and\n   should support cookies (for cookie-based sticky sessions).\n * Polling transports are used as a fallback for old browsers and\n   hosts behind restrictive proxies.\n * Connection establishment should be fast and lightweight.\n * No Flash inside (no need to open port 843 - which doesn't work\n   through proxies, no need to host 'crossdomain.xml', no need\n   [to wait for 3 seconds](https://github.com/gimite/web-socket-js/issues/49)\n   in order to detect problems)\n\n\nSubscribe to\n[SockJS mailing list](https://groups.google.com/forum/#!forum/sockjs) for\ndiscussions and support.\n\n# SockJS family\n\n  * [SockJS-client](https://github.com/sockjs/sockjs-client) JavaScript client library\n  * [SockJS-node](https://github.com/sockjs/sockjs-node) Node.js server\n  * [SockJS-erlang](https://github.com/sockjs/sockjs-erlang) Erlang server\n  * [SockJS-cyclone](https://github.com/flaviogrossi/sockjs-cyclone) Python/Cyclone/Twisted server\n  * [SockJS-tornado](https://github.com/MrJoes/sockjs-tornado) Python/Tornado server\n  * [SockJS-twisted](https://github.com/DesertBus/sockjs-twisted/) Python/Twisted server\n  * [SockJS-aiohttp](https://github.com/aio-libs/sockjs/) Python/Aiohttp server\n  * [Spring Framework](https://projects.spring.io/spring-framework) Java [client](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/web.html#websocket-fallback-sockjs-client) & server\n  * [vert.x](https://github.com/vert-x/vert.x) Java/vert.x server\n  * [Xitrum](https://xitrum-framework.github.io/) Scala server\n  * [Atmosphere Framework](https://github.com/Atmosphere/atmosphere) JavaEE Server, Play Framework, Netty, Vert.x\n  * [Actix SockJS](https://github.com/fafhrd91/actix-sockjs) Rust Server, Actix Framework\n\nWork in progress:\n\n  * [SockJS-ruby](https://github.com/nyarly/sockjs-ruby)\n  * [SockJS-netty](https://github.com/cgbystrom/sockjs-netty)\n  * [SockJS-gevent](https://github.com/ksava/sockjs-gevent) ([SockJS-gevent fork](https://github.com/njoyce/sockjs-gevent))\n  * [pyramid-SockJS](https://github.com/fafhrd91/pyramid_sockjs)\n  * [wildcloud-websockets](https://github.com/wildcloud/wildcloud-websockets)\n  * [wai-SockJS](https://github.com/Palmik/wai-sockjs)\n  * [SockJS-perl](https://github.com/vti/sockjs-perl)\n  * [SockJS-go](https://github.com/igm/sockjs-go/)\n  * [syp.biz.SockJS.NET](https://github.com/sypbiz/SockJS.NET) - .NET port of the SockJS client\n\n# Getting Started\n\nSockJS mimics the [WebSockets API](https://www.w3.org/TR/websockets/),\nbut instead of `WebSocket` there is a `SockJS` Javascript object.\n\nFirst, you need to load the SockJS JavaScript library. For example, you can\nput that in your HTML head:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js\"></script>\n```\n\nAfter the script is loaded you can establish a connection with the\nSockJS server. Here's a simple example:\n\n```javascript\n var sock = new SockJS('https://mydomain.com/my_prefix');\n sock.onopen = function() {\n     console.log('open');\n     sock.send('test');\n };\n\n sock.onmessage = function(e) {\n     console.log('message', e.data);\n     sock.close();\n };\n\n sock.onclose = function() {\n     console.log('close');\n };\n\n```\n\n# SockJS-client API\n\n## SockJS class\n\nSimilar to the 'WebSocket' API, the 'SockJS' constructor takes one or more arguments:\n\n```javascript\nvar sockjs = new SockJS(url, _reserved, options);\n```\n\n`url` may contain a query string, if one is desired.\n\nWhere `options` is a hash which can contain:\n\n *  **server (string)**\n\n    String to append to url for actual data connection. Defaults to a random 4 digit number.\n\n *  **transports (string OR array of strings)**\n\n    Sometimes it is useful to disable some fallback transports. This\n    option allows you to supply a list transports that may be used by\n    SockJS. By default all available transports will be used.\n\n *  **sessionId (number OR function)**\n\n    Both client and server use session identifiers to distinguish connections.\n    If you specify this option as a number, SockJS will use its random string\n    generator function to generate session ids that are N-character long\n    (where N corresponds to the number specified by **sessionId**).\n    When you specify this option as a function, the function must return a\n    randomly generated string. Every time SockJS needs to generate a session\n    id it will call this function and use the returned string directly.\n    If you don't specify this option, the default is to use the default random\n    string generator to generate 8-character long session ids.\n\n  * **timeout (number)**\n\n    Specify a minimum timeout in milliseconds to use for the transport connections.\n    By default this is dynamically calculated based on the measured RTT and\n    the number of expected round trips. This setting will establish a minimum,\n    but if the calculated timeout is higher, that will be used.\n\nAlthough the 'SockJS' object tries to emulate the 'WebSocket'\nbehaviour, it's impossible to support all of its features. An\nimportant SockJS limitation is the fact that you're not allowed to\nopen more than one SockJS connection to a single domain at a time.\nThis limitation is caused by an in-browser limit of outgoing\nconnections - usually [browsers don't allow opening more than two\noutgoing connections to a single domain](https://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser). A single SockJS session\nrequires those two connections - one for downloading data, the other for\nsending messages.  Opening a second SockJS session at the same time\nwould most likely block, and can result in both sessions timing out.\n\nOpening more than one SockJS connection at a time is generally a\nbad practice. If you absolutely must do it, you can use\nmultiple subdomains, using a different subdomain for every\nSockJS connection.\n\n# Supported transports, by browser (html served from http:// or https://)\n\n_Browser_       | _Websockets_     | _Streaming_ | _Polling_\n----------------|------------------|-------------|-------------------\nIE 6, 7         | no               | no          | jsonp-polling\nIE 8, 9 (cookies=no) |    no       | xdr-streaming &dagger; | xdr-polling &dagger;\nIE 8, 9 (cookies=yes)|    no       | iframe-htmlfile | iframe-xhr-polling\nIE 10           | rfc6455          | xhr-streaming   | xhr-polling\nChrome 6-13     | hixie-76         | xhr-streaming   | xhr-polling\nChrome 14+      | hybi-10 / rfc6455| xhr-streaming   | xhr-polling\nFirefox <10     | no &Dagger;      | xhr-streaming   | xhr-polling\nFirefox 10+     | hybi-10 / rfc6455| xhr-streaming   | xhr-polling\nSafari 5.x      | hixie-76         | xhr-streaming   | xhr-polling\nSafari 6+       | rfc6455          | xhr-streaming   | xhr-polling\nOpera 10.70+    | no &Dagger;      | iframe-eventsource | iframe-xhr-polling\nOpera 12.10+    | rfc6455          | xhr-streaming | xhr-polling\nKonqueror       | no               | no          | jsonp-polling\n\n\n * **&dagger;**: IE 8+ supports [XDomainRequest][^9], which is\n    essentially a modified AJAX/XHR that can do requests across\n    domains. But unfortunately it doesn't send any cookies, which\n    makes it inappropriate for deployments when the load balancer uses\n    JSESSIONID cookie to do sticky sessions.\n\n * **&Dagger;**: Firefox 4.0 and Opera 11.00 and shipped with disabled\n     Websockets \"hixie-76\". They can still be enabled by manually\n     changing a browser setting.\n\n# Supported transports, by browser (html served from file://)\n\nSometimes you may want to serve your html from \"file://\" address - for\ndevelopment or if you're using PhoneGap or similar technologies. But\ndue to the Cross Origin Policy files served from \"file://\" have no\nOrigin, and that means some of SockJS transports won't work. For this\nreason the SockJS transport table is different than usually, major\ndifferences are:\n\n_Browser_       | _Websockets_  | _Streaming_        | _Polling_\n----------------|---------------|--------------------|-------------------\nIE 8, 9         | same as above | iframe-htmlfile    | iframe-xhr-polling\nOther           | same as above | iframe-eventsource | iframe-xhr-polling\n\n# Supported transports, by name\n\n_Transport_          | _References_\n---------------------|---------------\nwebsocket (rfc6455)  | [rfc 6455][^10]\nwebsocket (hixie-76) | [draft-hixie-thewebsocketprotocol-76][^1]\nwebsocket (hybi-10)  | [draft-ietf-hybi-thewebsocketprotocol-10][^2]\nxhr-streaming        | Transport using [Cross domain XHR][^5] [streaming][^7] capability (readyState=3).\nxdr-streaming        | Transport using [XDomainRequest][^9] [streaming][^7] capability (readyState=3).\neventsource          | [EventSource/Server-sent events][^4].\niframe-eventsource   | [EventSource/Server-sent events][^4] used from an [iframe via postMessage][^3].\nhtmlfile             | [HtmlFile][^8].\niframe-htmlfile      | [HtmlFile][^8] used from an [iframe via postMessage][^3].\nxhr-polling          | Long-polling using [cross domain XHR][^5].\nxdr-polling          | Long-polling using [XDomainRequest][^9].\niframe-xhr-polling   | Long-polling using normal AJAX from an [iframe via postMessage][^3].\njsonp-polling        | Slow and old fashioned [JSONP polling][^6]. This transport will show \"busy indicator\" (aka: \"spinning wheel\") when sending data.\n\n\n[^1]: https://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76\n[^2]: https://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10\n[^3]: https://developer.mozilla.org/en/DOM/window.postMessage\n[^4]: https://html.spec.whatwg.org/multipage/comms.html#server-sent-events\n[^5]: https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest#Cross-domain_requests\n[^6]: https://secure.wikimedia.org/wikipedia/en/wiki/JSONP\n[^7]: http://www.debugtheweb.com/test/teststreaming.aspx\n[^8]: http://cometdaily.com/2007/11/18/ie-activexhtmlfile-transport-part-ii/\n[^9]: https://blogs.msdn.microsoft.com/ieinternals/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds/\n[^10]: https://www.rfc-editor.org/rfc/rfc6455.txt\n\n\n# Connecting to SockJS without the client\n\nAlthough the main point of SockJS is to enable browser-to-server\nconnectivity, it is possible to connect to SockJS from an external\napplication. Any SockJS server complying with 0.3 protocol does\nsupport a raw WebSocket url. The raw WebSocket url for the test server\nlooks like:\n\n * ws://localhost:8081/echo/websocket\n\nYou can connect any WebSocket RFC 6455 compliant WebSocket client to\nthis url. This can be a command line client, external application,\nthird party code or even a browser (though I don't know why you would\nwant to do so).\n\n\n# Deployment\n\nYou should use a version of sockjs-client\nthat supports the protocol used by your server. For example:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js\"></script>\n```\n\n\nFor server-side deployment tricks, especially about load balancing and\nsession stickiness, take a look at the\n[SockJS-node readme](https://github.com/sockjs/sockjs-node#readme).\n\n\n# Development and testing\n\nSockJS-client needs [node.js](https://nodejs.org/) for running a test\nserver and JavaScript minification. If you want to work on\nSockJS-client source code, checkout the git repo and follow these\nsteps:\n\n    cd sockjs-client\n    npm install\n\nTo generate JavaScript, run:\n\n    gulp browserify\n\nTo generate minified JavaScript, run:\n\n    gulp browserify:min\n\nBoth commands output into the `build` directory.\n\n## Testing\n\nAutomated testing provided by:\n\n<a href=\"https://browserstack.com\"><img src=\"img/Browserstack-logo@2x.png\" height=\"50\"></a>\n\nOnce you've compiled the SockJS-client you may want to check if your changes\npass all the tests.\n\n    npm run test:browser_local\n\nThis will start [karma](https://karma-runner.github.io) and a test support server.\n\n# Browser Quirks\n\nThere are various browser quirks which we don't intend to address:\n\n * Pressing ESC in Firefox, before Firefox 20, closes the SockJS connection. For a workaround\n   and discussion see [#18](https://github.com/sockjs/sockjs-client/issues/18).\n * `jsonp-polling` transport will show a \"spinning wheel\" (aka. \"busy indicator\")\n   when sending data.\n * You can't open more than one SockJS connection to one domain at the\n   same time due to [the browser's limit of concurrent connections](https://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser)\n   (this limit is not counting native WebSocket connections).\n * Although SockJS is trying to escape any strange Unicode characters\n   (even invalid ones - [like surrogates \\xD800-\\xDBFF](https://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Surrogates) or [\\xFFFE and \\xFFFF](https://en.wikipedia.org/wiki/Unicode#Character_General_Category))\n   it's advisable to use only valid characters. Using invalid\n   characters is a bit slower, and may not work with SockJS servers\n   that have proper Unicode support.\n * Having a global function called `onmessage` or such is probably a\n   bad idea, as it could be called by the built-in `postMessage` API.\n * From SockJS' point of view there is nothing special about\n   SSL/HTTPS. Connecting between unencrypted and encrypted sites\n   should work just fine.\n * Although SockJS does its best to support both prefix and cookie based\n   sticky sessions, the latter may not work well cross-domain with\n   browsers that don't accept third-party cookies by default (Safari).\n   In order to get around this make sure you're connecting to SockJS\n   from the same parent domain as the main site. For example\n   'sockjs.a.com' is able to set cookies if you're connecting from\n   'www.a.com' or 'a.com'.\n * Trying to connect from secure \"https://\" to insecure \"http://\" is\n   not a good idea. The other way around should be fine.\n * Long polling is known to cause problems on Heroku, but a\n   [workaround for SockJS is available](https://github.com/sockjs/sockjs-node/issues/57#issuecomment-5242187).\n * SockJS [websocket transport is more stable over SSL](https://github.com/sockjs/sockjs-client/issues/94). If\n   you're a serious SockJS user then consider using SSL\n   ([more info](https://www.ietf.org/mail-archive/web/hybi/current/msg01605.html)).\n"
  },
  {
    "path": "build.sh",
    "content": "#!/bin/bash\nset -e\n\nif [ \"x${BROWSER}\" = \"x\" ]; then\n\tnpm run lint\n\tnpm test\nelse\n\texit 1\nfi\n"
  },
  {
    "path": "dist/sockjs-esm.js",
    "content": "var __getOwnPropNames = Object.getOwnPropertyNames;\nvar __require = /* @__PURE__ */ ((x) => typeof require !== \"undefined\" ? require : typeof Proxy !== \"undefined\" ? new Proxy(x, {\n  get: (a, b) => (typeof require !== \"undefined\" ? require : a)[b]\n}) : x)(function(x) {\n  if (typeof require !== \"undefined\")\n    return require.apply(this, arguments);\n  throw Error('Dynamic require of \"' + x + '\" is not supported');\n});\nvar __commonJS = (cb, mod) => function __require2() {\n  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\n\n// dist/sockjs.js\nvar require_sockjs = __commonJS({\n  \"dist/sockjs.js\"(exports, module) {\n    (function(f) {\n      if (typeof exports === \"object\" && typeof module !== \"undefined\") {\n        module.exports = f();\n      } else if (typeof define === \"function\" && define.amd) {\n        define([], f);\n      } else {\n        var g;\n        if (typeof window !== \"undefined\") {\n          g = window;\n        } else if (typeof global !== \"undefined\") {\n          g = global;\n        } else if (typeof self !== \"undefined\") {\n          g = self;\n        } else {\n          g = this;\n        }\n        g.SockJS = f();\n      }\n    })(function() {\n      var define2, module2, exports2;\n      return function() {\n        function r(e, n, t) {\n          function o(i2, f) {\n            if (!n[i2]) {\n              if (!e[i2]) {\n                var c = \"function\" == typeof __require && __require;\n                if (!f && c)\n                  return c(i2, true);\n                if (u)\n                  return u(i2, true);\n                var a = new Error(\"Cannot find module '\" + i2 + \"'\");\n                throw a.code = \"MODULE_NOT_FOUND\", a;\n              }\n              var p = n[i2] = { exports: {} };\n              e[i2][0].call(p.exports, function(r2) {\n                var n2 = e[i2][1][r2];\n                return o(n2 || r2);\n              }, p, p.exports, r, e, n, t);\n            }\n            return n[i2].exports;\n          }\n          for (var u = \"function\" == typeof __require && __require, i = 0; i < t.length; i++)\n            o(t[i]);\n          return o;\n        }\n        return r;\n      }()({ 1: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var transportList = require2(\"./transport-list\");\n            module3.exports = require2(\"./main\")(transportList);\n            if (\"_sockjs_onload\" in global2) {\n              setTimeout(global2._sockjs_onload, 1);\n            }\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"./main\": 14, \"./transport-list\": 16 }], 2: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), Event = require2(\"./event\");\n        function CloseEvent() {\n          Event.call(this);\n          this.initEvent(\"close\", false, false);\n          this.wasClean = false;\n          this.code = 0;\n          this.reason = \"\";\n        }\n        inherits(CloseEvent, Event);\n        module3.exports = CloseEvent;\n      }, { \"./event\": 4, \"inherits\": 57 }], 3: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), EventTarget = require2(\"./eventtarget\");\n        function EventEmitter() {\n          EventTarget.call(this);\n        }\n        inherits(EventEmitter, EventTarget);\n        EventEmitter.prototype.removeAllListeners = function(type) {\n          if (type) {\n            delete this._listeners[type];\n          } else {\n            this._listeners = {};\n          }\n        };\n        EventEmitter.prototype.once = function(type, listener) {\n          var self2 = this, fired = false;\n          function g() {\n            self2.removeListener(type, g);\n            if (!fired) {\n              fired = true;\n              listener.apply(this, arguments);\n            }\n          }\n          this.on(type, g);\n        };\n        EventEmitter.prototype.emit = function() {\n          var type = arguments[0];\n          var listeners = this._listeners[type];\n          if (!listeners) {\n            return;\n          }\n          var l = arguments.length;\n          var args = new Array(l - 1);\n          for (var ai = 1; ai < l; ai++) {\n            args[ai - 1] = arguments[ai];\n          }\n          for (var i = 0; i < listeners.length; i++) {\n            listeners[i].apply(this, args);\n          }\n        };\n        EventEmitter.prototype.on = EventEmitter.prototype.addListener = EventTarget.prototype.addEventListener;\n        EventEmitter.prototype.removeListener = EventTarget.prototype.removeEventListener;\n        module3.exports.EventEmitter = EventEmitter;\n      }, { \"./eventtarget\": 5, \"inherits\": 57 }], 4: [function(require2, module3, exports3) {\n        \"use strict\";\n        function Event(eventType) {\n          this.type = eventType;\n        }\n        Event.prototype.initEvent = function(eventType, canBubble, cancelable) {\n          this.type = eventType;\n          this.bubbles = canBubble;\n          this.cancelable = cancelable;\n          this.timeStamp = +/* @__PURE__ */ new Date();\n          return this;\n        };\n        Event.prototype.stopPropagation = function() {\n        };\n        Event.prototype.preventDefault = function() {\n        };\n        Event.CAPTURING_PHASE = 1;\n        Event.AT_TARGET = 2;\n        Event.BUBBLING_PHASE = 3;\n        module3.exports = Event;\n      }, {}], 5: [function(require2, module3, exports3) {\n        \"use strict\";\n        function EventTarget() {\n          this._listeners = {};\n        }\n        EventTarget.prototype.addEventListener = function(eventType, listener) {\n          if (!(eventType in this._listeners)) {\n            this._listeners[eventType] = [];\n          }\n          var arr = this._listeners[eventType];\n          if (arr.indexOf(listener) === -1) {\n            arr = arr.concat([listener]);\n          }\n          this._listeners[eventType] = arr;\n        };\n        EventTarget.prototype.removeEventListener = function(eventType, listener) {\n          var arr = this._listeners[eventType];\n          if (!arr) {\n            return;\n          }\n          var idx = arr.indexOf(listener);\n          if (idx !== -1) {\n            if (arr.length > 1) {\n              this._listeners[eventType] = arr.slice(0, idx).concat(arr.slice(idx + 1));\n            } else {\n              delete this._listeners[eventType];\n            }\n            return;\n          }\n        };\n        EventTarget.prototype.dispatchEvent = function() {\n          var event = arguments[0];\n          var t = event.type;\n          var args = arguments.length === 1 ? [event] : Array.apply(null, arguments);\n          if (this[\"on\" + t]) {\n            this[\"on\" + t].apply(this, args);\n          }\n          if (t in this._listeners) {\n            var listeners = this._listeners[t];\n            for (var i = 0; i < listeners.length; i++) {\n              listeners[i].apply(this, args);\n            }\n          }\n        };\n        module3.exports = EventTarget;\n      }, {}], 6: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), Event = require2(\"./event\");\n        function TransportMessageEvent(data) {\n          Event.call(this);\n          this.initEvent(\"message\", false, false);\n          this.data = data;\n        }\n        inherits(TransportMessageEvent, Event);\n        module3.exports = TransportMessageEvent;\n      }, { \"./event\": 4, \"inherits\": 57 }], 7: [function(require2, module3, exports3) {\n        \"use strict\";\n        var iframeUtils = require2(\"./utils/iframe\");\n        function FacadeJS(transport) {\n          this._transport = transport;\n          transport.on(\"message\", this._transportMessage.bind(this));\n          transport.on(\"close\", this._transportClose.bind(this));\n        }\n        FacadeJS.prototype._transportClose = function(code, reason) {\n          iframeUtils.postMessage(\"c\", JSON.stringify([code, reason]));\n        };\n        FacadeJS.prototype._transportMessage = function(frame) {\n          iframeUtils.postMessage(\"t\", frame);\n        };\n        FacadeJS.prototype._send = function(data) {\n          this._transport.send(data);\n        };\n        FacadeJS.prototype._close = function() {\n          this._transport.close();\n          this._transport.removeAllListeners();\n        };\n        module3.exports = FacadeJS;\n      }, { \"./utils/iframe\": 47 }], 8: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var urlUtils = require2(\"./utils/url\"), eventUtils = require2(\"./utils/event\"), FacadeJS = require2(\"./facade\"), InfoIframeReceiver = require2(\"./info-iframe-receiver\"), iframeUtils = require2(\"./utils/iframe\"), loc = require2(\"./location\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:iframe-bootstrap\");\n            }\n            module3.exports = function(SockJS, availableTransports) {\n              var transportMap = {};\n              availableTransports.forEach(function(at) {\n                if (at.facadeTransport) {\n                  transportMap[at.facadeTransport.transportName] = at.facadeTransport;\n                }\n              });\n              transportMap[InfoIframeReceiver.transportName] = InfoIframeReceiver;\n              var parentOrigin;\n              SockJS.bootstrap_iframe = function() {\n                var facade;\n                iframeUtils.currentWindowId = loc.hash.slice(1);\n                var onMessage = function(e) {\n                  if (e.source !== parent) {\n                    return;\n                  }\n                  if (typeof parentOrigin === \"undefined\") {\n                    parentOrigin = e.origin;\n                  }\n                  if (e.origin !== parentOrigin) {\n                    return;\n                  }\n                  var iframeMessage;\n                  try {\n                    iframeMessage = JSON.parse(e.data);\n                  } catch (ignored) {\n                    debug(\"bad json\", e.data);\n                    return;\n                  }\n                  if (iframeMessage.windowId !== iframeUtils.currentWindowId) {\n                    return;\n                  }\n                  switch (iframeMessage.type) {\n                    case \"s\":\n                      var p;\n                      try {\n                        p = JSON.parse(iframeMessage.data);\n                      } catch (ignored) {\n                        debug(\"bad json\", iframeMessage.data);\n                        break;\n                      }\n                      var version = p[0];\n                      var transport = p[1];\n                      var transUrl = p[2];\n                      var baseUrl = p[3];\n                      debug(version, transport, transUrl, baseUrl);\n                      if (version !== SockJS.version) {\n                        throw new Error('Incompatible SockJS! Main site uses: \"' + version + '\", the iframe: \"' + SockJS.version + '\".');\n                      }\n                      if (!urlUtils.isOriginEqual(transUrl, loc.href) || !urlUtils.isOriginEqual(baseUrl, loc.href)) {\n                        throw new Error(\"Can't connect to different domain from within an iframe. (\" + loc.href + \", \" + transUrl + \", \" + baseUrl + \")\");\n                      }\n                      facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl));\n                      break;\n                    case \"m\":\n                      facade._send(iframeMessage.data);\n                      break;\n                    case \"c\":\n                      if (facade) {\n                        facade._close();\n                      }\n                      facade = null;\n                      break;\n                  }\n                };\n                eventUtils.attachEvent(\"message\", onMessage);\n                iframeUtils.postMessage(\"s\");\n              };\n            };\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"./facade\": 7, \"./info-iframe-receiver\": 10, \"./location\": 13, \"./utils/event\": 46, \"./utils/iframe\": 47, \"./utils/url\": 52, \"debug\": 55 }], 9: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var EventEmitter = require2(\"events\").EventEmitter, inherits = require2(\"inherits\"), objectUtils = require2(\"./utils/object\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:info-ajax\");\n            }\n            function InfoAjax(url, AjaxObject) {\n              EventEmitter.call(this);\n              var self2 = this;\n              var t0 = +/* @__PURE__ */ new Date();\n              this.xo = new AjaxObject(\"GET\", url);\n              this.xo.once(\"finish\", function(status, text) {\n                var info, rtt;\n                if (status === 200) {\n                  rtt = +/* @__PURE__ */ new Date() - t0;\n                  if (text) {\n                    try {\n                      info = JSON.parse(text);\n                    } catch (e) {\n                      debug(\"bad json\", text);\n                    }\n                  }\n                  if (!objectUtils.isObject(info)) {\n                    info = {};\n                  }\n                }\n                self2.emit(\"finish\", info, rtt);\n                self2.removeAllListeners();\n              });\n            }\n            inherits(InfoAjax, EventEmitter);\n            InfoAjax.prototype.close = function() {\n              this.removeAllListeners();\n              this.xo.close();\n            };\n            module3.exports = InfoAjax;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"./utils/object\": 49, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 10: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter, XHRLocalObject = require2(\"./transport/sender/xhr-local\"), InfoAjax = require2(\"./info-ajax\");\n        function InfoReceiverIframe(transUrl) {\n          var self2 = this;\n          EventEmitter.call(this);\n          this.ir = new InfoAjax(transUrl, XHRLocalObject);\n          this.ir.once(\"finish\", function(info, rtt) {\n            self2.ir = null;\n            self2.emit(\"message\", JSON.stringify([info, rtt]));\n          });\n        }\n        inherits(InfoReceiverIframe, EventEmitter);\n        InfoReceiverIframe.transportName = \"iframe-info-receiver\";\n        InfoReceiverIframe.prototype.close = function() {\n          if (this.ir) {\n            this.ir.close();\n            this.ir = null;\n          }\n          this.removeAllListeners();\n        };\n        module3.exports = InfoReceiverIframe;\n      }, { \"./info-ajax\": 9, \"./transport/sender/xhr-local\": 37, \"events\": 3, \"inherits\": 57 }], 11: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var EventEmitter = require2(\"events\").EventEmitter, inherits = require2(\"inherits\"), utils = require2(\"./utils/event\"), IframeTransport = require2(\"./transport/iframe\"), InfoReceiverIframe = require2(\"./info-iframe-receiver\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:info-iframe\");\n            }\n            function InfoIframe(baseUrl, url) {\n              var self2 = this;\n              EventEmitter.call(this);\n              var go = function() {\n                var ifr = self2.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);\n                ifr.once(\"message\", function(msg) {\n                  if (msg) {\n                    var d;\n                    try {\n                      d = JSON.parse(msg);\n                    } catch (e) {\n                      debug(\"bad json\", msg);\n                      self2.emit(\"finish\");\n                      self2.close();\n                      return;\n                    }\n                    var info = d[0], rtt = d[1];\n                    self2.emit(\"finish\", info, rtt);\n                  }\n                  self2.close();\n                });\n                ifr.once(\"close\", function() {\n                  self2.emit(\"finish\");\n                  self2.close();\n                });\n              };\n              if (!global2.document.body) {\n                utils.attachEvent(\"load\", go);\n              } else {\n                go();\n              }\n            }\n            inherits(InfoIframe, EventEmitter);\n            InfoIframe.enabled = function() {\n              return IframeTransport.enabled();\n            };\n            InfoIframe.prototype.close = function() {\n              if (this.ifr) {\n                this.ifr.close();\n              }\n              this.removeAllListeners();\n              this.ifr = null;\n            };\n            module3.exports = InfoIframe;\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"./info-iframe-receiver\": 10, \"./transport/iframe\": 22, \"./utils/event\": 46, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 12: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var EventEmitter = require2(\"events\").EventEmitter, inherits = require2(\"inherits\"), urlUtils = require2(\"./utils/url\"), XDR = require2(\"./transport/sender/xdr\"), XHRCors = require2(\"./transport/sender/xhr-cors\"), XHRLocal = require2(\"./transport/sender/xhr-local\"), XHRFake = require2(\"./transport/sender/xhr-fake\"), InfoIframe = require2(\"./info-iframe\"), InfoAjax = require2(\"./info-ajax\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:info-receiver\");\n            }\n            function InfoReceiver(baseUrl, urlInfo) {\n              debug(baseUrl);\n              var self2 = this;\n              EventEmitter.call(this);\n              setTimeout(function() {\n                self2.doXhr(baseUrl, urlInfo);\n              }, 0);\n            }\n            inherits(InfoReceiver, EventEmitter);\n            InfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {\n              if (urlInfo.sameOrigin) {\n                return new InfoAjax(url, XHRLocal);\n              }\n              if (XHRCors.enabled) {\n                return new InfoAjax(url, XHRCors);\n              }\n              if (XDR.enabled && urlInfo.sameScheme) {\n                return new InfoAjax(url, XDR);\n              }\n              if (InfoIframe.enabled()) {\n                return new InfoIframe(baseUrl, url);\n              }\n              return new InfoAjax(url, XHRFake);\n            };\n            InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {\n              var self2 = this, url = urlUtils.addPath(baseUrl, \"/info\");\n              debug(\"doXhr\", url);\n              this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);\n              this.timeoutRef = setTimeout(function() {\n                debug(\"timeout\");\n                self2._cleanup(false);\n                self2.emit(\"finish\");\n              }, InfoReceiver.timeout);\n              this.xo.once(\"finish\", function(info, rtt) {\n                debug(\"finish\", info, rtt);\n                self2._cleanup(true);\n                self2.emit(\"finish\", info, rtt);\n              });\n            };\n            InfoReceiver.prototype._cleanup = function(wasClean) {\n              debug(\"_cleanup\");\n              clearTimeout(this.timeoutRef);\n              this.timeoutRef = null;\n              if (!wasClean && this.xo) {\n                this.xo.close();\n              }\n              this.xo = null;\n            };\n            InfoReceiver.prototype.close = function() {\n              debug(\"close\");\n              this.removeAllListeners();\n              this._cleanup(false);\n            };\n            InfoReceiver.timeout = 8e3;\n            module3.exports = InfoReceiver;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"./info-ajax\": 9, \"./info-iframe\": 11, \"./transport/sender/xdr\": 34, \"./transport/sender/xhr-cors\": 35, \"./transport/sender/xhr-fake\": 36, \"./transport/sender/xhr-local\": 37, \"./utils/url\": 52, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 13: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            module3.exports = global2.location || {\n              origin: \"http://localhost:80\",\n              protocol: \"http:\",\n              host: \"localhost\",\n              port: 80,\n              href: \"http://localhost/\",\n              hash: \"\"\n            };\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, {}], 14: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            require2(\"./shims\");\n            var URL = require2(\"url-parse\"), inherits = require2(\"inherits\"), random = require2(\"./utils/random\"), escape = require2(\"./utils/escape\"), urlUtils = require2(\"./utils/url\"), eventUtils = require2(\"./utils/event\"), transport = require2(\"./utils/transport\"), objectUtils = require2(\"./utils/object\"), browser = require2(\"./utils/browser\"), log = require2(\"./utils/log\"), Event = require2(\"./event/event\"), EventTarget = require2(\"./event/eventtarget\"), loc = require2(\"./location\"), CloseEvent = require2(\"./event/close\"), TransportMessageEvent = require2(\"./event/trans-message\"), InfoReceiver = require2(\"./info-receiver\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:main\");\n            }\n            var transports;\n            function SockJS(url, protocols, options) {\n              if (!(this instanceof SockJS)) {\n                return new SockJS(url, protocols, options);\n              }\n              if (arguments.length < 1) {\n                throw new TypeError(\"Failed to construct 'SockJS: 1 argument required, but only 0 present\");\n              }\n              EventTarget.call(this);\n              this.readyState = SockJS.CONNECTING;\n              this.extensions = \"\";\n              this.protocol = \"\";\n              options = options || {};\n              if (options.protocols_whitelist) {\n                log.warn(\"'protocols_whitelist' is DEPRECATED. Use 'transports' instead.\");\n              }\n              this._transportsWhitelist = options.transports;\n              this._transportOptions = options.transportOptions || {};\n              this._timeout = options.timeout || 0;\n              var sessionId = options.sessionId || 8;\n              if (typeof sessionId === \"function\") {\n                this._generateSessionId = sessionId;\n              } else if (typeof sessionId === \"number\") {\n                this._generateSessionId = function() {\n                  return random.string(sessionId);\n                };\n              } else {\n                throw new TypeError(\"If sessionId is used in the options, it needs to be a number or a function.\");\n              }\n              this._server = options.server || random.numberString(1e3);\n              var parsedUrl = new URL(url);\n              if (!parsedUrl.host || !parsedUrl.protocol) {\n                throw new SyntaxError(\"The URL '\" + url + \"' is invalid\");\n              } else if (parsedUrl.hash) {\n                throw new SyntaxError(\"The URL must not contain a fragment\");\n              } else if (parsedUrl.protocol !== \"http:\" && parsedUrl.protocol !== \"https:\") {\n                throw new SyntaxError(\"The URL's scheme must be either 'http:' or 'https:'. '\" + parsedUrl.protocol + \"' is not allowed.\");\n              }\n              var secure = parsedUrl.protocol === \"https:\";\n              if (loc.protocol === \"https:\" && !secure) {\n                if (!urlUtils.isLoopbackAddr(parsedUrl.hostname)) {\n                  throw new Error(\"SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS\");\n                }\n              }\n              if (!protocols) {\n                protocols = [];\n              } else if (!Array.isArray(protocols)) {\n                protocols = [protocols];\n              }\n              var sortedProtocols = protocols.sort();\n              sortedProtocols.forEach(function(proto, i) {\n                if (!proto) {\n                  throw new SyntaxError(\"The protocols entry '\" + proto + \"' is invalid.\");\n                }\n                if (i < sortedProtocols.length - 1 && proto === sortedProtocols[i + 1]) {\n                  throw new SyntaxError(\"The protocols entry '\" + proto + \"' is duplicated.\");\n                }\n              });\n              var o = urlUtils.getOrigin(loc.href);\n              this._origin = o ? o.toLowerCase() : null;\n              parsedUrl.set(\"pathname\", parsedUrl.pathname.replace(/\\/+$/, \"\"));\n              this.url = parsedUrl.href;\n              debug(\"using url\", this.url);\n              this._urlInfo = {\n                nullOrigin: !browser.hasDomain(),\n                sameOrigin: urlUtils.isOriginEqual(this.url, loc.href),\n                sameScheme: urlUtils.isSchemeEqual(this.url, loc.href)\n              };\n              this._ir = new InfoReceiver(this.url, this._urlInfo);\n              this._ir.once(\"finish\", this._receiveInfo.bind(this));\n            }\n            inherits(SockJS, EventTarget);\n            function userSetCode(code) {\n              return code === 1e3 || code >= 3e3 && code <= 4999;\n            }\n            SockJS.prototype.close = function(code, reason) {\n              if (code && !userSetCode(code)) {\n                throw new Error(\"InvalidAccessError: Invalid code\");\n              }\n              if (reason && reason.length > 123) {\n                throw new SyntaxError(\"reason argument has an invalid length\");\n              }\n              if (this.readyState === SockJS.CLOSING || this.readyState === SockJS.CLOSED) {\n                return;\n              }\n              var wasClean = true;\n              this._close(code || 1e3, reason || \"Normal closure\", wasClean);\n            };\n            SockJS.prototype.send = function(data) {\n              if (typeof data !== \"string\") {\n                data = \"\" + data;\n              }\n              if (this.readyState === SockJS.CONNECTING) {\n                throw new Error(\"InvalidStateError: The connection has not been established yet\");\n              }\n              if (this.readyState !== SockJS.OPEN) {\n                return;\n              }\n              this._transport.send(escape.quote(data));\n            };\n            SockJS.version = require2(\"./version\");\n            SockJS.CONNECTING = 0;\n            SockJS.OPEN = 1;\n            SockJS.CLOSING = 2;\n            SockJS.CLOSED = 3;\n            SockJS.prototype._receiveInfo = function(info, rtt) {\n              debug(\"_receiveInfo\", rtt);\n              this._ir = null;\n              if (!info) {\n                this._close(1002, \"Cannot connect to server\");\n                return;\n              }\n              this._rto = this.countRTO(rtt);\n              this._transUrl = info.base_url ? info.base_url : this.url;\n              info = objectUtils.extend(info, this._urlInfo);\n              debug(\"info\", info);\n              var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info);\n              this._transports = enabledTransports.main;\n              debug(this._transports.length + \" enabled transports\");\n              this._connect();\n            };\n            SockJS.prototype._connect = function() {\n              for (var Transport = this._transports.shift(); Transport; Transport = this._transports.shift()) {\n                debug(\"attempt\", Transport.transportName);\n                if (Transport.needBody) {\n                  if (!global2.document.body || typeof global2.document.readyState !== \"undefined\" && global2.document.readyState !== \"complete\" && global2.document.readyState !== \"interactive\") {\n                    debug(\"waiting for body\");\n                    this._transports.unshift(Transport);\n                    eventUtils.attachEvent(\"load\", this._connect.bind(this));\n                    return;\n                  }\n                }\n                var timeoutMs = Math.max(this._timeout, this._rto * Transport.roundTrips || 5e3);\n                this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);\n                debug(\"using timeout\", timeoutMs);\n                var transportUrl = urlUtils.addPath(this._transUrl, \"/\" + this._server + \"/\" + this._generateSessionId());\n                var options = this._transportOptions[Transport.transportName];\n                debug(\"transport url\", transportUrl);\n                var transportObj = new Transport(transportUrl, this._transUrl, options);\n                transportObj.on(\"message\", this._transportMessage.bind(this));\n                transportObj.once(\"close\", this._transportClose.bind(this));\n                transportObj.transportName = Transport.transportName;\n                this._transport = transportObj;\n                return;\n              }\n              this._close(2e3, \"All transports failed\", false);\n            };\n            SockJS.prototype._transportTimeout = function() {\n              debug(\"_transportTimeout\");\n              if (this.readyState === SockJS.CONNECTING) {\n                if (this._transport) {\n                  this._transport.close();\n                }\n                this._transportClose(2007, \"Transport timed out\");\n              }\n            };\n            SockJS.prototype._transportMessage = function(msg) {\n              debug(\"_transportMessage\", msg);\n              var self2 = this, type = msg.slice(0, 1), content = msg.slice(1), payload;\n              switch (type) {\n                case \"o\":\n                  this._open();\n                  return;\n                case \"h\":\n                  this.dispatchEvent(new Event(\"heartbeat\"));\n                  debug(\"heartbeat\", this.transport);\n                  return;\n              }\n              if (content) {\n                try {\n                  payload = JSON.parse(content);\n                } catch (e) {\n                  debug(\"bad json\", content);\n                }\n              }\n              if (typeof payload === \"undefined\") {\n                debug(\"empty payload\", content);\n                return;\n              }\n              switch (type) {\n                case \"a\":\n                  if (Array.isArray(payload)) {\n                    payload.forEach(function(p) {\n                      debug(\"message\", self2.transport, p);\n                      self2.dispatchEvent(new TransportMessageEvent(p));\n                    });\n                  }\n                  break;\n                case \"m\":\n                  debug(\"message\", this.transport, payload);\n                  this.dispatchEvent(new TransportMessageEvent(payload));\n                  break;\n                case \"c\":\n                  if (Array.isArray(payload) && payload.length === 2) {\n                    this._close(payload[0], payload[1], true);\n                  }\n                  break;\n              }\n            };\n            SockJS.prototype._transportClose = function(code, reason) {\n              debug(\"_transportClose\", this.transport, code, reason);\n              if (this._transport) {\n                this._transport.removeAllListeners();\n                this._transport = null;\n                this.transport = null;\n              }\n              if (!userSetCode(code) && code !== 2e3 && this.readyState === SockJS.CONNECTING) {\n                this._connect();\n                return;\n              }\n              this._close(code, reason);\n            };\n            SockJS.prototype._open = function() {\n              debug(\"_open\", this._transport && this._transport.transportName, this.readyState);\n              if (this.readyState === SockJS.CONNECTING) {\n                if (this._transportTimeoutId) {\n                  clearTimeout(this._transportTimeoutId);\n                  this._transportTimeoutId = null;\n                }\n                this.readyState = SockJS.OPEN;\n                this.transport = this._transport.transportName;\n                this.dispatchEvent(new Event(\"open\"));\n                debug(\"connected\", this.transport);\n              } else {\n                this._close(1006, \"Server lost session\");\n              }\n            };\n            SockJS.prototype._close = function(code, reason, wasClean) {\n              debug(\"_close\", this.transport, code, reason, wasClean, this.readyState);\n              var forceFail = false;\n              if (this._ir) {\n                forceFail = true;\n                this._ir.close();\n                this._ir = null;\n              }\n              if (this._transport) {\n                this._transport.close();\n                this._transport = null;\n                this.transport = null;\n              }\n              if (this.readyState === SockJS.CLOSED) {\n                throw new Error(\"InvalidStateError: SockJS has already been closed\");\n              }\n              this.readyState = SockJS.CLOSING;\n              setTimeout(function() {\n                this.readyState = SockJS.CLOSED;\n                if (forceFail) {\n                  this.dispatchEvent(new Event(\"error\"));\n                }\n                var e = new CloseEvent(\"close\");\n                e.wasClean = wasClean || false;\n                e.code = code || 1e3;\n                e.reason = reason;\n                this.dispatchEvent(e);\n                this.onmessage = this.onclose = this.onerror = null;\n                debug(\"disconnected\");\n              }.bind(this), 0);\n            };\n            SockJS.prototype.countRTO = function(rtt) {\n              if (rtt > 100) {\n                return 4 * rtt;\n              }\n              return 300 + rtt;\n            };\n            module3.exports = function(availableTransports) {\n              transports = transport(availableTransports);\n              require2(\"./iframe-bootstrap\")(SockJS, availableTransports);\n              return SockJS;\n            };\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"./event/close\": 2, \"./event/event\": 4, \"./event/eventtarget\": 5, \"./event/trans-message\": 6, \"./iframe-bootstrap\": 8, \"./info-receiver\": 12, \"./location\": 13, \"./shims\": 15, \"./utils/browser\": 44, \"./utils/escape\": 45, \"./utils/event\": 46, \"./utils/log\": 48, \"./utils/object\": 49, \"./utils/random\": 50, \"./utils/transport\": 51, \"./utils/url\": 52, \"./version\": 53, \"debug\": 55, \"inherits\": 57, \"url-parse\": 60 }], 15: [function(require2, module3, exports3) {\n        \"use strict\";\n        var ArrayPrototype = Array.prototype;\n        var ObjectPrototype = Object.prototype;\n        var FunctionPrototype = Function.prototype;\n        var StringPrototype = String.prototype;\n        var array_slice = ArrayPrototype.slice;\n        var _toString = ObjectPrototype.toString;\n        var isFunction = function(val) {\n          return ObjectPrototype.toString.call(val) === \"[object Function]\";\n        };\n        var isArray = function isArray2(obj) {\n          return _toString.call(obj) === \"[object Array]\";\n        };\n        var isString = function isString2(obj) {\n          return _toString.call(obj) === \"[object String]\";\n        };\n        var supportsDescriptors = Object.defineProperty && function() {\n          try {\n            Object.defineProperty({}, \"x\", {});\n            return true;\n          } catch (e) {\n            return false;\n          }\n        }();\n        var defineProperty;\n        if (supportsDescriptors) {\n          defineProperty = function(object, name, method, forceAssign) {\n            if (!forceAssign && name in object) {\n              return;\n            }\n            Object.defineProperty(object, name, {\n              configurable: true,\n              enumerable: false,\n              writable: true,\n              value: method\n            });\n          };\n        } else {\n          defineProperty = function(object, name, method, forceAssign) {\n            if (!forceAssign && name in object) {\n              return;\n            }\n            object[name] = method;\n          };\n        }\n        var defineProperties = function(object, map, forceAssign) {\n          for (var name in map) {\n            if (ObjectPrototype.hasOwnProperty.call(map, name)) {\n              defineProperty(object, name, map[name], forceAssign);\n            }\n          }\n        };\n        var toObject = function(o) {\n          if (o == null) {\n            throw new TypeError(\"can't convert \" + o + \" to object\");\n          }\n          return Object(o);\n        };\n        function toInteger(num) {\n          var n = +num;\n          if (n !== n) {\n            n = 0;\n          } else if (n !== 0 && n !== 1 / 0 && n !== -(1 / 0)) {\n            n = (n > 0 || -1) * Math.floor(Math.abs(n));\n          }\n          return n;\n        }\n        function ToUint32(x) {\n          return x >>> 0;\n        }\n        function Empty() {\n        }\n        defineProperties(FunctionPrototype, {\n          bind: function bind(that) {\n            var target = this;\n            if (!isFunction(target)) {\n              throw new TypeError(\"Function.prototype.bind called on incompatible \" + target);\n            }\n            var args = array_slice.call(arguments, 1);\n            var binder = function() {\n              if (this instanceof bound) {\n                var result = target.apply(\n                  this,\n                  args.concat(array_slice.call(arguments))\n                );\n                if (Object(result) === result) {\n                  return result;\n                }\n                return this;\n              } else {\n                return target.apply(\n                  that,\n                  args.concat(array_slice.call(arguments))\n                );\n              }\n            };\n            var boundLength = Math.max(0, target.length - args.length);\n            var boundArgs = [];\n            for (var i = 0; i < boundLength; i++) {\n              boundArgs.push(\"$\" + i);\n            }\n            var bound = Function(\"binder\", \"return function (\" + boundArgs.join(\",\") + \"){ return binder.apply(this, arguments); }\")(binder);\n            if (target.prototype) {\n              Empty.prototype = target.prototype;\n              bound.prototype = new Empty();\n              Empty.prototype = null;\n            }\n            return bound;\n          }\n        });\n        defineProperties(Array, { isArray });\n        var boxedString = Object(\"a\");\n        var splitString = boxedString[0] !== \"a\" || !(0 in boxedString);\n        var properlyBoxesContext = function properlyBoxed(method) {\n          var properlyBoxesNonStrict = true;\n          var properlyBoxesStrict = true;\n          if (method) {\n            method.call(\"foo\", function(_, __, context) {\n              if (typeof context !== \"object\") {\n                properlyBoxesNonStrict = false;\n              }\n            });\n            method.call([1], function() {\n              \"use strict\";\n              properlyBoxesStrict = typeof this === \"string\";\n            }, \"x\");\n          }\n          return !!method && properlyBoxesNonStrict && properlyBoxesStrict;\n        };\n        defineProperties(ArrayPrototype, {\n          forEach: function forEach(fun) {\n            var object = toObject(this), self2 = splitString && isString(this) ? this.split(\"\") : object, thisp = arguments[1], i = -1, length = self2.length >>> 0;\n            if (!isFunction(fun)) {\n              throw new TypeError();\n            }\n            while (++i < length) {\n              if (i in self2) {\n                fun.call(thisp, self2[i], i, object);\n              }\n            }\n          }\n        }, !properlyBoxesContext(ArrayPrototype.forEach));\n        var hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) !== -1;\n        defineProperties(ArrayPrototype, {\n          indexOf: function indexOf(sought) {\n            var self2 = splitString && isString(this) ? this.split(\"\") : toObject(this), length = self2.length >>> 0;\n            if (!length) {\n              return -1;\n            }\n            var i = 0;\n            if (arguments.length > 1) {\n              i = toInteger(arguments[1]);\n            }\n            i = i >= 0 ? i : Math.max(0, length + i);\n            for (; i < length; i++) {\n              if (i in self2 && self2[i] === sought) {\n                return i;\n              }\n            }\n            return -1;\n          }\n        }, hasFirefox2IndexOfBug);\n        var string_split = StringPrototype.split;\n        if (\"ab\".split(/(?:ab)*/).length !== 2 || \".\".split(/(.?)(.?)/).length !== 4 || \"tesst\".split(/(s)*/)[1] === \"t\" || \"test\".split(/(?:)/, -1).length !== 4 || \"\".split(/.?/).length || \".\".split(/()()/).length > 1) {\n          (function() {\n            var compliantExecNpcg = /()??/.exec(\"\")[1] === void 0;\n            StringPrototype.split = function(separator, limit) {\n              var string = this;\n              if (separator === void 0 && limit === 0) {\n                return [];\n              }\n              if (_toString.call(separator) !== \"[object RegExp]\") {\n                return string_split.call(this, separator, limit);\n              }\n              var output = [], flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n              (separator.sticky ? \"y\" : \"\"), lastLastIndex = 0, separator2, match, lastIndex, lastLength;\n              separator = new RegExp(separator.source, flags + \"g\");\n              string += \"\";\n              if (!compliantExecNpcg) {\n                separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n              }\n              limit = limit === void 0 ? -1 >>> 0 : (\n                // Math.pow(2, 32) - 1\n                ToUint32(limit)\n              );\n              while (match = separator.exec(string)) {\n                lastIndex = match.index + match[0].length;\n                if (lastIndex > lastLastIndex) {\n                  output.push(string.slice(lastLastIndex, match.index));\n                  if (!compliantExecNpcg && match.length > 1) {\n                    match[0].replace(separator2, function() {\n                      for (var i = 1; i < arguments.length - 2; i++) {\n                        if (arguments[i] === void 0) {\n                          match[i] = void 0;\n                        }\n                      }\n                    });\n                  }\n                  if (match.length > 1 && match.index < string.length) {\n                    ArrayPrototype.push.apply(output, match.slice(1));\n                  }\n                  lastLength = match[0].length;\n                  lastLastIndex = lastIndex;\n                  if (output.length >= limit) {\n                    break;\n                  }\n                }\n                if (separator.lastIndex === match.index) {\n                  separator.lastIndex++;\n                }\n              }\n              if (lastLastIndex === string.length) {\n                if (lastLength || !separator.test(\"\")) {\n                  output.push(\"\");\n                }\n              } else {\n                output.push(string.slice(lastLastIndex));\n              }\n              return output.length > limit ? output.slice(0, limit) : output;\n            };\n          })();\n        } else if (\"0\".split(void 0, 0).length) {\n          StringPrototype.split = function split(separator, limit) {\n            if (separator === void 0 && limit === 0) {\n              return [];\n            }\n            return string_split.call(this, separator, limit);\n          };\n        }\n        var string_substr = StringPrototype.substr;\n        var hasNegativeSubstrBug = \"\".substr && \"0b\".substr(-1) !== \"b\";\n        defineProperties(StringPrototype, {\n          substr: function substr(start, length) {\n            return string_substr.call(\n              this,\n              start < 0 ? (start = this.length + start) < 0 ? 0 : start : start,\n              length\n            );\n          }\n        }, hasNegativeSubstrBug);\n      }, {}], 16: [function(require2, module3, exports3) {\n        \"use strict\";\n        module3.exports = [\n          // streaming transports\n          require2(\"./transport/websocket\"),\n          require2(\"./transport/xhr-streaming\"),\n          require2(\"./transport/xdr-streaming\"),\n          require2(\"./transport/eventsource\"),\n          require2(\"./transport/lib/iframe-wrap\")(require2(\"./transport/eventsource\")),\n          require2(\"./transport/htmlfile\"),\n          require2(\"./transport/lib/iframe-wrap\")(require2(\"./transport/htmlfile\")),\n          require2(\"./transport/xhr-polling\"),\n          require2(\"./transport/xdr-polling\"),\n          require2(\"./transport/lib/iframe-wrap\")(require2(\"./transport/xhr-polling\")),\n          require2(\"./transport/jsonp-polling\")\n        ];\n      }, { \"./transport/eventsource\": 20, \"./transport/htmlfile\": 21, \"./transport/jsonp-polling\": 23, \"./transport/lib/iframe-wrap\": 26, \"./transport/websocket\": 38, \"./transport/xdr-polling\": 39, \"./transport/xdr-streaming\": 40, \"./transport/xhr-polling\": 41, \"./transport/xhr-streaming\": 42 }], 17: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var EventEmitter = require2(\"events\").EventEmitter, inherits = require2(\"inherits\"), utils = require2(\"../../utils/event\"), urlUtils = require2(\"../../utils/url\"), XHR = global2.XMLHttpRequest;\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:browser:xhr\");\n            }\n            function AbstractXHRObject(method, url, payload, opts) {\n              debug(method, url);\n              var self2 = this;\n              EventEmitter.call(this);\n              setTimeout(function() {\n                self2._start(method, url, payload, opts);\n              }, 0);\n            }\n            inherits(AbstractXHRObject, EventEmitter);\n            AbstractXHRObject.prototype._start = function(method, url, payload, opts) {\n              var self2 = this;\n              try {\n                this.xhr = new XHR();\n              } catch (x) {\n              }\n              if (!this.xhr) {\n                debug(\"no xhr\");\n                this.emit(\"finish\", 0, \"no xhr support\");\n                this._cleanup();\n                return;\n              }\n              url = urlUtils.addQuery(url, \"t=\" + +/* @__PURE__ */ new Date());\n              this.unloadRef = utils.unloadAdd(function() {\n                debug(\"unload cleanup\");\n                self2._cleanup(true);\n              });\n              try {\n                this.xhr.open(method, url, true);\n                if (this.timeout && \"timeout\" in this.xhr) {\n                  this.xhr.timeout = this.timeout;\n                  this.xhr.ontimeout = function() {\n                    debug(\"xhr timeout\");\n                    self2.emit(\"finish\", 0, \"\");\n                    self2._cleanup(false);\n                  };\n                }\n              } catch (e) {\n                debug(\"exception\", e);\n                this.emit(\"finish\", 0, \"\");\n                this._cleanup(false);\n                return;\n              }\n              if ((!opts || !opts.noCredentials) && AbstractXHRObject.supportsCORS) {\n                debug(\"withCredentials\");\n                this.xhr.withCredentials = true;\n              }\n              if (opts && opts.headers) {\n                for (var key in opts.headers) {\n                  this.xhr.setRequestHeader(key, opts.headers[key]);\n                }\n              }\n              this.xhr.onreadystatechange = function() {\n                if (self2.xhr) {\n                  var x = self2.xhr;\n                  var text, status;\n                  debug(\"readyState\", x.readyState);\n                  switch (x.readyState) {\n                    case 3:\n                      try {\n                        status = x.status;\n                        text = x.responseText;\n                      } catch (e) {\n                      }\n                      debug(\"status\", status);\n                      if (status === 1223) {\n                        status = 204;\n                      }\n                      if (status === 200 && text && text.length > 0) {\n                        debug(\"chunk\");\n                        self2.emit(\"chunk\", status, text);\n                      }\n                      break;\n                    case 4:\n                      status = x.status;\n                      debug(\"status\", status);\n                      if (status === 1223) {\n                        status = 204;\n                      }\n                      if (status === 12005 || status === 12029) {\n                        status = 0;\n                      }\n                      debug(\"finish\", status, x.responseText);\n                      self2.emit(\"finish\", status, x.responseText);\n                      self2._cleanup(false);\n                      break;\n                  }\n                }\n              };\n              try {\n                self2.xhr.send(payload);\n              } catch (e) {\n                self2.emit(\"finish\", 0, \"\");\n                self2._cleanup(false);\n              }\n            };\n            AbstractXHRObject.prototype._cleanup = function(abort) {\n              debug(\"cleanup\");\n              if (!this.xhr) {\n                return;\n              }\n              this.removeAllListeners();\n              utils.unloadDel(this.unloadRef);\n              this.xhr.onreadystatechange = function() {\n              };\n              if (this.xhr.ontimeout) {\n                this.xhr.ontimeout = null;\n              }\n              if (abort) {\n                try {\n                  this.xhr.abort();\n                } catch (x) {\n                }\n              }\n              this.unloadRef = this.xhr = null;\n            };\n            AbstractXHRObject.prototype.close = function() {\n              debug(\"close\");\n              this._cleanup(true);\n            };\n            AbstractXHRObject.enabled = !!XHR;\n            var axo = [\"Active\"].concat(\"Object\").join(\"X\");\n            if (!AbstractXHRObject.enabled && axo in global2) {\n              debug(\"overriding xmlhttprequest\");\n              XHR = function() {\n                try {\n                  return new global2[axo](\"Microsoft.XMLHTTP\");\n                } catch (e) {\n                  return null;\n                }\n              };\n              AbstractXHRObject.enabled = !!new XHR();\n            }\n            var cors = false;\n            try {\n              cors = \"withCredentials\" in new XHR();\n            } catch (ignored) {\n            }\n            AbstractXHRObject.supportsCORS = cors;\n            module3.exports = AbstractXHRObject;\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../../utils/event\": 46, \"../../utils/url\": 52, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 18: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            module3.exports = global2.EventSource;\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, {}], 19: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var Driver = global2.WebSocket || global2.MozWebSocket;\n            if (Driver) {\n              module3.exports = function WebSocketBrowserDriver(url) {\n                return new Driver(url);\n              };\n            } else {\n              module3.exports = void 0;\n            }\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, {}], 20: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), AjaxBasedTransport = require2(\"./lib/ajax-based\"), EventSourceReceiver = require2(\"./receiver/eventsource\"), XHRCorsObject = require2(\"./sender/xhr-cors\"), EventSourceDriver = require2(\"eventsource\");\n        function EventSourceTransport(transUrl) {\n          if (!EventSourceTransport.enabled()) {\n            throw new Error(\"Transport created when disabled\");\n          }\n          AjaxBasedTransport.call(this, transUrl, \"/eventsource\", EventSourceReceiver, XHRCorsObject);\n        }\n        inherits(EventSourceTransport, AjaxBasedTransport);\n        EventSourceTransport.enabled = function() {\n          return !!EventSourceDriver;\n        };\n        EventSourceTransport.transportName = \"eventsource\";\n        EventSourceTransport.roundTrips = 2;\n        module3.exports = EventSourceTransport;\n      }, { \"./lib/ajax-based\": 24, \"./receiver/eventsource\": 29, \"./sender/xhr-cors\": 35, \"eventsource\": 18, \"inherits\": 57 }], 21: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), HtmlfileReceiver = require2(\"./receiver/htmlfile\"), XHRLocalObject = require2(\"./sender/xhr-local\"), AjaxBasedTransport = require2(\"./lib/ajax-based\");\n        function HtmlFileTransport(transUrl) {\n          if (!HtmlfileReceiver.enabled) {\n            throw new Error(\"Transport created when disabled\");\n          }\n          AjaxBasedTransport.call(this, transUrl, \"/htmlfile\", HtmlfileReceiver, XHRLocalObject);\n        }\n        inherits(HtmlFileTransport, AjaxBasedTransport);\n        HtmlFileTransport.enabled = function(info) {\n          return HtmlfileReceiver.enabled && info.sameOrigin;\n        };\n        HtmlFileTransport.transportName = \"htmlfile\";\n        HtmlFileTransport.roundTrips = 2;\n        module3.exports = HtmlFileTransport;\n      }, { \"./lib/ajax-based\": 24, \"./receiver/htmlfile\": 30, \"./sender/xhr-local\": 37, \"inherits\": 57 }], 22: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter, version = require2(\"../version\"), urlUtils = require2(\"../utils/url\"), iframeUtils = require2(\"../utils/iframe\"), eventUtils = require2(\"../utils/event\"), random = require2(\"../utils/random\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:transport:iframe\");\n            }\n            function IframeTransport(transport, transUrl, baseUrl) {\n              if (!IframeTransport.enabled()) {\n                throw new Error(\"Transport created when disabled\");\n              }\n              EventEmitter.call(this);\n              var self2 = this;\n              this.origin = urlUtils.getOrigin(baseUrl);\n              this.baseUrl = baseUrl;\n              this.transUrl = transUrl;\n              this.transport = transport;\n              this.windowId = random.string(8);\n              var iframeUrl = urlUtils.addPath(baseUrl, \"/iframe.html\") + \"#\" + this.windowId;\n              debug(transport, transUrl, iframeUrl);\n              this.iframeObj = iframeUtils.createIframe(iframeUrl, function(r) {\n                debug(\"err callback\");\n                self2.emit(\"close\", 1006, \"Unable to load an iframe (\" + r + \")\");\n                self2.close();\n              });\n              this.onmessageCallback = this._message.bind(this);\n              eventUtils.attachEvent(\"message\", this.onmessageCallback);\n            }\n            inherits(IframeTransport, EventEmitter);\n            IframeTransport.prototype.close = function() {\n              debug(\"close\");\n              this.removeAllListeners();\n              if (this.iframeObj) {\n                eventUtils.detachEvent(\"message\", this.onmessageCallback);\n                try {\n                  this.postMessage(\"c\");\n                } catch (x) {\n                }\n                this.iframeObj.cleanup();\n                this.iframeObj = null;\n                this.onmessageCallback = this.iframeObj = null;\n              }\n            };\n            IframeTransport.prototype._message = function(e) {\n              debug(\"message\", e.data);\n              if (!urlUtils.isOriginEqual(e.origin, this.origin)) {\n                debug(\"not same origin\", e.origin, this.origin);\n                return;\n              }\n              var iframeMessage;\n              try {\n                iframeMessage = JSON.parse(e.data);\n              } catch (ignored) {\n                debug(\"bad json\", e.data);\n                return;\n              }\n              if (iframeMessage.windowId !== this.windowId) {\n                debug(\"mismatched window id\", iframeMessage.windowId, this.windowId);\n                return;\n              }\n              switch (iframeMessage.type) {\n                case \"s\":\n                  this.iframeObj.loaded();\n                  this.postMessage(\"s\", JSON.stringify([\n                    version,\n                    this.transport,\n                    this.transUrl,\n                    this.baseUrl\n                  ]));\n                  break;\n                case \"t\":\n                  this.emit(\"message\", iframeMessage.data);\n                  break;\n                case \"c\":\n                  var cdata;\n                  try {\n                    cdata = JSON.parse(iframeMessage.data);\n                  } catch (ignored) {\n                    debug(\"bad json\", iframeMessage.data);\n                    return;\n                  }\n                  this.emit(\"close\", cdata[0], cdata[1]);\n                  this.close();\n                  break;\n              }\n            };\n            IframeTransport.prototype.postMessage = function(type, data) {\n              debug(\"postMessage\", type, data);\n              this.iframeObj.post(JSON.stringify({\n                windowId: this.windowId,\n                type,\n                data: data || \"\"\n              }), this.origin);\n            };\n            IframeTransport.prototype.send = function(message) {\n              debug(\"send\", message);\n              this.postMessage(\"m\", message);\n            };\n            IframeTransport.enabled = function() {\n              return iframeUtils.iframeEnabled;\n            };\n            IframeTransport.transportName = \"iframe\";\n            IframeTransport.roundTrips = 2;\n            module3.exports = IframeTransport;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"../utils/event\": 46, \"../utils/iframe\": 47, \"../utils/random\": 50, \"../utils/url\": 52, \"../version\": 53, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 23: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), SenderReceiver = require2(\"./lib/sender-receiver\"), JsonpReceiver = require2(\"./receiver/jsonp\"), jsonpSender = require2(\"./sender/jsonp\");\n            function JsonPTransport(transUrl) {\n              if (!JsonPTransport.enabled()) {\n                throw new Error(\"Transport created when disabled\");\n              }\n              SenderReceiver.call(this, transUrl, \"/jsonp\", jsonpSender, JsonpReceiver);\n            }\n            inherits(JsonPTransport, SenderReceiver);\n            JsonPTransport.enabled = function() {\n              return !!global2.document;\n            };\n            JsonPTransport.transportName = \"jsonp-polling\";\n            JsonPTransport.roundTrips = 1;\n            JsonPTransport.needBody = true;\n            module3.exports = JsonPTransport;\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"./lib/sender-receiver\": 28, \"./receiver/jsonp\": 31, \"./sender/jsonp\": 33, \"inherits\": 57 }], 24: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), urlUtils = require2(\"../../utils/url\"), SenderReceiver = require2(\"./sender-receiver\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:ajax-based\");\n            }\n            function createAjaxSender(AjaxObject) {\n              return function(url, payload, callback) {\n                debug(\"create ajax sender\", url, payload);\n                var opt = {};\n                if (typeof payload === \"string\") {\n                  opt.headers = { \"Content-type\": \"text/plain\" };\n                }\n                var ajaxUrl = urlUtils.addPath(url, \"/xhr_send\");\n                var xo = new AjaxObject(\"POST\", ajaxUrl, payload, opt);\n                xo.once(\"finish\", function(status) {\n                  debug(\"finish\", status);\n                  xo = null;\n                  if (status !== 200 && status !== 204) {\n                    return callback(new Error(\"http status \" + status));\n                  }\n                  callback();\n                });\n                return function() {\n                  debug(\"abort\");\n                  xo.close();\n                  xo = null;\n                  var err = new Error(\"Aborted\");\n                  err.code = 1e3;\n                  callback(err);\n                };\n              };\n            }\n            function AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) {\n              SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject);\n            }\n            inherits(AjaxBasedTransport, SenderReceiver);\n            module3.exports = AjaxBasedTransport;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"../../utils/url\": 52, \"./sender-receiver\": 28, \"debug\": 55, \"inherits\": 57 }], 25: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter;\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:buffered-sender\");\n            }\n            function BufferedSender(url, sender) {\n              debug(url);\n              EventEmitter.call(this);\n              this.sendBuffer = [];\n              this.sender = sender;\n              this.url = url;\n            }\n            inherits(BufferedSender, EventEmitter);\n            BufferedSender.prototype.send = function(message) {\n              debug(\"send\", message);\n              this.sendBuffer.push(message);\n              if (!this.sendStop) {\n                this.sendSchedule();\n              }\n            };\n            BufferedSender.prototype.sendScheduleWait = function() {\n              debug(\"sendScheduleWait\");\n              var self2 = this;\n              var tref;\n              this.sendStop = function() {\n                debug(\"sendStop\");\n                self2.sendStop = null;\n                clearTimeout(tref);\n              };\n              tref = setTimeout(function() {\n                debug(\"timeout\");\n                self2.sendStop = null;\n                self2.sendSchedule();\n              }, 25);\n            };\n            BufferedSender.prototype.sendSchedule = function() {\n              debug(\"sendSchedule\", this.sendBuffer.length);\n              var self2 = this;\n              if (this.sendBuffer.length > 0) {\n                var payload = \"[\" + this.sendBuffer.join(\",\") + \"]\";\n                this.sendStop = this.sender(this.url, payload, function(err) {\n                  self2.sendStop = null;\n                  if (err) {\n                    debug(\"error\", err);\n                    self2.emit(\"close\", err.code || 1006, \"Sending error: \" + err);\n                    self2.close();\n                  } else {\n                    self2.sendScheduleWait();\n                  }\n                });\n                this.sendBuffer = [];\n              }\n            };\n            BufferedSender.prototype._cleanup = function() {\n              debug(\"_cleanup\");\n              this.removeAllListeners();\n            };\n            BufferedSender.prototype.close = function() {\n              debug(\"close\");\n              this._cleanup();\n              if (this.sendStop) {\n                this.sendStop();\n                this.sendStop = null;\n              }\n            };\n            module3.exports = BufferedSender;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 26: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), IframeTransport = require2(\"../iframe\"), objectUtils = require2(\"../../utils/object\");\n            module3.exports = function(transport) {\n              function IframeWrapTransport(transUrl, baseUrl) {\n                IframeTransport.call(this, transport.transportName, transUrl, baseUrl);\n              }\n              inherits(IframeWrapTransport, IframeTransport);\n              IframeWrapTransport.enabled = function(url, info) {\n                if (!global2.document) {\n                  return false;\n                }\n                var iframeInfo = objectUtils.extend({}, info);\n                iframeInfo.sameOrigin = true;\n                return transport.enabled(iframeInfo) && IframeTransport.enabled();\n              };\n              IframeWrapTransport.transportName = \"iframe-\" + transport.transportName;\n              IframeWrapTransport.needBody = true;\n              IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1;\n              IframeWrapTransport.facadeTransport = transport;\n              return IframeWrapTransport;\n            };\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../../utils/object\": 49, \"../iframe\": 22, \"inherits\": 57 }], 27: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter;\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:polling\");\n            }\n            function Polling(Receiver, receiveUrl, AjaxObject) {\n              debug(receiveUrl);\n              EventEmitter.call(this);\n              this.Receiver = Receiver;\n              this.receiveUrl = receiveUrl;\n              this.AjaxObject = AjaxObject;\n              this._scheduleReceiver();\n            }\n            inherits(Polling, EventEmitter);\n            Polling.prototype._scheduleReceiver = function() {\n              debug(\"_scheduleReceiver\");\n              var self2 = this;\n              var poll = this.poll = new this.Receiver(this.receiveUrl, this.AjaxObject);\n              poll.on(\"message\", function(msg) {\n                debug(\"message\", msg);\n                self2.emit(\"message\", msg);\n              });\n              poll.once(\"close\", function(code, reason) {\n                debug(\"close\", code, reason, self2.pollIsClosing);\n                self2.poll = poll = null;\n                if (!self2.pollIsClosing) {\n                  if (reason === \"network\") {\n                    self2._scheduleReceiver();\n                  } else {\n                    self2.emit(\"close\", code || 1006, reason);\n                    self2.removeAllListeners();\n                  }\n                }\n              });\n            };\n            Polling.prototype.abort = function() {\n              debug(\"abort\");\n              this.removeAllListeners();\n              this.pollIsClosing = true;\n              if (this.poll) {\n                this.poll.abort();\n              }\n            };\n            module3.exports = Polling;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 28: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), urlUtils = require2(\"../../utils/url\"), BufferedSender = require2(\"./buffered-sender\"), Polling = require2(\"./polling\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:sender-receiver\");\n            }\n            function SenderReceiver(transUrl, urlSuffix, senderFunc, Receiver, AjaxObject) {\n              var pollUrl = urlUtils.addPath(transUrl, urlSuffix);\n              debug(pollUrl);\n              var self2 = this;\n              BufferedSender.call(this, transUrl, senderFunc);\n              this.poll = new Polling(Receiver, pollUrl, AjaxObject);\n              this.poll.on(\"message\", function(msg) {\n                debug(\"poll message\", msg);\n                self2.emit(\"message\", msg);\n              });\n              this.poll.once(\"close\", function(code, reason) {\n                debug(\"poll close\", code, reason);\n                self2.poll = null;\n                self2.emit(\"close\", code, reason);\n                self2.close();\n              });\n            }\n            inherits(SenderReceiver, BufferedSender);\n            SenderReceiver.prototype.close = function() {\n              BufferedSender.prototype.close.call(this);\n              debug(\"close\");\n              this.removeAllListeners();\n              if (this.poll) {\n                this.poll.abort();\n                this.poll = null;\n              }\n            };\n            module3.exports = SenderReceiver;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"../../utils/url\": 52, \"./buffered-sender\": 25, \"./polling\": 27, \"debug\": 55, \"inherits\": 57 }], 29: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter, EventSourceDriver = require2(\"eventsource\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:receiver:eventsource\");\n            }\n            function EventSourceReceiver(url) {\n              debug(url);\n              EventEmitter.call(this);\n              var self2 = this;\n              var es = this.es = new EventSourceDriver(url);\n              es.onmessage = function(e) {\n                debug(\"message\", e.data);\n                self2.emit(\"message\", decodeURI(e.data));\n              };\n              es.onerror = function(e) {\n                debug(\"error\", es.readyState, e);\n                var reason = es.readyState !== 2 ? \"network\" : \"permanent\";\n                self2._cleanup();\n                self2._close(reason);\n              };\n            }\n            inherits(EventSourceReceiver, EventEmitter);\n            EventSourceReceiver.prototype.abort = function() {\n              debug(\"abort\");\n              this._cleanup();\n              this._close(\"user\");\n            };\n            EventSourceReceiver.prototype._cleanup = function() {\n              debug(\"cleanup\");\n              var es = this.es;\n              if (es) {\n                es.onmessage = es.onerror = null;\n                es.close();\n                this.es = null;\n              }\n            };\n            EventSourceReceiver.prototype._close = function(reason) {\n              debug(\"close\", reason);\n              var self2 = this;\n              setTimeout(function() {\n                self2.emit(\"close\", null, reason);\n                self2.removeAllListeners();\n              }, 200);\n            };\n            module3.exports = EventSourceReceiver;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"debug\": 55, \"events\": 3, \"eventsource\": 18, \"inherits\": 57 }], 30: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), iframeUtils = require2(\"../../utils/iframe\"), urlUtils = require2(\"../../utils/url\"), EventEmitter = require2(\"events\").EventEmitter, random = require2(\"../../utils/random\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:receiver:htmlfile\");\n            }\n            function HtmlfileReceiver(url) {\n              debug(url);\n              EventEmitter.call(this);\n              var self2 = this;\n              iframeUtils.polluteGlobalNamespace();\n              this.id = \"a\" + random.string(6);\n              url = urlUtils.addQuery(url, \"c=\" + decodeURIComponent(iframeUtils.WPrefix + \".\" + this.id));\n              debug(\"using htmlfile\", HtmlfileReceiver.htmlfileEnabled);\n              var constructFunc = HtmlfileReceiver.htmlfileEnabled ? iframeUtils.createHtmlfile : iframeUtils.createIframe;\n              global2[iframeUtils.WPrefix][this.id] = {\n                start: function() {\n                  debug(\"start\");\n                  self2.iframeObj.loaded();\n                },\n                message: function(data) {\n                  debug(\"message\", data);\n                  self2.emit(\"message\", data);\n                },\n                stop: function() {\n                  debug(\"stop\");\n                  self2._cleanup();\n                  self2._close(\"network\");\n                }\n              };\n              this.iframeObj = constructFunc(url, function() {\n                debug(\"callback\");\n                self2._cleanup();\n                self2._close(\"permanent\");\n              });\n            }\n            inherits(HtmlfileReceiver, EventEmitter);\n            HtmlfileReceiver.prototype.abort = function() {\n              debug(\"abort\");\n              this._cleanup();\n              this._close(\"user\");\n            };\n            HtmlfileReceiver.prototype._cleanup = function() {\n              debug(\"_cleanup\");\n              if (this.iframeObj) {\n                this.iframeObj.cleanup();\n                this.iframeObj = null;\n              }\n              delete global2[iframeUtils.WPrefix][this.id];\n            };\n            HtmlfileReceiver.prototype._close = function(reason) {\n              debug(\"_close\", reason);\n              this.emit(\"close\", null, reason);\n              this.removeAllListeners();\n            };\n            HtmlfileReceiver.htmlfileEnabled = false;\n            var axo = [\"Active\"].concat(\"Object\").join(\"X\");\n            if (axo in global2) {\n              try {\n                HtmlfileReceiver.htmlfileEnabled = !!new global2[axo](\"htmlfile\");\n              } catch (x) {\n              }\n            }\n            HtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;\n            module3.exports = HtmlfileReceiver;\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../../utils/iframe\": 47, \"../../utils/random\": 50, \"../../utils/url\": 52, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 31: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var utils = require2(\"../../utils/iframe\"), random = require2(\"../../utils/random\"), browser = require2(\"../../utils/browser\"), urlUtils = require2(\"../../utils/url\"), inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter;\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:receiver:jsonp\");\n            }\n            function JsonpReceiver(url) {\n              debug(url);\n              var self2 = this;\n              EventEmitter.call(this);\n              utils.polluteGlobalNamespace();\n              this.id = \"a\" + random.string(6);\n              var urlWithId = urlUtils.addQuery(url, \"c=\" + encodeURIComponent(utils.WPrefix + \".\" + this.id));\n              global2[utils.WPrefix][this.id] = this._callback.bind(this);\n              this._createScript(urlWithId);\n              this.timeoutId = setTimeout(function() {\n                debug(\"timeout\");\n                self2._abort(new Error(\"JSONP script loaded abnormally (timeout)\"));\n              }, JsonpReceiver.timeout);\n            }\n            inherits(JsonpReceiver, EventEmitter);\n            JsonpReceiver.prototype.abort = function() {\n              debug(\"abort\");\n              if (global2[utils.WPrefix][this.id]) {\n                var err = new Error(\"JSONP user aborted read\");\n                err.code = 1e3;\n                this._abort(err);\n              }\n            };\n            JsonpReceiver.timeout = 35e3;\n            JsonpReceiver.scriptErrorTimeout = 1e3;\n            JsonpReceiver.prototype._callback = function(data) {\n              debug(\"_callback\", data);\n              this._cleanup();\n              if (this.aborting) {\n                return;\n              }\n              if (data) {\n                debug(\"message\", data);\n                this.emit(\"message\", data);\n              }\n              this.emit(\"close\", null, \"network\");\n              this.removeAllListeners();\n            };\n            JsonpReceiver.prototype._abort = function(err) {\n              debug(\"_abort\", err);\n              this._cleanup();\n              this.aborting = true;\n              this.emit(\"close\", err.code, err.message);\n              this.removeAllListeners();\n            };\n            JsonpReceiver.prototype._cleanup = function() {\n              debug(\"_cleanup\");\n              clearTimeout(this.timeoutId);\n              if (this.script2) {\n                this.script2.parentNode.removeChild(this.script2);\n                this.script2 = null;\n              }\n              if (this.script) {\n                var script = this.script;\n                script.parentNode.removeChild(script);\n                script.onreadystatechange = script.onerror = script.onload = script.onclick = null;\n                this.script = null;\n              }\n              delete global2[utils.WPrefix][this.id];\n            };\n            JsonpReceiver.prototype._scriptError = function() {\n              debug(\"_scriptError\");\n              var self2 = this;\n              if (this.errorTimer) {\n                return;\n              }\n              this.errorTimer = setTimeout(function() {\n                if (!self2.loadedOkay) {\n                  self2._abort(new Error(\"JSONP script loaded abnormally (onerror)\"));\n                }\n              }, JsonpReceiver.scriptErrorTimeout);\n            };\n            JsonpReceiver.prototype._createScript = function(url) {\n              debug(\"_createScript\", url);\n              var self2 = this;\n              var script = this.script = global2.document.createElement(\"script\");\n              var script2;\n              script.id = \"a\" + random.string(8);\n              script.src = url;\n              script.type = \"text/javascript\";\n              script.charset = \"UTF-8\";\n              script.onerror = this._scriptError.bind(this);\n              script.onload = function() {\n                debug(\"onload\");\n                self2._abort(new Error(\"JSONP script loaded abnormally (onload)\"));\n              };\n              script.onreadystatechange = function() {\n                debug(\"onreadystatechange\", script.readyState);\n                if (/loaded|closed/.test(script.readyState)) {\n                  if (script && script.htmlFor && script.onclick) {\n                    self2.loadedOkay = true;\n                    try {\n                      script.onclick();\n                    } catch (x) {\n                    }\n                  }\n                  if (script) {\n                    self2._abort(new Error(\"JSONP script loaded abnormally (onreadystatechange)\"));\n                  }\n                }\n              };\n              if (typeof script.async === \"undefined\" && global2.document.attachEvent) {\n                if (!browser.isOpera()) {\n                  try {\n                    script.htmlFor = script.id;\n                    script.event = \"onclick\";\n                  } catch (x) {\n                  }\n                  script.async = true;\n                } else {\n                  script2 = this.script2 = global2.document.createElement(\"script\");\n                  script2.text = \"try{var a = document.getElementById('\" + script.id + \"'); if(a)a.onerror();}catch(x){};\";\n                  script.async = script2.async = false;\n                }\n              }\n              if (typeof script.async !== \"undefined\") {\n                script.async = true;\n              }\n              var head = global2.document.getElementsByTagName(\"head\")[0];\n              head.insertBefore(script, head.firstChild);\n              if (script2) {\n                head.insertBefore(script2, head.firstChild);\n              }\n            };\n            module3.exports = JsonpReceiver;\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../../utils/browser\": 44, \"../../utils/iframe\": 47, \"../../utils/random\": 50, \"../../utils/url\": 52, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 32: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter;\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:receiver:xhr\");\n            }\n            function XhrReceiver(url, AjaxObject) {\n              debug(url);\n              EventEmitter.call(this);\n              var self2 = this;\n              this.bufferPosition = 0;\n              this.xo = new AjaxObject(\"POST\", url, null);\n              this.xo.on(\"chunk\", this._chunkHandler.bind(this));\n              this.xo.once(\"finish\", function(status, text) {\n                debug(\"finish\", status, text);\n                self2._chunkHandler(status, text);\n                self2.xo = null;\n                var reason = status === 200 ? \"network\" : \"permanent\";\n                debug(\"close\", reason);\n                self2.emit(\"close\", null, reason);\n                self2._cleanup();\n              });\n            }\n            inherits(XhrReceiver, EventEmitter);\n            XhrReceiver.prototype._chunkHandler = function(status, text) {\n              debug(\"_chunkHandler\", status);\n              if (status !== 200 || !text) {\n                return;\n              }\n              for (var idx = -1; ; this.bufferPosition += idx + 1) {\n                var buf = text.slice(this.bufferPosition);\n                idx = buf.indexOf(\"\\n\");\n                if (idx === -1) {\n                  break;\n                }\n                var msg = buf.slice(0, idx);\n                if (msg) {\n                  debug(\"message\", msg);\n                  this.emit(\"message\", msg);\n                }\n              }\n            };\n            XhrReceiver.prototype._cleanup = function() {\n              debug(\"_cleanup\");\n              this.removeAllListeners();\n            };\n            XhrReceiver.prototype.abort = function() {\n              debug(\"abort\");\n              if (this.xo) {\n                this.xo.close();\n                debug(\"close\");\n                this.emit(\"close\", null, \"user\");\n                this.xo = null;\n              }\n              this._cleanup();\n            };\n            module3.exports = XhrReceiver;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 33: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var random = require2(\"../../utils/random\"), urlUtils = require2(\"../../utils/url\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:sender:jsonp\");\n            }\n            var form, area;\n            function createIframe(id) {\n              debug(\"createIframe\", id);\n              try {\n                return global2.document.createElement('<iframe name=\"' + id + '\">');\n              } catch (x) {\n                var iframe = global2.document.createElement(\"iframe\");\n                iframe.name = id;\n                return iframe;\n              }\n            }\n            function createForm() {\n              debug(\"createForm\");\n              form = global2.document.createElement(\"form\");\n              form.style.display = \"none\";\n              form.style.position = \"absolute\";\n              form.method = \"POST\";\n              form.enctype = \"application/x-www-form-urlencoded\";\n              form.acceptCharset = \"UTF-8\";\n              area = global2.document.createElement(\"textarea\");\n              area.name = \"d\";\n              form.appendChild(area);\n              global2.document.body.appendChild(form);\n            }\n            module3.exports = function(url, payload, callback) {\n              debug(url, payload);\n              if (!form) {\n                createForm();\n              }\n              var id = \"a\" + random.string(8);\n              form.target = id;\n              form.action = urlUtils.addQuery(urlUtils.addPath(url, \"/jsonp_send\"), \"i=\" + id);\n              var iframe = createIframe(id);\n              iframe.id = id;\n              iframe.style.display = \"none\";\n              form.appendChild(iframe);\n              try {\n                area.value = payload;\n              } catch (e) {\n              }\n              form.submit();\n              var completed = function(err) {\n                debug(\"completed\", id, err);\n                if (!iframe.onerror) {\n                  return;\n                }\n                iframe.onreadystatechange = iframe.onerror = iframe.onload = null;\n                setTimeout(function() {\n                  debug(\"cleaning up\", id);\n                  iframe.parentNode.removeChild(iframe);\n                  iframe = null;\n                }, 500);\n                area.value = \"\";\n                callback(err);\n              };\n              iframe.onerror = function() {\n                debug(\"onerror\", id);\n                completed();\n              };\n              iframe.onload = function() {\n                debug(\"onload\", id);\n                completed();\n              };\n              iframe.onreadystatechange = function(e) {\n                debug(\"onreadystatechange\", id, iframe.readyState, e);\n                if (iframe.readyState === \"complete\") {\n                  completed();\n                }\n              };\n              return function() {\n                debug(\"aborted\", id);\n                completed(new Error(\"Aborted\"));\n              };\n            };\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../../utils/random\": 50, \"../../utils/url\": 52, \"debug\": 55 }], 34: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var EventEmitter = require2(\"events\").EventEmitter, inherits = require2(\"inherits\"), eventUtils = require2(\"../../utils/event\"), browser = require2(\"../../utils/browser\"), urlUtils = require2(\"../../utils/url\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:sender:xdr\");\n            }\n            function XDRObject(method, url, payload) {\n              debug(method, url);\n              var self2 = this;\n              EventEmitter.call(this);\n              setTimeout(function() {\n                self2._start(method, url, payload);\n              }, 0);\n            }\n            inherits(XDRObject, EventEmitter);\n            XDRObject.prototype._start = function(method, url, payload) {\n              debug(\"_start\");\n              var self2 = this;\n              var xdr = new global2.XDomainRequest();\n              url = urlUtils.addQuery(url, \"t=\" + +/* @__PURE__ */ new Date());\n              xdr.onerror = function() {\n                debug(\"onerror\");\n                self2._error();\n              };\n              xdr.ontimeout = function() {\n                debug(\"ontimeout\");\n                self2._error();\n              };\n              xdr.onprogress = function() {\n                debug(\"progress\", xdr.responseText);\n                self2.emit(\"chunk\", 200, xdr.responseText);\n              };\n              xdr.onload = function() {\n                debug(\"load\");\n                self2.emit(\"finish\", 200, xdr.responseText);\n                self2._cleanup(false);\n              };\n              this.xdr = xdr;\n              this.unloadRef = eventUtils.unloadAdd(function() {\n                self2._cleanup(true);\n              });\n              try {\n                this.xdr.open(method, url);\n                if (this.timeout) {\n                  this.xdr.timeout = this.timeout;\n                }\n                this.xdr.send(payload);\n              } catch (x) {\n                this._error();\n              }\n            };\n            XDRObject.prototype._error = function() {\n              this.emit(\"finish\", 0, \"\");\n              this._cleanup(false);\n            };\n            XDRObject.prototype._cleanup = function(abort) {\n              debug(\"cleanup\", abort);\n              if (!this.xdr) {\n                return;\n              }\n              this.removeAllListeners();\n              eventUtils.unloadDel(this.unloadRef);\n              this.xdr.ontimeout = this.xdr.onerror = this.xdr.onprogress = this.xdr.onload = null;\n              if (abort) {\n                try {\n                  this.xdr.abort();\n                } catch (x) {\n                }\n              }\n              this.unloadRef = this.xdr = null;\n            };\n            XDRObject.prototype.close = function() {\n              debug(\"close\");\n              this._cleanup(true);\n            };\n            XDRObject.enabled = !!(global2.XDomainRequest && browser.hasDomain());\n            module3.exports = XDRObject;\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../../utils/browser\": 44, \"../../utils/event\": 46, \"../../utils/url\": 52, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 35: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), XhrDriver = require2(\"../driver/xhr\");\n        function XHRCorsObject(method, url, payload, opts) {\n          XhrDriver.call(this, method, url, payload, opts);\n        }\n        inherits(XHRCorsObject, XhrDriver);\n        XHRCorsObject.enabled = XhrDriver.enabled && XhrDriver.supportsCORS;\n        module3.exports = XHRCorsObject;\n      }, { \"../driver/xhr\": 17, \"inherits\": 57 }], 36: [function(require2, module3, exports3) {\n        \"use strict\";\n        var EventEmitter = require2(\"events\").EventEmitter, inherits = require2(\"inherits\");\n        function XHRFake() {\n          var self2 = this;\n          EventEmitter.call(this);\n          this.to = setTimeout(function() {\n            self2.emit(\"finish\", 200, \"{}\");\n          }, XHRFake.timeout);\n        }\n        inherits(XHRFake, EventEmitter);\n        XHRFake.prototype.close = function() {\n          clearTimeout(this.to);\n        };\n        XHRFake.timeout = 2e3;\n        module3.exports = XHRFake;\n      }, { \"events\": 3, \"inherits\": 57 }], 37: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), XhrDriver = require2(\"../driver/xhr\");\n        function XHRLocalObject(method, url, payload) {\n          XhrDriver.call(this, method, url, payload, {\n            noCredentials: true\n          });\n        }\n        inherits(XHRLocalObject, XhrDriver);\n        XHRLocalObject.enabled = XhrDriver.enabled;\n        module3.exports = XHRLocalObject;\n      }, { \"../driver/xhr\": 17, \"inherits\": 57 }], 38: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var utils = require2(\"../utils/event\"), urlUtils = require2(\"../utils/url\"), inherits = require2(\"inherits\"), EventEmitter = require2(\"events\").EventEmitter, WebsocketDriver = require2(\"./driver/websocket\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:websocket\");\n            }\n            function WebSocketTransport(transUrl, ignore, options) {\n              if (!WebSocketTransport.enabled()) {\n                throw new Error(\"Transport created when disabled\");\n              }\n              EventEmitter.call(this);\n              debug(\"constructor\", transUrl);\n              var self2 = this;\n              var url = urlUtils.addPath(transUrl, \"/websocket\");\n              if (url.slice(0, 5) === \"https\") {\n                url = \"wss\" + url.slice(5);\n              } else {\n                url = \"ws\" + url.slice(4);\n              }\n              this.url = url;\n              this.ws = new WebsocketDriver(this.url, [], options);\n              this.ws.onmessage = function(e) {\n                debug(\"message event\", e.data);\n                self2.emit(\"message\", e.data);\n              };\n              this.unloadRef = utils.unloadAdd(function() {\n                debug(\"unload\");\n                self2.ws.close();\n              });\n              this.ws.onclose = function(e) {\n                debug(\"close event\", e.code, e.reason);\n                self2.emit(\"close\", e.code, e.reason);\n                self2._cleanup();\n              };\n              this.ws.onerror = function(e) {\n                debug(\"error event\", e);\n                self2.emit(\"close\", 1006, \"WebSocket connection broken\");\n                self2._cleanup();\n              };\n            }\n            inherits(WebSocketTransport, EventEmitter);\n            WebSocketTransport.prototype.send = function(data) {\n              var msg = \"[\" + data + \"]\";\n              debug(\"send\", msg);\n              this.ws.send(msg);\n            };\n            WebSocketTransport.prototype.close = function() {\n              debug(\"close\");\n              var ws = this.ws;\n              this._cleanup();\n              if (ws) {\n                ws.close();\n              }\n            };\n            WebSocketTransport.prototype._cleanup = function() {\n              debug(\"_cleanup\");\n              var ws = this.ws;\n              if (ws) {\n                ws.onmessage = ws.onclose = ws.onerror = null;\n              }\n              utils.unloadDel(this.unloadRef);\n              this.unloadRef = this.ws = null;\n              this.removeAllListeners();\n            };\n            WebSocketTransport.enabled = function() {\n              debug(\"enabled\");\n              return !!WebsocketDriver;\n            };\n            WebSocketTransport.transportName = \"websocket\";\n            WebSocketTransport.roundTrips = 2;\n            module3.exports = WebSocketTransport;\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"../utils/event\": 46, \"../utils/url\": 52, \"./driver/websocket\": 19, \"debug\": 55, \"events\": 3, \"inherits\": 57 }], 39: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), AjaxBasedTransport = require2(\"./lib/ajax-based\"), XdrStreamingTransport = require2(\"./xdr-streaming\"), XhrReceiver = require2(\"./receiver/xhr\"), XDRObject = require2(\"./sender/xdr\");\n        function XdrPollingTransport(transUrl) {\n          if (!XDRObject.enabled) {\n            throw new Error(\"Transport created when disabled\");\n          }\n          AjaxBasedTransport.call(this, transUrl, \"/xhr\", XhrReceiver, XDRObject);\n        }\n        inherits(XdrPollingTransport, AjaxBasedTransport);\n        XdrPollingTransport.enabled = XdrStreamingTransport.enabled;\n        XdrPollingTransport.transportName = \"xdr-polling\";\n        XdrPollingTransport.roundTrips = 2;\n        module3.exports = XdrPollingTransport;\n      }, { \"./lib/ajax-based\": 24, \"./receiver/xhr\": 32, \"./sender/xdr\": 34, \"./xdr-streaming\": 40, \"inherits\": 57 }], 40: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), AjaxBasedTransport = require2(\"./lib/ajax-based\"), XhrReceiver = require2(\"./receiver/xhr\"), XDRObject = require2(\"./sender/xdr\");\n        function XdrStreamingTransport(transUrl) {\n          if (!XDRObject.enabled) {\n            throw new Error(\"Transport created when disabled\");\n          }\n          AjaxBasedTransport.call(this, transUrl, \"/xhr_streaming\", XhrReceiver, XDRObject);\n        }\n        inherits(XdrStreamingTransport, AjaxBasedTransport);\n        XdrStreamingTransport.enabled = function(info) {\n          if (info.cookie_needed || info.nullOrigin) {\n            return false;\n          }\n          return XDRObject.enabled && info.sameScheme;\n        };\n        XdrStreamingTransport.transportName = \"xdr-streaming\";\n        XdrStreamingTransport.roundTrips = 2;\n        module3.exports = XdrStreamingTransport;\n      }, { \"./lib/ajax-based\": 24, \"./receiver/xhr\": 32, \"./sender/xdr\": 34, \"inherits\": 57 }], 41: [function(require2, module3, exports3) {\n        \"use strict\";\n        var inherits = require2(\"inherits\"), AjaxBasedTransport = require2(\"./lib/ajax-based\"), XhrReceiver = require2(\"./receiver/xhr\"), XHRCorsObject = require2(\"./sender/xhr-cors\"), XHRLocalObject = require2(\"./sender/xhr-local\");\n        function XhrPollingTransport(transUrl) {\n          if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {\n            throw new Error(\"Transport created when disabled\");\n          }\n          AjaxBasedTransport.call(this, transUrl, \"/xhr\", XhrReceiver, XHRCorsObject);\n        }\n        inherits(XhrPollingTransport, AjaxBasedTransport);\n        XhrPollingTransport.enabled = function(info) {\n          if (info.nullOrigin) {\n            return false;\n          }\n          if (XHRLocalObject.enabled && info.sameOrigin) {\n            return true;\n          }\n          return XHRCorsObject.enabled;\n        };\n        XhrPollingTransport.transportName = \"xhr-polling\";\n        XhrPollingTransport.roundTrips = 2;\n        module3.exports = XhrPollingTransport;\n      }, { \"./lib/ajax-based\": 24, \"./receiver/xhr\": 32, \"./sender/xhr-cors\": 35, \"./sender/xhr-local\": 37, \"inherits\": 57 }], 42: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var inherits = require2(\"inherits\"), AjaxBasedTransport = require2(\"./lib/ajax-based\"), XhrReceiver = require2(\"./receiver/xhr\"), XHRCorsObject = require2(\"./sender/xhr-cors\"), XHRLocalObject = require2(\"./sender/xhr-local\"), browser = require2(\"../utils/browser\");\n            function XhrStreamingTransport(transUrl) {\n              if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {\n                throw new Error(\"Transport created when disabled\");\n              }\n              AjaxBasedTransport.call(this, transUrl, \"/xhr_streaming\", XhrReceiver, XHRCorsObject);\n            }\n            inherits(XhrStreamingTransport, AjaxBasedTransport);\n            XhrStreamingTransport.enabled = function(info) {\n              if (info.nullOrigin) {\n                return false;\n              }\n              if (browser.isOpera()) {\n                return false;\n              }\n              return XHRCorsObject.enabled;\n            };\n            XhrStreamingTransport.transportName = \"xhr-streaming\";\n            XhrStreamingTransport.roundTrips = 2;\n            XhrStreamingTransport.needBody = !!global2.document;\n            module3.exports = XhrStreamingTransport;\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"../utils/browser\": 44, \"./lib/ajax-based\": 24, \"./receiver/xhr\": 32, \"./sender/xhr-cors\": 35, \"./sender/xhr-local\": 37, \"inherits\": 57 }], 43: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            if (global2.crypto && global2.crypto.getRandomValues) {\n              module3.exports.randomBytes = function(length) {\n                var bytes = new Uint8Array(length);\n                global2.crypto.getRandomValues(bytes);\n                return bytes;\n              };\n            } else {\n              module3.exports.randomBytes = function(length) {\n                var bytes = new Array(length);\n                for (var i = 0; i < length; i++) {\n                  bytes[i] = Math.floor(Math.random() * 256);\n                }\n                return bytes;\n              };\n            }\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, {}], 44: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            module3.exports = {\n              isOpera: function() {\n                return global2.navigator && /opera/i.test(global2.navigator.userAgent);\n              },\n              isKonqueror: function() {\n                return global2.navigator && /konqueror/i.test(global2.navigator.userAgent);\n              },\n              hasDomain: function() {\n                if (!global2.document) {\n                  return true;\n                }\n                try {\n                  return !!global2.document.domain;\n                } catch (e) {\n                  return false;\n                }\n              }\n            };\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, {}], 45: [function(require2, module3, exports3) {\n        \"use strict\";\n        var extraEscapable = /[\\x00-\\x1f\\ud800-\\udfff\\ufffe\\uffff\\u0300-\\u0333\\u033d-\\u0346\\u034a-\\u034c\\u0350-\\u0352\\u0357-\\u0358\\u035c-\\u0362\\u0374\\u037e\\u0387\\u0591-\\u05af\\u05c4\\u0610-\\u0617\\u0653-\\u0654\\u0657-\\u065b\\u065d-\\u065e\\u06df-\\u06e2\\u06eb-\\u06ec\\u0730\\u0732-\\u0733\\u0735-\\u0736\\u073a\\u073d\\u073f-\\u0741\\u0743\\u0745\\u0747\\u07eb-\\u07f1\\u0951\\u0958-\\u095f\\u09dc-\\u09dd\\u09df\\u0a33\\u0a36\\u0a59-\\u0a5b\\u0a5e\\u0b5c-\\u0b5d\\u0e38-\\u0e39\\u0f43\\u0f4d\\u0f52\\u0f57\\u0f5c\\u0f69\\u0f72-\\u0f76\\u0f78\\u0f80-\\u0f83\\u0f93\\u0f9d\\u0fa2\\u0fa7\\u0fac\\u0fb9\\u1939-\\u193a\\u1a17\\u1b6b\\u1cda-\\u1cdb\\u1dc0-\\u1dcf\\u1dfc\\u1dfe\\u1f71\\u1f73\\u1f75\\u1f77\\u1f79\\u1f7b\\u1f7d\\u1fbb\\u1fbe\\u1fc9\\u1fcb\\u1fd3\\u1fdb\\u1fe3\\u1feb\\u1fee-\\u1fef\\u1ff9\\u1ffb\\u1ffd\\u2000-\\u2001\\u20d0-\\u20d1\\u20d4-\\u20d7\\u20e7-\\u20e9\\u2126\\u212a-\\u212b\\u2329-\\u232a\\u2adc\\u302b-\\u302c\\uaab2-\\uaab3\\uf900-\\ufa0d\\ufa10\\ufa12\\ufa15-\\ufa1e\\ufa20\\ufa22\\ufa25-\\ufa26\\ufa2a-\\ufa2d\\ufa30-\\ufa6d\\ufa70-\\ufad9\\ufb1d\\ufb1f\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4e\\ufff0-\\uffff]/g, extraLookup;\n        var unrollLookup = function(escapable) {\n          var i;\n          var unrolled = {};\n          var c = [];\n          for (i = 0; i < 65536; i++) {\n            c.push(String.fromCharCode(i));\n          }\n          escapable.lastIndex = 0;\n          c.join(\"\").replace(escapable, function(a) {\n            unrolled[a] = \"\\\\u\" + (\"0000\" + a.charCodeAt(0).toString(16)).slice(-4);\n            return \"\";\n          });\n          escapable.lastIndex = 0;\n          return unrolled;\n        };\n        module3.exports = {\n          quote: function(string) {\n            var quoted = JSON.stringify(string);\n            extraEscapable.lastIndex = 0;\n            if (!extraEscapable.test(quoted)) {\n              return quoted;\n            }\n            if (!extraLookup) {\n              extraLookup = unrollLookup(extraEscapable);\n            }\n            return quoted.replace(extraEscapable, function(a) {\n              return extraLookup[a];\n            });\n          }\n        };\n      }, {}], 46: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var random = require2(\"./random\");\n            var onUnload = {}, afterUnload = false, isChromePackagedApp = global2.chrome && global2.chrome.app && global2.chrome.app.runtime;\n            module3.exports = {\n              attachEvent: function(event, listener) {\n                if (typeof global2.addEventListener !== \"undefined\") {\n                  global2.addEventListener(event, listener, false);\n                } else if (global2.document && global2.attachEvent) {\n                  global2.document.attachEvent(\"on\" + event, listener);\n                  global2.attachEvent(\"on\" + event, listener);\n                }\n              },\n              detachEvent: function(event, listener) {\n                if (typeof global2.addEventListener !== \"undefined\") {\n                  global2.removeEventListener(event, listener, false);\n                } else if (global2.document && global2.detachEvent) {\n                  global2.document.detachEvent(\"on\" + event, listener);\n                  global2.detachEvent(\"on\" + event, listener);\n                }\n              },\n              unloadAdd: function(listener) {\n                if (isChromePackagedApp) {\n                  return null;\n                }\n                var ref = random.string(8);\n                onUnload[ref] = listener;\n                if (afterUnload) {\n                  setTimeout(this.triggerUnloadCallbacks, 0);\n                }\n                return ref;\n              },\n              unloadDel: function(ref) {\n                if (ref in onUnload) {\n                  delete onUnload[ref];\n                }\n              },\n              triggerUnloadCallbacks: function() {\n                for (var ref in onUnload) {\n                  onUnload[ref]();\n                  delete onUnload[ref];\n                }\n              }\n            };\n            var unloadTriggered = function() {\n              if (afterUnload) {\n                return;\n              }\n              afterUnload = true;\n              module3.exports.triggerUnloadCallbacks();\n            };\n            if (!isChromePackagedApp) {\n              module3.exports.attachEvent(\"unload\", unloadTriggered);\n            }\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"./random\": 50 }], 47: [function(require2, module3, exports3) {\n        (function(process, global2) {\n          (function() {\n            \"use strict\";\n            var eventUtils = require2(\"./event\"), browser = require2(\"./browser\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:utils:iframe\");\n            }\n            module3.exports = {\n              WPrefix: \"_jp\",\n              currentWindowId: null,\n              polluteGlobalNamespace: function() {\n                if (!(module3.exports.WPrefix in global2)) {\n                  global2[module3.exports.WPrefix] = {};\n                }\n              },\n              postMessage: function(type, data) {\n                if (global2.parent !== global2) {\n                  global2.parent.postMessage(JSON.stringify({\n                    windowId: module3.exports.currentWindowId,\n                    type,\n                    data: data || \"\"\n                  }), \"*\");\n                } else {\n                  debug(\"Cannot postMessage, no parent window.\", type, data);\n                }\n              },\n              createIframe: function(iframeUrl, errorCallback) {\n                var iframe = global2.document.createElement(\"iframe\");\n                var tref, unloadRef;\n                var unattach = function() {\n                  debug(\"unattach\");\n                  clearTimeout(tref);\n                  try {\n                    iframe.onload = null;\n                  } catch (x) {\n                  }\n                  iframe.onerror = null;\n                };\n                var cleanup = function() {\n                  debug(\"cleanup\");\n                  if (iframe) {\n                    unattach();\n                    setTimeout(function() {\n                      if (iframe) {\n                        iframe.parentNode.removeChild(iframe);\n                      }\n                      iframe = null;\n                    }, 0);\n                    eventUtils.unloadDel(unloadRef);\n                  }\n                };\n                var onerror = function(err) {\n                  debug(\"onerror\", err);\n                  if (iframe) {\n                    cleanup();\n                    errorCallback(err);\n                  }\n                };\n                var post = function(msg, origin) {\n                  debug(\"post\", msg, origin);\n                  setTimeout(function() {\n                    try {\n                      if (iframe && iframe.contentWindow) {\n                        iframe.contentWindow.postMessage(msg, origin);\n                      }\n                    } catch (x) {\n                    }\n                  }, 0);\n                };\n                iframe.src = iframeUrl;\n                iframe.style.display = \"none\";\n                iframe.style.position = \"absolute\";\n                iframe.onerror = function() {\n                  onerror(\"onerror\");\n                };\n                iframe.onload = function() {\n                  debug(\"onload\");\n                  clearTimeout(tref);\n                  tref = setTimeout(function() {\n                    onerror(\"onload timeout\");\n                  }, 2e3);\n                };\n                global2.document.body.appendChild(iframe);\n                tref = setTimeout(function() {\n                  onerror(\"timeout\");\n                }, 15e3);\n                unloadRef = eventUtils.unloadAdd(cleanup);\n                return {\n                  post,\n                  cleanup,\n                  loaded: unattach\n                };\n              },\n              createHtmlfile: function(iframeUrl, errorCallback) {\n                var axo = [\"Active\"].concat(\"Object\").join(\"X\");\n                var doc = new global2[axo](\"htmlfile\");\n                var tref, unloadRef;\n                var iframe;\n                var unattach = function() {\n                  clearTimeout(tref);\n                  iframe.onerror = null;\n                };\n                var cleanup = function() {\n                  if (doc) {\n                    unattach();\n                    eventUtils.unloadDel(unloadRef);\n                    iframe.parentNode.removeChild(iframe);\n                    iframe = doc = null;\n                    CollectGarbage();\n                  }\n                };\n                var onerror = function(r) {\n                  debug(\"onerror\", r);\n                  if (doc) {\n                    cleanup();\n                    errorCallback(r);\n                  }\n                };\n                var post = function(msg, origin) {\n                  try {\n                    setTimeout(function() {\n                      if (iframe && iframe.contentWindow) {\n                        iframe.contentWindow.postMessage(msg, origin);\n                      }\n                    }, 0);\n                  } catch (x) {\n                  }\n                };\n                doc.open();\n                doc.write('<html><script>document.domain=\"' + global2.document.domain + '\";<\\/script></html>');\n                doc.close();\n                doc.parentWindow[module3.exports.WPrefix] = global2[module3.exports.WPrefix];\n                var c = doc.createElement(\"div\");\n                doc.body.appendChild(c);\n                iframe = doc.createElement(\"iframe\");\n                c.appendChild(iframe);\n                iframe.src = iframeUrl;\n                iframe.onerror = function() {\n                  onerror(\"onerror\");\n                };\n                tref = setTimeout(function() {\n                  onerror(\"timeout\");\n                }, 15e3);\n                unloadRef = eventUtils.unloadAdd(cleanup);\n                return {\n                  post,\n                  cleanup,\n                  loaded: unattach\n                };\n              }\n            };\n            module3.exports.iframeEnabled = false;\n            if (global2.document) {\n              module3.exports.iframeEnabled = (typeof global2.postMessage === \"function\" || typeof global2.postMessage === \"object\") && !browser.isKonqueror();\n            }\n          }).call(this);\n        }).call(this, { env: {} }, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"./browser\": 44, \"./event\": 46, \"debug\": 55 }], 48: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var logObject = {};\n            [\"log\", \"debug\", \"warn\"].forEach(function(level) {\n              var levelExists;\n              try {\n                levelExists = global2.console && global2.console[level] && global2.console[level].apply;\n              } catch (e) {\n              }\n              logObject[level] = levelExists ? function() {\n                return global2.console[level].apply(global2.console, arguments);\n              } : level === \"log\" ? function() {\n              } : logObject.log;\n            });\n            module3.exports = logObject;\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, {}], 49: [function(require2, module3, exports3) {\n        \"use strict\";\n        module3.exports = {\n          isObject: function(obj) {\n            var type = typeof obj;\n            return type === \"function\" || type === \"object\" && !!obj;\n          },\n          extend: function(obj) {\n            if (!this.isObject(obj)) {\n              return obj;\n            }\n            var source, prop;\n            for (var i = 1, length = arguments.length; i < length; i++) {\n              source = arguments[i];\n              for (prop in source) {\n                if (Object.prototype.hasOwnProperty.call(source, prop)) {\n                  obj[prop] = source[prop];\n                }\n              }\n            }\n            return obj;\n          }\n        };\n      }, {}], 50: [function(require2, module3, exports3) {\n        \"use strict\";\n        var crypto = require2(\"crypto\");\n        var _randomStringChars = \"abcdefghijklmnopqrstuvwxyz012345\";\n        module3.exports = {\n          string: function(length) {\n            var max = _randomStringChars.length;\n            var bytes = crypto.randomBytes(length);\n            var ret = [];\n            for (var i = 0; i < length; i++) {\n              ret.push(_randomStringChars.substr(bytes[i] % max, 1));\n            }\n            return ret.join(\"\");\n          },\n          number: function(max) {\n            return Math.floor(Math.random() * max);\n          },\n          numberString: function(max) {\n            var t = (\"\" + (max - 1)).length;\n            var p = new Array(t + 1).join(\"0\");\n            return (p + this.number(max)).slice(-t);\n          }\n        };\n      }, { \"crypto\": 43 }], 51: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:utils:transport\");\n            }\n            module3.exports = function(availableTransports) {\n              return {\n                filterToEnabled: function(transportsWhitelist, info) {\n                  var transports = {\n                    main: [],\n                    facade: []\n                  };\n                  if (!transportsWhitelist) {\n                    transportsWhitelist = [];\n                  } else if (typeof transportsWhitelist === \"string\") {\n                    transportsWhitelist = [transportsWhitelist];\n                  }\n                  availableTransports.forEach(function(trans) {\n                    if (!trans) {\n                      return;\n                    }\n                    if (trans.transportName === \"websocket\" && info.websocket === false) {\n                      debug(\"disabled from server\", \"websocket\");\n                      return;\n                    }\n                    if (transportsWhitelist.length && transportsWhitelist.indexOf(trans.transportName) === -1) {\n                      debug(\"not in whitelist\", trans.transportName);\n                      return;\n                    }\n                    if (trans.enabled(info)) {\n                      debug(\"enabled\", trans.transportName);\n                      transports.main.push(trans);\n                      if (trans.facadeTransport) {\n                        transports.facade.push(trans.facadeTransport);\n                      }\n                    } else {\n                      debug(\"disabled\", trans.transportName);\n                    }\n                  });\n                  return transports;\n                }\n              };\n            };\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"debug\": 55 }], 52: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            \"use strict\";\n            var URL = require2(\"url-parse\");\n            var debug = function() {\n            };\n            if (process.env.NODE_ENV !== \"production\") {\n              debug = require2(\"debug\")(\"sockjs-client:utils:url\");\n            }\n            module3.exports = {\n              getOrigin: function(url) {\n                if (!url) {\n                  return null;\n                }\n                var p = new URL(url);\n                if (p.protocol === \"file:\") {\n                  return null;\n                }\n                var port = p.port;\n                if (!port) {\n                  port = p.protocol === \"https:\" ? \"443\" : \"80\";\n                }\n                return p.protocol + \"//\" + p.hostname + \":\" + port;\n              },\n              isOriginEqual: function(a, b) {\n                var res = this.getOrigin(a) === this.getOrigin(b);\n                debug(\"same\", a, b, res);\n                return res;\n              },\n              isSchemeEqual: function(a, b) {\n                return a.split(\":\")[0] === b.split(\":\")[0];\n              },\n              addPath: function(url, path) {\n                var qs = url.split(\"?\");\n                return qs[0] + path + (qs[1] ? \"?\" + qs[1] : \"\");\n              },\n              addQuery: function(url, q) {\n                return url + (url.indexOf(\"?\") === -1 ? \"?\" + q : \"&\" + q);\n              },\n              isLoopbackAddr: function(addr) {\n                return /^127\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/i.test(addr) || /^\\[::1\\]$/.test(addr);\n              }\n            };\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"debug\": 55, \"url-parse\": 60 }], 53: [function(require2, module3, exports3) {\n        module3.exports = \"1.6.1\";\n      }, {}], 54: [function(require2, module3, exports3) {\n        var s = 1e3;\n        var m = s * 60;\n        var h = m * 60;\n        var d = h * 24;\n        var w = d * 7;\n        var y = d * 365.25;\n        module3.exports = function(val, options) {\n          options = options || {};\n          var type = typeof val;\n          if (type === \"string\" && val.length > 0) {\n            return parse(val);\n          } else if (type === \"number\" && isFinite(val)) {\n            return options.long ? fmtLong(val) : fmtShort(val);\n          }\n          throw new Error(\n            \"val is not a non-empty string or a valid number. val=\" + JSON.stringify(val)\n          );\n        };\n        function parse(str) {\n          str = String(str);\n          if (str.length > 100) {\n            return;\n          }\n          var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n            str\n          );\n          if (!match) {\n            return;\n          }\n          var n = parseFloat(match[1]);\n          var type = (match[2] || \"ms\").toLowerCase();\n          switch (type) {\n            case \"years\":\n            case \"year\":\n            case \"yrs\":\n            case \"yr\":\n            case \"y\":\n              return n * y;\n            case \"weeks\":\n            case \"week\":\n            case \"w\":\n              return n * w;\n            case \"days\":\n            case \"day\":\n            case \"d\":\n              return n * d;\n            case \"hours\":\n            case \"hour\":\n            case \"hrs\":\n            case \"hr\":\n            case \"h\":\n              return n * h;\n            case \"minutes\":\n            case \"minute\":\n            case \"mins\":\n            case \"min\":\n            case \"m\":\n              return n * m;\n            case \"seconds\":\n            case \"second\":\n            case \"secs\":\n            case \"sec\":\n            case \"s\":\n              return n * s;\n            case \"milliseconds\":\n            case \"millisecond\":\n            case \"msecs\":\n            case \"msec\":\n            case \"ms\":\n              return n;\n            default:\n              return void 0;\n          }\n        }\n        function fmtShort(ms) {\n          var msAbs = Math.abs(ms);\n          if (msAbs >= d) {\n            return Math.round(ms / d) + \"d\";\n          }\n          if (msAbs >= h) {\n            return Math.round(ms / h) + \"h\";\n          }\n          if (msAbs >= m) {\n            return Math.round(ms / m) + \"m\";\n          }\n          if (msAbs >= s) {\n            return Math.round(ms / s) + \"s\";\n          }\n          return ms + \"ms\";\n        }\n        function fmtLong(ms) {\n          var msAbs = Math.abs(ms);\n          if (msAbs >= d) {\n            return plural(ms, msAbs, d, \"day\");\n          }\n          if (msAbs >= h) {\n            return plural(ms, msAbs, h, \"hour\");\n          }\n          if (msAbs >= m) {\n            return plural(ms, msAbs, m, \"minute\");\n          }\n          if (msAbs >= s) {\n            return plural(ms, msAbs, s, \"second\");\n          }\n          return ms + \" ms\";\n        }\n        function plural(ms, msAbs, n, name) {\n          var isPlural = msAbs >= n * 1.5;\n          return Math.round(ms / n) + \" \" + name + (isPlural ? \"s\" : \"\");\n        }\n      }, {}], 55: [function(require2, module3, exports3) {\n        (function(process) {\n          (function() {\n            exports3.formatArgs = formatArgs;\n            exports3.save = save;\n            exports3.load = load;\n            exports3.useColors = useColors;\n            exports3.storage = localstorage();\n            exports3.destroy = (() => {\n              let warned = false;\n              return () => {\n                if (!warned) {\n                  warned = true;\n                  console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\");\n                }\n              };\n            })();\n            exports3.colors = [\n              \"#0000CC\",\n              \"#0000FF\",\n              \"#0033CC\",\n              \"#0033FF\",\n              \"#0066CC\",\n              \"#0066FF\",\n              \"#0099CC\",\n              \"#0099FF\",\n              \"#00CC00\",\n              \"#00CC33\",\n              \"#00CC66\",\n              \"#00CC99\",\n              \"#00CCCC\",\n              \"#00CCFF\",\n              \"#3300CC\",\n              \"#3300FF\",\n              \"#3333CC\",\n              \"#3333FF\",\n              \"#3366CC\",\n              \"#3366FF\",\n              \"#3399CC\",\n              \"#3399FF\",\n              \"#33CC00\",\n              \"#33CC33\",\n              \"#33CC66\",\n              \"#33CC99\",\n              \"#33CCCC\",\n              \"#33CCFF\",\n              \"#6600CC\",\n              \"#6600FF\",\n              \"#6633CC\",\n              \"#6633FF\",\n              \"#66CC00\",\n              \"#66CC33\",\n              \"#9900CC\",\n              \"#9900FF\",\n              \"#9933CC\",\n              \"#9933FF\",\n              \"#99CC00\",\n              \"#99CC33\",\n              \"#CC0000\",\n              \"#CC0033\",\n              \"#CC0066\",\n              \"#CC0099\",\n              \"#CC00CC\",\n              \"#CC00FF\",\n              \"#CC3300\",\n              \"#CC3333\",\n              \"#CC3366\",\n              \"#CC3399\",\n              \"#CC33CC\",\n              \"#CC33FF\",\n              \"#CC6600\",\n              \"#CC6633\",\n              \"#CC9900\",\n              \"#CC9933\",\n              \"#CCCC00\",\n              \"#CCCC33\",\n              \"#FF0000\",\n              \"#FF0033\",\n              \"#FF0066\",\n              \"#FF0099\",\n              \"#FF00CC\",\n              \"#FF00FF\",\n              \"#FF3300\",\n              \"#FF3333\",\n              \"#FF3366\",\n              \"#FF3399\",\n              \"#FF33CC\",\n              \"#FF33FF\",\n              \"#FF6600\",\n              \"#FF6633\",\n              \"#FF9900\",\n              \"#FF9933\",\n              \"#FFCC00\",\n              \"#FFCC33\"\n            ];\n            function useColors() {\n              if (typeof window !== \"undefined\" && window.process && (window.process.type === \"renderer\" || window.process.__nwjs)) {\n                return true;\n              }\n              if (typeof navigator !== \"undefined\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n                return false;\n              }\n              return typeof document !== \"undefined\" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773\n              typeof window !== \"undefined\" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?\n              // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n              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\n              typeof navigator !== \"undefined\" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/);\n            }\n            function formatArgs(args) {\n              args[0] = (this.useColors ? \"%c\" : \"\") + this.namespace + (this.useColors ? \" %c\" : \" \") + args[0] + (this.useColors ? \"%c \" : \" \") + \"+\" + module3.exports.humanize(this.diff);\n              if (!this.useColors) {\n                return;\n              }\n              const c = \"color: \" + this.color;\n              args.splice(1, 0, c, \"color: inherit\");\n              let index = 0;\n              let lastC = 0;\n              args[0].replace(/%[a-zA-Z%]/g, (match) => {\n                if (match === \"%%\") {\n                  return;\n                }\n                index++;\n                if (match === \"%c\") {\n                  lastC = index;\n                }\n              });\n              args.splice(lastC, 0, c);\n            }\n            exports3.log = console.debug || console.log || (() => {\n            });\n            function save(namespaces) {\n              try {\n                if (namespaces) {\n                  exports3.storage.setItem(\"debug\", namespaces);\n                } else {\n                  exports3.storage.removeItem(\"debug\");\n                }\n              } catch (error) {\n              }\n            }\n            function load() {\n              let r;\n              try {\n                r = exports3.storage.getItem(\"debug\");\n              } catch (error) {\n              }\n              if (!r && typeof process !== \"undefined\" && \"env\" in process) {\n                r = process.env.DEBUG;\n              }\n              return r;\n            }\n            function localstorage() {\n              try {\n                return localStorage;\n              } catch (error) {\n              }\n            }\n            module3.exports = require2(\"./common\")(exports3);\n            const { formatters } = module3.exports;\n            formatters.j = function(v) {\n              try {\n                return JSON.stringify(v);\n              } catch (error) {\n                return \"[UnexpectedJSONParseError]: \" + error.message;\n              }\n            };\n          }).call(this);\n        }).call(this, { env: {} });\n      }, { \"./common\": 56 }], 56: [function(require2, module3, exports3) {\n        function setup(env) {\n          createDebug.debug = createDebug;\n          createDebug.default = createDebug;\n          createDebug.coerce = coerce;\n          createDebug.disable = disable;\n          createDebug.enable = enable;\n          createDebug.enabled = enabled;\n          createDebug.humanize = require2(\"ms\");\n          createDebug.destroy = destroy;\n          Object.keys(env).forEach((key) => {\n            createDebug[key] = env[key];\n          });\n          createDebug.names = [];\n          createDebug.skips = [];\n          createDebug.formatters = {};\n          function selectColor(namespace) {\n            let hash = 0;\n            for (let i = 0; i < namespace.length; i++) {\n              hash = (hash << 5) - hash + namespace.charCodeAt(i);\n              hash |= 0;\n            }\n            return createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n          }\n          createDebug.selectColor = selectColor;\n          function createDebug(namespace) {\n            let prevTime;\n            let enableOverride = null;\n            let namespacesCache;\n            let enabledCache;\n            function debug(...args) {\n              if (!debug.enabled) {\n                return;\n              }\n              const self2 = debug;\n              const curr = Number(/* @__PURE__ */ new Date());\n              const ms = curr - (prevTime || curr);\n              self2.diff = ms;\n              self2.prev = prevTime;\n              self2.curr = curr;\n              prevTime = curr;\n              args[0] = createDebug.coerce(args[0]);\n              if (typeof args[0] !== \"string\") {\n                args.unshift(\"%O\");\n              }\n              let index = 0;\n              args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n                if (match === \"%%\") {\n                  return \"%\";\n                }\n                index++;\n                const formatter = createDebug.formatters[format];\n                if (typeof formatter === \"function\") {\n                  const val = args[index];\n                  match = formatter.call(self2, val);\n                  args.splice(index, 1);\n                  index--;\n                }\n                return match;\n              });\n              createDebug.formatArgs.call(self2, args);\n              const logFn = self2.log || createDebug.log;\n              logFn.apply(self2, args);\n            }\n            debug.namespace = namespace;\n            debug.useColors = createDebug.useColors();\n            debug.color = createDebug.selectColor(namespace);\n            debug.extend = extend;\n            debug.destroy = createDebug.destroy;\n            Object.defineProperty(debug, \"enabled\", {\n              enumerable: true,\n              configurable: false,\n              get: () => {\n                if (enableOverride !== null) {\n                  return enableOverride;\n                }\n                if (namespacesCache !== createDebug.namespaces) {\n                  namespacesCache = createDebug.namespaces;\n                  enabledCache = createDebug.enabled(namespace);\n                }\n                return enabledCache;\n              },\n              set: (v) => {\n                enableOverride = v;\n              }\n            });\n            if (typeof createDebug.init === \"function\") {\n              createDebug.init(debug);\n            }\n            return debug;\n          }\n          function extend(namespace, delimiter) {\n            const newDebug = createDebug(this.namespace + (typeof delimiter === \"undefined\" ? \":\" : delimiter) + namespace);\n            newDebug.log = this.log;\n            return newDebug;\n          }\n          function enable(namespaces) {\n            createDebug.save(namespaces);\n            createDebug.namespaces = namespaces;\n            createDebug.names = [];\n            createDebug.skips = [];\n            let i;\n            const split = (typeof namespaces === \"string\" ? namespaces : \"\").split(/[\\s,]+/);\n            const len = split.length;\n            for (i = 0; i < len; i++) {\n              if (!split[i]) {\n                continue;\n              }\n              namespaces = split[i].replace(/\\*/g, \".*?\");\n              if (namespaces[0] === \"-\") {\n                createDebug.skips.push(new RegExp(\"^\" + namespaces.substr(1) + \"$\"));\n              } else {\n                createDebug.names.push(new RegExp(\"^\" + namespaces + \"$\"));\n              }\n            }\n          }\n          function disable() {\n            const namespaces = [\n              ...createDebug.names.map(toNamespace),\n              ...createDebug.skips.map(toNamespace).map((namespace) => \"-\" + namespace)\n            ].join(\",\");\n            createDebug.enable(\"\");\n            return namespaces;\n          }\n          function enabled(name) {\n            if (name[name.length - 1] === \"*\") {\n              return true;\n            }\n            let i;\n            let len;\n            for (i = 0, len = createDebug.skips.length; i < len; i++) {\n              if (createDebug.skips[i].test(name)) {\n                return false;\n              }\n            }\n            for (i = 0, len = createDebug.names.length; i < len; i++) {\n              if (createDebug.names[i].test(name)) {\n                return true;\n              }\n            }\n            return false;\n          }\n          function toNamespace(regexp) {\n            return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\\.\\*\\?$/, \"*\");\n          }\n          function coerce(val) {\n            if (val instanceof Error) {\n              return val.stack || val.message;\n            }\n            return val;\n          }\n          function destroy() {\n            console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\");\n          }\n          createDebug.enable(createDebug.load());\n          return createDebug;\n        }\n        module3.exports = setup;\n      }, { \"ms\": 54 }], 57: [function(require2, module3, exports3) {\n        if (typeof Object.create === \"function\") {\n          module3.exports = function inherits(ctor, superCtor) {\n            if (superCtor) {\n              ctor.super_ = superCtor;\n              ctor.prototype = Object.create(superCtor.prototype, {\n                constructor: {\n                  value: ctor,\n                  enumerable: false,\n                  writable: true,\n                  configurable: true\n                }\n              });\n            }\n          };\n        } else {\n          module3.exports = function inherits(ctor, superCtor) {\n            if (superCtor) {\n              ctor.super_ = superCtor;\n              var TempCtor = function() {\n              };\n              TempCtor.prototype = superCtor.prototype;\n              ctor.prototype = new TempCtor();\n              ctor.prototype.constructor = ctor;\n            }\n          };\n        }\n      }, {}], 58: [function(require2, module3, exports3) {\n        \"use strict\";\n        var has = Object.prototype.hasOwnProperty, undef;\n        function decode(input) {\n          try {\n            return decodeURIComponent(input.replace(/\\+/g, \" \"));\n          } catch (e) {\n            return null;\n          }\n        }\n        function encode(input) {\n          try {\n            return encodeURIComponent(input);\n          } catch (e) {\n            return null;\n          }\n        }\n        function querystring(query) {\n          var parser = /([^=?&]+)=?([^&]*)/g, result = {}, part;\n          while (part = parser.exec(query)) {\n            var key = decode(part[1]), value = decode(part[2]);\n            if (key === null || value === null || key in result)\n              continue;\n            result[key] = value;\n          }\n          return result;\n        }\n        function querystringify(obj, prefix) {\n          prefix = prefix || \"\";\n          var pairs = [], value, key;\n          if (\"string\" !== typeof prefix)\n            prefix = \"?\";\n          for (key in obj) {\n            if (has.call(obj, key)) {\n              value = obj[key];\n              if (!value && (value === null || value === undef || isNaN(value))) {\n                value = \"\";\n              }\n              key = encodeURIComponent(key);\n              value = encodeURIComponent(value);\n              if (key === null || value === null)\n                continue;\n              pairs.push(key + \"=\" + value);\n            }\n          }\n          return pairs.length ? prefix + pairs.join(\"&\") : \"\";\n        }\n        exports3.stringify = querystringify;\n        exports3.parse = querystring;\n      }, {}], 59: [function(require2, module3, exports3) {\n        \"use strict\";\n        module3.exports = function required(port, protocol) {\n          protocol = protocol.split(\":\")[0];\n          port = +port;\n          if (!port)\n            return false;\n          switch (protocol) {\n            case \"http\":\n            case \"ws\":\n              return port !== 80;\n            case \"https\":\n            case \"wss\":\n              return port !== 443;\n            case \"ftp\":\n              return port !== 21;\n            case \"gopher\":\n              return port !== 70;\n            case \"file\":\n              return false;\n          }\n          return port !== 0;\n        };\n      }, {}], 60: [function(require2, module3, exports3) {\n        (function(global2) {\n          (function() {\n            \"use strict\";\n            var required = require2(\"requires-port\"), qs = require2(\"querystringify\"), controlOrWhitespace = /^[\\x00-\\x20\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/, CRHTLF = /[\\n\\r\\t]/g, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//, port = /:\\d+$/, protocolre = /^([a-z][a-z0-9.+-]*:)?(\\/\\/)?([\\\\/]+)?([\\S\\s]*)/i, windowsDriveLetter = /^[a-zA-Z]:/;\n            function trimLeft(str) {\n              return (str ? str : \"\").toString().replace(controlOrWhitespace, \"\");\n            }\n            var rules = [\n              [\"#\", \"hash\"],\n              // Extract from the back.\n              [\"?\", \"query\"],\n              // Extract from the back.\n              function sanitize(address, url) {\n                return isSpecial(url.protocol) ? address.replace(/\\\\/g, \"/\") : address;\n              },\n              [\"/\", \"pathname\"],\n              // Extract from the back.\n              [\"@\", \"auth\", 1],\n              // Extract from the front.\n              [NaN, \"host\", void 0, 1, 1],\n              // Set left over value.\n              [/:(\\d*)$/, \"port\", void 0, 1],\n              // RegExp the back.\n              [NaN, \"hostname\", void 0, 1, 1]\n              // Set left over.\n            ];\n            var ignore = { hash: 1, query: 1 };\n            function lolcation(loc) {\n              var globalVar;\n              if (typeof window !== \"undefined\")\n                globalVar = window;\n              else if (typeof global2 !== \"undefined\")\n                globalVar = global2;\n              else if (typeof self !== \"undefined\")\n                globalVar = self;\n              else\n                globalVar = {};\n              var location = globalVar.location || {};\n              loc = loc || location;\n              var finaldestination = {}, type = typeof loc, key;\n              if (\"blob:\" === loc.protocol) {\n                finaldestination = new Url(unescape(loc.pathname), {});\n              } else if (\"string\" === type) {\n                finaldestination = new Url(loc, {});\n                for (key in ignore)\n                  delete finaldestination[key];\n              } else if (\"object\" === type) {\n                for (key in loc) {\n                  if (key in ignore)\n                    continue;\n                  finaldestination[key] = loc[key];\n                }\n                if (finaldestination.slashes === void 0) {\n                  finaldestination.slashes = slashes.test(loc.href);\n                }\n              }\n              return finaldestination;\n            }\n            function isSpecial(scheme) {\n              return scheme === \"file:\" || scheme === \"ftp:\" || scheme === \"http:\" || scheme === \"https:\" || scheme === \"ws:\" || scheme === \"wss:\";\n            }\n            function extractProtocol(address, location) {\n              address = trimLeft(address);\n              address = address.replace(CRHTLF, \"\");\n              location = location || {};\n              var match = protocolre.exec(address);\n              var protocol = match[1] ? match[1].toLowerCase() : \"\";\n              var forwardSlashes = !!match[2];\n              var otherSlashes = !!match[3];\n              var slashesCount = 0;\n              var rest;\n              if (forwardSlashes) {\n                if (otherSlashes) {\n                  rest = match[2] + match[3] + match[4];\n                  slashesCount = match[2].length + match[3].length;\n                } else {\n                  rest = match[2] + match[4];\n                  slashesCount = match[2].length;\n                }\n              } else {\n                if (otherSlashes) {\n                  rest = match[3] + match[4];\n                  slashesCount = match[3].length;\n                } else {\n                  rest = match[4];\n                }\n              }\n              if (protocol === \"file:\") {\n                if (slashesCount >= 2) {\n                  rest = rest.slice(2);\n                }\n              } else if (isSpecial(protocol)) {\n                rest = match[4];\n              } else if (protocol) {\n                if (forwardSlashes) {\n                  rest = rest.slice(2);\n                }\n              } else if (slashesCount >= 2 && isSpecial(location.protocol)) {\n                rest = match[4];\n              }\n              return {\n                protocol,\n                slashes: forwardSlashes || isSpecial(protocol),\n                slashesCount,\n                rest\n              };\n            }\n            function resolve(relative, base) {\n              if (relative === \"\")\n                return base;\n              var path = (base || \"/\").split(\"/\").slice(0, -1).concat(relative.split(\"/\")), i = path.length, last = path[i - 1], unshift = false, up = 0;\n              while (i--) {\n                if (path[i] === \".\") {\n                  path.splice(i, 1);\n                } else if (path[i] === \"..\") {\n                  path.splice(i, 1);\n                  up++;\n                } else if (up) {\n                  if (i === 0)\n                    unshift = true;\n                  path.splice(i, 1);\n                  up--;\n                }\n              }\n              if (unshift)\n                path.unshift(\"\");\n              if (last === \".\" || last === \"..\")\n                path.push(\"\");\n              return path.join(\"/\");\n            }\n            function Url(address, location, parser) {\n              address = trimLeft(address);\n              address = address.replace(CRHTLF, \"\");\n              if (!(this instanceof Url)) {\n                return new Url(address, location, parser);\n              }\n              var relative, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0;\n              if (\"object\" !== type && \"string\" !== type) {\n                parser = location;\n                location = null;\n              }\n              if (parser && \"function\" !== typeof parser)\n                parser = qs.parse;\n              location = lolcation(location);\n              extracted = extractProtocol(address || \"\", location);\n              relative = !extracted.protocol && !extracted.slashes;\n              url.slashes = extracted.slashes || relative && location.slashes;\n              url.protocol = extracted.protocol || location.protocol || \"\";\n              address = extracted.rest;\n              if (extracted.protocol === \"file:\" && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) {\n                instructions[3] = [/(.*)/, \"pathname\"];\n              }\n              for (; i < instructions.length; i++) {\n                instruction = instructions[i];\n                if (typeof instruction === \"function\") {\n                  address = instruction(address, url);\n                  continue;\n                }\n                parse = instruction[0];\n                key = instruction[1];\n                if (parse !== parse) {\n                  url[key] = address;\n                } else if (\"string\" === typeof parse) {\n                  index = parse === \"@\" ? address.lastIndexOf(parse) : address.indexOf(parse);\n                  if (~index) {\n                    if (\"number\" === typeof instruction[2]) {\n                      url[key] = address.slice(0, index);\n                      address = address.slice(index + instruction[2]);\n                    } else {\n                      url[key] = address.slice(index);\n                      address = address.slice(0, index);\n                    }\n                  }\n                } else if (index = parse.exec(address)) {\n                  url[key] = index[1];\n                  address = address.slice(0, index.index);\n                }\n                url[key] = url[key] || (relative && instruction[3] ? location[key] || \"\" : \"\");\n                if (instruction[4])\n                  url[key] = url[key].toLowerCase();\n              }\n              if (parser)\n                url.query = parser(url.query);\n              if (relative && location.slashes && url.pathname.charAt(0) !== \"/\" && (url.pathname !== \"\" || location.pathname !== \"\")) {\n                url.pathname = resolve(url.pathname, location.pathname);\n              }\n              if (url.pathname.charAt(0) !== \"/\" && isSpecial(url.protocol)) {\n                url.pathname = \"/\" + url.pathname;\n              }\n              if (!required(url.port, url.protocol)) {\n                url.host = url.hostname;\n                url.port = \"\";\n              }\n              url.username = url.password = \"\";\n              if (url.auth) {\n                index = url.auth.indexOf(\":\");\n                if (~index) {\n                  url.username = url.auth.slice(0, index);\n                  url.username = encodeURIComponent(decodeURIComponent(url.username));\n                  url.password = url.auth.slice(index + 1);\n                  url.password = encodeURIComponent(decodeURIComponent(url.password));\n                } else {\n                  url.username = encodeURIComponent(decodeURIComponent(url.auth));\n                }\n                url.auth = url.password ? url.username + \":\" + url.password : url.username;\n              }\n              url.origin = url.protocol !== \"file:\" && isSpecial(url.protocol) && url.host ? url.protocol + \"//\" + url.host : \"null\";\n              url.href = url.toString();\n            }\n            function set(part, value, fn) {\n              var url = this;\n              switch (part) {\n                case \"query\":\n                  if (\"string\" === typeof value && value.length) {\n                    value = (fn || qs.parse)(value);\n                  }\n                  url[part] = value;\n                  break;\n                case \"port\":\n                  url[part] = value;\n                  if (!required(value, url.protocol)) {\n                    url.host = url.hostname;\n                    url[part] = \"\";\n                  } else if (value) {\n                    url.host = url.hostname + \":\" + value;\n                  }\n                  break;\n                case \"hostname\":\n                  url[part] = value;\n                  if (url.port)\n                    value += \":\" + url.port;\n                  url.host = value;\n                  break;\n                case \"host\":\n                  url[part] = value;\n                  if (port.test(value)) {\n                    value = value.split(\":\");\n                    url.port = value.pop();\n                    url.hostname = value.join(\":\");\n                  } else {\n                    url.hostname = value;\n                    url.port = \"\";\n                  }\n                  break;\n                case \"protocol\":\n                  url.protocol = value.toLowerCase();\n                  url.slashes = !fn;\n                  break;\n                case \"pathname\":\n                case \"hash\":\n                  if (value) {\n                    var char = part === \"pathname\" ? \"/\" : \"#\";\n                    url[part] = value.charAt(0) !== char ? char + value : value;\n                  } else {\n                    url[part] = value;\n                  }\n                  break;\n                case \"username\":\n                case \"password\":\n                  url[part] = encodeURIComponent(value);\n                  break;\n                case \"auth\":\n                  var index = value.indexOf(\":\");\n                  if (~index) {\n                    url.username = value.slice(0, index);\n                    url.username = encodeURIComponent(decodeURIComponent(url.username));\n                    url.password = value.slice(index + 1);\n                    url.password = encodeURIComponent(decodeURIComponent(url.password));\n                  } else {\n                    url.username = encodeURIComponent(decodeURIComponent(value));\n                  }\n              }\n              for (var i = 0; i < rules.length; i++) {\n                var ins = rules[i];\n                if (ins[4])\n                  url[ins[1]] = url[ins[1]].toLowerCase();\n              }\n              url.auth = url.password ? url.username + \":\" + url.password : url.username;\n              url.origin = url.protocol !== \"file:\" && isSpecial(url.protocol) && url.host ? url.protocol + \"//\" + url.host : \"null\";\n              url.href = url.toString();\n              return url;\n            }\n            function toString(stringify) {\n              if (!stringify || \"function\" !== typeof stringify)\n                stringify = qs.stringify;\n              var query, url = this, host = url.host, protocol = url.protocol;\n              if (protocol && protocol.charAt(protocol.length - 1) !== \":\")\n                protocol += \":\";\n              var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? \"//\" : \"\");\n              if (url.username) {\n                result += url.username;\n                if (url.password)\n                  result += \":\" + url.password;\n                result += \"@\";\n              } else if (url.password) {\n                result += \":\" + url.password;\n                result += \"@\";\n              } else if (url.protocol !== \"file:\" && isSpecial(url.protocol) && !host && url.pathname !== \"/\") {\n                result += \"@\";\n              }\n              if (host[host.length - 1] === \":\" || port.test(url.hostname) && !url.port) {\n                host += \":\";\n              }\n              result += host + url.pathname;\n              query = \"object\" === typeof url.query ? stringify(url.query) : url.query;\n              if (query)\n                result += \"?\" !== query.charAt(0) ? \"?\" + query : query;\n              if (url.hash)\n                result += url.hash;\n              return result;\n            }\n            Url.prototype = { set, toString };\n            Url.extractProtocol = extractProtocol;\n            Url.location = lolcation;\n            Url.trimLeft = trimLeft;\n            Url.qs = qs;\n            module3.exports = Url;\n          }).call(this);\n        }).call(this, typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {});\n      }, { \"querystringify\": 58, \"requires-port\": 59 }] }, {}, [1])(1);\n    });\n  }\n});\nexport default require_sockjs();\n"
  },
  {
    "path": "dist/sockjs.d.ts",
    "content": "// index.d.ts\ndeclare module \"sockjs-client\" {\n  const SockJS: {\n      new(url: string, _reserved?: any, options?: SockJS.Options): WebSocket;\n      (url: string, _reserved?: any, options?: SockJS.Options): WebSocket;\n      prototype: WebSocket;\n      CONNECTING: SockJS.CONNECTING;\n      OPEN: SockJS.OPEN;\n      CLOSING: SockJS.CLOSING;\n      CLOSED: SockJS.CLOSED;\n  };\n\n  namespace SockJS {\n      type CONNECTING = 0;\n      type OPEN = 1;\n      type CLOSING = 2;\n      type CLOSED = 3;\n\n      type State = CONNECTING | OPEN | CLOSING | CLOSED;\n\n      interface BaseEvent extends Event {\n          type: string;\n      }\n\n      type OpenEvent = BaseEvent;\n\n      interface CloseEvent extends BaseEvent {\n          code: number;\n          reason: string;\n          wasClean: boolean;\n      }\n\n      interface MessageEvent extends BaseEvent {\n          data: string;\n      }\n\n      type SessionGenerator = () => string;\n\n      interface Options {\n          server?: string | undefined;\n          sessionId?: number | SessionGenerator | undefined;\n          transports?: string | string[] | undefined;\n          timeout?: number | undefined;\n      }\n  }\n\n  export = SockJS;\n}\n"
  },
  {
    "path": "gulpfile.js",
    "content": "/* eslint camelcase: \"off\" */\n'use strict';\n\nvar gulp = require('gulp')\n  , browserify = require('browserify')\n  , uglify = require('gulp-uglify')\n  , sourcemaps = require('gulp-sourcemaps')\n  , source = require('vinyl-source-stream')\n  , buffer = require('vinyl-buffer')\n  , envify = require('envify/custom')\n  , rename = require('gulp-rename')\n  , header = require('gulp-header')\n  , replace = require('gulp-replace')\n  , pkg = require('./package.json')\n  , fs = require('fs')\n  , pump = require('pump')\n  ;\n\nvar browserifyOptions = {\n      entries: './lib/entry.js'\n    , standalone: 'SockJS'\n    , debug: true\n    , insertGlobalVars: {\n        process: function () {\n          return '{ env: {} }';\n        }\n      }\n    }\n  ;\n\nvar banner = '/* sockjs-client v<%= pkg.version %> | http://sockjs.org | MIT license */\\n';\n\ngulp.task('write-version', function (cb) {\n  fs.writeFile('./lib/version.js', \"module.exports = '\" + pkg.version + \"';\\n\", cb);\n});\n\ngulp.task('browserify', gulp.series('write-version', function (cb) {\n  pump([\n    browserify(browserifyOptions).bundle(),\n    source('sockjs.js'),\n    buffer(),\n    sourcemaps.init({ loadMaps: true }),\n    header(banner, { pkg: pkg }),\n    sourcemaps.write('./'),\n    gulp.dest('./build/')\n  ], cb);\n}));\n\ngulp.task('browserify:min', gulp.series('write-version', function (cb) {\n  pump([\n    browserify(browserifyOptions).exclude('debug').transform(envify({ NODE_ENV: 'production' })).bundle(),\n    source('sockjs.min.js'),\n    buffer(),\n    sourcemaps.init({ loadMaps: true }),\n    uglify({ compress: { pure_funcs: ['debug'] }, output: { beautify: false, keep_quoted_props: true } }),\n    header(banner, { pkg: pkg }),\n    sourcemaps.write('./'),\n    gulp.dest('./build/')\n  ], cb);\n}));\n\ngulp.task('testbundle', gulp.series('browserify:min', \n  gulp.parallel(function() {\n    return gulp.src('./build/sockjs.min.js')\n      .pipe(rename('sockjs.js'))\n      .pipe(replace('sourceMappingURL=sockjs.min.js.map', 'sourceMappingURL=sockjs.js.map'))\n      .pipe(gulp.dest('./tests/html/lib/'));\n  }, function() {\n    return gulp.src('./build/sockjs.min.js.map')\n      .pipe(rename('sockjs.js.map'))\n      .pipe(gulp.dest('./tests/html/lib/'));\n  })\n));\n\ngulp.task('testbundle-debug', gulp.series('browserify',\n  gulp.parallel(function() {\n    return gulp.src('./build/sockjs.js')\n      .pipe(rename('sockjs.js'))\n      .pipe(gulp.dest('./tests/html/lib/'));\n  }, function() {\n    return gulp.src('./build/sockjs.js.map')\n      .pipe(rename('sockjs.js.map'))\n      .pipe(gulp.dest('./tests/html/lib/'));\n  })\n));\n\ngulp.task('release', gulp.series('browserify', 'browserify:min', gulp.parallel(\n  function () { return gulp.src('./build/sockjs.js').pipe(gulp.dest('./dist/')); },\n  function () { return gulp.src('./build/sockjs.js.map').pipe(gulp.dest('./dist/')); },\n  function () { return gulp.src('./build/sockjs.min.js').pipe(gulp.dest('./dist/')); },\n  function () { return gulp.src('./build/sockjs.min.js.map').pipe(gulp.dest('./dist/')); }\n)));\n"
  },
  {
    "path": "karma.conf.js",
    "content": "// Karma configuration\n// Generated on Tue Aug 07 2018 16:41:49 GMT-0400 (EDT)\n\nvar testServer = require('./tests/support/sockjs_server');\nvar targets = require('./tests/browser_targets');\n\nvar port = 9889;\nvar SockFrameworkFactory = function(config, logger) {\n  var log = logger.create('sockjs.server');\n  log.info('Starting sockjs test server...');\n  testServer(port, config, '/sockjs-test');\n};\n\nmodule.exports = function(config) {\n  config.set({\n    // necessary to have karma proxy websockets correctly\n    urlRoot: '/karma/',\n    client: {\n      useIframe: false,\n      runInParent: true\n    },\n\n    plugins: [\n      {'framework:sock': ['factory', SockFrameworkFactory]},\n      'karma-*'\n    ],\n\n    // base path that will be used to resolve all patterns (eg. files, exclude)\n    basePath: '',\n\n    // frameworks to use\n    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter\n    frameworks: ['sock', 'mocha', 'browserify'],\n\n    // list of files / patterns to load in the browser\n    files: [\n      { pattern: 'tests/support/domain.js', watched: false, nocache: true },\n      { pattern: 'tests/browser.js', watched: false }\n    ],\n\n    // list of files / patterns to exclude\n    exclude: [\n    ],\n\n    proxies: {\n      '/sockjs-test/': 'http://localhost:' + port + '/'\n    },\n\n    // preprocess matching files before serving them to the browser\n    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor\n    preprocessors: {\n      'tests/browser.js': ['browserify']\n    },\n\n    browserify: {\n      debug: true\n    },\n\n    // test results reporter to use\n    // possible values: 'dots', 'progress'\n    // available reporters: https://npmjs.org/browse/keyword/karma-reporter\n    reporters: ['progress', 'BrowserStack'],\n\n    // web server port\n    port: 9876,\n\n    // enable / disable colors in the output (reporters and logs)\n    colors: true,\n\n    // level of logging\n    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG\n    logLevel: config.LOG_INFO,\n\n    // enable / disable watching file and executing tests whenever any file changes\n    autoWatch: false,\n\n    // start these browsers\n    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher\n    browsers: Object.keys(targets),\n\n    // Continuous Integration mode\n    // if true, Karma captures browsers, runs the tests and exits\n    singleRun: true,\n\n    // Concurrency level\n    // how many browser should be started simultaneous\n    concurrency: 5,\n\n    browserStack: {\n      username: 'brycekahle2',\n      accessKey: process.env.BROWSERSTACK_ACCESS_KEY,\n      forcelocal: true,\n      video: false,\n      project: 'sockjs-client'\n    },\n\n    customLaunchers: targets,\n  })\n}\n"
  },
  {
    "path": "lib/entry.js",
    "content": "'use strict';\n\nvar transportList = require('./transport-list');\n\nmodule.exports = require('./main')(transportList);\n\n// TODO can't get rid of this until all servers do\nif ('_sockjs_onload' in global) {\n  setTimeout(global._sockjs_onload, 1);\n}\n"
  },
  {
    "path": "lib/event/close.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , Event = require('./event')\n  ;\n\nfunction CloseEvent() {\n  Event.call(this);\n  this.initEvent('close', false, false);\n  this.wasClean = false;\n  this.code = 0;\n  this.reason = '';\n}\n\ninherits(CloseEvent, Event);\n\nmodule.exports = CloseEvent;\n"
  },
  {
    "path": "lib/event/emitter.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , EventTarget = require('./eventtarget')\n  ;\n\nfunction EventEmitter() {\n  EventTarget.call(this);\n}\n\ninherits(EventEmitter, EventTarget);\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n  if (type) {\n    delete this._listeners[type];\n  } else {\n    this._listeners = {};\n  }\n};\n\nEventEmitter.prototype.once = function(type, listener) {\n  var self = this\n    , fired = false;\n\n  function g() {\n    self.removeListener(type, g);\n\n    if (!fired) {\n      fired = true;\n      listener.apply(this, arguments);\n    }\n  }\n\n  this.on(type, g);\n};\n\nEventEmitter.prototype.emit = function() {\n  var type = arguments[0];\n  var listeners = this._listeners[type];\n  if (!listeners) {\n    return;\n  }\n  // equivalent of Array.prototype.slice.call(arguments, 1);\n  var l = arguments.length;\n  var args = new Array(l - 1);\n  for (var ai = 1; ai < l; ai++) {\n    args[ai - 1] = arguments[ai];\n  }\n  for (var i = 0; i < listeners.length; i++) {\n    listeners[i].apply(this, args);\n  }\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener = EventTarget.prototype.addEventListener;\nEventEmitter.prototype.removeListener = EventTarget.prototype.removeEventListener;\n\nmodule.exports.EventEmitter = EventEmitter;\n"
  },
  {
    "path": "lib/event/event.js",
    "content": "'use strict';\n\nfunction Event(eventType) {\n  this.type = eventType;\n}\n\nEvent.prototype.initEvent = function(eventType, canBubble, cancelable) {\n  this.type = eventType;\n  this.bubbles = canBubble;\n  this.cancelable = cancelable;\n  this.timeStamp = +new Date();\n  return this;\n};\n\nEvent.prototype.stopPropagation = function() {};\nEvent.prototype.preventDefault = function() {};\n\nEvent.CAPTURING_PHASE = 1;\nEvent.AT_TARGET = 2;\nEvent.BUBBLING_PHASE = 3;\n\nmodule.exports = Event;\n"
  },
  {
    "path": "lib/event/eventtarget.js",
    "content": "'use strict';\n\n/* Simplified implementation of DOM2 EventTarget.\n *   http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget\n */\n\nfunction EventTarget() {\n  this._listeners = {};\n}\n\nEventTarget.prototype.addEventListener = function(eventType, listener) {\n  if (!(eventType in this._listeners)) {\n    this._listeners[eventType] = [];\n  }\n  var arr = this._listeners[eventType];\n  // #4\n  if (arr.indexOf(listener) === -1) {\n    // Make a copy so as not to interfere with a current dispatchEvent.\n    arr = arr.concat([listener]);\n  }\n  this._listeners[eventType] = arr;\n};\n\nEventTarget.prototype.removeEventListener = function(eventType, listener) {\n  var arr = this._listeners[eventType];\n  if (!arr) {\n    return;\n  }\n  var idx = arr.indexOf(listener);\n  if (idx !== -1) {\n    if (arr.length > 1) {\n      // Make a copy so as not to interfere with a current dispatchEvent.\n      this._listeners[eventType] = arr.slice(0, idx).concat(arr.slice(idx + 1));\n    } else {\n      delete this._listeners[eventType];\n    }\n    return;\n  }\n};\n\nEventTarget.prototype.dispatchEvent = function() {\n  var event = arguments[0];\n  var t = event.type;\n  // equivalent of Array.prototype.slice.call(arguments, 0);\n  var args = arguments.length === 1 ? [event] : Array.apply(null, arguments);\n  // TODO: This doesn't match the real behavior; per spec, onfoo get\n  // their place in line from the /first/ time they're set from\n  // non-null. Although WebKit bumps it to the end every time it's\n  // set.\n  if (this['on' + t]) {\n    this['on' + t].apply(this, args);\n  }\n  if (t in this._listeners) {\n    // Grab a reference to the listeners list. removeEventListener may alter the list.\n    var listeners = this._listeners[t];\n    for (var i = 0; i < listeners.length; i++) {\n      listeners[i].apply(this, args);\n    }\n  }\n};\n\nmodule.exports = EventTarget;\n"
  },
  {
    "path": "lib/event/trans-message.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , Event = require('./event')\n  ;\n\nfunction TransportMessageEvent(data) {\n  Event.call(this);\n  this.initEvent('message', false, false);\n  this.data = data;\n}\n\ninherits(TransportMessageEvent, Event);\n\nmodule.exports = TransportMessageEvent;\n"
  },
  {
    "path": "lib/facade.js",
    "content": "'use strict';\n\nvar iframeUtils = require('./utils/iframe')\n  ;\n\nfunction FacadeJS(transport) {\n  this._transport = transport;\n  transport.on('message', this._transportMessage.bind(this));\n  transport.on('close', this._transportClose.bind(this));\n}\n\nFacadeJS.prototype._transportClose = function(code, reason) {\n  iframeUtils.postMessage('c', JSON.stringify([code, reason]));\n};\nFacadeJS.prototype._transportMessage = function(frame) {\n  iframeUtils.postMessage('t', frame);\n};\nFacadeJS.prototype._send = function(data) {\n  this._transport.send(data);\n};\nFacadeJS.prototype._close = function() {\n  this._transport.close();\n  this._transport.removeAllListeners();\n};\n\nmodule.exports = FacadeJS;\n"
  },
  {
    "path": "lib/iframe-bootstrap.js",
    "content": "'use strict';\n\nvar urlUtils = require('./utils/url')\n  , eventUtils = require('./utils/event')\n  , FacadeJS = require('./facade')\n  , InfoIframeReceiver = require('./info-iframe-receiver')\n  , iframeUtils = require('./utils/iframe')\n  , loc = require('./location')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:iframe-bootstrap');\n}\n\nmodule.exports = function(SockJS, availableTransports) {\n  var transportMap = {};\n  availableTransports.forEach(function(at) {\n    if (at.facadeTransport) {\n      transportMap[at.facadeTransport.transportName] = at.facadeTransport;\n    }\n  });\n\n  // hard-coded for the info iframe\n  // TODO see if we can make this more dynamic\n  transportMap[InfoIframeReceiver.transportName] = InfoIframeReceiver;\n  var parentOrigin;\n\n  /* eslint-disable camelcase */\n  SockJS.bootstrap_iframe = function() {\n    /* eslint-enable camelcase */\n    var facade;\n    iframeUtils.currentWindowId = loc.hash.slice(1);\n    var onMessage = function(e) {\n      if (e.source !== parent) {\n        return;\n      }\n      if (typeof parentOrigin === 'undefined') {\n        parentOrigin = e.origin;\n      }\n      if (e.origin !== parentOrigin) {\n        return;\n      }\n\n      var iframeMessage;\n      try {\n        iframeMessage = JSON.parse(e.data);\n      } catch (ignored) {\n        debug('bad json', e.data);\n        return;\n      }\n\n      if (iframeMessage.windowId !== iframeUtils.currentWindowId) {\n        return;\n      }\n      switch (iframeMessage.type) {\n      case 's':\n        var p;\n        try {\n          p = JSON.parse(iframeMessage.data);\n        } catch (ignored) {\n          debug('bad json', iframeMessage.data);\n          break;\n        }\n        var version = p[0];\n        var transport = p[1];\n        var transUrl = p[2];\n        var baseUrl = p[3];\n        debug(version, transport, transUrl, baseUrl);\n        // change this to semver logic\n        if (version !== SockJS.version) {\n          throw new Error('Incompatible SockJS! Main site uses:' +\n                    ' \"' + version + '\", the iframe:' +\n                    ' \"' + SockJS.version + '\".');\n        }\n\n        if (!urlUtils.isOriginEqual(transUrl, loc.href) ||\n            !urlUtils.isOriginEqual(baseUrl, loc.href)) {\n          throw new Error('Can\\'t connect to different domain from within an ' +\n                    'iframe. (' + loc.href + ', ' + transUrl + ', ' + baseUrl + ')');\n        }\n        facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl));\n        break;\n      case 'm':\n        facade._send(iframeMessage.data);\n        break;\n      case 'c':\n        if (facade) {\n          facade._close();\n        }\n        facade = null;\n        break;\n      }\n    };\n\n    eventUtils.attachEvent('message', onMessage);\n\n    // Start\n    iframeUtils.postMessage('s');\n  };\n};\n"
  },
  {
    "path": "lib/info-ajax.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  , objectUtils = require('./utils/object')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:info-ajax');\n}\n\nfunction InfoAjax(url, AjaxObject) {\n  EventEmitter.call(this);\n\n  var self = this;\n  var t0 = +new Date();\n  this.xo = new AjaxObject('GET', url);\n\n  this.xo.once('finish', function(status, text) {\n    var info, rtt;\n    if (status === 200) {\n      rtt = (+new Date()) - t0;\n      if (text) {\n        try {\n          info = JSON.parse(text);\n        } catch (e) {\n          debug('bad json', text);\n        }\n      }\n\n      if (!objectUtils.isObject(info)) {\n        info = {};\n      }\n    }\n    self.emit('finish', info, rtt, status);\n    self.removeAllListeners();\n  });\n}\n\ninherits(InfoAjax, EventEmitter);\n\nInfoAjax.prototype.close = function() {\n  this.removeAllListeners();\n  this.xo.close();\n};\n\nmodule.exports = InfoAjax;\n"
  },
  {
    "path": "lib/info-iframe-receiver.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  , XHRLocalObject = require('./transport/sender/xhr-local')\n  , InfoAjax = require('./info-ajax')\n  ;\n\nfunction InfoReceiverIframe(transUrl) {\n  var self = this;\n  EventEmitter.call(this);\n\n  this.ir = new InfoAjax(transUrl, XHRLocalObject);\n  this.ir.once('finish', function(info, rtt) {\n    self.ir = null;\n    self.emit('message', JSON.stringify([info, rtt]));\n  });\n}\n\ninherits(InfoReceiverIframe, EventEmitter);\n\nInfoReceiverIframe.transportName = 'iframe-info-receiver';\n\nInfoReceiverIframe.prototype.close = function() {\n  if (this.ir) {\n    this.ir.close();\n    this.ir = null;\n  }\n  this.removeAllListeners();\n};\n\nmodule.exports = InfoReceiverIframe;\n"
  },
  {
    "path": "lib/info-iframe.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  , utils = require('./utils/event')\n  , IframeTransport = require('./transport/iframe')\n  , InfoReceiverIframe = require('./info-iframe-receiver')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:info-iframe');\n}\n\nfunction InfoIframe(baseUrl, url) {\n  var self = this;\n  EventEmitter.call(this);\n\n  var go = function() {\n    var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);\n\n    ifr.once('message', function(msg) {\n      if (msg) {\n        var d;\n        try {\n          d = JSON.parse(msg);\n        } catch (e) {\n          debug('bad json', msg);\n          self.emit('finish');\n          self.close();\n          return;\n        }\n\n        var info = d[0], rtt = d[1];\n        self.emit('finish', info, rtt);\n      }\n      self.close();\n    });\n\n    ifr.once('close', function() {\n      self.emit('finish');\n      self.close();\n    });\n  };\n\n  // TODO this seems the same as the 'needBody' from transports\n  if (!global.document.body) {\n    utils.attachEvent('load', go);\n  } else {\n    go();\n  }\n}\n\ninherits(InfoIframe, EventEmitter);\n\nInfoIframe.enabled = function() {\n  return IframeTransport.enabled();\n};\n\nInfoIframe.prototype.close = function() {\n  if (this.ifr) {\n    this.ifr.close();\n  }\n  this.removeAllListeners();\n  this.ifr = null;\n};\n\nmodule.exports = InfoIframe;\n"
  },
  {
    "path": "lib/info-receiver.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  , urlUtils = require('./utils/url')\n  , XDR = require('./transport/sender/xdr')\n  , XHRCors = require('./transport/sender/xhr-cors')\n  , XHRLocal = require('./transport/sender/xhr-local')\n  , XHRFake = require('./transport/sender/xhr-fake')\n  , InfoIframe = require('./info-iframe')\n  , InfoAjax = require('./info-ajax')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:info-receiver');\n}\n\nfunction InfoReceiver(baseUrl, urlInfo) {\n  debug(baseUrl);\n  var self = this;\n  EventEmitter.call(this);\n\n  setTimeout(function() {\n    self.doXhr(baseUrl, urlInfo);\n  }, 0);\n}\n\ninherits(InfoReceiver, EventEmitter);\n\n// TODO this is currently ignoring the list of available transports and the whitelist\n\nInfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {\n  // determine method of CORS support (if needed)\n  if (urlInfo.sameOrigin) {\n    return new InfoAjax(url, XHRLocal);\n  }\n  if (XHRCors.enabled) {\n    return new InfoAjax(url, XHRCors);\n  }\n  if (XDR.enabled && urlInfo.sameScheme) {\n    return new InfoAjax(url, XDR);\n  }\n  if (InfoIframe.enabled()) {\n    return new InfoIframe(baseUrl, url);\n  }\n  return new InfoAjax(url, XHRFake);\n};\n\nInfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {\n  var self = this\n    , url = urlUtils.addPath(baseUrl, '/info')\n    ;\n  debug('doXhr', url);\n\n  this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);\n\n  this.timeoutRef = setTimeout(function() {\n    debug('timeout');\n    self._cleanup(false);\n    self.emit('finish');\n  }, InfoReceiver.timeout);\n\n  this.xo.once('finish', function(info, rtt, status) {\n    debug('finish', info, rtt);\n    self._cleanup(true);\n    self.emit('finish', info, rtt, status);\n  });\n};\n\nInfoReceiver.prototype._cleanup = function(wasClean) {\n  debug('_cleanup');\n  clearTimeout(this.timeoutRef);\n  this.timeoutRef = null;\n  if (!wasClean && this.xo) {\n    this.xo.close();\n  }\n  this.xo = null;\n};\n\nInfoReceiver.prototype.close = function() {\n  debug('close');\n  this.removeAllListeners();\n  this._cleanup(false);\n};\n\nInfoReceiver.timeout = 8000;\n\nmodule.exports = InfoReceiver;\n"
  },
  {
    "path": "lib/location.js",
    "content": "'use strict';\n\nmodule.exports = global.location || {\n  origin: 'http://localhost:80'\n, protocol: 'http:'\n, host: 'localhost'\n, port: 80\n, href: 'http://localhost/'\n, hash: ''\n};\n"
  },
  {
    "path": "lib/main.js",
    "content": "'use strict';\n\nrequire('./shims');\n\nvar URL = require('url-parse')\n  , inherits = require('inherits')\n  , random = require('./utils/random')\n  , escape = require('./utils/escape')\n  , urlUtils = require('./utils/url')\n  , eventUtils = require('./utils/event')\n  , transport = require('./utils/transport')\n  , objectUtils = require('./utils/object')\n  , browser = require('./utils/browser')\n  , log = require('./utils/log')\n  , Event = require('./event/event')\n  , EventTarget = require('./event/eventtarget')\n  , loc = require('./location')\n  , CloseEvent = require('./event/close')\n  , TransportMessageEvent = require('./event/trans-message')\n  , InfoReceiver = require('./info-receiver')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:main');\n}\n\nvar transports;\n\n// follow constructor steps defined at http://dev.w3.org/html5/websockets/#the-websocket-interface\nfunction SockJS(url, protocols, options) {\n  if (!(this instanceof SockJS)) {\n    return new SockJS(url, protocols, options);\n  }\n  if (arguments.length < 1) {\n    throw new TypeError(\"Failed to construct 'SockJS: 1 argument required, but only 0 present\");\n  }\n  EventTarget.call(this);\n\n  this.readyState = SockJS.CONNECTING;\n  this.extensions = '';\n  this.protocol = '';\n\n  // non-standard extension\n  options = options || {};\n  if (options.protocols_whitelist) {\n    log.warn(\"'protocols_whitelist' is DEPRECATED. Use 'transports' instead.\");\n  }\n  this._transportsWhitelist = options.transports;\n  this._transportOptions = options.transportOptions || {};\n  this._timeout = options.timeout || 0;\n\n  var sessionId = options.sessionId || 8;\n  if (typeof sessionId === 'function') {\n    this._generateSessionId = sessionId;\n  } else if (typeof sessionId === 'number') {\n    this._generateSessionId = function() {\n      return random.string(sessionId);\n    };\n  } else {\n    throw new TypeError('If sessionId is used in the options, it needs to be a number or a function.');\n  }\n\n  this._server = options.server || random.numberString(1000);\n\n  // Step 1 of WS spec - parse and validate the url. Issue #8\n  var parsedUrl = new URL(url);\n  if (!parsedUrl.host || !parsedUrl.protocol) {\n    throw new SyntaxError(\"The URL '\" + url + \"' is invalid\");\n  } else if (parsedUrl.hash) {\n    throw new SyntaxError('The URL must not contain a fragment');\n  } else if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {\n    throw new SyntaxError(\"The URL's scheme must be either 'http:' or 'https:'. '\" + parsedUrl.protocol + \"' is not allowed.\");\n  }\n\n  var secure = parsedUrl.protocol === 'https:';\n  // Step 2 - don't allow secure origin with an insecure protocol\n  if (loc.protocol === 'https:' && !secure) {\n    // exception is 127.0.0.0/8 and ::1 urls\n    if (!urlUtils.isLoopbackAddr(parsedUrl.hostname)) {\n      throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS');\n    }\n  }\n\n  // Step 3 - check port access - no need here\n  // Step 4 - parse protocols argument\n  if (!protocols) {\n    protocols = [];\n  } else if (!Array.isArray(protocols)) {\n    protocols = [protocols];\n  }\n\n  // Step 5 - check protocols argument\n  var sortedProtocols = protocols.sort();\n  sortedProtocols.forEach(function(proto, i) {\n    if (!proto) {\n      throw new SyntaxError(\"The protocols entry '\" + proto + \"' is invalid.\");\n    }\n    if (i < (sortedProtocols.length - 1) && proto === sortedProtocols[i + 1]) {\n      throw new SyntaxError(\"The protocols entry '\" + proto + \"' is duplicated.\");\n    }\n  });\n\n  // Step 6 - convert origin\n  var o = urlUtils.getOrigin(loc.href);\n  this._origin = o ? o.toLowerCase() : null;\n\n  // remove the trailing slash\n  parsedUrl.set('pathname', parsedUrl.pathname.replace(/\\/+$/, ''));\n\n  // store the sanitized url\n  this.url = parsedUrl.href;\n  debug('using url', this.url);\n\n  // Step 7 - start connection in background\n  // obtain server info\n  // http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26\n  this._urlInfo = {\n    nullOrigin: !browser.hasDomain()\n  , sameOrigin: urlUtils.isOriginEqual(this.url, loc.href)\n  , sameScheme: urlUtils.isSchemeEqual(this.url, loc.href)\n  };\n\n  this._ir = new InfoReceiver(this.url, this._urlInfo);\n  this._ir.once('finish', this._receiveInfo.bind(this));\n}\n\ninherits(SockJS, EventTarget);\n\nfunction userSetCode(code) {\n  return code === 1000 || (code >= 3000 && code <= 4999);\n}\n\nSockJS.prototype.close = function(code, reason) {\n  // Step 1\n  if (code && !userSetCode(code)) {\n    throw new Error('InvalidAccessError: Invalid code');\n  }\n  // Step 2.4 states the max is 123 bytes, but we are just checking length\n  if (reason && reason.length > 123) {\n    throw new SyntaxError('reason argument has an invalid length');\n  }\n\n  // Step 3.1\n  if (this.readyState === SockJS.CLOSING || this.readyState === SockJS.CLOSED) {\n    return;\n  }\n\n  // TODO look at docs to determine how to set this\n  var wasClean = true;\n  this._close(code || 1000, reason || 'Normal closure', wasClean);\n};\n\nSockJS.prototype.send = function(data) {\n  // #13 - convert anything non-string to string\n  // TODO this currently turns objects into [object Object]\n  if (typeof data !== 'string') {\n    data = '' + data;\n  }\n  if (this.readyState === SockJS.CONNECTING) {\n    throw new Error('InvalidStateError: The connection has not been established yet');\n  }\n  if (this.readyState !== SockJS.OPEN) {\n    return;\n  }\n  this._transport.send(escape.quote(data));\n};\n\nSockJS.version = require('./version');\n\nSockJS.CONNECTING = 0;\nSockJS.OPEN = 1;\nSockJS.CLOSING = 2;\nSockJS.CLOSED = 3;\n\nSockJS.prototype._receiveInfo = function(info, rtt, status) {\n  debug('_receiveInfo', rtt);\n  this._ir = null;\n  if (!info) {\n    this._close(status || 1002, 'Cannot connect to server');\n    return;\n  }\n\n  // establish a round-trip timeout (RTO) based on the\n  // round-trip time (RTT)\n  this._rto = this.countRTO(rtt);\n  // allow server to override url used for the actual transport\n  this._transUrl = info.base_url ? info.base_url : this.url;\n  info = objectUtils.extend(info, this._urlInfo);\n  debug('info', info);\n  // determine list of desired and supported transports\n  var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info);\n  this._transports = enabledTransports.main;\n  debug(this._transports.length + ' enabled transports');\n\n  this._connect();\n};\n\nSockJS.prototype._connect = function() {\n  for (var Transport = this._transports.shift(); Transport; Transport = this._transports.shift()) {\n    debug('attempt', Transport.transportName);\n    if (Transport.needBody) {\n      if (!global.document.body ||\n          (typeof global.document.readyState !== 'undefined' &&\n            global.document.readyState !== 'complete' &&\n            global.document.readyState !== 'interactive')) {\n        debug('waiting for body');\n        this._transports.unshift(Transport);\n        eventUtils.attachEvent('load', this._connect.bind(this));\n        return;\n      }\n    }\n\n    // calculate timeout based on RTO and round trips. Default to 5s\n    var timeoutMs = Math.max(this._timeout, (this._rto * Transport.roundTrips) || 5000);\n    this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);\n    debug('using timeout', timeoutMs);\n\n    var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId());\n    var options = this._transportOptions[Transport.transportName];\n    debug('transport url', transportUrl);\n    var transportObj = new Transport(transportUrl, this._transUrl, options);\n    transportObj.on('message', this._transportMessage.bind(this));\n    transportObj.once('close', this._transportClose.bind(this));\n    transportObj.transportName = Transport.transportName;\n    this._transport = transportObj;\n\n    return;\n  }\n  this._close(2000, 'All transports failed', false);\n};\n\nSockJS.prototype._transportTimeout = function() {\n  debug('_transportTimeout');\n  if (this.readyState === SockJS.CONNECTING) {\n    if (this._transport) {\n      this._transport.close();\n    }\n\n    this._transportClose(2007, 'Transport timed out');\n  }\n};\n\nSockJS.prototype._transportMessage = function(msg) {\n  debug('_transportMessage', msg);\n  var self = this\n    , type = msg.slice(0, 1)\n    , content = msg.slice(1)\n    , payload\n    ;\n\n  // first check for messages that don't need a payload\n  switch (type) {\n    case 'o':\n      this._open();\n      return;\n    case 'h':\n      this.dispatchEvent(new Event('heartbeat'));\n      debug('heartbeat', this.transport);\n      return;\n  }\n\n  if (content) {\n    try {\n      payload = JSON.parse(content);\n    } catch (e) {\n      debug('bad json', content);\n    }\n  }\n\n  if (typeof payload === 'undefined') {\n    debug('empty payload', content);\n    return;\n  }\n\n  switch (type) {\n    case 'a':\n      if (Array.isArray(payload)) {\n        payload.forEach(function(p) {\n          debug('message', self.transport, p);\n          self.dispatchEvent(new TransportMessageEvent(p));\n        });\n      }\n      break;\n    case 'm':\n      debug('message', this.transport, payload);\n      this.dispatchEvent(new TransportMessageEvent(payload));\n      break;\n    case 'c':\n      if (Array.isArray(payload) && payload.length === 2) {\n        this._close(payload[0], payload[1], true);\n      }\n      break;\n  }\n};\n\nSockJS.prototype._transportClose = function(code, reason) {\n  debug('_transportClose', this.transport, code, reason);\n  if (this._transport) {\n    clearTimeout(this._transportTimeoutId);\n    this._transport.removeAllListeners();\n    this._transport = null;\n    this.transport = null;\n    this._transportTimeoutId = null;\n  }\n\n  if (!userSetCode(code) && code !== 2000 && this.readyState === SockJS.CONNECTING) {\n    this._connect();\n    return;\n  }\n\n  this._close(code, reason);\n};\n\nSockJS.prototype._open = function() {\n  debug('_open', this._transport && this._transport.transportName, this.readyState);\n  if (this.readyState === SockJS.CONNECTING) {\n    if (this._transportTimeoutId) {\n      clearTimeout(this._transportTimeoutId);\n      this._transportTimeoutId = null;\n    }\n    this.readyState = SockJS.OPEN;\n    this.transport = this._transport.transportName;\n    this.dispatchEvent(new Event('open'));\n    debug('connected', this.transport);\n  } else {\n    // The server might have been restarted, and lost track of our\n    // connection.\n    this._close(1006, 'Server lost session');\n  }\n};\n\nSockJS.prototype._close = function(code, reason, wasClean) {\n  debug('_close', this.transport, code, reason, wasClean, this.readyState);\n  var forceFail = false;\n\n  if (this._ir) {\n    forceFail = true;\n    this._ir.close();\n    this._ir = null;\n  }\n  if (this._transport) {\n    this._transport.close();\n    this._transport = null;\n    this.transport = null;\n  }\n\n  if (this.readyState === SockJS.CLOSED) {\n    throw new Error('InvalidStateError: SockJS has already been closed');\n  }\n\n  this.readyState = SockJS.CLOSING;\n  setTimeout(function() {\n    this.readyState = SockJS.CLOSED;\n\n    if (forceFail) {\n      this.dispatchEvent(new Event('error'));\n    }\n\n    var e = new CloseEvent('close');\n    e.wasClean = wasClean || false;\n    e.code = code || 1000;\n    e.reason = reason;\n\n    this.dispatchEvent(e);\n    this.onmessage = this.onclose = this.onerror = null;\n    debug('disconnected');\n  }.bind(this), 0);\n};\n\n// See: http://www.erg.abdn.ac.uk/~gerrit/dccp/notes/ccid2/rto_estimator/\n// and RFC 2988.\nSockJS.prototype.countRTO = function(rtt) {\n  // In a local environment, when using IE8/9 and the `jsonp-polling`\n  // transport the time needed to establish a connection (the time that pass\n  // from the opening of the transport to the call of `_dispatchOpen`) is\n  // around 200msec (the lower bound used in the article above) and this\n  // causes spurious timeouts. For this reason we calculate a value slightly\n  // larger than that used in the article.\n  if (rtt > 100) {\n    return 4 * rtt; // rto > 400msec\n  }\n  return 300 + rtt; // 300msec < rto <= 400msec\n};\n\nmodule.exports = function(availableTransports) {\n  transports = transport(availableTransports);\n  require('./iframe-bootstrap')(SockJS, availableTransports);\n  return SockJS;\n};\n"
  },
  {
    "path": "lib/shims.js",
    "content": "/* eslint-disable */\n/* jscs: disable */\n'use strict';\n\n// pulled specific shims from https://github.com/es-shims/es5-shim\n\nvar ArrayPrototype = Array.prototype;\nvar ObjectPrototype = Object.prototype;\nvar FunctionPrototype = Function.prototype;\nvar StringPrototype = String.prototype;\nvar array_slice = ArrayPrototype.slice;\n\nvar _toString = ObjectPrototype.toString;\nvar isFunction = function (val) {\n    return ObjectPrototype.toString.call(val) === '[object Function]';\n};\nvar isArray = function isArray(obj) {\n    return _toString.call(obj) === '[object Array]';\n};\nvar isString = function isString(obj) {\n    return _toString.call(obj) === '[object String]';\n};\n\nvar supportsDescriptors = Object.defineProperty && (function () {\n    try {\n        Object.defineProperty({}, 'x', {});\n        return true;\n    } catch (e) { /* this is ES3 */\n        return false;\n    }\n}());\n\n// Define configurable, writable and non-enumerable props\n// if they don't exist.\nvar defineProperty;\nif (supportsDescriptors) {\n    defineProperty = function (object, name, method, forceAssign) {\n        if (!forceAssign && (name in object)) { return; }\n        Object.defineProperty(object, name, {\n            configurable: true,\n            enumerable: false,\n            writable: true,\n            value: method\n        });\n    };\n} else {\n    defineProperty = function (object, name, method, forceAssign) {\n        if (!forceAssign && (name in object)) { return; }\n        object[name] = method;\n    };\n}\nvar defineProperties = function (object, map, forceAssign) {\n    for (var name in map) {\n        if (ObjectPrototype.hasOwnProperty.call(map, name)) {\n          defineProperty(object, name, map[name], forceAssign);\n        }\n    }\n};\n\nvar toObject = function (o) {\n    if (o == null) { // this matches both null and undefined\n        throw new TypeError(\"can't convert \" + o + ' to object');\n    }\n    return Object(o);\n};\n\n//\n// Util\n// ======\n//\n\n// ES5 9.4\n// http://es5.github.com/#x9.4\n// http://jsperf.com/to-integer\n\nfunction toInteger(num) {\n    var n = +num;\n    if (n !== n) { // isNaN\n        n = 0;\n    } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {\n        n = (n > 0 || -1) * Math.floor(Math.abs(n));\n    }\n    return n;\n}\n\nfunction ToUint32(x) {\n    return x >>> 0;\n}\n\n//\n// Function\n// ========\n//\n\n// ES-5 15.3.4.5\n// http://es5.github.com/#x15.3.4.5\n\nfunction Empty() {}\n\ndefineProperties(FunctionPrototype, {\n    bind: function bind(that) { // .length is 1\n        // 1. Let Target be the this value.\n        var target = this;\n        // 2. If IsCallable(Target) is false, throw a TypeError exception.\n        if (!isFunction(target)) {\n            throw new TypeError('Function.prototype.bind called on incompatible ' + target);\n        }\n        // 3. Let A be a new (possibly empty) internal list of all of the\n        //   argument values provided after thisArg (arg1, arg2 etc), in order.\n        // XXX slicedArgs will stand in for \"A\" if used\n        var args = array_slice.call(arguments, 1); // for normal call\n        // 4. Let F be a new native ECMAScript object.\n        // 11. Set the [[Prototype]] internal property of F to the standard\n        //   built-in Function prototype object as specified in 15.3.3.1.\n        // 12. Set the [[Call]] internal property of F as described in\n        //   15.3.4.5.1.\n        // 13. Set the [[Construct]] internal property of F as described in\n        //   15.3.4.5.2.\n        // 14. Set the [[HasInstance]] internal property of F as described in\n        //   15.3.4.5.3.\n        var binder = function () {\n\n            if (this instanceof bound) {\n                // 15.3.4.5.2 [[Construct]]\n                // When the [[Construct]] internal method of a function object,\n                // F that was created using the bind function is called with a\n                // list of arguments ExtraArgs, the following steps are taken:\n                // 1. Let target be the value of F's [[TargetFunction]]\n                //   internal property.\n                // 2. If target has no [[Construct]] internal method, a\n                //   TypeError exception is thrown.\n                // 3. Let boundArgs be the value of F's [[BoundArgs]] internal\n                //   property.\n                // 4. Let args be a new list containing the same values as the\n                //   list boundArgs in the same order followed by the same\n                //   values as the list ExtraArgs in the same order.\n                // 5. Return the result of calling the [[Construct]] internal\n                //   method of target providing args as the arguments.\n\n                var result = target.apply(\n                    this,\n                    args.concat(array_slice.call(arguments))\n                );\n                if (Object(result) === result) {\n                    return result;\n                }\n                return this;\n\n            } else {\n                // 15.3.4.5.1 [[Call]]\n                // When the [[Call]] internal method of a function object, F,\n                // which was created using the bind function is called with a\n                // this value and a list of arguments ExtraArgs, the following\n                // steps are taken:\n                // 1. Let boundArgs be the value of F's [[BoundArgs]] internal\n                //   property.\n                // 2. Let boundThis be the value of F's [[BoundThis]] internal\n                //   property.\n                // 3. Let target be the value of F's [[TargetFunction]] internal\n                //   property.\n                // 4. Let args be a new list containing the same values as the\n                //   list boundArgs in the same order followed by the same\n                //   values as the list ExtraArgs in the same order.\n                // 5. Return the result of calling the [[Call]] internal method\n                //   of target providing boundThis as the this value and\n                //   providing args as the arguments.\n\n                // equiv: target.call(this, ...boundArgs, ...args)\n                return target.apply(\n                    that,\n                    args.concat(array_slice.call(arguments))\n                );\n\n            }\n\n        };\n\n        // 15. If the [[Class]] internal property of Target is \"Function\", then\n        //     a. Let L be the length property of Target minus the length of A.\n        //     b. Set the length own property of F to either 0 or L, whichever is\n        //       larger.\n        // 16. Else set the length own property of F to 0.\n\n        var boundLength = Math.max(0, target.length - args.length);\n\n        // 17. Set the attributes of the length own property of F to the values\n        //   specified in 15.3.5.1.\n        var boundArgs = [];\n        for (var i = 0; i < boundLength; i++) {\n            boundArgs.push('$' + i);\n        }\n\n        // XXX Build a dynamic function with desired amount of arguments is the only\n        // way to set the length property of a function.\n        // In environments where Content Security Policies enabled (Chrome extensions,\n        // for ex.) all use of eval or Function costructor throws an exception.\n        // However in all of these environments Function.prototype.bind exists\n        // and so this code will never be executed.\n        var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);\n\n        if (target.prototype) {\n            Empty.prototype = target.prototype;\n            bound.prototype = new Empty();\n            // Clean up dangling references.\n            Empty.prototype = null;\n        }\n\n        // TODO\n        // 18. Set the [[Extensible]] internal property of F to true.\n\n        // TODO\n        // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).\n        // 20. Call the [[DefineOwnProperty]] internal method of F with\n        //   arguments \"caller\", PropertyDescriptor {[[Get]]: thrower, [[Set]]:\n        //   thrower, [[Enumerable]]: false, [[Configurable]]: false}, and\n        //   false.\n        // 21. Call the [[DefineOwnProperty]] internal method of F with\n        //   arguments \"arguments\", PropertyDescriptor {[[Get]]: thrower,\n        //   [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},\n        //   and false.\n\n        // TODO\n        // NOTE Function objects created using Function.prototype.bind do not\n        // have a prototype property or the [[Code]], [[FormalParameters]], and\n        // [[Scope]] internal properties.\n        // XXX can't delete prototype in pure-js.\n\n        // 22. Return F.\n        return bound;\n    }\n});\n\n//\n// Array\n// =====\n//\n\n// ES5 15.4.3.2\n// http://es5.github.com/#x15.4.3.2\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray\ndefineProperties(Array, { isArray: isArray });\n\n\nvar boxedString = Object('a');\nvar splitString = boxedString[0] !== 'a' || !(0 in boxedString);\n\nvar properlyBoxesContext = function properlyBoxed(method) {\n    // Check node 0.6.21 bug where third parameter is not boxed\n    var properlyBoxesNonStrict = true;\n    var properlyBoxesStrict = true;\n    if (method) {\n        method.call('foo', function (_, __, context) {\n            if (typeof context !== 'object') { properlyBoxesNonStrict = false; }\n        });\n\n        method.call([1], function () {\n            'use strict';\n            properlyBoxesStrict = typeof this === 'string';\n        }, 'x');\n    }\n    return !!method && properlyBoxesNonStrict && properlyBoxesStrict;\n};\n\ndefineProperties(ArrayPrototype, {\n    forEach: function forEach(fun /*, thisp*/) {\n        var object = toObject(this),\n            self = splitString && isString(this) ? this.split('') : object,\n            thisp = arguments[1],\n            i = -1,\n            length = self.length >>> 0;\n\n        // If no callback function or if callback is not a callable function\n        if (!isFunction(fun)) {\n            throw new TypeError(); // TODO message\n        }\n\n        while (++i < length) {\n            if (i in self) {\n                // Invoke the callback function with call, passing arguments:\n                // context, property value, property key, thisArg object\n                // context\n                fun.call(thisp, self[i], i, object);\n            }\n        }\n    }\n}, !properlyBoxesContext(ArrayPrototype.forEach));\n\n// ES5 15.4.4.14\n// http://es5.github.com/#x15.4.4.14\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf\nvar hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) !== -1;\ndefineProperties(ArrayPrototype, {\n    indexOf: function indexOf(sought /*, fromIndex */ ) {\n        var self = splitString && isString(this) ? this.split('') : toObject(this),\n            length = self.length >>> 0;\n\n        if (!length) {\n            return -1;\n        }\n\n        var i = 0;\n        if (arguments.length > 1) {\n            i = toInteger(arguments[1]);\n        }\n\n        // handle negative indices\n        i = i >= 0 ? i : Math.max(0, length + i);\n        for (; i < length; i++) {\n            if (i in self && self[i] === sought) {\n                return i;\n            }\n        }\n        return -1;\n    }\n}, hasFirefox2IndexOfBug);\n\n//\n// String\n// ======\n//\n\n// ES5 15.5.4.14\n// http://es5.github.com/#x15.5.4.14\n\n// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]\n// Many browsers do not split properly with regular expressions or they\n// do not perform the split correctly under obscure conditions.\n// See http://blog.stevenlevithan.com/archives/cross-browser-split\n// I've tested in many browsers and this seems to cover the deviant ones:\n//    'ab'.split(/(?:ab)*/) should be [\"\", \"\"], not [\"\"]\n//    '.'.split(/(.?)(.?)/) should be [\"\", \".\", \"\", \"\"], not [\"\", \"\"]\n//    'tesst'.split(/(s)*/) should be [\"t\", undefined, \"e\", \"s\", \"t\"], not\n//       [undefined, \"t\", undefined, \"e\", ...]\n//    ''.split(/.?/) should be [], not [\"\"]\n//    '.'.split(/()()/) should be [\".\"], not [\"\", \"\", \".\"]\n\nvar string_split = StringPrototype.split;\nif (\n    'ab'.split(/(?:ab)*/).length !== 2 ||\n    '.'.split(/(.?)(.?)/).length !== 4 ||\n    'tesst'.split(/(s)*/)[1] === 't' ||\n    'test'.split(/(?:)/, -1).length !== 4 ||\n    ''.split(/.?/).length ||\n    '.'.split(/()()/).length > 1\n) {\n    (function () {\n        var compliantExecNpcg = /()??/.exec('')[1] === void 0; // NPCG: nonparticipating capturing group\n\n        StringPrototype.split = function (separator, limit) {\n            var string = this;\n            if (separator === void 0 && limit === 0) {\n                return [];\n            }\n\n            // If `separator` is not a regex, use native split\n            if (_toString.call(separator) !== '[object RegExp]') {\n                return string_split.call(this, separator, limit);\n            }\n\n            var output = [],\n                flags = (separator.ignoreCase ? 'i' : '') +\n                        (separator.multiline  ? 'm' : '') +\n                        (separator.extended   ? 'x' : '') + // Proposed for ES6\n                        (separator.sticky     ? 'y' : ''), // Firefox 3+\n                lastLastIndex = 0,\n                // Make `global` and avoid `lastIndex` issues by working with a copy\n                separator2, match, lastIndex, lastLength;\n            separator = new RegExp(separator.source, flags + 'g');\n            string += ''; // Type-convert\n            if (!compliantExecNpcg) {\n                // Doesn't need flags gy, but they don't hurt\n                separator2 = new RegExp('^' + separator.source + '$(?!\\\\s)', flags);\n            }\n            /* Values for `limit`, per the spec:\n             * If undefined: 4294967295 // Math.pow(2, 32) - 1\n             * If 0, Infinity, or NaN: 0\n             * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n             * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n             * If other: Type-convert, then use the above rules\n             */\n            limit = limit === void 0 ?\n                -1 >>> 0 : // Math.pow(2, 32) - 1\n                ToUint32(limit);\n            while (match = separator.exec(string)) {\n                // `separator.lastIndex` is not reliable cross-browser\n                lastIndex = match.index + match[0].length;\n                if (lastIndex > lastLastIndex) {\n                    output.push(string.slice(lastLastIndex, match.index));\n                    // Fix browsers whose `exec` methods don't consistently return `undefined` for\n                    // nonparticipating capturing groups\n                    if (!compliantExecNpcg && match.length > 1) {\n                        match[0].replace(separator2, function () {\n                            for (var i = 1; i < arguments.length - 2; i++) {\n                                if (arguments[i] === void 0) {\n                                    match[i] = void 0;\n                                }\n                            }\n                        });\n                    }\n                    if (match.length > 1 && match.index < string.length) {\n                        ArrayPrototype.push.apply(output, match.slice(1));\n                    }\n                    lastLength = match[0].length;\n                    lastLastIndex = lastIndex;\n                    if (output.length >= limit) {\n                        break;\n                    }\n                }\n                if (separator.lastIndex === match.index) {\n                    separator.lastIndex++; // Avoid an infinite loop\n                }\n            }\n            if (lastLastIndex === string.length) {\n                if (lastLength || !separator.test('')) {\n                    output.push('');\n                }\n            } else {\n                output.push(string.slice(lastLastIndex));\n            }\n            return output.length > limit ? output.slice(0, limit) : output;\n        };\n    }());\n\n// [bugfix, chrome]\n// If separator is undefined, then the result array contains just one String,\n// which is the this value (converted to a String). If limit is not undefined,\n// then the output array is truncated so that it contains no more than limit\n// elements.\n// \"0\".split(undefined, 0) -> []\n} else if ('0'.split(void 0, 0).length) {\n    StringPrototype.split = function split(separator, limit) {\n        if (separator === void 0 && limit === 0) { return []; }\n        return string_split.call(this, separator, limit);\n    };\n}\n\n// ECMA-262, 3rd B.2.3\n// Not an ECMAScript standard, although ECMAScript 3rd Edition has a\n// non-normative section suggesting uniform semantics and it should be\n// normalized across all browsers\n// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE\nvar string_substr = StringPrototype.substr;\nvar hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b';\ndefineProperties(StringPrototype, {\n    substr: function substr(start, length) {\n        return string_substr.call(\n            this,\n            start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,\n            length\n        );\n    }\n}, hasNegativeSubstrBug);\n"
  },
  {
    "path": "lib/transport/browser/abstract-xhr.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  , utils = require('../../utils/event')\n  , urlUtils = require('../../utils/url')\n  , XHR = global.XMLHttpRequest\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:browser:xhr');\n}\n\nfunction AbstractXHRObject(method, url, payload, opts) {\n  debug(method, url);\n  var self = this;\n  EventEmitter.call(this);\n\n  setTimeout(function () {\n    self._start(method, url, payload, opts);\n  }, 0);\n}\n\ninherits(AbstractXHRObject, EventEmitter);\n\nAbstractXHRObject.prototype._start = function(method, url, payload, opts) {\n  var self = this;\n\n  try {\n    this.xhr = new XHR();\n  } catch (x) {\n    // intentionally empty\n  }\n\n  if (!this.xhr) {\n    debug('no xhr');\n    this.emit('finish', 0, 'no xhr support');\n    this._cleanup();\n    return;\n  }\n\n  // several browsers cache POSTs\n  url = urlUtils.addQuery(url, 't=' + (+new Date()));\n\n  // Explorer tends to keep connection open, even after the\n  // tab gets closed: http://bugs.jquery.com/ticket/5280\n  this.unloadRef = utils.unloadAdd(function() {\n    debug('unload cleanup');\n    self._cleanup(true);\n  });\n  try {\n    this.xhr.open(method, url, true);\n    if (this.timeout && 'timeout' in this.xhr) {\n      this.xhr.timeout = this.timeout;\n      this.xhr.ontimeout = function() {\n        debug('xhr timeout');\n        self.emit('finish', 0, '');\n        self._cleanup(false);\n      };\n    }\n  } catch (e) {\n    debug('exception', e);\n    // IE raises an exception on wrong port.\n    this.emit('finish', 0, '');\n    this._cleanup(false);\n    return;\n  }\n\n  if ((!opts || !opts.noCredentials) && AbstractXHRObject.supportsCORS) {\n    debug('withCredentials');\n    // Mozilla docs says https://developer.mozilla.org/en/XMLHttpRequest :\n    // \"This never affects same-site requests.\"\n\n    this.xhr.withCredentials = true;\n  }\n  if (opts && opts.headers) {\n    for (var key in opts.headers) {\n      this.xhr.setRequestHeader(key, opts.headers[key]);\n    }\n  }\n\n  this.xhr.onreadystatechange = function() {\n    if (self.xhr) {\n      var x = self.xhr;\n      var text, status;\n      debug('readyState', x.readyState);\n      switch (x.readyState) {\n      case 3:\n        // IE doesn't like peeking into responseText or status\n        // on Microsoft.XMLHTTP and readystate=3\n        try {\n          status = x.status;\n          text = x.responseText;\n        } catch (e) {\n          // intentionally empty\n        }\n        debug('status', status);\n        // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450\n        if (status === 1223) {\n          status = 204;\n        }\n\n        // IE does return readystate == 3 for 404 answers.\n        if (status === 200 && text && text.length > 0) {\n          debug('chunk');\n          self.emit('chunk', status, text);\n        }\n        break;\n      case 4:\n        status = x.status;\n        debug('status', status);\n        // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450\n        if (status === 1223) {\n          status = 204;\n        }\n        // IE returns this for a bad port\n        // http://msdn.microsoft.com/en-us/library/windows/desktop/aa383770(v=vs.85).aspx\n        if (status === 12005 || status === 12029) {\n          status = 0;\n        }\n\n        debug('finish', status, x.responseText);\n        self.emit('finish', status, x.responseText);\n        self._cleanup(false);\n        break;\n      }\n    }\n  };\n\n  try {\n    self.xhr.send(payload);\n  } catch (e) {\n    self.emit('finish', 0, '');\n    self._cleanup(false);\n  }\n};\n\nAbstractXHRObject.prototype._cleanup = function(abort) {\n  debug('cleanup');\n  if (!this.xhr) {\n    return;\n  }\n  this.removeAllListeners();\n  utils.unloadDel(this.unloadRef);\n\n  // IE needs this field to be a function\n  this.xhr.onreadystatechange = function() {};\n  if (this.xhr.ontimeout) {\n    this.xhr.ontimeout = null;\n  }\n\n  if (abort) {\n    try {\n      this.xhr.abort();\n    } catch (x) {\n      // intentionally empty\n    }\n  }\n  this.unloadRef = this.xhr = null;\n};\n\nAbstractXHRObject.prototype.close = function() {\n  debug('close');\n  this._cleanup(true);\n};\n\nAbstractXHRObject.enabled = !!XHR;\n// override XMLHttpRequest for IE6/7\n// obfuscate to avoid firewalls\nvar axo = ['Active'].concat('Object').join('X');\nif (!AbstractXHRObject.enabled && (axo in global)) {\n  debug('overriding xmlhttprequest');\n  XHR = function() {\n    try {\n      return new global[axo]('Microsoft.XMLHTTP');\n    } catch (e) {\n      return null;\n    }\n  };\n  AbstractXHRObject.enabled = !!new XHR();\n}\n\nvar cors = false;\ntry {\n  cors = 'withCredentials' in new XHR();\n} catch (ignored) {\n  // intentionally empty\n}\n\nAbstractXHRObject.supportsCORS = cors;\n\nmodule.exports = AbstractXHRObject;\n"
  },
  {
    "path": "lib/transport/browser/eventsource.js",
    "content": "module.exports = global.EventSource;\n"
  },
  {
    "path": "lib/transport/browser/websocket.js",
    "content": "'use strict';\n\nvar Driver = global.WebSocket || global.MozWebSocket;\nif (Driver) {\n\tmodule.exports = function WebSocketBrowserDriver(url) {\n\t\treturn new Driver(url);\n\t};\n} else {\n\tmodule.exports = undefined;\n}\n"
  },
  {
    "path": "lib/transport/driver/eventsource.js",
    "content": "module.exports = require('eventsource');\n"
  },
  {
    "path": "lib/transport/driver/websocket.js",
    "content": "module.exports = require('faye-websocket').Client;\n"
  },
  {
    "path": "lib/transport/driver/xhr.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  , http = require('http')\n  , https = require('https')\n  , URL = require('url-parse')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:driver:xhr');\n}\n\nfunction XhrDriver(method, url, payload, opts) {\n  debug(method, url, payload);\n  var self = this;\n  EventEmitter.call(this);\n\n  var parsedUrl = new URL(url);\n  var options = {\n    method: method\n  , hostname: parsedUrl.hostname.replace(/\\[|\\]/g, '')\n  , port: parsedUrl.port\n  , path: parsedUrl.pathname + (parsedUrl.query || '')\n  , headers: opts && opts.headers\n  };\n\n  var protocol = parsedUrl.protocol === 'https:' ? https : http;\n  this.req = protocol.request(options, function(res) {\n    res.setEncoding('utf8');\n    var responseText = '';\n\n    res.on('data', function(chunk) {\n      debug('data', chunk);\n      responseText += chunk;\n      self.emit('chunk', 200, responseText);\n    });\n    res.once('end', function() {\n      debug('end');\n      self.emit('finish', res.statusCode, responseText);\n      self.req = null;\n    });\n  });\n\n  this.req.on('error', function(e) {\n    debug('error', e);\n    self.emit('finish', 0, e.message);\n  });\n\n  if (payload) {\n    this.req.write(payload);\n  }\n  this.req.end();\n}\n\ninherits(XhrDriver, EventEmitter);\n\nXhrDriver.prototype.close = function() {\n  debug('close');\n  this.removeAllListeners();\n  if (this.req) {\n    this.req.abort();\n    this.req = null;\n  }\n};\n\nXhrDriver.enabled = true;\nXhrDriver.supportsCORS = true;\n\nmodule.exports = XhrDriver;\n"
  },
  {
    "path": "lib/transport/eventsource.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , AjaxBasedTransport = require('./lib/ajax-based')\n  , EventSourceReceiver = require('./receiver/eventsource')\n  , XHRCorsObject = require('./sender/xhr-cors')\n  , EventSourceDriver = require('eventsource')\n  ;\n\nfunction EventSourceTransport(transUrl) {\n  if (!EventSourceTransport.enabled()) {\n    throw new Error('Transport created when disabled');\n  }\n\n  AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);\n}\n\ninherits(EventSourceTransport, AjaxBasedTransport);\n\nEventSourceTransport.enabled = function() {\n  return !!EventSourceDriver;\n};\n\nEventSourceTransport.transportName = 'eventsource';\nEventSourceTransport.roundTrips = 2;\n\nmodule.exports = EventSourceTransport;\n"
  },
  {
    "path": "lib/transport/htmlfile.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , HtmlfileReceiver = require('./receiver/htmlfile')\n  , XHRLocalObject = require('./sender/xhr-local')\n  , AjaxBasedTransport = require('./lib/ajax-based')\n  ;\n\nfunction HtmlFileTransport(transUrl) {\n  if (!HtmlfileReceiver.enabled) {\n    throw new Error('Transport created when disabled');\n  }\n  AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject);\n}\n\ninherits(HtmlFileTransport, AjaxBasedTransport);\n\nHtmlFileTransport.enabled = function(info) {\n  return HtmlfileReceiver.enabled && info.sameOrigin;\n};\n\nHtmlFileTransport.transportName = 'htmlfile';\nHtmlFileTransport.roundTrips = 2;\n\nmodule.exports = HtmlFileTransport;\n"
  },
  {
    "path": "lib/transport/iframe.js",
    "content": "'use strict';\n\n// Few cool transports do work only for same-origin. In order to make\n// them work cross-domain we shall use iframe, served from the\n// remote domain. New browsers have capabilities to communicate with\n// cross domain iframe using postMessage(). In IE it was implemented\n// from IE 8+, but of course, IE got some details wrong:\n//    http://msdn.microsoft.com/en-us/library/cc197015(v=VS.85).aspx\n//    http://stevesouders.com/misc/test-postmessage.php\n\nvar inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  , version = require('../version')\n  , urlUtils = require('../utils/url')\n  , iframeUtils = require('../utils/iframe')\n  , eventUtils = require('../utils/event')\n  , random = require('../utils/random')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:transport:iframe');\n}\n\nfunction IframeTransport(transport, transUrl, baseUrl) {\n  if (!IframeTransport.enabled()) {\n    throw new Error('Transport created when disabled');\n  }\n  EventEmitter.call(this);\n\n  var self = this;\n  this.origin = urlUtils.getOrigin(baseUrl);\n  this.baseUrl = baseUrl;\n  this.transUrl = transUrl;\n  this.transport = transport;\n  this.windowId = random.string(8);\n\n  var iframeUrl = urlUtils.addPath(baseUrl, '/iframe.html') + '#' + this.windowId;\n  debug(transport, transUrl, iframeUrl);\n\n  this.iframeObj = iframeUtils.createIframe(iframeUrl, function(r) {\n    debug('err callback');\n    self.emit('close', 1006, 'Unable to load an iframe (' + r + ')');\n    self.close();\n  });\n\n  this.onmessageCallback = this._message.bind(this);\n  eventUtils.attachEvent('message', this.onmessageCallback);\n}\n\ninherits(IframeTransport, EventEmitter);\n\nIframeTransport.prototype.close = function() {\n  debug('close');\n  this.removeAllListeners();\n  if (this.iframeObj) {\n    eventUtils.detachEvent('message', this.onmessageCallback);\n    try {\n      // When the iframe is not loaded, IE raises an exception\n      // on 'contentWindow'.\n      this.postMessage('c');\n    } catch (x) {\n      // intentionally empty\n    }\n    this.iframeObj.cleanup();\n    this.iframeObj = null;\n    this.onmessageCallback = this.iframeObj = null;\n  }\n};\n\nIframeTransport.prototype._message = function(e) {\n  debug('message', e.data);\n  if (!urlUtils.isOriginEqual(e.origin, this.origin)) {\n    debug('not same origin', e.origin, this.origin);\n    return;\n  }\n\n  var iframeMessage;\n  try {\n    iframeMessage = JSON.parse(e.data);\n  } catch (ignored) {\n    debug('bad json', e.data);\n    return;\n  }\n\n  if (iframeMessage.windowId !== this.windowId) {\n    debug('mismatched window id', iframeMessage.windowId, this.windowId);\n    return;\n  }\n\n  switch (iframeMessage.type) {\n  case 's':\n    this.iframeObj.loaded();\n    // window global dependency\n    this.postMessage('s', JSON.stringify([\n      version\n    , this.transport\n    , this.transUrl\n    , this.baseUrl\n    ]));\n    break;\n  case 't':\n    this.emit('message', iframeMessage.data);\n    break;\n  case 'c':\n    var cdata;\n    try {\n      cdata = JSON.parse(iframeMessage.data);\n    } catch (ignored) {\n      debug('bad json', iframeMessage.data);\n      return;\n    }\n    this.emit('close', cdata[0], cdata[1]);\n    this.close();\n    break;\n  }\n};\n\nIframeTransport.prototype.postMessage = function(type, data) {\n  debug('postMessage', type, data);\n  this.iframeObj.post(JSON.stringify({\n    windowId: this.windowId\n  , type: type\n  , data: data || ''\n  }), this.origin);\n};\n\nIframeTransport.prototype.send = function(message) {\n  debug('send', message);\n  this.postMessage('m', message);\n};\n\nIframeTransport.enabled = function() {\n  return iframeUtils.iframeEnabled;\n};\n\nIframeTransport.transportName = 'iframe';\nIframeTransport.roundTrips = 2;\n\nmodule.exports = IframeTransport;\n"
  },
  {
    "path": "lib/transport/jsonp-polling.js",
    "content": "'use strict';\n\n// The simplest and most robust transport, using the well-know cross\n// domain hack - JSONP. This transport is quite inefficient - one\n// message could use up to one http request. But at least it works almost\n// everywhere.\n// Known limitations:\n//   o you will get a spinning cursor\n//   o for Konqueror a dumb timer is needed to detect errors\n\nvar inherits = require('inherits')\n  , SenderReceiver = require('./lib/sender-receiver')\n  , JsonpReceiver = require('./receiver/jsonp')\n  , jsonpSender = require('./sender/jsonp')\n  ;\n\nfunction JsonPTransport(transUrl) {\n  if (!JsonPTransport.enabled()) {\n    throw new Error('Transport created when disabled');\n  }\n  SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);\n}\n\ninherits(JsonPTransport, SenderReceiver);\n\nJsonPTransport.enabled = function() {\n  return !!global.document;\n};\n\nJsonPTransport.transportName = 'jsonp-polling';\nJsonPTransport.roundTrips = 1;\nJsonPTransport.needBody = true;\n\nmodule.exports = JsonPTransport;\n"
  },
  {
    "path": "lib/transport/lib/ajax-based.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , urlUtils = require('../../utils/url')\n  , SenderReceiver = require('./sender-receiver')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:ajax-based');\n}\n\nfunction createAjaxSender(AjaxObject) {\n  return function(url, payload, callback) {\n    debug('create ajax sender', url, payload);\n    var opt = {};\n    if (typeof payload === 'string') {\n      opt.headers = {'Content-type': 'text/plain'};\n    }\n    var ajaxUrl = urlUtils.addPath(url, '/xhr_send');\n    var xo = new AjaxObject('POST', ajaxUrl, payload, opt);\n    xo.once('finish', function(status) {\n      debug('finish', status);\n      xo = null;\n\n      if (status !== 200 && status !== 204) {\n        return callback(new Error('http status ' + status));\n      }\n      callback();\n    });\n    return function() {\n      debug('abort');\n      xo.close();\n      xo = null;\n\n      var err = new Error('Aborted');\n      err.code = 1000;\n      callback(err);\n    };\n  };\n}\n\nfunction AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) {\n  SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject);\n}\n\ninherits(AjaxBasedTransport, SenderReceiver);\n\nmodule.exports = AjaxBasedTransport;\n"
  },
  {
    "path": "lib/transport/lib/buffered-sender.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:buffered-sender');\n}\n\nfunction BufferedSender(url, sender) {\n  debug(url);\n  EventEmitter.call(this);\n  this.sendBuffer = [];\n  this.sender = sender;\n  this.url = url;\n}\n\ninherits(BufferedSender, EventEmitter);\n\nBufferedSender.prototype.send = function(message) {\n  debug('send', message);\n  this.sendBuffer.push(message);\n  if (!this.sendStop) {\n    this.sendSchedule();\n  }\n};\n\n// For polling transports in a situation when in the message callback,\n// new message is being send. If the sending connection was started\n// before receiving one, it is possible to saturate the network and\n// timeout due to the lack of receiving socket. To avoid that we delay\n// sending messages by some small time, in order to let receiving\n// connection be started beforehand. This is only a halfmeasure and\n// does not fix the big problem, but it does make the tests go more\n// stable on slow networks.\nBufferedSender.prototype.sendScheduleWait = function() {\n  debug('sendScheduleWait');\n  var self = this;\n  var tref;\n  this.sendStop = function() {\n    debug('sendStop');\n    self.sendStop = null;\n    clearTimeout(tref);\n  };\n  tref = setTimeout(function() {\n    debug('timeout');\n    self.sendStop = null;\n    self.sendSchedule();\n  }, 25);\n};\n\nBufferedSender.prototype.sendSchedule = function() {\n  debug('sendSchedule', this.sendBuffer.length);\n  var self = this;\n  if (this.sendBuffer.length > 0) {\n    var payload = '[' + this.sendBuffer.join(',') + ']';\n    this.sendStop = this.sender(this.url, payload, function(err) {\n      self.sendStop = null;\n      if (err) {\n        debug('error', err);\n        self.emit('close', err.code || 1006, 'Sending error: ' + err);\n        self.close();\n      } else {\n        self.sendScheduleWait();\n      }\n    });\n    this.sendBuffer = [];\n  }\n};\n\nBufferedSender.prototype._cleanup = function() {\n  debug('_cleanup');\n  this.removeAllListeners();\n};\n\nBufferedSender.prototype.close = function() {\n  debug('close');\n  this._cleanup();\n  if (this.sendStop) {\n    this.sendStop();\n    this.sendStop = null;\n  }\n};\n\nmodule.exports = BufferedSender;\n"
  },
  {
    "path": "lib/transport/lib/iframe-wrap.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , IframeTransport = require('../iframe')\n  , objectUtils = require('../../utils/object')\n  ;\n\nmodule.exports = function(transport) {\n\n  function IframeWrapTransport(transUrl, baseUrl) {\n    IframeTransport.call(this, transport.transportName, transUrl, baseUrl);\n  }\n\n  inherits(IframeWrapTransport, IframeTransport);\n\n  IframeWrapTransport.enabled = function(url, info) {\n    if (!global.document) {\n      return false;\n    }\n\n    var iframeInfo = objectUtils.extend({}, info);\n    iframeInfo.sameOrigin = true;\n    return transport.enabled(iframeInfo) && IframeTransport.enabled();\n  };\n\n  IframeWrapTransport.transportName = 'iframe-' + transport.transportName;\n  IframeWrapTransport.needBody = true;\n  IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1; // html, javascript (2) + transport - no CORS (1)\n\n  IframeWrapTransport.facadeTransport = transport;\n\n  return IframeWrapTransport;\n};\n"
  },
  {
    "path": "lib/transport/lib/polling.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:polling');\n}\n\nfunction Polling(Receiver, receiveUrl, AjaxObject) {\n  debug(receiveUrl);\n  EventEmitter.call(this);\n  this.Receiver = Receiver;\n  this.receiveUrl = receiveUrl;\n  this.AjaxObject = AjaxObject;\n  this._scheduleReceiver();\n}\n\ninherits(Polling, EventEmitter);\n\nPolling.prototype._scheduleReceiver = function() {\n  debug('_scheduleReceiver');\n  var self = this;\n  var poll = this.poll = new this.Receiver(this.receiveUrl, this.AjaxObject);\n\n  poll.on('message', function(msg) {\n    debug('message', msg);\n    self.emit('message', msg);\n  });\n\n  poll.once('close', function(code, reason) {\n    debug('close', code, reason, self.pollIsClosing);\n    self.poll = poll = null;\n\n    if (!self.pollIsClosing) {\n      if (reason === 'network') {\n        self._scheduleReceiver();\n      } else {\n        self.emit('close', code || 1006, reason);\n        self.removeAllListeners();\n      }\n    }\n  });\n};\n\nPolling.prototype.abort = function() {\n  debug('abort');\n  this.removeAllListeners();\n  this.pollIsClosing = true;\n  if (this.poll) {\n    this.poll.abort();\n  }\n};\n\nmodule.exports = Polling;\n"
  },
  {
    "path": "lib/transport/lib/sender-receiver.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , urlUtils = require('../../utils/url')\n  , BufferedSender = require('./buffered-sender')\n  , Polling = require('./polling')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:sender-receiver');\n}\n\nfunction SenderReceiver(transUrl, urlSuffix, senderFunc, Receiver, AjaxObject) {\n  var pollUrl = urlUtils.addPath(transUrl, urlSuffix);\n  debug(pollUrl);\n  var self = this;\n  BufferedSender.call(this, transUrl, senderFunc);\n\n  this.poll = new Polling(Receiver, pollUrl, AjaxObject);\n  this.poll.on('message', function(msg) {\n    debug('poll message', msg);\n    self.emit('message', msg);\n  });\n  this.poll.once('close', function(code, reason) {\n    debug('poll close', code, reason);\n    self.poll = null;\n    self.emit('close', code, reason);\n    self.close();\n  });\n}\n\ninherits(SenderReceiver, BufferedSender);\n\nSenderReceiver.prototype.close = function() {\n  BufferedSender.prototype.close.call(this);\n  debug('close');\n  this.removeAllListeners();\n  if (this.poll) {\n    this.poll.abort();\n    this.poll = null;\n  }\n};\n\nmodule.exports = SenderReceiver;\n"
  },
  {
    "path": "lib/transport/receiver/eventsource.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  , EventSourceDriver = require('eventsource')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:receiver:eventsource');\n}\n\nfunction decodeURISafe(s) {\n    return decodeURI(s.replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25'));\n}\n\nfunction EventSourceReceiver(url) {\n  debug(url);\n  EventEmitter.call(this);\n\n  var self = this;\n  var es = this.es = new EventSourceDriver(url);\n  es.onmessage = function(e) {\n    debug('message', e.data);\n    self.emit('message', decodeURISafe(e.data));\n  };\n  es.onerror = function(e) {\n    debug('error', es.readyState, e);\n    // ES on reconnection has readyState = 0 or 1.\n    // on network error it's CLOSED = 2\n    var reason = (es.readyState !== 2 ? 'network' : 'permanent');\n    self._cleanup();\n    self._close(reason);\n  };\n}\n\ninherits(EventSourceReceiver, EventEmitter);\n\nEventSourceReceiver.prototype.abort = function() {\n  debug('abort');\n  this._cleanup();\n  this._close('user');\n};\n\nEventSourceReceiver.prototype._cleanup = function() {\n  debug('cleanup');\n  var es = this.es;\n  if (es) {\n    es.onmessage = es.onerror = null;\n    es.close();\n    this.es = null;\n  }\n};\n\nEventSourceReceiver.prototype._close = function(reason) {\n  debug('close', reason);\n  var self = this;\n  // Safari and chrome < 15 crash if we close window before\n  // waiting for ES cleanup. See:\n  // https://code.google.com/p/chromium/issues/detail?id=89155\n  setTimeout(function() {\n    self.emit('close', null, reason);\n    self.removeAllListeners();\n  }, 200);\n};\n\nmodule.exports = EventSourceReceiver;\n"
  },
  {
    "path": "lib/transport/receiver/htmlfile.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , iframeUtils = require('../../utils/iframe')\n  , urlUtils = require('../../utils/url')\n  , EventEmitter = require('events').EventEmitter\n  , random = require('../../utils/random')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:receiver:htmlfile');\n}\n\nfunction HtmlfileReceiver(url) {\n  debug(url);\n  EventEmitter.call(this);\n  var self = this;\n  iframeUtils.polluteGlobalNamespace();\n\n  this.id = 'a' + random.string(6);\n  url = urlUtils.addQuery(url, 'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id));\n\n  debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled);\n  var constructFunc = HtmlfileReceiver.htmlfileEnabled ?\n      iframeUtils.createHtmlfile : iframeUtils.createIframe;\n\n  global[iframeUtils.WPrefix][this.id] = {\n    start: function() {\n      debug('start');\n      self.iframeObj.loaded();\n    }\n  , message: function(data) {\n      debug('message', data);\n      self.emit('message', data);\n    }\n  , stop: function() {\n      debug('stop');\n      self._cleanup();\n      self._close('network');\n    }\n  };\n  this.iframeObj = constructFunc(url, function() {\n    debug('callback');\n    self._cleanup();\n    self._close('permanent');\n  });\n}\n\ninherits(HtmlfileReceiver, EventEmitter);\n\nHtmlfileReceiver.prototype.abort = function() {\n  debug('abort');\n  this._cleanup();\n  this._close('user');\n};\n\nHtmlfileReceiver.prototype._cleanup = function() {\n  debug('_cleanup');\n  if (this.iframeObj) {\n    this.iframeObj.cleanup();\n    this.iframeObj = null;\n  }\n  delete global[iframeUtils.WPrefix][this.id];\n};\n\nHtmlfileReceiver.prototype._close = function(reason) {\n  debug('_close', reason);\n  this.emit('close', null, reason);\n  this.removeAllListeners();\n};\n\nHtmlfileReceiver.htmlfileEnabled = false;\n\n// obfuscate to avoid firewalls\nvar axo = ['Active'].concat('Object').join('X');\nif (axo in global) {\n  try {\n    HtmlfileReceiver.htmlfileEnabled = !!new global[axo]('htmlfile');\n  } catch (x) {\n    // intentionally empty\n  }\n}\n\nHtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;\n\nmodule.exports = HtmlfileReceiver;\n"
  },
  {
    "path": "lib/transport/receiver/jsonp.js",
    "content": "'use strict';\n\nvar utils = require('../../utils/iframe')\n  , random = require('../../utils/random')\n  , browser = require('../../utils/browser')\n  , urlUtils = require('../../utils/url')\n  , inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:receiver:jsonp');\n}\n\nfunction JsonpReceiver(url) {\n  debug(url);\n  var self = this;\n  EventEmitter.call(this);\n\n  utils.polluteGlobalNamespace();\n\n  this.id = 'a' + random.string(6);\n  var urlWithId = urlUtils.addQuery(url, 'c=' + encodeURIComponent(utils.WPrefix + '.' + this.id));\n\n  global[utils.WPrefix][this.id] = this._callback.bind(this);\n  this._createScript(urlWithId);\n\n  // Fallback mostly for Konqueror - stupid timer, 35 seconds shall be plenty.\n  this.timeoutId = setTimeout(function() {\n    debug('timeout');\n    self._abort(new Error('JSONP script loaded abnormally (timeout)'));\n  }, JsonpReceiver.timeout);\n}\n\ninherits(JsonpReceiver, EventEmitter);\n\nJsonpReceiver.prototype.abort = function() {\n  debug('abort');\n  if (global[utils.WPrefix][this.id]) {\n    var err = new Error('JSONP user aborted read');\n    err.code = 1000;\n    this._abort(err);\n  }\n};\n\nJsonpReceiver.timeout = 35000;\nJsonpReceiver.scriptErrorTimeout = 1000;\n\nJsonpReceiver.prototype._callback = function(data) {\n  debug('_callback', data);\n  this._cleanup();\n\n  if (this.aborting) {\n    return;\n  }\n\n  if (data) {\n    debug('message', data);\n    this.emit('message', data);\n  }\n  this.emit('close', null, 'network');\n  this.removeAllListeners();\n};\n\nJsonpReceiver.prototype._abort = function(err) {\n  debug('_abort', err);\n  this._cleanup();\n  this.aborting = true;\n  this.emit('close', err.code, err.message);\n  this.removeAllListeners();\n};\n\nJsonpReceiver.prototype._cleanup = function() {\n  debug('_cleanup');\n  clearTimeout(this.timeoutId);\n  if (this.script2) {\n    this.script2.parentNode.removeChild(this.script2);\n    this.script2 = null;\n  }\n  if (this.script) {\n    var script = this.script;\n    // Unfortunately, you can't really abort script loading of\n    // the script.\n    script.parentNode.removeChild(script);\n    script.onreadystatechange = script.onerror =\n        script.onload = script.onclick = null;\n    this.script = null;\n  }\n  delete global[utils.WPrefix][this.id];\n};\n\nJsonpReceiver.prototype._scriptError = function() {\n  debug('_scriptError');\n  var self = this;\n  if (this.errorTimer) {\n    return;\n  }\n\n  this.errorTimer = setTimeout(function() {\n    if (!self.loadedOkay) {\n      self._abort(new Error('JSONP script loaded abnormally (onerror)'));\n    }\n  }, JsonpReceiver.scriptErrorTimeout);\n};\n\nJsonpReceiver.prototype._createScript = function(url) {\n  debug('_createScript', url);\n  var self = this;\n  var script = this.script = global.document.createElement('script');\n  var script2;  // Opera synchronous load trick.\n\n  script.id = 'a' + random.string(8);\n  script.src = url;\n  script.type = 'text/javascript';\n  script.charset = 'UTF-8';\n  script.onerror = this._scriptError.bind(this);\n  script.onload = function() {\n    debug('onload');\n    self._abort(new Error('JSONP script loaded abnormally (onload)'));\n  };\n\n  // IE9 fires 'error' event after onreadystatechange or before, in random order.\n  // Use loadedOkay to determine if actually errored\n  script.onreadystatechange = function() {\n    debug('onreadystatechange', script.readyState);\n    if (/loaded|closed/.test(script.readyState)) {\n      if (script && script.htmlFor && script.onclick) {\n        self.loadedOkay = true;\n        try {\n          // In IE, actually execute the script.\n          script.onclick();\n        } catch (x) {\n          // intentionally empty\n        }\n      }\n      if (script) {\n        self._abort(new Error('JSONP script loaded abnormally (onreadystatechange)'));\n      }\n    }\n  };\n  // IE: event/htmlFor/onclick trick.\n  // One can't rely on proper order for onreadystatechange. In order to\n  // make sure, set a 'htmlFor' and 'event' properties, so that\n  // script code will be installed as 'onclick' handler for the\n  // script object. Later, onreadystatechange, manually execute this\n  // code. FF and Chrome doesn't work with 'event' and 'htmlFor'\n  // set. For reference see:\n  //   http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n  // Also, read on that about script ordering:\n  //   http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order\n  if (typeof script.async === 'undefined' && global.document.attachEvent) {\n    // According to mozilla docs, in recent browsers script.async defaults\n    // to 'true', so we may use it to detect a good browser:\n    // https://developer.mozilla.org/en/HTML/Element/script\n    if (!browser.isOpera()) {\n      // Naively assume we're in IE\n      try {\n        script.htmlFor = script.id;\n        script.event = 'onclick';\n      } catch (x) {\n        // intentionally empty\n      }\n      script.async = true;\n    } else {\n      // Opera, second sync script hack\n      script2 = this.script2 = global.document.createElement('script');\n      script2.text = \"try{var a = document.getElementById('\" + script.id + \"'); if(a)a.onerror();}catch(x){};\";\n      script.async = script2.async = false;\n    }\n  }\n  if (typeof script.async !== 'undefined') {\n    script.async = true;\n  }\n\n  var head = global.document.getElementsByTagName('head')[0];\n  head.insertBefore(script, head.firstChild);\n  if (script2) {\n    head.insertBefore(script2, head.firstChild);\n  }\n};\n\nmodule.exports = JsonpReceiver;\n"
  },
  {
    "path": "lib/transport/receiver/xhr.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:receiver:xhr');\n}\n\nfunction XhrReceiver(url, AjaxObject) {\n  debug(url);\n  EventEmitter.call(this);\n  var self = this;\n\n  this.bufferPosition = 0;\n\n  this.xo = new AjaxObject('POST', url, null);\n  this.xo.on('chunk', this._chunkHandler.bind(this));\n  this.xo.once('finish', function(status, text) {\n    debug('finish', status, text);\n    self._chunkHandler(status, text);\n    self.xo = null;\n    var reason = status === 200 ? 'network' : 'permanent';\n    debug('close', reason);\n    self.emit('close', null, reason);\n    self._cleanup();\n  });\n}\n\ninherits(XhrReceiver, EventEmitter);\n\nXhrReceiver.prototype._chunkHandler = function(status, text) {\n  debug('_chunkHandler', status);\n  if (status !== 200 || !text) {\n    return;\n  }\n\n  for (var idx = -1; ; this.bufferPosition += idx + 1) {\n    var buf = text.slice(this.bufferPosition);\n    idx = buf.indexOf('\\n');\n    if (idx === -1) {\n      break;\n    }\n    var msg = buf.slice(0, idx);\n    if (msg) {\n      debug('message', msg);\n      this.emit('message', msg);\n    }\n  }\n};\n\nXhrReceiver.prototype._cleanup = function() {\n  debug('_cleanup');\n  this.removeAllListeners();\n};\n\nXhrReceiver.prototype.abort = function() {\n  debug('abort');\n  if (this.xo) {\n    this.xo.close();\n    debug('close');\n    this.emit('close', null, 'user');\n    this.xo = null;\n  }\n  this._cleanup();\n};\n\nmodule.exports = XhrReceiver;\n"
  },
  {
    "path": "lib/transport/sender/jsonp.js",
    "content": "'use strict';\n\nvar random = require('../../utils/random')\n  , urlUtils = require('../../utils/url')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:sender:jsonp');\n}\n\nvar form, area;\n\nfunction createIframe(id) {\n  debug('createIframe', id);\n  try {\n    // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n    return global.document.createElement('<iframe name=\"' + id + '\">');\n  } catch (x) {\n    var iframe = global.document.createElement('iframe');\n    iframe.name = id;\n    return iframe;\n  }\n}\n\nfunction createForm() {\n  debug('createForm');\n  form = global.document.createElement('form');\n  form.style.display = 'none';\n  form.style.position = 'absolute';\n  form.method = 'POST';\n  form.enctype = 'application/x-www-form-urlencoded';\n  form.acceptCharset = 'UTF-8';\n\n  area = global.document.createElement('textarea');\n  area.name = 'd';\n  form.appendChild(area);\n\n  global.document.body.appendChild(form);\n}\n\nmodule.exports = function(url, payload, callback) {\n  debug(url, payload);\n  if (!form) {\n    createForm();\n  }\n  var id = 'a' + random.string(8);\n  form.target = id;\n  form.action = urlUtils.addQuery(urlUtils.addPath(url, '/jsonp_send'), 'i=' + id);\n\n  var iframe = createIframe(id);\n  iframe.id = id;\n  iframe.style.display = 'none';\n  form.appendChild(iframe);\n\n  try {\n    area.value = payload;\n  } catch (e) {\n    // seriously broken browsers get here\n  }\n  form.submit();\n\n  var completed = function(err) {\n    debug('completed', id, err);\n    if (!iframe.onerror) {\n      return;\n    }\n    iframe.onreadystatechange = iframe.onerror = iframe.onload = null;\n    // Opera mini doesn't like if we GC iframe\n    // immediately, thus this timeout.\n    setTimeout(function() {\n      debug('cleaning up', id);\n      iframe.parentNode.removeChild(iframe);\n      iframe = null;\n    }, 500);\n    area.value = '';\n    // It is not possible to detect if the iframe succeeded or\n    // failed to submit our form.\n    callback(err);\n  };\n  iframe.onerror = function() {\n    debug('onerror', id);\n    completed();\n  };\n  iframe.onload = function() {\n    debug('onload', id);\n    completed();\n  };\n  iframe.onreadystatechange = function(e) {\n    debug('onreadystatechange', id, iframe.readyState, e);\n    if (iframe.readyState === 'complete') {\n      completed();\n    }\n  };\n  return function() {\n    debug('aborted', id);\n    completed(new Error('Aborted'));\n  };\n};\n"
  },
  {
    "path": "lib/transport/sender/xdr.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  , eventUtils = require('../../utils/event')\n  , browser = require('../../utils/browser')\n  , urlUtils = require('../../utils/url')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:sender:xdr');\n}\n\n// References:\n//   http://ajaxian.com/archives/100-line-ajax-wrapper\n//   http://msdn.microsoft.com/en-us/library/cc288060(v=VS.85).aspx\n\nfunction XDRObject(method, url, payload) {\n  debug(method, url);\n  var self = this;\n  EventEmitter.call(this);\n\n  setTimeout(function() {\n    self._start(method, url, payload);\n  }, 0);\n}\n\ninherits(XDRObject, EventEmitter);\n\nXDRObject.prototype._start = function(method, url, payload) {\n  debug('_start');\n  var self = this;\n  var xdr = new global.XDomainRequest();\n  // IE caches even POSTs\n  url = urlUtils.addQuery(url, 't=' + (+new Date()));\n\n  xdr.onerror = function() {\n    debug('onerror');\n    self._error();\n  };\n  xdr.ontimeout = function() {\n    debug('ontimeout');\n    self._error();\n  };\n  xdr.onprogress = function() {\n    debug('progress', xdr.responseText);\n    self.emit('chunk', 200, xdr.responseText);\n  };\n  xdr.onload = function() {\n    debug('load');\n    self.emit('finish', 200, xdr.responseText);\n    self._cleanup(false);\n  };\n  this.xdr = xdr;\n  this.unloadRef = eventUtils.unloadAdd(function() {\n    self._cleanup(true);\n  });\n  try {\n    // Fails with AccessDenied if port number is bogus\n    this.xdr.open(method, url);\n    if (this.timeout) {\n      this.xdr.timeout = this.timeout;\n    }\n    this.xdr.send(payload);\n  } catch (x) {\n    this._error();\n  }\n};\n\nXDRObject.prototype._error = function() {\n  this.emit('finish', 0, '');\n  this._cleanup(false);\n};\n\nXDRObject.prototype._cleanup = function(abort) {\n  debug('cleanup', abort);\n  if (!this.xdr) {\n    return;\n  }\n  this.removeAllListeners();\n  eventUtils.unloadDel(this.unloadRef);\n\n  this.xdr.ontimeout = this.xdr.onerror = this.xdr.onprogress = this.xdr.onload = null;\n  if (abort) {\n    try {\n      this.xdr.abort();\n    } catch (x) {\n      // intentionally empty\n    }\n  }\n  this.unloadRef = this.xdr = null;\n};\n\nXDRObject.prototype.close = function() {\n  debug('close');\n  this._cleanup(true);\n};\n\n// IE 8/9 if the request target uses the same scheme - #79\nXDRObject.enabled = !!(global.XDomainRequest && browser.hasDomain());\n\nmodule.exports = XDRObject;\n"
  },
  {
    "path": "lib/transport/sender/xhr-cors.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , XhrDriver = require('../driver/xhr')\n  ;\n\nfunction XHRCorsObject(method, url, payload, opts) {\n  XhrDriver.call(this, method, url, payload, opts);\n}\n\ninherits(XHRCorsObject, XhrDriver);\n\nXHRCorsObject.enabled = XhrDriver.enabled && XhrDriver.supportsCORS;\n\nmodule.exports = XHRCorsObject;\n"
  },
  {
    "path": "lib/transport/sender/xhr-fake.js",
    "content": "'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n  , inherits = require('inherits')\n  ;\n\nfunction XHRFake(/* method, url, payload, opts */) {\n  var self = this;\n  EventEmitter.call(this);\n\n  this.to = setTimeout(function() {\n    self.emit('finish', 200, '{}');\n  }, XHRFake.timeout);\n}\n\ninherits(XHRFake, EventEmitter);\n\nXHRFake.prototype.close = function() {\n  clearTimeout(this.to);\n};\n\nXHRFake.timeout = 2000;\n\nmodule.exports = XHRFake;\n"
  },
  {
    "path": "lib/transport/sender/xhr-local.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , XhrDriver = require('../driver/xhr')\n  ;\n\nfunction XHRLocalObject(method, url, payload /*, opts */) {\n  XhrDriver.call(this, method, url, payload, {\n    noCredentials: true\n  });\n}\n\ninherits(XHRLocalObject, XhrDriver);\n\nXHRLocalObject.enabled = XhrDriver.enabled;\n\nmodule.exports = XHRLocalObject;\n"
  },
  {
    "path": "lib/transport/websocket.js",
    "content": "'use strict';\n\nvar utils = require('../utils/event')\n  , urlUtils = require('../utils/url')\n  , inherits = require('inherits')\n  , EventEmitter = require('events').EventEmitter\n  , WebsocketDriver = require('./driver/websocket')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:websocket');\n}\n\nfunction WebSocketTransport(transUrl, ignore, options) {\n  if (!WebSocketTransport.enabled()) {\n    throw new Error('Transport created when disabled');\n  }\n\n  EventEmitter.call(this);\n  debug('constructor', transUrl);\n\n  var self = this;\n  var url = urlUtils.addPath(transUrl, '/websocket');\n  if (url.slice(0, 5) === 'https') {\n    url = 'wss' + url.slice(5);\n  } else {\n    url = 'ws' + url.slice(4);\n  }\n  this.url = url;\n\n  this.ws = new WebsocketDriver(this.url, [], options);\n  this.ws.onmessage = function(e) {\n    debug('message event', e.data);\n    self.emit('message', e.data);\n  };\n  // Firefox has an interesting bug. If a websocket connection is\n  // created after onunload, it stays alive even when user\n  // navigates away from the page. In such situation let's lie -\n  // let's not open the ws connection at all. See:\n  // https://github.com/sockjs/sockjs-client/issues/28\n  // https://bugzilla.mozilla.org/show_bug.cgi?id=696085\n  this.unloadRef = utils.unloadAdd(function() {\n    debug('unload');\n    self.ws.close();\n  });\n  this.ws.onclose = function(e) {\n    debug('close event', e.code, e.reason);\n    self.emit('close', e.code, e.reason);\n    self._cleanup();\n  };\n  this.ws.onerror = function(e) {\n    debug('error event', e);\n    self.emit('close', 1006, 'WebSocket connection broken');\n    self._cleanup();\n  };\n}\n\ninherits(WebSocketTransport, EventEmitter);\n\nWebSocketTransport.prototype.send = function(data) {\n  var msg = '[' + data + ']';\n  debug('send', msg);\n  this.ws.send(msg);\n};\n\nWebSocketTransport.prototype.close = function() {\n  debug('close');\n  var ws = this.ws;\n  this._cleanup();\n  if (ws) {\n    ws.close();\n  }\n};\n\nWebSocketTransport.prototype._cleanup = function() {\n  debug('_cleanup');\n  var ws = this.ws;\n  if (ws) {\n    ws.onmessage = ws.onclose = ws.onerror = null;\n  }\n  utils.unloadDel(this.unloadRef);\n  this.unloadRef = this.ws = null;\n  this.removeAllListeners();\n};\n\nWebSocketTransport.enabled = function() {\n  debug('enabled');\n  return !!WebsocketDriver;\n};\nWebSocketTransport.transportName = 'websocket';\n\n// In theory, ws should require 1 round trip. But in chrome, this is\n// not very stable over SSL. Most likely a ws connection requires a\n// separate SSL connection, in which case 2 round trips are an\n// absolute minumum.\nWebSocketTransport.roundTrips = 2;\n\nmodule.exports = WebSocketTransport;\n"
  },
  {
    "path": "lib/transport/xdr-polling.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , AjaxBasedTransport = require('./lib/ajax-based')\n  , XdrStreamingTransport = require('./xdr-streaming')\n  , XhrReceiver = require('./receiver/xhr')\n  , XDRObject = require('./sender/xdr')\n  ;\n\nfunction XdrPollingTransport(transUrl) {\n  if (!XDRObject.enabled) {\n    throw new Error('Transport created when disabled');\n  }\n  AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XDRObject);\n}\n\ninherits(XdrPollingTransport, AjaxBasedTransport);\n\nXdrPollingTransport.enabled = XdrStreamingTransport.enabled;\nXdrPollingTransport.transportName = 'xdr-polling';\nXdrPollingTransport.roundTrips = 2; // preflight, ajax\n\nmodule.exports = XdrPollingTransport;\n"
  },
  {
    "path": "lib/transport/xdr-streaming.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , AjaxBasedTransport = require('./lib/ajax-based')\n  , XhrReceiver = require('./receiver/xhr')\n  , XDRObject = require('./sender/xdr')\n  ;\n\n// According to:\n//   http://stackoverflow.com/questions/1641507/detect-browser-support-for-cross-domain-xmlhttprequests\n//   http://hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/\n\nfunction XdrStreamingTransport(transUrl) {\n  if (!XDRObject.enabled) {\n    throw new Error('Transport created when disabled');\n  }\n  AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XDRObject);\n}\n\ninherits(XdrStreamingTransport, AjaxBasedTransport);\n\nXdrStreamingTransport.enabled = function(info) {\n  if (info.cookie_needed || info.nullOrigin) {\n    return false;\n  }\n  return XDRObject.enabled && info.sameScheme;\n};\n\nXdrStreamingTransport.transportName = 'xdr-streaming';\nXdrStreamingTransport.roundTrips = 2; // preflight, ajax\n\nmodule.exports = XdrStreamingTransport;\n"
  },
  {
    "path": "lib/transport/xhr-polling.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , AjaxBasedTransport = require('./lib/ajax-based')\n  , XhrReceiver = require('./receiver/xhr')\n  , XHRCorsObject = require('./sender/xhr-cors')\n  , XHRLocalObject = require('./sender/xhr-local')\n  ;\n\nfunction XhrPollingTransport(transUrl) {\n  if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {\n    throw new Error('Transport created when disabled');\n  }\n  AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XHRCorsObject);\n}\n\ninherits(XhrPollingTransport, AjaxBasedTransport);\n\nXhrPollingTransport.enabled = function(info) {\n  if (info.nullOrigin) {\n    return false;\n  }\n\n  if (XHRLocalObject.enabled && info.sameOrigin) {\n    return true;\n  }\n  return XHRCorsObject.enabled;\n};\n\nXhrPollingTransport.transportName = 'xhr-polling';\nXhrPollingTransport.roundTrips = 2; // preflight, ajax\n\nmodule.exports = XhrPollingTransport;\n"
  },
  {
    "path": "lib/transport/xhr-streaming.js",
    "content": "'use strict';\n\nvar inherits = require('inherits')\n  , AjaxBasedTransport = require('./lib/ajax-based')\n  , XhrReceiver = require('./receiver/xhr')\n  , XHRCorsObject = require('./sender/xhr-cors')\n  , XHRLocalObject = require('./sender/xhr-local')\n  , browser = require('../utils/browser')\n  ;\n\nfunction XhrStreamingTransport(transUrl) {\n  if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {\n    throw new Error('Transport created when disabled');\n  }\n  AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XHRCorsObject);\n}\n\ninherits(XhrStreamingTransport, AjaxBasedTransport);\n\nXhrStreamingTransport.enabled = function(info) {\n  if (info.nullOrigin) {\n    return false;\n  }\n  // Opera doesn't support xhr-streaming #60\n  // But it might be able to #92\n  if (browser.isOpera()) {\n    return false;\n  }\n\n  return XHRCorsObject.enabled;\n};\n\nXhrStreamingTransport.transportName = 'xhr-streaming';\nXhrStreamingTransport.roundTrips = 2; // preflight, ajax\n\n// Safari gets confused when a streaming ajax request is started\n// before onload. This causes the load indicator to spin indefinetely.\n// Only require body when used in a browser\nXhrStreamingTransport.needBody = !!global.document;\n\nmodule.exports = XhrStreamingTransport;\n"
  },
  {
    "path": "lib/transport-list.js",
    "content": "'use strict';\n\nmodule.exports = [\n  // streaming transports\n  require('./transport/websocket')\n, require('./transport/xhr-streaming')\n, require('./transport/xdr-streaming')\n, require('./transport/eventsource')\n, require('./transport/lib/iframe-wrap')(require('./transport/eventsource'))\n\n  // polling transports\n, require('./transport/htmlfile')\n, require('./transport/lib/iframe-wrap')(require('./transport/htmlfile'))\n, require('./transport/xhr-polling')\n, require('./transport/xdr-polling')\n, require('./transport/lib/iframe-wrap')(require('./transport/xhr-polling'))\n, require('./transport/jsonp-polling')\n];\n"
  },
  {
    "path": "lib/utils/browser-crypto.js",
    "content": "'use strict';\n\nif (global.crypto && global.crypto.getRandomValues) {\n  module.exports.randomBytes = function(length) {\n    var bytes = new Uint8Array(length);\n    global.crypto.getRandomValues(bytes);\n    return bytes;\n  };\n} else {\n  module.exports.randomBytes = function(length) {\n    var bytes = new Array(length);\n    for (var i = 0; i < length; i++) {\n      bytes[i] = Math.floor(Math.random() * 256);\n    }\n    return bytes;\n  };\n}\n"
  },
  {
    "path": "lib/utils/browser.js",
    "content": "'use strict';\n\nmodule.exports = {\n  isOpera: function() {\n    return global.navigator &&\n      /opera/i.test(global.navigator.userAgent);\n  }\n\n, isKonqueror: function() {\n    return global.navigator &&\n      /konqueror/i.test(global.navigator.userAgent);\n  }\n\n  // #187 wrap document.domain in try/catch because of WP8 from file:///\n, hasDomain: function () {\n    // non-browser client always has a domain\n    if (!global.document) {\n      return true;\n    }\n\n    try {\n      return !!global.document.domain;\n    } catch (e) {\n      return false;\n    }\n  }\n};\n"
  },
  {
    "path": "lib/utils/escape.js",
    "content": "'use strict';\n\n// Some extra characters that Chrome gets wrong, and substitutes with\n// something else on the wire.\n// eslint-disable-next-line no-control-regex, no-misleading-character-class\nvar extraEscapable = /[\\x00-\\x1f\\ud800-\\udfff\\ufffe\\uffff\\u0300-\\u0333\\u033d-\\u0346\\u034a-\\u034c\\u0350-\\u0352\\u0357-\\u0358\\u035c-\\u0362\\u0374\\u037e\\u0387\\u0591-\\u05af\\u05c4\\u0610-\\u0617\\u0653-\\u0654\\u0657-\\u065b\\u065d-\\u065e\\u06df-\\u06e2\\u06eb-\\u06ec\\u0730\\u0732-\\u0733\\u0735-\\u0736\\u073a\\u073d\\u073f-\\u0741\\u0743\\u0745\\u0747\\u07eb-\\u07f1\\u0951\\u0958-\\u095f\\u09dc-\\u09dd\\u09df\\u0a33\\u0a36\\u0a59-\\u0a5b\\u0a5e\\u0b5c-\\u0b5d\\u0e38-\\u0e39\\u0f43\\u0f4d\\u0f52\\u0f57\\u0f5c\\u0f69\\u0f72-\\u0f76\\u0f78\\u0f80-\\u0f83\\u0f93\\u0f9d\\u0fa2\\u0fa7\\u0fac\\u0fb9\\u1939-\\u193a\\u1a17\\u1b6b\\u1cda-\\u1cdb\\u1dc0-\\u1dcf\\u1dfc\\u1dfe\\u1f71\\u1f73\\u1f75\\u1f77\\u1f79\\u1f7b\\u1f7d\\u1fbb\\u1fbe\\u1fc9\\u1fcb\\u1fd3\\u1fdb\\u1fe3\\u1feb\\u1fee-\\u1fef\\u1ff9\\u1ffb\\u1ffd\\u2000-\\u2001\\u20d0-\\u20d1\\u20d4-\\u20d7\\u20e7-\\u20e9\\u2126\\u212a-\\u212b\\u2329-\\u232a\\u2adc\\u302b-\\u302c\\uaab2-\\uaab3\\uf900-\\ufa0d\\ufa10\\ufa12\\ufa15-\\ufa1e\\ufa20\\ufa22\\ufa25-\\ufa26\\ufa2a-\\ufa2d\\ufa30-\\ufa6d\\ufa70-\\ufad9\\ufb1d\\ufb1f\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4e\\ufff0-\\uffff]/g\n  , extraLookup;\n\n// This may be quite slow, so let's delay until user actually uses bad\n// characters.\nvar unrollLookup = function(escapable) {\n  var i;\n  var unrolled = {};\n  var c = [];\n  for (i = 0; i < 65536; i++) {\n    c.push( String.fromCharCode(i) );\n  }\n  escapable.lastIndex = 0;\n  c.join('').replace(escapable, function(a) {\n    unrolled[ a ] = '\\\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\n    return '';\n  });\n  escapable.lastIndex = 0;\n  return unrolled;\n};\n\n// Quote string, also taking care of unicode characters that browsers\n// often break. Especially, take care of unicode surrogates:\n// http://en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Surrogates\nmodule.exports = {\n  quote: function(string) {\n    var quoted = JSON.stringify(string);\n\n    // In most cases this should be very fast and good enough.\n    extraEscapable.lastIndex = 0;\n    if (!extraEscapable.test(quoted)) {\n      return quoted;\n    }\n\n    if (!extraLookup) {\n      extraLookup = unrollLookup(extraEscapable);\n    }\n\n    return quoted.replace(extraEscapable, function(a) {\n      return extraLookup[a];\n    });\n  }\n};\n"
  },
  {
    "path": "lib/utils/event.js",
    "content": "'use strict';\n\nvar random = require('./random');\n\nvar onUnload = {}\n  , afterUnload = false\n    // detect google chrome packaged apps because they don't allow the 'unload' event\n  , isChromePackagedApp = global.chrome && global.chrome.app && global.chrome.app.runtime\n  ;\n\nmodule.exports = {\n  attachEvent: function(event, listener) {\n    if (typeof global.addEventListener !== 'undefined') {\n      global.addEventListener(event, listener, false);\n    } else if (global.document && global.attachEvent) {\n      // IE quirks.\n      // According to: http://stevesouders.com/misc/test-postmessage.php\n      // the message gets delivered only to 'document', not 'window'.\n      global.document.attachEvent('on' + event, listener);\n      // I get 'window' for ie8.\n      global.attachEvent('on' + event, listener);\n    }\n  }\n\n, detachEvent: function(event, listener) {\n    if (typeof global.addEventListener !== 'undefined') {\n      global.removeEventListener(event, listener, false);\n    } else if (global.document && global.detachEvent) {\n      global.document.detachEvent('on' + event, listener);\n      global.detachEvent('on' + event, listener);\n    }\n  }\n\n, unloadAdd: function(listener) {\n    if (isChromePackagedApp) {\n      return null;\n    }\n\n    var ref = random.string(8);\n    onUnload[ref] = listener;\n    if (afterUnload) {\n      setTimeout(this.triggerUnloadCallbacks, 0);\n    }\n    return ref;\n  }\n\n, unloadDel: function(ref) {\n    if (ref in onUnload) {\n      delete onUnload[ref];\n    }\n  }\n\n, triggerUnloadCallbacks: function() {\n    for (var ref in onUnload) {\n      onUnload[ref]();\n      delete onUnload[ref];\n    }\n  }\n};\n\nvar unloadTriggered = function() {\n  if (afterUnload) {\n    return;\n  }\n  afterUnload = true;\n  module.exports.triggerUnloadCallbacks();\n};\nvar pagehide = function (e) {\n  // Avoid the bfcache case\n  if (!e.persisted) unloadTriggered();\n};\n\n// 'unload' alone is not reliable in opera within an iframe, but we\n// can't use `beforeunload` as IE fires it on javascript: links.\nif (!isChromePackagedApp) {\n  if (\"onpagehide\" in global) {\n    // In the future, unload will no longer be supported; use pagehide instead of unload.\n    module.exports.attachEvent('pagehide', pagehide);\n  } else {\n    module.exports.attachEvent('unload', unloadTriggered);\n  }\n}\n"
  },
  {
    "path": "lib/utils/iframe.js",
    "content": "'use strict';\n\nvar eventUtils = require('./event')\n  , browser = require('./browser')\n  ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:utils:iframe');\n}\n\nmodule.exports = {\n  WPrefix: '_jp'\n, currentWindowId: null\n\n, polluteGlobalNamespace: function() {\n    if (!(module.exports.WPrefix in global)) {\n      global[module.exports.WPrefix] = {};\n    }\n  }\n\n, postMessage: function(type, data) {\n    if (global.parent !== global) {\n      global.parent.postMessage(JSON.stringify({\n        windowId: module.exports.currentWindowId\n      , type: type\n      , data: data || ''\n      }), '*');\n    } else {\n      debug('Cannot postMessage, no parent window.', type, data);\n    }\n  }\n\n, createIframe: function(iframeUrl, errorCallback) {\n    var iframe = global.document.createElement('iframe');\n    var tref, unloadRef;\n    var unattach = function() {\n      debug('unattach');\n      clearTimeout(tref);\n      // Explorer had problems with that.\n      try {\n        iframe.onload = null;\n      } catch (x) {\n        // intentionally empty\n      }\n      iframe.onerror = null;\n    };\n    var cleanup = function() {\n      debug('cleanup');\n      if (iframe) {\n        unattach();\n        // This timeout makes chrome fire onbeforeunload event\n        // within iframe. Without the timeout it goes straight to\n        // onunload.\n        setTimeout(function() {\n          if (iframe) {\n            iframe.parentNode.removeChild(iframe);\n          }\n          iframe = null;\n        }, 0);\n        eventUtils.unloadDel(unloadRef);\n      }\n    };\n    var onerror = function(err) {\n      debug('onerror', err);\n      if (iframe) {\n        cleanup();\n        errorCallback(err);\n      }\n    };\n    var post = function(msg, origin) {\n      debug('post', msg, origin);\n      setTimeout(function() {\n        try {\n          // When the iframe is not loaded, IE raises an exception\n          // on 'contentWindow'.\n          if (iframe && iframe.contentWindow) {\n            iframe.contentWindow.postMessage(msg, origin);\n          }\n        } catch (x) {\n          // intentionally empty\n        }\n      }, 0);\n    };\n\n    iframe.src = iframeUrl;\n    iframe.style.display = 'none';\n    iframe.style.position = 'absolute';\n    iframe.onerror = function() {\n      onerror('onerror');\n    };\n    iframe.onload = function() {\n      debug('onload');\n      // `onload` is triggered before scripts on the iframe are\n      // executed. Give it few seconds to actually load stuff.\n      clearTimeout(tref);\n      tref = setTimeout(function() {\n        onerror('onload timeout');\n      }, 2000);\n    };\n    global.document.body.appendChild(iframe);\n    tref = setTimeout(function() {\n      onerror('timeout');\n    }, 15000);\n    unloadRef = eventUtils.unloadAdd(cleanup);\n    return {\n      post: post\n    , cleanup: cleanup\n    , loaded: unattach\n    };\n  }\n\n/* eslint no-undef: \"off\", new-cap: \"off\" */\n, createHtmlfile: function(iframeUrl, errorCallback) {\n    var axo = ['Active'].concat('Object').join('X');\n    var doc = new global[axo]('htmlfile');\n    var tref, unloadRef;\n    var iframe;\n    var unattach = function() {\n      clearTimeout(tref);\n      iframe.onerror = null;\n    };\n    var cleanup = function() {\n      if (doc) {\n        unattach();\n        eventUtils.unloadDel(unloadRef);\n        iframe.parentNode.removeChild(iframe);\n        iframe = doc = null;\n        CollectGarbage();\n      }\n    };\n    var onerror = function(r) {\n      debug('onerror', r);\n      if (doc) {\n        cleanup();\n        errorCallback(r);\n      }\n    };\n    var post = function(msg, origin) {\n      try {\n        // When the iframe is not loaded, IE raises an exception\n        // on 'contentWindow'.\n        setTimeout(function() {\n          if (iframe && iframe.contentWindow) {\n              iframe.contentWindow.postMessage(msg, origin);\n          }\n        }, 0);\n      } catch (x) {\n        // intentionally empty\n      }\n    };\n\n    doc.open();\n    doc.write('<html><s' + 'cript>' +\n              'document.domain=\"' + global.document.domain + '\";' +\n              '</s' + 'cript></html>');\n    doc.close();\n    doc.parentWindow[module.exports.WPrefix] = global[module.exports.WPrefix];\n    var c = doc.createElement('div');\n    doc.body.appendChild(c);\n    iframe = doc.createElement('iframe');\n    c.appendChild(iframe);\n    iframe.src = iframeUrl;\n    iframe.onerror = function() {\n      onerror('onerror');\n    };\n    tref = setTimeout(function() {\n      onerror('timeout');\n    }, 15000);\n    unloadRef = eventUtils.unloadAdd(cleanup);\n    return {\n      post: post\n    , cleanup: cleanup\n    , loaded: unattach\n    };\n  }\n};\n\nmodule.exports.iframeEnabled = false;\nif (global.document) {\n  // postMessage misbehaves in konqueror 4.6.5 - the messages are delivered with\n  // huge delay, or not at all.\n  module.exports.iframeEnabled = (typeof global.postMessage === 'function' ||\n    typeof global.postMessage === 'object') && (!browser.isKonqueror());\n}\n"
  },
  {
    "path": "lib/utils/log.js",
    "content": "'use strict';\n\nvar logObject = {};\n['log', 'debug', 'warn'].forEach(function (level) {\n  var levelExists;\n\n  try {\n    levelExists = global.console && global.console[level] && global.console[level].apply;\n  } catch(e) {\n    // do nothing\n  }\n\n  logObject[level] = levelExists ? function () {\n    return global.console[level].apply(global.console, arguments);\n  } : (level === 'log' ? function () {} : logObject.log);\n});\n\nmodule.exports = logObject;\n"
  },
  {
    "path": "lib/utils/object.js",
    "content": "'use strict';\n\nmodule.exports = {\n  isObject: function(obj) {\n    var type = typeof obj;\n    return type === 'function' || type === 'object' && !!obj;\n  }\n\n, extend: function(obj) {\n    if (!this.isObject(obj)) {\n      return obj;\n    }\n    var source, prop;\n    for (var i = 1, length = arguments.length; i < length; i++) {\n      source = arguments[i];\n      for (prop in source) {\n        if (Object.prototype.hasOwnProperty.call(source, prop)) {\n          obj[prop] = source[prop];\n        }\n      }\n    }\n    return obj;\n  }\n};\n"
  },
  {
    "path": "lib/utils/random.js",
    "content": "'use strict';\n\nvar crypto = require('crypto');\n\n// This string has length 32, a power of 2, so the modulus doesn't introduce a\n// bias.\nvar _randomStringChars = 'abcdefghijklmnopqrstuvwxyz012345';\nmodule.exports = {\n  string: function(length) {\n    var max = _randomStringChars.length;\n    var bytes = crypto.randomBytes(length);\n    var ret = [];\n    for (var i = 0; i < length; i++) {\n      ret.push(_randomStringChars.substr(bytes[i] % max, 1));\n    }\n    return ret.join('');\n  }\n\n, number: function(max) {\n    return Math.floor(Math.random() * max);\n  }\n\n, numberString: function(max) {\n    var t = ('' + (max - 1)).length;\n    var p = new Array(t + 1).join('0');\n    return (p + this.number(max)).slice(-t);\n  }\n};\n"
  },
  {
    "path": "lib/utils/transport.js",
    "content": "'use strict';\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:utils:transport');\n}\n\nmodule.exports = function(availableTransports) {\n  return {\n    filterToEnabled: function(transportsWhitelist, info) {\n      var transports = {\n        main: []\n      , facade: []\n      };\n      if (!transportsWhitelist) {\n        transportsWhitelist = [];\n      } else if (typeof transportsWhitelist === 'string') {\n        transportsWhitelist = [transportsWhitelist];\n      }\n\n      availableTransports.forEach(function(trans) {\n        if (!trans) {\n          return;\n        }\n\n        if (trans.transportName === 'websocket' && info.websocket === false) {\n          debug('disabled from server', 'websocket');\n          return;\n        }\n\n        if (transportsWhitelist.length &&\n            transportsWhitelist.indexOf(trans.transportName) === -1) {\n          debug('not in whitelist', trans.transportName);\n          return;\n        }\n\n        if (trans.enabled(info)) {\n          debug('enabled', trans.transportName);\n          transports.main.push(trans);\n          if (trans.facadeTransport) {\n            transports.facade.push(trans.facadeTransport);\n          }\n        } else {\n          debug('disabled', trans.transportName);\n        }\n      });\n      return transports;\n    }\n  };\n};\n"
  },
  {
    "path": "lib/utils/url.js",
    "content": "'use strict';\n\nvar URL = require('url-parse');\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n  debug = require('debug')('sockjs-client:utils:url');\n}\n\nmodule.exports = {\n  getOrigin: function(url) {\n    if (!url) {\n      return null;\n    }\n\n    var p = new URL(url);\n    if (p.protocol === 'file:') {\n      return null;\n    }\n\n    var port = p.port;\n    if (!port) {\n      port = (p.protocol === 'https:') ? '443' : '80';\n    }\n\n    return p.protocol + '//' + p.hostname + ':' + port;\n  }\n\n, isOriginEqual: function(a, b) {\n    var res = this.getOrigin(a) === this.getOrigin(b);\n    debug('same', a, b, res);\n    return res;\n  }\n\n, isSchemeEqual: function(a, b) {\n    return (a.split(':')[0] === b.split(':')[0]);\n  }\n\n, addPath: function (url, path) {\n    var qs = url.split('?');\n    return qs[0] + path + (qs[1] ? '?' + qs[1] : '');\n  }\n\n, addQuery: function (url, q) {\n    return url + (url.indexOf('?') === -1 ? ('?' + q) : ('&' + q));\n  }\n\n, isLoopbackAddr: function (addr) {\n    return /^127\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})$/i.test(addr) || /^\\[::1\\]$/.test(addr);\n  }\n};\n"
  },
  {
    "path": "lib/version.js",
    "content": "module.exports = '1.6.1';\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"sockjs-client\",\n  \"description\": \"SockJS-client is a browser JavaScript library that provides a WebSocket-like object.\",\n  \"version\": \"1.6.2\",\n  \"author\": \"Bryce Kahle\",\n  \"jsdelivr\": \"dist/sockjs.min.js\",\n  \"engines\": {\n    \"node\": \">=12\"\n  },\n  \"funding\": \"https://tidelift.com/funding/github/npm/sockjs-client\",\n  \"browser\": {\n    \"./lib/transport/driver/websocket.js\": \"./lib/transport/browser/websocket.js\",\n    \"eventsource\": \"./lib/transport/browser/eventsource.js\",\n    \"./lib/transport/driver/xhr.js\": \"./lib/transport/browser/abstract-xhr.js\",\n    \"crypto\": \"./lib/utils/browser-crypto.js\",\n    \"events\": \"./lib/event/emitter.js\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/sockjs/sockjs-client/issues\"\n  },\n  \"contributors\": [\n    {\n      \"name\": \"Bryce Kahle\",\n      \"email\": \"bkahle@gmail.com\"\n    },\n    {\n      \"name\": \"Marek Majkowski\",\n      \"email\": \"deadbeef@popcount.org\"\n    }\n  ],\n  \"dependencies\": {\n    \"debug\": \"^3.2.7\",\n    \"eventsource\": \"^2.0.2\",\n    \"faye-websocket\": \"^0.11.4\",\n    \"inherits\": \"^2.0.4\",\n    \"url-parse\": \"^1.5.10\"\n  },\n  \"devDependencies\": {\n    \"browserify\": \"^17.0.0\",\n    \"envify\": \"^4.0.0\",\n    \"esbuild\": \"^0.25.0\",\n    \"eslint\": \"^8.10.0\",\n    \"expect.js\": \"~0.3.1\",\n    \"gulp\": \"^5.0.0\",\n    \"gulp-header\": \"^1.8.9\",\n    \"gulp-rename\": \"^2.0.0\",\n    \"gulp-replace\": \"^1.1.3\",\n    \"gulp-sourcemaps\": \"^2.6.5\",\n    \"gulp-uglify\": \"^3.0.2\",\n    \"karma\": \"^6.3.16\",\n    \"karma-browserify\": \"^8.1.0\",\n    \"karma-browserstack-launcher\": \"^1.6.0\",\n    \"karma-chrome-launcher\": \"^3.1.0\",\n    \"karma-mocha\": \"^2.0.1\",\n    \"mocha\": \"^11.1.0\",\n    \"proxyquire\": \"^2.1.3\",\n    \"pump\": \"^3.0.0\",\n    \"serve-static\": \"^1.14.2\",\n    \"sockjs\": \"^0.3.24\",\n    \"vinyl-buffer\": \"~1.0.0\",\n    \"vinyl-source-stream\": \"^2.0.0\"\n  },\n  \"homepage\": \"http://sockjs.org\",\n  \"keywords\": [\n    \"websockets\",\n    \"websocket\"\n  ],\n  \"license\": \"MIT\",\n  \"main\": \"./lib/entry.js\",\n  \"types\": \"./dist/sockjs.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/sockjs/sockjs-client.git\"\n  },\n  \"scripts\": {\n    \"test\": \"mocha tests/node.js\",\n    \"test:bundle\": \"gulp testbundle\",\n    \"test:browser_local\": \"npm run test:bundle && npx karma start --browsers Chrome\",\n    \"test:browser_remote\": \"npm run test:bundle && npx karma start\",\n    \"gulp\": \"gulp\",\n    \"lint\": \"eslint .\",\n    \"build\": \"esbuild dist/sockjs.js --bundle --format=esm --outfile=dist/sockjs-esm.js\",\n    \"version\": \"gulp release && git add -A dist lib/version.js Changelog.md\",\n    \"postversion\": \"npm publish\",\n    \"postpublish\": \"git push origin --all && git push origin --tags\"\n  }\n}\n"
  },
  {
    "path": "tests/.eslintrc",
    "content": "{\n  \"env\": {\n    \"mocha\": true\n  }\n}\n"
  },
  {
    "path": "tests/browser.js",
    "content": "'use strict';\n\nrequire('../lib/shims');\n\n// prevent global leak warnings on this\nglobal._jp = {};\n/* eslint-disable camelcase */\nglobal._sockjs_global = null;\n/* eslint-enable camelcase */\n\nrequire('./lib/main');\nrequire('./lib/utils');\nrequire('./lib/receivers');\nrequire('./lib/senders');\nrequire('./lib/end-to-end');\nrequire('./lib/iframe');\nrequire('./lib/transports');\n"
  },
  {
    "path": "tests/browser_targets.js",
    "content": "module.exports = {\n  bs_chrome_windows: {\n    base: 'BrowserStack',\n    browser: 'chrome',\n    browser_version: '69.0',\n    os: 'Windows',\n    os_version: '10'\n  },\n  bs_edge_windows: {\n    base: 'BrowserStack',\n    browser: 'edge',\n    browser_version: '17.0',\n    os: 'Windows',\n    os_version: '10'\n  },\n  bs_ie_11_windows: {\n    base: 'BrowserStack',\n    browser: 'ie',\n    browser_version: '11.0',\n    os: 'Windows',\n    os_version: '10'\n  },\n  // bs_ie_10_windows: {\n  //   base: 'BrowserStack',\n  //   browser: 'ie',\n  //   browser_version: '10.0',\n  //   os: 'Windows',\n  //   os_version: '8'\n  // },\n  // bs_ie_9_windows: {\n  //   base: 'BrowserStack',\n  //   browser: 'ie',\n  //   browser_version: '9.0',\n  //   os: 'Windows',\n  //   os_version: '7'\n  // },\n  // bs_ie_8_windows: {\n  //   base: 'BrowserStack',\n  //   browser: 'ie',\n  //   browser_version: '8.0',\n  //   os: 'Windows',\n  //   os_version: '7'\n  // },\n  bs_firefox_mac: {\n    base: 'BrowserStack',\n    browser: 'firefox',\n    browser_version: '62.0',\n    os: 'OS X',\n    os_version: 'High Sierra'\n  },\n  bs_safari_11_mac: {\n    base: 'BrowserStack',\n    browser: 'safari',\n    browser_version: '11.1',\n    os: 'OS X',\n    os_version: 'High Sierra'\n  },\n  // bs_safari_10_mac: {\n  //   base: 'BrowserStack',\n  //   browser: 'safari',\n  //   browser_version: '10.1',\n  //   os: 'OS X',\n  //   os_version: 'Sierra'\n  // },\n  // bs_safari_9_mac: {\n  //   base: 'BrowserStack',\n  //   browser: 'safari',\n  //   browser_version: '9.1',\n  //   os: 'OS X',\n  //   os_version: 'El Capitan'\n  // },\n  // bs_safari_8_mac: {\n  //   base: 'BrowserStack',\n  //   browser: 'safari',\n  //   browser_version: '8.0',\n  //   os: 'OS X',\n  //   os_version: 'Yosemite'\n  // },\n  // bs_safari_7_mac: {\n  //   base: 'BrowserStack',\n  //   browser: 'safari',\n  //   browser_version: '7.0',\n  //   os: 'OS X',\n  //   os_version: 'Mavericks'\n  // },\n  // bs_safari_6_mac: {\n  //   base: 'BrowserStack',\n  //   browser: 'safari',\n  //   browser_version: '6.0',\n  //   os: 'OS X',\n  //   os_version: 'Mountain Lion'\n  // },\n  bs_ios_11: {\n    base: 'BrowserStack',\n    browser: 'iphone',\n    browser_version: null,\n    os: 'ios',\n    os_version: '11.4',\n    device: 'iPhone 6S',\n    real_mobile: true\n  },\n  // bs_ios_10: {\n  //   base: 'BrowserStack',\n  //   browser: 'iphone',\n  //   browser_version: null,\n  //   os: 'ios',\n  //   os_version: '10.3',\n  //   device: 'iPhone 7',\n  //   real_mobile: true\n  // },\n  bs_android_9: {\n    base: 'BrowserStack',\n    browser: 'android',\n    browser_version: null,\n    os: 'android',\n    os_version: '9.0',\n    device: 'Google Pixel 2',\n    real_mobile: true\n  },\n  // bs_android_8: {\n  //   base: 'BrowserStack',\n  //   browser: 'android',\n  //   browser_version: null,\n  //   os: 'android',\n  //   os_version: '8.0',\n  //   device: 'Samsung Galaxy S9',\n  //   real_mobile: true\n  // },\n  // bs_android_7_1: {\n  //   base: 'BrowserStack',\n  //   browser: 'android',\n  //   browser_version: null,\n  //   os: 'android',\n  //   os_version: '7.1',\n  //   device: 'Samsung Galaxy Note 8',\n  //   real_mobile: true\n  // },\n  // bs_android_6: {\n  //   base: 'BrowserStack',\n  //   browser: 'android',\n  //   browser_version: null,\n  //   os: 'android',\n  //   os_version: '6.0',\n  //   device: 'Samsung Galaxy S7',\n  //   real_mobile: true\n  // }\n};\n"
  },
  {
    "path": "tests/html/example-cursors.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta charset=\"UTF-8\" />\n\n  <link href=\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=\" rel=\"icon\" type=\"image/x-icon\" />\n\n  <script type=\"text/javascript\" src=\"lib/sockjs.js\"></script>\n  <script type=\"text/javascript\" src=\"static/jquery.min.js\"></script>\n\n  <script type=\"text/javascript\" src=\"config.js\"></script>\n\n  <style type=\"text/css\">\n      .cursor {\n        height: 30px;\n        width: 30px;\n        position: absolute;\n        border: 1px solid gray;\n        z-index: -1;\n      }\n  </style>\n\n</head>\n<body>\n\n<form>\n  <select id=\"transport\">\n  <option value=\"\">- any - </option>\n  <option value=\"websocket\">websocket</option>\n  <option value=\"not-websocket\">- not websocket -</option>\n  <option value=\"xdr-streaming\">xdr-streaming</option>\n  <option value=\"xhr-streaming\">xhr-streaming</option>\n  <option value=\"iframe-eventsource\">iframe-eventsource</option>\n  <option value=\"iframe-htmlfile\">iframe-htmlfile</option>\n  <option value=\"xdr-polling\">xdr-polling</option>\n  <option value=\"xhr-polling\">xhr-polling</option>\n  <option value=\"iframe-xhr-polling\">iframe-xhr-polling</option>\n  <option value=\"jsonp-polling\">jsonp-polling</option>\n  </select>\n  <input type=\"checkbox\" id=\"sameOrigin\" checked>Same Origin?\n  <input type=\"button\" value=\"Connect\" id=\"connect\">\n  <input type=\"button\" value=\"Disconnect\" id=\"disconnect\" disabled=\"yes\">\n</form>\n\n  Latency: <code id=\"latency\"></code><br>\n  <code id=\"logs\" style=\"height:200px; overflow:auto; display: block; border: 1px gray solid;\">\n  </code>\n\n<script>\n    function log(a) {\n            if ('console' in window && 'log' in window.console) {\n                console.log(a);\n            }\n            $('#logs').append($(\"<code>\").text(a));\n            $('#logs').append($(\"<br>\"));\n            $('#logs').scrollTop($('#logs').scrollTop()+10000);\n      }\n\n    var sjs = null;\n    var transport;\n    $('#connect').click(function() {\n        $('#connect').attr('disabled', true);\n        $('#disconnect').each(function(_,e){e.disabled='';});\n        var transport = $('#transport').val() || undefined;\n        if (transport === 'not-websocket') {\n            transport = ['xdr-streaming',\n                      'xhr-streaming',\n                      'eventsource',\n                      'iframe-eventsource',\n                      'htmlfile',\n                      'iframe-htmlfile',\n                      'xdr-polling',\n                      'xhr-polling',\n                      'iframe-xhr-polling',\n                      'jsonp-polling'];\n        }\n        log('[connecting] ' + transport);\n        var url;\n        if ($('#sameOrigin').prop('checked')) {\n          if (window.location.origin) url = window.location.origin;\n          else {\n            url = window.location.protocol + '//' + window.location.hostname +\n              (window.location.port ? ':' + window.location.port : '');\n          }\n        } else {\n          url = clientOptions.url;\n        }\n        sjs = new SockJS(url + '/broadcast', null, { transports: transport });\n        sjs.onopen = onopen\n        sjs.onclose = onclose;\n        sjs.onmessage = xonmessage;\n    });\n    $('#disconnect').click(function() {\n        $('#disconnect').attr('disabled', true);\n        log('[disconnecting]');\n        sjs.close();\n    });\n\n    var onopen = function() {\n        log('connected ' + sjs.transport);\n        $('#sameOrigin').attr('disabled', true);\n    };\n    var onclose = function(e) {\n        log('disconnected ' + e.code + ', ' + e.reason);\n        $('#connect').each(function(_,e){e.disabled='';});\n        $('#disconnect').attr('disabled', true);\n        $('#sameOrigin').attr('disabled', false);\n    };\n    var myself = (''+Math.random()).substr(2);\n    var xonmessage = function(e) {\n        var msg = JSON.parse(e.data);\n        if (msg.id === myself) {\n            var td = (new Date()).getTime() - msg.t;\n            $('#latency').text('' + td + ' ms');\n        }\n        var id = 'cursor_'+msg.id;\n        if ($('#'+id).length === 0) {\n            $(\"body\").append('<div id=\"' + id + '\" class=\"cursor\"></div>');\n        }\n        $('#'+id).offset({top:msg.y-15, left:msg.x-15});\n    };\n    var x, y;\n    var last_x, last_y, tref;\n    $(document).mousemove(function(e) {\n         x = e.pageX; y = e.pageY;\n         if(!tref) poll();\n    });\n    var poll = function() {\n         tref = null;\n         if (last_x === x && last_y === y)\n             return;\n         var msg = {x:x, y:y, t: (new Date()).getTime(), id:myself};\n         last_x = x; last_y = y;\n         var raw_msg = JSON.stringify(msg);\n         if (sjs && sjs.readyState === SockJS.OPEN) {\n             sjs.send(raw_msg);\n         }\n         tref = setTimeout(poll, 200);\n    };\n    $('#connect').each(function(_,e){e.disabled='';});\n    $('#disconnect').attr('disabled', true);\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "tests/html/iframe.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  <script>\n    document.domain = document.domain;\n  </script>\n  <script src=\"/sockjs-test/lib/sockjs.js\"></script>\n</head>\n<body>\n  <h2>Don't panic!</h2>\n  <script>\n    c = parent._sockjs_global;\n    window_id = window.location.hash.slice(1);\n    hook = c(window_id);\n    hook.callback = function(code) {eval(code);};\n    hook.open();\n  </script>\n</body>\n"
  },
  {
    "path": "tests/html/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta charset=\"UTF-8\" />\n\n  <link href=\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=\" rel=\"icon\" type=\"image/x-icon\" />\n\n</head>\n<body>\n  <h1>SockJS</h1>\n  <ul>\n    <li><a href=\"example-cursors.html\">Cursors example</a></li>\n    <li><a href=\"smoke-latency.html\">Smoketest: latency</a></li>\n    <li><a href=\"smoke-reconnect.html\">Smoketest: reconnect</a></li>\n    <li><a href=\"web-worker.html\">Web Worker</a></li>\n  </ul>\n</body>\n</html>\n"
  },
  {
    "path": "tests/html/lib/worker.js",
    "content": "/* eslint-env worker */\n/* global SockJS */\n'use strict';\nimportScripts('sockjs.js');\n\nvar sjs;\n\nonmessage = function(e) {\n  var msg = JSON.parse(e.data);\n\n  if (msg.type === 'open') {\n    sjs = new SockJS(msg.url, null, msg.transports);\n    sjs.onmessage = function(e) {\n      postMessage(JSON.stringify({ type: 'message', data: e.data }));\n    };\n    sjs.onopen = function() {\n      postMessage(JSON.stringify({ type: 'open' }));\n    };\n    sjs.onclose = function(e) {\n      postMessage(JSON.stringify({ type: 'close', code: e.code, reason: e.reason }));\n    };\n    sjs.onerror = function(e) {\n      postMessage(JSON.stringify({ type: 'error ', data: e.toString() }));\n    };\n    return;\n  }\n\n  if (msg.type === 'message') {\n    sjs.send(msg.data);\n    return;\n  }\n\n  if (msg.type === 'close') {\n    sjs.close();\n    return;\n  }\n};\n"
  },
  {
    "path": "tests/html/smoke-latency.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta charset=\"UTF-8\" />\n\n  <link href=\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=\" rel=\"icon\" type=\"image/x-icon\" />\n\n  <script type=\"text/javascript\" src=\"lib/sockjs.js\"></script>\n  <script type=\"text/javascript\" src=\"static/jquery.min.js\"></script>\n\n  <script type=\"text/javascript\" src=\"config.js\"></script>\n</head>\n<body>\n<form>\n  <input type=\"text\" id=\"url\" size=\"40\">\n  <br />\n  <select id=\"transport\">\n  <option value=\"\">- any - </option>\n  <option value=\"websocket\">websocket</option>\n  <option value=\"xdr-streaming\">xdr-streaming</option>\n  <option value=\"xhr-streaming\">xhr-streaming</option>\n  <option value=\"eventsource\">eventsource</option>\n  <option value=\"iframe-eventsource\">iframe-eventsource</option>\n  <option value=\"htmlfile\">htmlfile</option>\n  <option value=\"iframe-htmlfile\">iframe-htmlfile</option>\n  <option value=\"xdr-polling\">xdr-polling</option>\n  <option value=\"xhr-polling\">xhr-polling</option>\n  <option value=\"iframe-xhr-polling\">iframe-xhr-polling</option>\n  <option value=\"jsonp-polling\">jsonp-polling</option>\n  </select>\n  <input type=\"checkbox\" id=\"sameOrigin\" checked>Same Origin?\n  <input type=\"button\" value=\"Connect\" id=\"connect\">\n  <input type=\"button\" value=\"Disconnect\" id=\"disconnect\" disabled=\"yes\">\n</form>\n\n  Latency: <code id=\"latency\"></code><br>\n  <code id=\"logs\" style=\"height:200px; overflow:auto; display: block; border: 1px gray solid;\">\n  </code>\n\n<script>\n    function log(a) {\n            if ('console' in window && 'log' in window.console) {\n                console.log(a);\n            }\n            $('#logs').append($(\"<code>\").text(a));\n            $('#logs').append($(\"<br>\"));\n            $('#logs').scrollTop($('#logs').scrollTop()+10000);\n      }\n\n    var sjs;\n    function onopen() {\n            log('connected ' + sjs.transport);\n            $('#sameOrigin').attr('disabled', true);\n            send();\n    };\n    function onclose(e) {\n            log('disconnected ' + e.code + ', ' + e.reason);\n            $('#connect').each(function(_,e){e.disabled='';});\n            $('#disconnect').attr('disabled', true);\n            $('#sameOrigin').attr('disabled', false);\n    };\n    function send() {\n        sjs.send(JSON.stringify({t: (new Date()).getTime()}));\n    };\n    var i = 0;\n    function xonmessage(e) {\n            var msg = JSON.parse(e.data);\n            var td = (new Date()).getTime() - msg.t;\n            $('#latency').text(''+i +'  ' + td + ' ms');\n            i += 1;\n            send();\n    };\n\n    $('#connect').click(function() {\n        $('#connect').attr('disabled', true);\n        $('#disconnect').each(function(_,e){e.disabled='';});\n        var transport = $('#transport').val() || undefined;\n        log('[connecting] ' + transport);\n        var url;\n        if ($('#url').val()) {\n          url = $('#url').val();\n        } else if ($('#sameOrigin').prop('checked')) {\n          if (window.location.origin) url = window.location.origin;\n          else {\n            url = window.location.protocol + '//' + window.location.hostname +\n              (window.location.port ? ':' + window.location.port : '');\n          }\n          url += '/echo';\n        } else {\n          url = clientOptions.url + '/echo';\n        }\n        sjs = new SockJS(url, null, { transports: transport });\n        sjs.onopen = onopen\n        sjs.onclose = onclose;\n        sjs.onmessage = xonmessage;\n    });\n    $('#disconnect').click(function() {\n        $('#disconnect').attr('disabled', true);\n        log('[disconnecting]');\n        sjs.close();\n    });\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "tests/html/smoke-reconnect.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta charset=\"UTF-8\" />\n\n  <link href=\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=\" rel=\"icon\" type=\"image/x-icon\" />\n\n  <script type=\"text/javascript\" src=\"lib/sockjs.js\"></script>\n  <script type=\"text/javascript\" src=\"static/jquery.min.js\"></script>\n\n  <script type=\"text/javascript\" src=\"config.js\"></script>\n</head>\n<body>\n<form>\n  <select id=\"transport\">\n  <option value=\"\">- any - </option>\n  <option value=\"websocket\">websocket</option>\n  <option value=\"xdr-streaming\">xdr-streaming</option>\n  <option value=\"xhr-streaming\">xhr-streaming</option>\n  <option value=\"iframe-eventsource\">iframe-eventsource</option>\n  <option value=\"iframe-htmlfile\">iframe-htmlfile</option>\n  <option value=\"xdr-polling\">xdr-polling</option>\n  <option value=\"xhr-polling\">xhr-polling</option>\n  <option value=\"iframe-xhr-polling\">iframe-xhr-polling</option>\n  <option value=\"jsonp-polling\">jsonp-polling</option>\n  </select>\n  <input type=\"checkbox\" id=\"sameOrigin\" checked>Same Origin?\n  <input type=\"button\" value=\"Start\" id=\"connect\">\n  <input type=\"button\" value=\"Stop\" id=\"disconnect\" disabled=\"yes\">\n</form>\n\n  Connected: <code id=\"out\"></code><br>\n  <code id=\"logs\" style=\"height:200px; overflow:auto; display: block; border: 1px gray solid;\">\n  </code>\n\n<script>\n    function log(a) {\n            if ('console' in window && 'log' in window.console) {\n                console.log(a);\n            }\n            $('#logs').append($(\"<code>\").text(a));\n            $('#logs').append($(\"<br>\"));\n            $('#logs').scrollTop($('#logs').scrollTop()+10000);\n      }\n\n    var started = false;\n    var sjs;\n    var i = 0;\n    var transport;\n    var t0;\n    function onopen() {\n      $('#sameOrigin').attr('disabled', true);\n       var td = (new Date()).getTime() - t0;\n       i += 1;\n       $('#out').text(''+i +'  ' + td + ' ms');\n       sjs.close();\n    };\n    function onclose(e) {\n        if (started && e.code === 1000) {\n            t0 = (new Date()).getTime();\n            var url;\n            if ($('#sameOrigin').prop('checked')) {\n              if (window.location.origin) url = window.location.origin;\n              else {\n                url = window.location.protocol + '//' + window.location.hostname +\n                  (window.location.port ? ':' + window.location.port : '');\n              }\n            } else {\n              url = clientOptions.url;\n            }\n            sjs = new SockJS(clientOptions.url + '/echo', null, { transports: transport });\n            sjs.onopen = onopen\n            sjs.onclose = onclose;\n        } else {\n            log('[stopped] ' + e.code + ', ' + e.reason);\n            $('#connect').each(function(_,e){e.disabled='';});\n            $('#disconnect').attr('disabled', true);\n            $('#sameOrigin').attr('disabled', false);\n        }\n    };\n\n    $('#connect').click(function() {\n        started = true;\n        transport = $('#transport').val() || undefined;\n        log('[starting] ' + transport);\n        onclose({code:1000});\n        $('#connect').attr('disabled', true);\n        $('#disconnect').each(function(_,e){e.disabled='';});\n    });\n    $('#disconnect').click(function() {\n        $('#disconnect').attr('disabled', true);\n        log('[stopping...]');\n        started = false;\n    });\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "tests/html/sockjs-in-parent.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  <script>\n    document.domain = document.domain;\n  </script>\n  <script>\n    c = parent._sockjs_global;\n    window_id = window.location.hash.slice(1);\n    hook = c(window_id);\n    hook.callback = function(code) {eval(code);};\n    hook.open();\n  </script>\n</head>\n<body>\n  <h2>Don't panic!</h2>\n</body>\n"
  },
  {
    "path": "tests/html/web-worker.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta charset=\"UTF-8\" />\n\n  <link href=\"data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=\" rel=\"icon\" type=\"image/x-icon\" />\n\n  <script type=\"text/javascript\" src=\"lib/sockjs.js\"></script>\n  <script type=\"text/javascript\" src=\"static/jquery.min.js\"></script>\n\n  <script type=\"text/javascript\" src=\"config.js\"></script>\n</head>\n<body>\n<form>\n  <select id=\"transport\">\n  <option value=\"\">- any - </option>\n  <option value=\"websocket\">websocket</option>\n  <option value=\"xdr-streaming\">xdr-streaming</option>\n  <option value=\"xhr-streaming\">xhr-streaming</option>\n  <option value=\"eventsource\">eventsource</option>\n  <option value=\"iframe-eventsource\">iframe-eventsource</option>\n  <option value=\"htmlfile\">htmlfile</option>\n  <option value=\"iframe-htmlfile\">iframe-htmlfile</option>\n  <option value=\"xdr-polling\">xdr-polling</option>\n  <option value=\"xhr-polling\">xhr-polling</option>\n  <option value=\"iframe-xhr-polling\">iframe-xhr-polling</option>\n  <option value=\"jsonp-polling\">jsonp-polling</option>\n  </select>\n  <input type=\"checkbox\" id=\"sameOrigin\" checked>Same Origin?\n  <input type=\"button\" value=\"Connect\" id=\"connect\">\n  <input type=\"button\" value=\"Disconnect\" id=\"disconnect\" disabled=\"yes\">\n</form>\n\n  Latency: <code id=\"latency\"></code><br>\n  <code id=\"logs\" style=\"height:200px; overflow:auto; display: block; border: 1px gray solid;\">\n  </code>\n\n<script>\n  /* global $, clientOptions */\n  'use strict';\n  function log(a) {\n    if ('console' in window && 'log' in window.console) {\n        console.log(a);\n    }\n    $('#logs').append($('<code>').text(a));\n    $('#logs').append($('<br>'));\n    $('#logs').scrollTop($('#logs').scrollTop() + 10000);\n  }\n\n  var worker;\n  function send() {\n    worker.postMessage(JSON.stringify({ type: 'message', data: JSON.stringify({ t: (new Date()).getTime()}) }));\n  }\n  function onopen() {\n    log('connected');\n    $('#sameOrigin').attr('disabled', true);\n    send();\n  }\n  function onclose(code, reason) {\n    log('disconnected ' + code + ', ' + reason);\n    $('#connect').each(function(_,e){\n      e.disabled = '';\n    });\n    $('#disconnect').attr('disabled', true);\n    $('#sameOrigin').attr('disabled', false);\n  }\n\n  var i = 0;\n  function xonmessage(e) {\n    var msg = JSON.parse(e);\n    var td = (new Date()).getTime() - msg.t;\n    $('#latency').text('' + i + '  ' + td + ' ms');\n    i += 1;\n    send();\n  }\n\n  $('#connect').click(function() {\n      $('#connect').attr('disabled', true);\n      $('#disconnect').each(function(_,e){\n        e.disabled = '';\n      });\n      var transport = $('#transport').val() || undefined;\n      log('[connecting] ' + transport);\n      var url;\n      if ($('#sameOrigin').prop('checked')) {\n        if (window.location.origin) {\n          url = window.location.origin;\n        } else {\n          url = window.location.protocol + '//' + window.location.hostname +\n            (window.location.port ? ':' + window.location.port : '');\n        }\n      } else {\n        url = clientOptions.url;\n      }\n      worker = new Worker('lib/worker.js');\n      worker.onmessage = function (e) {\n        var msg = JSON.parse(e.data);\n        switch (msg.type) {\n          case 'message':\n            xonmessage(msg.data);\n            break;\n          case 'open':\n            onopen();\n            break;\n          case 'close':\n            onclose(msg.code, msg.reason);\n            break;\n          case 'error':\n            console.error(msg.data);\n            break;\n          default:\n            console.error('unknown type: ' + msg.type);\n        }\n      };\n\n      worker.postMessage(JSON.stringify({ type: 'open', url: url + '/echo', transports: transport }));\n  });\n  $('#disconnect').click(function() {\n    $('#disconnect').attr('disabled', true);\n    log('[disconnecting]');\n    worker.postMessage(JSON.stringify({ type: 'close' }));\n  });\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "tests/lib/batch-tests.js",
    "content": "'use strict';\nvar expect = require('expect.js')\n  , testUtils = require('./test-utils')\n  , debug = require('debug')('sockjs-client:tests:batch')\n  ;\n\nfunction batchFactory(transport, messages, url) {\n  return function(done) {\n    var test = this.runnable();\n    var title = test.fullTitle();\n    debug('start', title);\n    this.timeout(10000);\n    var sjs = testUtils.newSockJs(url + '/echo', transport);\n    var counter = 0;\n    sjs.onopen = function () {\n      messages.forEach(function (m) {\n        sjs.send(m);\n      });\n    };\n    sjs.onmessage = function (e) {\n      try {\n        expect(e.data).to.eql(messages[counter]);\n      } catch (err) {\n        done(err);\n        sjs.close();\n        return;\n      }\n\n      counter++;\n      if (counter === messages.length) {\n        sjs.close();\n      }\n    };\n    sjs.onclose = function (e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(e.code).to.equal(1000);\n        expect(counter).to.equal(messages.length);\n      } catch (err) {\n        done(err);\n        return;\n      }\n      done();\n      debug('end', title);\n    };\n  };\n}\n\nmodule.exports.largeMessage = function(url, transport) {\n  var messages = [new Array(Math.pow(2, 1)).join('x'), new Array(Math.pow(2, 2)).join('x'), new Array(Math.pow(2, 4)).join('x'), new Array(Math.pow(2, 8)).join('x'), new Array(Math.pow(2, 13)).join('x'), new Array(Math.pow(2, 13)).join('x')];\n  it('large message (batch)', batchFactory(transport, messages, url));\n};\n\nfunction amplifyFactory(transport, messages, url) {\n  return function(done) {\n    var test = this.runnable();\n    var title = test.fullTitle();\n    debug('start', title);\n    this.timeout(10000);\n    var sjs = testUtils.newSockJs(url + '/amplify', transport);\n    var counter = 0;\n    sjs.onopen = function () {\n      messages.forEach(function (m) {\n        sjs.send(m);\n      });\n    };\n    sjs.onmessage = function (e) {\n      try {\n        expect(e.data).to.have.length(Math.pow(2, messages[counter]));\n      } catch (err) {\n        done(err);\n        sjs.close();\n        return;\n      }\n      counter++;\n      if (counter === messages.length) {\n        sjs.close();\n      }\n    };\n    sjs.onclose = function (e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(e.code).to.equal(1000);\n        expect(counter).to.equal(messages.length);\n      } catch (err) {\n        done(err);\n        return;\n      }\n\n      done();\n      debug('end', title);\n    };\n  };\n}\n\nmodule.exports.largeDownload = function(url, transport) {\n  var messages = [1, 2, 4, 8, 13, 15, 15];\n  it('large download', amplifyFactory(transport, messages, url));\n};\n"
  },
  {
    "path": "tests/lib/echo-tests.js",
    "content": "'use strict';\nvar expect = require('expect.js')\n  , iframeUtils = require('../../lib/utils/iframe')\n  , testUtils = require('./test-utils')\n  , debug = require('debug')('sockjs-client:tests:echo')\n  ;\n\nfunction echoFactory(transport, messages, url) {\n  return function (done) {\n    var test = this.runnable();\n    var title = test.fullTitle();\n    debug('start', title);\n    this.timeout(20000);\n    var msgs = messages.slice(0);\n\n    var sjs = testUtils.newSockJs(url, transport);\n    sjs.onopen = function () {\n      sjs.send(msgs[0]);\n    };\n    sjs.onmessage = function (e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n      // TODO don't like having to force the element toString here\n      try {\n        expect(e.data).to.eql('' + msgs[0]);\n      } catch (err) {\n        done(err);\n        sjs.close();\n        return;\n      }\n\n      msgs.shift();\n      if (typeof msgs[0] === 'undefined') {\n        sjs.close();\n      } else {\n        sjs.send(msgs[0]);\n      }\n    };\n    sjs.onclose = function (e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(e.code).to.equal(1000);\n        expect(msgs).to.have.length(0);\n      } catch (err) {\n        done(err);\n        return;\n      }\n\n      done();\n      debug('end', title);\n    };\n  };\n}\n\nmodule.exports.echoBasic = function echoBasic(url, transport) {\n  var messages = ['data'];\n  it('echo basic', echoFactory(transport, messages, url + '/echo'));\n};\n\nmodule.exports.echoQueryString = function echoBasic(url, transport) {\n  var messages = ['data'];\n  it('echo querystring', echoFactory(transport, messages, url + '/echo?testqs=1'));\n};\n\nmodule.exports.echoRich = function echoRich(url, transport) {\n  var messages = [\n    [1, 2, 3, 'data'], null, false, 'data', 1, 12.0, {\n      a: 1,\n      b: 2\n    }\n  ];\n  it('echo rich', echoFactory(transport, messages, url + '/echo'));\n};\n\n/* eslint-disable quotes */\nmodule.exports.echoUnicode = function echoUnicode(url, transport) {\n  var messages = [\"Τη γλώσσα μου έδωσαν ελληνική το σπίτι φτωχικό στις αμμουδιές του \", \"ღმერთსი შემვედრე, ნუთუ კვლა დამხსნას სოფლისა შრომასა, ცეცხლს, წყალს\", \"⠊⠀⠉⠁⠝⠀⠑⠁⠞⠀⠛⠇⠁⠎⠎⠀⠁⠝⠙⠀⠊⠞⠀⠙⠕⠑⠎⠝⠞⠀⠓⠥⠗⠞⠀⠍⠑\", \"Би шил идэй чадна, надад хортой биш\", \"을\", \"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요\", \"ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ\", \"Ég get etið gler án þess að meiða mig.\", \"Mogę jeść szkło, i mi nie szkodzi.\", \"\\ufffd\\u10102\\u2f877\", \"Начало музыкальной карьеры\\nБритни пела в церковном хоре местной баптистской церкви. В возрасте 8-ми лет Спирс прошла аудирование для участия в шоу «Новый Клуб Микки-Мауса» на канале «Дисней». И хотя продюсеры решили, что Спирс слишком молода для участия в шоу, они представили её агенту в Нью-Йорке. Следующие 3 года Бритни училась в актёрской школе Professional Performing Arts School в Нью-Йорке и участвовала в нескольких постановках, в том числе «Ruthless!» 1991 года. В 1992 году Спирс участвовала в конкурсе Star Search, но проиграла во втором туре.\\nВ 1993 году Спирс вернулась на канал «Дисней» и в течение 2-х лет участвовала в шоу «Новый Клуб Микки-Мауса». Другие будущие знаменитости, начинавшие с этого шоу — Кристина Агилера, участники 'N Sync Джастин Тимберлейк и Джейси Шазе, звезда сериала «Счастье» Кери Расселл и актёр фильма «Дневник памяти» Райан Гослинг.\\nВ 1994 году шоу закрыли, Бритни вернулась домой в Луизиану, где поступила в среднюю школу. Некоторое время она пела в девичьей группе Innosense, но вскоре, решив начать сольную карьеру, записала демодиск, который попал в руки продюсерам из Jive Records, и те заключили с ней контракт.\\nДалее последовал тур по стране, выступления в супермаркетах и работа на разогреве у групп 'N Sync и Backstreet Boys.\\n[править]1999—2000: Ранний коммерческий успех\\nВ октябре 1998 года вышел дебютный сингл Бритни Спирс «…Baby One More Time» . Песня имела огромный успех, в первые же недели возглавила международные чарты, мировые продажи сингла составили 9 миллионов копий, что сделало диск дважды платиновым. Альбом с одноимённым названием вышел в январе 1999 года. Альбом стартовал на первом месте рейтинга Billboard 200, пятьдесят одну неделю продержался в верхней десятке и шестьдесят недель в двадцати лучших. Альбом стал 15-кратным платиновым и на сегодняшний день является самым успешным альбомом Бритни Спирс.\\nВ 1999 году Бритни снялась для апрельского номера журнала Rolling Stone. Откровенные фотографии спровоцировали слухи о том, что 17-летняя звезда сделала операцию по увеличению груди, что сама Спирс отрицала. Успех альбома и противоречивый образ Спирс, созданный массмедиа, сделали её главной звездой 1999 года.\\nВслед за успешным дебютом последовал второй альбом певицы «Oops!... I Did It Again», также стартовавший на 1-м месте в США. Продажи за первую неделю составили 1 319 193 копии, что являлось абсолютным рекордом, который затем побил американский рэпер Эминем. Летом 2000 года Спирс отправилась в свой первый мировой тур, «Oops!… I Did It Again World Tour». В 2000 году Спирс получила две награды Billboards Music Awards и была номинирована на «Грэмми» в двух категориях — «Лучший поп-альбом» и «Лучшее живое выступление».\\n[править]2001—2003: Вершина карьеры\\n\\n\\nИсполняя «Me Against the Music»\\nУспех Спирс сделал её заметной фигурой и в музыкальной индустрии, и в поп-культуре. В начале 2001 года она привлекла внимание «Пепси», эта компания предложила ей многомиллионный контракт, включавший телевизионную рекламу и участие в промо-акциях.\\nВ ноябре 2001 года вышел третий альбом Спирс — Britney. Альбом дебютировал на первом месте в США с продажами в 745 744 пластинок за первую неделю, что сделало Бритни первой в истории исполнительницей, чьи первые три альбома стартовали на вершине рейтинга. Сразу же после выхода альбома Спирс отправилась в тур Dream Within a Dream Tour, по окончании которого объявила, что хочет взять 6-месячный перерыв в карьере.\\nВ этом же году Спирс рассталась с солистом 'N Sync Джастином Тимберлейком, с которым встречалась 4 года.\\nБритни вернулась на сцену в августе 2003 года.\\nВ ноябре 2003 года вышел четвёртый студийный альбом Спирс In The Zone. Бритни участвовала в написании восьми из тринадцати композиций, а также выступила в качестве продюсера альбома. In The Zone дебютировал на первом месте в США, что сделало Бритни первой в истории исполнительницей, чьи первые четыре альбома стартовали на вершине рейтинга. Самый успешный сингл с альбома — Toxic — принёс Бритни первую для неё награду Грэмми в категории «Лучшая танцевальная композиция».\\n[править]2007—2008: Возвращение к музыке\\nВ начале 2007 года после двухлетнего перерыва Спирс приступила к записи нового сольного альбома, продюсерами которого выступили Nate «Danja» Hills, Шон Гарретт и Джонатан Ротэм.\\nВ мае 2007 года Спирс в составе коллектива «The M and M’s» дала 6 концертов в рамках тура «House of Blues» в Лос-Анджелесе, Сан-Диего, Анахайме, Лас-Вегасе, Орландо и Майами. Каждый концерт длился около 15 минут и включал 5 старых хитов певицы.[4]\\n30 августа 2007 года на волнах нью-йоркской радиостанции Z100 состоялась премьера песни «Gimme More», первого сингла с нового альбома Спирс.[5] Сингл вышел на iTunes 24 сентября и на CD 29 октября 2007.\\n9 сентября 2007 года Спирс исполнила «Gimme More» на церемонии вручения наград MTV Video Music Awards. Выступление оказалось неудачным; Спирс выглядела непрофессионально — не всегда попадала в фонограмму и в танце отставала от группы хореографической поддержки.[6]\\nНесмотря на это, в начале октября 2007 года сингл «Gimme More» достиг 3-го места в чарте Billboard Hot 100, став таким образом одним из самых успешных синглов Спирс.[7]\"];\n  it('unicode', echoFactory(transport, messages, url + '/echo'));\n};\n\nmodule.exports.echoSpecialChars = function echoSpecialChars(url, transport) {\n  var messages = [\" \", \"\\u0000\", \"\\xff\", \"\\xff\\x00\", \"\\x00\\xff\", \" \\r \", \" \\n \", \" \\r\\n \", \"\\r\\n\", \"\", \"message\\t\", \"\\tmessage\", \"message \", \" message\", \"message\\r\", \"\\rmessage\", \"message\\n\", \"\\nmessage\", \"message\\xff\", \"\\xffmessage\", \"A\", \"b\", \"c\", \"d\", \"e\", \"\\ufffd\", \"\\ufffd\\u0000\", \"message\\ufffd\", \"\\ufffdmessage\", \"%20\"];\n  it('special chars', echoFactory(transport, messages, url + '/echo'));\n};\n/* eslint-enable quotes */\n\nmodule.exports.echoLargeMessage = function echoLargeMessage(url, transport) {\n  var messages = [new Array(Math.pow(2, 1)).join('x'), new Array(Math.pow(2, 2)).join('x'), new Array(Math.pow(2, 4)).join('x'), new Array(Math.pow(2, 8)).join('x'), new Array(Math.pow(2, 13)).join('x'), new Array(Math.pow(2, 13)).join('x')];\n  it('large message (ping-pong)', echoFactory(transport, messages, url + '/echo'));\n};\n\nmodule.exports.echoUtfEncodingSimple = function echoUtfEncodingSimple(url, transport) {\n  var chars = [];\n  for (var i = 0; i <= 256; i++) {\n    chars.push(String.fromCharCode(i));\n  }\n  it('echo utf encoding 0x00-0xFF', echoFactory(transport, [chars.join('')], url + '/echo'));\n};\n\n// eslint-disable-next-line no-control-regex, no-useless-escape, no-misleading-character-class\nvar escapable = /[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u2000-\\u20ff\\ufeff\\ufff0-\\uffff\\x00-\\x1f\\ufffe\\uffff\\u0300-\\u0333\\u033d-\\u0346\\u034a-\\u034c\\u0350-\\u0352\\u0357-\\u0358\\u035c-\\u0362\\u0374\\u037e\\u0387\\u0591-\\u05af\\u05c4\\u0610-\\u0617\\u0653-\\u0654\\u0657-\\u065b\\u065d-\\u065e\\u06df-\\u06e2\\u06eb-\\u06ec\\u0730\\u0732-\\u0733\\u0735-\\u0736\\u073a\\u073d\\u073f-\\u0741\\u0743\\u0745\\u0747\\u07eb-\\u07f1\\u0951\\u0958-\\u095f\\u09dc-\\u09dd\\u09df\\u0a33\\u0a36\\u0a59-\\u0a5b\\u0a5e\\u0b5c-\\u0b5d\\u0e38-\\u0e39\\u0f43\\u0f4d\\u0f52\\u0f57\\u0f5c\\u0f69\\u0f72-\\u0f76\\u0f78\\u0f80-\\u0f83\\u0f93\\u0f9d\\u0fa2\\u0fa7\\u0fac\\u0fb9\\u1939-\\u193a\\u1a17\\u1b6b\\u1cda-\\u1cdb\\u1dc0-\\u1dcf\\u1dfc\\u1dfe\\u1f71\\u1f73\\u1f75\\u1f77\\u1f79\\u1f7b\\u1f7d\\u1fbb\\u1fbe\\u1fc9\\u1fcb\\u1fd3\\u1fdb\\u1fe3\\u1feb\\u1fee-\\u1fef\\u1ff9\\u1ffb\\u1ffd\\u2000-\\u2001\\u20d0-\\u20d1\\u20d4-\\u20d7\\u20e7-\\u20e9\\u2126\\u212a-\\u212b\\u2329-\\u232a\\u2adc\\u302b-\\u302c\\uaab2-\\uaab3\\uf900-\\ufa0d\\ufa10\\ufa12\\ufa15-\\ufa1e\\ufa20\\ufa22\\ufa25-\\ufa26\\ufa2a-\\ufa2d\\ufa30-\\ufa6d\\ufa70-\\ufad9\\ufb1d\\ufb1f\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40-\\ufb41\\ufb43-\\ufb44\\ufb46-\\ufb4e]/g;\nmodule.exports.echoUtfEncoding = function echoUtfEncoding(url, transport) {\n  var chars = [], message = [];\n  for (var i = 0; i <= 65536; i++) {\n    chars.push(String.fromCharCode(i));\n  }\n  escapable.lastIndex = 0;\n  chars.join('').replace(escapable, function (a) {\n    message.push(a);\n    return '';\n  });\n  it('echo utf encoding killer message', echoFactory(transport, [message.join('')], url + '/echo'));\n};\n\nmodule.exports.echoFromChild = function echoFromChild(url, transport) {\n  if (!iframeUtils.iframeEnabled) {\n    it('echo from child [unsupported]');\n    return;\n  }\n\n  it('echo from child', function (done) {\n    this.timeout(10000);\n\n    var test = this.runnable();\n    var title = test.fullTitle();\n    debug('start', title);\n    var hook = testUtils.createIframe('/sockjs-test/sockjs-in-parent.html');\n    var sjs = testUtils.newSockJs(url + '/echo', transport);\n    var code = 'hook.sjs.send(\"a\"); hook.onsend();';\n    var hookReady, sockJsReady, timeout, i = 0;\n\n    hook.open = function() {\n      debug('hook open');\n      hook.iobj.loaded();\n      i++;\n      hookReady = true;\n      hook.sjs = sjs;\n      if (sockJsReady) {\n        hook.callback(code);\n      }\n    };\n    hook.onsend = function () {\n      debug('hook onsend');\n      timeout = setTimeout(function() {\n        done(new Error('echo timeout'));\n        sjs.close();\n        debug('end', title);\n      }, 1000);\n    };\n\n    sjs.onopen = function() {\n      debug('hook sjs open');\n      hook.iobj.loaded();\n      i++;\n      sockJsReady = true;\n      if (hookReady) {\n        hook.callback(code);\n      }\n    };\n    sjs.onmessage = function(e) {\n      debug('hook sjs message, e.data');\n      clearTimeout(timeout);\n      try {\n        expect(e.data).to.equal('a');\n        expect(i).to.equal(2);\n      } catch (err) {\n        done(err);\n      } finally {\n        hook.iobj.cleanup();\n        hook.del();\n        sjs.close();\n      }\n    };\n    sjs.onclose = function(e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(e.code).to.equal(1000);\n      } catch (err) {\n        done(e);\n        return;\n      }\n      debug('hook sjs close');\n      done();\n      debug('end', title);\n    };\n  });\n};\n"
  },
  {
    "path": "tests/lib/end-to-end.js",
    "content": "'use strict';\n\nvar expect = require('expect.js')\n  , testUtils = require('./test-utils')\n  , XDR = require('../../lib/transport/sender/xdr')\n  , XHRCors = require('../../lib/transport/sender/xhr-cors')\n  , InfoIframe = require('../../lib/info-iframe')\n  ;\n\ndescribe('End to End', function () {\n  // selenium needs a long time to timeout\n  this.timeout(30000);\n\n  describe('Connection Errors', function () {\n    it('invalid url 404', function (done) {\n      var test = this.runnable();\n      var sjs = testUtils.newSockJs('/invalid_url', 'jsonp-polling');\n      expect(sjs).to.be.ok();\n      sjs.onopen = sjs.onmessage = function () {\n        done(new Error('Open/Message event should not fire for an invalid url'));\n        sjs.close();\n      };\n      sjs.onclose = function (e) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n\n        try {\n          expect(e.code).to.equal(404);\n          expect(e.reason).to.equal('Cannot connect to server');\n          expect(e.wasClean).to.equal(false);\n        } catch (err) {\n          done(err);\n          return;\n        }\n\n        done();\n      };\n    });\n\n    // TODO this isn't a great way to disable this test\n    if (!XHRCors.enabled && !XDR.enabled && !InfoIframe.enabled()) {\n      // CORS unsupported, won't actually hit info server\n      it('invalid url port [unsupported]');\n      return;\n    } else {\n      it('invalid url port', function (done) {\n        var test = this.runnable();\n        var badUrl;\n        if (global.location) {\n          badUrl = global.location.protocol + '//' + global.location.hostname + ':1079';\n        } else {\n          badUrl = 'http://localhost:1079';\n        }\n\n        var sjs = testUtils.newSockJs(badUrl, 'jsonp-polling');\n        expect(sjs).to.be.ok();\n        sjs.onopen = sjs.onmessage = function () {\n          done(new Error('Open/Message event should not fire for an invalid port'));\n          sjs.close();\n        };\n        sjs.onclose = function (e) {\n          if (test.timedOut || test.duration) {\n            return;\n          }\n\n          try {\n            expect(e.code).to.equal(1002);\n            expect(e.reason).to.equal('Cannot connect to server');\n            expect(e.wasClean).to.equal(false);\n          } catch (err) {\n            done(err);\n            return;\n          }\n\n          done();\n        };\n      });\n    }\n\n    it('disabled websocket test', function (done) {\n      var test = this.runnable();\n      var sjs = testUtils.newSockJs('/disabled_websocket_echo', 'websocket');\n      expect(sjs).to.be.ok();\n      sjs.onopen = sjs.onmessage = function () {\n        done(new Error('Open/Message event should not fire for disabled websockets'));\n        sjs.close();\n      };\n      sjs.onclose = function (e) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n\n        try {\n          expect(e.code).to.equal(2000);\n          expect(e.reason).to.equal('All transports failed');\n          expect(e.wasClean).to.equal(false);\n        } catch (err) {\n          done(err);\n          return;\n        }\n        done();\n      };\n    });\n\n    it('close on close', function (done) {\n      var test = this.runnable();\n      var sjs = testUtils.newSockJs('/close');\n      expect(sjs).to.be.ok();\n      sjs.onopen = function () {\n        expect(true).to.be.ok();\n      };\n      sjs.onmessage = function () {\n        done(new Error('Message should not be emitted'));\n        sjs.close();\n      };\n      sjs.onclose = function (e) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n\n        try {\n          expect(e.code).to.equal(3000);\n          expect(e.reason).to.equal('Go away!');\n          expect(e.wasClean).to.equal(true);\n        } catch (err) {\n          done(err);\n          return;\n        }\n\n        sjs.onclose = function () {\n          done(new Error());\n        };\n        sjs.close();\n        setTimeout(function () {\n          done();\n        }, 10);\n      };\n    });\n  });\n});\n"
  },
  {
    "path": "tests/lib/iframe.js",
    "content": "/* eslint quotes: \"off\", camelcase: \"off\" */\n'use strict';\n\nvar expect = require('expect.js')\n  , eventUtils = require('../../lib/utils/event')\n  , browser = require('../../lib/utils/browser')\n  , transportList = require('../../lib/transport-list')\n  , testUtils = require('./test-utils')\n  , echoTests = require('./echo-tests')\n  , IframeTransport = require('../../lib/transport/iframe')\n  ;\n\nfunction onunloadTest (code, done) {\n  var hook = testUtils.createIframe('/sockjs-test/iframe.html');\n  var i = 0;\n  hook.open = function () {\n    i++;\n    return hook.callback(code);\n  };\n  hook.load = function () {\n    i++;\n    return setTimeout(function () {\n      hook.iobj.cleanup();\n    }, 1);\n  };\n  hook.unload = function () {\n    try {\n      expect(i).to.equal(2);\n    } catch (e) {\n      done(e);\n      hook.del();\n      return;\n    }\n\n    hook.del();\n    done();\n  };\n}\n\ndescribe('iframe', function () {\n  if (!IframeTransport.enabled()) {\n    it('[unsupported]');\n    return;\n  }\n\n  if (browser.isOpera()) {\n    it('onunload [unsupported]');\n  } else {\n    it('onunload', function (done) {\n      this.timeout(5000);\n      onunloadTest(\"function attachEvent(event, listener) {\" +\n        \"    if (typeof window.addEventListener !== 'undefined') {\" +\n        \"        window.addEventListener(event, listener, false);\" +\n        \"    } else {\" +\n        \"        document.attachEvent('on' + event, listener);\" +\n        \"        window.attachEvent('on' + event, listener);\" +\n        \"    }\" +\n        \"}\" +\n        \"attachEvent('load', function(){\" +\n        \"    hook.load();\" +\n        \"});\" +\n        \"var w = 0;\" +\n        \"var run = function(){\" +\n        \"    if(w === 0) {\" +\n        \"        w = 1;\" +\n        \"        hook.unload();\" +\n        \"    }\" +\n        \"};\" +\n        \"attachEvent('beforeunload', run);\" +\n        \"attachEvent('unload', run);\", done);\n    });\n  }\n\n  it('onmessage', function (done) {\n    var hook = testUtils.createIframe('/sockjs-test/iframe.html');\n    var i = 0;\n    hook.open = function () {\n      i++;\n      hook.callback(\"\" +\n        \"function attachEvent(event, listener) {\" +\n        \"    if (typeof window.addEventListener !== 'undefined') {\" +\n        \"        window.addEventListener(event, listener, false);\" +\n        \"    } else {\" +\n        \"        document.attachEvent('on' + event, listener);\" +\n        \"        window.attachEvent('on' + event, listener);\" +\n        \"    }\" +\n        \"}\" +\n        \"attachEvent('message', function(e) {\" +\n        \"    var b = e.data;\" +\n        \"    parent.postMessage(window_id + ' ' + 'e', '*');\" +\n        \"});\" +\n        \"parent.postMessage(window_id + ' ' + 's', '*');\");\n    };\n    eventUtils.attachEvent('message', function (e) {\n      var msgParts = e.data.split(' ')\n        , windowId = msgParts[0]\n        , data = msgParts[1]\n        ;\n      if (windowId === hook.id) {\n        switch (data) {\n          case 's':\n            hook.iobj.loaded();\n            i++;\n            hook.iobj.post(hook.id + ' ' + 's', testUtils.getSameOriginUrl());\n            break;\n          case 'e':\n            try {\n              expect(i).to.equal(2);\n            } catch (err) {\n              done(err);\n              hook.iobj.cleanup();\n              hook.del();\n              return;\n            }\n\n            hook.iobj.cleanup();\n            hook.del();\n            done();\n            break;\n        }\n      }\n    });\n  });\n});\n\ndescribe('Transports', function () {\n  transportList.forEach(function (Trans) {\n    describe(Trans.transportName, function () {\n      if (!Trans.enabled({ cookie_needed: false, nullOrigin: false, sameScheme: true, sameOrigin: true })) {\n        it('[unsupported]');\n        return;\n      }\n\n      var transport = Trans.transportName;\n      var soUrl = testUtils.getSameOriginUrl();\n      describe('same origin', function () {\n        echoTests.echoFromChild(soUrl, transport);\n      });\n\n      // var corsUrl = testUtils.getCrossOriginUrl();\n      // if (corsUrl && corsUrl !== soUrl) {\n      //   describe('cross origin', function () {\n      //     echoTests.echoFromChild(corsUrl, transport);\n      //   });\n      // }\n    });\n  });\n});\n"
  },
  {
    "path": "tests/lib/main-node.js",
    "content": "'use strict';\n\nvar expect = require('expect.js')\n  , proxyquire = require('proxyquire')\n  ;\n\ndescribe('SockJS', function() {\n  describe('Constructor', function () {\n\n    describe('WebSocket specification step #2', function () {\n      var main = proxyquire('../../lib/main', { './location': {\n        protocol: 'https:'\n      }});\n      var sjs = proxyquire('../../lib/entry', { './main': main });\n\n      it('should throw SecurityError for an insecure url from a secure page', function () {\n        expect(function () {\n          sjs('http://localhost');\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(Error);\n          expect(e.message).to.contain('SecurityError');\n        });\n      });\n\n      // https://www.w3.org/TR/secure-contexts/#is-origin-trustworthy\n      it('should NOT throw SecurityError for 127.0.0.1/8 url from a secure page', function () {\n        expect(function () {\n          sjs('http://127.0.0.1');\n        }).to.not.throwException();\n      });\n\n      it('should NOT throw SecurityError for ::1 url from a secure page', function () {\n        expect(function () {\n          sjs('http://[::1]');\n        }).to.not.throwException();\n      });\n\n      it('should throw SyntaxError for an invalid url', function () {\n        expect(function () {\n          sjs('//localhost');\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(SyntaxError);\n        });\n      });\n\n      it('should throw SyntaxError for an empty url - #8', function () {\n        expect(function () {\n          sjs('');\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(SyntaxError);\n        });\n      });\n    });\n\n  });\n});\n"
  },
  {
    "path": "tests/lib/main.js",
    "content": "/* eslint new-cap: \"off\", no-new: \"off\" */\n'use strict';\n\nvar expect = require('expect.js')\n  , SockJS = require('../../lib/entry')\n  ;\n\ndescribe('SockJS', function() {\n  describe('Constructor', function () {\n    it('should support construction without new', function () {\n      var s = SockJS('http://localhost');\n      expect(s).to.be.a(SockJS);\n      s.close();\n    });\n\n    it('create a valid WebSocket object', function () {\n      var s = new SockJS('http://localhost');\n      expect(s).to.have.property('url', 'http://localhost');\n      expect(s).to.have.property('readyState', SockJS.CONNECTING);\n      expect(s).to.have.property('extensions', '');\n      expect(s).to.have.property('protocol', '');\n      s.close();\n    });\n\n    it('should not remove basic authentication credentials (1/2)', function () {\n      var s = new SockJS('http://user@localhost');\n      expect(s).to.have.property('url', 'http://user@localhost');\n      s.close();\n    });\n\n    it('should not remove basic authentication credentials (2/2)', function () {\n      var s = new SockJS('http://user:password@localhost');\n      expect(s).to.have.property('url', 'http://user:password@localhost');\n      s.close();\n    });\n\n    describe('WebSocket specification step #1', function () {\n      it('should throw TypeError for a null url', function () {\n        expect(function () {\n          new SockJS();\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(TypeError);\n        });\n      });\n\n      it('should throw SyntaxError when the url contains a fragment', function () {\n        expect(function () {\n          new SockJS('http://localhost/#test');\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(SyntaxError);\n        });\n      });\n\n      it('should throw SyntaxError for an invalid protocol', function () {\n        expect(function () {\n          new SockJS('ftp://localhost');\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(SyntaxError);\n        });\n      });\n    });\n\n    describe('WebSocket specification step #5', function () {\n      it('should throw SyntaxError for duplicated protocols', function () {\n        expect(function () {\n          new SockJS('http://localhost', ['test', 'test']);\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(SyntaxError);\n        });\n      });\n    });\n\n    it('should generate 8-character-long session ids by default', function () {\n      var s = SockJS('http://localhost');\n      expect(s._generateSessionId().length).to.be(8);\n      s.close();\n    });\n\n    it('should generate N-character-long session ids', function () {\n      for (var i = 1; i <= 100; i++) {\n        var s = SockJS('http://localhost', null, {sessionId: i});\n        expect(s._generateSessionId().length).to.be(i);\n        s.close();\n      }\n    });\n\n    it('should generate sessionIds using the custom generator function', function () {\n      var f = function() {\n        return 'this_is_not_random';\n      };\n      var s = SockJS('http://localhost', null, {sessionId: f});\n      expect(s._generateSessionId).to.be(f);\n      s.close();\n    });\n\n    it('should throw TypeError if sessionId is neither a number nor a function', function () {\n        expect(function () {\n          new SockJS('http://localhost', null, {sessionId: 'this is wrong'});\n        }).to.throwException(function (e) {\n          expect(e).to.be.a(TypeError);\n        });\n    });\n  });\n});\n"
  },
  {
    "path": "tests/lib/receivers.js",
    "content": "'use strict';\n\nvar expect = require('expect.js')\n  , JsonpReceiver = require('../../lib/transport/receiver/jsonp')\n  , EventSourceReceiver = require('../../lib/transport/receiver/eventsource')\n  , XhrReceiver = require('../../lib/transport/receiver/xhr')\n  , XhrFake = require('../../lib/transport/sender/xhr-fake')\n  , utils = require('../../lib/utils/iframe')\n  ;\n\ndescribe('Receivers', function () {\n  describe('jsonp', function () {\n    var oldTimeout = JsonpReceiver.timeout;\n    var oldScriptTimeout = JsonpReceiver.scriptErrorTimeout;\n    var scriptFunc = JsonpReceiver.prototype._createScript;\n    before(function () {\n      JsonpReceiver.prototype._createScript = function () {};\n      JsonpReceiver.timeout = 300;\n    });\n    after(function () {\n      JsonpReceiver.timeout = oldTimeout;\n      JsonpReceiver.scriptErrorTimeout = oldScriptTimeout;\n      JsonpReceiver.prototype._createScript = scriptFunc;\n    });\n\n    it('receives data', function (done) {\n      var test = this.runnable();\n      JsonpReceiver.prototype._createScript = function () {\n        var self = this;\n        setTimeout(function () {\n          global[utils.WPrefix][self.id]('datadata');\n        }, 5);\n      };\n      var jpr = new JsonpReceiver('test');\n      jpr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n\n        try {\n          expect(reason).to.equal('network');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      jpr.on('message', function (msg) {\n        try {\n          expect(msg).to.equal('datadata');\n        } catch (e) {\n          done(e);\n          jpr.abort();\n          return;\n        }\n      });\n    });\n\n    it('will timeout', function (done) {\n      this.timeout(500);\n      var test = this.runnable();\n      JsonpReceiver.prototype._createScript = function () {\n        var self = this;\n        setTimeout(function () {\n          if (global[utils.WPrefix][self.id]) {\n            global[utils.WPrefix][self.id]('datadata');\n          }\n        }, 400);\n      };\n\n      var jpr = new JsonpReceiver('test');\n      jpr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n\n        try {\n          expect(reason).to.contain('timeout');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      jpr.on('message', function () {\n        done(new Error('No message should be sent'));\n        jpr.abort();\n      });\n    });\n\n    it('aborts without sending a message', function (done) {\n      var test = this.runnable();\n      JsonpReceiver.prototype._createScript = function () {\n        var self = this;\n        setTimeout(function () {\n          if (global[utils.WPrefix][self.id]) {\n            global[utils.WPrefix][self.id]('datadata');\n          }\n        }, 200);\n      };\n      var jpr = new JsonpReceiver('test');\n      jpr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n\n        try {\n          expect(reason).to.contain('aborted');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      jpr.on('message', function () {\n        done(new Error('No message should be sent'));\n        jpr.abort();\n      });\n      jpr.abort();\n    });\n\n    it('will not report error if onerror triggered right before onreadystatechange (IE9)', function (done) {\n      JsonpReceiver.scriptErrorTimeout = 300;\n      var test = this.runnable();\n      JsonpReceiver.prototype._createScript = function () {\n        var self = this;\n        // simulate a normal JSONP response\n        setTimeout(function () {\n          self.loadedOkay = true;\n          global[utils.WPrefix][self.id]('datadata');\n        }, 200);\n      };\n\n      var jpr = new JsonpReceiver('test');\n      jpr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n        try {\n          expect(reason).to.equal('network');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      jpr.on('message', function (msg) {\n        try {\n          expect(msg).to.equal('datadata');\n        } catch (e) {\n          done(e);\n          jpr.abort();\n        }\n      });\n\n      // simulate script error\n      jpr._scriptError();\n    });\n\n    it('will not report error if onerror triggered right after onreadystatechange (IE9)', function (done) {\n      JsonpReceiver.scriptErrorTimeout = 100;\n      var test = this.runnable();\n      JsonpReceiver.prototype._createScript = function () {\n        var self = this;\n        // simulate a normal JSONP response\n        setTimeout(function () {\n          self.loadedOkay = true;\n          global[utils.WPrefix][self.id]('datadata');\n        }, 100);\n      };\n\n      var jpr = new JsonpReceiver('test');\n      jpr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n        try {\n          expect(reason).to.equal('network');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      jpr.on('message', function (msg) {\n        try {\n          expect(msg).to.equal('datadata');\n        } catch (e) {\n          done(e);\n          jpr.abort();\n        }\n      });\n\n      // simulate script error\n      setTimeout(function () {\n        jpr._scriptError();\n      }, 200);\n    });\n  });\n\n  describe('xhr', function () {\n    var oldTimeout;\n    before(function () {\n      oldTimeout = XhrFake.timeout;\n      XhrFake.timeout = 100;\n    });\n    after(function () {\n      XhrFake.timeout = oldTimeout;\n    });\n\n    it('emits multiple messages for multi-line response', function (done) {\n      var test = this.runnable();\n      var xhr = new XhrReceiver('test', XhrFake);\n      var i = 0, responses = ['test', 'multiple', 'lines', '{}'];\n      xhr.on('message', function (msg) {\n        try {\n          expect(msg).to.equal(responses[i]);\n        } catch (e) {\n          done(e);\n          xhr.abort();\n          return;\n        }\n        i++;\n      });\n      xhr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n        try {\n          expect(reason).to.equal('network');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      xhr._chunkHandler(200, 'test\\nmultiple\\nlines');\n    });\n\n    it('emits no messages for an empty string response', function (done) {\n      var test = this.runnable();\n      var xhr = new XhrReceiver('test', XhrFake);\n      var i = 0, responses = ['{}'];\n      xhr.on('message', function (msg) {\n        try {\n          expect(i).to.be.lessThan(responses.length);\n          expect(msg).to.equal(responses[i]);\n        } catch (e) {\n          done(e);\n          xhr.abort();\n          return;\n        }\n        i++;\n      });\n      xhr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n        try {\n          expect(reason).to.equal('network');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      xhr._chunkHandler(200, '');\n    });\n\n    it('aborts without sending a message', function (done) {\n      var test = this.runnable();\n      var xhr = new XhrReceiver('test', XhrFake);\n      xhr.on('message', function () {\n        done(new Error());\n        xhr.abort();\n      });\n      xhr.on('close', function (code, reason) {\n        if (test.timedOut || test.duration) {\n          return;\n        }\n        try {\n          expect(reason).to.equal('user');\n        } catch (e) {\n          done(e);\n          return;\n        }\n        done();\n      });\n      xhr.abort();\n    });\n  });\n\n  describe('eventsource', function () {\n    it('receives data', function(done) {\n      var eventSourceReceiver = new EventSourceReceiver('test');\n\n      eventSourceReceiver.on('message', function(msg) {\n        try {\n          expect(msg).to.equal('datadataaa');\n        } catch (e) {}\n        eventSourceReceiver.abort();\n        done();\n      });\n\n      eventSourceReceiver.es.dispatchEvent({\n        type: 'message',\n        detail: { data:  'datadataaa' }\n      })\n    });\n\n    it('correctly escapes characters', function(done) {\n      var eventSourceReceiver = new EventSourceReceiver('test');\n\n      eventSourceReceiver.on('message', function(msg) {\n        try {\n          expect(msg).to.equal('{ \\\\\"lastName\\\\\":\\\\\"#@%!~`%^&*()\\\\\" }');\n        } catch (e) {}\n        eventSourceReceiver.abort();\n        done();\n      });\n\n      eventSourceReceiver.es.dispatchEvent({\n        type: 'message',\n        detail: { data:  '{ \\\\\"lastName\\\\\":\\\\\"#@%!~`%^&*()\\\\\" }' }\n      })\n    });\n  });\n});\n"
  },
  {
    "path": "tests/lib/senders.js",
    "content": "'use strict';\n\nvar expect = require('expect.js')\n  , testUtils = require('./test-utils')\n  , XhrLocal = require('../../lib/transport/sender/xhr-local')\n  , XhrCors = require('../../lib/transport/sender/xhr-cors')\n  , Xdr = require('../../lib/transport/sender/xdr')\n  ;\n\nfunction ajaxSimple (Obj) {\n  it('simple', function (done) {\n    var x = new Obj('GET', testUtils.getSameOriginUrl() + '/simple.txt', null);\n    x.on('finish', function (status, text) {\n      try {\n        expect(text.length).to.equal(2051);\n        expect(text.slice(-2)).to.equal('b\\n');\n      } catch (e) {\n        done(e);\n        return;\n      }\n      done();\n    });\n  });\n}\n\nfunction ajaxStreaming (Obj) {\n  if (!XhrCors.enabled) {\n    it('streaming [unsupported]');\n    return;\n  }\n\n  it('streaming', function (done) {\n    var test = this.runnable();\n    var x = new Obj('GET', testUtils.getSameOriginUrl() + '/streaming.txt', null);\n    var i = 0;\n    x.on('chunk', function (status/*, text*/) {\n      try {\n        expect(status).to.equal(200);\n      } catch (e) {\n        done(e);\n        x.abort();\n        return;\n      }\n      i++;\n      // 2051 because of transparent proxies\n      //expect([2049, 2051]).to.contain(text.length);\n    });\n    x.on('finish', function (status, text) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(i).to.be.greaterThan(0);\n        expect(status).to.equal(200);\n        expect(text.slice(-4)).to.equal('a\\nb\\n');\n      } catch (e) {\n        done(e);\n        return;\n      }\n      done();\n    });\n  });\n}\n\nfunction wrongUrl(Obj, url, statuses) {\n  it('wrong url ' + url, function (done) {\n    var test = this.runnable();\n    // Selenium has a long timeout for when it can't connect to the port\n    this.timeout(30000);\n    var x = new Obj('GET', url, null);\n    x.timeout = 10000;\n    x.on('chunk', function (status, text) {\n      done(new Error('No chunk should be received: ' + status + ', ' + text));\n      x.abort();\n    });\n    x.on('finish', function (status, text) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(statuses).to.contain(status);\n        expect(text).not.to.be(undefined);\n      } catch (e) {\n        done(e);\n        return;\n      }\n      done();\n    });\n  });\n}\n\nfunction wrongPort (Obj) {\n  var badUrl;\n  if (global.location) {\n    badUrl = global.location.protocol + '//' + global.location.hostname + ':';\n  } else {\n    badUrl = 'http://localhost:';\n  }\n\n  var ports = [25, 8999, 65300];\n  ports.forEach(function (port) {\n    // Sauce Labs/Selenium returns 400 when it can't connect to the port\n    wrongUrl(Obj, badUrl + port + '/wrong_url_indeed.txt', [0, 400]);\n  });\n}\n\ndescribe('Senders', function () {\n  describe('xhr-local', function () {\n    ajaxSimple(XhrLocal);\n    ajaxStreaming(XhrLocal);\n    // TODO senders don't have a timeouts so these tests can fail\n    // BUT info-receiver has a timeout so they will never not-return\n    // wrongPort(XhrLocal);\n    wrongUrl(XhrLocal, testUtils.getSameOriginUrl() + '/wrong_url_indeed.txt', [0, 404]);\n  });\n\n  describe('xdr', function () {\n    if (!Xdr.enabled) {\n      it('[unsupported]');\n      return;\n    }\n    ajaxSimple(Xdr);\n    ajaxStreaming(Xdr);\n    wrongPort(Xdr);\n    wrongUrl(Xdr, testUtils.getSameOriginUrl() + '/wrong_url_indeed.txt', [0, 400]);\n  });\n});\n"
  },
  {
    "path": "tests/lib/test-utils.js",
    "content": "'use strict';\n\nvar SockJS = require('../../lib/entry')\n  , iframeUtils = require('../../lib/utils/iframe')\n  , urlUtils = require('../../lib/utils/url')\n  , random = require('../../lib/utils/random')\n  ;\n\nvar MPrefix = '_sockjs_global';\n\nmodule.exports = {\n  getSameOriginUrl: function () {\n    if (global.location) {\n      return urlUtils.getOrigin(global.location.href) + '/sockjs-test';\n    }\n    return 'http://localhost:8081';\n  }\n\n, getCrossOriginUrl: function () {\n    if (global.clientOptions) {\n      return global.clientOptions.url;\n    }\n    return null;\n  }\n\n, getUrl: function (path) {\n    return /^http/.test(path) ? path : this.getSameOriginUrl() + path;\n  }\n\n, newSockJs: function (path, transport) {\n    return new SockJS(this.getUrl(path), null, { transports: transport });\n  }\n\n, createHook: function () {\n    var windowId = 'a' + random.string(8);\n    if (!global[MPrefix]) {\n      var map = {};\n      global[MPrefix] = function(id) {\n        if (!(id in map)) {\n          map[id] = {\n            id: id,\n            del: function() {\n              delete map[id];\n            }\n          };\n        }\n        return map[id];\n      };\n    }\n    return global[MPrefix](windowId);\n  }\n\n, createIframe: function (path) {\n    path = path || '/iframe.html';\n    var hook = this.createHook();\n    hook.iobj = iframeUtils.createIframe(path + '?a=' + random.number(1000) + '#' + hook.id, function (err) {\n      throw (err || new Error('iframe error'));\n    });\n    return hook;\n  }\n};\n"
  },
  {
    "path": "tests/lib/transports.js",
    "content": "/* eslint camelcase: \"off\" */\n'use strict';\n\nvar expect = require('expect.js')\n  , transportList = require('../../lib/transport-list')\n  , testUtils = require('./test-utils')\n  , echoTests = require('./echo-tests')\n  , batchTests = require('./batch-tests')\n  , SockJS = require('../../lib/entry')\n  ;\n\nfunction userClose(url, transport) {\n  it('user close', function (done) {\n    var test = this.runnable();\n    this.timeout(10000);\n    var sjs = new SockJS(url + '/echo', null, { transports: transport });\n    expect(sjs).to.be.ok();\n    var counter = 0;\n\n    sjs.onopen = function() {\n      counter++;\n      try {\n        expect(counter).to.equal(1);\n        sjs.close(3000, 'User message');\n        expect(counter).to.equal(1);\n      } catch (e) {\n        done(e);\n      }\n    };\n    sjs.onmessage = function() {\n      done(new Error());\n      sjs.close();\n      counter++;\n    };\n    sjs.onclose = function(e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      counter++;\n      try {\n        expect(e.wasClean).to.equal(true);\n        expect(counter).to.equal(2);\n      } catch (err) {\n        done(err);\n        return;\n      }\n\n      done();\n    };\n  });\n}\n\nfunction serverClose(url, transport) {\n  it('server close', function (done) {\n    var test = this.runnable();\n    this.timeout(10000);\n    var sjs = new SockJS(url + '/close', null, { transports: transport });\n    expect(sjs).to.be.ok();\n    var i = 0;\n    sjs.onopen = function() {\n      i++;\n    };\n    sjs.onmessage = function() {\n      done(new Error());\n      sjs.close();\n    };\n    sjs.onclose = function(e) {\n      if (test.timedOut || test.duration) {\n        return;\n      }\n\n      try {\n        expect(i).to.equal(1);\n        expect(e.code).to.equal(3000);\n        expect(e.reason).to.equal('Go away!');\n        expect(e.wasClean).to.equal(true);\n      } catch (err) {\n        done(err);\n        return;\n      }\n      done();\n    };\n  });\n}\n\nfunction runTests(url, transport) {\n  echoTests.echoBasic(url, transport);\n  echoTests.echoQueryString(url, transport);\n  echoTests.echoRich(url, transport);\n  echoTests.echoUnicode(url, transport);\n  echoTests.echoSpecialChars(url, transport);\n  echoTests.echoLargeMessage(url, transport);\n  echoTests.echoUtfEncodingSimple(url, transport);\n  echoTests.echoUtfEncoding(url, transport);\n\n  batchTests.largeMessage(url, transport);\n  batchTests.largeDownload(url, transport);\n\n  userClose(url, transport);\n  serverClose(url, transport);\n}\n\ndescribe('Transports', function () {\n  transportList.forEach(function (Trans) {\n    describe(Trans.transportName, function () {\n      it('has a valid interface', function () {\n        expect(Trans).to.be.ok();\n        expect(Trans).to.have.property('transportName');\n        expect(Trans.transportName.length).to.be.greaterThan(0);\n\n        expect(Trans).to.have.property('roundTrips');\n        expect(Trans.roundTrips).to.be.a('number');\n\n        expect(Trans).to.have.property('enabled');\n        expect(Trans.enabled).to.be.a('function');\n\n        expect(Trans.prototype).to.have.property('send');\n        expect(Trans.prototype.send).to.be.a('function');\n\n        expect(Trans.prototype).to.have.property('close');\n        expect(Trans.prototype.close).to.be.a('function');\n\n        //var t = new Trans('http://localhost');\n        //expect(t).to.be.an(EventEmitter);\n        // TODO tests for event emitting\n      });\n\n      if (!Trans.enabled({ cookie_needed: false, nullOrigin: false, sameScheme: true, sameOrigin: true })) {\n        it('[unsupported]');\n        return;\n      }\n\n      var transport = Trans.transportName;\n\n      var soUrl = testUtils.getSameOriginUrl();\n      describe('same origin', function () {\n        runTests(soUrl, transport);\n      });\n\n      // var corsUrl = testUtils.getCrossOriginUrl();\n      // if (corsUrl && corsUrl !== soUrl) {\n      //   describe('cross origin', function () {\n      //     runTests(corsUrl, transport);\n      //   });\n      // }\n    });\n  });\n});\n"
  },
  {
    "path": "tests/lib/utils-event.js",
    "content": "'use strict';\n\nvar expect = require('expect.js');\n\nfunction clearEventUtilsCache() {\n  delete require.cache[require.resolve('../../lib/utils/event')];\n}\n\ndescribe('utils/event', function () {\n  var originalAddEventListener;\n  var originalOnPageHide;\n  var originalChrome;\n  var hadOnPageHide;\n  var hadChrome;\n\n  beforeEach(function () {\n    originalAddEventListener = global.addEventListener;\n    hadOnPageHide = Object.prototype.hasOwnProperty.call(global, 'onpagehide');\n    originalOnPageHide = global.onpagehide;\n    hadChrome = Object.prototype.hasOwnProperty.call(global, 'chrome');\n    originalChrome = global.chrome;\n    // Ensure not a packaged app during tests\n    global.chrome = null;\n  });\n\n  afterEach(function () {\n    global.addEventListener = originalAddEventListener;\n    if (hadOnPageHide) {\n      global.onpagehide = originalOnPageHide;\n    } else {\n      delete global.onpagehide;\n    }\n    if (hadChrome) {\n      global.chrome = originalChrome;\n    } else {\n      delete global.chrome;\n    }\n    clearEventUtilsCache();\n  });\n\n  it('uses pagehide when supported', function () {\n    var registeredEvents = [];\n    global.addEventListener = function (event, listener) {\n      registeredEvents.push(event);\n    };\n    global.onpagehide = function () {};\n\n    clearEventUtilsCache();\n    var eventUtils = require('../../lib/utils/event');\n    expect(eventUtils).to.be.ok();\n\n    expect(registeredEvents).to.eql(['pagehide']);\n  });\n\n  it('falls back to unload when pagehide unsupported', function () {\n    var registeredEvents = [];\n    global.addEventListener = function (event, listener) {\n      registeredEvents.push(event);\n    };\n    delete global.onpagehide;\n\n    clearEventUtilsCache();\n    var eventUtils = require('../../lib/utils/event');\n    expect(eventUtils).to.be.ok();\n\n    expect(registeredEvents).to.eql(['unload']);\n  });\n});\n"
  },
  {
    "path": "tests/lib/utils.js",
    "content": "'use strict';\n\nvar expect = require('expect.js');\n\ndescribe('utils', function () {\n  describe('random', function () {\n    var random = require('../../lib/utils/random');\n    describe('string', function () {\n      it('should generate unique outputs', function () {\n        expect(random.string(8)).not.to.equal(random.string(8));\n      });\n\n      it('should have the correct length', function () {\n        var lengths = [1, 2, 3, 128];\n        lengths.forEach(function (len) {\n          expect(random.string(len).length).to.equal(len);\n        });\n      });\n    });\n\n    describe('numberString', function () {\n      it('should have the correct length based on the max', function () {\n        expect(random.numberString(10).length).to.equal(1);\n        expect(random.numberString(100).length).to.equal(2);\n        expect(random.numberString(1000).length).to.equal(3);\n        expect(random.numberString(10000).length).to.equal(4);\n        expect(random.numberString(100000).length).to.equal(5);\n      });\n    });\n  });\n\n  describe('url', function () {\n    var urlUtils = require('../../lib/utils/url');\n    it('getOrigin', function () {\n      expect(urlUtils.getOrigin('http://a.b/')).to.equal('http://a.b:80');\n      expect(urlUtils.getOrigin('http://a.b/c')).to.equal('http://a.b:80');\n      expect(urlUtils.getOrigin('http://a.b:123/c')).to.equal('http://a.b:123');\n      expect(urlUtils.getOrigin('https://a.b/')).to.equal('https://a.b:443');\n      expect(urlUtils.getOrigin('file://a.b/')).to.equal(null);\n    });\n\n    it('isOriginEqual', function () {\n      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost/')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost/abc')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost/', 'http://localhost')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost:8080')).to.not.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost:8080', 'http://localhost')).to.not.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost:8080', 'http://localhost:8080/')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:80/', 'http://127.0.0.1:80/a')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:80', 'http://127.0.0.1:80/a')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost:80')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1/', 'http://127.0.0.1:80/a')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:9', 'http://127.0.0.1:9999')).to.not.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:99', 'http://127.0.0.1:9999')).to.not.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:999', 'http://127.0.0.1:9999')).to.not.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:9999', 'http://127.0.0.1:9999')).to.be.ok();\n      expect(urlUtils.isOriginEqual('http://127.0.0.1:99999', 'http://127.0.0.1:9999')).to.not.be.ok();\n    });\n\n    it('isSchemeEqual', function () {\n      expect(urlUtils.isSchemeEqual('http://localhost', 'http://localhost/')).to.be.ok();\n      expect(urlUtils.isSchemeEqual('http://localhost', 'https://localhost/')).to.not.be.ok();\n      expect(urlUtils.isSchemeEqual('http://localhost', 'file://localhost/')).to.not.be.ok();\n    });\n  });\n\n  describe('escape', function () {\n    var escape = require('../../lib/utils/escape');\n    describe('quote', function () {\n      it('handles empty string', function () {\n        expect(escape.quote('')).to.equal('\"\"');\n      });\n\n      it('handles non-empty string', function () {\n        expect(escape.quote('a')).to.equal('\"a\"');\n      });\n\n      it('handles tab and newline', function () {\n        expect(['\"\\\\t\"', '\"\\\\u0009\"']).to.contain(escape.quote('\\t'));\n        expect(['\"\\\\n\"', '\"\\\\u000a\"']).to.contain(escape.quote('\\n'));\n      });\n\n      it('handles unicode', function () {\n        expect(escape.quote('\\x00\\udfff\\ufffe\\uffff')).to.equal('\"\\\\u0000\\\\udfff\\\\ufffe\\\\uffff\"');\n        expect(escape.quote('\\ud85c\\udff7\\ud800\\ud8ff')).to.equal('\"\\\\ud85c\\\\udff7\\\\ud800\\\\ud8ff\"');\n        expect(escape.quote('\\u2000\\u2001\\u0300\\u0301')).to.equal('\"\\\\u2000\\\\u2001\\\\u0300\\\\u0301\"');\n      });\n\n      it.skip('handles all 64K characters round-trip', function () {\n        var c = [];\n        for (var i = 0; i <= 65536; i++) {\n          c.push(String.fromCharCode(i));\n        }\n        var allChars = c.join('');\n        expect(JSON.parse(escape.quote(allChars))).to.equal(allChars);\n      });\n    });\n  });\n\n  describe('object', function () {\n    var objectUtils = require('../../lib/utils/object');\n    it('extend', function () {\n      var a, b;\n      expect(objectUtils.extend({}, {})).to.eql({});\n      a = {\n        a: 1\n      };\n      expect(objectUtils.extend(a, {})).to.eql(a);\n      expect(objectUtils.extend(a, {\n        b: 1\n      })).to.eql(a);\n      a = {\n        a: 1\n      };\n      b = {\n        b: 2\n      };\n      expect(objectUtils.extend(a, b)).to.eql({\n        a: 1,\n        b: 2\n      });\n      expect(a).to.eql({\n        a: 1,\n        b: 2\n      });\n      expect(b).to.eql({\n        b: 2\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "tests/node.js",
    "content": "'use strict';\n\nvar server = require('./support/sockjs_server')(8081, {\n\tlistenAddress: '0.0.0.0',\n\tport: 8081\n});\n\n// Load utils-event tests early to avoid global side-effects from other modules\nrequire('./lib/utils-event');\n\nrequire('./lib/main');\nrequire('./lib/main-node');\nrequire('./lib/utils');\nrequire('./lib/receivers');\nrequire('./lib/senders');\nrequire('./lib/end-to-end');\nrequire('./lib/transports');\n\nafter(function() {\n\tserver.close();\n});\n"
  },
  {
    "path": "tests/support/domain.js",
    "content": "// eslint-disable-next-line no-self-assign\ndocument.domain = document.domain;\n"
  },
  {
    "path": "tests/support/manual.js",
    "content": "'use strict';\n\nrequire('./sockjs_server')(8081, {\n\tlistenAddress: '127.0.0.1',\n\tport: 8081\n});\n"
  },
  {
    "path": "tests/support/sockjs_app.js",
    "content": "/* eslint camelcase: \"off\" */\n'use strict';\nvar sockjs = require('sockjs');\nvar debug = require('debug')('sockjs-client:test-server:app');\n\nexports.install = function(opts, server) {\n  var sjs_echo = sockjs.createServer(opts);\n  sjs_echo.on('connection', function(conn) {\n    debug('    [+] echo open    ' + conn);\n    conn.on('close', function() {\n      debug('    [-] echo close   ' + conn);\n    });\n    conn.on('data', function(m) {\n      var d = JSON.stringify(m);\n      debug('    [ ] echo message ' + conn,\n                  d.slice(0, 64) +\n                  ((d.length > 64) ? '...' : ''));\n      conn.write(m);\n    });\n  });\n\n  var sjs_close = sockjs.createServer(opts);\n  sjs_close.on('connection', function(conn) {\n    debug('    [+] close open    ' + conn);\n    conn.close(3000, 'Go away!');\n    conn.on('close', function() {\n      debug('    [-] close close   ' + conn);\n    });\n  });\n\n  var sjs_ticker = sockjs.createServer(opts);\n  sjs_ticker.on('connection', function(conn) {\n    debug('    [+] ticker open   ' + conn);\n    var tref;\n    var schedule = function() {\n      conn.write('tick!');\n      tref = setTimeout(schedule, 1000);\n    };\n    tref = setTimeout(schedule, 1000);\n    conn.on('close', function() {\n      clearTimeout(tref);\n      debug('    [-] ticker close   ' + conn);\n    });\n  });\n\n  var broadcast = {};\n  var sjs_broadcast = sockjs.createServer(opts);\n  sjs_broadcast.on('connection', function(conn) {\n    debug('    [+] broadcast open ' + conn);\n    broadcast[conn.id] = conn;\n    conn.on('close', function() {\n      delete broadcast[conn.id];\n      debug('    [-] broadcast close' + conn);\n    });\n    conn.on('data', function(m) {\n      debug('    [-] broadcast message', m);\n      for(var id in broadcast) {\n          broadcast[id].write(m);\n      }\n    });\n  });\n\n  var sjs_amplify = sockjs.createServer(opts);\n  sjs_amplify.on('connection', function(conn) {\n    debug('    [+] amp open    ' + conn);\n    conn.on('close', function() {\n      debug('    [-] amp close   ' + conn);\n    });\n    conn.on('data', function(m) {\n      var n = Math.floor(Number(m));\n      n = (n > 0 && n < 19) ? n : 1;\n      debug('    [ ] amp message: 2^' + n);\n      conn.write(new Array(Math.pow(2, n) + 1).join('x'));\n    });\n  });\n\n\n  sjs_echo.installHandlers(server, {prefix: '/echo',\n                                    response_limit: 4096});\n  sjs_echo.installHandlers(server, {prefix: '/disabled_websocket_echo',\n                                    websocket: false});\n  sjs_echo.installHandlers(server, {prefix: '/cookie_needed_echo',\n                                    jsessionid: true});\n  sjs_close.installHandlers(server, {prefix: '/close'});\n  sjs_ticker.installHandlers(server, {prefix: '/ticker'});\n  sjs_amplify.installHandlers(server, {prefix: '/amplify'});\n  sjs_broadcast.installHandlers(server, {prefix: '/broadcast'});\n};\n"
  },
  {
    "path": "tests/support/sockjs_server.js",
    "content": "/* eslint camelcase: \"off\", no-console: \"off\" */\n'use strict';\n\nvar http = require('http');\nvar serveStatic = require('serve-static');\nvar sockjs = require('./sockjs_app');\nvar URL = require('url').URL;\nvar path = require('path');\nvar debug = require('debug')('sockjs-client:test-server:main');\n\nfunction startServer(port, config, prefix) {\n  var clientOptions = {\n    // Address of a sockjs test server.\n    url: 'http://' + config.listenAddress + ':' + config.port,\n    sockjs_opts: {\n        // websocket:false\n        info: {cookie_needed: false}\n    }\n  };\n\n  var serve = serveStatic(path.join(__dirname, '../html'), { fallthrough: false });\n\n  var server = http.createServer();\n  server.addListener('request', function(req, res) {\n    if ( /\\/slow-script.js/.test(req.url) ) {\n      res.setHeader('content-type', 'application/javascript');\n      res.writeHead(200);\n      setTimeout(function() {\n          res.end('var a = 1;\\n');\n      }, 500);\n    } else if ( /\\/streaming.txt/.test(req.url) ) {\n      res.setHeader('content-type', 'text/plain');\n      res.setHeader('Access-Control-Allow-Origin', '*');\n\n      res.writeHead(200);\n      res.write(new Array(2049).join('a') + '\\n');\n      setTimeout(function() {\n          res.end('b\\n');\n      }, 250);\n    } else if ( /\\/simple.txt/.test(req.url) ) {\n      res.setHeader('content-type', 'text/plain');\n      res.setHeader('Access-Control-Allow-Origin', '*');\n      res.writeHead(200);\n      res.end(new Array(2049).join('a') + '\\nb\\n');\n    } else if (req.url === '/config.js') {\n      if (req.headers.referer) {\n        var parsedOrigin = new URL(req.headers.referer);\n        clientOptions.url = parsedOrigin.protocol + '//' + parsedOrigin.hostname + ':' + config.port;\n      }\n      res.setHeader('content-type', 'application/javascript');\n      res.writeHead(200);\n      res.end('var clientOptions = ' +\n              JSON.stringify(clientOptions) + ';');\n    } else {\n      serve(req, res, function(err) {\n        var status = err ? err.statusCode : 404;\n        return res.writeHead(status).end();\n      });\n    }\n  });\n  server.addListener('upgrade', function(req, res){\n    console.log('upgrade kill');\n    res.end();\n  });\n\n  sockjs.install({\n    sockjs_url: 'http://' + config.listenAddress + ':' + config.port + (prefix || '') + '/lib/sockjs.js',\n    websocket: true,\n    log: function (severity, message) {\n      debug('[%s] %s', severity, message);\n    }\n  }, server);\n\n  console.log(' [*] Listening on', port);\n  server.listen(port);\n  return server;\n}\n\nmodule.exports = startServer;\n"
  }
]