Python control program
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 8 Mar 2016 06:19:57 +0000 (22:19 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 8 Mar 2016 06:19:57 +0000 (22:19 -0800)
29 files changed:
.gitignore [new file with mode: 0644]
Makefile [new file with mode: 0644]
README.md
SConstruct [deleted file]
bbctrl.init.d [new file with mode: 0644]
bbctrl.py [new file with mode: 0755]
package.json [new file with mode: 0644]
setup.sh [deleted file]
setup_rpi.sh [new file with mode: 0755]
src/bbmc.cpp [deleted file]
src/bbmc.scons [deleted file]
src/bbmc/App.cpp [deleted file]
src/bbmc/App.h [deleted file]
src/bbmc/Server.cpp [deleted file]
src/bbmc/Server.h [deleted file]
src/bbmc/Transaction.cpp [deleted file]
src/bbmc/Transaction.h [deleted file]
src/jade/index.jade [new file with mode: 0644]
src/js/app.js [new file with mode: 0644]
src/js/gauge.js [new file with mode: 0644]
src/js/main.js [new file with mode: 0644]
src/js/slider.js [new file with mode: 0644]
src/resources/css/fd-slider-tooltip.css [new file with mode: 0644]
src/resources/css/fd-slider.css [new file with mode: 0644]
src/resources/js/fd-slider.min.js [new file with mode: 0644]
src/resources/js/gauge.min.js [new file with mode: 0644]
src/resources/js/socket.io.js [new file with mode: 0644]
src/resources/js/sockjs.min.js [new file with mode: 0644]
src/stylus/style.styl [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..99a7751
--- /dev/null
@@ -0,0 +1,4 @@
+.sconf_temp/
+.sconsign.dblite
+*~
+\#*
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..ebbe0d9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,65 @@
+DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))
+
+NODE_MODS  := $(DIR)/node_modules
+JADE       := $(NODE_MODS)/jade/bin/jade.js
+STYLUS     := $(NODE_MODS)/stylus/bin/stylus
+AP         := $(NODE_MODS)/autoprefixer/autoprefixer
+BROWSERIFY := $(NODE_MODS)/browserify/bin/cmd.js
+
+HTTP      := http
+HTML      := index
+HTML      := $(patsubst %,$(HTTP)/%.html,$(HTML))
+CSS       := style
+CSS       := $(patsubst %,$(HTTP)/%.css,$(CSS))
+JS        := $(wildcard src/js/*.js)
+JS_ASSETS := $(HTTP)/js/assets.js
+TEMPLS    := $(wildcard src/jade/templates/*.jade)
+STATIC    := $(shell find src/resources -type f)
+STATIC    := $(patsubst src/resources/%,http/%,$(STATIC))
+
+WATCH := src/jade src/stylus src/js Makefile
+
+TARGETS := $(HTML) $(CSS) $(JS_ASSETS) $(STATIC)
+
+all: node_modules $(TARGETS) copy
+
+copy: $(TARGETS)
+       cp -r bbctrl.py http/ bbctrl/
+
+$(HTTP)/admin.html: build/templates.jade
+
+$(HTTP)/%.html: src/jade/%.jade
+       $(JADE) -P $< --out $(shell dirname $@) || \
+       (rm -f $@; exit 1)
+
+$(HTTP)/%.css: src/stylus/%.styl
+       mkdir -p $(shell dirname $@)
+       $(STYLUS) < $< > $@ || (rm -f $@; exit 1)
+
+$(HTTP)/%: src/resources/%
+       install -D $< $@
+
+build/templates.jade: $(TEMPLS)
+       mkdir -p build
+       cat $(TEMPLS) >$@
+
+$(JS_ASSETS): $(JS)
+       @mkdir -p $(shell dirname $@)
+       $(BROWSERIFY) src/js/main.js -s main -o $@ || \
+       (rm -f $@; exit 1)
+
+node_modules:
+       npm install
+
+watch:
+       @clear
+       $(MAKE)
+       @while sleep 1; do \
+         inotifywait -qr -e modify -e create -e delete \
+               --exclude .*~ --exclude \#.* $(WATCH); \
+         clear; \
+         $(MAKE); \
+       done
+
+clean:
+       rm -rf $(HTTP)
index a178df303707161f7c1317dd34c796e913151589..d42b74b3ab33f6b755ab7ec71648d1ae9450a539 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,11 +42,11 @@ ssh pi@<ip>
 Substitute ``<ip>`` with the correct IP address.  The default password is ``raspberry``.  You should see a prompt like this: ``pi@raspberrypi ~ $``, but in color.
 
 ## Configure the RPi
-Copy the ``setup.sh`` script to the RPi and run it as root:
+Copy the ``setup_rpi.sh`` script to the RPi and run it as root:
 
 ```
-scp setup.sh pi@<ip>:
-ssh pi@<ip> sudo ./setup.sh
+scp setup_rpi.sh pi@<ip>:
+ssh pi@<ip> sudo ./setup_rpi.sh
 ```
 
 This will take some time and will end by rebooting the RPi.  After this script has run you can log in to the RPi with out typing the IP addrerss like this:
diff --git a/SConstruct b/SConstruct
deleted file mode 100644 (file)
index f0ddf65..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-# Setup
-import os
-env = Environment(ENV = os.environ)
-try:
-    env.Tool('config', toolpath = [os.environ.get('CBANG_HOME')])
-except Exception, e:
-    raise Exception, 'CBANG_HOME not set?\n' + str(e)
-
-env.CBLoadTools('compiler cbang dist resources build_info packager')
-conf = env.CBConfigure()
-
-# Settings
-name = 'bbmc'
-
-# Version
-version = '0.0.1'
-major, minor, revision = version.split('.')
-
-# Config vars
-env.Replace(PACKAGE_VERSION = version)
-env.Replace(RESOURCES_NS = 'bbmc')
-env.Replace(BUILD_INFO_NS = 'bbmc::BuildInfo')
-
-if not env.GetOption('clean') and not 'package' in COMMAND_LINE_TARGETS:
-    conf.CBConfig('compiler')
-
-    conf.CBConfig('cbang')
-    env.CBDefine('USING_CBANG') # Using CBANG macro namespace
-
-    conf.CBRequireLib('re2')
-    conf.CBRequireCXXHeader('re2/re2.h')
-
-conf.Finish()
-
-# Program
-Export('env name')
-prog, lib = \
-    SConscript('src/%s.scons' % name, variant_dir = 'build', duplicate = 0)
-Default(prog)
-
-# Clean
-Clean(prog, ['build', 'config.log'])
-
-# Dist
-docs = ['README.md']
-tar = env.TarBZ2Dist(name, docs + [prog])
-Alias('dist', tar)
-AlwaysBuild(tar)
-
-description = \
-'''
-Buildbotics Machine Controller
-'''
-
-short_description = description
-
-
-if 'package' in COMMAND_LINE_TARGETS:
-    pkg = env.Packager(
-        name,
-        version = version,
-        maintainer = 'Joseph Coffland <joseph@cauldrondevelopment.com>',
-        vendor = 'Buildbotics LLC',
-        url = 'http://github.com/buildbotics/machine-controller/',
-        license = 'copyright',
-        bug_url = 'https://github.com/buildbotics/machine-controller/issues',
-        summary = 'Buildbotics Machine Controller',
-        description = description,
-        prefix = '/usr',
-
-        documents = docs,
-        programs = [str(prog[0])],
-        init_d = [['scripts/' + name + '.init.d', name]],
-        changelog = 'ChangeLog',
-
-        deb_directory = 'debian',
-        deb_section = 'science',
-        deb_depends = 'debconf | debconf-2.0, libc6, bzip2, zlib1g',
-        deb_pre_depends = 'adduser, ssl-cert',
-        deb_priority = 'optional',
-        )
-
-    AlwaysBuild(pkg)
-    env.Alias('package', pkg)
-
-    f = None
-    try:
-        f = open('package-description.txt', 'w')
-        f.write(short_description.strip())
-    finally:
-        if f is not None: f.close()
diff --git a/bbctrl.init.d b/bbctrl.init.d
new file mode 100644 (file)
index 0000000..cc1f882
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          bbctl
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Buildbotics Controller Web service
+# Description:       Buildbotics Controller Web service
+### END INIT INFO
+
+DAEMON=/usr/local/bin/bbctrl.py
+DAEMON_NAME=bbctrl
+DAEMON_OPTS=""
+DAEMON_USER=root
+PIDFILE=/var/run/$DAEMON_NAME.pid
+
+
+. /lib/lsb/init-functions
+
+
+do_start () {
+    log_daemon_msg "Starting system $DAEMON_NAME daemon"
+    start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile \
+        --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- \
+        $DAEMON_OPTS
+    log_end_msg $?
+}
+
+
+do_stop () {
+    log_daemon_msg "Stopping system $DAEMON_NAME daemon"
+    start-stop-daemon --stop --pidfile $PIDFILE --retry 10
+    log_end_msg $?
+}
+
+
+case "$1" in
+    start|stop) do_${1} ;;
+    restart|reload|force-reload) do_stop; do_start ;;
+    status)
+        status_of_proc "$DAEMON_NAME" "$DAEMON" && exit 0 || exit $?
+        ;;
+
+    *)
+        echo "Usage: /etc/init.d/$DAEMON_NAME {start|stop|restart|status}"
+        exit 1
+        ;;
+esac
diff --git a/bbctrl.py b/bbctrl.py
new file mode 100755 (executable)
index 0000000..c6f8a48
--- /dev/null
+++ b/bbctrl.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+
+## Change this to match your local settings
+SERIAL_PORT = '/dev/ttyAMA0'
+SERIAL_BAUDRATE = 115200
+
+import os
+from tornado import web, ioloop
+from sockjs.tornado import SockJSRouter, SockJSConnection
+import json
+import serial
+import multiprocessing
+
+DIR = os.path.dirname(__file__)
+
+state = {}
+clients = []
+
+input_queue = multiprocessing.Queue()
+output_queue = multiprocessing.Queue()
+
+
+class SerialProcess(multiprocessing.Process):
+    def __init__(self, input_queue, output_queue):
+        multiprocessing.Process.__init__(self)
+        self.input_queue = input_queue
+        self.output_queue = output_queue
+        self.sp = serial.Serial(SERIAL_PORT, SERIAL_BAUDRATE, timeout = 1)
+        self.input_queue.put('\n')
+
+
+    def close(self):
+        self.sp.close()
+
+    def writeSerial(self, data):
+        self.sp.write(data.encode())
+
+
+    def readSerial(self):
+        return self.sp.readline().replace("\n", "")
+
+
+    def run(self):
+        self.sp.flushInput()
+        while True:
+            # look for incoming tornado request
+            if not self.input_queue.empty():
+                data = self.input_queue.get()
+                # send it to the serial device
+                self.writeSerial(data)
+
+            # look for incoming serial data
+            if (self.sp.inWaiting() > 0):
+                data = self.readSerial()
+                # send it back to tornado
+                self.output_queue.put(data)
+                print data
+
+
+
+class Connection(SockJSConnection):
+    def on_open(self, info):
+        clients.append(self)
+        self.send(state)
+
+    def on_close(self):
+        clients.remove(self)
+
+
+    def on_message(self, data):
+        input_queue.put(data + '\n')
+
+
+
+# check the queue for pending messages, and rely that to all connected clients
+def checkQueue():
+    while not output_queue.empty():
+        try:
+            msg = json.loads(output_queue.get())
+            state.update(msg)
+            for c in clients: c.send(msg)
+        except: pass
+
+
+handlers = [
+    (r'/(.*)', web.StaticFileHandler,
+     {'path': os.path.join(DIR, 'http/'),
+      "default_filename": "index.html"}),
+    ]
+
+router = SockJSRouter(Connection, '/ws')
+
+
+if __name__ == "__main__":
+    import logging
+    logging.getLogger().setLevel(logging.DEBUG)
+
+    # Start the serial worker
+    sp = SerialProcess(input_queue, output_queue)
+    sp.daemon = True
+    sp.start()
+
+    # Adjust the interval according to frames sent by serial port
+    ioloop.PeriodicCallback(checkQueue, 100).start()
+
+    # Start the web server
+    app = web.Application(router.urls + handlers)
+    app.listen(8080)
+    ioloop.IOLoop.instance().start()
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..eff8596
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "name": "bbctrl",
+  "private": true,
+
+  "dependencies": {
+    "autoprefixer": ">=3.0.0",
+    "jade": ">=1.3.0",
+    "stylus": ">=0.42.3",
+    "browserify": ">=8.1.1"
+  }
+}
diff --git a/setup.sh b/setup.sh
deleted file mode 100755 (executable)
index b916da5..0000000
--- a/setup.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/bash
-
-ID=2
-
-# Update the system
-apt-get update
-apt-get dist-upgrade -y
-
-# Resize FS
-# TODO no /dev/root in Jessie
-ROOT_PART=$(readlink /dev/root)
-PART_NUM=${ROOT_PART#mmcblk0p}
-
-if [ "$PART_NUM" != "$ROOT_PART" ]; then
-    # Get the starting offset of the root partition
-    PART_START=$(
-        parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d:)
-    [ "$PART_START" ] &&
-
-    fdisk /dev/mmcblk0 <<EOF &&
-p
-d
-$PART_NUM
-n
-p
-$PART_NUM
-$PART_START
-p
-w
-EOF
-
-  # Now set up an init.d script to do the resize
-    cat <<\EOF >/etc/init.d/resize2fs_once &&
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides:          resize2fs_once
-# Required-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5 S
-# Default-Stop:
-# Short-Description: Resize the root filesystem to fill partition
-# Description:
-### END INIT INFO
-. /lib/lsb/init-functions
-case "$1" in
-  start)
-    log_daemon_msg "Starting resize2fs_once" &&
-    resize2fs /dev/root &&
-    rm /etc/init.d/resize2fs_once &&
-    update-rc.d resize2fs_once remove &&
-    log_end_msg $?
-    ;;
-  *)
-    echo "Usage: $0 start" >&2
-    exit 3
-    ;;
-esac
-EOF
-
-    chmod +x /etc/init.d/resize2fs_once &&
-    update-rc.d resize2fs_once defaults
-fi
-
-# Install pacakges
-apt-get install -y avahi-daemon avrdude minicom python-pip
-pip install tornado sockjs-tornado pyserial
-
-# Clean
-apt-get autoclean
-
-# Change hostname
-sed -i "s/raspberrypi/bbctrl$ID/" /etc/hosts /etc/hostname
-
-# Create user
-useradd -m -p $(openssl passwd -1 buildbotics) -s /bin/bash bbmc
-echo "bbmc ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
-
-# Disable console on serial port
-#sed -i 's/^\(.*ttyAMA0.*\)$/# \1/' /etc/inittab
-sed -i 's/console=ttyAMA0,115200 //' /boot/cmdline.txt
-
-# TODO install bbctrl w/ init.d script
-
-reboot
diff --git a/setup_rpi.sh b/setup_rpi.sh
new file mode 100755 (executable)
index 0000000..b916da5
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+ID=2
+
+# Update the system
+apt-get update
+apt-get dist-upgrade -y
+
+# Resize FS
+# TODO no /dev/root in Jessie
+ROOT_PART=$(readlink /dev/root)
+PART_NUM=${ROOT_PART#mmcblk0p}
+
+if [ "$PART_NUM" != "$ROOT_PART" ]; then
+    # Get the starting offset of the root partition
+    PART_START=$(
+        parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d:)
+    [ "$PART_START" ] &&
+
+    fdisk /dev/mmcblk0 <<EOF &&
+p
+d
+$PART_NUM
+n
+p
+$PART_NUM
+$PART_START
+p
+w
+EOF
+
+  # Now set up an init.d script to do the resize
+    cat <<\EOF >/etc/init.d/resize2fs_once &&
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          resize2fs_once
+# Required-Start:
+# Required-Stop:
+# Default-Start: 2 3 4 5 S
+# Default-Stop:
+# Short-Description: Resize the root filesystem to fill partition
+# Description:
+### END INIT INFO
+. /lib/lsb/init-functions
+case "$1" in
+  start)
+    log_daemon_msg "Starting resize2fs_once" &&
+    resize2fs /dev/root &&
+    rm /etc/init.d/resize2fs_once &&
+    update-rc.d resize2fs_once remove &&
+    log_end_msg $?
+    ;;
+  *)
+    echo "Usage: $0 start" >&2
+    exit 3
+    ;;
+esac
+EOF
+
+    chmod +x /etc/init.d/resize2fs_once &&
+    update-rc.d resize2fs_once defaults
+fi
+
+# Install pacakges
+apt-get install -y avahi-daemon avrdude minicom python-pip
+pip install tornado sockjs-tornado pyserial
+
+# Clean
+apt-get autoclean
+
+# Change hostname
+sed -i "s/raspberrypi/bbctrl$ID/" /etc/hosts /etc/hostname
+
+# Create user
+useradd -m -p $(openssl passwd -1 buildbotics) -s /bin/bash bbmc
+echo "bbmc ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+
+# Disable console on serial port
+#sed -i 's/^\(.*ttyAMA0.*\)$/# \1/' /etc/inittab
+sed -i 's/console=ttyAMA0,115200 //' /boot/cmdline.txt
+
+# TODO install bbctrl w/ init.d script
+
+reboot
diff --git a/src/bbmc.cpp b/src/bbmc.cpp
deleted file mode 100644 (file)
index 2a05f86..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#include <cbang/ApplicationMain.h>
-#include <cbang/event/Event.h>
-
-#include <bbmc/App.h>
-
-int main(int argc, char *argv[]) {
-#ifdef DEBUG
-  cb::Event::Event::enableDebugMode();
-#endif
-
-  return cb::doApplication<bbmc::App>(argc, argv);
-}
diff --git a/src/bbmc.scons b/src/bbmc.scons
deleted file mode 100644 (file)
index 283a46b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-import glob
-
-Import('*')
-
-env.Append(CPPPATH = ['#/src'])
-
-subdirs = ['']
-
-# Source
-src = []
-for dir in subdirs:
-    src += Glob('bbmc/' + dir + '/*.cpp')
-
-
-# Resources
-res = env.Resources('resources.cpp', ['#/src/resources'])
-resLib = env.Library(name + 'Resources', res)
-Precious(resLib)
-
-# Build lib
-lib = env.Library(name, src)
-
-
-# Build Info
-info = env.BuildInfo('build_info.cpp', [])
-AlwaysBuild(info)
-
-# Main program
-prog = env.Program('#/' + name, [name + '.cpp', info, lib, resLib]);
-
-
-# Return
-pair = (prog, lib)
-Return('pair')
diff --git a/src/bbmc/App.cpp b/src/bbmc/App.cpp
deleted file mode 100644 (file)
index 36c3646..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#include "App.h"
-
-#include <cbang/util/DefaultCatch.h>
-#include <cbang/log/Logger.h>
-#include <cbang/event/Event.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-
-using namespace bbmc;
-using namespace cb;
-using namespace std;
-
-
-App::App() :
-  ServerApplication("Buildbotics Machine Controller", &App::_hasFeature),
-  dns(base), client(base, dns), server(*this) {
-
-  options.pushCategory("Buildbotics Machine Controller");
-  options.add("http-root", "Serve /* files from this directory.");
-  options.popCategory();
-
-  options.pushCategory("Debugging");
-  options.add("debug-libevent", "Enable verbose libevent debugging"
-              )->setDefault(false);
-  options.popCategory();
-
-  // Enable libevent logging
-  Event::Event::enableLogging(3);
-}
-
-
-bool App::_hasFeature(int feature) {
-  if (feature == FEATURE_LIFELINE) return true;
-  return ServerApplication::_hasFeature(feature);
-}
-
-int App::init(int argc, char *argv[]) {
-  int i = ServerApplication::init(argc, argv);
-  if (i == -1) return -1;
-
-  // Libevent debugging
-  if (options["debug-libevent"].toBoolean()) Event::Event::enableDebugLogging();
-
-  server.init();
-
-  // Check lifeline
-  if (getLifeline()) base.newEvent(this, &App::lifelineEvent).add(0.25);
-
-  // Handle exit signal
-  base.newSignal(SIGINT, this, &App::signalEvent).add();
-  base.newSignal(SIGTERM, this, &App::signalEvent).add();
-
-  return 0;
-}
-
-
-void App::run() {
-  try {
-    base.dispatch();
-    LOG_INFO(1, "Clean exit");
-  } CATCH_ERROR;
-}
-
-
-void App::lifelineEvent(Event::Event &e, int signal, unsigned flags) {
-  e.add(0.25);
-  if (shouldQuit()) base.loopExit();
-}
-
-
-void App::signalEvent(Event::Event &e, int signal, unsigned flags) {
-  base.loopExit();
-}
diff --git a/src/bbmc/App.h b/src/bbmc/App.h
deleted file mode 100644 (file)
index 67ca809..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#ifndef BBMC_APP_H
-#define BBMC_APP_H
-
-#include "Server.h"
-
-#include <cbang/ServerApplication.h>
-#include <cbang/net/IPAddress.h>
-
-#include <cbang/event/Base.h>
-#include <cbang/event/DNSBase.h>
-#include <cbang/event/Client.h>
-
-namespace cb {
-  namespace Event {class Event;}
-}
-
-
-namespace bbmc {
-  class App : public cb::ServerApplication {
-    cb::Event::Base base;
-    cb::Event::DNSBase dns;
-    cb::Event::Client client;
-
-    Server server;
-
-  public:
-    App();
-
-    static bool _hasFeature(int feature);
-
-    cb::Event::Base &getEventBase() {return base;}
-    cb::Event::DNSBase &getEventDNS() {return dns;}
-    cb::Event::Client &getEventClient() {return client;}
-
-    Server &getServer() {return server;}
-
-    // From cb::Application
-    int init(int argc, char *argv[]);
-    void run();
-
-    void lifelineEvent(cb::Event::Event &e, int signal, unsigned flags);
-    void signalEvent(cb::Event::Event &e, int signal, unsigned flags);
-  };
-}
-
-#endif // BBMC_APP_H
-
diff --git a/src/bbmc/Server.cpp b/src/bbmc/Server.cpp
deleted file mode 100644 (file)
index 03765e7..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#include "Server.h"
-#include "App.h"
-#include "Transaction.h"
-
-#include <cbang/openssl/SSLContext.h>
-
-#include <cbang/event/Request.h>
-#include <cbang/event/PendingRequest.h>
-#include <cbang/event/Buffer.h>
-#include <cbang/event/RedirectSecure.h>
-#include <cbang/event/ResourceHTTPHandler.h>
-#include <cbang/event/FileHandler.h>
-
-#include <cbang/config/Options.h>
-#include <cbang/util/Resource.h>
-#include <cbang/log/Logger.h>
-
-#include <stdlib.h>
-
-using namespace cb;
-using namespace std;
-using namespace bbmc;
-
-namespace bbmc {
-  extern const DirectoryResource resource0;
-}
-
-
-Server::Server(App &app) :
-  Event::WebServer(app.getOptions(), app.getEventBase()), app(app) {
-}
-
-
-void Server::init() {
-  Event::WebServer::init();
-
-  // Event::HTTP request callbacks
-  HTTPHandlerGroup &api = *addGroup(HTTP_ANY, "/api/.*");
-
-#define ADD_TM(GROUP, METHODS, PATTERN, FUNC)                           \
-  (GROUP).addMember<Transaction>(METHODS, PATTERN, &Transaction::FUNC)
-
-  // API not found
-  ADD_TM(api, HTTP_ANY, "", apiNotFound);
-
-  // Docs
-  HTTPHandlerGroup &docs = *addGroup(HTTP_ANY, "/docs/.*");
-  if (app.getOptions()["http-root"].hasValue())
-    docs.addHandler(app.getOptions()["http-root"]);
-  else docs.addHandler(*resource0.find("http"));
-
-  docs.addMember<Transaction>(HTTP_ANY, ".*\\..*", &Transaction::notFound);
-
-  // Root
-  if (app.getOptions()["http-root"].hasValue()) {
-    string root = app.getOptions()["http-root"];
-
-    addHandler(root);
-    addHandler(root + "/index.html");
-
-  } else {
-    addHandler(*resource0.find("http"));
-    addHandler(*resource0.find("http/index.html"));
-  }
-}
-
-
-Event::Request *Server::createRequest(evhttp_request *req) {
-  return new Transaction(app, req);
-}
diff --git a/src/bbmc/Server.h b/src/bbmc/Server.h
deleted file mode 100644 (file)
index 4c8dce5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#ifndef BBMC_SERVER_H
-#define BBMC_SERVER_H
-
-#include <cbang/event/WebServer.h>
-
-
-namespace bbmc {
-  class App;
-
-  class Server : public cb::Event::WebServer {
-    App &app;
-
-  public:
-    Server(App &app);
-
-    void init();
-
-    // From cb::Event::HTTPHandler
-    cb::Event::Request *createRequest(evhttp_request *req);
-  };
-}
-
-#endif // BBMC_SERVER_H
-
diff --git a/src/bbmc/Transaction.cpp b/src/bbmc/Transaction.cpp
deleted file mode 100644 (file)
index e33d8b8..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#include "Transaction.h"
-#include "App.h"
-
-#include <cbang/json/JSON.h>
-#include <cbang/log/Logger.h>
-#include <cbang/util/DefaultCatch.h>
-
-using namespace std;
-using namespace cb;
-using namespace bbmc;
-
-
-Transaction::Transaction(App &app, evhttp_request *req) :
-  Request(req), app(app) {
-  LOG_DEBUG(5, "Transaction()");
-}
-
-
-Transaction::~Transaction() {
-  LOG_DEBUG(5, "~Transaction()");
-}
-
-
-bool Transaction::apiNotFound() {
-  THROWXS("Invalid API method " << getURI().getPath(), HTTP_NOT_FOUND);
-  return true;
-}
-
-
-bool Transaction::notFound() {
-  THROWXS("Not found " << getURI().getPath(), HTTP_NOT_FOUND);
-  return true;
-}
diff --git a/src/bbmc/Transaction.h b/src/bbmc/Transaction.h
deleted file mode 100644 (file)
index 8f6190d..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/******************************************************************************\
-
-             This file is part of the Buildbotics Machine Controller.
-
-                    Copyright (c) 2015-2016, Buildbotics LLC
-                               All rights reserved.
-
-        The Buildbotics Machine Controller is free software: you can
-        redistribute it and/or modify it under the terms of the GNU
-        General Public License as published by the Free Software
-        Foundation, either version 2 of the License, or (at your option)
-        any later version.
-
-        The Buildbotics Webserver is distributed in the hope that it will
-        be useful, but WITHOUT ANY WARRANTY; without even the implied
-        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-        PURPOSE.  See the GNU General Public License for more details.
-
-        You should have received a copy of the GNU General Public License
-        along with this software.  If not, see
-        <http://www.gnu.org/licenses/>.
-
-        In addition, BSD licensing may be granted on a case by case basis
-        by written permission from at least one of the copyright holders.
-        You may request written permission by emailing the authors.
-
-                For information regarding this software email:
-                               Joseph Coffland
-                        joseph@cauldrondevelopment.com
-
-\******************************************************************************/
-
-#ifndef BBMC_TRANSACTION_H
-#define BBMC_TRANSACTION_H
-
-#include <cbang/event/Request.h>
-#include <cbang/event/RequestMethod.h>
-#include <cbang/event/PendingRequest.h>
-
-
-namespace cb {
-  namespace JSON {
-    class Writer;
-    class Value;
-  }
-}
-
-
-namespace bbmc {
-  class App;
-
-  class Transaction : public cb::Event::Request {
-    App &app;
-
-  public:
-    Transaction(App &app, evhttp_request *req);
-    ~Transaction();
-
-    bool apiNotFound();
-    bool notFound();
-  };
-}
-
-#endif // BBMC_TRANSACTION_H
-
diff --git a/src/jade/index.jade b/src/jade/index.jade
new file mode 100644 (file)
index 0000000..1118b18
--- /dev/null
@@ -0,0 +1,65 @@
+doctype html
+html(lang="en")
+  head
+    title Buildbotics Controller - Web interface
+    meta(charset="utf-8")
+
+    script(src="//code.jquery.com/jquery-1.11.3.min.js")
+    script(src="//cdn.jsdelivr.net/vue/1.0.13/vue.min.js")
+    script(src="js/sockjs.min.js")
+    script(src="js/gauge.min.js")
+    script(src="js/fd-slider.min.js")
+    script(src="js/assets.js")
+
+    - var faURL = "//maxcdn.bootstrapcdn.com/font-awesome"
+    link(rel="stylesheet" href=faURL + "/4.5.0/css/font-awesome.min.css")
+
+    link(rel="stylesheet" href="/style.css")
+
+  body
+    table
+      tr
+        td
+        td: button(@click="jog('y', 1)") Y+
+        td
+        td: button(@click="jog('z', 1)") Z+
+        td: button(@click="jog('a', 1)") A+
+      tr
+        td: button(@click="jog('x', -1)") -X
+        td
+        td: button(@click="jog('x', 1)") X+
+      tr
+        td
+        td: button(@click="jog('y', -1)") -Y
+        td
+        td: button(@click="jog('z', -1)") Z-
+        td: button(@click="jog('a', -1)") A-
+
+    h2 Velocity {{state.vel}}
+    h2 Step {{step}}
+
+    table.axes
+      tr
+        th Axis
+        th Position
+        th Step
+        th Flags
+        th Current
+        th StallGuard
+
+      each axis in ['x', 'y', 'z']
+        tr.axis
+          th.name #{axis}
+          td {{state.pos#{axis}}}
+          td {{state.dstep#{axis}}}
+          td {{state.dflags#{axis}}}
+          td
+            | {{state.dcur#{axis} | percent}}
+            gauge(:value="state.dcur#{axis} * 32", :min="1", :max="32")
+            input(type="range" min=1 max=32 v-model="current#{axis}")
+          td
+            gauge(:value="state.sguard#{axis}", :min="0", :max="511")
+
+
+    #templates
+
diff --git a/src/js/app.js b/src/js/app.js
new file mode 100644 (file)
index 0000000..4ce1b88
--- /dev/null
@@ -0,0 +1,85 @@
+'use strict'
+
+
+function is_array(x) {
+  return Object.prototype.toString.call(x) === '[object Array]';
+}
+
+
+module.exports = new Vue({
+  el: 'body',
+
+
+  data: function () {
+    return {
+      axes: 'xyza',
+      state: {
+        dcurx: 1, dcury: 1, dcurz: 1, dcura: 1
+        //sguardx: 1, sguardy: 1, sguardz: 1, sguarda: 1
+      },
+      step: 10
+    }
+  },
+
+
+  components: {
+    gauge: require('./gauge')
+  },
+
+
+  watch: {
+    currentx: function (value) {this.current('x', value);},
+    currenty: function (value) {this.current('y', value);},
+    currentz: function (value) {this.current('z', value);},
+    currenta: function (value) {this.current('a', value);}
+  },
+
+
+  ready: function () {
+    this.sock = new SockJS('//' + window.location.host + '/ws');
+
+    this.sock.onmessage = function (e) {
+      var data = e.data;
+      console.debug(data);
+
+      for (var key in data) {
+        this.$set('state.' + key, data[key]);
+
+        for (var axis of ['x', 'y', 'z', 'a'])
+          if (key == 'dcur' + axis && typeof this.$get('current' + axis) == 'undefined')
+            this.$set('current' + axis, (32 * data[key]).toFixed());
+      }
+    }.bind(this);
+  },
+
+
+  methods: {
+    send: function (data) {
+      this.sock.send(JSON.stringify(data));
+    },
+
+
+    jog: function (axis, dir) {
+      var pos = this.state['pos' + axis] + dir * this.step;
+      this.sock.send('g0' + axis + pos);
+    },
+
+
+    current: function (axis, value) {
+      var x = value / 32.0;
+      if (this.state['dcur' + axis] == x) return;
+
+      var data = {};
+      data['dcur' + axis] = x;
+      this.send(data);
+    }
+  },
+
+
+  filters: {
+    percent: function (value, precision) {
+      if (typeof precision == 'undefined') precision = 2;
+      return (value * 100.0).toFixed(precision) + '%';
+    }
+  }
+})
diff --git a/src/js/gauge.js b/src/js/gauge.js
new file mode 100644 (file)
index 0000000..dda1b4b
--- /dev/null
@@ -0,0 +1,64 @@
+module.exports = Vue.extend({
+  template: '<div class="gauge"><canvas></canvas><span></span></div>',
+
+
+  props: {
+    value: {tupe: Number, required: true},
+    lines: {type: Number, default: 1},
+    angle: {type: Number, default: 0.1},
+    lineWidth: {type: Number, default: 0.25},
+    ptrLength: {type: Number, default: 0.85},
+    ptrStrokeWidth: {type: Number, default: 0.054},
+    ptrColor: {type: String, default: '#666'},
+    limitMax: {type: Boolean, default: true},
+    colorStart: {type: String, default: '#6FADCF'},
+    colorStop: {type: String, default: '#8FC0DA'},
+    strokeColor: String,
+    min: {type: Number, default: 0},
+    max: {type: Number, default: 100}
+  },
+
+
+  data: function () {
+    return {
+    }
+  },
+
+
+  watch: {
+    value: function (value) {this.set(value)}
+  },
+
+
+  compiled: function () {
+    this.gauge = new Gauge(this.$el.children[0]).setOptions({
+      lines: this.lines,
+      angle: this.angle,
+      lineWidth: this.lineWidth,
+      pointer: {
+        length: this.ptrLength,
+        strokeWidth: this.ptrStrokeWidth,
+        color: this.ptrColor
+      },
+      limitMax: this.limitMax,
+      colorStart: this.colorStart,
+      colorStop: this.colorStop,
+      strokeColor: this.strokeColor,
+      minValue: this.min,
+      maxValue: this.max
+   });
+
+    this.gauge.minValue = parseInt(this.min);
+    this.gauge.maxValue = parseInt(this.max);
+    this.set(this.value);
+
+    this.gauge.setTextField(this.$el.children[1]);
+  },
+
+
+  methods: {
+    set: function (value) {
+      if (typeof value == 'number') this.gauge.set(value);
+    }
+  }
+})
diff --git a/src/js/main.js b/src/js/main.js
new file mode 100644 (file)
index 0000000..8cff07a
--- /dev/null
@@ -0,0 +1,8 @@
+$(function() {
+  // Vue debugging
+  Vue.config.debug = true;
+  Vue.util.warn = function (msg) {console.debug('[Vue warn]: ' + msg)}
+
+  // Vue app
+  require('./app');
+});
diff --git a/src/js/slider.js b/src/js/slider.js
new file mode 100644 (file)
index 0000000..f25f873
--- /dev/null
@@ -0,0 +1,25 @@
+module.exports = new Vue({
+  template: '<input type="range" v-model="value">',
+  replace: true,
+
+
+  props: {
+    value: Number,
+    min: Number,
+    max: Number,
+    step: Number
+  },
+
+
+  data: function () {
+    return {
+    }
+  },
+
+
+  compiled: function () {
+    this.$el.attributes.min = this.min;
+    this.$el.attributes.max = this.max;
+    this.$el.attributes.step = this.step;
+  }
+}
diff --git a/src/resources/css/fd-slider-tooltip.css b/src/resources/css/fd-slider-tooltip.css
new file mode 100644 (file)
index 0000000..bbdd5b4
--- /dev/null
@@ -0,0 +1,109 @@
+/*\r
+  Sample tooltip code. Only works on grade A browsers (so no IE6, 7 or 8).\r
+  \r
+  See: http://nicolasgallagher.com/multiple-backgrounds-and-borders-with-css2/ \r
+  for full info on how to style generated content & the associated pitfalls.  \r
+*/\r
+\r
+.fd-slider-handle:before,\r
+.fd-slider-handle:after\r
+        {\r
+        content:"";\r
+        /* Remove from screen */\r
+        opacity:0;\r
+        -webkit-transition-property: all;\r
+           -moz-transition-property: all;\r
+            -ms-transition-property: all;\r
+             -o-transition-property: all;\r
+                transition-property: all;        \r
+        -webkit-transition-duration: 0.3s;\r
+           -moz-transition-duration: 0.3s;\r
+            -ms-transition-duration: 0.3s;\r
+             -o-transition-duration: 0.3s;\r
+                transition-duration: 0.3s;        \r
+        -webkit-transition-delay: 0.2s;\r
+           -moz-transition-delay: 0.2s;\r
+            -ms-transition-delay: 0.2s;\r
+             -o-transition-delay: 0.2s;\r
+                transition-delay: 0.2s;\r
+        }\r
+/* \r
+   The tooltip body - as we position it above the slider and position the \r
+   tooltip arrow below it, we need to know the height of the body. This means \r
+   that multi-line tooltips are not supported.\r
+   \r
+   To support multi-line tooltips, you will need to position the tooltip below \r
+   the slider and the tooltip pointer above the tooltip body. Additionally, you \r
+   will have to set the tooltip body "height" to auto\r
+*/\r
+.fd-slider-handle:before\r
+        {\r
+        display:block;\r
+        position:absolute;\r
+        top:-30px;\r
+        left:-25px;\r
+        margin:0;\r
+        width:60px;\r
+        padding:5px;\r
+        height:14px;\r
+        line-height:12px;\r
+        font-size:10px;\r
+        text-shadow:0 1px 0 #000;\r
+        color:#fff;\r
+        background:#222;\r
+        z-index:1;\r
+        /* Use the ARIA valuetext property, set by the script, to generate the \r
+           tooltip content */    \r
+        content:attr(aria-valuetext);  \r
+        -webkit-border-radius:3px;\r
+           -moz-border-radius:3px;\r
+                border-radius:3px;\r
+        -webkit-box-shadow: 0 0 4px #aaa;\r
+           -moz-box-shadow: 0 0 4px #aaa;\r
+                box-shadow: 0 0 4px #aaa; \r
+        }\r
+.fd-slider-handle:after\r
+        {\r
+        outline:none;\r
+        content:"";  \r
+        display:block;        \r
+        position:absolute;\r
+        top:-14px;\r
+        left:50%;\r
+        margin:0 0 0 -5px;\r
+        background:#222;\r
+        z-index:2;\r
+        width:10px;\r
+        height:10px;\r
+        overflow:hidden;\r
+        /* Rotate element by 45 degress to get the "\/" pointer effect */\r
+        -webkit-transform: rotate(45deg); \r
+           -moz-transform: rotate(45deg);\r
+            -ms-transform: rotate(45deg);\r
+             -o-transform: rotate(45deg);\r
+        -webkit-box-shadow: 0 0 4px #aaa;\r
+           -moz-box-shadow: 0 0 4px #aaa;\r
+                box-shadow: 0 0 4px #aaa;\r
+        clip:rect(4px, 14px, 14px, 4px); \r
+        }\r
+/* Change opacity and position to kick in the transitions */ \r
+.fd-slider-focused .fd-slider-handle:before,\r
+.fd-slider-hover   .fd-slider-handle:before,\r
+.fd-slider-active  .fd-slider-handle:before\r
+        {\r
+        top:-25px;     \r
+        opacity:1;             \r
+        }\r
+.fd-slider-focused .fd-slider-handle:after,\r
+.fd-slider-hover   .fd-slider-handle:after,\r
+.fd-slider-active  .fd-slider-handle:after\r
+        {\r
+        top:-9px;     \r
+        opacity:1;             \r
+        }\r
+/* Remove completely for IE 6, 7 and 8 */\r
+.oldie .fd-slider-handle:before,\r
+.oldie .fd-slider-handle:after\r
+        {\r
+        display:none;\r
+        }      
\ No newline at end of file
diff --git a/src/resources/css/fd-slider.css b/src/resources/css/fd-slider.css
new file mode 100644 (file)
index 0000000..84d5def
--- /dev/null
@@ -0,0 +1,1004 @@
+/* \r
+\r
+   Don't use this version of the file in a production environment. A minified \r
+   version tailored specifically to your needs can be generated in-browser by\r
+   using the /css-generator/index.html file.\r
+   \r
+   Notes for the adventurous:\r
+   \r
+   1. The script automagically adds the classname "oldie" to IE6, 7 & 8.\r
+   \r
+   2. A combination of the .oldie class and "safe css hacks" are used to target \r
+      specific IE versions. See: http://mathiasbynens.be/notes/safe-css-hacks\r
+   \r
+   3. MSHTML has been used to base64 encode the various png images used for the \r
+      drag handle in IE6 and 7. IE7 gets served one base64 encoded image sprite \r
+      whereas IE6 gets served individual base64 encoded images.\r
+       \r
+      See: http://www.phpied.com/the-proper-mhtml-syntax/ for more info on MHTML\r
+      \r
+      The base64 encoded images have been placed into their own .mht file. This\r
+      means only IE6 and 7 will ever be burdened with downloading the file.\r
+      \r
+      A Microsoft security update in July 2011 means that .mht files now have to\r
+      be delivered with the mimetype "message/rfc822". If using IIS, there is \r
+      nothing to do as IIS appears to default to using the required \r
+      "message/rfc822" mimetype, if using Apache, there are two ways in which to\r
+      configure this behaviour:\r
+      \r
+      A. You have Admin rights and can restart the Apache server\r
+      \r
+      Update the apache_root/httpd/conf/Srm.conf file and add the following \r
+      line:\r
+      \r
+      AddType message/rfc822 mht\r
+      \r
+      This method requires that you restart Apache.\r
+      \r
+      B. You can simply use an htaccess directive \r
+      \r
+      You can add the following to an .htaccess file that sits in the same \r
+      directory as the .mht file (or to an htaccess file at the root of your\r
+      website if one exists already): \r
+      \r
+      AddType message/rfc822 mht\r
+      \r
+      You do not need to restart Apache for the change to take effect.\r
+      \r
+      Yikes - I cant do either of the above!\r
+      \r
+      Don't worry, using the .mht file isn't compulsory - just replace the \r
+      various mhtml: references (found within the .oldie classes) to point to \r
+      the correct image file on your server (not forgetting to actually upload \r
+      the image files to your server of course). \r
+      \r
+      All of the relevant rules have further instructions embedded within them.\r
+       \r
+   4. All browsers but IE6 get one "normal" base64 encoded image sprite. IE6 has\r
+      to use separate images for each animation state.\r
+   \r
+   5. The drag handle is only 20px in width & height, most probably not suitable \r
+      for touch screen devices. \r
+      \r
+   6. It's painless to base64 encode your own images, use an online encoder. \r
+      See: http://www.google.com/search?q=base+64+encoder - the only problem is \r
+      that IE6 needs each frame of the handle sprite to be encoded individually.\r
+      \r
+   7. If you want to use a different image for vertical slider drag handles,\r
+      uncomment the relevant classes below (easy to spot as they all have the \r
+      classname ".fd-slider-vertical" somewhere within the declaration).\r
+       \r
+   8. As a reminder, the following HTML is being targetted by the CSS:\r
\r
+<span class="fd-slider[-vertical]" \r
+      id="fd-slider-[the associated form element id]" \r
+      role="application" \r
+      aria-disabled="false">\r
+  <span class="fd-slider-wrapper (fd-slider-[focus|hover|no-value|disabled|active])">\r
+    <span class="fd-slider-inner"></span>\r
+    <span class="fd-slider-range"></span>\r
+    <span class="fd-slider-bar"></span>\r
+    <span class="fd-slider-handle" \r
+          tabindex="0" \r
+          role="slider" \r
+          aria-valuemin="-10" \r
+          aria-valuemax="10" \r
+          aria-labelledby="[the associated form element label id]" \r
+          id="fd-slider-handle-[the associated form element id]" \r
+          aria-describedby="fd-slider-describedby" \r
+          aria-valuenow="-3.50" \r
+          aria-valuetext="-3.50">&nbsp;</span>\r
+  </span>\r
+</span>\r
+\r
+*/\r
+\r
+/*\r
+        Element: Form element associated with the slider\r
+        Notes: The styles given to the associated form element in order to hide \r
+        it within the display\r
+*/  \r
+.fd-form-element-hidden\r
+        {\r
+        display:none;\r
+        } \r
+/*\r
+        Element: Outer wrapper\r
+        Orientation: Horizontal \r
+*/ \r
+.fd-slider\r
+        {                     \r
+        width:100%;\r
+        height:20px;\r
+        margin:0 0 10px 0;\r
+        }\r
+/*\r
+        Element: Outer wrapper\r
+        Orientation: Vertical\r
+        Notes: You may wish to float the vertical sliders left or use\r
+        display:inline-block (inline-block should work even in IE6 as the slider\r
+        is constructed from span elements but don't quote me on that)\r
+*/ \r
+.fd-slider-vertical\r
+        {               \r
+        width:20px;\r
+        height:100%; \r
+        margin:0 10px 10px 0;              \r
+        }\r
+/*\r
+        Element: Outer wrapper\r
+        Orientation: Both horizontal & vertical\r
+*/ \r
+.fd-slider,\r
+.fd-slider-vertical\r
+        {\r
+        text-align:center;\r
+        display:block;\r
+        position:relative;\r
+        cursor:pointer;        \r
+        text-decoration:none;\r
+        border:0 none;\r
+        -webkit-user-select: none;\r
+         -khtml-user-select: none;\r
+           -moz-user-select: none;\r
+            -ms-user-select: none;\r
+             -o-user-select: none;\r
+                user-select: none;\r
+        }\r
+/*\r
+        Element: Outer Wrapper \r
+        Orientation: Both horizontal & vertical\r
+        Notes: IE6 & 7 need a transparent gif as a background in order for\r
+        hover events to work. This has been base64 encoded within the .mht file.\r
+        As it's not a png, no AlphaImageLoader filter is required for IE6. \r
+*/\r
+.oldie .fd-slider,\r
+.oldie .fd-slider-vertical\r
+        {\r
+        /* \r
+           If using the .mht file then uncomment the following rule and edit the \r
+           filepath to match the absolute path to the fd-slider.mht file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        *background:transparent url(mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!blank) repeat;\r
+        \r
+        */\r
+        \r
+        /* \r
+           If not using the .mht file then uncomment the following rule and edit \r
+           the filepath to match the absolute path to the blank.gif file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        *background:transparent url(http://www.your-domain.com/the/path/to/blank.gif) repeat;\r
+        \r
+        */                \r
+        }                 \r
+/*\r
+        Element: Inner wrapper\r
+        Notes: All other DOM elements added as children to this element.\r
+*/\r
+.fd-slider-wrapper\r
+        {\r
+        position:absolute;\r
+        top:0;\r
+        left:0;\r
+        width:100%;\r
+        height:100%;\r
+        }\r
+/*\r
+        Element: Inner wrapper\r
+        Notes: IE6 needs an expression as it cannot do a height:100% on \r
+        absolutely positioned elements and it also can't position on four \r
+        corners - so we are left with a "one time evaluated" self-deleting \r
+        expression to do the dirty work.\r
+*/\r
+\r
+.oldie .fd-slider-vertical .fd-slider-wrapper\r
+        {\r
+        *clear:expression(style.height=parentNode.offsetHeight+'px',style.clear='none', 0);\r
+        }\r
+/*\r
+        Element: ieBlur shiv\r
+        Notes: Used only by IE for the onfocus "Blur" effect\r
+*/ \r
+.fd-slider-inner\r
+        {\r
+        display:none;\r
+        }\r
+/*\r
+        Element: ieBlur shiv\r
+        Orientation: Horizontal\r
+        Notes: IE6, 7 & 8 only.\r
+        Use the "Blur" filter to simulate the box-shadow - not brilliant but the \r
+        best we can do for IE. IE6 can't absolutely position on 4 sides so we \r
+        reset the right to "auto" and use a nasty expression to calculate the \r
+        width dynamically. \r
+*/ \r
+.oldie .fd-slider-inner\r
+        {        \r
+        position:absolute;        \r
+        height:2px;\r
+        border:1px solid #bbf;\r
+        background:#bbf;      \r
+        top:4px;        \r
+        bottom:auto;\r
+        left:4px;\r
+        right:12px;              \r
+        z-index:2;       \r
+        margin:0;\r
+        padding:0;\r
+        overflow:hidden;\r
+        line-height:4px; \r
+        _right:auto;\r
+        _width:expression((this.parentNode.offsetWidth - 12) + "px");\r
+        filter:progid:DXImageTransform.Microsoft.Blur(pixelradius=3.5); \r
+        }\r
+/*\r
+        Element: ieBlur shiv\r
+        Orientation: Vertical\r
+        Notes: Reposition the "Blur" filter for the vertical slider for IE6, \r
+        7 & 8. The "Blur" filter rule cascades from the rule above so no need to \r
+        redeclare here, we just reposition.\r
+*/ \r
+.oldie .fd-slider-vertical .fd-slider-inner\r
+        {        \r
+        width:2px;\r
+        height:auto;     \r
+        bottom:12px;\r
+        right:auto; \r
+        _bottom:auto;\r
+        *clear:expression(style.height=(parentNode.offsetHeight - 8)+'px',style.clear='none', 0);\r
+        }\r
+/*\r
+        Element: ieBlur shiv\r
+        Orientation: Horizontal & Vertical\r
+        Notes: Display the "Blurred" inner div for IE6, 7 & 8 when the slider \r
+        gains focus\r
+*/ \r
+.oldie .fd-slider-focused .fd-slider-inner\r
+        {        \r
+        display:block;\r
+        }  \r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Horizontal   \r
+*/\r
+.fd-slider-bar\r
+        {\r
+        display:block;\r
+        position:absolute;\r
+        top:8px;\r
+        right:10px; \r
+        left:10px;                \r
+        z-index:2;\r
+        height:2px;\r
+        margin:0;\r
+        padding:0;\r
+        overflow:hidden;\r
+        border:1px solid #bbb;\r
+        border-bottom:1px solid #aaa;\r
+        border-right:1px solid #aaa;\r
+        border:1px solid rgba(187, 187, 187, .8);\r
+        border-bottom:1px solid rgba(170, 170, 170, .8);\r
+        border-right:1px solid rgba(170, 170, 170, .8);                   \r
+        line-height:4px;\r
+        background-color:#ddd;\r
+        background-image: -webkit-gradient(linear, left top, left bottom, from(#ececec), to(#ccc)); \r
+        background-image: -webkit-linear-gradient(top, #ececec, #ccc); \r
+        background-image:    -moz-linear-gradient(top, #ececec, #ccc); \r
+        background-image:     -ms-linear-gradient(top, #ececec, #ccc); \r
+        background-image:      -o-linear-gradient(top, #ececec, #ccc); \r
+        background-image:         linear-gradient(to bottom, #ececec, #ccc);\r
+        border-radius:2px;\r
+        -webkit-background-clip: padding-box; \r
+           -moz-background-clip: padding; \r
+                background-clip: padding-box;\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Horizontal\r
+        Notes: For IE6 & 7 & 8. IE6 does not recognise absolute positioning on \r
+        four sides (top, right, bottom & left) so we use an expression to \r
+        dynamically calculate the track bar size. Yes, it is horrible - you \r
+        don't need to remind me.\r
+*/\r
+.oldie .fd-slider-bar\r
+        {\r
+        _right:auto;        \r
+        _width:expression((this.parentNode.offsetWidth - 20) + "px");\r
+        filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffececec',endColorstr='#ffcccccc');\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Vertical\r
+*/\r
+.fd-slider-vertical .fd-slider-bar\r
+        {         \r
+        width:2px;   \r
+        top:10px;\r
+        right:auto;\r
+        bottom:10px;\r
+        left:8px;        \r
+        height:auto;\r
+        background-color:#ddd;\r
+        background-image: -webkit-gradient(linear, left top, right top, from(#ececec), to(#ccc)); \r
+        background-image: -webkit-linear-gradient(left, #ececec, #ccc); \r
+        background-image:    -moz-linear-gradient(left, #ececec, #ccc); \r
+        background-image:     -ms-linear-gradient(left, #ececec, #ccc); \r
+        background-image:      -o-linear-gradient(left, #ececec, #ccc); \r
+        background-image:         linear-gradient(to right, #ececec, #ccc);\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Vertical\r
+        Notes: For IE6 & 7 & 8. The gradient filter colour strings in AARRGGBB \r
+        format (to save you one less google). IE6 gets repositioned and alas,\r
+        an expression to calculate the height.\r
+*/\r
+.oldie .fd-slider-vertical .fd-slider-bar\r
+        {  \r
+        _bottom:auto;\r
+        *clear:expression(style.height=(parentNode.offsetHeight - 20)+'px',style.clear='none', 0);\r
+        filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ffececec',endColorstr='#ffcccccc');\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Horizontal & Vertical\r
+        State: Focused\r
+        Notes: Drop shadow on the inner bar when focused - newer browsers get \r
+        an animation. IE6, 7 & 8 get a "Blur" filter on an inner SPAN \r
+        .fd-slider-inner instead \r
+*/\r
+.fd-slider-focused .fd-slider-bar\r
+        {\r
+        box-shadow: 0 0 6px rgba(10, 130, 170, 0.7);\r
+        -webkit-animation:fd-pulse 2s infinite;\r
+           -moz-animation:fd-pulse 2s infinite;\r
+             -o-animation:fd-pulse 2s infinite;\r
+                animation:fd-pulse 2s infinite;\r
+        } \r
+/*\r
+        Element: Inner animated range bar \r
+        Orientation: Horizontal\r
+*/\r
+.fd-slider-range\r
+        {\r
+        display:block;\r
+        position:absolute;\r
+        top:9px;\r
+        left:11px;                   \r
+        z-index:3;\r
+        height:2px;      \r
+        margin:0;\r
+        padding:0;\r
+        overflow:hidden;\r
+        line-height:2px;\r
+        background-color:#4cc;\r
+        background-image: -webkit-gradient(linear, left top, right top, from(#6cc), to(#3cf)); \r
+        background-image: -webkit-linear-gradient(left, #6cc, #3cf); \r
+        background-image:    -moz-linear-gradient(left, #6cc, #3cf); \r
+        background-image:     -ms-linear-gradient(left, #6cc, #3cf); \r
+        background-image:      -o-linear-gradient(left, #6cc, #3cf); \r
+        background-image:         linear-gradient(to right, #6cc, #3cf);\r
+        border-radius:2px;\r
+        -webkit-background-clip: padding-box; \r
+           -moz-background-clip: padding; \r
+                background-clip: padding-box;\r
+        }\r
+/*\r
+        Element: Inner range bar \r
+        Orientation: Horizontal\r
+        Notes: IE6, 7 & 8\r
+*/\r
+.oldie .fd-slider-range\r
+        {\r
+        /* IE6 - is this needed? To test. */ \r
+        _left:10px;\r
+        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ff66cccc',endColorstr='#ff33ccff');\r
+        }\r
+/*\r
+        Element: Inner range bar \r
+        Orientation: Vertical\r
+*/\r
+.fd-slider-vertical .fd-slider-range\r
+        {\r
+        height:auto;\r
+        width:2px;\r
+        top:auto;        \r
+        right:auto;\r
+        bottom:11px;\r
+        left:9px;        \r
+        background-image: -webkit-gradient(linear, left top, left bottom, from(#3cf), to(#6cc)); \r
+        background-image: -webkit-linear-gradient(top, #3cf, #6cc); \r
+        background-image:    -moz-linear-gradient(top, #3cf, #6cc); \r
+        background-image:     -ms-linear-gradient(top, #3cf, #6cc); \r
+        background-image:      -o-linear-gradient(top, #3cf, #6cc); \r
+        background-image:         linear-gradient(to bottom, #3cf, #6cc);       \r
+        }\r
+/*\r
+        Element: Inner range bar \r
+        Orientation: Vertical\r
+        Notes: IE6, 7 & 8\r
+*/\r
+.oldie .fd-slider-vertical .fd-slider-range\r
+        {\r
+        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ff66cccc',endColorstr='#ff33ccff');\r
+        }     \r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal\r
+        State: Default.\r
+        Notes: The image sprite used for the handle is base64 encoded below. IE7\r
+        gets its own version within the .mht file, IE6 does not use an image\r
+        sprite and it is necessary to base64 encode individual animation frames\r
+        within the .mht file.\r
+*/\r
+.fd-slider-handle\r
+        {\r
+        position:absolute;\r
+        display:block;\r
+        padding:0;\r
+        border:0 none;\r
+        margin:0;\r
+        z-index:3;\r
+        top:0;\r
+        left:0;\r
+        width:20px;\r
+        height:20px;\r
+        outline:0 none;\r
+        background-color:transparent;\r
+        background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAABQCAYAAAAZQFV3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjFFRDg4NEVDNENDODExRTFCMTZDREIyQTZDMjlDNTQ2IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjFFRDg4NEVENENDODExRTFCMTZDREIyQTZDMjlDNTQ2Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MUVEODg0RUE0Q0M4MTFFMUIxNkNEQjJBNkMyOUM1NDYiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MUVEODg0RUI0Q0M4MTFFMUIxNkNEQjJBNkMyOUM1NDYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz68iMNZAAAIQElEQVR42uxYW28b1xGes7tckiIp3iRboi6mbollya5DF4VsVWpaw42ABCmaogWSFH3oDyjQoijQP2AUyFOLFshbn4SqsYFabowmdaW4NhDJiKXaUuwotm6UKJK6kKIkipfl7p7OWR3aa5kiVdQoEjQLDM7u2TPfnss3MztDKKXwPC8BnvP1xQeUSnUSvGBwshl8R18Fq70PZOtx44WSn4F89hYkV6/B26ElWuIAyP4+xBKd70311tXV/bzb7+oLOcDaYiWSTSAkR0EfT9P8UDj1j8Rq/Lfw1ukx1NcOnKExs4tDbT6f75e9tc6+c05q90gEtwWRdAoyblG/k4jeVvcr76qKZePi0K9Q5ZF5pvuXLENj6xv1Pvc5n6DJyQJAQgGdjWZCuFQRwTLQ7P/W6PaLb0YBfoNd+YMAq8BR/TIpFCzhDECEgK5SeGafJAJEA0FqO+L7LgL+rhygEwE7FrMFWMqAVvY4CX6I2hoMHYDNg5es60I8Z9xXNiHd2A25PG3WInFPY9BfLRFiwePQS8AKuJEFHWA3Fl1PVOChArPT96Gp5YRDJMSFoExZ1Z8cisQ/sqOBroRnZgydMoBpGLk8mm9uDemdJzs8kkA8FgZKQMSXbFN1ZEiqQGl26eFS4cbwiKFTxvQyMPbhZPb9weHl6bsL4ZymZzRKXSKBADKbtew5+vDB8vKVwb8kPrh029A5yFIMYgO4UNrh1Nl+6H/9PBwPtUMg6DcGRBcTMDM5CzevjsDU2E3smUXZMRO7pOlh40AJoAR56+KvdxgsyiJvd/ebHinlYPlMZYPoezyTHx/a3p6xZSqHcg5fCn9ITC0xPRcvapJnLEoqASQUOczvRdM7WqQjisqfdTOwtA9M5GLhByHzMSJ/r3EghUuB92kcg5pnKHJlK4qdSxV/Lo5Tuatip5zlkjd9zBhITEtjyg5FUdx/iuVeuJQi35lTxZc2QGpkg2tAjbRJ2r9+6KGjb9bbHsqyLOzbV53RhnAwG+NcMpn0vxPVvz2pWn/sc9i6TlcRyzErCDbkZhY94CdpWhhPZO72yvnBXzeI/8RwkeDcZE5Pk0wHIOfz+ao/r6RP3M67ftLhtXb3OInFKyFXGV9xAnZ0qn0ukL2iPfS3mCri2PWfOhwTVqtV4duhC6Yly/F43H0lBa8QW1WnX6TSlqqTRQx1KHRhT/BeJw6BSl0+58mPdoXXmA4/PAOrOEPjQGKxmHtRD4aaqS5G8wRWC0B1YFvyhDXovigOpgWKftZq/0Ys9sh97Nix9SK9zLQRNzY2XEnP8QDJaSReIFTECIpbR83cZaaqUZ1q6GUF3eJnOmauPmUpu7u7FnDrwpqigygKCMimAcRMazZDjYmGY3R1T6eEpRgWUCgUVM/uZlLx1Lp8shFTCC6YFBHZwRi+hAqQ1yhYt7ZSTIdz8LGlFM1JxeXt1iUjC2FPbbMVuzFQ4SzxJX0SU9g3VJzdFm7u0VQszHT4CWtFSynao+JwOBKdCzMfp1w1L6iB5oATQ4nXQowoZwDrBMEpwSCsy4n4Wmv8848dDd4EN0N9b+57gIZ9NjU1JTvU7YmWR7dv5FcWV8NZVUurGrXjXtYiH1mbVnWajUc2XA/GP2rKbNxmOhxQNdsyAy20tbVtz8/Pz21PTV1zfBLfnm/s6rlzpKVxq7q2mg1yb69v16wtRFoj98fbIXsreOrUHNPhTuKpPWTT1TweT66rq2sdN3oaPvts2zf19xm0ngAeqpOHhjRaRRTNba6zszOMYxNMx+TSaDEEPOW+kFvyxMSEc2VlpZqRXVVVm/F1ScrV19dvNTQ0bJ85cyZdU1OjmNwXmAGfu4M1u3Ld1P5XIWA/MP1CRL0vcZ5y4cKFZuTcq6Io9qEYeYqmaTMot5Cb165fv374PGVgYOAckvdntbW1fdjKaOMicpABUuSoMjs7O5pKpX6PoJXzlJ6enrbq6upfIIG/iYA2FtlYIEMww9lin4h9F6anpy04dq1inoKzeQMBe1HJiksTstnsfgrhDy2Rg8FgP5roj/D5nbJ5isVieRk/aNnZ2SHpdFo/4HePNRa/338e2z+UzVMQsAPBBASrRGzCf0jL5yk4o1LLLHnx2ZfPUxAs7na7fThT/iN7MBiuZK0SD5Wtra37CNiJ3COMKgx034+98YwujSLgg4p5SiQSGXW5XCGkTTueNEF5Csj4qqIA8nB+aWnpmTxlP2AGfy0m7Xb7MN7/AEGDgiAQm80GbAuQJjSXywGOCSO5h8Ph8J1D5ylIif5AIHDe6/W2V1VVGXlKJpNJbG5uzkaj0ZFEIvFVnvJ/67H/p6WqWvAd/TpY7V0gWxt5qSoC+ex9SK7egbdD64cNAYLzvakTdXV13+v2u7pCDrC0WInAS1V0HNOKoXDqbmI1fhXeOj2D+nqlUlU9xpHv99Y6u845qeyRGCcfl6pIv5NYva3u0LuqIm1cHPojqkTLhQAJGlvP1vvcnT5Bk3ipipYoVYkDzf7u0e0X+9FcLvPfuZKAVnBUn0QvIPJSFS1TqhLbjvheQsC/lgO0IWCAl6r0Q5Sq/DylSx8EaPkPS1XAU+GypapNT2PQdchS1ValUlUBZqeXoKmliZeqoEypiirhmYh5/0oB5mDk8r18c2ub3nkyUKFUtVa4MXyPp7UHml4exj6cy74/OL48fTcezmnUVKoCU6lqY/nK4Fjig0ufm4P8QSGAlQbq4dTZbuh//WtwPFQPgaCLl6p2YGYyBjev3oOpsU+xJ8Yib6UQIHAq+FCO8tZeDNsoLNFZ5W1uv+mVCwHFgobNRI0C3zO2TPWrEGBc/xZgAJyadcoLu6zuAAAAAElFTkSuQmCC);\r
+        background-position:0 0;\r
+        cursor:W-resize;  \r
+        line-height:20px;\r
+        font-size:10px;       \r
+        -moz-outline:0 none;\r
+        -webkit-touch-callout: none;        \r
+          -webkit-user-select: none;\r
+           -khtml-user-select: none;\r
+             -moz-user-select: none;\r
+              -ms-user-select: none;\r
+               -o-user-select: none;\r
+                  user-select: none;                                 \r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal\r
+        State: Default\r
+        Notes: IE6, 7 & 8 use a nasty expression in order to not draw focus \r
+        outline on drag handle. \r
+*/\r
+.oldie .fd-slider-handle\r
+        {\r
+        /* IE6 & 7 - set the handle sprite as the background image */ \r
+        \r
+        /* \r
+           If using the .mht file then uncomment the following rule and edit the \r
+           filepath to match the absolute path to the fd-slider.mht file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        *background-image:url(mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!fullsprite);\r
+        \r
+        */\r
+        \r
+        /* \r
+           If not using the .mht file then uncomment the following rule and edit \r
+           the filepath to match the absolute path to the fd-slider-sprite.png \r
+           file on your server (replace "www.your-domain.com/the/path/to/") \r
+        */\r
+                \r
+        /* \r
+        \r
+        *background-image:url(http://www.your-domain.com/the/path/to/fd-slider-sprite.png);\r
+        \r
+        */        \r
+        \r
+        /**********************************************************************/\r
+                \r
+        /* IE6 - reset the background image sprite stipulated above. */\r
+        _background-image:none;\r
+\r
+        /* \r
+           IE6 - use the AlphaImageLoader to either load a base64 encoded image \r
+           from the .mht file or a normal png image from the server \r
+        */\r
+        \r
+        /* \r
+           If using the .mht file then uncomment the following rule and edit the \r
+           filepath to match the absolute path to the fd-slider.mht file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */ \r
+        \r
+        /*\r
+               \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handlenormal');\r
+        \r
+        */\r
+        \r
+        /* \r
+           If not using the .mht file then uncomment the following rule and edit \r
+           the filepath to match the absolute path to the fd-handle-normal.png\r
+           file on your server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-normal.png');\r
+        \r
+        */\r
+        \r
+        /* IE6, 7 & 8 */\r
+        outline:expression(hideFocus='true');\r
+        }       \r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal & Vertical\r
+        State: Focused\r
+        Notes: Attempts to remove the focus outline, remove the rule if it\r
+        offends your sensibilities.\r
+*/\r
+.fd-slider-handle:focus\r
+        {\r
+        outline:0 none;\r
+        border:0 none;\r
+        -moz-user-focus:normal;\r
+        }\r
+.fd-slider-handle:focus::-moz-focus-inner \r
+        { \r
+        border-color: transparent; \r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal\r
+        State: Focused and Hovered and also while handle is animating into \r
+        position or being dragged.\r
+        Notes: I'm using the same image for focused, hover and active states\r
+        but you can, of course, go wild.\r
+*/\r
+.fd-slider-focused .fd-slider-handle,\r
+.fd-slider-hover   .fd-slider-handle,\r
+.fd-slider-active  .fd-slider-handle\r
+        {\r
+        background-position:0 -20px;\r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal\r
+        State: Focused and Hovered and also while handle is animating into \r
+        position or being dragged.\r
+        Notes: IE6 only.\r
+*/\r
+.oldie .fd-slider-focused .fd-slider-handle,\r
+.oldie .fd-slider-hover   .fd-slider-handle,\r
+.oldie .fd-slider-active  .fd-slider-handle\r
+        {\r
+        /* \r
+           IE6 - use the AlphaImageLoader to either load a base64 encoded image \r
+           from the .mht file or a normal png image from the server \r
+        */\r
+        \r
+        /* \r
+           If using the .mht file then uncomment the following rule and edit the \r
+           filepath to match the absolute path to the fd-slider.mht file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */ \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handleglow');\r
+        \r
+        */\r
+        \r
+        /* \r
+           If not using the .mht file then uncomment the following rule and edit \r
+           the filepath to match the absolute path to the fd-handle-glow.png\r
+           file on your server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-glow.png');\r
+\r
+        */\r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Vertical\r
+        Notes: Change the cursor to the correct icon.\r
+*/\r
+.fd-slider-vertical .fd-slider-handle\r
+        {\r
+        cursor:N-resize;\r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Vertical\r
+        Notes: IE6, 7 & 8\r
+         \r
+.oldie .fd-slider-vertical .fd-slider-handle\r
+        {\r
+        }\r
+*/\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Vertical\r
+        State: Focused and Hovered and also while handle is animating into \r
+        position or being dragged.\r
\r
+.fd-slider-vertical .fd-slider-focused .fd-slider-handle,\r
+.fd-slider-vertical .fd-slider-hover   .fd-slider-handle,\r
+.fd-slider-vertical .fd-slider-active  .fd-slider-handle\r
+        {\r
+        }\r
+*/\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Vertical\r
+        State: Focused and Hovered and also while handle is animating into \r
+        position or being dragged.\r
+        Notes: IE6, 7 & 8\r
\r
+.oldie .fd-slider-vertical .fd-slider-focused .fd-slider-handle,\r
+.oldie .fd-slider-vertical .fd-slider-hover   .fd-slider-handle,\r
+.oldie .fd-slider-vertical .fd-slider-active  .fd-slider-handle\r
+        {\r
+        }\r
+*/\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal & Vertical\r
+        State: User has not yet used the slider to set a value\r
+        Notes: I screwed the positioning of the image sprite by 1px which is why\r
+        it's -59px and not -60px. Yeah - I suck at Photoshop.      \r
+*/\r
+.fd-slider-no-value .fd-slider-handle\r
+        {\r
+        background-position:0 -59px;\r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Horizontal\r
+        State: User has not yet used the slider to set a value\r
+        Notes: IE6 only\r
+*/\r
+.oldie .fd-slider-no-value .fd-slider-handle\r
+        {\r
+        /* \r
+           IE6 - use the AlphaImageLoader to either load a base64 encoded image \r
+           from the .mht file or a normal png image from the server \r
+        */\r
+        \r
+        /* \r
+           If using the .mht file then uncomment the following rule and edit the \r
+           filepath to match the absolute path to the fd-slider.mht file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */ \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handlenovalue');\r
+        \r
+        */\r
+        \r
+        /* \r
+           If not using the .mht file then uncomment the following rule and edit \r
+           the filepath to match the absolute path to the fd-handle-no-value.png\r
+           file on your server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-no-value.png');\r
+\r
+        */\r
+        }\r
+/*\r
+        Element: Drag handle \r
+        Orientation: Vertical\r
+        State: User has not yet used the slider to set a value\r
+        Notes: IE6, 7 & 8. Only required should you use a different image for\r
+        vertical sliders.\r
+        \r
+.oldie .fd-slider-vertical .fd-slider-no-value .fd-slider-handle\r
+        {\r
+        }        \r
+*/ \r
+/*\r
+        Element: document.body\r
+        Orientation: Horizontal and  Vertical\r
+        Notes: Class given to body to change cursor style when dragging. It also\r
+        attempts to stop text selection while dragging. \r
+*/\r
+body.fd-slider-drag-horizontal,\r
+body.fd-slider-drag-horizontal *,\r
+body.fd-slider-drag-vertical,\r
+body.fd-slider-drag-vertical *\r
+        {\r
+        cursor:N-resize !important;\r
+        -webkit-user-select: none;\r
+           -moz-user-select: none;\r
+            -ms-user-select: none;\r
+             -o-user-select: none;\r
+                user-select: none;\r
+        }\r
+/*\r
+        Element: document.body\r
+        Orientation: Horizontal\r
+        Notes: Class given to body to change cursor style when dragging \r
+*/\r
+body.fd-slider-drag-horizontal,\r
+body.fd-slider-drag-horizontal *\r
+        {\r
+        cursor:W-resize !important;\r
+        }\r
+/*\r
+        Element: Inner wrapper\r
+        Orientation: Horizontal & Vertical\r
+        State: disabled\r
+        Notes: Class given to slider when disabled\r
+*/  \r
+.fd-slider-disabled\r
+        {\r
+        opacity:.8;\r
+        cursor:default;\r
+        }\r
+/*\r
+        Element: Drag handle\r
+        Orientation: Horizontal\r
+        State: disabled\r
+        Notes: Class given to slider when disabled\r
+*/ \r
+.fd-slider-disabled .fd-slider-handle\r
+        {\r
+        cursor:default !important;\r
+        background-position:0 -40px;\r
+        opacity:1;\r
+        }\r
+/*\r
+        Element: Drag handle\r
+        Orientation: Horizontal\r
+        State: disabled\r
+        Notes: IE6 only\r
+*/ \r
+.oldie .fd-slider-disabled .fd-slider-handle\r
+        {\r
+        /* \r
+           IE6 - use the AlphaImageLoader to either load a base64 encoded image \r
+           from the .mht file or a normal png image from the server \r
+        */\r
+        \r
+        /* \r
+           If using the .mht file then uncomment the following rule and edit the \r
+           filepath to match the absolute path to the fd-slider.mht file on your \r
+           server (replace "www.your-domain.com/the/path/to/") \r
+        */ \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='mhtml:http://www.your-domain.com/the/path/to/fd-slider.mht!handledisabled');\r
+        \r
+        */\r
+        \r
+        /* \r
+           If not using the .mht file then uncomment the following rule and edit \r
+           the filepath to match the absolute path to the fd-handle-disabled.png\r
+           file on your server (replace "www.your-domain.com/the/path/to/") \r
+        */        \r
+        \r
+        /*\r
+        \r
+        _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='http://www.your-domain.com/the/path/to/fd-handle-disabled.png');\r
+\r
+        */\r
+        }\r
+/*\r
+        Element: Drag handle\r
+        Orientation: Vertical\r
+        State: disabled\r
+        \r
+.fd-slider-vertical .fd-slider-disabled .fd-slider-handle\r
+        {\r
+        }\r
+.oldie .fd-slider-vertical .fd-slider-disabled .fd-slider-handle\r
+        {\r
+        }\r
+*/ \r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Horizontal\r
+        State: disabled\r
+*/ \r
+.fd-slider-disabled .fd-slider-bar\r
+        {\r
+        cursor:auto !important;\r
+        border:1px solid #888;\r
+        border-bottom:1px solid #999;\r
+        border-right:1px solid #999;\r
+        border:1px solid rgba(136,136,136,.8);\r
+        border-bottom:1px solid rgba(153,153,153,.8);\r
+        border-right:1px solid rgba(153,153,153,.8);\r
+        background-color:#555;\r
+        background-image: -webkit-gradient(linear, left top, right top, from(#666), to(#333)); \r
+        background-image: -webkit-linear-gradient(left, #666, #333); \r
+        background-image:    -moz-linear-gradient(left, #666, #333); \r
+        background-image:     -ms-linear-gradient(left, #666, #333); \r
+        background-image:      -o-linear-gradient(left, #666, #333); \r
+        background-image:         linear-gradient(to right, #666, #333);\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Vertical\r
+        State: disabled\r
+*/ \r
+.fd-slider-vertical .fd-slider-disabled .fd-slider-bar\r
+        {\r
+        background-image: -webkit-gradient(linear, left top, right bottom, from(#333), to(#666)); \r
+        background-image: -webkit-linear-gradient(top, #333, #666); \r
+        background-image:    -moz-linear-gradient(top, #333, #666); \r
+        background-image:     -ms-linear-gradient(top, #333, #666); \r
+        background-image:      -o-linear-gradient(top, #333, #666); \r
+        background-image:         linear-gradient(to bottom, #333, #666);\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Horizontal\r
+        State: disabled\r
+        Notes: IE6, 7 & 8\r
+*/\r
+.oldie .fd-slider-disabled .fd-slider-bar\r
+        {\r
+        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ff666666',endColorstr='#ff333333');\r
+        }\r
+/*\r
+        Element: Inner track bar\r
+        Orientation: Vertical\r
+        State: disabled\r
+        Notes: IE6, 7 & 8\r
+*/\r
+.oldie .fd-slider-vertical .fd-slider-disabled .fd-slider-bar\r
+        {\r
+        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ff666666',endColorstr='#ff333333');\r
+        }\r
+/*\r
+        Element: Range bar\r
+        Orientation: Horizontal\r
+        State: disabled\r
+*/\r
+.fd-slider-disabled .fd-slider-range\r
+        {\r
+        cursor:auto !important;\r
+        background-color:#222;\r
+        background-image: -webkit-gradient(linear, left top, right top, from(#222), to(#000)); \r
+        background-image: -webkit-linear-gradient(left, #222, #000); \r
+        background-image:    -moz-linear-gradient(left, #222, #000); \r
+        background-image:     -ms-linear-gradient(left, #222, #000); \r
+        background-image:      -o-linear-gradient(left, #222, #000); \r
+        background-image:         linear-gradient(to right, #222, #000);\r
+        }\r
+/*\r
+        Element: Range bar\r
+        Orientation: Horizontal\r
+        State: disabled\r
+        Notes: IE6, 7 & 8\r
+*/\r
+.oldie .fd-slider-disabled .fd-slider-range\r
+        {\r
+        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#ff222222',endColorstr='#ff000000');\r
+        }\r
+/*\r
+        Element: Range bar\r
+        Orientation: Vertical\r
+        State: disabled\r
+*/\r
+.fd-slider-vertical .fd-slider-disabled .fd-slider-range\r
+        {\r
+        background-image: -webkit-gradient(linear, left top, right bottom, from(#000), to(#222)); \r
+        background-image: -webkit-linear-gradient(top, #000, #222); \r
+        background-image:    -moz-linear-gradient(top, #000, #222); \r
+        background-image:     -ms-linear-gradient(top, #000, #222); \r
+        background-image:      -o-linear-gradient(top, #000, #222); \r
+        background-image:         linear-gradient(to bottom, #000, #222);     \r
+        }\r
+/*\r
+        Element: Range bar\r
+        Orientation: Vertical\r
+        State: disabled\r
+        Notes: IE6, 7 & 8\r
+*/\r
+.oldie .fd-slider-vertical .fd-slider-disabled .fd-slider-range\r
+        {\r
+        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ff222222',endColorstr='#ff000000');\r
+        }\r
+/* \r
+        The various prefixed keyframe rules for the glow effect used whenever\r
+        the slider gains keyboard focus\r
+*/\r
+@-webkit-keyframes fd-pulse {\r
+0%      {\r
+        box-shadow:0 0 3px rgba(100, 130, 170, 0.55);\r
+        }\r
+20%     {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+40%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+60%     {\r
+        box-shadow:0 0 6px rgba(10, 130, 170, 0.7);\r
+        }\r
+80%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+100%    {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+}\r
+@-moz-keyframes fd-pulse {\r
+0%      {\r
+        box-shadow:0 0 3px rgba(100, 130, 170, 0.55);\r
+        }\r
+20%     {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+40%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+60%     {\r
+        box-shadow:0 0 6px rgba(10, 130, 170, 0.7);\r
+        }\r
+80%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+100%    {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+}\r
+@-o-keyframes fd-pulse {\r
+0%      {\r
+        box-shadow:0 0 3px rgba(100, 130, 170, 0.55);\r
+        }\r
+20%     {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+40%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+60%     {\r
+        box-shadow:0 0 6px rgba(10, 130, 170, 0.7);\r
+        }\r
+80%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+100%    {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+}\r
+@keyframes fd-pulse {\r
+0%      {\r
+        box-shadow:0 0 3px rgba(100, 130, 170, 0.55);\r
+        }\r
+20%     {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+40%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+60%     {\r
+        box-shadow:0 0 6px rgba(10, 130, 170, 0.7);\r
+        }\r
+80%     {\r
+        box-shadow:0 0 5px rgba(40, 130, 170, 0.65);\r
+        }\r
+100%    {\r
+        box-shadow:0 0 4px rgba(70, 130, 170, 0.6);\r
+        }\r
+}\r
diff --git a/src/resources/js/fd-slider.min.js b/src/resources/js/fd-slider.min.js
new file mode 100644 (file)
index 0000000..264cae7
--- /dev/null
@@ -0,0 +1,2 @@
+/*! Unobtrusive Slider Control / HTML5 Input Range polyfill - MIT/GPL2 @freqdec */
+var fdSlider=function(){function ut(n){function nf(n){n=!!n,n!=ft&&(ft=n,pt(kt()))}function nu(){if(!p||d=="select")return;var n=g(e);if(n.min==tt&&n.max==st&&n.step==nt)return;tt=+n.min,st=+n.max,ut=tt,it=st,nt=+n.step,ir=Math.abs(st-tt),li=nt*2,bi=Math.ceil(ir/nt),ft=!1,ar(tt,st)}function gr(n){if(oi&&!n)return;try{di(l,-1),i(l,"focus",fu),i(l,"blur",su),o?i(l,"keypress",yi):(i(l,"keydown",yi),i(l,"keypress",ou)),i(a,"mouseover",br),i(a,"mouseout",sr),i(a,"mousedown",fi),i(a,"touchstart",fi),c&&(window.addEventListener&&!window.devicePixelRatio?window.removeEventListener("DOMMouseScroll",at,!1):(i(document,"mousewheel",at),i(window,"mousewheel",at)))}catch(t){}u(v,"fd-slider-focused"),u(v,"fd-slider-active"),f(v,"fd-slider-disabled"),a.setAttribute("aria-disabled",!0),e.disabled=oi=!0,clearTimeout(ht),n||ot("disable")}function hu(n){if(!oi&&!n)return;di(l,0),t(l,"focus",fu),t(l,"blur",su),o?t(l,"keypress",yi):(t(l,"keydown",yi),t(l,"keypress",ou)),t(a,"touchstart",fi),t(a,"mousedown",fi),t(a,"mouseover",br),t(a,"mouseout",sr),u(v,"fd-slider-disabled"),a.setAttribute("aria-disabled",!1),e.disabled=oi=gt=!1,n||ot("enable")}function ku(){clearTimeout(ht),ri=vt=l=a=v=ht=null,ot("destroy"),ki=null}function ii(){wr();try{var t=a.offsetWidth,n=a.offsetHeight,r=l.offsetWidth,i=l.offsetHeight,o=vt.offsetHeight,s=vt.offsetWidth,u=b?n-i:t-r;ct=u/bi,ni=Math.max(et?er(tr(ut)):Math.abs((ut-tt)/nt)*ct,0),bt=Math.min(et?er(tr(it)):Math.abs((it-tt)/nt)*ct,Math.floor(b?n-i:t-r)),ru=t,dr=n,pt(nr?kt():d=="select"?e.selectedIndex:parseFloat(e.value),!1)}catch(f){}ot("redraw")}function ot(n){var r,i,u,t;if(wt){if(n.match(/^(blur|focus|change)$/i))if(typeof document.createEvent!="undefined")t=document.createEvent("HTMLEvents"),t.initEvent(n,!0,!0),e.dispatchEvent(t);else if(typeof document.createEventObject!="undefined")try{t=document.createEventObject(),e.fireEvent("on"+n.toLowerCase(),t)}catch(f){}}else if(ki.hasOwnProperty(n))for(r={userSet:ft,disabled:oi,elem:e,value:d=="select"?e.options[e.selectedIndex].value:e.value},i=0;u=ki[n][i];i++)u.call(e,r)}function fu(){return f(v,"fd-slider-focused"),h.onfocus&&(ft=!0,pt(kt())),c&&(t(window,"DOMMouseScroll",at),t(document,"mousewheel",at),o||t(window,"mousewheel",at)),ot("focus"),!0}function su(){u(v,"fd-slider-focused"),c&&(i(document,"mousewheel",at),i(window,"DOMMouseScroll",at),o||i(window,"mousewheel",at)),lt=!0,ot("blur")}function at(n){if(!lt)return;n=n||window.event;var t=0,i;n.wheelDelta?(t=n.wheelDelta/120,o&&window.opera.version()<9.2&&(t=-t)):n.detail&&(t=-n.detail/3),b&&(t=-t),t&&(i=kt(),i+=t<0?-nt:nt,ft=!0,pt(hi(i))),s(n)}function ou(n){return n=n||window.event,n.keyCode>=33&&n.keyCode<=40||!lt||n.keyCode==45||n.keyCode==46?k(n):!0}function yi(n){if(!lt)return!0;n=n||window.event;var t=n.keyCode!==null?n.keyCode:n.charCode,i;if(t<33||t>40&&t!=45&&t!=46)return!0;i=kt(),t==37||t==40||t==46||t==34?i-=n.ctrlKey||t==34?+li:+nt:t==39||t==38||t==45||t==33?i+=n.ctrlKey||t==33?+li:+nt:t==35?i=it:t==36&&(i=ut),ft=!0,pt(hi(i)),ot("update"),s(n)}function br(){f(v,"fd-slider-hover")}function sr(){u(v,"fd-slider-hover")}function fi(n){var u,r;n=n||window.event,s(n),n.target?u=n.target:n.srcElement&&(u=n.srcElement),u&&u.nodeType==3&&(u=u.parentNode);if(n.touches){if(n.targetTouches&&n.targetTouches.length!=1)return!1;n=n.touches[0],gt=!0}return clearTimeout(ht),ht=null,lt=!1,ft=!0,u.className.search("fd-slider-handle")!=-1?(rr=b?n.clientY:n.clientX,tu=parseInt(b?l.offsetTop:l.offsetLeft)||0,ci(n),gt?(t(document,"touchmove",ci),t(document,"touchend",vi),i(a,"mousedown",fi)):(t(document,"mousemove",ci),t(document,"mouseup",vi)),f(v,"fd-slider-active"),f(document.body,"fd-slider-drag-"+(b?"vertical":"horizontal")),ot("dragstart")):(wr(),r=0,n.pageX||n.pageY?r=b?n.pageY:n.pageX:(n.clientX||n.clientY)&&(r=b?n.clientY+document.body.scrollTop+document.documentElement.scrollTop:n.clientX+document.body.scrollLeft+document.documentElement.scrollLeft),r-=b?hr+Math.round(l.offsetHeight/2):iu+Math.round(l.offsetWidth/2),r=pi(r),pr=="tween"?(f(v,"fd-slider-active"),bu(r)):pr=="timed"?(f(v,"fd-slider-active"),t(document,gt?"touchend":"mouseup",cr),ui=r,yr()):ai(r)),!1}function cr(n){return n=n||window.event,s(n),i(document,gt?"touchend":"mouseup",cr),u(v,"fd-slider-active"),clearTimeout(ht),ht=null,lt=!0,!1}function vi(n){return n=n||window.event,s(n),gt?(i(document,"touchmove",ci),i(document,"touchend",vi)):(i(document,"mousemove",ci),i(document,"mouseup",vi)),lt=!0,u(document.body,"fd-slider-drag-"+(b?"vertical":"horizontal")),u(v,"fd-slider-active"),ot("dragend"),!1}function ci(n){n=n||window.event,s(n);if(n.touches){if(n.targetTouches&&n.targetTouches.length!=1)return!1;n=n.touches[0]}return ai(pi(tu+(b?n.clientY-rr:n.clientX-rr))),!1}function ei(n){var t=kt();ft=!0,t+=n*nt,pt(hi(t))}function wr(){var i=0,t=0,n=a;try{do i+=n.offsetLeft,t+=n.offsetTop;while(n=n.offsetParent)}catch(r){}iu=i,hr=t}function yr(){var n=parseInt(b?l.offsetTop:l.offsetLeft,10);n=Math.round(ui<n?Math.max(ui,Math.floor(n-ct)):Math.min(ui,Math.ceil(n+ct))),ai(pi(n)),n!=ui?ht=setTimeout(yr,bi>20?50:100):(lt=!0,u(v,"fd-slider-active"),ot("finalise"))}function bu(n){lt=!1,or=parseInt(n,10),fr=parseInt(b?l.offsetTop:l.offsetLeft,10),uu=or-fr,lu=20,ur=0,ht||(ht=setTimeout(gi,20))}function si(n){return isNaN(n)||n===""||typeof n=="undefined"?(ft=!1,yt):n<Math.min(ut,it)?(ft=!1,Math.min(ut,it)):n>Math.max(ut,it)?(ft=!1,Math.max(ut,it)):(ft=!0,n)}function kt(){return hi(d=="input"?parseFloat(e.value):e.selectedIndex)}function hi(n){return isNaN(n)||n===""||typeof n=="undefined"?yt:Math.min(Math.max(n,Math.min(ut,it)),Math.max(ut,it))}function ai(n){var t=hi(et?du(tf(n)):b?st-Math.round(n/ct)*nt:tt+Math.round(n/ct)*nt);l.style[b?"top":"left"]=(n||0)+"px",lr(),vr(d=="select"||nt==1?Math.round(t):t)}function pt(n,t){var r=!1,i;(typeof n=="undefined"||isNaN(n)||n==="")&&d=="input"&&!nr?(i=yt,r=!0,ft=!1):i=si(n),l.style[b?"top":"left"]=(et?er(tr(i)):b?Math.round((st-i)/nt*ct):Math.round((i-tt)/nt*ct))+"px",lr(),!0&&vr(r?"":i)}function pi(n){if(et)return Math.max(Math.min(bt,n),ni);var t=n%ct;return t&&t>=ct/2?n+=ct-t:n-=t,n<Math.min(Math.abs(ni),Math.abs(bt))?n=Math.min(Math.abs(ni),Math.abs(bt)):n>Math.max(Math.abs(ni),Math.abs(bt))&&(n=Math.max(Math.abs(ni),Math.abs(bt))),Math.min(Math.max(n,0),bt)}function du(n){var i=0,r=tt,u,t;for(t in et){if(!et.hasOwnProperty(t))continue;n<i||n>+t||(u=r+(n-i)*(+et[t]-r)/(+t-i)),i=+t,r=+et[t]}return u}function tr(n){var r=0,i=tt,u=0,t;for(t in et){if(!et.hasOwnProperty(t))continue;n<i||n>+et[t]||(u=r+(n-i)*(+t-r)/(+et[t]-i)),r=+t,i=+et[t]}return u}function er(n){return(a[b?"offsetHeight":"offsetWidth"]-l[b?"offsetHeight":"offsetWidth"])/100*n}function tf(n){return n/((a[b?"offsetHeight":"offsetWidth"]-a[l?"offsetHeight":"offsetWidth"])/100)}function vr(n){ot("update"),ft?u(v,"fd-slider-no-value"):f(v,"fd-slider-no-value");if(d=="select")try{n=parseInt(n,10);if(e.selectedIndex===n){dt();return}e.options[n].selected=!0}catch(t){}else{n===""||wi||(n=(tt+Math.round((+n-tt)/nt)*nt).toFixed(yu));if(e.value===n){dt();return}e.value=n}dt(),ot("change")}function ar(n,t){ut>it?(n=Math.min(tt,Math.max(n,t)),t=Math.max(st,Math.min(n,t)),ut=Math.max(n,t),it=Math.min(n,t)):(n=Math.max(tt,Math.min(n,t)),t=Math.min(st,Math.max(n,t)),ut=Math.min(n,t),it=Math.max(n,t)),yt<Math.min(ut,it)?yt=Math.min(ut,it):yt>Math.max(ut,it)&&(yt=Math.max(ut,it)),l.setAttribute("aria-valuemin",ut),l.setAttribute("aria-valuemax",it),si(d=="input"?parseFloat(e.value):e.selectedIndex),ii()}function lr(){if(y)return;b?ti.style.height=Math.max(1,vt.offsetHeight-l.offsetTop)+"px":ti.style.width=Math.max(1,l.offsetLeft)+"px"}function cu(){for(var t=!1,r=document.getElementsByTagName("label"),n,i=0;n=r[i];i++)if(n.htmlFor&&n.htmlFor==e.id||n.getAttribute("for")==e.id){t=n;break}return t&&!t.id&&(t.id=e.id+"_label"),t}function dt(){var n=d=="select"?e.options[e.selectedIndex].value:e.value,t=kr?kr(n):d=="select"?e.options[e.selectedIndex].text?e.options[e.selectedIndex].text:n:n;l.setAttribute("aria-valuenow",n),l.setAttribute("aria-valuetext",t)}function wu(){ft=!0,wi=gu,pt(d=="input"?parseFloat(e.value):e.selectedIndex),dt(),wi=!1}function pu(){d=="input"?e.value=e.defaultValue:e.selectedIndex=au,si(d=="select"?e.options[e.selectedIndex].value:e.value),ii(),dt()}function di(n,t){n.setAttribute("tabIndex",t),n.tabIndex=t}var e=n.inp,oi=!1,d=e.tagName.toLowerCase(),tt=+n.min,st=+n.max,ut=+n.min,it=+n.max,ir=Math.abs(st-tt),nt=d=="select"?1:+n.step,li=n.maxStep?+n.maxStep:nt*2,yu=n.precision||0,bi=Math.ceil(ir/nt),et=n.scale||!1,rf=!!n.hideInput,pr=n.animation||"",b=!!n.vertical,ki=n.callbacks||{},vu=n.classNames||"",wt=!!n.html5Shim,yt=st<tt?tt:tt+(st-tt)/2,au=d=="select"?e.selectedIndex:e.defaultValue||yt,nr=wt||!!n.forceValue,eu=wt&&b&&"inpHeight"in n?n.inpHeight:!1,kr=!wt&&n.ariaFormat?n.ariaFormat:!1,gu=!wt&&!(d=="select")&&"userSnap"in n?!!n.userSnap:!1,wi=!1,ht=null,lt=!0,ff=d=="select"?e.selectedIndex:e.value,dr=0,ru=0,or=0,fr=0,uu=0,lu=0,ur=0,iu=0,hr=0,bt=0,ni=0,tu=0,ui=0,rr=0,ct=0,ft=!1,gt=!1,a,v,ri,l,ti,vt,gi;return d=="input"&&nr&&!e.defaultValue&&(e.defaultValue=kt()),st<tt&&(nt=-Math.abs(nt),li=-Math.abs(li)),et&&(et[100]=st),gi=function(){ur++;var r=uu,n=20,t=ur,i=fr,f=Math.ceil(t==n?i+r:r*(-Math.pow(2,-10*t/n)+1)+i);ai(t==n?or:f),t!=n?(ot("move"),ht=setTimeout(gi,20)):(clearTimeout(ht),ht=null,lt=!0,u(v,"fd-slider-focused"),u(v,"fd-slider-active"),ot("finalise"))},(function(){if(wt||rf){f(e,"fd-form-element-hidden");try{e.type!="range"&&r(e,"type")=="range"&&document.defaultView.getComputedStyle(e,null).getPropertyValue("display")=="inline-block"&&(e.type="number")}catch(i){}}else t(e,"change",wu);wt&&(e.setAttribute("fd-range-enabled",1),e.stepUp=function(n){ei(n||1)},e.stepDown=function(n){ei(n||-1)},p&&t(e,typeof e.onpropertychange=="object"?"propertychange":"DOMAttrModified",nu)),a=document.createElement("span"),a.className="fd-slider"+(b?"-vertical ":" ")+vu,a.id="fd-slider-"+e.id,b&&eu&&(a.style.height=eu+"px"),v=document.createElement("span"),v.className="fd-slider-wrapper"+(wt?"":" fd-slider-no-value"),ri=document.createElement("span"),ri.className="fd-slider-inner",vt=document.createElement("span"),vt.className="fd-slider-bar",rt?l=document.createElement("span"):(l=document.createElement("a"),l.setAttribute("href","#"),t(l,"click",k)),di(l,0),l.className="fd-slider-handle",l.appendChild(document.createTextNode(String.fromCharCode(160))),v.appendChild(ri),y||(ti=document.createElement("span"),ti.className="fd-slider-range",v.appendChild(ti)),v.appendChild(vt),v.appendChild(l),a.appendChild(v),e.parentNode.insertBefore(a,e),o&&(l.unselectable="on",vt.unselectable="on",ri.unselectable="on",a.unselectable="on",v.unselectable="on",y||(ti.unselectable="on")),a.setAttribute("role","application"),l.setAttribute("role","slider"),l.setAttribute("aria-valuemin",d=="select"?e.options[0].value:tt),l.setAttribute("aria-valuemax",d=="select"?e.options[e.options.length-1].value:st);var n=cu();if(n){l.setAttribute("aria-labelledby",n.id),l.id="fd-slider-handle-"+e.id;/*@if(@_win32)n.setAttribute("htmlFor",l.id);@else@*/n.setAttribute("for",l.id);/*@end@*/}document.getElementById(w)&&l.setAttribute("aria-describedby",w),e.getAttribute("disabled")==!0||e.getAttribute("disabled")=="disabled"?gr(!0):hu(!0),h.onvalue&&(ft=!0,si(d=="input"?parseFloat(e.value):e.selectedIndex)),e.form&&t(e.form,"reset",pu),dt(),ot("create"),ii()})(),{onResize:function(){(a.offsetHeight!=dr||a.offsetWidth!=ru)&&ii()},destroy:function(){ku()},reset:function(){pt(d=="input"?parseFloat(e.value):e.selectedIndex)},stepUp:function(n){ei(Math.abs(n)||1)},stepDown:function(n){ei(-Math.abs(n)||-1)},increment:function(n){ei(n)},disable:function(){gr()},enable:function(){hu()},setRange:function(n,t){ar(n,t)},getValueSet:function(){return!!ft},setValueSet:function(n){nf(n)},rescan:function(){nu()},checkValue:function(){h.onvalue&&(ft=!0,si(d=="input"?parseFloat(e.value):e.selectedIndex)),dt(),ii()}}}var n={},lt=0,c=!0,rt=!0,w="fd-slider-describedby",h={onfocus:!0,onvalue:!0},y=!1,ft="jump",p=!1,o=Object.prototype.toString.call(window.opera)==="[object Opera]",v=/^([\-]{0,1}[0-9]+(\.[0-9]+){0,1})$/,b=/^([0-9]+(\.[0-9]+){0,1})$/,ot=function(n){if(typeof n!="string"||n==="")return{};try{if(typeof JSON=="object"&&typeof JSON.parse=="function")return JSON.parse(n);if(/mousewheelenabled|fullaria|describedby|norangebar|html5animation|varsetrules/.test(n.toLowerCase())){var t=Function(["var document,top,self,window,parent,Number,Date,Object,Function,","Array,String,Math,RegExp,Image,ActiveXObject;","return (",n.replace(/<\!--.+-->/gim,"").replace(/\bfunction\b/g,"function-"),");"].join(""));return t()}}catch(i){}return{err:"Could not parse the JSON object"}},it=function(n){if(typeof n!="object")return;for(var t in n){value=n[t];switch(t.toLowerCase()){case"mousewheelenabled":c=!!value;break;case"fullaria":rt=!!value;break;case"describedby":w=String(value);break;case"norangebar":y=!!value;break;case"html5animation":ft=String(value).search(/^(jump|tween|timed)$/i)!=-1?String(value).toLowerCase():"jump";break;case"watchattributes":p=!!value;break;case"varsetrules":"onfocus"in value&&(h.onfocus=!!value.onfocus),"onvalue"in value&&(h.onvalue=!!value.onvalue)}}},t=function(n,t,i){n.addEventListener?n.addEventListener(t,i,!0):n.attachEvent&&n.attachEvent("on"+t,i)},i=function(n,t,i){try{n.removeEventListener?n.removeEventListener(t,i,!0):n.detachEvent&&n.detachEvent("on"+t,i)}catch(r){}},k=function(n){n=n||window.event,n.stopPropagation&&(n.stopPropagation(),n.preventDefault());/*@cc_on@if(@_win32)n.cancelBubble=!0,n.returnValue=!1;@end@*/return!1},s=function(n){n=n||window.event;if(n.preventDefault){n.preventDefault();return}n.returnValue=!1},f=function(n,t){if(new RegExp("(^|\\s)"+t+"(\\s|$)").test(n.className))return;n.className+=(n.className?" ":"")+t},u=function(n,t){n.className=t?n.className.replace(new RegExp("(^|\\s)"+t+"(\\s|$)")," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""):""},ct=function(){var i={},t;for(t in n)i[t]=n[t].getValueSet();return i},st=function(t,i){n[t].setValueSet(!!i)},e=function(t){return!!(t in n&&n.hasOwnProperty(t))},vt=function(t){if(!t||!t.inp||!t.inp.tagName||t.inp.tagName.search(/^input|select/i)==-1)return!1;t.html5Shim=!1;if(t.inp.tagName.toLowerCase()=="select"){if(t.inp.options.length<2)return!1;t.min=0,t.max=t.inp.options.length-1,t.step=1,t.precision=0,t.scale=!1,t.forceValue=!0}else{if(String(t.inp.type).search(/^(text|range)$/i)==-1)return!1;t.min=t.min&&String(t.min).search(v)!=-1?+t.min:0,t.max=t.max&&String(t.max).search(v)!=-1?+t.max:100,t.step=t.step&&String(t.step).search(b)!=-1?t.step:1,t.precision=t.precision&&String(t.precision).search(/^[0-9]+$/)!=-1?t.precision:String(t.step).search(/\.([0-9]+)$/)!=-1?String(t.step).match(/\.([0-9]+)$/)[1].length:0,t.scale=t.scale||!1,t.forceValue="forceValue"in t?!!t.forceValue:!1,t.userSnap="userSnap"in t?!!t.userSnap:!1}return t.ariaFormat="ariaFormat"in t&&typeof t.ariaFormat=="function"?t.ariaFormat:!1,t.maxStep=t.maxStep&&String(t.maxStep).search(b)!=-1?+t.maxStep:+t.step*2,t.classNames=t.classNames||"",t.callbacks=t.callbacks||!1,a(t.inp.id),n[t.inp.id]=new ut(t),!0},r=function(n,t){return n.getAttribute(t)||""},l=function(){for(var e=document.getElementsByTagName("input"),i,u,t,f=0;t=e[f];f++)if(t.tagName.toLowerCase()=="input"&&r(t,"type")&&r(t,"type").toLowerCase()=="range"&&(r(t,"min")&&r(t,"min").search(v)!=-1||r(t,"max")&&r(t,"max").search(v)!=-1||r(t,"step")&&r(t,"step").search(/^(any|([0-9]+(\.[0-9]+){0,1}))$/i)!=-1)){if(t.id&&document.getElementById("fd-slider-"+t.id))continue;else t.id&&!document.getElementById("fd-slider-"+t.id)&&a(t.id);t.id||(t.id="fd-slider-form-elem-"+lt++),i={inp:t,callbacks:[],animation:ft,vertical:r(t,"data-fd-slider-vertical")?!0:t.offsetHeight>t.offsetWidth,classNames:r(t,"data-fd-slider-vertical"),html5Shim:!0},i.vertical&&!r(t,"data-fd-slider-vertical")&&(i.inpHeight=t.offsetHeight),u=g(t),i.min=u.min,i.max=u.max,i.step=u.step,i.precision=String(i.step).search(/\.([0-9]+)$/)!=-1?String(i.step).match(/\.([0-9]+)$/)[1].length:0,i.maxStep=i.step*2,a(i.inp.id),n[i.inp.id]=new ut(i)}return!0},g=function(n){return{min:+(r(n,"min")||0),max:+(r(n,"max")||100),step:+(r(n,"step").search(b)!=-1?n.getAttribute("step"):1)}},a=function(t){return t in n&&n.hasOwnProperty(t)?(n[t].destroy(),delete n[t],!0):!1},tt=function(){for(var i in n)n.hasOwnProperty(i)&&n[i].destroy();n=[]},at=function(){tt(),n=null},d=function(){for(var i in n)n.hasOwnProperty(i)&&n[i].onResize()},et=function(){for(var t in n)n.hasOwnProperty(t)&&n[t].rescan()},ht=function(){nt(),l()},nt=function(){i(window,"load",l)};t(window,"load",l),t(window,"load",function(){setTimeout(function(){var t;for(t in n)n[t].checkValue()},0)}),t(window,"resize",d),t(window,"unload",at),(function(){var t=document.getElementsByTagName("script"),n=ot(String(t[t.length-1].innerHTML).replace(/[\n\r\s\t]+/g," ").replace(/^\s+/,"").replace(/\s+$/,""));typeof n!="object"||"err"in n||it(n)})();/*@if(@_jscript_version<9)f(document.documentElement,"oldie");@end@*/return{rescanDocument:l,createSlider:function(n){return vt(n)},onDomReady:function(){ht()},destroyAll:function(){tt()},destroySlider:function(n){return a(n)},redrawAll:function(){d()},addEvent:t,removeEvent:i,stopEvent:k,increment:function(t,i){if(!e(t))return!1;n[t].increment(i)},stepUp:function(t,i){if(!e(t))return!1;n[t].stepUp(Math.abs(i)||1)},stepDown:function(t,i){if(!e(t))return!1;n[t].stepDown(-Math.abs(i)||-1)},setRange:function(t,i,r){if(!e(t))return!1;n[t].setRange(i,r)},updateSlider:function(t){if(!e(t))return!1;n[t].onResize(),n[t].reset()},disable:function(t){if(!e(t))return!1;n[t].disable()},enable:function(t){if(!e(t))return!1;n[t].enable()},getValueSet:function(){return ct()},setValueSet:function(n,t){if(!e(id))return!1;st(n,t)},setGlobalVariables:function(n){it(n)},removeOnload:function(){nt()},rescanAttributes:et}}()
\ No newline at end of file
diff --git a/src/resources/js/gauge.min.js b/src/resources/js/gauge.min.js
new file mode 100644 (file)
index 0000000..733d502
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q={}.hasOwnProperty,r=function(a,b){function c(){this.constructor=a}for(var d in b)q.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};!function(){var a,b,c,d,e,f,g;for(g=["ms","moz","webkit","o"],c=0,e=g.length;e>c&&(f=g[c],!window.requestAnimationFrame);c++)window.requestAnimationFrame=window[f+"RequestAnimationFrame"],window.cancelAnimationFrame=window[f+"CancelAnimationFrame"]||window[f+"CancelRequestAnimationFrame"];return a=null,d=0,b={},requestAnimationFrame?window.cancelAnimationFrame?void 0:(a=window.requestAnimationFrame,window.requestAnimationFrame=function(c,e){var f;return f=++d,a(function(){return b[f]?void 0:c()},e),f},window.cancelAnimationFrame=function(a){return b[a]=!0}):(window.requestAnimationFrame=function(a,b){var c,d,e,f;return c=(new Date).getTime(),f=Math.max(0,16-(c-e)),d=window.setTimeout(function(){return a(c+f)},f),e=c+f,d},window.cancelAnimationFrame=function(a){return clearTimeout(a)})}(),String.prototype.hashCode=function(){var a,b,c,d,e;if(b=0,0===this.length)return b;for(c=d=0,e=this.length;e>=0?e>d:d>e;c=e>=0?++d:--d)a=this.charCodeAt(c),b=(b<<5)-b+a,b&=b;return b},o=function(a){var b,c;for(b=Math.floor(a/3600),c=Math.floor((a-3600*b)/60),a-=3600*b+60*c,a+="",c+="";c.length<2;)c="0"+c;for(;a.length<2;)a="0"+a;return b=b?b+":":"",b+c+":"+a},m=function(a){return k(a.toFixed(0))},p=function(a,b){var c,d;for(c in b)q.call(b,c)&&(d=b[c],a[c]=d);return a},n=function(a,b){var c,d,e;d={};for(c in a)q.call(a,c)&&(e=a[c],d[c]=e);for(c in b)q.call(b,c)&&(e=b[c],d[c]=e);return d},k=function(a){var b,c,d,e;for(a+="",c=a.split("."),d=c[0],e="",c.length>1&&(e="."+c[1]),b=/(\d+)(\d{3})/;b.test(d);)d=d.replace(b,"$1,$2");return d+e},l=function(a){return"#"===a.charAt(0)?a.substring(1,7):a},j=function(){function a(a,b){null==a&&(a=!0),this.clear=null!=b?b:!0,a&&AnimationUpdater.add(this)}return a.prototype.animationSpeed=32,a.prototype.update=function(a){var b;return null==a&&(a=!1),a||this.displayedValue!==this.value?(this.ctx&&this.clear&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),b=this.value-this.displayedValue,Math.abs(b/this.animationSpeed)<=.001?this.displayedValue=this.value:this.displayedValue=this.displayedValue+b/this.animationSpeed,this.render(),!0):!1},a}(),e=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return r(b,a),b.prototype.displayScale=1,b.prototype.setTextField=function(a){return this.textField=a instanceof i?a:new i(a)},b.prototype.setMinValue=function(a,b){var c,d,e,f,g;if(this.minValue=a,null==b&&(b=!0),b){for(this.displayedValue=this.minValue,f=this.gp||[],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.displayedValue=this.minValue);return g}},b.prototype.setOptions=function(a){return null==a&&(a=null),this.options=n(this.options,a),this.textField&&(this.textField.el.style.fontSize=a.fontSize+"px"),this.options.angle>.5&&(this.gauge.options.angle=.5),this.configDisplayScale(),this},b.prototype.configDisplayScale=function(){var a,b,c,d,e;return d=this.displayScale,this.options.highDpiSupport===!1?delete this.displayScale:(b=window.devicePixelRatio||1,a=this.ctx.webkitBackingStorePixelRatio||this.ctx.mozBackingStorePixelRatio||this.ctx.msBackingStorePixelRatio||this.ctx.oBackingStorePixelRatio||this.ctx.backingStorePixelRatio||1,this.displayScale=b/a),this.displayScale!==d&&(e=this.canvas.G__width||this.canvas.width,c=this.canvas.G__height||this.canvas.height,this.canvas.width=e*this.displayScale,this.canvas.height=c*this.displayScale,this.canvas.style.width=e+"px",this.canvas.style.height=c+"px",this.canvas.G__width=e,this.canvas.G__height=c),this},b}(j),i=function(){function a(a){this.el=a}return a.prototype.render=function(a){return this.el.innerHTML=m(a.displayedValue)},a}(),a=function(a){function b(a,b){this.elem=a,this.text=null!=b?b:!1,this.value=1*this.elem.innerHTML,this.text&&(this.value=0)}return r(b,a),b.prototype.displayedValue=0,b.prototype.value=0,b.prototype.setVal=function(a){return this.value=1*a},b.prototype.render=function(){var a;return a=this.text?o(this.displayedValue.toFixed(0)):k(m(this.displayedValue)),this.elem.innerHTML=a},b}(j),b={create:function(b){var c,d,e,f;for(f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(new a(c));return f}},h=function(a){function b(a){this.gauge=a,this.ctx=this.gauge.ctx,this.canvas=this.gauge.canvas,b.__super__.constructor.call(this,!1,!1),this.setOptions()}return r(b,a),b.prototype.displayedValue=0,b.prototype.value=0,b.prototype.options={strokeWidth:.035,length:.1,color:"#000000"},b.prototype.setOptions=function(a){return null==a&&(a=null),p(this.options,a),this.length=this.canvas.height*this.options.length,this.strokeWidth=this.canvas.height*this.options.strokeWidth,this.maxValue=this.gauge.maxValue,this.minValue=this.gauge.minValue,this.animationSpeed=this.gauge.animationSpeed,this.options.angle=this.gauge.options.angle},b.prototype.render=function(){var a,b,c,d,e,f,g,h,i;return a=this.gauge.getAngle.call(this,this.displayedValue),b=this.canvas.width/2,c=.9*this.canvas.height,h=Math.round(b+this.length*Math.cos(a)),i=Math.round(c+this.length*Math.sin(a)),f=Math.round(b+this.strokeWidth*Math.cos(a-Math.PI/2)),g=Math.round(c+this.strokeWidth*Math.sin(a-Math.PI/2)),d=Math.round(b+this.strokeWidth*Math.cos(a+Math.PI/2)),e=Math.round(c+this.strokeWidth*Math.sin(a+Math.PI/2)),this.ctx.fillStyle=this.options.color,this.ctx.beginPath(),this.ctx.arc(b,c,this.strokeWidth,0,2*Math.PI,!0),this.ctx.fill(),this.ctx.beginPath(),this.ctx.moveTo(f,g),this.ctx.lineTo(h,i),this.ctx.lineTo(d,e),this.ctx.fill()},b}(j),c=function(){function a(a){this.elem=a}return a.prototype.updateValues=function(a){return this.value=a[0],this.maxValue=a[1],this.avgValue=a[2],this.render()},a.prototype.render=function(){var a,b;return this.textField&&this.textField.text(m(this.value)),0===this.maxValue&&(this.maxValue=2*this.avgValue),b=this.value/this.maxValue*100,a=this.avgValue/this.maxValue*100,$(".bar-value",this.elem).css({width:b+"%"}),$(".typical-value",this.elem).css({width:a+"%"})},a}(),g=function(a){function b(a){this.canvas=a,b.__super__.constructor.call(this),this.percentColors=null,"undefined"!=typeof G_vmlCanvasManager&&(this.canvas=window.G_vmlCanvasManager.initElement(this.canvas)),this.ctx=this.canvas.getContext("2d"),this.gp=[new h(this)],this.setOptions(),this.render()}return r(b,a),b.prototype.elem=null,b.prototype.value=[20],b.prototype.maxValue=80,b.prototype.minValue=0,b.prototype.displayedAngle=0,b.prototype.displayedValue=0,b.prototype.lineWidth=40,b.prototype.paddingBottom=.1,b.prototype.percentColors=null,b.prototype.options={colorStart:"#6fadcf",colorStop:void 0,gradientType:0,strokeColor:"#e0e0e0",pointer:{length:.8,strokeWidth:.035},angle:.15,lineWidth:.44,fontSize:40,limitMax:!1},b.prototype.setOptions=function(a){var c,d,e,f;for(null==a&&(a=null),b.__super__.setOptions.call(this,a),this.configPercentColors(),this.lineWidth=this.canvas.height*(1-this.paddingBottom)*this.options.lineWidth,this.radius=this.canvas.height*(1-this.paddingBottom)-this.lineWidth,this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.render(),f=this.gp,d=0,e=f.length;e>d;d++)c=f[d],c.setOptions(this.options.pointer),c.render();return this},b.prototype.configPercentColors=function(){var a,b,c,d,e,f,g;if(this.percentColors=null,void 0!==this.options.percentColors){for(this.percentColors=new Array,f=[],c=d=0,e=this.options.percentColors.length-1;e>=0?e>=d:d>=e;c=e>=0?++d:--d)g=parseInt(l(this.options.percentColors[c][1]).substring(0,2),16),b=parseInt(l(this.options.percentColors[c][1]).substring(2,4),16),a=parseInt(l(this.options.percentColors[c][1]).substring(4,6),16),f.push(this.percentColors[c]={pct:this.options.percentColors[c][0],color:{r:g,g:b,b:a}});return f}},b.prototype.set=function(a){var b,c,d,e,f,g,i;if(a instanceof Array||(a=[a]),a.length>this.gp.length)for(b=c=0,g=a.length-this.gp.length;g>=0?g>c:c>g;b=g>=0?++c:--c)this.gp.push(new h(this));for(b=0,f=!1,d=0,e=a.length;e>d;d++)i=a[d],i>this.maxValue&&(this.maxValue=1.1*this.value,f=!0),this.gp[b].value=i,this.gp[b++].setOptions({maxValue:this.maxValue,angle:this.options.angle});return this.value=a[a.length-1],f&&this.options.limitMax?void 0:AnimationUpdater.run()},b.prototype.getAngle=function(a){return(1+this.options.angle)*Math.PI+(a-this.minValue)/(this.maxValue-this.minValue)*(1-2*this.options.angle)*Math.PI},b.prototype.getColorForPercentage=function(a,b){var c,d,e,f,g,h,i;if(0===a)c=this.percentColors[0].color;else for(c=this.percentColors[this.percentColors.length-1].color,e=f=0,h=this.percentColors.length-1;h>=0?h>=f:f>=h;e=h>=0?++f:--f)if(a<=this.percentColors[e].pct){b===!0?(i=this.percentColors[e-1],d=this.percentColors[e],g=(a-i.pct)/(d.pct-i.pct),c={r:Math.floor(i.color.r*(1-g)+d.color.r*g),g:Math.floor(i.color.g*(1-g)+d.color.g*g),b:Math.floor(i.color.b*(1-g)+d.color.b*g)}):c=this.percentColors[e].color;break}return"rgb("+[c.r,c.g,c.b].join(",")+")"},b.prototype.getColorForValue=function(a,b){var c;return c=(a-this.minValue)/(this.maxValue-this.minValue),this.getColorForPercentage(c,b)},b.prototype.render=function(){var a,b,c,d,e,f,g,h,i;for(i=this.canvas.width/2,d=this.canvas.height*(1-this.paddingBottom),a=this.getAngle(this.displayedValue),this.textField&&this.textField.render(this),this.ctx.lineCap="butt",void 0!==this.options.customFillStyle?b=this.options.customFillStyle(this):null!==this.percentColors?b=this.getColorForValue(this.displayedValue,!0):void 0!==this.options.colorStop?(b=0===this.options.gradientType?this.ctx.createRadialGradient(i,d,9,i,d,70):this.ctx.createLinearGradient(0,0,i,0),b.addColorStop(0,this.options.colorStart),b.addColorStop(1,this.options.colorStop)):b=this.options.colorStart,this.ctx.strokeStyle=b,this.ctx.beginPath(),this.ctx.arc(i,d,this.radius,(1+this.options.angle)*Math.PI,a,!1),this.ctx.lineWidth=this.lineWidth,this.ctx.stroke(),this.ctx.strokeStyle=this.options.strokeColor,this.ctx.beginPath(),this.ctx.arc(i,d,this.radius,a,(2-this.options.angle)*Math.PI,!1),this.ctx.stroke(),g=this.gp,h=[],e=0,f=g.length;f>e;e++)c=g[e],h.push(c.update(!0));return h},b}(e),d=function(a){function b(a){this.canvas=a,b.__super__.constructor.call(this),"undefined"!=typeof G_vmlCanvasManager&&(this.canvas=window.G_vmlCanvasManager.initElement(this.canvas)),this.ctx=this.canvas.getContext("2d"),this.setOptions(),this.render()}return r(b,a),b.prototype.lineWidth=15,b.prototype.displayedValue=0,b.prototype.value=33,b.prototype.maxValue=80,b.prototype.minValue=0,b.prototype.options={lineWidth:.1,colorStart:"#6f6ea0",colorStop:"#c0c0db",strokeColor:"#eeeeee",shadowColor:"#d5d5d5",angle:.35},b.prototype.getAngle=function(a){return(1-this.options.angle)*Math.PI+(a-this.minValue)/(this.maxValue-this.minValue)*(2+this.options.angle-(1-this.options.angle))*Math.PI},b.prototype.setOptions=function(a){return null==a&&(a=null),b.__super__.setOptions.call(this,a),this.lineWidth=this.canvas.height*this.options.lineWidth,this.radius=this.canvas.height/2-this.lineWidth/2,this},b.prototype.set=function(a){return this.value=a,this.value>this.maxValue&&(this.maxValue=1.1*this.value),AnimationUpdater.run()},b.prototype.render=function(){var a,b,c,d,e,f;return a=this.getAngle(this.displayedValue),f=this.canvas.width/2,c=this.canvas.height/2,this.textField&&this.textField.render(this),b=this.ctx.createRadialGradient(f,c,39,f,c,70),b.addColorStop(0,this.options.colorStart),b.addColorStop(1,this.options.colorStop),d=this.radius-this.lineWidth/2,e=this.radius+this.lineWidth/2,this.ctx.strokeStyle=this.options.strokeColor,this.ctx.beginPath(),this.ctx.arc(f,c,this.radius,(1-this.options.angle)*Math.PI,(2+this.options.angle)*Math.PI,!1),this.ctx.lineWidth=this.lineWidth,this.ctx.lineCap="round",this.ctx.stroke(),this.ctx.strokeStyle=b,this.ctx.beginPath(),this.ctx.arc(f,c,this.radius,(1-this.options.angle)*Math.PI,a,!1),this.ctx.stroke()},b}(e),f=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return r(b,a),b.prototype.strokeGradient=function(a,b,c,d){var e;return e=this.ctx.createRadialGradient(a,b,c,a,b,d),e.addColorStop(0,this.options.shadowColor),e.addColorStop(.12,this.options._orgStrokeColor),e.addColorStop(.88,this.options._orgStrokeColor),e.addColorStop(1,this.options.shadowColor),e},b.prototype.setOptions=function(a){var c,d,e,f;return null==a&&(a=null),b.__super__.setOptions.call(this,a),f=this.canvas.width/2,c=this.canvas.height/2,d=this.radius-this.lineWidth/2,e=this.radius+this.lineWidth/2,this.options._orgStrokeColor=this.options.strokeColor,this.options.strokeColor=this.strokeGradient(f,c,d,e),this},b}(d),window.AnimationUpdater={elements:[],animId:null,addAll:function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(AnimationUpdater.elements.push(b));return e},add:function(a){return AnimationUpdater.elements.push(a)},run:function(){var a,b,c,d,e;for(a=!0,e=AnimationUpdater.elements,c=0,d=e.length;d>c;c++)b=e[c],b.update()&&(a=!1);return a?cancelAnimationFrame(AnimationUpdater.animId):AnimationUpdater.animId=requestAnimationFrame(AnimationUpdater.run)}},"function"==typeof window.define&&null!=window.define.amd?define(function(){return{Gauge:g,Donut:f,BaseDonut:d,TextRenderer:i}}):"undefined"!=typeof module&&null!=module.exports?module.exports={Gauge:g,Donut:f,BaseDonut:d,TextRenderer:i}:(window.Gauge=g,window.Donut=f,window.BaseDonut=d,window.TextRenderer=i)}).call(this);
\ No newline at end of file
diff --git a/src/resources/js/socket.io.js b/src/resources/js/socket.io.js
new file mode 100644 (file)
index 0000000..e43c4ad
--- /dev/null
@@ -0,0 +1,3 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.io=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){module.exports=_dereq_("./lib/")},{"./lib/":2}],2:[function(_dereq_,module,exports){var url=_dereq_("./url");var parser=_dereq_("socket.io-parser");var Manager=_dereq_("./manager");var debug=_dereq_("debug")("socket.io-client");module.exports=exports=lookup;var cache=exports.managers={};function lookup(uri,opts){if(typeof uri=="object"){opts=uri;uri=undefined}opts=opts||{};var parsed=url(uri);var source=parsed.source;var id=parsed.id;var io;if(opts.forceNew||opts["force new connection"]||false===opts.multiplex){debug("ignoring socket cache for %s",source);io=Manager(source,opts)}else{if(!cache[id]){debug("new io instance for %s",source);cache[id]=Manager(source,opts)}io=cache[id]}return io.socket(parsed.path)}exports.protocol=parser.protocol;exports.connect=lookup;exports.Manager=_dereq_("./manager");exports.Socket=_dereq_("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(_dereq_,module,exports){var url=_dereq_("./url");var eio=_dereq_("engine.io-client");var Socket=_dereq_("./socket");var Emitter=_dereq_("component-emitter");var parser=_dereq_("socket.io-parser");var on=_dereq_("./on");var bind=_dereq_("component-bind");var object=_dereq_("object-component");var debug=_dereq_("debug")("socket.io-client:manager");var indexOf=_dereq_("indexof");var Backoff=_dereq_("backo2");module.exports=Manager;function Manager(uri,opts){if(!(this instanceof Manager))return new Manager(uri,opts);if(uri&&"object"==typeof uri){opts=uri;uri=undefined}opts=opts||{};opts.path=opts.path||"/socket.io";this.nsps={};this.subs=[];this.opts=opts;this.reconnection(opts.reconnection!==false);this.reconnectionAttempts(opts.reconnectionAttempts||Infinity);this.reconnectionDelay(opts.reconnectionDelay||1e3);this.reconnectionDelayMax(opts.reconnectionDelayMax||5e3);this.randomizationFactor(opts.randomizationFactor||.5);this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()});this.timeout(null==opts.timeout?2e4:opts.timeout);this.readyState="closed";this.uri=uri;this.connected=[];this.encoding=false;this.packetBuffer=[];this.encoder=new parser.Encoder;this.decoder=new parser.Decoder;this.autoConnect=opts.autoConnect!==false;if(this.autoConnect)this.open()}Manager.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var nsp in this.nsps){this.nsps[nsp].emit.apply(this.nsps[nsp],arguments)}};Manager.prototype.updateSocketIds=function(){for(var nsp in this.nsps){this.nsps[nsp].id=this.engine.id}};Emitter(Manager.prototype);Manager.prototype.reconnection=function(v){if(!arguments.length)return this._reconnection;this._reconnection=!!v;return this};Manager.prototype.reconnectionAttempts=function(v){if(!arguments.length)return this._reconnectionAttempts;this._reconnectionAttempts=v;return this};Manager.prototype.reconnectionDelay=function(v){if(!arguments.length)return this._reconnectionDelay;this._reconnectionDelay=v;this.backoff&&this.backoff.setMin(v);return this};Manager.prototype.randomizationFactor=function(v){if(!arguments.length)return this._randomizationFactor;this._randomizationFactor=v;this.backoff&&this.backoff.setJitter(v);return this};Manager.prototype.reconnectionDelayMax=function(v){if(!arguments.length)return this._reconnectionDelayMax;this._reconnectionDelayMax=v;this.backoff&&this.backoff.setMax(v);return this};Manager.prototype.timeout=function(v){if(!arguments.length)return this._timeout;this._timeout=v;return this};Manager.prototype.maybeReconnectOnOpen=function(){if(!this.reconnecting&&this._reconnection&&this.backoff.attempts===0){this.reconnect()}};Manager.prototype.open=Manager.prototype.connect=function(fn){debug("readyState %s",this.readyState);if(~this.readyState.indexOf("open"))return this;debug("opening %s",this.uri);this.engine=eio(this.uri,this.opts);var socket=this.engine;var self=this;this.readyState="opening";this.skipReconnect=false;var openSub=on(socket,"open",function(){self.onopen();fn&&fn()});var errorSub=on(socket,"error",function(data){debug("connect_error");self.cleanup();self.readyState="closed";self.emitAll("connect_error",data);if(fn){var err=new Error("Connection error");err.data=data;fn(err)}else{self.maybeReconnectOnOpen()}});if(false!==this._timeout){var timeout=this._timeout;debug("connect attempt will timeout after %d",timeout);var timer=setTimeout(function(){debug("connect attempt timed out after %d",timeout);openSub.destroy();socket.close();socket.emit("error","timeout");self.emitAll("connect_timeout",timeout)},timeout);this.subs.push({destroy:function(){clearTimeout(timer)}})}this.subs.push(openSub);this.subs.push(errorSub);return this};Manager.prototype.onopen=function(){debug("open");this.cleanup();this.readyState="open";this.emit("open");var socket=this.engine;this.subs.push(on(socket,"data",bind(this,"ondata")));this.subs.push(on(this.decoder,"decoded",bind(this,"ondecoded")));this.subs.push(on(socket,"error",bind(this,"onerror")));this.subs.push(on(socket,"close",bind(this,"onclose")))};Manager.prototype.ondata=function(data){this.decoder.add(data)};Manager.prototype.ondecoded=function(packet){this.emit("packet",packet)};Manager.prototype.onerror=function(err){debug("error",err);this.emitAll("error",err)};Manager.prototype.socket=function(nsp){var socket=this.nsps[nsp];if(!socket){socket=new Socket(this,nsp);this.nsps[nsp]=socket;var self=this;socket.on("connect",function(){socket.id=self.engine.id;if(!~indexOf(self.connected,socket)){self.connected.push(socket)}})}return socket};Manager.prototype.destroy=function(socket){var index=indexOf(this.connected,socket);if(~index)this.connected.splice(index,1);if(this.connected.length)return;this.close()};Manager.prototype.packet=function(packet){debug("writing packet %j",packet);var self=this;if(!self.encoding){self.encoding=true;this.encoder.encode(packet,function(encodedPackets){for(var i=0;i<encodedPackets.length;i++){self.engine.write(encodedPackets[i])}self.encoding=false;self.processPacketQueue()})}else{self.packetBuffer.push(packet)}};Manager.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var pack=this.packetBuffer.shift();this.packet(pack)}};Manager.prototype.cleanup=function(){var sub;while(sub=this.subs.shift())sub.destroy();this.packetBuffer=[];this.encoding=false;this.decoder.destroy()};Manager.prototype.close=Manager.prototype.disconnect=function(){this.skipReconnect=true;this.backoff.reset();this.readyState="closed";this.engine&&this.engine.close()};Manager.prototype.onclose=function(reason){debug("close");this.cleanup();this.backoff.reset();this.readyState="closed";this.emit("close",reason);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};Manager.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var self=this;if(this.backoff.attempts>=this._reconnectionAttempts){debug("reconnect failed");this.backoff.reset();this.emitAll("reconnect_failed");this.reconnecting=false}else{var delay=this.backoff.duration();debug("will wait %dms before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout(function(){if(self.skipReconnect)return;debug("attempting reconnect");self.emitAll("reconnect_attempt",self.backoff.attempts);self.emitAll("reconnecting",self.backoff.attempts);if(self.skipReconnect)return;self.open(function(err){if(err){debug("reconnect attempt error");self.reconnecting=false;self.reconnect();self.emitAll("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}})},delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.backoff.attempts;this.reconnecting=false;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",attempt)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(_dereq_,module,exports){module.exports=on;function on(obj,ev,fn){obj.on(ev,fn);return{destroy:function(){obj.removeListener(ev,fn)}}}},{}],5:[function(_dereq_,module,exports){var parser=_dereq_("socket.io-parser");var Emitter=_dereq_("component-emitter");var toArray=_dereq_("to-array");var on=_dereq_("./on");var bind=_dereq_("component-bind");var debug=_dereq_("debug")("socket.io-client:socket");var hasBin=_dereq_("has-binary");module.exports=exports=Socket;var events={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1};var emit=Emitter.prototype.emit;function Socket(io,nsp){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};if(this.io.autoConnect)this.open();this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true}Emitter(Socket.prototype);Socket.prototype.subEvents=function(){if(this.subs)return;var io=this.io;this.subs=[on(io,"open",bind(this,"onopen")),on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose"))]};Socket.prototype.open=Socket.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();return this};Socket.prototype.send=function(){var args=toArray(arguments);args.unshift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(events.hasOwnProperty(ev)){emit.apply(this,arguments);return this}var args=toArray(arguments);var parserType=parser.EVENT;if(hasBin(args)){parserType=parser.BINARY_EVENT}var packet={type:parserType,data:args};if("function"==typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}if(this.connected){this.packet(packet)}else{this.sendBuffer.push(packet)}return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.packet(packet)};Socket.prototype.onopen=function(){debug("transport is open - connecting");if("/"!=this.nsp){this.packet({type:parser.CONNECT})}};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.connected=false;this.disconnected=true;delete this.id;this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){if(packet.nsp!=this.nsp)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.BINARY_EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.BINARY_ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(null!=packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.receiveBuffer.push(args)}};Socket.prototype.ack=function(id){var self=this;var sent=false;return function(){if(sent)return;sent=true;var args=toArray(arguments);debug("sending ack %j",args);var type=hasBin(args)?parser.BINARY_ACK:parser.ACK;self.packet({type:type,id:id,data:args})}};Socket.prototype.onack=function(packet){debug("calling ack %s with %j",packet.id,packet.data);var fn=this.acks[packet.id];fn.apply(this,packet.data);delete this.acks[packet.id]};Socket.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};Socket.prototype.emitBuffered=function(){var i;for(i=0;i<this.receiveBuffer.length;i++){emit.apply(this,this.receiveBuffer[i])}this.receiveBuffer=[];for(i=0;i<this.sendBuffer.length;i++){this.packet(this.sendBuffer[i])}this.sendBuffer=[]};Socket.prototype.ondisconnect=function(){debug("server disconnect (%s)",this.nsp);this.destroy();this.onclose("io server disconnect")};Socket.prototype.destroy=function(){if(this.subs){for(var i=0;i<this.subs.length;i++){this.subs[i].destroy()}this.subs=null}this.io.destroy(this)};Socket.prototype.close=Socket.prototype.disconnect=function(){if(this.connected){debug("performing disconnect (%s)",this.nsp);this.packet({type:parser.DISCONNECT})}this.destroy();if(this.connected){this.onclose("io client disconnect")}return this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(_dereq_,module,exports){(function(global){var parseuri=_dereq_("parseuri");var debug=_dereq_("debug")("socket.io-client:url");module.exports=url;function url(uri,loc){var obj=uri;var loc=loc||global.location;if(null==uri)uri=loc.protocol+"//"+loc.host;if("string"==typeof uri){if("/"==uri.charAt(0)){if("/"==uri.charAt(1)){uri=loc.protocol+uri}else{uri=loc.hostname+uri}}if(!/^(https?|wss?):\/\//.test(uri)){debug("protocol-less url %s",uri);if("undefined"!=typeof loc){uri=loc.protocol+"//"+uri}else{uri="https://"+uri}}debug("parse %s",uri);obj=parseuri(uri)}if(!obj.port){if(/^(http|ws)$/.test(obj.protocol)){obj.port="80"}else if(/^(http|ws)s$/.test(obj.protocol)){obj.port="443"}}obj.path=obj.path||"/";obj.id=obj.protocol+"://"+obj.host+":"+obj.port;obj.href=obj.protocol+"://"+obj.host+(loc&&loc.port==obj.port?"":":"+obj.port);return obj}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{debug:10,parseuri:42}],7:[function(_dereq_,module,exports){module.exports=Backoff;function Backoff(opts){opts=opts||{};this.ms=opts.min||100;this.max=opts.max||1e4;this.factor=opts.factor||2;this.jitter=opts.jitter>0&&opts.jitter<=1?opts.jitter:0;this.attempts=0}Backoff.prototype.duration=function(){var ms=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var rand=Math.random();var deviation=Math.floor(rand*this.jitter*ms);ms=(Math.floor(rand*10)&1)==0?ms-deviation:ms+deviation}return Math.min(ms,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(min){this.ms=min};Backoff.prototype.setMax=function(max){this.max=max};Backoff.prototype.setJitter=function(jitter){this.jitter=jitter}},{}],8:[function(_dereq_,module,exports){var slice=[].slice;module.exports=function(obj,fn){if("string"==typeof fn)fn=obj[fn];if("function"!=typeof fn)throw new Error("bind() requires a function");var args=slice.call(arguments,2);return function(){return fn.apply(obj,args.concat(slice.call(arguments)))}}},{}],9:[function(_dereq_,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){var self=this;this._callbacks=this._callbacks||{};function on(){self.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks[event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks[event];return this}var cb;for(var i=0;i<callbacks.length;i++){cb=callbacks[i];if(cb===fn||cb.fn===fn){callbacks.splice(i,1);break}}return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=[].slice.call(arguments,1),callbacks=this._callbacks[event];if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i<len;++i){callbacks[i].apply(this,args)}}return this};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks[event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],10:[function(_dereq_,module,exports){module.exports=debug;function debug(name){if(!debug.enabled(name))return function(){};return function(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(debug[name]||curr);debug[name]=curr;fmt=name+" "+fmt+" +"+debug.humanize(ms);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];debug.enable=function(name){try{localStorage.debug=name}catch(e){}var split=(name||"").split(/[\s,]+/),len=split.length;for(var i=0;i<len;i++){name=split[i].replace("*",".*?");if(name[0]==="-"){debug.skips.push(new RegExp("^"+name.substr(1)+"$"))}else{debug.names.push(new RegExp("^"+name+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i<len;i++){if(debug.skips[i].test(name)){return false}}for(var i=0,len=debug.names.length;i<len;i++){if(debug.names[i].test(name)){return true}}return false};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],11:[function(_dereq_,module,exports){module.exports=_dereq_("./lib/")},{"./lib/":12}],12:[function(_dereq_,module,exports){module.exports=_dereq_("./socket");module.exports.parser=_dereq_("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(_dereq_,module,exports){(function(global){var transports=_dereq_("./transports");var Emitter=_dereq_("component-emitter");var debug=_dereq_("debug")("engine.io-client:socket");var index=_dereq_("indexof");var parser=_dereq_("engine.io-parser");var parseuri=_dereq_("parseuri");var parsejson=_dereq_("parsejson");var parseqs=_dereq_("parseqs");module.exports=Socket;function noop(){}function Socket(uri,opts){if(!(this instanceof Socket))return new Socket(uri,opts);opts=opts||{};if(uri&&"object"==typeof uri){opts=uri;uri=null}if(uri){uri=parseuri(uri);opts.host=uri.host;opts.secure=uri.protocol=="https"||uri.protocol=="wss";opts.port=uri.port;if(uri.query)opts.query=uri.query}this.secure=null!=opts.secure?opts.secure:global.location&&"https:"==location.protocol;if(opts.host){var pieces=opts.host.split(":");opts.hostname=pieces.shift();if(pieces.length){opts.port=pieces.pop()}else if(!opts.port){opts.port=this.secure?"443":"80"}}this.agent=opts.agent||false;this.hostname=opts.hostname||(global.location?location.hostname:"localhost");this.port=opts.port||(global.location&&location.port?location.port:this.secure?443:80);this.query=opts.query||{};if("string"==typeof this.query)this.query=parseqs.decode(this.query);this.upgrade=false!==opts.upgrade;this.path=(opts.path||"/engine.io").replace(/\/$/,"")+"/";this.forceJSONP=!!opts.forceJSONP;this.jsonp=false!==opts.jsonp;this.forceBase64=!!opts.forceBase64;this.enablesXDR=!!opts.enablesXDR;this.timestampParam=opts.timestampParam||"t";this.timestampRequests=opts.timestampRequests;this.transports=opts.transports||["polling","websocket"];this.readyState="";this.writeBuffer=[];this.callbackBuffer=[];this.policyPort=opts.policyPort||843;this.rememberUpgrade=opts.rememberUpgrade||false;this.binaryType=null;this.onlyBinaryUpgrades=opts.onlyBinaryUpgrades;this.pfx=opts.pfx||null;this.key=opts.key||null;this.passphrase=opts.passphrase||null;this.cert=opts.cert||null;this.ca=opts.ca||null;this.ciphers=opts.ciphers||null;this.rejectUnauthorized=opts.rejectUnauthorized||null;this.open()}Socket.priorWebsocketSuccess=false;Emitter(Socket.prototype);Socket.protocol=parser.protocol;Socket.Socket=Socket;Socket.Transport=_dereq_("./transport");Socket.transports=_dereq_("./transports");Socket.parser=_dereq_("engine.io-parser");Socket.prototype.createTransport=function(name){debug('creating transport "%s"',name);var query=clone(this.query);query.EIO=parser.protocol;query.transport=name;if(this.id)query.sid=this.id;var transport=new transports[name]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:query,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return transport};function clone(obj){var o={};for(var i in obj){if(obj.hasOwnProperty(i)){o[i]=obj[i]}}return o}Socket.prototype.open=function(){var transport;if(this.rememberUpgrade&&Socket.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1){transport="websocket"}else if(0==this.transports.length){var self=this;setTimeout(function(){self.emit("error","No transports available")},0);return}else{transport=this.transports[0]}this.readyState="opening";var transport;try{transport=this.createTransport(transport)}catch(e){this.transports.shift();this.open();return}transport.open();this.setTransport(transport)};Socket.prototype.setTransport=function(transport){debug("setting transport %s",transport.name);var self=this;if(this.transport){debug("clearing existing transport %s",this.transport.name);this.transport.removeAllListeners()}this.transport=transport;transport.on("drain",function(){self.onDrain()}).on("packet",function(packet){self.onPacket(packet)}).on("error",function(e){self.onError(e)}).on("close",function(){self.onClose("transport close")})};Socket.prototype.probe=function(name){debug('probing transport "%s"',name);var transport=this.createTransport(name,{probe:1}),failed=false,self=this;Socket.priorWebsocketSuccess=false;function onTransportOpen(){if(self.onlyBinaryUpgrades){var upgradeLosesBinary=!this.supportsBinary&&self.transport.supportsBinary;failed=failed||upgradeLosesBinary}if(failed)return;debug('probe transport "%s" opened',name);transport.send([{type:"ping",data:"probe"}]);transport.once("packet",function(msg){if(failed)return;if("pong"==msg.type&&"probe"==msg.data){debug('probe transport "%s" pong',name);self.upgrading=true;self.emit("upgrading",transport);if(!transport)return;Socket.priorWebsocketSuccess="websocket"==transport.name;debug('pausing current transport "%s"',self.transport.name);self.transport.pause(function(){if(failed)return;if("closed"==self.readyState)return;debug("changing transport and sending upgrade packet");cleanup();self.setTransport(transport);transport.send([{type:"upgrade"}]);self.emit("upgrade",transport);transport=null;self.upgrading=false;self.flush()})}else{debug('probe transport "%s" failed',name);var err=new Error("probe error");err.transport=transport.name;self.emit("upgradeError",err)}})}function freezeTransport(){if(failed)return;failed=true;cleanup();transport.close();transport=null}function onerror(err){var error=new Error("probe error: "+err);error.transport=transport.name;freezeTransport();debug('probe transport "%s" failed because of error: %s',name,err);self.emit("upgradeError",error)}function onTransportClose(){onerror("transport closed")}function onclose(){onerror("socket closed")}function onupgrade(to){if(transport&&to.name!=transport.name){debug('"%s" works - aborting "%s"',to.name,transport.name);freezeTransport()}}function cleanup(){transport.removeListener("open",onTransportOpen);transport.removeListener("error",onerror);transport.removeListener("close",onTransportClose);self.removeListener("close",onclose);self.removeListener("upgrading",onupgrade)}transport.once("open",onTransportOpen);transport.once("error",onerror);transport.once("close",onTransportClose);this.once("close",onclose);this.once("upgrading",onupgrade);transport.open()};Socket.prototype.onOpen=function(){debug("socket open");this.readyState="open";Socket.priorWebsocketSuccess="websocket"==this.transport.name;this.emit("open");this.flush();if("open"==this.readyState&&this.upgrade&&this.transport.pause){debug("starting upgrade probes");for(var i=0,l=this.upgrades.length;i<l;i++){this.probe(this.upgrades[i])}}};Socket.prototype.onPacket=function(packet){if("opening"==this.readyState||"open"==this.readyState){debug('socket receive: type "%s", data "%s"',packet.type,packet.data);this.emit("packet",packet);this.emit("heartbeat");switch(packet.type){case"open":this.onHandshake(parsejson(packet.data));break;case"pong":this.setPing();break;case"error":var err=new Error("server error");err.code=packet.data;this.emit("error",err);break;case"message":this.emit("data",packet.data);this.emit("message",packet.data);break}}else{debug('packet received with socket readyState "%s"',this.readyState)}};Socket.prototype.onHandshake=function(data){this.emit("handshake",data);this.id=data.sid;this.transport.query.sid=data.sid;this.upgrades=this.filterUpgrades(data.upgrades);this.pingInterval=data.pingInterval;this.pingTimeout=data.pingTimeout;this.onOpen();if("closed"==this.readyState)return;this.setPing();this.removeListener("heartbeat",this.onHeartbeat);this.on("heartbeat",this.onHeartbeat)};Socket.prototype.onHeartbeat=function(timeout){clearTimeout(this.pingTimeoutTimer);var self=this;self.pingTimeoutTimer=setTimeout(function(){if("closed"==self.readyState)return;self.onClose("ping timeout")},timeout||self.pingInterval+self.pingTimeout)};Socket.prototype.setPing=function(){var self=this;clearTimeout(self.pingIntervalTimer);self.pingIntervalTimer=setTimeout(function(){debug("writing ping packet - expecting pong within %sms",self.pingTimeout);self.ping();self.onHeartbeat(self.pingTimeout)},self.pingInterval)};Socket.prototype.ping=function(){this.sendPacket("ping")};Socket.prototype.onDrain=function(){for(var i=0;i<this.prevBufferLen;i++){if(this.callbackBuffer[i]){this.callbackBuffer[i]()}}this.writeBuffer.splice(0,this.prevBufferLen);this.callbackBuffer.splice(0,this.prevBufferLen);this.prevBufferLen=0;if(this.writeBuffer.length==0){this.emit("drain")}else{this.flush()}};Socket.prototype.flush=function(){if("closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){debug("flushing %d packets in socket",this.writeBuffer.length);this.transport.send(this.writeBuffer);this.prevBufferLen=this.writeBuffer.length;this.emit("flush")}};Socket.prototype.write=Socket.prototype.send=function(msg,fn){this.sendPacket("message",msg,fn);return this};Socket.prototype.sendPacket=function(type,data,fn){if("closing"==this.readyState||"closed"==this.readyState){return}var packet={type:type,data:data};this.emit("packetCreate",packet);this.writeBuffer.push(packet);this.callbackBuffer.push(fn);this.flush()};Socket.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState){this.readyState="closing";var self=this;function close(){self.onClose("forced close");debug("socket closing - telling transport to close");self.transport.close()}function cleanupAndClose(){self.removeListener("upgrade",cleanupAndClose);self.removeListener("upgradeError",cleanupAndClose);close()}function waitForUpgrade(){self.once("upgrade",cleanupAndClose);self.once("upgradeError",cleanupAndClose)}if(this.writeBuffer.length){this.once("drain",function(){if(this.upgrading){waitForUpgrade()}else{close()}})}else if(this.upgrading){waitForUpgrade()}else{close()}}return this};Socket.prototype.onError=function(err){debug("socket error %j",err);Socket.priorWebsocketSuccess=false;this.emit("error",err);this.onClose("transport error",err)};Socket.prototype.onClose=function(reason,desc){if("opening"==this.readyState||"open"==this.readyState||"closing"==this.readyState){debug('socket close with reason: "%s"',reason);var self=this;clearTimeout(this.pingIntervalTimer);clearTimeout(this.pingTimeoutTimer);setTimeout(function(){self.writeBuffer=[];self.callbackBuffer=[];self.prevBufferLen=0},0);this.transport.removeAllListeners("close");this.transport.close();this.transport.removeAllListeners();this.readyState="closed";this.id=null;this.emit("close",reason,desc)}};Socket.prototype.filterUpgrades=function(upgrades){var filteredUpgrades=[];for(var i=0,j=upgrades.length;i<j;i++){if(~index(this.transports,upgrades[i]))filteredUpgrades.push(upgrades[i])}return filteredUpgrades}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(_dereq_,module,exports){var parser=_dereq_("engine.io-parser");var Emitter=_dereq_("component-emitter");module.exports=Transport;function Transport(opts){this.path=opts.path;this.hostname=opts.hostname;this.port=opts.port;this.secure=opts.secure;this.query=opts.query;this.timestampParam=opts.timestampParam;this.timestampRequests=opts.timestampRequests;this.readyState="";this.agent=opts.agent||false;this.socket=opts.socket;this.enablesXDR=opts.enablesXDR;this.pfx=opts.pfx;this.key=opts.key;this.passphrase=opts.passphrase;this.cert=opts.cert;this.ca=opts.ca;this.ciphers=opts.ciphers;this.rejectUnauthorized=opts.rejectUnauthorized}Emitter(Transport.prototype);Transport.timestamps=0;Transport.prototype.onError=function(msg,desc){var err=new Error(msg);err.type="TransportError";err.description=desc;this.emit("error",err);return this};Transport.prototype.open=function(){if("closed"==this.readyState||""==this.readyState){this.readyState="opening";this.doOpen()}return this};Transport.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState){this.doClose();this.onClose()}return this};Transport.prototype.send=function(packets){if("open"==this.readyState){this.write(packets)}else{throw new Error("Transport not open")}};Transport.prototype.onOpen=function(){this.readyState="open";this.writable=true;this.emit("open")};Transport.prototype.onData=function(data){var packet=parser.decodePacket(data,this.socket.binaryType);this.onPacket(packet)};Transport.prototype.onPacket=function(packet){this.emit("packet",packet)};Transport.prototype.onClose=function(){this.readyState="closed";this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(_dereq_,module,exports){(function(global){var XMLHttpRequest=_dereq_("xmlhttprequest");var XHR=_dereq_("./polling-xhr");var JSONP=_dereq_("./polling-jsonp");var websocket=_dereq_("./websocket");exports.polling=polling;exports.websocket=websocket;function polling(opts){var xhr;var xd=false;var xs=false;var jsonp=false!==opts.jsonp;if(global.location){var isSSL="https:"==location.protocol;var port=location.port;if(!port){port=isSSL?443:80}xd=opts.hostname!=location.hostname||port!=opts.port;xs=opts.secure!=isSSL}opts.xdomain=xd;opts.xscheme=xs;xhr=new XMLHttpRequest(opts);if("open"in xhr&&!opts.forceJSONP){return new XHR(opts)}else{if(!jsonp)throw new Error("JSONP disabled");return new JSONP(opts)}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(_dereq_,module,exports){(function(global){var Polling=_dereq_("./polling");var inherit=_dereq_("component-inherit");module.exports=JSONPPolling;var rNewline=/\n/g;var rEscapedNewline=/\\n/g;var callbacks;var index=0;function empty(){}function JSONPPolling(opts){Polling.call(this,opts);
+this.query=this.query||{};if(!callbacks){if(!global.___eio)global.___eio=[];callbacks=global.___eio}this.index=callbacks.length;var self=this;callbacks.push(function(msg){self.onData(msg)});this.query.j=this.index;if(global.document&&global.addEventListener){global.addEventListener("beforeunload",function(){if(self.script)self.script.onerror=empty},false)}}inherit(JSONPPolling,Polling);JSONPPolling.prototype.supportsBinary=false;JSONPPolling.prototype.doClose=function(){if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}if(this.form){this.form.parentNode.removeChild(this.form);this.form=null;this.iframe=null}Polling.prototype.doClose.call(this)};JSONPPolling.prototype.doPoll=function(){var self=this;var script=document.createElement("script");if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}script.async=true;script.src=this.uri();script.onerror=function(e){self.onError("jsonp poll error",e)};var insertAt=document.getElementsByTagName("script")[0];insertAt.parentNode.insertBefore(script,insertAt);this.script=script;var isUAgecko="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);if(isUAgecko){setTimeout(function(){var iframe=document.createElement("iframe");document.body.appendChild(iframe);document.body.removeChild(iframe)},100)}};JSONPPolling.prototype.doWrite=function(data,fn){var self=this;if(!this.form){var form=document.createElement("form");var area=document.createElement("textarea");var id=this.iframeId="eio_iframe_"+this.index;var iframe;form.className="socketio";form.style.position="absolute";form.style.top="-1000px";form.style.left="-1000px";form.target=id;form.method="POST";form.setAttribute("accept-charset","utf-8");area.name="d";form.appendChild(area);document.body.appendChild(form);this.form=form;this.area=area}this.form.action=this.uri();function complete(){initIframe();fn()}function initIframe(){if(self.iframe){try{self.form.removeChild(self.iframe)}catch(e){self.onError("jsonp polling iframe removal error",e)}}try{var html='<iframe src="javascript:0" name="'+self.iframeId+'">';iframe=document.createElement(html)}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId;iframe.src="javascript:0"}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();data=data.replace(rEscapedNewline,"\\\n");this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(_dereq_,module,exports){(function(global){var XMLHttpRequest=_dereq_("xmlhttprequest");var Polling=_dereq_("./polling");var Emitter=_dereq_("component-emitter");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling-xhr");module.exports=XHR;module.exports.Request=Request;function empty(){}function XHR(opts){Polling.call(this,opts);if(global.location){var isSSL="https:"==location.protocol;var port=location.port;if(!port){port=isSSL?443:80}this.xd=opts.hostname!=global.location.hostname||port!=opts.port;this.xs=opts.secure!=isSSL}}inherit(XHR,Polling);XHR.prototype.supportsBinary=true;XHR.prototype.request=function(opts){opts=opts||{};opts.uri=this.uri();opts.xd=this.xd;opts.xs=this.xs;opts.agent=this.agent||false;opts.supportsBinary=this.supportsBinary;opts.enablesXDR=this.enablesXDR;opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;return new Request(opts)};XHR.prototype.doWrite=function(data,fn){var isBinary=typeof data!=="string"&&data!==undefined;var req=this.request({method:"POST",data:data,isBinary:isBinary});var self=this;req.on("success",fn);req.on("error",function(err){self.onError("xhr post error",err)});this.sendXhr=req};XHR.prototype.doPoll=function(){debug("xhr poll");var req=this.request();var self=this;req.on("data",function(data){self.onData(data)});req.on("error",function(err){self.onError("xhr poll error",err)});this.pollXhr=req};function Request(opts){this.method=opts.method||"GET";this.uri=opts.uri;this.xd=!!opts.xd;this.xs=!!opts.xs;this.async=false!==opts.async;this.data=undefined!=opts.data?opts.data:null;this.agent=opts.agent;this.isBinary=opts.isBinary;this.supportsBinary=opts.supportsBinary;this.enablesXDR=opts.enablesXDR;this.pfx=opts.pfx;this.key=opts.key;this.passphrase=opts.passphrase;this.cert=opts.cert;this.ca=opts.ca;this.ciphers=opts.ciphers;this.rejectUnauthorized=opts.rejectUnauthorized;this.create()}Emitter(Request.prototype);Request.prototype.create=function(){var opts={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;var xhr=this.xhr=new XMLHttpRequest(opts);var self=this;try{debug("xhr open %s: %s",this.method,this.uri);xhr.open(this.method,this.uri,this.async);if(this.supportsBinary){xhr.responseType="arraybuffer"}if("POST"==this.method){try{if(this.isBinary){xhr.setRequestHeader("Content-type","application/octet-stream")}else{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(e){}}if("withCredentials"in xhr){xhr.withCredentials=true}if(this.hasXDR()){xhr.onload=function(){self.onLoad()};xhr.onerror=function(){self.onError(xhr.responseText)}}else{xhr.onreadystatechange=function(){if(4!=xhr.readyState)return;if(200==xhr.status||1223==xhr.status){self.onLoad()}else{setTimeout(function(){self.onError(xhr.status)},0)}}}debug("xhr data %s",this.data);xhr.send(this.data)}catch(e){setTimeout(function(){self.onError(e)},0);return}if(global.document){this.index=Request.requestsCount++;Request.requests[this.index]=this}};Request.prototype.onSuccess=function(){this.emit("success");this.cleanup()};Request.prototype.onData=function(data){this.emit("data",data);this.onSuccess()};Request.prototype.onError=function(err){this.emit("error",err);this.cleanup(true)};Request.prototype.cleanup=function(fromError){if("undefined"==typeof this.xhr||null===this.xhr){return}if(this.hasXDR()){this.xhr.onload=this.xhr.onerror=empty}else{this.xhr.onreadystatechange=empty}if(fromError){try{this.xhr.abort()}catch(e){}}if(global.document){delete Request.requests[this.index]}this.xhr=null};Request.prototype.onLoad=function(){var data;try{var contentType;try{contentType=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(e){}if(contentType==="application/octet-stream"){data=this.xhr.response}else{if(!this.supportsBinary){data=this.xhr.responseText}else{data="ok"}}}catch(e){this.onError(e)}if(null!=data){this.onData(data)}};Request.prototype.hasXDR=function(){return"undefined"!==typeof global.XDomainRequest&&!this.xs&&this.enablesXDR};Request.prototype.abort=function(){this.cleanup()};if(global.document){Request.requestsCount=0;Request.requests={};if(global.attachEvent){global.attachEvent("onunload",unloadHandler)}else if(global.addEventListener){global.addEventListener("beforeunload",unloadHandler,false)}}function unloadHandler(){for(var i in Request.requests){if(Request.requests.hasOwnProperty(i)){Request.requests[i].abort()}}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(_dereq_,module,exports){var Transport=_dereq_("../transport");var parseqs=_dereq_("parseqs");var parser=_dereq_("engine.io-parser");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling");module.exports=Polling;var hasXHR2=function(){var XMLHttpRequest=_dereq_("xmlhttprequest");var xhr=new XMLHttpRequest({xdomain:false});return null!=xhr.responseType}();function Polling(opts){var forceBase64=opts&&opts.forceBase64;if(!hasXHR2||forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(Polling,Transport);Polling.prototype.name="polling";Polling.prototype.doOpen=function(){this.poll()};Polling.prototype.pause=function(onPause){var pending=0;var self=this;this.readyState="pausing";function pause(){debug("paused");self.readyState="paused";onPause()}if(this.polling||!this.writable){var total=0;if(this.polling){debug("we are currently polling - waiting to pause");total++;this.once("pollComplete",function(){debug("pre-pause polling complete");--total||pause()})}if(!this.writable){debug("we are currently writing - waiting to pause");total++;this.once("drain",function(){debug("pre-pause writing complete");--total||pause()})}}else{pause()}};Polling.prototype.poll=function(){debug("polling");this.polling=true;this.doPoll();this.emit("poll")};Polling.prototype.onData=function(data){var self=this;debug("polling got data %s",data);var callback=function(packet,index,total){if("opening"==self.readyState){self.onOpen()}if("close"==packet.type){self.onClose();return false}self.onPacket(packet)};parser.decodePayload(data,this.socket.binaryType,callback);if("closed"!=this.readyState){this.polling=false;this.emit("pollComplete");if("open"==this.readyState){this.poll()}else{debug('ignoring poll - transport state "%s"',this.readyState)}}};Polling.prototype.doClose=function(){var self=this;function close(){debug("writing close packet");self.write([{type:"close"}])}if("open"==this.readyState){debug("transport open - closing");close()}else{debug("transport not open - deferring close");this.once("open",close)}};Polling.prototype.write=function(packets){var self=this;this.writable=false;var callbackfn=function(){self.writable=true;self.emit("drain")};var self=this;parser.encodePayload(packets,this.supportsBinary,function(data){self.doWrite(data,callbackfn)})};Polling.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"https":"http";var port="";if(false!==this.timestampRequests){query[this.timestampParam]=+new Date+"-"+Transport.timestamps++}if(!this.supportsBinary&&!query.sid){query.b64=1}query=parseqs.encode(query);if(this.port&&("https"==schema&&this.port!=443||"http"==schema&&this.port!=80)){port=":"+this.port}if(query.length){query="?"+query}return schema+"://"+this.hostname+port+this.path+query}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(_dereq_,module,exports){var Transport=_dereq_("../transport");var parser=_dereq_("engine.io-parser");var parseqs=_dereq_("parseqs");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:websocket");var WebSocket=_dereq_("ws");module.exports=WS;function WS(opts){var forceBase64=opts&&opts.forceBase64;if(forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(WS,Transport);WS.prototype.name="websocket";WS.prototype.supportsBinary=true;WS.prototype.doOpen=function(){if(!this.check()){return}var self=this;var uri=this.uri();var protocols=void 0;var opts={agent:this.agent};opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;this.ws=new WebSocket(uri,protocols,opts);if(this.ws.binaryType===undefined){this.supportsBinary=false}this.ws.binaryType="arraybuffer";this.addEventListeners()};WS.prototype.addEventListeners=function(){var self=this;this.ws.onopen=function(){self.onOpen()};this.ws.onclose=function(){self.onClose()};this.ws.onmessage=function(ev){self.onData(ev.data)};this.ws.onerror=function(e){self.onError("websocket error",e)}};if("undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)){WS.prototype.onData=function(data){var self=this;setTimeout(function(){Transport.prototype.onData.call(self,data)},0)}}WS.prototype.write=function(packets){var self=this;this.writable=false;for(var i=0,l=packets.length;i<l;i++){parser.encodePacket(packets[i],this.supportsBinary,function(data){try{self.ws.send(data)}catch(e){debug("websocket closed before onclose event")}})}function ondrain(){self.writable=true;self.emit("drain")}setTimeout(ondrain,0)};WS.prototype.onClose=function(){Transport.prototype.onClose.call(this)};WS.prototype.doClose=function(){if(typeof this.ws!=="undefined"){this.ws.close()}};WS.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"wss":"ws";var port="";if(this.port&&("wss"==schema&&this.port!=443||"ws"==schema&&this.port!=80)){port=":"+this.port}if(this.timestampRequests){query[this.timestampParam]=+new Date}if(!this.supportsBinary){query.b64=1}query=parseqs.encode(query);if(query.length){query="?"+query}return schema+"://"+this.hostname+port+this.path+query};WS.prototype.check=function(){return!!WebSocket&&!("__initialize"in WebSocket&&this.name===WS.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(_dereq_,module,exports){var hasCORS=_dereq_("has-cors");module.exports=function(opts){var xdomain=opts.xdomain;var xscheme=opts.xscheme;var enablesXDR=opts.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!xdomain||hasCORS)){return new XMLHttpRequest}}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!xscheme&&enablesXDR){return new XDomainRequest}}catch(e){}if(!xdomain){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}},{"has-cors":38}],21:[function(_dereq_,module,exports){module.exports=function(a,b){var fn=function(){};fn.prototype=b.prototype;a.prototype=new fn;a.prototype.constructor=a}},{}],22:[function(_dereq_,module,exports){exports=module.exports=_dereq_("./debug");exports.log=log;exports.formatArgs=formatArgs;exports.save=save;exports.load=load;exports.useColors=useColors;exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function useColors(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}exports.formatters.j=function(v){return JSON.stringify(v)};function formatArgs(){var args=arguments;var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return args;var c="color: "+this.color;args=[args[0],c,"color: inherit"].concat(Array.prototype.slice.call(args,1));var index=0;var lastC=0;args[0].replace(/%[a-z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c);return args}function log(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){localStorage.removeItem("debug")}else{localStorage.debug=namespaces}}catch(e){}}function load(){var r;try{r=localStorage.debug}catch(e){}return r}exports.enable(load())},{"./debug":23}],23:[function(_dereq_,module,exports){exports=module.exports=debug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=_dereq_("ms");exports.names=[];exports.skips=[];exports.formatters={};var prevColor=0;var prevTime;function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(namespace){function disabled(){}disabled.enabled=false;function enabled(){var self=enabled;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;if(null==self.useColors)self.useColors=exports.useColors();if(null==self.color&&self.useColors)self.color=selectColor();var args=Array.prototype.slice.call(arguments);args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args=["%o"].concat(args)}var index=0;args[0]=args[0].replace(/%([a-z%])/g,function(match,format){if(match==="%%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match});if("function"===typeof exports.formatArgs){args=exports.formatArgs.apply(self,args)}var logFn=enabled.log||exports.log||console.log.bind(console);logFn.apply(self,args)}enabled.enabled=true;var fn=exports.enabled(namespace)?enabled:disabled;fn.namespace=namespace;return fn}function enable(namespaces){exports.save(namespaces);var split=(namespaces||"").split(/[\s,]+/);var len=split.length;for(var i=0;i<len;i++){if(!split[i])continue;namespaces=split[i].replace(/\*/g,".*?");if(namespaces[0]==="-"){exports.skips.push(new RegExp("^"+namespaces.substr(1)+"$"))}else{exports.names.push(new RegExp("^"+namespaces+"$"))}}}function disable(){exports.enable("")}function enabled(name){var i,len;for(i=0,len=exports.skips.length;i<len;i++){if(exports.skips[i].test(name)){return false}}for(i=0,len=exports.names.length;i<len;i++){if(exports.names[i].test(name)){return true}}return false}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{ms:24}],24:[function(_dereq_,module,exports){var s=1e3;var m=s*60;var h=m*60;var d=h*24;var y=d*365.25;module.exports=function(val,options){options=options||{};if("string"==typeof val)return parse(val);return options.long?long(val):short(val)};function parse(str){var match=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);if(!match)return;var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"h":return n*h;case"minutes":case"minute":case"m":return n*m;case"seconds":case"second":case"s":return n*s;case"ms":return n}}function short(ms){if(ms>=d)return Math.round(ms/d)+"d";if(ms>=h)return Math.round(ms/h)+"h";if(ms>=m)return Math.round(ms/m)+"m";if(ms>=s)return Math.round(ms/s)+"s";return ms+"ms"}function long(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms<n)return;if(ms<n*1.5)return Math.floor(ms/n)+" "+name;return Math.ceil(ms/n)+" "+name+"s"}},{}],25:[function(_dereq_,module,exports){(function(global){var keys=_dereq_("./keys");var hasBinary=_dereq_("has-binary");var sliceBuffer=_dereq_("arraybuffer.slice");var base64encoder=_dereq_("base64-arraybuffer");var after=_dereq_("after");var utf8=_dereq_("utf8");var isAndroid=navigator.userAgent.match(/Android/i);var isPhantomJS=/PhantomJS/i.test(navigator.userAgent);var dontSendBlobs=isAndroid||isPhantomJS;exports.protocol=3;var packets=exports.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6};var packetslist=keys(packets);var err={type:"error",data:"parser error"};var Blob=_dereq_("blob");exports.encodePacket=function(packet,supportsBinary,utf8encode,callback){if("function"==typeof supportsBinary){callback=supportsBinary;supportsBinary=false}if("function"==typeof utf8encode){callback=utf8encode;utf8encode=null}var data=packet.data===undefined?undefined:packet.data.buffer||packet.data;if(global.ArrayBuffer&&data instanceof ArrayBuffer){return encodeArrayBuffer(packet,supportsBinary,callback)}else if(Blob&&data instanceof global.Blob){return encodeBlob(packet,supportsBinary,callback)}if(data&&data.base64){return encodeBase64Object(packet,callback)}var encoded=packets[packet.type];if(undefined!==packet.data){encoded+=utf8encode?utf8.encode(String(packet.data)):String(packet.data)}return callback(""+encoded)};function encodeBase64Object(packet,callback){var message="b"+exports.packets[packet.type]+packet.data.data;return callback(message)}function encodeArrayBuffer(packet,supportsBinary,callback){if(!supportsBinary){return exports.encodeBase64Packet(packet,callback)}var data=packet.data;var contentArray=new Uint8Array(data);var resultBuffer=new Uint8Array(1+data.byteLength);resultBuffer[0]=packets[packet.type];for(var i=0;i<contentArray.length;i++){resultBuffer[i+1]=contentArray[i]}return callback(resultBuffer.buffer)}function encodeBlobAsArrayBuffer(packet,supportsBinary,callback){if(!supportsBinary){return exports.encodeBase64Packet(packet,callback)}var fr=new FileReader;fr.onload=function(){packet.data=fr.result;exports.encodePacket(packet,supportsBinary,true,callback)};return fr.readAsArrayBuffer(packet.data)}function encodeBlob(packet,supportsBinary,callback){if(!supportsBinary){return exports.encodeBase64Packet(packet,callback)}if(dontSendBlobs){return encodeBlobAsArrayBuffer(packet,supportsBinary,callback)}var length=new Uint8Array(1);length[0]=packets[packet.type];var blob=new Blob([length.buffer,packet.data]);return callback(blob)}exports.encodeBase64Packet=function(packet,callback){var message="b"+exports.packets[packet.type];if(Blob&&packet.data instanceof Blob){var fr=new FileReader;fr.onload=function(){var b64=fr.result.split(",")[1];callback(message+b64)};return fr.readAsDataURL(packet.data)}var b64data;try{b64data=String.fromCharCode.apply(null,new Uint8Array(packet.data))}catch(e){var typed=new Uint8Array(packet.data);var basic=new Array(typed.length);for(var i=0;i<typed.length;i++){basic[i]=typed[i]}b64data=String.fromCharCode.apply(null,basic)}message+=global.btoa(b64data);return callback(message)};exports.decodePacket=function(data,binaryType,utf8decode){if(typeof data=="string"||data===undefined){if(data.charAt(0)=="b"){return exports.decodeBase64Packet(data.substr(1),binaryType)}if(utf8decode){try{data=utf8.decode(data)}catch(e){return err}}var type=data.charAt(0);if(Number(type)!=type||!packetslist[type]){return err}if(data.length>1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}}var asArray=new Uint8Array(data);var type=asArray[0];var rest=sliceBuffer(data,1);if(Blob&&binaryType==="blob"){rest=new Blob([rest])}return{type:packetslist[type],data:rest}};exports.decodeBase64Packet=function(msg,binaryType){var type=packetslist[msg.charAt(0)];if(!global.ArrayBuffer){return{type:type,data:{base64:true,data:msg.substr(1)}}}var data=base64encoder.decode(msg.substr(1));if(binaryType==="blob"&&Blob){data=new Blob([data])}return{type:type,data:data}};exports.encodePayload=function(packets,supportsBinary,callback){if(typeof supportsBinary=="function"){callback=supportsBinary;supportsBinary=null}var isBinary=hasBinary(packets);if(supportsBinary&&isBinary){if(Blob&&!dontSendBlobs){return exports.encodePayloadAsBlob(packets,callback)}return exports.encodePayloadAsArrayBuffer(packets,callback)}if(!packets.length){return callback("0:")}function setLengthHeader(message){return message.length+":"+message}function encodeOne(packet,doneCallback){exports.encodePacket(packet,!isBinary?false:supportsBinary,true,function(message){doneCallback(null,setLengthHeader(message))})}map(packets,encodeOne,function(err,results){return callback(results.join(""))})};function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function(i,el,cb){each(el,function(error,msg){result[i]=msg;cb(error,result)})};for(var i=0;i<ary.length;i++){eachWithIndex(i,ary[i],next)}}exports.decodePayload=function(data,binaryType,callback){if(typeof data!="string"){return exports.decodePayloadAsBinary(data,binaryType,callback)}if(typeof binaryType==="function"){callback=binaryType;binaryType=null}var packet;if(data==""){return callback(err,0,1)}var length="",n,msg;for(var i=0,l=data.length;i<l;i++){var chr=data.charAt(i);if(":"!=chr){length+=chr}else{if(""==length||length!=(n=Number(length))){return callback(err,0,1)}msg=data.substr(i+1,n);if(length!=msg.length){return callback(err,0,1)}if(msg.length){packet=exports.decodePacket(msg,binaryType,true);if(err.type==packet.type&&err.data==packet.data){return callback(err,0,1)}var ret=callback(packet,i+n,l);if(false===ret)return}i+=n;length=""}}if(length!=""){return callback(err,0,1)}};exports.encodePayloadAsArrayBuffer=function(packets,callback){if(!packets.length){return callback(new ArrayBuffer(0))}function encodeOne(packet,doneCallback){exports.encodePacket(packet,true,true,function(data){return doneCallback(null,data)})}map(packets,encodeOne,function(err,encodedPackets){var totalLength=encodedPackets.reduce(function(acc,p){var len;if(typeof p==="string"){len=p.length}else{len=p.byteLength}return acc+len.toString().length+len+2},0);var resultArray=new Uint8Array(totalLength);var bufferIndex=0;encodedPackets.forEach(function(p){var isString=typeof p==="string";var ab=p;if(isString){var view=new Uint8Array(p.length);for(var i=0;i<p.length;i++){view[i]=p.charCodeAt(i)}ab=view.buffer}if(isString){resultArray[bufferIndex++]=0}else{resultArray[bufferIndex++]=1}var lenStr=ab.byteLength.toString();for(var i=0;i<lenStr.length;i++){resultArray[bufferIndex++]=parseInt(lenStr[i])}resultArray[bufferIndex++]=255;var view=new Uint8Array(ab);for(var i=0;i<view.length;i++){resultArray[bufferIndex++]=view[i]}});return callback(resultArray.buffer)})};exports.encodePayloadAsBlob=function(packets,callback){function encodeOne(packet,doneCallback){exports.encodePacket(packet,true,true,function(encoded){var binaryIdentifier=new Uint8Array(1);binaryIdentifier[0]=1;if(typeof encoded==="string"){var view=new Uint8Array(encoded.length);for(var i=0;i<encoded.length;i++){view[i]=encoded.charCodeAt(i)}encoded=view.buffer;binaryIdentifier[0]=0}var len=encoded instanceof ArrayBuffer?encoded.byteLength:encoded.size;var lenStr=len.toString();var lengthAry=new Uint8Array(lenStr.length+1);for(var i=0;i<lenStr.length;i++){lengthAry[i]=parseInt(lenStr[i])}lengthAry[lenStr.length]=255;if(Blob){var blob=new Blob([binaryIdentifier.buffer,lengthAry.buffer,encoded]);doneCallback(null,blob)}})}map(packets,encodeOne,function(err,results){return callback(new Blob(results))})};exports.decodePayloadAsBinary=function(data,binaryType,callback){if(typeof binaryType==="function"){callback=binaryType;binaryType=null}var bufferTail=data;var buffers=[];var numberTooLong=false;while(bufferTail.byteLength>0){var tailArray=new Uint8Array(bufferTail);var isString=tailArray[0]===0;var msgLength="";for(var i=1;;i++){if(tailArray[i]==255)break;if(msgLength.length>310){numberTooLong=true;break}msgLength+=tailArray[i]}if(numberTooLong)return callback(err,0,1);bufferTail=sliceBuffer(bufferTail,2+msgLength.length);msgLength=parseInt(msgLength);var msg=sliceBuffer(bufferTail,0,msgLength);if(isString){try{msg=String.fromCharCode.apply(null,new Uint8Array(msg))}catch(e){var typed=new Uint8Array(msg);msg="";for(var i=0;i<typed.length;i++){msg+=String.fromCharCode(typed[i])}}}buffers.push(msg);bufferTail=sliceBuffer(bufferTail,msgLength)}var total=buffers.length;buffers.forEach(function(buffer,i){callback(exports.decodePacket(buffer,binaryType,true),i,total)})}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(_dereq_,module,exports){module.exports=Object.keys||function keys(obj){var arr=[];var has=Object.prototype.hasOwnProperty;for(var i in obj){if(has.call(obj,i)){arr.push(i)}}return arr}},{}],27:[function(_dereq_,module,exports){module.exports=after;function after(count,callback,err_cb){var bail=false;err_cb=err_cb||noop;proxy.count=count;return count===0?callback():proxy;function proxy(err,result){if(proxy.count<=0){throw new Error("after called too many times")}--proxy.count;if(err){bail=true;callback(err);callback=err_cb}else if(proxy.count===0&&!bail){callback(null,result)}}}function noop(){}},{}],28:[function(_dereq_,module,exports){module.exports=function(arraybuffer,start,end){var bytes=arraybuffer.byteLength;start=start||0;end=end||bytes;if(arraybuffer.slice){return arraybuffer.slice(start,end)}if(start<0){start+=bytes}if(end<0){end+=bytes}if(end>bytes){end=bytes}if(start>=bytes||start>=end||bytes===0){return new ArrayBuffer(0)}var abv=new Uint8Array(arraybuffer);var result=new Uint8Array(end-start);for(var i=start,ii=0;i<end;i++,ii++){result[ii]=abv[i]}return result.buffer}},{}],29:[function(_dereq_,module,exports){(function(chars){"use strict";exports.encode=function(arraybuffer){var bytes=new Uint8Array(arraybuffer),i,len=bytes.length,base64="";for(i=0;i<len;i+=3){base64+=chars[bytes[i]>>2];base64+=chars[(bytes[i]&3)<<4|bytes[i+1]>>4];base64+=chars[(bytes[i+1]&15)<<2|bytes[i+2]>>6];base64+=chars[bytes[i+2]&63]}if(len%3===2){base64=base64.substring(0,base64.length-1)+"="}else if(len%3===1){base64=base64.substring(0,base64.length-2)+"=="}return base64};exports.decode=function(base64){var bufferLength=base64.length*.75,len=base64.length,i,p=0,encoded1,encoded2,encoded3,encoded4;if(base64[base64.length-1]==="="){bufferLength--;if(base64[base64.length-2]==="="){bufferLength--}}var arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i=0;i<len;i+=4){encoded1=chars.indexOf(base64[i]);encoded2=chars.indexOf(base64[i+1]);encoded3=chars.indexOf(base64[i+2]);encoded4=chars.indexOf(base64[i+3]);bytes[p++]=encoded1<<2|encoded2>>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(_dereq_,module,exports){(function(global){var BlobBuilder=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder;var blobSupported=function(){try{var a=new Blob(["hi"]);return a.size===2}catch(e){return false}}();var blobSupportsArrayBufferView=blobSupported&&function(){try{var b=new Blob([new Uint8Array([1,2])]);return b.size===2}catch(e){return false}}();var blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function mapArrayBufferViews(ary){for(var i=0;i<ary.length;i++){var chunk=ary[i];if(chunk.buffer instanceof ArrayBuffer){var buf=chunk.buffer;if(chunk.byteLength!==buf.byteLength){var copy=new Uint8Array(chunk.byteLength);copy.set(new Uint8Array(buf,chunk.byteOffset,chunk.byteLength));buf=copy.buffer}ary[i]=buf}}}function BlobBuilderConstructor(ary,options){options=options||{};var bb=new BlobBuilder;mapArrayBufferViews(ary);for(var i=0;i<ary.length;i++){bb.append(ary[i])}return options.type?bb.getBlob(options.type):bb.getBlob()}function BlobConstructor(ary,options){mapArrayBufferViews(ary);return new Blob(ary,options||{})}module.exports=function(){if(blobSupported){return blobSupportsArrayBufferView?global.Blob:BlobConstructor}else if(blobBuilderSupported){return BlobBuilderConstructor}else{return undefined}}()}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],31:[function(_dereq_,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var stringFromCharCode=String.fromCharCode;function ucs2decode(string){var output=[];var counter=0;var length=string.length;var value;var extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){var length=array.length;var index=-1;var value;var output="";while(++index<length){value=array[index];if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}return output}function checkScalarValue(codePoint){if(codePoint>=55296&&codePoint<=57343){throw Error("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value")
+}}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if((codePoint&4294967168)==0){return stringFromCharCode(codePoint)}var symbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}else if((codePoint&4294901760)==0){checkScalarValue(codePoint);symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}else if((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);return symbol}function utf8encode(string){var codePoints=ucs2decode(string);var length=codePoints.length;var index=-1;var codePoint;var byteString="";while(++index<length){codePoint=codePoints[index];byteString+=encodeCodePoint(codePoint)}return byteString}function readContinuationByte(){if(byteIndex>=byteCount){throw Error("Invalid byte index")}var continuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){return continuationByte&63}throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1;var byte2;var byte3;var byte4;var codePoint;if(byteIndex>byteCount){throw Error("Invalid byte index")}if(byteIndex==byteCount){return false}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){return byte1}if((byte1&224)==192){var byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){checkScalarValue(codePoint);return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&15)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){return codePoint}}throw Error("Invalid UTF-8 detected")}var byteArray;var byteCount;var byteIndex;function utf8decode(byteString){byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;var codePoints=[];var tmp;while((tmp=decodeSymbol())!==false){codePoints.push(tmp)}return ucs2encode(codePoints)}var utf8={version:"2.0.0",encode:utf8encode,decode:utf8decode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return utf8})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=utf8}else{var object={};var hasOwnProperty=object.hasOwnProperty;for(var key in utf8){hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}}}else{root.utf8=utf8}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],32:[function(_dereq_,module,exports){(function(global){var rvalidchars=/^[\],:{}\s]*$/;var rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g;var rtrimLeft=/^\s+/;var rtrimRight=/\s+$/;module.exports=function parsejson(data){if("string"!=typeof data||!data){return null}data=data.replace(rtrimLeft,"").replace(rtrimRight,"");if(global.JSON&&JSON.parse){return JSON.parse(data)}if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return new Function("return "+data)()}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],33:[function(_dereq_,module,exports){exports.encode=function(obj){var str="";for(var i in obj){if(obj.hasOwnProperty(i)){if(str.length)str+="&";str+=encodeURIComponent(i)+"="+encodeURIComponent(obj[i])}}return str};exports.decode=function(qs){var qry={};var pairs=qs.split("&");for(var i=0,l=pairs.length;i<l;i++){var pair=pairs[i].split("=");qry[decodeURIComponent(pair[0])]=decodeURIComponent(pair[1])}return qry}},{}],34:[function(_dereq_,module,exports){var re=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];module.exports=function parseuri(str){var src=str,b=str.indexOf("["),e=str.indexOf("]");if(b!=-1&&e!=-1){str=str.substring(0,b)+str.substring(b,e).replace(/:/g,";")+str.substring(e,str.length)}var m=re.exec(str||""),uri={},i=14;while(i--){uri[parts[i]]=m[i]||""}if(b!=-1&&e!=-1){uri.source=src;uri.host=uri.host.substring(1,uri.host.length-1).replace(/;/g,":");uri.authority=uri.authority.replace("[","").replace("]","").replace(/;/g,":");uri.ipv6uri=true}return uri}},{}],35:[function(_dereq_,module,exports){var global=function(){return this}();var WebSocket=global.WebSocket||global.MozWebSocket;module.exports=WebSocket?ws:null;function ws(uri,protocols,opts){var instance;if(protocols){instance=new WebSocket(uri,protocols)}else{instance=new WebSocket(uri)}return instance}if(WebSocket)ws.prototype=WebSocket.prototype},{}],36:[function(_dereq_,module,exports){(function(global){var isArray=_dereq_("isarray");module.exports=hasBinary;function hasBinary(data){function _hasBinary(obj){if(!obj)return false;if(global.Buffer&&global.Buffer.isBuffer(obj)||global.ArrayBuffer&&obj instanceof ArrayBuffer||global.Blob&&obj instanceof Blob||global.File&&obj instanceof File){return true}if(isArray(obj)){for(var i=0;i<obj.length;i++){if(_hasBinary(obj[i])){return true}}}else if(obj&&"object"==typeof obj){if(obj.toJSON){obj=obj.toJSON()}for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)&&_hasBinary(obj[key])){return true}}}return false}return _hasBinary(data)}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{isarray:37}],37:[function(_dereq_,module,exports){module.exports=Array.isArray||function(arr){return Object.prototype.toString.call(arr)=="[object Array]"}},{}],38:[function(_dereq_,module,exports){var global=_dereq_("global");try{module.exports="XMLHttpRequest"in global&&"withCredentials"in new global.XMLHttpRequest}catch(err){module.exports=false}},{global:39}],39:[function(_dereq_,module,exports){module.exports=function(){return this}()},{}],40:[function(_dereq_,module,exports){var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i<arr.length;++i){if(arr[i]===obj)return i}return-1}},{}],41:[function(_dereq_,module,exports){var has=Object.prototype.hasOwnProperty;exports.keys=Object.keys||function(obj){var keys=[];for(var key in obj){if(has.call(obj,key)){keys.push(key)}}return keys};exports.values=function(obj){var vals=[];for(var key in obj){if(has.call(obj,key)){vals.push(obj[key])}}return vals};exports.merge=function(a,b){for(var key in b){if(has.call(b,key)){a[key]=b[key]}}return a};exports.length=function(obj){return exports.keys(obj).length};exports.isEmpty=function(obj){return 0==exports.length(obj)}},{}],42:[function(_dereq_,module,exports){var re=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];module.exports=function parseuri(str){var m=re.exec(str||""),uri={},i=14;while(i--){uri[parts[i]]=m[i]||""}return uri}},{}],43:[function(_dereq_,module,exports){(function(global){var isArray=_dereq_("isarray");var isBuf=_dereq_("./is-buffer");exports.deconstructPacket=function(packet){var buffers=[];var packetData=packet.data;function _deconstructPacket(data){if(!data)return data;if(isBuf(data)){var placeholder={_placeholder:true,num:buffers.length};buffers.push(data);return placeholder}else if(isArray(data)){var newData=new Array(data.length);for(var i=0;i<data.length;i++){newData[i]=_deconstructPacket(data[i])}return newData}else if("object"==typeof data&&!(data instanceof Date)){var newData={};for(var key in data){newData[key]=_deconstructPacket(data[key])}return newData}return data}var pack=packet;pack.data=_deconstructPacket(packetData);pack.attachments=buffers.length;return{packet:pack,buffers:buffers}};exports.reconstructPacket=function(packet,buffers){var curPlaceHolder=0;function _reconstructPacket(data){if(data&&data._placeholder){var buf=buffers[data.num];return buf}else if(isArray(data)){for(var i=0;i<data.length;i++){data[i]=_reconstructPacket(data[i])}return data}else if(data&&"object"==typeof data){for(var key in data){data[key]=_reconstructPacket(data[key])}return data}return data}packet.data=_reconstructPacket(packet.data);packet.attachments=undefined;return packet};exports.removeBlobs=function(data,callback){function _removeBlobs(obj,curKey,containingObject){if(!obj)return obj;if(global.Blob&&obj instanceof Blob||global.File&&obj instanceof File){pendingBlobs++;var fileReader=new FileReader;fileReader.onload=function(){if(containingObject){containingObject[curKey]=this.result}else{bloblessData=this.result}if(!--pendingBlobs){callback(bloblessData)}};fileReader.readAsArrayBuffer(obj)}else if(isArray(obj)){for(var i=0;i<obj.length;i++){_removeBlobs(obj[i],i,obj)}}else if(obj&&"object"==typeof obj&&!isBuf(obj)){for(var key in obj){_removeBlobs(obj[key],key,obj)}}}var pendingBlobs=0;var bloblessData=data;_removeBlobs(bloblessData);if(!pendingBlobs){callback(bloblessData)}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(_dereq_,module,exports){var debug=_dereq_("debug")("socket.io-parser");var json=_dereq_("json3");var isArray=_dereq_("isarray");var Emitter=_dereq_("component-emitter");var binary=_dereq_("./binary");var isBuf=_dereq_("./is-buffer");exports.protocol=4;exports.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"];exports.CONNECT=0;exports.DISCONNECT=1;exports.EVENT=2;exports.ACK=3;exports.ERROR=4;exports.BINARY_EVENT=5;exports.BINARY_ACK=6;exports.Encoder=Encoder;exports.Decoder=Decoder;function Encoder(){}Encoder.prototype.encode=function(obj,callback){debug("encoding packet %j",obj);if(exports.BINARY_EVENT==obj.type||exports.BINARY_ACK==obj.type){encodeAsBinary(obj,callback)}else{var encoding=encodeAsString(obj);callback([encoding])}};function encodeAsString(obj){var str="";var nsp=false;str+=obj.type;if(exports.BINARY_EVENT==obj.type||exports.BINARY_ACK==obj.type){str+=obj.attachments;str+="-"}if(obj.nsp&&"/"!=obj.nsp){nsp=true;str+=obj.nsp}if(null!=obj.id){if(nsp){str+=",";nsp=false}str+=obj.id}if(null!=obj.data){if(nsp)str+=",";str+=json.stringify(obj.data)}debug("encoded %j as %s",obj,str);return str}function encodeAsBinary(obj,callback){function writeEncoding(bloblessData){var deconstruction=binary.deconstructPacket(bloblessData);var pack=encodeAsString(deconstruction.packet);var buffers=deconstruction.buffers;buffers.unshift(pack);callback(buffers)}binary.removeBlobs(obj,writeEncoding)}function Decoder(){this.reconstructor=null}Emitter(Decoder.prototype);Decoder.prototype.add=function(obj){var packet;if("string"==typeof obj){packet=decodeString(obj);if(exports.BINARY_EVENT==packet.type||exports.BINARY_ACK==packet.type){this.reconstructor=new BinaryReconstructor(packet);if(this.reconstructor.reconPack.attachments===0){this.emit("decoded",packet)}}else{this.emit("decoded",packet)}}else if(isBuf(obj)||obj.base64){if(!this.reconstructor){throw new Error("got binary data when not reconstructing a packet")}else{packet=this.reconstructor.takeBinaryData(obj);if(packet){this.reconstructor=null;this.emit("decoded",packet)}}}else{throw new Error("Unknown type: "+obj)}};function decodeString(str){var p={};var i=0;p.type=Number(str.charAt(0));if(null==exports.types[p.type])return error();if(exports.BINARY_EVENT==p.type||exports.BINARY_ACK==p.type){var buf="";while(str.charAt(++i)!="-"){buf+=str.charAt(i);if(i==str.length)break}if(buf!=Number(buf)||str.charAt(i)!="-"){throw new Error("Illegal attachments")}p.attachments=Number(buf)}if("/"==str.charAt(i+1)){p.nsp="";while(++i){var c=str.charAt(i);if(","==c)break;p.nsp+=c;if(i==str.length)break}}else{p.nsp="/"}var next=str.charAt(i+1);if(""!==next&&Number(next)==next){p.id="";while(++i){var c=str.charAt(i);if(null==c||Number(c)!=c){--i;break}p.id+=str.charAt(i);if(i==str.length)break}p.id=Number(p.id)}if(str.charAt(++i)){try{p.data=json.parse(str.substr(i))}catch(e){return error()}}debug("decoded %s as %j",str,p);return p}Decoder.prototype.destroy=function(){if(this.reconstructor){this.reconstructor.finishedReconstruction()}};function BinaryReconstructor(packet){this.reconPack=packet;this.buffers=[]}BinaryReconstructor.prototype.takeBinaryData=function(binData){this.buffers.push(binData);if(this.buffers.length==this.reconPack.attachments){var packet=binary.reconstructPacket(this.reconPack,this.buffers);this.finishedReconstruction();return packet}return null};BinaryReconstructor.prototype.finishedReconstruction=function(){this.reconPack=null;this.buffers=[]};function error(data){return{type:exports.ERROR,data:"parser error"}}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(_dereq_,module,exports){(function(global){module.exports=isBuf;function isBuf(obj){return global.Buffer&&global.Buffer.isBuffer(obj)||global.ArrayBuffer&&obj instanceof ArrayBuffer}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],46:[function(_dereq_,module,exports){module.exports=_dereq_(37)},{}],47:[function(_dereq_,module,exports){(function(window){var getClass={}.toString,isProperty,forEach,undef;var isLoader=typeof define==="function"&&define.amd;var nativeJSON=typeof JSON=="object"&&JSON;var JSON3=typeof exports=="object"&&exports&&!exports.nodeType&&exports;if(JSON3&&nativeJSON){JSON3.stringify=nativeJSON.stringify;JSON3.parse=nativeJSON.parse}else{JSON3=window.JSON=nativeJSON||{}}var isExtended=new Date(-0xc782b5b800cec);try{isExtended=isExtended.getUTCFullYear()==-109252&&isExtended.getUTCMonth()===0&&isExtended.getUTCDate()===1&&isExtended.getUTCHours()==10&&isExtended.getUTCMinutes()==37&&isExtended.getUTCSeconds()==6&&isExtended.getUTCMilliseconds()==708}catch(exception){}function has(name){if(has[name]!==undef){return has[name]}var isSupported;if(name=="bug-string-char-index"){isSupported="a"[0]!="a"}else if(name=="json"){isSupported=has("json-stringify")&&has("json-parse")}else{var value,serialized='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(name=="json-stringify"){var stringify=JSON3.stringify,stringifySupported=typeof stringify=="function"&&isExtended;if(stringifySupported){(value=function(){return 1}).toJSON=value;try{stringifySupported=stringify(0)==="0"&&stringify(new Number)==="0"&&stringify(new String)=='""'&&stringify(getClass)===undef&&stringify(undef)===undef&&stringify()===undef&&stringify(value)==="1"&&stringify([value])=="[1]"&&stringify([undef])=="[null]"&&stringify(null)=="null"&&stringify([undef,getClass,null])=="[null,null,null]"&&stringify({a:[value,true,false,null,"\x00\b\n\f\r  "]})==serialized&&stringify(null,value)==="1"&&stringify([1,2],null,1)=="[\n 1,\n 2\n]"&&stringify(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&stringify(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&stringify(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&stringify(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch(exception){stringifySupported=false}}isSupported=stringifySupported}if(name=="json-parse"){var parse=JSON3.parse;if(typeof parse=="function"){try{if(parse("0")===0&&!parse(false)){value=parse(serialized);var parseSupported=value["a"].length==5&&value["a"][0]===1;if(parseSupported){try{parseSupported=!parse('"    "')}catch(exception){}if(parseSupported){try{parseSupported=parse("01")!==1}catch(exception){}}if(parseSupported){try{parseSupported=parse("1.")!==1}catch(exception){}}}}}catch(exception){parseSupported=false}}isSupported=parseSupported}}return has[name]=!!isSupported}if(!has("json")){var functionClass="[object Function]";var dateClass="[object Date]";var numberClass="[object Number]";var stringClass="[object String]";var arrayClass="[object Array]";var booleanClass="[object Boolean]";var charIndexBuggy=has("bug-string-char-index");if(!isExtended){var floor=Math.floor;var Months=[0,31,59,90,120,151,181,212,243,273,304,334];var getDay=function(year,month){return Months[month]+365*(year-1970)+floor((year-1969+(month=+(month>1)))/4)-floor((year-1901+month)/100)+floor((year-1601+month)/400)}}if(!(isProperty={}.hasOwnProperty)){isProperty=function(property){var members={},constructor;if((members.__proto__=null,members.__proto__={toString:1},members).toString!=getClass){isProperty=function(property){var original=this.__proto__,result=property in(this.__proto__=null,this);this.__proto__=original;return result}}else{constructor=members.constructor;isProperty=function(property){var parent=(this.constructor||constructor).prototype;return property in this&&!(property in parent&&this[property]===parent[property])}}members=null;return isProperty.call(this,property)}}var PrimitiveTypes={"boolean":1,number:1,string:1,undefined:1};var isHostType=function(object,property){var type=typeof object[property];return type=="object"?!!object[property]:!PrimitiveTypes[type]};forEach=function(object,callback){var size=0,Properties,members,property;(Properties=function(){this.valueOf=0}).prototype.valueOf=0;members=new Properties;for(property in members){if(isProperty.call(members,property)){size++}}Properties=members=null;if(!size){members=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,length;var hasProperty=!isFunction&&typeof object.constructor!="function"&&isHostType(object,"hasOwnProperty")?object.hasOwnProperty:isProperty;for(property in object){if(!(isFunction&&property=="prototype")&&hasProperty.call(object,property)){callback(property)}}for(length=members.length;property=members[--length];hasProperty.call(object,property)&&callback(property));}}else if(size==2){forEach=function(object,callback){var members={},isFunction=getClass.call(object)==functionClass,property;for(property in object){if(!(isFunction&&property=="prototype")&&!isProperty.call(members,property)&&(members[property]=1)&&isProperty.call(object,property)){callback(property)}}}}else{forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,isConstructor;for(property in object){if(!(isFunction&&property=="prototype")&&isProperty.call(object,property)&&!(isConstructor=property==="constructor")){callback(property)}}if(isConstructor||isProperty.call(object,property="constructor")){callback(property)}}}return forEach(object,callback)};if(!has("json-stringify")){var Escapes={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var leadingZeroes="000000";var toPaddedString=function(width,value){return(leadingZeroes+(value||0)).slice(-width)};var unicodePrefix="\\u00";var quote=function(value){var result='"',index=0,length=value.length,isLarge=length>10&&charIndexBuggy,symbols;if(isLarge){symbols=value.split("")}for(;index<length;index++){var charCode=value.charCodeAt(index);switch(charCode){case 8:case 9:case 10:case 12:case 13:case 34:case 92:result+=Escapes[charCode];break;default:if(charCode<32){result+=unicodePrefix+toPaddedString(2,charCode.toString(16));break}result+=isLarge?symbols[index]:charIndexBuggy?value.charAt(index):value[index]}}return result+'"'};var serialize=function(property,object,callback,properties,whitespace,indentation,stack){var value,className,year,month,date,time,hours,minutes,seconds,milliseconds,results,element,index,length,prefix,result;try{value=object[property]}catch(exception){}if(typeof value=="object"&&value){className=getClass.call(value);if(className==dateClass&&!isProperty.call(value,"toJSON")){if(value>-1/0&&value<1/0){if(getDay){date=floor(value/864e5);for(year=floor(date/365.2425)+1970-1;getDay(year+1,0)<=date;year++);for(month=floor((date-getDay(year,0))/30.42);getDay(year,month+1)<=date;month++);date=1+date-getDay(year,month);time=(value%864e5+864e5)%864e5;hours=floor(time/36e5)%24;minutes=floor(time/6e4)%60;seconds=floor(time/1e3)%60;milliseconds=time%1e3}else{year=value.getUTCFullYear();month=value.getUTCMonth();date=value.getUTCDate();hours=value.getUTCHours();minutes=value.getUTCMinutes();seconds=value.getUTCSeconds();milliseconds=value.getUTCMilliseconds()}value=(year<=0||year>=1e4?(year<0?"-":"+")+toPaddedString(6,year<0?-year:year):toPaddedString(4,year))+"-"+toPaddedString(2,month+1)+"-"+toPaddedString(2,date)+"T"+toPaddedString(2,hours)+":"+toPaddedString(2,minutes)+":"+toPaddedString(2,seconds)+"."+toPaddedString(3,milliseconds)+"Z"}else{value=null}}else if(typeof value.toJSON=="function"&&(className!=numberClass&&className!=stringClass&&className!=arrayClass||isProperty.call(value,"toJSON"))){value=value.toJSON(property)}}if(callback){value=callback.call(object,property,value)}if(value===null){return"null"}className=getClass.call(value);if(className==booleanClass){return""+value}else if(className==numberClass){return value>-1/0&&value<1/0?""+value:"null"}else if(className==stringClass){return quote(""+value)}if(typeof value=="object"){for(length=stack.length;length--;){if(stack[length]===value){throw TypeError()}}stack.push(value);results=[];prefix=indentation;indentation+=whitespace;if(className==arrayClass){for(index=0,length=value.length;index<length;index++){element=serialize(index,value,callback,properties,whitespace,indentation,stack);results.push(element===undef?"null":element)}result=results.length?whitespace?"[\n"+indentation+results.join(",\n"+indentation)+"\n"+prefix+"]":"["+results.join(",")+"]":"[]"}else{forEach(properties||value,function(property){var element=serialize(property,value,callback,properties,whitespace,indentation,stack);if(element!==undef){results.push(quote(property)+":"+(whitespace?" ":"")+element)}});result=results.length?whitespace?"{\n"+indentation+results.join(",\n"+indentation)+"\n"+prefix+"}":"{"+results.join(",")+"}":"{}"}stack.pop();return result}};JSON3.stringify=function(source,filter,width){var whitespace,callback,properties,className;if(typeof filter=="function"||typeof filter=="object"&&filter){if((className=getClass.call(filter))==functionClass){callback=filter}else if(className==arrayClass){properties={};for(var index=0,length=filter.length,value;index<length;value=filter[index++],(className=getClass.call(value),className==stringClass||className==numberClass)&&(properties[value]=1));}}if(width){if((className=getClass.call(width))==numberClass){if((width-=width%1)>0){for(whitespace="",width>10&&(width=10);whitespace.length<width;whitespace+=" ");}}else if(className==stringClass){whitespace=width.length<=10?width:width.slice(0,10)}}return serialize("",(value={},value[""]=source,value),callback,properties,whitespace,"",[])}}if(!has("json-parse")){var fromCharCode=String.fromCharCode;var Unescapes={92:"\\",34:'"',47:"/",98:"\b",116:"  ",110:"\n",102:"\f",114:"\r"};var Index,Source;var abort=function(){Index=Source=null;throw SyntaxError()};var lex=function(){var source=Source,length=source.length,value,begin,position,isSigned,charCode;while(Index<length){charCode=source.charCodeAt(Index);switch(charCode){case 9:case 10:case 13:case 32:Index++;break;case 123:case 125:case 91:case 93:case 58:case 44:value=charIndexBuggy?source.charAt(Index):source[Index];Index++;return value;case 34:for(value="@",Index++;Index<length;){charCode=source.charCodeAt(Index);if(charCode<32){abort()}else if(charCode==92){charCode=source.charCodeAt(++Index);switch(charCode){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:value+=Unescapes[charCode];Index++;break;case 117:begin=++Index;for(position=Index+4;Index<position;Index++){charCode=source.charCodeAt(Index);if(!(charCode>=48&&charCode<=57||charCode>=97&&charCode<=102||charCode>=65&&charCode<=70)){abort()}}value+=fromCharCode("0x"+source.slice(begin,Index));break;default:abort()}}else{if(charCode==34){break}charCode=source.charCodeAt(Index);begin=Index;while(charCode>=32&&charCode!=92&&charCode!=34){charCode=source.charCodeAt(++Index)}value+=source.slice(begin,Index)}}if(source.charCodeAt(Index)==34){Index++;return value}abort();default:begin=Index;if(charCode==45){isSigned=true;charCode=source.charCodeAt(++Index)}if(charCode>=48&&charCode<=57){if(charCode==48&&(charCode=source.charCodeAt(Index+1),charCode>=48&&charCode<=57)){abort()}isSigned=false;for(;Index<length&&(charCode=source.charCodeAt(Index),charCode>=48&&charCode<=57);Index++);if(source.charCodeAt(Index)==46){position=++Index;for(;position<length&&(charCode=source.charCodeAt(position),charCode>=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}charCode=source.charCodeAt(Index);if(charCode==101||charCode==69){charCode=source.charCodeAt(++Index);if(charCode==43||charCode==45){Index++}for(position=Index;position<length&&(charCode=source.charCodeAt(position),charCode>=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}return+source.slice(begin,Index)}if(isSigned){abort()}if(source.slice(Index,Index+4)=="true"){Index+=4;return true}else if(source.slice(Index,Index+5)=="false"){Index+=5;return false}else if(source.slice(Index,Index+4)=="null"){Index+=4;return null}abort()}}return"$"};var get=function(value){var results,hasMembers;if(value=="$"){abort()}if(typeof value=="string"){if((charIndexBuggy?value.charAt(0):value[0])=="@"){return value.slice(1)}if(value=="["){results=[];for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="]"){break}if(hasMembers){if(value==","){value=lex();if(value=="]"){abort()}}else{abort()}}if(value==","){abort()}results.push(get(value))}return results}else if(value=="{"){results={};for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="}"){break}if(hasMembers){if(value==","){value=lex();if(value=="}"){abort()}}else{abort()}}if(value==","||typeof value!="string"||(charIndexBuggy?value.charAt(0):value[0])!="@"||lex()!=":"){abort()}results[value.slice(1)]=get(lex())}return results}abort()}return value};var update=function(source,property,callback){var element=walk(source,property,callback);if(element===undef){delete source[property]}else{source[property]=element}};var walk=function(source,property,callback){var value=source[property],length;if(typeof value=="object"&&value){if(getClass.call(value)==arrayClass){for(length=value.length;length--;){update(value,length,callback)}}else{forEach(value,function(property){update(value,property,callback)})}}return callback.call(source,property,value)};JSON3.parse=function(source,callback){var result,value;Index=0;Source=""+source;result=get(lex());if(lex()!="$"){abort()}Index=Source=null;return callback&&getClass.call(callback)==functionClass?walk((value={},value[""]=result,value),"",callback):result}}}if(isLoader){define(function(){return JSON3})}})(this)},{}],48:[function(_dereq_,module,exports){module.exports=toArray;function toArray(list,index){var array=[];index=index||0;for(var i=index||0;i<list.length;i++){array[i-index]=list[i]}return array}},{}]},{},[1])(1)});
\ No newline at end of file
diff --git a/src/resources/js/sockjs.min.js b/src/resources/js/sockjs.min.js
new file mode 100644 (file)
index 0000000..4f3c4c0
--- /dev/null
@@ -0,0 +1,3 @@
+/* sockjs-client v1.0.3 | http://sockjs.org | MIT license */
+!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.SockJS=t()}}(function(){var t;return function e(t,n,r){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,e){(function(n){"use strict";var r=t("./transport-list");e.exports=t("./main")(r),"_sockjs_onload"in n&&setTimeout(n._sockjs_onload,1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./main":14,"./transport-list":16}],2:[function(t,e){"use strict";function n(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],3:[function(t,e){"use strict";function n(){i.call(this)}var r=t("inherits"),i=t("./eventtarget");r(n,i),n.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},n.prototype.once=function(t,e){function n(){r.removeListener(t,n),i||(i=!0,e.apply(this,arguments))}var r=this,i=!1;this.on(t,n)},n.prototype.emit=function(t){var e=this._listeners[t];if(e)for(var n=Array.prototype.slice.call(arguments,1),r=0;r<e.length;r++)e[r].apply(this,n)},n.prototype.on=n.prototype.addListener=i.prototype.addEventListener,n.prototype.removeListener=i.prototype.removeEventListener,e.exports.EventEmitter=n},{"./eventtarget":5,inherits:54}],4:[function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,e.exports=n},{}],5:[function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];-1===n.indexOf(e)&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var r=n.indexOf(e);return-1!==r?void(n.length>1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(t){var e=t.type,n=Array.prototype.slice.call(arguments,0);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],i=0;i<r.length;i++)r[i].apply(this,n)},e.exports=n},{}],6:[function(t,e){"use strict";function n(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var r=t("inherits"),i=t("./event");r(n,i),e.exports=n},{"./event":4,inherits:54}],7:[function(t,e){"use strict";function n(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var r=t("json3"),i=t("./utils/iframe");n.prototype._transportClose=function(t,e){i.postMessage("c",r.stringify([t,e]))},n.prototype._transportMessage=function(t){i.postMessage("t",t)},n.prototype._send=function(t){this._transport.send(t)},n.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},e.exports=n},{"./utils/iframe":47,json3:55}],8:[function(t,e){"use strict";var n=t("./utils/url"),r=t("./utils/event"),i=t("json3"),o=t("./facade"),s=t("./info-iframe-receiver"),a=t("./utils/iframe"),u=t("./location");e.exports=function(t,e){var l={};e.forEach(function(t){t.facadeTransport&&(l[t.facadeTransport.transportName]=t.facadeTransport)}),l[s.transportName]=s;var c;t.bootstrap_iframe=function(){var e;a.currentWindowId=u.hash.slice(1);var s=function(r){if(r.source===parent&&("undefined"==typeof c&&(c=r.origin),r.origin===c)){var s;try{s=i.parse(r.data)}catch(f){return}if(s.windowId===a.currentWindowId)switch(s.type){case"s":var h;try{h=i.parse(s.data)}catch(f){break}var d=h[0],p=h[1],v=h[2],m=h[3];if(d!==t.version)throw new Error('Incompatibile SockJS! Main site uses: "'+d+'", the iframe: "'+t.version+'".');if(!n.isOriginEqual(v,u.href)||!n.isOriginEqual(m,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+v+", "+m+")");e=new o(new l[p](v,m));break;case"m":e._send(s.data);break;case"c":e&&e._close(),e=null}}};r.attachEvent("message",s),a.postMessage("s")}}},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,debug:void 0,json3:55}],9:[function(t,e){"use strict";function n(t,e){r.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var r,a;if(200===t){if(a=+new Date-i,e)try{r=o.parse(e)}catch(u){}s.isObject(r)||(r={})}n.emit("finish",r,a),n.removeAllListeners()})}var r=t("events").EventEmitter,i=t("inherits"),o=t("json3"),s=t("./utils/object");i(n,r),n.prototype.close=function(){this.removeAllListeners(),this.xo.close()},e.exports=n},{"./utils/object":49,debug:void 0,events:3,inherits:54,json3:55}],10:[function(t,e){"use strict";function n(t){var e=this;i.call(this),this.ir=new a(t,s),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",o.stringify([t,n]))})}var r=t("inherits"),i=t("events").EventEmitter,o=t("json3"),s=t("./transport/sender/xhr-local"),a=t("./info-ajax");r(n,i),n.transportName="iframe-info-receiver",n.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},e.exports=n},{"./info-ajax":9,"./transport/sender/xhr-local":37,events:3,inherits:54,json3:55}],11:[function(t,e){(function(n){"use strict";function r(t,e){var r=this;i.call(this);var o=function(){var n=r.ifr=new u(l.transportName,e,t);n.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(n){return r.emit("finish"),void r.close()}var i=e[0],o=e[1];r.emit("finish",i,o)}r.close()}),n.once("close",function(){r.emit("finish"),r.close()})};n.document.body?o():a.attachEvent("load",o)}var i=t("events").EventEmitter,o=t("inherits"),s=t("json3"),a=t("./utils/event"),u=t("./transport/iframe"),l=t("./info-iframe-receiver");o(r,i),r.enabled=function(){return u.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,debug:void 0,events:3,inherits:54,json3:55}],12:[function(t,e){"use strict";function n(t,e){var n=this;r.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var r=t("events").EventEmitter,i=t("inherits"),o=t("./utils/url"),s=t("./transport/sender/xdr"),a=t("./transport/sender/xhr-cors"),u=t("./transport/sender/xhr-local"),l=t("./transport/sender/xhr-fake"),c=t("./info-iframe"),f=t("./info-ajax");i(n,r),n._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):a.enabled?new f(e,a):s.enabled&&n.sameScheme?new f(e,s):c.enabled()?new c(t,e):new f(e,l)},n.prototype.doXhr=function(t,e){var r=this,i=o.addPath(t,"/info");this.xo=n._getReceiver(t,i,e),this.timeoutRef=setTimeout(function(){r._cleanup(!1),r.emit("finish")},n.timeout),this.xo.once("finish",function(t,e){r._cleanup(!0),r.emit("finish",t,e)})},n.prototype._cleanup=function(t){clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},n.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},n.timeout=8e3,e.exports=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:void 0,events:3,inherits:54}],13:[function(t,e){(function(t){"use strict";e.exports=t.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(t,e){(function(n){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&m.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports;var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return l.string(i)}}this._server=n.server||l.numberString(1e3);var o=new s(t);if(!o.host||!o.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(o.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==o.protocol&&"https:"!==o.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+o.protocol+"' is not allowed.");var a="https:"===o.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var u=e.sort();u.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<u.length-1&&t===u[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var c=f.getOrigin(g.href);this._origin=c?c.toLowerCase():null,o.set("pathname",o.pathname.replace(/\/+$/,"")),this.url=o.href,this._urlInfo={nullOrigin:!v.hasDomain(),sameOrigin:f.isOriginEqual(this.url,g.href),sameScheme:f.isSchemeEqual(this.url,g.href)},this._ir=new _(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function i(t){return 1e3===t||t>=3e3&&4999>=t}t("./shims");var o,s=t("url-parse"),a=t("inherits"),u=t("json3"),l=t("./utils/random"),c=t("./utils/escape"),f=t("./utils/url"),h=t("./utils/event"),d=t("./utils/transport"),p=t("./utils/object"),v=t("./utils/browser"),m=t("./utils/log"),y=t("./event/event"),b=t("./event/eventtarget"),g=t("./location"),w=t("./event/close"),x=t("./event/trans-message"),_=t("./info-receiver");a(r,b),r.prototype.close=function(t,e){if(t&&!i(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(c.quote(t))},r.version=t("./version"),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=p.extend(t,this._urlInfo);var n=o.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(t.needBody&&(!n.document.body||"undefined"!=typeof n.document.readyState&&"complete"!==n.document.readyState&&"interactive"!==n.document.readyState))return this._transports.unshift(t),void h.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e);var r=f.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=new t(r,this._transUrl);return i.on("message",this._transportMessage.bind(this)),i.once("close",this._transportClose.bind(this)),i.transportName=t.transportName,void(this._transport=i)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){var e,n=this,r=t.slice(0,1),i=t.slice(1);switch(r){case"o":return void this._open();case"h":return void this.dispatchEvent(new y("heartbeat"))}if(i)try{e=u.parse(i)}catch(o){}if("undefined"!=typeof e)switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){n.dispatchEvent(new x(t))});break;case"m":this.dispatchEvent(new x(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),i(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open"))):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,i&&this.dispatchEvent(new y("error"));var o=new w("close");o.wasClean=n||!1,o.code=t||1e3,o.reason=e,this.dispatchEvent(o),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},e.exports=function(e){return o=d(e),t("./iframe-bootstrap")(r,e),r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./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:void 0,inherits:54,json3:55,"url-parse":56}],15:[function(){"use strict";function t(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function e(t){return t>>>0}function n(){}var r,i=Array.prototype,o=Object.prototype,s=Function.prototype,a=String.prototype,u=i.slice,l=o.toString,c=function(t){return"[object Function]"===o.toString.call(t)},f=function(t){return"[object Array]"===l.call(t)},h=function(t){return"[object String]"===l.call(t)},d=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();r=d?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var p=function(t,e,n){for(var i in e)o.hasOwnProperty.call(e,i)&&r(t,i,e[i],n)},v=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};p(s,{bind:function(t){var e=this;if(!c(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var r=u.call(arguments,1),i=function(){if(this instanceof l){var n=e.apply(this,r.concat(u.call(arguments)));return Object(n)===n?n:this}return e.apply(t,r.concat(u.call(arguments)))},o=Math.max(0,e.length-r.length),s=[],a=0;o>a;a++)s.push("$"+a);var l=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(n.prototype=e.prototype,l.prototype=new n,n.prototype=null),l}}),p(Array,{isArray:f});var m=Object("a"),y="a"!==m[0]||!(0 in m),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,r){"object"!=typeof r&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};p(i,{forEach:function(t){var e=v(this),n=y&&h(this)?this.split(""):e,r=arguments[1],i=-1,o=n.length>>>0;if(!c(t))throw new TypeError;for(;++i<o;)i in n&&t.call(r,n[i],i,e)}},!b(i.forEach));var g=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);p(i,{indexOf:function(e){var n=y&&h(this)?this.split(""):v(this),r=n.length>>>0;if(!r)return-1;var i=0;for(arguments.length>1&&(i=t(arguments[1])),i=i>=0?i:Math.max(0,r+i);r>i;i++)if(i in n&&n[i]===e)return i;return-1}},g);var w=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];a.split=function(n,r){var o=this;if(void 0===n&&0===r)return[];if("[object RegExp]"!==l.call(n))return w.call(this,n,r);var s,a,u,c,f=[],h=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),d=0;for(n=new RegExp(n.source,h+"g"),o+="",t||(s=new RegExp("^"+n.source+"$(?!\\s)",h)),r=void 0===r?-1>>>0:e(r);(a=n.exec(o))&&(u=a.index+a[0].length,!(u>d&&(f.push(o.slice(d,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&i.push.apply(f,a.slice(1)),c=a[0].length,d=u,f.length>=r)));)n.lastIndex===a.index&&n.lastIndex++;return d===o.length?(c||!n.test(""))&&f.push(""):f.push(o.slice(d)),f.length>r?f.slice(0,r):f}}():"0".split(void 0,0).length&&(a.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var x="        \n\v\f\r   ᠎              \u2028\u2029",_="​",E="["+x+"]",j=new RegExp("^"+E+E+"*"),T=new RegExp(E+E+"*$"),S=a.trim&&(x.trim()||!_.trim());p(a,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(j,"").replace(T,"")}},S);var O=a.substr,C="".substr&&"b"!=="0b".substr(-1);p(a,{substr:function(t,e){return O.call(this,0>t&&(t=this.length+t)<0?0:t,e)}},C)},{}],16:[function(t,e){"use strict";e.exports=[t("./transport/websocket"),t("./transport/xhr-streaming"),t("./transport/xdr-streaming"),t("./transport/eventsource"),t("./transport/lib/iframe-wrap")(t("./transport/eventsource")),t("./transport/htmlfile"),t("./transport/lib/iframe-wrap")(t("./transport/htmlfile")),t("./transport/xhr-polling"),t("./transport/xdr-polling"),t("./transport/lib/iframe-wrap")(t("./transport/xhr-polling")),t("./transport/jsonp-polling")]},{"./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(t,e){(function(n){"use strict";function r(t,e,n,r){var o=this;i.call(this),setTimeout(function(){o._start(t,e,n,r)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/url"),u=n.XMLHttpRequest;o(r,i),r.prototype._start=function(t,e,n,i){var o=this;try{this.xhr=new u}catch(l){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){o.emit("finish",0,""),o._cleanup(!1)})}catch(c){return this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!r.supportsCORS||(this.xhr.withCredentials="true"),i&&i.headers)for(var f in i.headers)this.xhr.setRequestHeader(f,i.headers[f]);this.xhr.onreadystatechange=function(){if(o.xhr){var t,e,n=o.xhr;switch(n.readyState){case 3:try{e=n.status,t=n.responseText}catch(r){}1223===e&&(e=204),200===e&&t&&t.length>0&&o.emit("chunk",e,t);break;case 4:e=n.status,1223===e&&(e=204),(12005===e||12029===e)&&(e=0),o.emit("finish",e,n.responseText),o._cleanup(!1)}}};try{o.xhr.send(n)}catch(c){o.emit("finish",0,""),o._cleanup(!1)}},r.prototype._cleanup=function(t){if(this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!!u;var l=["Active"].concat("Object").join("X");!r.enabled&&l in n&&(u=function(){try{return new n[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new u);var c=!1;try{c="withCredentials"in new u}catch(f){}r.supportsCORS=c,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],18:[function(t,e){(function(t){e.exports=t.EventSource}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],19:[function(t,e){(function(t){e.exports=t.WebSocket||t.MozWebSocket}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],20:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/eventsource"),s=t("./sender/xhr-cors"),a=t("eventsource");r(n,i),n.enabled=function(){return!!a},n.transportName="eventsource",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,eventsource:18,inherits:54}],21:[function(t,e){"use strict";function n(t){if(!i.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/htmlfile",i,o)}var r=t("inherits"),i=t("./receiver/htmlfile"),o=t("./sender/xhr-local"),s=t("./lib/ajax-based");r(n,s),n.enabled=function(t){return i.enabled&&t.sameOrigin},n.transportName="htmlfile",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,inherits:54}],22:[function(t,e){"use strict";function n(t,e,r){if(!n.enabled())throw new Error("Transport created when disabled");o.call(this);var i=this;this.origin=a.getOrigin(r),this.baseUrl=r,this.transUrl=e,this.transport=t,this.windowId=c.string(8);var s=a.addPath(r,"/iframe.html")+"#"+this.windowId;this.iframeObj=u.createIframe(s,function(t){i.emit("close",1006,"Unable to load an iframe ("+t+")"),i.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var r=t("inherits"),i=t("json3"),o=t("events").EventEmitter,s=t("../version"),a=t("../utils/url"),u=t("../utils/iframe"),l=t("../utils/event"),c=t("../utils/random");r(n,o),n.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},n.prototype._message=function(t){if(a.isOriginEqual(t.origin,this.origin)){var e;try{e=i.parse(t.data)}catch(n){return}if(e.windowId===this.windowId)switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([s,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var r;try{r=i.parse(e.data)}catch(n){return}this.emit("close",r[0],r[1]),this.close()}}},n.prototype.postMessage=function(t,e){this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},n.prototype.send=function(t){this.postMessage("m",t)},n.enabled=function(){return u.iframeEnabled},n.transportName="iframe",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,debug:void 0,events:3,inherits:54,json3:55}],23:[function(t,e){(function(n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");o.call(this,t,"/jsonp",a,s)}var i=t("inherits"),o=t("./lib/sender-receiver"),s=t("./receiver/jsonp"),a=t("./sender/jsonp");i(r,o),r.enabled=function(){return!!n.document},r.transportName="jsonp-polling",r.roundTrips=1,r.needBody=!0,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,inherits:54}],24:[function(t,e){"use strict";function n(t){return function(e,n,r){var i={};"string"==typeof n&&(i.headers={"Content-type":"text/plain"});var s=o.addPath(e,"/xhr_send"),a=new t("POST",s,n,i);return a.once("finish",function(t){return a=null,200!==t&&204!==t?r(new Error("http status "+t)):void r()}),function(){a.close(),a=null;var t=new Error("Aborted");t.code=1e3,r(t)}}}function r(t,e,r,i){s.call(this,t,e,n(i),r,i)}var i=t("inherits"),o=t("../../utils/url"),s=t("./sender-receiver");i(r,s),e.exports=r},{"../../utils/url":52,"./sender-receiver":28,debug:void 0,inherits:54}],25:[function(t,e){"use strict";function n(t,e){i.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype.send=function(t){this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var t,e=this;this.sendStop=function(){e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){e.sendStop=null,e.sendSchedule()},25)},n.prototype.sendSchedule=function(){var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.stop=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},e.exports=n},{debug:void 0,events:3,inherits:54}],26:[function(t,e){(function(n){"use strict";var r=t("inherits"),i=t("../iframe"),o=t("../../utils/object");e.exports=function(t){function e(e,n){i.call(this,t.transportName,e,n)}return r(e,i),e.enabled=function(e,r){if(!n.document)return!1;var s=o.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&i.enabled()},e.transportName="iframe-"+t.transportName,e.needBody=!0,e.roundTrips=i.roundTrips+t.roundTrips-1,e.facadeTransport=t,e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/object":49,"../iframe":22,inherits:54}],27:[function(t,e){"use strict";function n(t,e,n){i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._scheduleReceiver=function(){var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){t.emit("message",e)}),e.once("close",function(n,r){t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},e.exports=n},{debug:void 0,events:3,inherits:54}],28:[function(t,e){"use strict";function n(t,e,n,r,a){var u=i.addPath(t,e),l=this;o.call(this,t,n),this.poll=new s(r,u,a),this.poll.on("message",function(t){l.emit("message",t)}),this.poll.once("close",function(t,e){l.poll=null,l.emit("close",t,e),l.close()})}var r=t("inherits"),i=t("../../utils/url"),o=t("./buffered-sender"),s=t("./polling");r(n,o),n.prototype.close=function(){this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null),this.stop()},e.exports=n},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,debug:void 0,inherits:54}],29:[function(t,e){"use strict";function n(t){i.call(this);var e=this,n=this.es=new o(t);n.onmessage=function(t){e.emit("message",decodeURI(t.data))},n.onerror=function(t){var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var r=t("inherits"),i=t("events").EventEmitter,o=t("eventsource");r(n,i),n.prototype.abort=function(){this._cleanup(),this._close("user")},n.prototype._cleanup=function(){var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},n.prototype._close=function(t){var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},e.exports=n},{debug:void 0,events:3,eventsource:18,inherits:54}],30:[function(t,e){(function(n){"use strict";function r(t){a.call(this);var e=this;o.polluteGlobalNamespace(),this.id="a"+u.string(6),t=s.addQuery(t,"c="+decodeURIComponent(o.WPrefix+"."+this.id));var i=r.htmlfileEnabled?o.createHtmlfile:o.createIframe;n[o.WPrefix][this.id]={start:function(){e.iframeObj.loaded()},message:function(t){e.emit("message",t)},stop:function(){e._cleanup(),e._close("network")}},this.iframeObj=i(t,function(){e._cleanup(),e._close("permanent")})}var i=t("inherits"),o=t("../../utils/iframe"),s=t("../../utils/url"),a=t("events").EventEmitter,u=t("../../utils/random");i(r,a),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete n[o.WPrefix][this.id]},r.prototype._close=function(t){this.emit("close",null,t),this.removeAllListeners()},r.htmlfileEnabled=!1;var l=["Active"].concat("Object").join("X");if(l in n)try{r.htmlfileEnabled=!!new n[l]("htmlfile")}catch(c){}r.enabled=r.htmlfileEnabled||o.iframeEnabled,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],31:[function(t,e){(function(n){"use strict";function r(t){var e=this;l.call(this),i.polluteGlobalNamespace(),this.id="a"+o.string(6);var s=a.addQuery(t,"c="+encodeURIComponent(i.WPrefix+"."+this.id));n[i.WPrefix][this.id]=this._callback.bind(this),this._createScript(s),this.timeoutId=setTimeout(function(){e._abort(new Error("JSONP script loaded abnormally (timeout)"))},r.timeout)}var i=t("../../utils/iframe"),o=t("../../utils/random"),s=t("../../utils/browser"),a=t("../../utils/url"),u=t("inherits"),l=t("events").EventEmitter;u(r,l),r.prototype.abort=function(){if(n[i.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},r.timeout=35e3,r.scriptErrorTimeout=1e3,r.prototype._callback=function(t){this._cleanup(),this.aborting||(t&&this.emit("message",t),this.emit("close",null,"network"),this.removeAllListeners())},r.prototype._abort=function(t){this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},r.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete n[i.WPrefix][this.id]},r.prototype._scriptError=function(){var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},r.scriptErrorTimeout))},r.prototype._createScript=function(t){var e,r=this,i=this.script=n.document.createElement("script");if(i.id="a"+o.string(8),i.src=t,i.type="text/javascript",i.charset="UTF-8",i.onerror=this._scriptError.bind(this),i.onload=function(){r._abort(new Error("JSONP script loaded abnormally (onload)"))},i.onreadystatechange=function(){if(/loaded|closed/.test(i.readyState)){if(i&&i.htmlFor&&i.onclick){r.loadedOkay=!0;try{i.onclick()}catch(t){}}i&&r._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))}},"undefined"==typeof i.async&&n.document.attachEvent)if(s.isOpera())e=this.script2=n.document.createElement("script"),e.text="try{var a = document.getElementById('"+i.id+"'); if(a)a.onerror();}catch(x){};",i.async=e.async=!1;
+else{try{i.htmlFor=i.id,i.event="onclick"}catch(a){}i.async=!0}"undefined"!=typeof i.async&&(i.async=!0);var u=n.document.getElementsByTagName("head")[0];u.insertBefore(i,u.firstChild),e&&u.insertBefore(e,u.firstChild)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,debug:void 0,events:3,inherits:54}],32:[function(t,e){"use strict";function n(t,e){i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";n.emit("close",null,r),n._cleanup()})}var r=t("inherits"),i=t("events").EventEmitter;r(n,i),n.prototype._chunkHandler=function(t,e){if(200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),-1===n)break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},e.exports=n},{debug:void 0,events:3,inherits:54}],33:[function(t,e){(function(n){"use strict";function r(t){try{return n.document.createElement('<iframe name="'+t+'">')}catch(e){var r=n.document.createElement("iframe");return r.name=t,r}}function i(){o=n.document.createElement("form"),o.style.display="none",o.style.position="absolute",o.method="POST",o.enctype="application/x-www-form-urlencoded",o.acceptCharset="UTF-8",s=n.document.createElement("textarea"),s.name="d",o.appendChild(s),n.document.body.appendChild(o)}var o,s,a=t("../../utils/random"),u=t("../../utils/url");e.exports=function(t,e,n){o||i();var l="a"+a.string(8);o.target=l,o.action=u.addQuery(u.addPath(t,"/jsonp_send"),"i="+l);var c=r(l);c.id=l,c.style.display="none",o.appendChild(c);try{s.value=e}catch(f){}o.submit();var h=function(t){c.onerror&&(c.onreadystatechange=c.onerror=c.onload=null,setTimeout(function(){c.parentNode.removeChild(c),c=null},500),s.value="",n(t))};return c.onerror=function(){h()},c.onload=function(){h()},c.onreadystatechange=function(t){"complete"===c.readyState&&h()},function(){h(new Error("Aborted"))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/random":50,"../../utils/url":52,debug:void 0}],34:[function(t,e){(function(n){"use strict";function r(t,e,n){var r=this;i.call(this),setTimeout(function(){r._start(t,e,n)},0)}var i=t("events").EventEmitter,o=t("inherits"),s=t("../../utils/event"),a=t("../../utils/browser"),u=t("../../utils/url");o(r,i),r.prototype._start=function(t,e,r){var i=this,o=new n.XDomainRequest;e=u.addQuery(e,"t="+ +new Date),o.onerror=function(){i._error()},o.ontimeout=function(){i._error()},o.onprogress=function(){i.emit("chunk",200,o.responseText)},o.onload=function(){i.emit("finish",200,o.responseText),i._cleanup(!1)},this.xdr=o,this.unloadRef=s.unloadAdd(function(){i._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(a){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){this._cleanup(!0)},r.enabled=!(!n.XDomainRequest||!a.hasDomain()),e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/browser":44,"../../utils/event":46,"../../utils/url":52,debug:void 0,events:3,inherits:54}],35:[function(t,e){"use strict";function n(t,e,n,r){i.call(this,t,e,n,r)}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled&&i.supportsCORS,e.exports=n},{"../driver/xhr":17,inherits:54}],36:[function(t,e){"use strict";function n(){var t=this;r.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},n.timeout)}var r=t("events").EventEmitter,i=t("inherits");i(n,r),n.prototype.close=function(){clearTimeout(this.to)},n.timeout=2e3,e.exports=n},{events:3,inherits:54}],37:[function(t,e){"use strict";function n(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var r=t("inherits"),i=t("../driver/xhr");r(n,i),n.enabled=i.enabled,e.exports=n},{"../driver/xhr":17,inherits:54}],38:[function(t,e){"use strict";function n(t){if(!n.enabled())throw new Error("Transport created when disabled");s.call(this);var e=this,o=i.addPath(t,"/websocket");o="https"===o.slice(0,5)?"wss"+o.slice(5):"ws"+o.slice(4),this.url=o,this.ws=new a(this.url),this.ws.onmessage=function(t){e.emit("message",t.data)},this.unloadRef=r.unloadAdd(function(){e.ws.close()}),this.ws.onclose=function(t){e.emit("close",t.code,t.reason),e._cleanup()},this.ws.onerror=function(t){e.emit("close",1006,"WebSocket connection broken"),e._cleanup()}}var r=t("../utils/event"),i=t("../utils/url"),o=t("inherits"),s=t("events").EventEmitter,a=t("./driver/websocket");o(n,s),n.prototype.send=function(t){var e="["+t+"]";this.ws.send(e)},n.prototype.close=function(){this.ws&&this.ws.close(),this._cleanup()},n.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),r.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},n.enabled=function(){return!!a},n.transportName="websocket",n.roundTrips=2,e.exports=n},{"../utils/event":46,"../utils/url":52,"./driver/websocket":19,debug:void 0,events:3,inherits:54}],39:[function(t,e){"use strict";function n(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",s,a)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./xdr-streaming"),s=t("./receiver/xhr"),a=t("./sender/xdr");r(n,i),n.enabled=o.enabled,n.transportName="xdr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,"./xdr-streaming":40,inherits:54}],40:[function(t,e){"use strict";function n(t){if(!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xdr");r(n,i),n.enabled=function(t){return t.cookie_needed||t.nullOrigin?!1:s.enabled&&t.sameScheme},n.transportName="xdr-streaming",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xdr":34,inherits:54}],41:[function(t,e){"use strict";function n(t){if(!a.enabled&&!s.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr",o,s)}var r=t("inherits"),i=t("./lib/ajax-based"),o=t("./receiver/xhr"),s=t("./sender/xhr-cors"),a=t("./sender/xhr-local");r(n,i),n.enabled=function(t){return t.nullOrigin?!1:a.enabled&&t.sameOrigin?!0:s.enabled},n.transportName="xhr-polling",n.roundTrips=2,e.exports=n},{"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],42:[function(t,e){(function(n){"use strict";function r(t){if(!u.enabled&&!a.enabled)throw new Error("Transport created when disabled");o.call(this,t,"/xhr_streaming",s,a)}var i=t("inherits"),o=t("./lib/ajax-based"),s=t("./receiver/xhr"),a=t("./sender/xhr-cors"),u=t("./sender/xhr-local"),l=t("../utils/browser");i(r,o),r.enabled=function(t){return t.nullOrigin?!1:l.isOpera()?!1:a.enabled},r.transportName="xhr-streaming",r.roundTrips=2,r.needBody=!!n.document,e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/browser":44,"./lib/ajax-based":24,"./receiver/xhr":32,"./sender/xhr-cors":35,"./sender/xhr-local":37,inherits:54}],43:[function(t,e){(function(t){"use strict";e.exports.randomBytes=t.crypto&&t.crypto.getRandomValues?function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:function(t){for(var e=new Array(t),n=0;t>n;n++)e[n]=Math.floor(256*Math.random());return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],44:[function(t,e){(function(t){"use strict";e.exports={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],45:[function(t,e){"use strict";var n,r=t("json3"),i=/[\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,o=function(t){var e,n={},r=[];for(e=0;65536>e;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};e.exports={quote:function(t){var e=r.stringify(t);return i.lastIndex=0,i.test(e)?(n||(n=o(i)),e.replace(i,function(t){return n[t]})):e}}},{json3:55}],46:[function(t,e){(function(n){"use strict";var r=t("./random"),i={},o=!1,s=n.chrome&&n.chrome.app&&n.chrome.app.runtime;e.exports={attachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.addEventListener(t,e,!1):n.document&&n.attachEvent&&(n.document.attachEvent("on"+t,e),n.attachEvent("on"+t,e))},detachEvent:function(t,e){"undefined"!=typeof n.addEventListener?n.removeEventListener(t,e,!1):n.document&&n.detachEvent&&(n.document.detachEvent("on"+t,e),n.detachEvent("on"+t,e))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return i[e]=t,o&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in i&&delete i[t]},triggerUnloadCallbacks:function(){for(var t in i)i[t](),delete i[t]}};var a=function(){o||(o=!0,e.exports.triggerUnloadCallbacks())};s||e.exports.attachEvent("unload",a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./random":50}],47:[function(t,e){(function(n){"use strict";var r=t("./event"),i=t("json3"),o=t("./browser");e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in n||(n[e.exports.WPrefix]={})},postMessage:function(t,r){n.parent!==n&&n.parent.postMessage(i.stringify({windowId:e.exports.currentWindowId,type:t,data:r||""}),"*")},createIframe:function(t,e){var i,o,s=n.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(t){}s.onerror=null},u=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),r.unloadDel(o))},l=function(t){s&&(u(),e(t))},c=function(t,e){try{setTimeout(function(){s&&s.contentWindow&&s.contentWindow.postMessage(t,e)},0)}catch(n){}};return s.src=t,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},n.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=r.unloadAdd(u),{post:c,cleanup:u,loaded:a}},createHtmlfile:function(t,i){var o,s,a,u=["Active"].concat("Object").join("X"),l=new n[u]("htmlfile"),c=function(){clearTimeout(o),a.onerror=null},f=function(){l&&(c(),r.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},h=function(t){l&&(f(),i(t))},d=function(t,e){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(n){}};l.open(),l.write('<html><script>document.domain="'+n.document.domain+'";</script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=n[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=t,a.onerror=function(){h("onerror")},o=setTimeout(function(){h("timeout")},15e3),s=r.unloadAdd(f),{post:d,cleanup:f,loaded:c}}},e.exports.iframeEnabled=!1,n.document&&(e.exports.iframeEnabled=("function"==typeof n.postMessage||"object"==typeof n.postMessage)&&!o.isKonqueror())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./browser":44,"./event":46,debug:void 0,json3:55}],48:[function(t,e){(function(t){"use strict";var n={};["log","debug","warn"].forEach(function(e){var r=t.console&&t.console[e]&&t.console[e].apply;n[e]=r?function(){return t.console[e].apply(t.console,arguments)}:"log"===e?function(){}:n.log}),e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],49:[function(t,e){"use strict";e.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,i=arguments.length;i>r;r++){e=arguments[r];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},{}],50:[function(t,e){"use strict";var n=t("crypto"),r="abcdefghijklmnopqrstuvwxyz012345";e.exports={string:function(t){for(var e=r.length,i=n.randomBytes(t),o=[],s=0;t>s;s++)o.push(r.substr(i[s]%e,1));return o.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},{crypto:43}],51:[function(t,e){"use strict";e.exports=function(t){return{filterToEnabled:function(e,n){var r={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){t&&("websocket"!==t.transportName||n.websocket!==!1)&&(e.length&&-1===e.indexOf(t.transportName)||t.enabled(n)&&(r.main.push(t),t.facadeTransport&&r.facade.push(t.facadeTransport)))}),r}}}},{debug:void 0}],52:[function(t,e){"use strict";var n=t("url-parse");e.exports={getOrigin:function(t){if(!t)return null;var e=new n(t);if("file:"===e.protocol)return null;var r=e.port;return r||(r="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+r},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(-1===t.indexOf("?")?"?"+e:"&"+e)}}},{debug:void 0,"url-parse":56}],53:[function(t,e){e.exports="1.0.3"},{}],54:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],55:[function(e,n,r){(function(e){(function(){function i(t,e){function n(t){if(n[t]!==m)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,c="function"==typeof u&&g;if(c){(s=function(){return 1}).toJSON=s;try{c="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===m&&u(m)===m&&u()===m&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([m])&&"null"==u(null)&&"[null,null,null]"==u([m,b,null])&&u({a:[s,!0,!1,null,"\x00\b\n\f\r    "]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new l(-1))}catch(f){c=!1}}i=c}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var d=5==s.a.length&&1===s.a[0];if(d){try{d=!h('" "')}catch(f){}if(d)try{d=1!==h("01")}catch(f){}if(d)try{d=1!==h("1.")}catch(f){}}}}catch(f){d=!1}i=d}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,a=t.Object||u.Object,l=t.Date||u.Date,c=t.SyntaxError||u.SyntaxError,f=t.TypeError||u.TypeError,h=t.Math||u.Math,d=t.JSON||u.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var p,v,m,y=a.prototype,b=y.toString,g=new l(-0xc782b5b800cec);try{g=-109252==g.getUTCFullYear()&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(w){}if(!n("json")){var x="[object Function]",_="[object Date]",E="[object Number]",j="[object String]",T="[object Array]",S="[object Boolean]",O=n("bug-string-char-index");if(!g)var C=h.floor,A=[0,31,59,90,120,151,181,212,243,273,304,334],N=function(t,e){return A[e]+365*(t-1970)+C((t-1969+(e=+(e>1)))/4)-C((t-1901+e)/100)+C((t-1601+e)/400)};if((p=y.hasOwnProperty)||(p=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?p=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,p=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,p.call(this,t)}),v=function(t,e){var n,r,i,o=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(i in r)p.call(r,i)&&o++;return n=r=null,o?v=2==o?function(t,e){var n,r={},i=b.call(t)==x;for(n in t)i&&"prototype"==n||p.call(r,n)||!(r[n]=1)||!p.call(t,n)||e(n)}:function(t,e){var n,r,i=b.call(t)==x;for(n in t)i&&"prototype"==n||!p.call(t,n)||(r="constructor"===n)||e(n);(r||p.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],v=function(t,e){var n,i,o=b.call(t)==x,a=!o&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||p;for(n in t)o&&"prototype"==n||!a.call(t,n)||e(n);for(i=r.length;n=r[--i];a.call(t,n)&&e(n));}),v(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I="000000",P=function(t,e){return(I+(e||0)).slice(-t)},L="\\u00",R=function(t){for(var e='"',n=0,r=t.length,i=!O||r>10,o=i&&(O?t.split(""):t);r>n;n++){var s=t.charCodeAt(n);switch(s){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[s];break;default:if(32>s){e+=L+P(2,s.toString(16));break}e+=i?o[n]:t.charAt(n)}}return e+'"'},U=function(t,e,n,r,i,o,s){var a,u,l,c,h,d,y,g,w,x,O,A,k,I,L,M;try{a=e[t]}catch(q){}if("object"==typeof a&&a)if(u=b.call(a),u!=_||p.call(a,"toJSON"))"function"==typeof a.toJSON&&(u!=E&&u!=j&&u!=T||p.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&1/0>a){if(N){for(h=C(a/864e5),l=C(h/365.2425)+1970-1;N(l+1,0)<=h;l++);for(c=C((h-N(l,0))/30.42);N(l,c+1)<=h;c++);h=1+h-N(l,c),d=(a%864e5+864e5)%864e5,y=C(d/36e5)%24,g=C(d/6e4)%60,w=C(d/1e3)%60,x=d%1e3}else l=a.getUTCFullYear(),c=a.getUTCMonth(),h=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(0>=l||l>=1e4?(0>l?"-":"+")+P(6,0>l?-l:l):P(4,l))+"-"+P(2,c+1)+"-"+P(2,h)+"T"+P(2,y)+":"+P(2,g)+":"+P(2,w)+"."+P(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(u=b.call(a),u==S)return""+a;if(u==E)return a>-1/0&&1/0>a?""+a:"null";if(u==j)return R(""+a);if("object"==typeof a){for(I=s.length;I--;)if(s[I]===a)throw f();if(s.push(a),O=[],L=o,o+=i,u==T){for(k=0,I=a.length;I>k;k++)A=U(k,a,n,r,i,o,s),O.push(A===m?"null":A);M=O.length?i?"[\n"+o+O.join(",\n"+o)+"\n"+L+"]":"["+O.join(",")+"]":"[]"}else v(r||a,function(t){var e=U(t,a,n,r,i,o,s);e!==m&&O.push(R(t)+":"+(i?" ":"")+e)}),M=O.length?i?"{\n"+o+O.join(",\n"+o)+"\n"+L+"}":"{"+O.join(",")+"}":"{}";return s.pop(),M}};e.stringify=function(t,e,n){var r,i,o,a;if(s[typeof e]&&e)if((a=b.call(e))==x)i=e;else if(a==T){o={};for(var u,l=0,c=e.length;c>l;u=e[l++],a=b.call(u),(a==j||a==E)&&(o[u]=1));}if(n)if((a=b.call(n))==E){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else a==j&&(r=n.length<=10?n:n.slice(0,10));return U("",(u={},u[""]=t,u),i,o,r,"",[])}}if(!n("json-parse")){var M,q,D=o.fromCharCode,W={92:"\\",34:'"',47:"/",98:"\b",116:"       ",110:"\n",102:"\f",114:"\r"},J=function(){throw M=q=null,c()},B=function(){for(var t,e,n,r,i,o=q,s=o.length;s>M;)switch(i=o.charCodeAt(M)){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=O?o.charAt(M):o[M],M++,t;case 34:for(t="@",M++;s>M;)if(i=o.charCodeAt(M),32>i)J();else if(92==i)switch(i=o.charCodeAt(++M)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=W[i],M++;break;case 117:for(e=++M,n=M+4;n>M;M++)i=o.charCodeAt(M),i>=48&&57>=i||i>=97&&102>=i||i>=65&&70>=i||J();t+=D("0x"+o.slice(e,M));break;default:J()}else{if(34==i)break;for(i=o.charCodeAt(M),e=M;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++M);t+=o.slice(e,M)}if(34==o.charCodeAt(M))return M++,t;J();default:if(e=M,45==i&&(r=!0,i=o.charCodeAt(++M)),i>=48&&57>=i){for(48==i&&(i=o.charCodeAt(M+1),i>=48&&57>=i)&&J(),r=!1;s>M&&(i=o.charCodeAt(M),i>=48&&57>=i);M++);if(46==o.charCodeAt(M)){for(n=++M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}if(i=o.charCodeAt(M),101==i||69==i){for(i=o.charCodeAt(++M),(43==i||45==i)&&M++,n=M;s>n&&(i=o.charCodeAt(n),i>=48&&57>=i);n++);n==M&&J(),M=n}return+o.slice(e,M)}if(r&&J(),"true"==o.slice(M,M+4))return M+=4,!0;if("false"==o.slice(M,M+5))return M+=5,!1;if("null"==o.slice(M,M+4))return M+=4,null;J()}return"$"},G=function(t){var e,n;if("$"==t&&J(),"string"==typeof t){if("@"==(O?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=B(),"]"!=t;n||(n=!0))n&&(","==t?(t=B(),"]"==t&&J()):J()),","==t&&J(),e.push(G(t));return e}if("{"==t){for(e={};t=B(),"}"!=t;n||(n=!0))n&&(","==t?(t=B(),"}"==t&&J()):J()),(","==t||"string"!=typeof t||"@"!=(O?t.charAt(0):t[0])||":"!=B())&&J(),e[t.slice(1)]=G(B());return e}J()}return t},F=function(t,e,n){var r=H(t,e,n);r===m?delete t[e]:t[e]=r},H=function(t,e,n){var r,i=t[e];if("object"==typeof i&&i)if(b.call(i)==T)for(r=i.length;r--;)F(i,r,n);else v(i,function(t){F(i,t,n)});return n.call(t,e,i)};e.parse=function(t,e){var n,r;return M=0,q=""+t,n=G(B()),"$"!=B()&&J(),M=q=null,e&&b.call(e)==x?H((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var o="function"==typeof t&&t.amd,s={"function":!0,object:!0},a=s[typeof r]&&r&&!r.nodeType&&r,u=s[typeof window]&&window||this,l=a&&s[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),a&&!o)i(u,a);else{var c=u.JSON,f=u.JSON3,h=!1,d=i(u,u.JSON3={noConflict:function(){return h||(h=!0,u.JSON=c,u.JSON3=f,c=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}o&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(t,e){"use strict";function n(t,e,u){if(!(this instanceof n))return new n(t,e,u);var l,c,f,h,d=s.test(t),p=typeof e,v=this,m=0;for("object"!==p&&"string"!==p&&(u=e,e=null),u&&"function"!=typeof u&&(u=o.parse),e=i(e);m<a.length;m++)c=a[m],l=c[0],h=c[1],l!==l?v[h]=t:"string"==typeof l?~(f=t.indexOf(l))&&("number"==typeof c[2]?(v[h]=t.slice(0,f),t=t.slice(f+c[2])):(v[h]=t.slice(f),t=t.slice(0,f))):(f=l.exec(t))&&(v[h]=f[1],t=t.slice(0,t.length-f[0].length)),v[h]=v[h]||(c[3]||"port"===h&&d?e[h]||"":""),c[4]&&(v[h]=v[h].toLowerCase());u&&(v.query=u(v.query)),r(v.port,v.protocol)||(v.host=v.hostname,v.port=""),v.username=v.password="",v.auth&&(c=v.auth.split(":"),v.username=c[0]||"",v.password=c[1]||""),v.href=v.toString()}var r=t("requires-port"),i=t("./lolcation"),o=t("querystringify"),s=/^\/(?!\/)/,a=[["#","hash"],["?","query"],["//","protocol",2,1,1],["/","pathname"],["@","auth",1],[0/0,"host",void 0,1,1],[/\:(\d+)$/,"port"],[0/0,"hostname",void 0,1,1]];n.prototype.set=function(t,e,n){var i=this;return"query"===t?("string"==typeof e&&(e=(n||o.parse)(e)),i[t]=e):"port"===t?(i[t]=e,r(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="")):"hostname"===t?(i[t]=e,i.port&&(e+=":"+i.port),i.host=e):"host"===t?(i[t]=e,/\:\d+/.test(e)&&(e=e.split(":"),i.hostname=e[0],i.port=e[1])):i[t]=e,i.href=i.toString(),i},n.prototype.toString=function(t){t&&"function"==typeof t||(t=o.stringify);var e,n=this,r=n.protocol+"//";return n.username&&(r+=n.username,n.password&&(r+=":"+n.password),r+="@"),r+=n.hostname,n.port&&(r+=":"+n.port),r+=n.pathname,n.query&&(e="object"==typeof n.query?t(n.query):n.query,r+=("?"===e.charAt(0)?"":"?")+e),n.hash&&(r+=n.hash),r},n.qs=o,n.location=i,e.exports=n},{"./lolcation":57,querystringify:58,"requires-port":59}],57:[function(t,e){(function(n){"use strict";var r,i={hash:1,query:1};e.exports=function(e){e=e||n.location||{},r=r||t("./");var o,s={},a=typeof e;if("blob:"===e.protocol)s=new r(unescape(e.pathname),{});else if("string"===a){s=new r(e,{});for(o in i)delete s[o]}else if("object"===a)for(o in e)o in i||(s[o]=e[o]);return s}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":56}],58:[function(t,e,n){"use strict";function r(t){for(var e,n=/([^=?&]+)=([^&]*)/g,r={};e=n.exec(t);r[decodeURIComponent(e[1])]=decodeURIComponent(e[2]));return r}function i(t,e){e=e||"";var n=[];"string"!=typeof e&&(e="?");for(var r in t)o.call(t,r)&&n.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return n.length?e+n.join("&"):""}var o=Object.prototype.hasOwnProperty;n.stringify=i,n.parse=r},{}],59:[function(t,e){"use strict";e.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 22!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},{}]},{},[1])(1)});
\ No newline at end of file
diff --git a/src/stylus/style.styl b/src/stylus/style.styl
new file mode 100644 (file)
index 0000000..aa8d798
--- /dev/null
@@ -0,0 +1,25 @@
+table.axes
+  border-collapse collapse
+
+  td, th
+    border 1px solid black
+    text-align center
+
+  .axis
+    .name
+      font-size 24pt
+
+
+.gauge
+  position relative
+
+  span
+    font-weight bold
+    color #000
+    text-shadow 0 0 2px #fff
+    font-size 20pt
+    text-align center
+    position absolute
+    left 0
+    right 0
+    top 75px