';
+}
+
+/**
+ * Load and cache the given `icon`.
+ *
+ * @param {String} icon
+ * @return {String}
+ * @api private
+ */
+
+function load(icon) {
+ if (cache[icon]) return cache[icon];
+ return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64');
+}
+
+/**
+ * Filter "hidden" `files`, aka files
+ * beginning with a `.`.
+ *
+ * @param {Array} files
+ * @return {Array}
+ * @api private
+ */
+
+function removeHidden(files) {
+ return files.filter(function(file){
+ return '.' != file[0];
+ });
+}
+
+/**
+ * Icon map.
+ */
+
+var icons = {
+ '.js': 'page_white_code_red.png'
+ , '.c': 'page_white_c.png'
+ , '.h': 'page_white_h.png'
+ , '.cc': 'page_white_cplusplus.png'
+ , '.php': 'page_white_php.png'
+ , '.rb': 'page_white_ruby.png'
+ , '.cpp': 'page_white_cplusplus.png'
+ , '.swf': 'page_white_flash.png'
+ , '.pdf': 'page_white_acrobat.png'
+ , 'default': 'page_white.png'
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
new file mode 100644
index 0000000..4a84edc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
@@ -0,0 +1,86 @@
+/*!
+ * Connect - errorHandler
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , fs = require('fs');
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Error handler:
+ *
+ * Development error handler, providing stack traces
+ * and error message responses for requests accepting text, html,
+ * or json.
+ *
+ * Text:
+ *
+ * By default, and when _text/plain_ is accepted a simple stack trace
+ * or error message will be returned.
+ *
+ * JSON:
+ *
+ * When _application/json_ is accepted, connect will respond with
+ * an object in the form of `{ "error": error }`.
+ *
+ * HTML:
+ *
+ * When accepted connect will output a nice html stack trace.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function errorHandler(){
+ return function errorHandler(err, req, res, next){
+ if (err.status) res.statusCode = err.status;
+ if (res.statusCode < 400) res.statusCode = 500;
+ if ('test' != env) console.error(err.stack);
+ var accept = req.headers.accept || '';
+ // html
+ if (~accept.indexOf('html')) {
+ fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){
+ fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){
+ var stack = (err.stack || '')
+ .split('\n').slice(1)
+ .map(function(v){ return '
' + v + '
'; }).join('');
+ html = html
+ .replace('{style}', style)
+ .replace('{stack}', stack)
+ .replace('{title}', exports.title)
+ .replace('{statusCode}', res.statusCode)
+ .replace(/\{error\}/g, utils.escape(err.toString()));
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
+ res.end(html);
+ });
+ });
+ // json
+ } else if (~accept.indexOf('json')) {
+ var error = { message: err.message, stack: err.stack };
+ for (var prop in err) error[prop] = err[prop];
+ var json = JSON.stringify({ error: error });
+ res.setHeader('Content-Type', 'application/json');
+ res.end(json);
+ // plain text
+ } else {
+ res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' });
+ res.end(err.stack);
+ }
+ };
+};
+
+/**
+ * Template title, framework authors may override this value.
+ */
+
+exports.title = 'Connect';
diff --git a/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/node_modules/express/node_modules/connect/lib/middleware/favicon.js
new file mode 100644
index 0000000..c57bf34
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/favicon.js
@@ -0,0 +1,81 @@
+
+/*!
+ * Connect - favicon
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+ , utils = require('../utils');
+
+/**
+ * Favicon:
+ *
+ * By default serves the connect favicon, or the favicon
+ * located by the given `path`.
+ *
+ * Options:
+ *
+ * - `maxAge` cache-control max-age directive, defaulting to 1 day
+ *
+ * Examples:
+ *
+ * Serve default favicon:
+ *
+ * connect()
+ * .use(connect.favicon())
+ *
+ * Serve favicon before logging for brevity:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.logger('dev'))
+ *
+ * Serve custom favicon:
+ *
+ * connect()
+ * .use(connect.favicon('public/favicon.ico))
+ *
+ * @param {String} path
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function favicon(path, options){
+ var options = options || {}
+ , path = path || __dirname + '/../public/favicon.ico'
+ , maxAge = options.maxAge || 86400000
+ , icon; // favicon cache
+
+ return function favicon(req, res, next){
+ if ('/favicon.ico' == req.url) {
+ if (icon) {
+ res.writeHead(200, icon.headers);
+ res.end(icon.body);
+ } else {
+ fs.readFile(path, function(err, buf){
+ if (err) return next(err);
+ icon = {
+ headers: {
+ 'Content-Type': 'image/x-icon'
+ , 'Content-Length': buf.length
+ , 'ETag': '"' + utils.md5(buf) + '"'
+ , 'Cache-Control': 'public, max-age=' + (maxAge / 1000)
+ },
+ body: buf
+ };
+ res.writeHead(200, icon.headers);
+ res.end(icon.body);
+ });
+ }
+ } else {
+ next();
+ }
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/json.js b/node_modules/express/node_modules/connect/lib/middleware/json.js
new file mode 100644
index 0000000..200006b
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/json.js
@@ -0,0 +1,86 @@
+
+/*!
+ * Connect - json
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , _limit = require('./limit');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * JSON:
+ *
+ * Parse JSON request bodies, providing the
+ * parsed object as `req.body`.
+ *
+ * Options:
+ *
+ * - `strict` when `false` anything `JSON.parse()` accepts will be parsed
+ * - `reviver` used as the second "reviver" argument for JSON.parse
+ * - `limit` byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ var options = options || {}
+ , strict = options.strict !== false;
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function json(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+
+ if (!utils.hasBody(req)) return next();
+
+ // check Content-Type
+ if ('application/json' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+ var buf = '';
+ req.setEncoding('utf8');
+ req.on('data', function(chunk){ buf += chunk });
+ req.on('end', function(){
+ var first = buf.trim()[0];
+
+ if (0 == buf.length) {
+ return next(400, 'invalid json, empty body');
+ }
+
+ if (strict && '{' != first && '[' != first) return next(400, 'invalid json');
+ try {
+ req.body = JSON.parse(buf, options.reviver);
+ next();
+ } catch (err){
+ err.body = buf;
+ err.status = 400;
+ next(err);
+ }
+ });
+ });
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/limit.js b/node_modules/express/node_modules/connect/lib/middleware/limit.js
new file mode 100644
index 0000000..614787d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/limit.js
@@ -0,0 +1,55 @@
+
+/*!
+ * Connect - limit
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Limit:
+ *
+ * Limit request bodies to the given size in `bytes`.
+ *
+ * A string representation of the bytesize may also be passed,
+ * for example "5mb", "200kb", "1gb", etc.
+ *
+ * connect()
+ * .use(connect.limit('5.5mb'))
+ * .use(handleImageUpload)
+ *
+ * @param {Number|String} bytes
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function limit(bytes){
+ if ('string' == typeof bytes) bytes = utils.parseBytes(bytes);
+ if ('number' != typeof bytes) throw new Error('limit() bytes required');
+ return function limit(req, res, next){
+ var received = 0
+ , len = req.headers['content-length']
+ ? parseInt(req.headers['content-length'], 10)
+ : null;
+
+ // self-awareness
+ if (req._limit) return next();
+ req._limit = true;
+
+ // limit by content-length
+ if (len && len > bytes) return next(413);
+
+ // limit
+ req.on('data', function(chunk){
+ received += chunk.length;
+ if (received > bytes) req.destroy();
+ });
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/logger.js b/node_modules/express/node_modules/connect/lib/middleware/logger.js
new file mode 100644
index 0000000..de72244
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/logger.js
@@ -0,0 +1,339 @@
+/*!
+ * Connect - logger
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var bytes = require('bytes');
+
+/*!
+ * Log buffer.
+ */
+
+var buf = [];
+
+/*!
+ * Default log buffer duration.
+ */
+
+var defaultBufferDuration = 1000;
+
+/**
+ * Logger:
+ *
+ * Log requests with the given `options` or a `format` string.
+ *
+ * Options:
+ *
+ * - `format` Format string, see below for tokens
+ * - `stream` Output stream, defaults to _stdout_
+ * - `buffer` Buffer duration, defaults to 1000ms when _true_
+ * - `immediate` Write log line on request instead of response (for response times)
+ *
+ * Tokens:
+ *
+ * - `:req[header]` ex: `:req[Accept]`
+ * - `:res[header]` ex: `:res[Content-Length]`
+ * - `:http-version`
+ * - `:response-time`
+ * - `:remote-addr`
+ * - `:date`
+ * - `:method`
+ * - `:url`
+ * - `:referrer`
+ * - `:user-agent`
+ * - `:status`
+ *
+ * Formats:
+ *
+ * Pre-defined formats that ship with connect:
+ *
+ * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
+ * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
+ * - `tiny` ':method :url :status :res[content-length] - :response-time ms'
+ * - `dev` concise output colored by response status for development use
+ *
+ * Examples:
+ *
+ * connect.logger() // default
+ * connect.logger('short')
+ * connect.logger('tiny')
+ * connect.logger({ immediate: true, format: 'dev' })
+ * connect.logger(':method :url - :referrer')
+ * connect.logger(':req[content-type] -> :res[content-type]')
+ * connect.logger(function(tokens, req, res){ return 'some format string' })
+ *
+ * Defining Tokens:
+ *
+ * To define a token, simply invoke `connect.logger.token()` with the
+ * name and a callback function. The value returned is then available
+ * as ":type" in this case.
+ *
+ * connect.logger.token('type', function(req, res){ return req.headers['content-type']; })
+ *
+ * Defining Formats:
+ *
+ * All default formats are defined this way, however it's public API as well:
+ *
+ * connect.logger.format('name', 'string or function')
+ *
+ * @param {String|Function|Object} format or options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function logger(options) {
+ if ('object' == typeof options) {
+ options = options || {};
+ } else if (options) {
+ options = { format: options };
+ } else {
+ options = {};
+ }
+
+ // output on request instead of response
+ var immediate = options.immediate;
+
+ // format name
+ var fmt = exports[options.format] || options.format || exports.default;
+
+ // compile format
+ if ('function' != typeof fmt) fmt = compile(fmt);
+
+ // options
+ var stream = options.stream || process.stdout
+ , buffer = options.buffer;
+
+ // buffering support
+ if (buffer) {
+ var realStream = stream
+ , interval = 'number' == typeof buffer
+ ? buffer
+ : defaultBufferDuration;
+
+ // flush interval
+ setInterval(function(){
+ if (buf.length) {
+ realStream.write(buf.join(''));
+ buf.length = 0;
+ }
+ }, interval);
+
+ // swap the stream
+ stream = {
+ write: function(str){
+ buf.push(str);
+ }
+ };
+ }
+
+ return function logger(req, res, next) {
+ req._startTime = new Date;
+
+ // immediate
+ if (immediate) {
+ var line = fmt(exports, req, res);
+ if (null == line) return;
+ stream.write(line + '\n');
+ // proxy end to output logging
+ } else {
+ var end = res.end;
+ res.end = function(chunk, encoding){
+ res.end = end;
+ res.end(chunk, encoding);
+ var line = fmt(exports, req, res);
+ if (null == line) return;
+ stream.write(line + '\n');
+ };
+ }
+
+
+ next();
+ };
+};
+
+/**
+ * Compile `fmt` into a function.
+ *
+ * @param {String} fmt
+ * @return {Function}
+ * @api private
+ */
+
+function compile(fmt) {
+ fmt = fmt.replace(/"/g, '\\"');
+ var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){
+ return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "';
+ }) + '";'
+ return new Function('tokens, req, res', js);
+};
+
+/**
+ * Define a token function with the given `name`,
+ * and callback `fn(req, res)`.
+ *
+ * @param {String} name
+ * @param {Function} fn
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.token = function(name, fn) {
+ exports[name] = fn;
+ return this;
+};
+
+/**
+ * Define a `fmt` with the given `name`.
+ *
+ * @param {String} name
+ * @param {String|Function} fmt
+ * @return {Object} exports for chaining
+ * @api public
+ */
+
+exports.format = function(name, str){
+ exports[name] = str;
+ return this;
+};
+
+/**
+ * Default format.
+ */
+
+exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
+
+/**
+ * Short format.
+ */
+
+exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');
+
+/**
+ * Tiny format.
+ */
+
+exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');
+
+/**
+ * dev (colored)
+ */
+
+exports.format('dev', function(tokens, req, res){
+ var status = res.statusCode
+ , len = parseInt(res.getHeader('Content-Length'), 10)
+ , color = 32;
+
+ if (status >= 500) color = 31
+ else if (status >= 400) color = 33
+ else if (status >= 300) color = 36;
+
+ len = isNaN(len)
+ ? ''
+ : len = ' - ' + bytes(len);
+
+ return '\033[90m' + req.method
+ + ' ' + req.originalUrl + ' '
+ + '\033[' + color + 'm' + res.statusCode
+ + ' \033[90m'
+ + (new Date - req._startTime)
+ + 'ms' + len
+ + '\033[0m';
+});
+
+/**
+ * request url
+ */
+
+exports.token('url', function(req){
+ return req.originalUrl || req.url;
+});
+
+/**
+ * request method
+ */
+
+exports.token('method', function(req){
+ return req.method;
+});
+
+/**
+ * response time in milliseconds
+ */
+
+exports.token('response-time', function(req){
+ return new Date - req._startTime;
+});
+
+/**
+ * UTC date
+ */
+
+exports.token('date', function(){
+ return new Date().toUTCString();
+});
+
+/**
+ * response status code
+ */
+
+exports.token('status', function(req, res){
+ return res.statusCode;
+});
+
+/**
+ * normalized referrer
+ */
+
+exports.token('referrer', function(req){
+ return req.headers['referer'] || req.headers['referrer'];
+});
+
+/**
+ * remote address
+ */
+
+exports.token('remote-addr', function(req){
+ if (req.ip) return req.ip;
+ var sock = req.socket;
+ if (sock.socket) return sock.socket.remoteAddress;
+ return sock.remoteAddress;
+});
+
+/**
+ * HTTP version
+ */
+
+exports.token('http-version', function(req){
+ return req.httpVersionMajor + '.' + req.httpVersionMinor;
+});
+
+/**
+ * UA string
+ */
+
+exports.token('user-agent', function(req){
+ return req.headers['user-agent'];
+});
+
+/**
+ * request header
+ */
+
+exports.token('req', function(req, res, field){
+ return req.headers[field.toLowerCase()];
+});
+
+/**
+ * response header
+ */
+
+exports.token('res', function(req, res, field){
+ return (res._headers || {})[field.toLowerCase()];
+});
+
diff --git a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
new file mode 100644
index 0000000..aaf4014
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
@@ -0,0 +1,40 @@
+
+/*!
+ * Connect - methodOverride
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Method Override:
+ *
+ * Provides faux HTTP method support.
+ *
+ * Pass an optional `key` to use when checking for
+ * a method override, othewise defaults to _\_method_.
+ * The original method is available via `req.originalMethod`.
+ *
+ * @param {String} key
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function methodOverride(key){
+ key = key || "_method";
+ return function methodOverride(req, res, next) {
+ req.originalMethod = req.originalMethod || req.method;
+
+ // req.body
+ if (req.body && key in req.body) {
+ req.method = req.body[key].toUpperCase();
+ delete req.body[key];
+ // check X-HTTP-Method-Override
+ } else if (req.headers['x-http-method-override']) {
+ req.method = req.headers['x-http-method-override'].toUpperCase();
+ }
+
+ next();
+ };
+};
+
diff --git a/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/node_modules/express/node_modules/connect/lib/middleware/multipart.js
new file mode 100644
index 0000000..7b26fae
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/multipart.js
@@ -0,0 +1,133 @@
+/*!
+ * Connect - multipart
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var formidable = require('formidable')
+ , _limit = require('./limit')
+ , utils = require('../utils')
+ , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * Multipart:
+ *
+ * Parse multipart/form-data request bodies,
+ * providing the parsed object as `req.body`
+ * and `req.files`.
+ *
+ * Configuration:
+ *
+ * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s
+ * `IncomingForm` object, allowing you to configure the upload directory,
+ * size limits, etc. For example if you wish to change the upload dir do the following.
+ *
+ * app.use(connect.multipart({ uploadDir: path }));
+ *
+ * Options:
+ *
+ * - `limit` byte limit defaulting to none
+ * - `defer` defers processing and exposes the Formidable form object as `req.form`.
+ * `next()` is called without waiting for the form's "end" event.
+ * This option is useful if you need to bind to the "progress" event, for example.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ options = options || {};
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function multipart(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+ req.files = req.files || {};
+
+ if (!utils.hasBody(req)) return next();
+
+ // ignore GET
+ if ('GET' == req.method || 'HEAD' == req.method) return next();
+
+ // check Content-Type
+ if ('multipart/form-data' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+
+ var form = new formidable.IncomingForm
+ , data = {}
+ , files = {}
+ , done;
+
+ Object.keys(options).forEach(function(key){
+ form[key] = options[key];
+ });
+
+ function ondata(name, val, data){
+ if (Array.isArray(data[name])) {
+ data[name].push(val);
+ } else if (data[name]) {
+ data[name] = [data[name], val];
+ } else {
+ data[name] = val;
+ }
+ }
+
+ form.on('field', function(name, val){
+ ondata(name, val, data);
+ });
+
+ form.on('file', function(name, val){
+ ondata(name, val, files);
+ });
+
+ form.on('error', function(err){
+ if (!options.defer) {
+ err.status = 400;
+ next(err);
+ }
+ done = true;
+ });
+
+ form.on('end', function(){
+ if (done) return;
+ try {
+ req.body = qs.parse(data);
+ req.files = qs.parse(files);
+ if (!options.defer) next();
+ } catch (err) {
+ form.emit('error', err);
+ }
+ });
+
+ form.parse(req);
+
+ if (options.defer) {
+ req.form = form;
+ next();
+ }
+ });
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/query.js b/node_modules/express/node_modules/connect/lib/middleware/query.js
new file mode 100644
index 0000000..93fc5d3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/query.js
@@ -0,0 +1,46 @@
+/*!
+ * Connect - query
+ * Copyright(c) 2011 TJ Holowaychuk
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var qs = require('qs')
+ , parse = require('../utils').parseUrl;
+
+/**
+ * Query:
+ *
+ * Automatically parse the query-string when available,
+ * populating the `req.query` object.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.query())
+ * .use(function(req, res){
+ * res.end(JSON.stringify(req.query));
+ * });
+ *
+ * The `options` passed are provided to qs.parse function.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function query(options){
+ return function query(req, res, next){
+ if (!req.query) {
+ req.query = ~req.url.indexOf('?')
+ ? qs.parse(parse(req).query, options)
+ : {};
+ }
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
new file mode 100644
index 0000000..62abc04
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
@@ -0,0 +1,32 @@
+
+/*!
+ * Connect - responseTime
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Reponse time:
+ *
+ * Adds the `X-Response-Time` header displaying the response
+ * duration in milliseconds.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function responseTime(){
+ return function(req, res, next){
+ var start = new Date;
+
+ if (res._responseTime) return next();
+ res._responseTime = true;
+
+ res.on('header', function(){
+ var duration = new Date - start;
+ res.setHeader('X-Response-Time', duration + 'ms');
+ });
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session.js b/node_modules/express/node_modules/connect/lib/middleware/session.js
new file mode 100644
index 0000000..f97b8d6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session.js
@@ -0,0 +1,352 @@
+
+/*!
+ * Connect - session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Session = require('./session/session')
+ , debug = require('debug')('connect:session')
+ , MemoryStore = require('./session/memory')
+ , signature = require('cookie-signature')
+ , Cookie = require('./session/cookie')
+ , Store = require('./session/store')
+ , utils = require('./../utils')
+ , parse = utils.parseUrl
+ , crc32 = require('buffer-crc32');
+
+// environment
+
+var env = process.env.NODE_ENV;
+
+/**
+ * Expose the middleware.
+ */
+
+exports = module.exports = session;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Store = Store;
+exports.Cookie = Cookie;
+exports.Session = Session;
+exports.MemoryStore = MemoryStore;
+
+/**
+ * Warning message for `MemoryStore` usage in production.
+ */
+
+var warning = 'Warning: connection.session() MemoryStore is not\n'
+ + 'designed for a production environment, as it will leak\n'
+ + 'memory, and will not scale past a single process.';
+
+/**
+ * Session:
+ *
+ * Setup session store with the given `options`.
+ *
+ * Session data is _not_ saved in the cookie itself, however
+ * cookies are used, so we must use the [cookieParser()](cookieParser.html)
+ * middleware _before_ `session()`.
+ *
+ * Examples:
+ *
+ * connect()
+ * .use(connect.cookieParser())
+ * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))
+ *
+ * Options:
+ *
+ * - `key` cookie name defaulting to `connect.sid`
+ * - `store` session store instance
+ * - `secret` session cookie is signed with this secret to prevent tampering
+ * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }`
+ * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto")
+ *
+ * Cookie option:
+ *
+ * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set
+ * so the cookie becomes a browser-session cookie. When the user closes the
+ * browser the cookie (and session) will be removed.
+ *
+ * ## req.session
+ *
+ * To store or access session data, simply use the request property `req.session`,
+ * which is (generally) serialized as JSON by the store, so nested objects
+ * are typically fine. For example below is a user-specific view counter:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.cookieParser())
+ * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))
+ * .use(function(req, res, next){
+ * var sess = req.session;
+ * if (sess.views) {
+ * res.setHeader('Content-Type', 'text/html');
+ * res.write('
views: ' + sess.views + '
');
+ * res.write('
expires in: ' + (sess.cookie.maxAge / 1000) + 's
');
+ * res.end();
+ * sess.views++;
+ * } else {
+ * sess.views = 1;
+ * res.end('welcome to the session demo. refresh!');
+ * }
+ * }
+ * )).listen(3000);
+ *
+ * ## Session#regenerate()
+ *
+ * To regenerate the session simply invoke the method, once complete
+ * a new SID and `Session` instance will be initialized at `req.session`.
+ *
+ * req.session.regenerate(function(err){
+ * // will have a new session here
+ * });
+ *
+ * ## Session#destroy()
+ *
+ * Destroys the session, removing `req.session`, will be re-generated next request.
+ *
+ * req.session.destroy(function(err){
+ * // cannot access session here
+ * });
+ *
+ * ## Session#reload()
+ *
+ * Reloads the session data.
+ *
+ * req.session.reload(function(err){
+ * // session updated
+ * });
+ *
+ * ## Session#save()
+ *
+ * Save the session.
+ *
+ * req.session.save(function(err){
+ * // session saved
+ * });
+ *
+ * ## Session#touch()
+ *
+ * Updates the `.maxAge` property. Typically this is
+ * not necessary to call, as the session middleware does this for you.
+ *
+ * ## Session#cookie
+ *
+ * Each session has a unique cookie object accompany it. This allows
+ * you to alter the session cookie per visitor. For example we can
+ * set `req.session.cookie.expires` to `false` to enable the cookie
+ * to remain for only the duration of the user-agent.
+ *
+ * ## Session#maxAge
+ *
+ * Alternatively `req.session.cookie.maxAge` will return the time
+ * remaining in milliseconds, which we may also re-assign a new value
+ * to adjust the `.expires` property appropriately. The following
+ * are essentially equivalent
+ *
+ * var hour = 3600000;
+ * req.session.cookie.expires = new Date(Date.now() + hour);
+ * req.session.cookie.maxAge = hour;
+ *
+ * For example when `maxAge` is set to `60000` (one minute), and 30 seconds
+ * has elapsed it will return `30000` until the current request has completed,
+ * at which time `req.session.touch()` is called to reset `req.session.maxAge`
+ * to its original value.
+ *
+ * req.session.cookie.maxAge;
+ * // => 30000
+ *
+ * Session Store Implementation:
+ *
+ * Every session store _must_ implement the following methods
+ *
+ * - `.get(sid, callback)`
+ * - `.set(sid, session, callback)`
+ * - `.destroy(sid, callback)`
+ *
+ * Recommended methods include, but are not limited to:
+ *
+ * - `.length(callback)`
+ * - `.clear(callback)`
+ *
+ * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+function session(options){
+ var options = options || {}
+ , key = options.key || 'connect.sid'
+ , store = options.store || new MemoryStore
+ , cookie = options.cookie || {}
+ , trustProxy = options.proxy
+ , storeReady = true;
+
+ // notify user that this store is not
+ // meant for a production environment
+ if ('production' == env && store instanceof MemoryStore) {
+ console.warn(warning);
+ }
+
+ // generates the new session
+ store.generate = function(req){
+ req.sessionID = utils.uid(24);
+ req.session = new Session(req);
+ req.session.cookie = new Cookie(cookie);
+ };
+
+ store.on('disconnect', function(){ storeReady = false; });
+ store.on('connect', function(){ storeReady = true; });
+
+ return function session(req, res, next) {
+ // self-awareness
+ if (req.session) return next();
+
+ // Handle connection as if there is no session if
+ // the store has temporarily disconnected etc
+ if (!storeReady) return debug('store is disconnected'), next();
+
+ // pathname mismatch
+ if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next();
+
+ // backwards compatibility for signed cookies
+ // req.secret is passed from the cookie parser middleware
+ var secret = options.secret || req.secret;
+
+ // ensure secret is available or bail
+ if (!secret) throw new Error('`secret` option required for sessions');
+
+ // parse url
+ var originalHash
+ , originalId;
+
+ // expose store
+ req.sessionStore = store;
+
+ // grab the session cookie value and check the signature
+ var rawCookie = req.cookies[key];
+
+ // get signedCookies for backwards compat with signed cookies
+ var unsignedCookie = req.signedCookies[key];
+
+ if (!unsignedCookie && rawCookie) {
+ unsignedCookie = utils.parseSignedCookie(rawCookie, secret);
+ }
+
+ // set-cookie
+ res.on('header', function(){
+ if (!req.session) return;
+ var cookie = req.session.cookie
+ , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
+ , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
+ , secured = cookie.secure && tls
+ , isNew = unsignedCookie != req.sessionID;
+
+ // only send secure cookies via https
+ if (cookie.secure && !secured) return debug('not secured');
+
+ // browser-session length cookie
+ if (null == cookie.expires) {
+ if (!isNew) return debug('already set browser-session cookie');
+ // compare hashes and ids
+ } else if (originalHash == hash(req.session) && originalId == req.session.id) {
+ return debug('unmodified session');
+ }
+
+ var val = 's:' + signature.sign(req.sessionID, secret);
+ val = cookie.serialize(key, val);
+ debug('set-cookie %s', val);
+ res.setHeader('Set-Cookie', val);
+ });
+
+ // proxy end() to commit the session
+ var end = res.end;
+ res.end = function(data, encoding){
+ res.end = end;
+ if (!req.session) return res.end(data, encoding);
+ debug('saving');
+ req.session.resetMaxAge();
+ req.session.save(function(){
+ debug('saved');
+ res.end(data, encoding);
+ });
+ };
+
+ // generate the session
+ function generate() {
+ store.generate(req);
+ }
+
+ // get the sessionID from the cookie
+ req.sessionID = unsignedCookie;
+
+ // generate a session if the browser doesn't send a sessionID
+ if (!req.sessionID) {
+ debug('no SID sent, generating session');
+ generate();
+ next();
+ return;
+ }
+
+ // generate the session object
+ var pause = utils.pause(req);
+ debug('fetching %s', req.sessionID);
+ store.get(req.sessionID, function(err, sess){
+ // proxy to resume() events
+ var _next = next;
+ next = function(err){
+ _next(err);
+ pause.resume();
+ };
+
+ // error handling
+ if (err) {
+ debug('error');
+ if ('ENOENT' == err.code) {
+ generate();
+ next();
+ } else {
+ next(err);
+ }
+ // no session
+ } else if (!sess) {
+ debug('no session found');
+ generate();
+ next();
+ // populate req.session
+ } else {
+ debug('session found');
+ store.createSession(req, sess);
+ originalId = req.sessionID;
+ originalHash = hash(sess);
+ next();
+ }
+ });
+ };
+};
+
+/**
+ * Hash the given `sess` object omitting changes
+ * to `.cookie`.
+ *
+ * @param {Object} sess
+ * @return {String}
+ * @api private
+ */
+
+function hash(sess) {
+ return crc32.signed(JSON.stringify(sess, function(key, val){
+ if ('cookie' != key) return val;
+ }));
+}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
new file mode 100644
index 0000000..e8ff862
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
@@ -0,0 +1,128 @@
+
+/*!
+ * Connect - session - Cookie
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../../utils')
+ , cookie = require('cookie');
+
+/**
+ * Initialize a new `Cookie` with the given `options`.
+ *
+ * @param {IncomingMessage} req
+ * @param {Object} options
+ * @api private
+ */
+
+var Cookie = module.exports = function Cookie(options) {
+ this.path = '/';
+ this.maxAge = null;
+ this.httpOnly = true;
+ if (options) utils.merge(this, options);
+ this.originalMaxAge = undefined == this.originalMaxAge
+ ? this.maxAge
+ : this.originalMaxAge;
+};
+
+/*!
+ * Prototype.
+ */
+
+Cookie.prototype = {
+
+ /**
+ * Set expires `date`.
+ *
+ * @param {Date} date
+ * @api public
+ */
+
+ set expires(date) {
+ this._expires = date;
+ this.originalMaxAge = this.maxAge;
+ },
+
+ /**
+ * Get expires `date`.
+ *
+ * @return {Date}
+ * @api public
+ */
+
+ get expires() {
+ return this._expires;
+ },
+
+ /**
+ * Set expires via max-age in `ms`.
+ *
+ * @param {Number} ms
+ * @api public
+ */
+
+ set maxAge(ms) {
+ this.expires = 'number' == typeof ms
+ ? new Date(Date.now() + ms)
+ : ms;
+ },
+
+ /**
+ * Get expires max-age in `ms`.
+ *
+ * @return {Number}
+ * @api public
+ */
+
+ get maxAge() {
+ return this.expires instanceof Date
+ ? this.expires.valueOf() - Date.now()
+ : this.expires;
+ },
+
+ /**
+ * Return cookie data object.
+ *
+ * @return {Object}
+ * @api private
+ */
+
+ get data() {
+ return {
+ originalMaxAge: this.originalMaxAge
+ , expires: this._expires
+ , secure: this.secure
+ , httpOnly: this.httpOnly
+ , domain: this.domain
+ , path: this.path
+ }
+ },
+
+ /**
+ * Return a serialized cookie string.
+ *
+ * @return {String}
+ * @api public
+ */
+
+ serialize: function(name, val){
+ return cookie.serialize(name, val, this.data);
+ },
+
+ /**
+ * Return JSON representation of this cookie.
+ *
+ * @return {Object}
+ * @api private
+ */
+
+ toJSON: function(){
+ return this.data;
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
new file mode 100644
index 0000000..fb93939
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
@@ -0,0 +1,129 @@
+
+/*!
+ * Connect - session - MemoryStore
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var Store = require('./store');
+
+/**
+ * Initialize a new `MemoryStore`.
+ *
+ * @api public
+ */
+
+var MemoryStore = module.exports = function MemoryStore() {
+ this.sessions = {};
+};
+
+/**
+ * Inherit from `Store.prototype`.
+ */
+
+MemoryStore.prototype.__proto__ = Store.prototype;
+
+/**
+ * Attempt to fetch session by the given `sid`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.get = function(sid, fn){
+ var self = this;
+ process.nextTick(function(){
+ var expires
+ , sess = self.sessions[sid];
+ if (sess) {
+ sess = JSON.parse(sess);
+ expires = 'string' == typeof sess.cookie.expires
+ ? new Date(sess.cookie.expires)
+ : sess.cookie.expires;
+ if (!expires || new Date < expires) {
+ fn(null, sess);
+ } else {
+ self.destroy(sid, fn);
+ }
+ } else {
+ fn();
+ }
+ });
+};
+
+/**
+ * Commit the given `sess` object associated with the given `sid`.
+ *
+ * @param {String} sid
+ * @param {Session} sess
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.set = function(sid, sess, fn){
+ var self = this;
+ process.nextTick(function(){
+ self.sessions[sid] = JSON.stringify(sess);
+ fn && fn();
+ });
+};
+
+/**
+ * Destroy the session associated with the given `sid`.
+ *
+ * @param {String} sid
+ * @api public
+ */
+
+MemoryStore.prototype.destroy = function(sid, fn){
+ var self = this;
+ process.nextTick(function(){
+ delete self.sessions[sid];
+ fn && fn();
+ });
+};
+
+/**
+ * Invoke the given callback `fn` with all active sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.all = function(fn){
+ var arr = []
+ , keys = Object.keys(this.sessions);
+ for (var i = 0, len = keys.length; i < len; ++i) {
+ arr.push(this.sessions[keys[i]]);
+ }
+ fn(null, arr);
+};
+
+/**
+ * Clear all sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.clear = function(fn){
+ this.sessions = {};
+ fn && fn();
+};
+
+/**
+ * Fetch number of sessions.
+ *
+ * @param {Function} fn
+ * @api public
+ */
+
+MemoryStore.prototype.length = function(fn){
+ fn(null, Object.keys(this.sessions).length);
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/node_modules/express/node_modules/connect/lib/middleware/session/session.js
new file mode 100644
index 0000000..0dd4b40
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/session.js
@@ -0,0 +1,116 @@
+
+/*!
+ * Connect - session - Session
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../../utils');
+
+/**
+ * Create a new `Session` with the given request and `data`.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} data
+ * @api private
+ */
+
+var Session = module.exports = function Session(req, data) {
+ Object.defineProperty(this, 'req', { value: req });
+ Object.defineProperty(this, 'id', { value: req.sessionID });
+ if ('object' == typeof data) utils.merge(this, data);
+};
+
+/**
+ * Update reset `.cookie.maxAge` to prevent
+ * the cookie from expiring when the
+ * session is still active.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.touch = function(){
+ return this.resetMaxAge();
+};
+
+/**
+ * Reset `.maxAge` to `.originalMaxAge`.
+ *
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.resetMaxAge = function(){
+ this.cookie.maxAge = this.cookie.originalMaxAge;
+ return this;
+};
+
+/**
+ * Save the session data with optional callback `fn(err)`.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.save = function(fn){
+ this.req.sessionStore.set(this.id, this, fn || function(){});
+ return this;
+};
+
+/**
+ * Re-loads the session data _without_ altering
+ * the maxAge properties. Invokes the callback `fn(err)`,
+ * after which time if no exception has occurred the
+ * `req.session` property will be a new `Session` object,
+ * although representing the same session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.reload = function(fn){
+ var req = this.req
+ , store = this.req.sessionStore;
+ store.get(this.id, function(err, sess){
+ if (err) return fn(err);
+ if (!sess) return fn(new Error('failed to load session'));
+ store.createSession(req, sess);
+ fn();
+ });
+ return this;
+};
+
+/**
+ * Destroy `this` session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.destroy = function(fn){
+ delete this.req.session;
+ this.req.sessionStore.destroy(this.id, fn);
+ return this;
+};
+
+/**
+ * Regenerate this request's session.
+ *
+ * @param {Function} fn
+ * @return {Session} for chaining
+ * @api public
+ */
+
+Session.prototype.regenerate = function(fn){
+ this.req.sessionStore.regenerate(this.req, fn);
+ return this;
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/node_modules/express/node_modules/connect/lib/middleware/session/store.js
new file mode 100644
index 0000000..54294cb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/session/store.js
@@ -0,0 +1,84 @@
+
+/*!
+ * Connect - session - Store
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+ , Session = require('./session')
+ , Cookie = require('./cookie');
+
+/**
+ * Initialize abstract `Store`.
+ *
+ * @api private
+ */
+
+var Store = module.exports = function Store(options){};
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Store.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Re-generate the given requests's session.
+ *
+ * @param {IncomingRequest} req
+ * @return {Function} fn
+ * @api public
+ */
+
+Store.prototype.regenerate = function(req, fn){
+ var self = this;
+ this.destroy(req.sessionID, function(err){
+ self.generate(req);
+ fn(err);
+ });
+};
+
+/**
+ * Load a `Session` instance via the given `sid`
+ * and invoke the callback `fn(err, sess)`.
+ *
+ * @param {String} sid
+ * @param {Function} fn
+ * @api public
+ */
+
+Store.prototype.load = function(sid, fn){
+ var self = this;
+ this.get(sid, function(err, sess){
+ if (err) return fn(err);
+ if (!sess) return fn();
+ var req = { sessionID: sid, sessionStore: self };
+ sess = self.createSession(req, sess);
+ fn(null, sess);
+ });
+};
+
+/**
+ * Create session from JSON `sess` data.
+ *
+ * @param {IncomingRequest} req
+ * @param {Object} sess
+ * @return {Session}
+ * @api private
+ */
+
+Store.prototype.createSession = function(req, sess){
+ var expires = sess.cookie.expires
+ , orig = sess.cookie.originalMaxAge;
+ sess.cookie = new Cookie(sess.cookie);
+ if ('string' == typeof expires) sess.cookie.expires = new Date(expires);
+ sess.cookie.originalMaxAge = orig;
+ req.session = new Session(req, sess);
+ return req.session;
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/static.js b/node_modules/express/node_modules/connect/lib/middleware/static.js
new file mode 100644
index 0000000..bb29d07
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/static.js
@@ -0,0 +1,94 @@
+
+/*!
+ * Connect - static
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var send = require('send')
+ , utils = require('../utils')
+ , parse = utils.parseUrl
+ , url = require('url');
+
+/**
+ * Static:
+ *
+ * Static file server with the given `root` path.
+ *
+ * Examples:
+ *
+ * var oneDay = 86400000;
+ *
+ * connect()
+ * .use(connect.static(__dirname + '/public'))
+ *
+ * connect()
+ * .use(connect.static(__dirname + '/public', { maxAge: oneDay }))
+ *
+ * Options:
+ *
+ * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0
+ * - `hidden` Allow transfer of hidden files. defaults to false
+ * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function static(root, options){
+ options = options || {};
+
+ // root required
+ if (!root) throw new Error('static() root path required');
+
+ // default redirect
+ var redirect = false !== options.redirect;
+
+ return function static(req, res, next) {
+ if ('GET' != req.method && 'HEAD' != req.method) return next();
+ var path = parse(req).pathname;
+ var pause = utils.pause(req);
+
+ function resume() {
+ next();
+ pause.resume();
+ }
+
+ function directory() {
+ if (!redirect) return resume();
+ var pathname = url.parse(req.originalUrl).pathname;
+ res.statusCode = 301;
+ res.setHeader('Location', pathname + '/');
+ res.end('Redirecting to ' + utils.escape(pathname) + '/');
+ }
+
+ function error(err) {
+ if (404 == err.status) return resume();
+ next(err);
+ }
+
+ send(req, path)
+ .maxage(options.maxAge || 0)
+ .root(root)
+ .hidden(options.hidden)
+ .on('error', error)
+ .on('directory', directory)
+ .pipe(res);
+ };
+};
+
+/**
+ * Expose mime module.
+ *
+ * If you wish to extend the mime table use this
+ * reference to the "mime" module in the npm registry.
+ */
+
+exports.mime = send.mime;
diff --git a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
new file mode 100644
index 0000000..7354a8f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
@@ -0,0 +1,231 @@
+
+/*!
+ * Connect - staticCache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , Cache = require('../cache')
+ , fresh = require('fresh');
+
+/**
+ * Static cache:
+ *
+ * Enables a memory cache layer on top of
+ * the `static()` middleware, serving popular
+ * static files.
+ *
+ * By default a maximum of 128 objects are
+ * held in cache, with a max of 256k each,
+ * totalling ~32mb.
+ *
+ * A Least-Recently-Used (LRU) cache algo
+ * is implemented through the `Cache` object,
+ * simply rotating cache objects as they are
+ * hit. This means that increasingly popular
+ * objects maintain their positions while
+ * others get shoved out of the stack and
+ * garbage collected.
+ *
+ * Benchmarks:
+ *
+ * static(): 2700 rps
+ * node-static: 5300 rps
+ * static() + staticCache(): 7500 rps
+ *
+ * Options:
+ *
+ * - `maxObjects` max cache objects [128]
+ * - `maxLength` max cache object length 256kb
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function staticCache(options){
+ var options = options || {}
+ , cache = new Cache(options.maxObjects || 128)
+ , maxlen = options.maxLength || 1024 * 256;
+
+ console.warn('connect.staticCache() is deprecated and will be removed in 3.0');
+ console.warn('use varnish or similar reverse proxy caches.');
+
+ return function staticCache(req, res, next){
+ var key = cacheKey(req)
+ , ranges = req.headers.range
+ , hasCookies = req.headers.cookie
+ , hit = cache.get(key);
+
+ // cache static
+ // TODO: change from staticCache() -> cache()
+ // and make this work for any request
+ req.on('static', function(stream){
+ var headers = res._headers
+ , cc = utils.parseCacheControl(headers['cache-control'] || '')
+ , contentLength = headers['content-length']
+ , hit;
+
+ // dont cache set-cookie responses
+ if (headers['set-cookie']) return hasCookies = true;
+
+ // dont cache when cookies are present
+ if (hasCookies) return;
+
+ // ignore larger files
+ if (!contentLength || contentLength > maxlen) return;
+
+ // don't cache partial files
+ if (headers['content-range']) return;
+
+ // dont cache items we shouldn't be
+ // TODO: real support for must-revalidate / no-cache
+ if ( cc['no-cache']
+ || cc['no-store']
+ || cc['private']
+ || cc['must-revalidate']) return;
+
+ // if already in cache then validate
+ if (hit = cache.get(key)){
+ if (headers.etag == hit[0].etag) {
+ hit[0].date = new Date;
+ return;
+ } else {
+ cache.remove(key);
+ }
+ }
+
+ // validation notifiactions don't contain a steam
+ if (null == stream) return;
+
+ // add the cache object
+ var arr = [];
+
+ // store the chunks
+ stream.on('data', function(chunk){
+ arr.push(chunk);
+ });
+
+ // flag it as complete
+ stream.on('end', function(){
+ var cacheEntry = cache.add(key);
+ delete headers['x-cache']; // Clean up (TODO: others)
+ cacheEntry.push(200);
+ cacheEntry.push(headers);
+ cacheEntry.push.apply(cacheEntry, arr);
+ });
+ });
+
+ if (req.method == 'GET' || req.method == 'HEAD') {
+ if (ranges) {
+ next();
+ } else if (!hasCookies && hit && !mustRevalidate(req, hit)) {
+ res.setHeader('X-Cache', 'HIT');
+ respondFromCache(req, res, hit);
+ } else {
+ res.setHeader('X-Cache', 'MISS');
+ next();
+ }
+ } else {
+ next();
+ }
+ }
+};
+
+/**
+ * Respond with the provided cached value.
+ * TODO: Assume 200 code, that's iffy.
+ *
+ * @param {Object} req
+ * @param {Object} res
+ * @param {Object} cacheEntry
+ * @return {String}
+ * @api private
+ */
+
+function respondFromCache(req, res, cacheEntry) {
+ var status = cacheEntry[0]
+ , headers = utils.merge({}, cacheEntry[1])
+ , content = cacheEntry.slice(2);
+
+ headers.age = (new Date - new Date(headers.date)) / 1000 || 0;
+
+ switch (req.method) {
+ case 'HEAD':
+ res.writeHead(status, headers);
+ res.end();
+ break;
+ case 'GET':
+ if (utils.conditionalGET(req) && fresh(req.headers, headers)) {
+ headers['content-length'] = 0;
+ res.writeHead(304, headers);
+ res.end();
+ } else {
+ res.writeHead(status, headers);
+
+ function write() {
+ while (content.length) {
+ if (false === res.write(content.shift())) {
+ res.once('drain', write);
+ return;
+ }
+ }
+ res.end();
+ }
+
+ write();
+ }
+ break;
+ default:
+ // This should never happen.
+ res.writeHead(500, '');
+ res.end();
+ }
+}
+
+/**
+ * Determine whether or not a cached value must be revalidated.
+ *
+ * @param {Object} req
+ * @param {Object} cacheEntry
+ * @return {String}
+ * @api private
+ */
+
+function mustRevalidate(req, cacheEntry) {
+ var cacheHeaders = cacheEntry[1]
+ , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '')
+ , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '')
+ , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0;
+
+ if ( cacheCC['no-cache']
+ || cacheCC['must-revalidate']
+ || cacheCC['proxy-revalidate']) return true;
+
+ if (reqCC['no-cache']) return true;
+
+ if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge;
+
+ if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge;
+
+ return false;
+}
+
+/**
+ * The key to use in the cache. For now, this is the URL path and query.
+ *
+ * 'http://example.com?key=value' -> '/?key=value'
+ *
+ * @param {Object} req
+ * @return {String}
+ * @api private
+ */
+
+function cacheKey(req) {
+ return utils.parseUrl(req).path;
+}
diff --git a/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/node_modules/express/node_modules/connect/lib/middleware/timeout.js
new file mode 100644
index 0000000..a6dc087
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/timeout.js
@@ -0,0 +1,56 @@
+
+/*!
+ * Connect - timeout
+ * Ported from https://github.com/LearnBoost/connect-timeout
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var debug = require('debug')('connect:timeout');
+
+/**
+ * Timeout:
+ *
+ * Times out the request in `ms`, defaulting to `5000`. The
+ * method `req.clearTimeout()` is added to revert this behaviour
+ * programmatically within your application's middleware, routes, etc.
+ *
+ * The timeout error is passed to `next()` so that you may customize
+ * the response behaviour. This error has the `.timeout` property as
+ * well as `.status == 408`.
+ *
+ * @param {Number} ms
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function timeout(ms) {
+ ms = ms || 5000;
+
+ return function(req, res, next) {
+ var id = setTimeout(function(){
+ req.emit('timeout', ms);
+ }, ms);
+
+ req.on('timeout', function(){
+ if (req.headerSent) return debug('response started, cannot timeout');
+ var err = new Error('Response timeout');
+ err.timeout = ms;
+ err.status = 503;
+ next(err);
+ });
+
+ req.clearTimeout = function(){
+ clearTimeout(id);
+ };
+
+ res.on('header', function(){
+ clearTimeout(id);
+ });
+
+ next();
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
new file mode 100644
index 0000000..cceafc0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
@@ -0,0 +1,78 @@
+
+/*!
+ * Connect - urlencoded
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+ , _limit = require('./limit')
+ , qs = require('qs');
+
+/**
+ * noop middleware.
+ */
+
+function noop(req, res, next) {
+ next();
+}
+
+/**
+ * Urlencoded:
+ *
+ * Parse x-ww-form-urlencoded request bodies,
+ * providing the parsed object as `req.body`.
+ *
+ * Options:
+ *
+ * - `limit` byte limit disabled by default
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(options){
+ options = options || {};
+
+ var limit = options.limit
+ ? _limit(options.limit)
+ : noop;
+
+ return function urlencoded(req, res, next) {
+ if (req._body) return next();
+ req.body = req.body || {};
+
+ if (!utils.hasBody(req)) return next();
+
+ // check Content-Type
+ if ('application/x-www-form-urlencoded' != utils.mime(req)) return next();
+
+ // flag as parsed
+ req._body = true;
+
+ // parse
+ limit(req, res, function(err){
+ if (err) return next(err);
+ var buf = '';
+ req.setEncoding('utf8');
+ req.on('data', function(chunk){ buf += chunk });
+ req.on('end', function(){
+ try {
+ req.body = buf.length
+ ? qs.parse(buf, options)
+ : {};
+ next();
+ } catch (err){
+ err.body = buf;
+ next(err);
+ }
+ });
+ });
+ }
+};
diff --git a/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/node_modules/express/node_modules/connect/lib/middleware/vhost.js
new file mode 100644
index 0000000..897a9d8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/middleware/vhost.js
@@ -0,0 +1,40 @@
+
+/*!
+ * Connect - vhost
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Vhost:
+ *
+ * Setup vhost for the given `hostname` and `server`.
+ *
+ * connect()
+ * .use(connect.vhost('foo.com', fooApp))
+ * .use(connect.vhost('bar.com', barApp))
+ * .use(connect.vhost('*.com', mainApp))
+ *
+ * The `server` may be a Connect server or
+ * a regular Node `http.Server`.
+ *
+ * @param {String} hostname
+ * @param {Server} server
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function vhost(hostname, server){
+ if (!hostname) throw new Error('vhost hostname required');
+ if (!server) throw new Error('vhost server required');
+ var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i');
+ if (server.onvhost) server.onvhost(hostname);
+ return function vhost(req, res, next){
+ if (!req.headers.host) return next();
+ var host = req.headers.host.split(':')[0];
+ if (!regexp.test(host)) return next();
+ if ('function' == typeof server) return server(req, res, next);
+ server.emit('request', req, res);
+ };
+};
diff --git a/node_modules/express/node_modules/connect/lib/patch.js b/node_modules/express/node_modules/connect/lib/patch.js
new file mode 100644
index 0000000..7cf0012
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/patch.js
@@ -0,0 +1,79 @@
+
+/*!
+ * Connect
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , res = http.ServerResponse.prototype
+ , setHeader = res.setHeader
+ , _renderHeaders = res._renderHeaders
+ , writeHead = res.writeHead;
+
+// apply only once
+
+if (!res._hasConnectPatch) {
+
+ /**
+ * Provide a public "header sent" flag
+ * until node does.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+ res.__defineGetter__('headerSent', function(){
+ return this._header;
+ });
+
+ /**
+ * Set header `field` to `val`, special-casing
+ * the `Set-Cookie` field for multiple support.
+ *
+ * @param {String} field
+ * @param {String} val
+ * @api public
+ */
+
+ res.setHeader = function(field, val){
+ var key = field.toLowerCase()
+ , prev;
+
+ // special-case Set-Cookie
+ if (this._headers && 'set-cookie' == key) {
+ if (prev = this.getHeader(field)) {
+ val = Array.isArray(prev)
+ ? prev.concat(val)
+ : [prev, val];
+ }
+ // charset
+ } else if ('content-type' == key && this.charset) {
+ val += '; charset=' + this.charset;
+ }
+
+ return setHeader.call(this, field, val);
+ };
+
+ /**
+ * Proxy to emit "header" event.
+ */
+
+ res._renderHeaders = function(){
+ if (!this._emittedHeader) this.emit('header');
+ this._emittedHeader = true;
+ return _renderHeaders.call(this);
+ };
+
+ res.writeHead = function(){
+ if (!this._emittedHeader) this.emit('header');
+ this._emittedHeader = true;
+ return writeHead.apply(this, arguments);
+ };
+
+ res._hasConnectPatch = true;
+}
diff --git a/node_modules/express/node_modules/connect/lib/proto.js b/node_modules/express/node_modules/connect/lib/proto.js
new file mode 100644
index 0000000..889c237
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/proto.js
@@ -0,0 +1,239 @@
+
+/*!
+ * Connect - HTTPServer
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , utils = require('./utils')
+ , debug = require('debug')('connect:dispatcher');
+
+// prototype
+
+var app = module.exports = {};
+
+// environment
+
+var env = process.env.NODE_ENV || 'development';
+
+/**
+ * Utilize the given middleware `handle` to the given `route`,
+ * defaulting to _/_. This "route" is the mount-point for the
+ * middleware, when given a value other than _/_ the middleware
+ * is only effective when that segment is present in the request's
+ * pathname.
+ *
+ * For example if we were to mount a function at _/admin_, it would
+ * be invoked on _/admin_, and _/admin/settings_, however it would
+ * not be invoked for _/_, or _/posts_.
+ *
+ * Examples:
+ *
+ * var app = connect();
+ * app.use(connect.favicon());
+ * app.use(connect.logger());
+ * app.use(connect.static(__dirname + '/public'));
+ *
+ * If we wanted to prefix static files with _/public_, we could
+ * "mount" the `static()` middleware:
+ *
+ * app.use('/public', connect.static(__dirname + '/public'));
+ *
+ * This api is chainable, so the following is valid:
+ *
+ * connect()
+ * .use(connect.favicon())
+ * .use(connect.logger())
+ * .use(connect.static(__dirname + '/public'))
+ * .listen(3000);
+ *
+ * @param {String|Function|Server} route, callback or server
+ * @param {Function|Server} callback or server
+ * @return {Server} for chaining
+ * @api public
+ */
+
+app.use = function(route, fn){
+ // default route to '/'
+ if ('string' != typeof route) {
+ fn = route;
+ route = '/';
+ }
+
+ // wrap sub-apps
+ if ('function' == typeof fn.handle) {
+ var server = fn;
+ fn.route = route;
+ fn = function(req, res, next){
+ server.handle(req, res, next);
+ };
+ }
+
+ // wrap vanilla http.Servers
+ if (fn instanceof http.Server) {
+ fn = fn.listeners('request')[0];
+ }
+
+ // strip trailing slash
+ if ('/' == route[route.length - 1]) {
+ route = route.slice(0, -1);
+ }
+
+ // add the middleware
+ debug('use %s %s', route || '/', fn.name || 'anonymous');
+ this.stack.push({ route: route, handle: fn });
+
+ return this;
+};
+
+/**
+ * Handle server requests, punting them down
+ * the middleware stack.
+ *
+ * @api private
+ */
+
+app.handle = function(req, res, out) {
+ var stack = this.stack
+ , fqdn = ~req.url.indexOf('://')
+ , removed = ''
+ , slashAdded = false
+ , index = 0;
+
+ function next(err, msg) {
+ var layer, path, status, c;
+
+ if (slashAdded) {
+ req.url = req.url.substr(1);
+ slashAdded = false;
+ }
+
+ req.url = removed + req.url;
+ req.originalUrl = req.originalUrl || req.url;
+ removed = '';
+
+ // next(status, msg) support
+ if (typeof err === 'number') {
+ var status = err;
+ var name = http.STATUS_CODES[status];
+ err = new Error(msg || name);
+ err.name = name;
+ err.status = status;
+ }
+
+ // next callback
+ layer = stack[index++];
+
+ // all done
+ if (!layer || res.headerSent) {
+ // delegate to parent
+ if (out) return out(err);
+
+ // unhandled error
+ if (err) {
+ // default to 500
+ if (res.statusCode < 400) res.statusCode = 500;
+ debug('default %s', res.statusCode);
+
+ // respect err.status
+ if (err.status) res.statusCode = err.status;
+
+ // production gets a basic error message
+ var msg = 'production' == env
+ ? http.STATUS_CODES[res.statusCode]
+ : err.stack || err.toString();
+
+ // log to stderr in a non-test env
+ if ('test' != env) console.error(err.stack || err.toString());
+ if (res.headerSent) return req.socket.destroy();
+ res.setHeader('Content-Type', 'text/plain');
+ res.setHeader('Content-Length', Buffer.byteLength(msg));
+ if ('HEAD' == req.method) return res.end();
+ res.end(msg);
+ } else {
+ debug('default 404');
+ res.statusCode = 404;
+ res.setHeader('Content-Type', 'text/plain');
+ if ('HEAD' == req.method) return res.end();
+ res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl));
+ }
+ return;
+ }
+
+ try {
+ path = utils.parseUrl(req).pathname;
+ if (undefined == path) path = '/';
+
+ // skip this layer if the route doesn't match.
+ if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err);
+
+ c = path[layer.route.length];
+ if (c && '/' != c && '.' != c) return next(err);
+
+ // Call the layer handler
+ // Trim off the part of the url that matches the route
+ removed = layer.route;
+ req.url = req.url.substr(removed.length);
+
+ // Ensure leading slash
+ if (!fqdn && '/' != req.url[0]) {
+ req.url = '/' + req.url;
+ slashAdded = true;
+ }
+
+ debug('%s', layer.handle.name || 'anonymous');
+ var arity = layer.handle.length;
+ if (err) {
+ if (arity === 4) {
+ layer.handle(err, req, res, next);
+ } else {
+ next(err);
+ }
+ } else if (arity < 4) {
+ layer.handle(req, res, next);
+ } else {
+ next();
+ }
+ } catch (e) {
+ next(e);
+ }
+ }
+ next();
+};
+
+/**
+ * Listen for connections.
+ *
+ * This method takes the same arguments
+ * as node's `http.Server#listen()`.
+ *
+ * HTTP and HTTPS:
+ *
+ * If you run your application both as HTTP
+ * and HTTPS you may wrap them individually,
+ * since your Connect "server" is really just
+ * a JavaScript `Function`.
+ *
+ * var connect = require('connect')
+ * , http = require('http')
+ * , https = require('https');
+ *
+ * var app = connect();
+ *
+ * http.createServer(app).listen(80);
+ * https.createServer(options, app).listen(443);
+ *
+ * @return {http.Server}
+ * @api public
+ */
+
+app.listen = function(){
+ var server = http.createServer(this);
+ return server.listen.apply(server, arguments);
+};
diff --git a/node_modules/express/node_modules/connect/lib/public/directory.html b/node_modules/express/node_modules/connect/lib/public/directory.html
new file mode 100644
index 0000000..2d63704
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/directory.html
@@ -0,0 +1,81 @@
+
+
+
+
+ listing directory {directory}
+
+
+
+
+
+
+
{linked-path}
+ {files}
+
+
+
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/lib/public/error.html b/node_modules/express/node_modules/connect/lib/public/error.html
new file mode 100644
index 0000000..a6d3faf
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/error.html
@@ -0,0 +1,14 @@
+
+
+
+ {error}
+
+
+
+
+
{title}
+
{statusCode} {error}
+
{stack}
+
+
+
diff --git a/node_modules/express/node_modules/connect/lib/public/favicon.ico b/node_modules/express/node_modules/connect/lib/public/favicon.ico
new file mode 100644
index 0000000..895fc96
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/favicon.ico differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page.png b/node_modules/express/node_modules/connect/lib/public/icons/page.png
new file mode 100644
index 0000000..03ddd79
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_add.png
new file mode 100644
index 0000000..d5bfa07
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_add.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
new file mode 100644
index 0000000..89ee2da
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png
new file mode 100644
index 0000000..f7ea904
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
new file mode 100644
index 0000000..195dc6d
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
new file mode 100644
index 0000000..3141467
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
new file mode 100644
index 0000000..046811e
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png
new file mode 100644
index 0000000..f07f449
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
new file mode 100644
index 0000000..eb6158e
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png
new file mode 100644
index 0000000..2f19388
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
new file mode 100644
index 0000000..8e83281
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png
new file mode 100644
index 0000000..80fe1ed
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_green.png b/node_modules/express/node_modules/connect/lib/public/icons/page_green.png
new file mode 100644
index 0000000..de8e003
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_green.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png
new file mode 100644
index 0000000..d6626cb
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
new file mode 100644
index 0000000..7e56870
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png
new file mode 100644
index 0000000..312eab0
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
new file mode 100644
index 0000000..246a2f0
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
new file mode 100644
index 0000000..968f073
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png
new file mode 100644
index 0000000..0b18247
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
new file mode 100644
index 0000000..cf347c7
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_save.png b/node_modules/express/node_modules/connect/lib/public/icons/page_save.png
new file mode 100644
index 0000000..caea546
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_save.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png
new file mode 100644
index 0000000..8b8b1ca
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
new file mode 100644
index 0000000..8f8095e
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
new file mode 100644
index 0000000..159b240
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png
new file mode 100644
index 0000000..aa23dde
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png
new file mode 100644
index 0000000..34a05cc
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png
new file mode 100644
index 0000000..f501a59
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png
new file mode 100644
index 0000000..848bdaf
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png
new file mode 100644
index 0000000..0c76bd1
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png
new file mode 100644
index 0000000..87a6914
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png
new file mode 100644
index 0000000..c66011f
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png
new file mode 100644
index 0000000..2b6b100
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png
new file mode 100644
index 0000000..a9f31a2
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png
new file mode 100644
index 0000000..a87cf84
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png
new file mode 100644
index 0000000..ffb8fc9
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png
new file mode 100644
index 0000000..0a7d6f4
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png
new file mode 100644
index 0000000..bddba1f
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png
new file mode 100644
index 0000000..af1ecaf
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png
new file mode 100644
index 0000000..4cc537a
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png
new file mode 100644
index 0000000..b93e776
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png
new file mode 100644
index 0000000..9fc5a0a
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png
new file mode 100644
index 0000000..b977d7e
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png
new file mode 100644
index 0000000..5818436
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png
new file mode 100644
index 0000000..5769120
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png
new file mode 100644
index 0000000..8d719df
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png
new file mode 100644
index 0000000..106f5aa
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png
new file mode 100644
index 0000000..e4a1ecb
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png
new file mode 100644
index 0000000..7e62a92
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png
new file mode 100644
index 0000000..e902abb
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png
new file mode 100644
index 0000000..1d2d0a4
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png
new file mode 100644
index 0000000..d616484
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png
new file mode 100644
index 0000000..7215d1e
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png
new file mode 100644
index 0000000..bf7bd1c
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png
new file mode 100644
index 0000000..f6b74cc
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png
new file mode 100644
index 0000000..d3fffb6
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png
new file mode 100644
index 0000000..a65bcb3
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png
new file mode 100644
index 0000000..23a37b8
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png
new file mode 100644
index 0000000..f907e44
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png
new file mode 100644
index 0000000..5b2cbb3
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png
new file mode 100644
index 0000000..7868a25
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png
new file mode 100644
index 0000000..134b669
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png
new file mode 100644
index 0000000..c4eff03
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png
new file mode 100644
index 0000000..884ffd6
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png
new file mode 100644
index 0000000..f59b7c4
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png
new file mode 100644
index 0000000..44084ad
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png
new file mode 100644
index 0000000..3a1441c
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png
new file mode 100644
index 0000000..e770829
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png
new file mode 100644
index 0000000..813f712
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png
new file mode 100644
index 0000000..d9cf132
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png
new file mode 100644
index 0000000..52699bf
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png
new file mode 100644
index 0000000..4a05955
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png
new file mode 100644
index 0000000..a0a433d
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png
new file mode 100644
index 0000000..1eb8809
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png
new file mode 100644
index 0000000..ae8ecbf
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png
new file mode 100644
index 0000000..6ed2490
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png
new file mode 100644
index 0000000..fecadd0
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png
new file mode 100644
index 0000000..fd4bbcc
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_word.png
new file mode 100644
index 0000000..834cdfa
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_word.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_world.png
new file mode 100644
index 0000000..b8895dd
Binary files /dev/null and b/node_modules/express/node_modules/connect/lib/public/icons/page_world.png differ
diff --git a/node_modules/express/node_modules/connect/lib/public/style.css b/node_modules/express/node_modules/connect/lib/public/style.css
new file mode 100644
index 0000000..32b6507
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/public/style.css
@@ -0,0 +1,141 @@
+body {
+ margin: 0;
+ padding: 80px 100px;
+ font: 13px "Helvetica Neue", "Lucida Grande", "Arial";
+ background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9));
+ background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9);
+ background-repeat: no-repeat;
+ color: #555;
+ -webkit-font-smoothing: antialiased;
+}
+h1, h2, h3 {
+ margin: 0;
+ font-size: 22px;
+ color: #343434;
+}
+h1 em, h2 em {
+ padding: 0 5px;
+ font-weight: normal;
+}
+h1 {
+ font-size: 60px;
+}
+h2 {
+ margin-top: 10px;
+}
+h3 {
+ margin: 5px 0 10px 0;
+ padding-bottom: 5px;
+ border-bottom: 1px solid #eee;
+ font-size: 18px;
+}
+ul {
+ margin: 0;
+ padding: 0;
+}
+ul li {
+ margin: 5px 0;
+ padding: 3px 8px;
+ list-style: none;
+}
+ul li:hover {
+ cursor: pointer;
+ color: #2e2e2e;
+}
+ul li .path {
+ padding-left: 5px;
+ font-weight: bold;
+}
+ul li .line {
+ padding-right: 5px;
+ font-style: italic;
+}
+ul li:first-child .path {
+ padding-left: 0;
+}
+p {
+ line-height: 1.5;
+}
+a {
+ color: #555;
+ text-decoration: none;
+}
+a:hover {
+ color: #303030;
+}
+#stacktrace {
+ margin-top: 15px;
+}
+.directory h1 {
+ margin-bottom: 15px;
+ font-size: 18px;
+}
+ul#files {
+ width: 100%;
+ height: 500px;
+}
+ul#files li {
+ padding: 0;
+}
+ul#files li img {
+ position: absolute;
+ top: 5px;
+ left: 5px;
+}
+ul#files li a {
+ position: relative;
+ display: block;
+ margin: 1px;
+ width: 30%;
+ height: 25px;
+ line-height: 25px;
+ text-indent: 8px;
+ float: left;
+ border: 1px solid transparent;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+ul#files li a.icon {
+ text-indent: 25px;
+}
+ul#files li a:focus,
+ul#files li a:hover {
+ outline: none;
+ background: rgba(255,255,255,0.65);
+ border: 1px solid #ececec;
+}
+ul#files li a.highlight {
+ -webkit-transition: background .4s ease-in-out;
+ background: #ffff4f;
+ border-color: #E9DC51;
+}
+#search {
+ display: block;
+ position: fixed;
+ top: 20px;
+ right: 20px;
+ width: 90px;
+ -webkit-transition: width ease 0.2s, opacity ease 0.4s;
+ -moz-transition: width ease 0.2s, opacity ease 0.4s;
+ -webkit-border-radius: 32px;
+ -moz-border-radius: 32px;
+ -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03);
+ -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03);
+ -webkit-font-smoothing: antialiased;
+ text-align: left;
+ font: 13px "Helvetica Neue", Arial, sans-serif;
+ padding: 4px 10px;
+ border: none;
+ background: transparent;
+ margin-bottom: 0;
+ outline: none;
+ opacity: 0.7;
+ color: #888;
+}
+#search:focus {
+ width: 120px;
+ opacity: 1.0;
+}
diff --git a/node_modules/express/node_modules/connect/lib/utils.js b/node_modules/express/node_modules/connect/lib/utils.js
new file mode 100644
index 0000000..47b30e0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/lib/utils.js
@@ -0,0 +1,370 @@
+
+/*!
+ * Connect - utils
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+ , crypto = require('crypto')
+ , parse = require('url').parse
+ , signature = require('cookie-signature');
+
+/**
+ * Return `true` if the request has a body, otherwise return `false`.
+ *
+ * @param {IncomingMessage} req
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.hasBody = function(req) {
+ return 'transfer-encoding' in req.headers || 'content-length' in req.headers;
+};
+
+/**
+ * Extract the mime type from the given request's
+ * _Content-Type_ header.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+exports.mime = function(req) {
+ var str = req.headers['content-type'] || '';
+ return str.split(';')[0];
+};
+
+/**
+ * Return md5 hash of the given string and optional encoding,
+ * defaulting to hex.
+ *
+ * utils.md5('wahoo');
+ * // => "e493298061761236c96b02ea6aa8a2ad"
+ *
+ * @param {String} str
+ * @param {String} encoding
+ * @return {String}
+ * @api private
+ */
+
+exports.md5 = function(str, encoding){
+ return crypto
+ .createHash('md5')
+ .update(str)
+ .digest(encoding || 'hex');
+};
+
+/**
+ * Merge object b with object a.
+ *
+ * var a = { foo: 'bar' }
+ * , b = { bar: 'baz' };
+ *
+ * utils.merge(a, b);
+ * // => { foo: 'bar', bar: 'baz' }
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Object}
+ * @api private
+ */
+
+exports.merge = function(a, b){
+ if (a && b) {
+ for (var key in b) {
+ a[key] = b[key];
+ }
+ }
+ return a;
+};
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+ return String(html)
+ .replace(/&(?!\w+;)/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+};
+
+
+/**
+ * Return a unique identifier with the given `len`.
+ *
+ * utils.uid(10);
+ * // => "FDaS435D2z"
+ *
+ * @param {Number} len
+ * @return {String}
+ * @api private
+ */
+
+exports.uid = function(len) {
+ return crypto.randomBytes(Math.ceil(len * 3 / 4))
+ .toString('base64')
+ .slice(0, len);
+};
+
+/**
+ * Sign the given `val` with `secret`.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(val, secret){
+ console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature')
+ return val + '.' + crypto
+ .createHmac('sha256', secret)
+ .update(val)
+ .digest('base64')
+ .replace(/=+$/, '');
+};
+
+/**
+ * Unsign and decode the given `val` with `secret`,
+ * returning `false` if the signature is invalid.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String|Boolean}
+ * @api private
+ */
+
+exports.unsign = function(val, secret){
+ console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature')
+ var str = val.slice(0, val.lastIndexOf('.'));
+ return exports.sign(str, secret) == val
+ ? str
+ : false;
+};
+
+/**
+ * Parse signed cookies, returning an object
+ * containing the decoded key/value pairs,
+ * while removing the signed key from `obj`.
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseSignedCookies = function(obj, secret){
+ var ret = {};
+ Object.keys(obj).forEach(function(key){
+ var val = obj[key];
+ if (0 == val.indexOf('s:')) {
+ val = signature.unsign(val.slice(2), secret);
+ if (val) {
+ ret[key] = val;
+ delete obj[key];
+ }
+ }
+ });
+ return ret;
+};
+
+/**
+ * Parse a signed cookie string, return the decoded value
+ *
+ * @param {String} str signed cookie string
+ * @param {String} secret
+ * @return {String} decoded value
+ * @api private
+ */
+
+exports.parseSignedCookie = function(str, secret){
+ return 0 == str.indexOf('s:')
+ ? signature.unsign(str.slice(2), secret)
+ : str;
+};
+
+/**
+ * Parse JSON cookies.
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseJSONCookies = function(obj){
+ Object.keys(obj).forEach(function(key){
+ var val = obj[key];
+ var res = exports.parseJSONCookie(val);
+ if (res) obj[key] = res;
+ });
+ return obj;
+};
+
+/**
+ * Parse JSON cookie string
+ *
+ * @param {String} str
+ * @return {Object} Parsed object or null if not json cookie
+ * @api private
+ */
+
+exports.parseJSONCookie = function(str) {
+ if (0 == str.indexOf('j:')) {
+ try {
+ return JSON.parse(str.slice(2));
+ } catch (err) {
+ // no op
+ }
+ }
+};
+
+/**
+ * Pause `data` and `end` events on the given `obj`.
+ * Middleware performing async tasks _should_ utilize
+ * this utility (or similar), to re-emit data once
+ * the async operation has completed, otherwise these
+ * events may be lost.
+ *
+ * var pause = utils.pause(req);
+ * fs.readFile(path, function(){
+ * next();
+ * pause.resume();
+ * });
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.pause = require('pause');
+
+/**
+ * Strip `Content-*` headers from `res`.
+ *
+ * @param {ServerResponse} res
+ * @api private
+ */
+
+exports.removeContentHeaders = function(res){
+ Object.keys(res._headers).forEach(function(field){
+ if (0 == field.indexOf('content')) {
+ res.removeHeader(field);
+ }
+ });
+};
+
+/**
+ * Check if `req` is a conditional GET request.
+ *
+ * @param {IncomingMessage} req
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.conditionalGET = function(req) {
+ return req.headers['if-modified-since']
+ || req.headers['if-none-match'];
+};
+
+/**
+ * Respond with 401 "Unauthorized".
+ *
+ * @param {ServerResponse} res
+ * @param {String} realm
+ * @api private
+ */
+
+exports.unauthorized = function(res, realm) {
+ res.statusCode = 401;
+ res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"');
+ res.end('Unauthorized');
+};
+
+/**
+ * Respond with 304 "Not Modified".
+ *
+ * @param {ServerResponse} res
+ * @param {Object} headers
+ * @api private
+ */
+
+exports.notModified = function(res) {
+ exports.removeContentHeaders(res);
+ res.statusCode = 304;
+ res.end();
+};
+
+/**
+ * Return an ETag in the form of `"-"`
+ * from the given `stat`.
+ *
+ * @param {Object} stat
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(stat) {
+ return '"' + stat.size + '-' + Number(stat.mtime) + '"';
+};
+
+/**
+ * Parse the given Cache-Control `str`.
+ *
+ * @param {String} str
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseCacheControl = function(str){
+ var directives = str.split(',')
+ , obj = {};
+
+ for(var i = 0, len = directives.length; i < len; i++) {
+ var parts = directives[i].split('=')
+ , key = parts.shift().trim()
+ , val = parseInt(parts.shift(), 10);
+
+ obj[key] = isNaN(val) ? true : val;
+ }
+
+ return obj;
+};
+
+/**
+ * Parse the `req` url with memoization.
+ *
+ * @param {ServerRequest} req
+ * @return {Object}
+ * @api private
+ */
+
+exports.parseUrl = function(req){
+ var parsed = req._parsedUrl;
+ if (parsed && parsed.href == req.url) {
+ return parsed;
+ } else {
+ return req._parsedUrl = parse(req.url);
+ }
+};
+
+/**
+ * Parse byte `size` string.
+ *
+ * @param {String} size
+ * @return {Number}
+ * @api private
+ */
+
+exports.parseBytes = require('bytes');
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore
@@ -0,0 +1 @@
+test
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/node_modules/express/node_modules/connect/node_modules/bytes/History.md
new file mode 100644
index 0000000..db1f759
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/History.md
@@ -0,0 +1,5 @@
+
+0.1.0 / 2012-07-04
+==================
+
+ * add bytes to string conversion [yields]
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
new file mode 100644
index 0000000..8e8640f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --reporter spec \
+ --require should
+
+.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
new file mode 100644
index 0000000..9325d5b
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
@@ -0,0 +1,51 @@
+# node-bytes
+
+ Byte string parser / formatter.
+
+## Example:
+
+```js
+bytes('1kb')
+// => 1024
+
+bytes('2mb')
+// => 2097152
+
+bytes('1gb')
+// => 1073741824
+
+bytes(1073741824)
+// => 1gb
+```
+
+## Installation
+
+```
+$ npm install bytes
+$ component install visionmedia/bytes.js
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/node_modules/express/node_modules/connect/node_modules/bytes/component.json
new file mode 100644
index 0000000..76a6057
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/component.json
@@ -0,0 +1,7 @@
+{
+ "name": "bytes",
+ "description": "byte size string parser / serializer",
+ "keywords": ["bytes", "utility"],
+ "version": "0.1.0",
+ "scripts": ["index.js"]
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/node_modules/express/node_modules/connect/node_modules/bytes/index.js
new file mode 100644
index 0000000..3eaafc7
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/index.js
@@ -0,0 +1,39 @@
+
+/**
+ * Parse byte `size` string.
+ *
+ * @param {String} size
+ * @return {Number}
+ * @api public
+ */
+
+module.exports = function(size) {
+ if ('number' == typeof size) return convert(size);
+ var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/)
+ , n = parseFloat(parts[1])
+ , type = parts[2];
+
+ var map = {
+ kb: 1 << 10
+ , mb: 1 << 20
+ , gb: 1 << 30
+ };
+
+ return map[type] * n;
+};
+
+/**
+ * convert bytes into string.
+ *
+ * @param {Number} b - bytes to convert
+ * @return {String}i
+ * @api public
+ */
+
+function convert (b) {
+ var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10;
+ if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
+ if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb';
+ if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb';
+ return b;
+}
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/node_modules/express/node_modules/connect/node_modules/bytes/package.json
new file mode 100644
index 0000000..05f17ec
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/bytes/package.json
@@ -0,0 +1,24 @@
+{
+ "name": "bytes",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "description": "byte size string parser / serializer",
+ "version": "0.1.0",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "component": {
+ "scripts": {
+ "bytes": "index.js"
+ }
+ },
+ "readme": "# node-bytes\n\n Byte string parser / formatter.\n\n## Example:\n\n```js\nbytes('1kb')\n// => 1024\n\nbytes('2mb')\n// => 2097152\n\nbytes('1gb')\n// => 1073741824\n\nbytes(1073741824)\n// => 1gb\n```\n\n## Installation\n\n```\n$ npm install bytes\n$ component install visionmedia/bytes.js\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
+ "_id": "bytes@0.1.0",
+ "_from": "bytes@0.1.0"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
new file mode 100644
index 0000000..4fbabb3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore
@@ -0,0 +1,4 @@
+/test/tmp/
+*.upload
+*.un~
+*.http
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
new file mode 100644
index 0000000..f1d0f13
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/Makefile
new file mode 100644
index 0000000..8945872
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/Makefile
@@ -0,0 +1,14 @@
+SHELL := /bin/bash
+
+test:
+ @./test/run.js
+
+build: npm test
+
+npm:
+ npm install .
+
+clean:
+ rm test/tmp/*
+
+.PHONY: test clean build
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
new file mode 100644
index 0000000..a5ca104
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
@@ -0,0 +1,311 @@
+# Formidable
+
+[](http://travis-ci.org/felixge/node-formidable)
+
+## Purpose
+
+A node.js module for parsing form data, especially file uploads.
+
+## Current status
+
+This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading
+and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from
+a large variety of clients and is considered production-ready.
+
+## Features
+
+* Fast (~500mb/sec), non-buffering multipart parser
+* Automatically writing file uploads to disk
+* Low memory footprint
+* Graceful error handling
+* Very high test coverage
+
+## Changelog
+
+### v1.0.9
+
+* Emit progress when content length header parsed (Tim Koschützki)
+* Fix Readme syntax due to GitHub changes (goob)
+* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)
+
+### v1.0.8
+
+* Strip potentially unsafe characters when using `keepExtensions: true`.
+* Switch to utest / urun for testing
+* Add travis build
+
+### v1.0.7
+
+* Remove file from package that was causing problems when installing on windows. (#102)
+* Fix typos in Readme (Jason Davies).
+
+### v1.0.6
+
+* Do not default to the default to the field name for file uploads where
+ filename="".
+
+### v1.0.5
+
+* Support filename="" in multipart parts
+* Explain unexpected end() errors in parser better
+
+**Note:** Starting with this version, formidable emits 'file' events for empty
+file input fields. Previously those were incorrectly emitted as regular file
+input fields with value = "".
+
+### v1.0.4
+
+* Detect a good default tmp directory regardless of platform. (#88)
+
+### v1.0.3
+
+* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)
+* Small performance improvements
+* New test suite and fixture system
+
+### v1.0.2
+
+* Exclude node\_modules folder from git
+* Implement new `'aborted'` event
+* Fix files in example folder to work with recent node versions
+* Make gently a devDependency
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)
+
+### v1.0.1
+
+* Fix package.json to refer to proper main directory. (#68, Dean Landolt)
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)
+
+### v1.0.0
+
+* Add support for multipart boundaries that are quoted strings. (Jeff Craig)
+
+This marks the beginning of development on version 2.0 which will include
+several architectural improvements.
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)
+
+### v0.9.11
+
+* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)
+* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class
+
+**Important:** The old property names of the File class will be removed in a
+future release.
+
+[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)
+
+### Older releases
+
+These releases were done before starting to maintain the above Changelog:
+
+* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)
+* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)
+* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)
+* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)
+* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)
+* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)
+* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)
+* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)
+* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)
+* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)
+* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)
+
+## Installation
+
+Via [npm](http://github.com/isaacs/npm):
+
+ npm install formidable@latest
+
+Manually:
+
+ git clone git://github.com/felixge/node-formidable.git formidable
+ vim my.js
+ # var formidable = require('./formidable');
+
+Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.
+
+## Example
+
+Parse an incoming file upload.
+
+ var formidable = require('formidable'),
+ http = require('http'),
+
+ util = require('util');
+
+ http.createServer(function(req, res) {
+ if (req.url == '/upload' && req.method.toLowerCase() == 'post') {
+ // parse a file upload
+ var form = new formidable.IncomingForm();
+ form.parse(req, function(err, fields, files) {
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.write('received upload:\n\n');
+ res.end(util.inspect({fields: fields, files: files}));
+ });
+ return;
+ }
+
+ // show a file upload form
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ ''
+ );
+ }).listen(80);
+
+## API
+
+### formidable.IncomingForm
+
+__new formidable.IncomingForm()__
+
+Creates a new incoming form.
+
+__incomingForm.encoding = 'utf-8'__
+
+The encoding to use for incoming form fields.
+
+__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__
+
+The directory for placing file uploads in. You can move them later on using
+`fs.rename()`. The default directory is picked at module load time depending on
+the first existing directory from those listed above.
+
+__incomingForm.keepExtensions = false__
+
+If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.
+
+__incomingForm.type__
+
+Either 'multipart' or 'urlencoded' depending on the incoming request.
+
+__incomingForm.maxFieldsSize = 2 * 1024 * 1024__
+
+Limits the amount of memory a field (not file) can allocate in bytes.
+If this value is exceeded, an `'error'` event is emitted. The default
+size is 2MB.
+
+__incomingForm.hash = false__
+
+If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.
+
+__incomingForm.bytesReceived__
+
+The amount of bytes received for this form so far.
+
+__incomingForm.bytesExpected__
+
+The expected number of bytes in this form.
+
+__incomingForm.parse(request, [cb])__
+
+Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:
+
+ incomingForm.parse(req, function(err, fields, files) {
+ // ...
+ });
+
+__incomingForm.onPart(part)__
+
+You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.
+
+ incomingForm.onPart = function(part) {
+ part.addListener('data', function() {
+ // ...
+ });
+ }
+
+If you want to use formidable to only handle certain parts for you, you can do so:
+
+ incomingForm.onPart = function(part) {
+ if (!part.filename) {
+ // let formidable handle all non-file parts
+ incomingForm.handlePart(part);
+ }
+ }
+
+Check the code in this method for further inspiration.
+
+__Event: 'progress' (bytesReceived, bytesExpected)__
+
+Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.
+
+__Event: 'field' (name, value)__
+
+Emitted whenever a field / value pair has been received.
+
+__Event: 'fileBegin' (name, file)__
+
+Emitted whenever a new file is detected in the upload stream. Use this even if
+you want to stream the file to somewhere else while buffering the upload on
+the file system.
+
+__Event: 'file' (name, file)__
+
+Emitted whenever a field / file pair has been received. `file` is an instance of `File`.
+
+__Event: 'error' (err)__
+
+Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.
+
+__Event: 'aborted'__
+
+Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).
+
+__Event: 'end' ()__
+
+Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.
+
+### formidable.File
+
+__file.size = 0__
+
+The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.
+
+__file.path = null__
+
+The path this file is being written to. You can modify this in the `'fileBegin'` event in
+case you are unhappy with the way formidable generates a temporary path for your files.
+
+__file.name = null__
+
+The name this file had according to the uploading client.
+
+__file.type = null__
+
+The mime type of this file, according to the uploading client.
+
+__file.lastModifiedDate = null__
+
+A date object (or `null`) containing the time this file was last written to. Mostly
+here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).
+
+__file.hash = null__
+
+If hash calculation was set, you can read the hex digest out of this var.
+
+## License
+
+Formidable is licensed under the MIT license.
+
+## Ports
+
+* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable
+
+## Credits
+
+* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/TODO b/node_modules/express/node_modules/connect/node_modules/formidable/TODO
new file mode 100644
index 0000000..e1107f2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/TODO
@@ -0,0 +1,3 @@
+- Better bufferMaxSize handling approach
+- Add tests for JSON parser pull request and merge it
+- Implement QuerystringParser the same way as MultipartParser
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
new file mode 100644
index 0000000..bff41f1
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
@@ -0,0 +1,70 @@
+require('../test/common');
+var multipartParser = require('../lib/multipart_parser'),
+ MultipartParser = multipartParser.MultipartParser,
+ parser = new MultipartParser(),
+ Buffer = require('buffer').Buffer,
+ boundary = '-----------------------------168072824752491622650073',
+ mb = 100,
+ buffer = createMultipartBuffer(boundary, mb * 1024 * 1024),
+ callbacks =
+ { partBegin: -1,
+ partEnd: -1,
+ headerField: -1,
+ headerValue: -1,
+ partData: -1,
+ end: -1,
+ };
+
+
+parser.initWithBoundary(boundary);
+parser.onHeaderField = function() {
+ callbacks.headerField++;
+};
+
+parser.onHeaderValue = function() {
+ callbacks.headerValue++;
+};
+
+parser.onPartBegin = function() {
+ callbacks.partBegin++;
+};
+
+parser.onPartData = function() {
+ callbacks.partData++;
+};
+
+parser.onPartEnd = function() {
+ callbacks.partEnd++;
+};
+
+parser.onEnd = function() {
+ callbacks.end++;
+};
+
+var start = +new Date(),
+ nparsed = parser.write(buffer),
+ duration = +new Date - start,
+ mbPerSec = (mb / (duration / 1000)).toFixed(2);
+
+console.log(mbPerSec+' mb/sec');
+
+assert.equal(nparsed, buffer.length);
+
+function createMultipartBuffer(boundary, size) {
+ var head =
+ '--'+boundary+'\r\n'
+ + 'content-disposition: form-data; name="field1"\r\n'
+ + '\r\n'
+ , tail = '\r\n--'+boundary+'--\r\n'
+ , buffer = new Buffer(size);
+
+ buffer.write(head, 'ascii', 0);
+ buffer.write(tail, 'ascii', buffer.length - tail.length);
+ return buffer;
+}
+
+process.on('exit', function() {
+ for (var k in callbacks) {
+ assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]);
+ }
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
new file mode 100644
index 0000000..f6c15a6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
@@ -0,0 +1,43 @@
+require('../test/common');
+var http = require('http'),
+ util = require('util'),
+ formidable = require('formidable'),
+ server;
+
+server = http.createServer(function(req, res) {
+ if (req.url == '/') {
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ ''
+ );
+ } else if (req.url == '/post') {
+ var form = new formidable.IncomingForm(),
+ fields = [];
+
+ form
+ .on('error', function(err) {
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.end('error:\n\n'+util.inspect(err));
+ })
+ .on('field', function(field, value) {
+ console.log(field, value);
+ fields.push([field, value]);
+ })
+ .on('end', function() {
+ console.log('-> post done');
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.end('received fields:\n\n '+util.inspect(fields));
+ });
+ form.parse(req);
+ } else {
+ res.writeHead(404, {'content-type': 'text/plain'});
+ res.end('404');
+ }
+});
+server.listen(TEST_PORT);
+
+console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
new file mode 100644
index 0000000..050cdd9
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
@@ -0,0 +1,48 @@
+require('../test/common');
+var http = require('http'),
+ util = require('util'),
+ formidable = require('formidable'),
+ server;
+
+server = http.createServer(function(req, res) {
+ if (req.url == '/') {
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ ''
+ );
+ } else if (req.url == '/upload') {
+ var form = new formidable.IncomingForm(),
+ files = [],
+ fields = [];
+
+ form.uploadDir = TEST_TMP;
+
+ form
+ .on('field', function(field, value) {
+ console.log(field, value);
+ fields.push([field, value]);
+ })
+ .on('file', function(field, file) {
+ console.log(field, file);
+ files.push([field, file]);
+ })
+ .on('end', function() {
+ console.log('-> upload done');
+ res.writeHead(200, {'content-type': 'text/plain'});
+ res.write('received fields:\n\n '+util.inspect(fields));
+ res.write('\n\n');
+ res.end('received files:\n\n '+util.inspect(files));
+ });
+ form.parse(req);
+ } else {
+ res.writeHead(404, {'content-type': 'text/plain'});
+ res.end('404');
+ }
+});
+server.listen(TEST_PORT);
+
+console.log('listening on http://localhost:'+TEST_PORT+'/');
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/index.js
new file mode 100644
index 0000000..be41032
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/formidable');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
new file mode 100644
index 0000000..dad8d5f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
@@ -0,0 +1,73 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+var util = require('./util'),
+ WriteStream = require('fs').WriteStream,
+ EventEmitter = require('events').EventEmitter,
+ crypto = require('crypto');
+
+function File(properties) {
+ EventEmitter.call(this);
+
+ this.size = 0;
+ this.path = null;
+ this.name = null;
+ this.type = null;
+ this.hash = null;
+ this.lastModifiedDate = null;
+
+ this._writeStream = null;
+
+ for (var key in properties) {
+ this[key] = properties[key];
+ }
+
+ if(typeof this.hash === 'string') {
+ this.hash = crypto.createHash(properties.hash);
+ }
+
+ this._backwardsCompatibility();
+}
+module.exports = File;
+util.inherits(File, EventEmitter);
+
+// @todo Next release: Show error messages when accessing these
+File.prototype._backwardsCompatibility = function() {
+ var self = this;
+ this.__defineGetter__('length', function() {
+ return self.size;
+ });
+ this.__defineGetter__('filename', function() {
+ return self.name;
+ });
+ this.__defineGetter__('mime', function() {
+ return self.type;
+ });
+};
+
+File.prototype.open = function() {
+ this._writeStream = new WriteStream(this.path);
+};
+
+File.prototype.write = function(buffer, cb) {
+ var self = this;
+ this._writeStream.write(buffer, function() {
+ if(self.hash) {
+ self.hash.update(buffer);
+ }
+ self.lastModifiedDate = new Date();
+ self.size += buffer.length;
+ self.emit('progress', self.size);
+ cb();
+ });
+};
+
+File.prototype.end = function(cb) {
+ var self = this;
+ this._writeStream.end(function() {
+ if(self.hash) {
+ self.hash = self.hash.digest('hex');
+ }
+ self.emit('end');
+ cb();
+ });
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
new file mode 100644
index 0000000..060eac2
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
@@ -0,0 +1,384 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+var fs = require('fs');
+var util = require('./util'),
+ path = require('path'),
+ File = require('./file'),
+ MultipartParser = require('./multipart_parser').MultipartParser,
+ QuerystringParser = require('./querystring_parser').QuerystringParser,
+ StringDecoder = require('string_decoder').StringDecoder,
+ EventEmitter = require('events').EventEmitter,
+ Stream = require('stream').Stream;
+
+function IncomingForm(opts) {
+ if (!(this instanceof IncomingForm)) return new IncomingForm;
+ EventEmitter.call(this);
+
+ opts=opts||{};
+
+ this.error = null;
+ this.ended = false;
+
+ this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
+ this.keepExtensions = opts.keepExtensions || false;
+ this.uploadDir = opts.uploadDir || IncomingForm.UPLOAD_DIR;
+ this.encoding = opts.encoding || 'utf-8';
+ this.headers = null;
+ this.type = null;
+ this.hash = false;
+
+ this.bytesReceived = null;
+ this.bytesExpected = null;
+
+ this._parser = null;
+ this._flushing = 0;
+ this._fieldsSize = 0;
+};
+util.inherits(IncomingForm, EventEmitter);
+exports.IncomingForm = IncomingForm;
+
+IncomingForm.UPLOAD_DIR = (function() {
+ var dirs = [process.env.TMP, '/tmp', process.cwd()];
+ for (var i = 0; i < dirs.length; i++) {
+ var dir = dirs[i];
+ var isDirectory = false;
+
+ try {
+ isDirectory = fs.statSync(dir).isDirectory();
+ } catch (e) {}
+
+ if (isDirectory) return dir;
+ }
+})();
+
+IncomingForm.prototype.parse = function(req, cb) {
+ this.pause = function() {
+ try {
+ req.pause();
+ } catch (err) {
+ // the stream was destroyed
+ if (!this.ended) {
+ // before it was completed, crash & burn
+ this._error(err);
+ }
+ return false;
+ }
+ return true;
+ };
+
+ this.resume = function() {
+ try {
+ req.resume();
+ } catch (err) {
+ // the stream was destroyed
+ if (!this.ended) {
+ // before it was completed, crash & burn
+ this._error(err);
+ }
+ return false;
+ }
+
+ return true;
+ };
+
+ this.writeHeaders(req.headers);
+
+ var self = this;
+ req
+ .on('error', function(err) {
+ self._error(err);
+ })
+ .on('aborted', function() {
+ self.emit('aborted');
+ })
+ .on('data', function(buffer) {
+ self.write(buffer);
+ })
+ .on('end', function() {
+ if (self.error) {
+ return;
+ }
+
+ var err = self._parser.end();
+ if (err) {
+ self._error(err);
+ }
+ });
+
+ if (cb) {
+ var fields = {}, files = {};
+ this
+ .on('field', function(name, value) {
+ fields[name] = value;
+ })
+ .on('file', function(name, file) {
+ files[name] = file;
+ })
+ .on('error', function(err) {
+ cb(err, fields, files);
+ })
+ .on('end', function() {
+ cb(null, fields, files);
+ });
+ }
+
+ return this;
+};
+
+IncomingForm.prototype.writeHeaders = function(headers) {
+ this.headers = headers;
+ this._parseContentLength();
+ this._parseContentType();
+};
+
+IncomingForm.prototype.write = function(buffer) {
+ if (!this._parser) {
+ this._error(new Error('unintialized parser'));
+ return;
+ }
+
+ this.bytesReceived += buffer.length;
+ this.emit('progress', this.bytesReceived, this.bytesExpected);
+
+ var bytesParsed = this._parser.write(buffer);
+ if (bytesParsed !== buffer.length) {
+ this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed'));
+ }
+
+ return bytesParsed;
+};
+
+IncomingForm.prototype.pause = function() {
+ // this does nothing, unless overwritten in IncomingForm.parse
+ return false;
+};
+
+IncomingForm.prototype.resume = function() {
+ // this does nothing, unless overwritten in IncomingForm.parse
+ return false;
+};
+
+IncomingForm.prototype.onPart = function(part) {
+ // this method can be overwritten by the user
+ this.handlePart(part);
+};
+
+IncomingForm.prototype.handlePart = function(part) {
+ var self = this;
+
+ if (part.filename === undefined) {
+ var value = ''
+ , decoder = new StringDecoder(this.encoding);
+
+ part.on('data', function(buffer) {
+ self._fieldsSize += buffer.length;
+ if (self._fieldsSize > self.maxFieldsSize) {
+ self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data'));
+ return;
+ }
+ value += decoder.write(buffer);
+ });
+
+ part.on('end', function() {
+ self.emit('field', part.name, value);
+ });
+ return;
+ }
+
+ this._flushing++;
+
+ var file = new File({
+ path: this._uploadPath(part.filename),
+ name: part.filename,
+ type: part.mime,
+ hash: self.hash
+ });
+
+ this.emit('fileBegin', part.name, file);
+
+ file.open();
+
+ part.on('data', function(buffer) {
+ self.pause();
+ file.write(buffer, function() {
+ self.resume();
+ });
+ });
+
+ part.on('end', function() {
+ file.end(function() {
+ self._flushing--;
+ self.emit('file', part.name, file);
+ self._maybeEnd();
+ });
+ });
+};
+
+IncomingForm.prototype._parseContentType = function() {
+ if (!this.headers['content-type']) {
+ this._error(new Error('bad content-type header, no content-type'));
+ return;
+ }
+
+ if (this.headers['content-type'].match(/urlencoded/i)) {
+ this._initUrlencoded();
+ return;
+ }
+
+ if (this.headers['content-type'].match(/multipart/i)) {
+ var m;
+ if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) {
+ this._initMultipart(m[1] || m[2]);
+ } else {
+ this._error(new Error('bad content-type header, no multipart boundary'));
+ }
+ return;
+ }
+
+ this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type']));
+};
+
+IncomingForm.prototype._error = function(err) {
+ if (this.error) {
+ return;
+ }
+
+ this.error = err;
+ this.pause();
+ this.emit('error', err);
+};
+
+IncomingForm.prototype._parseContentLength = function() {
+ if (this.headers['content-length']) {
+ this.bytesReceived = 0;
+ this.bytesExpected = parseInt(this.headers['content-length'], 10);
+ this.emit('progress', this.bytesReceived, this.bytesExpected);
+ }
+};
+
+IncomingForm.prototype._newParser = function() {
+ return new MultipartParser();
+};
+
+IncomingForm.prototype._initMultipart = function(boundary) {
+ this.type = 'multipart';
+
+ var parser = new MultipartParser(),
+ self = this,
+ headerField,
+ headerValue,
+ part;
+
+ parser.initWithBoundary(boundary);
+
+ parser.onPartBegin = function() {
+ part = new Stream();
+ part.readable = true;
+ part.headers = {};
+ part.name = null;
+ part.filename = null;
+ part.mime = null;
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onHeaderField = function(b, start, end) {
+ headerField += b.toString(self.encoding, start, end);
+ };
+
+ parser.onHeaderValue = function(b, start, end) {
+ headerValue += b.toString(self.encoding, start, end);
+ };
+
+ parser.onHeaderEnd = function() {
+ headerField = headerField.toLowerCase();
+ part.headers[headerField] = headerValue;
+
+ var m;
+ if (headerField == 'content-disposition') {
+ if (m = headerValue.match(/name="([^"]+)"/i)) {
+ part.name = m[1];
+ }
+
+ part.filename = self._fileName(headerValue);
+ } else if (headerField == 'content-type') {
+ part.mime = headerValue;
+ }
+
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onHeadersEnd = function() {
+ self.onPart(part);
+ };
+
+ parser.onPartData = function(b, start, end) {
+ part.emit('data', b.slice(start, end));
+ };
+
+ parser.onPartEnd = function() {
+ part.emit('end');
+ };
+
+ parser.onEnd = function() {
+ self.ended = true;
+ self._maybeEnd();
+ };
+
+ this._parser = parser;
+};
+
+IncomingForm.prototype._fileName = function(headerValue) {
+ var m = headerValue.match(/filename="(.*?)"($|; )/i)
+ if (!m) return;
+
+ var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
+ filename = filename.replace(/%22/g, '"');
+ filename = filename.replace(/([\d]{4});/g, function(m, code) {
+ return String.fromCharCode(code);
+ });
+ return filename;
+};
+
+IncomingForm.prototype._initUrlencoded = function() {
+ this.type = 'urlencoded';
+
+ var parser = new QuerystringParser()
+ , self = this;
+
+ parser.onField = function(key, val) {
+ self.emit('field', key, val);
+ };
+
+ parser.onEnd = function() {
+ self.ended = true;
+ self._maybeEnd();
+ };
+
+ this._parser = parser;
+};
+
+IncomingForm.prototype._uploadPath = function(filename) {
+ var name = '';
+ for (var i = 0; i < 32; i++) {
+ name += Math.floor(Math.random() * 16).toString(16);
+ }
+
+ if (this.keepExtensions) {
+ var ext = path.extname(filename);
+ ext = ext.replace(/(\.[a-z0-9]+).*/, '$1')
+
+ name += ext;
+ }
+
+ return path.join(this.uploadDir, name);
+};
+
+IncomingForm.prototype._maybeEnd = function() {
+ if (!this.ended || this._flushing) {
+ return;
+ }
+
+ this.emit('end');
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
new file mode 100644
index 0000000..7a6e3e1
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
@@ -0,0 +1,3 @@
+var IncomingForm = require('./incoming_form').IncomingForm;
+IncomingForm.IncomingForm = IncomingForm;
+module.exports = IncomingForm;
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
new file mode 100644
index 0000000..9ca567c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
@@ -0,0 +1,312 @@
+var Buffer = require('buffer').Buffer,
+ s = 0,
+ S =
+ { PARSER_UNINITIALIZED: s++,
+ START: s++,
+ START_BOUNDARY: s++,
+ HEADER_FIELD_START: s++,
+ HEADER_FIELD: s++,
+ HEADER_VALUE_START: s++,
+ HEADER_VALUE: s++,
+ HEADER_VALUE_ALMOST_DONE: s++,
+ HEADERS_ALMOST_DONE: s++,
+ PART_DATA_START: s++,
+ PART_DATA: s++,
+ PART_END: s++,
+ END: s++,
+ },
+
+ f = 1,
+ F =
+ { PART_BOUNDARY: f,
+ LAST_BOUNDARY: f *= 2,
+ },
+
+ LF = 10,
+ CR = 13,
+ SPACE = 32,
+ HYPHEN = 45,
+ COLON = 58,
+ A = 97,
+ Z = 122,
+
+ lower = function(c) {
+ return c | 0x20;
+ };
+
+for (var s in S) {
+ exports[s] = S[s];
+}
+
+function MultipartParser() {
+ this.boundary = null;
+ this.boundaryChars = null;
+ this.lookbehind = null;
+ this.state = S.PARSER_UNINITIALIZED;
+
+ this.index = null;
+ this.flags = 0;
+};
+exports.MultipartParser = MultipartParser;
+
+MultipartParser.stateToString = function(stateNumber) {
+ for (var state in S) {
+ var number = S[state];
+ if (number === stateNumber) return state;
+ }
+};
+
+MultipartParser.prototype.initWithBoundary = function(str) {
+ this.boundary = new Buffer(str.length+4);
+ this.boundary.write('\r\n--', 'ascii', 0);
+ this.boundary.write(str, 'ascii', 4);
+ this.lookbehind = new Buffer(this.boundary.length+8);
+ this.state = S.START;
+
+ this.boundaryChars = {};
+ for (var i = 0; i < this.boundary.length; i++) {
+ this.boundaryChars[this.boundary[i]] = true;
+ }
+};
+
+MultipartParser.prototype.write = function(buffer) {
+ var self = this,
+ i = 0,
+ len = buffer.length,
+ prevIndex = this.index,
+ index = this.index,
+ state = this.state,
+ flags = this.flags,
+ lookbehind = this.lookbehind,
+ boundary = this.boundary,
+ boundaryChars = this.boundaryChars,
+ boundaryLength = this.boundary.length,
+ boundaryEnd = boundaryLength - 1,
+ bufferLength = buffer.length,
+ c,
+ cl,
+
+ mark = function(name) {
+ self[name+'Mark'] = i;
+ },
+ clear = function(name) {
+ delete self[name+'Mark'];
+ },
+ callback = function(name, buffer, start, end) {
+ if (start !== undefined && start === end) {
+ return;
+ }
+
+ var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
+ if (callbackSymbol in self) {
+ self[callbackSymbol](buffer, start, end);
+ }
+ },
+ dataCallback = function(name, clear) {
+ var markSymbol = name+'Mark';
+ if (!(markSymbol in self)) {
+ return;
+ }
+
+ if (!clear) {
+ callback(name, buffer, self[markSymbol], buffer.length);
+ self[markSymbol] = 0;
+ } else {
+ callback(name, buffer, self[markSymbol], i);
+ delete self[markSymbol];
+ }
+ };
+
+ for (i = 0; i < len; i++) {
+ c = buffer[i];
+ switch (state) {
+ case S.PARSER_UNINITIALIZED:
+ return i;
+ case S.START:
+ index = 0;
+ state = S.START_BOUNDARY;
+ case S.START_BOUNDARY:
+ if (index == boundary.length - 2) {
+ if (c != CR) {
+ return i;
+ }
+ index++;
+ break;
+ } else if (index - 1 == boundary.length - 2) {
+ if (c != LF) {
+ return i;
+ }
+ index = 0;
+ callback('partBegin');
+ state = S.HEADER_FIELD_START;
+ break;
+ }
+
+ if (c != boundary[index+2]) {
+ return i;
+ }
+ index++;
+ break;
+ case S.HEADER_FIELD_START:
+ state = S.HEADER_FIELD;
+ mark('headerField');
+ index = 0;
+ case S.HEADER_FIELD:
+ if (c == CR) {
+ clear('headerField');
+ state = S.HEADERS_ALMOST_DONE;
+ break;
+ }
+
+ index++;
+ if (c == HYPHEN) {
+ break;
+ }
+
+ if (c == COLON) {
+ if (index == 1) {
+ // empty header field
+ return i;
+ }
+ dataCallback('headerField', true);
+ state = S.HEADER_VALUE_START;
+ break;
+ }
+
+ cl = lower(c);
+ if (cl < A || cl > Z) {
+ return i;
+ }
+ break;
+ case S.HEADER_VALUE_START:
+ if (c == SPACE) {
+ break;
+ }
+
+ mark('headerValue');
+ state = S.HEADER_VALUE;
+ case S.HEADER_VALUE:
+ if (c == CR) {
+ dataCallback('headerValue', true);
+ callback('headerEnd');
+ state = S.HEADER_VALUE_ALMOST_DONE;
+ }
+ break;
+ case S.HEADER_VALUE_ALMOST_DONE:
+ if (c != LF) {
+ return i;
+ }
+ state = S.HEADER_FIELD_START;
+ break;
+ case S.HEADERS_ALMOST_DONE:
+ if (c != LF) {
+ return i;
+ }
+
+ callback('headersEnd');
+ state = S.PART_DATA_START;
+ break;
+ case S.PART_DATA_START:
+ state = S.PART_DATA
+ mark('partData');
+ case S.PART_DATA:
+ prevIndex = index;
+
+ if (index == 0) {
+ // boyer-moore derrived algorithm to safely skip non-boundary data
+ i += boundaryEnd;
+ while (i < bufferLength && !(buffer[i] in boundaryChars)) {
+ i += boundaryLength;
+ }
+ i -= boundaryEnd;
+ c = buffer[i];
+ }
+
+ if (index < boundary.length) {
+ if (boundary[index] == c) {
+ if (index == 0) {
+ dataCallback('partData', true);
+ }
+ index++;
+ } else {
+ index = 0;
+ }
+ } else if (index == boundary.length) {
+ index++;
+ if (c == CR) {
+ // CR = part boundary
+ flags |= F.PART_BOUNDARY;
+ } else if (c == HYPHEN) {
+ // HYPHEN = end boundary
+ flags |= F.LAST_BOUNDARY;
+ } else {
+ index = 0;
+ }
+ } else if (index - 1 == boundary.length) {
+ if (flags & F.PART_BOUNDARY) {
+ index = 0;
+ if (c == LF) {
+ // unset the PART_BOUNDARY flag
+ flags &= ~F.PART_BOUNDARY;
+ callback('partEnd');
+ callback('partBegin');
+ state = S.HEADER_FIELD_START;
+ break;
+ }
+ } else if (flags & F.LAST_BOUNDARY) {
+ if (c == HYPHEN) {
+ callback('partEnd');
+ callback('end');
+ state = S.END;
+ } else {
+ index = 0;
+ }
+ } else {
+ index = 0;
+ }
+ }
+
+ if (index > 0) {
+ // when matching a possible boundary, keep a lookbehind reference
+ // in case it turns out to be a false lead
+ lookbehind[index-1] = c;
+ } else if (prevIndex > 0) {
+ // if our boundary turned out to be rubbish, the captured lookbehind
+ // belongs to partData
+ callback('partData', lookbehind, 0, prevIndex);
+ prevIndex = 0;
+ mark('partData');
+
+ // reconsider the current character even so it interrupted the sequence
+ // it could be the beginning of a new sequence
+ i--;
+ }
+
+ break;
+ case S.END:
+ break;
+ default:
+ return i;
+ }
+ }
+
+ dataCallback('headerField');
+ dataCallback('headerValue');
+ dataCallback('partData');
+
+ this.index = index;
+ this.state = state;
+ this.flags = flags;
+
+ return len;
+};
+
+MultipartParser.prototype.end = function() {
+ if (this.state != S.END) {
+ return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain());
+ }
+};
+
+MultipartParser.prototype.explain = function() {
+ return 'state = ' + MultipartParser.stateToString(this.state);
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
new file mode 100644
index 0000000..63f109e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
@@ -0,0 +1,25 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+// This is a buffering parser, not quite as nice as the multipart one.
+// If I find time I'll rewrite this to be fully streaming as well
+var querystring = require('querystring');
+
+function QuerystringParser() {
+ this.buffer = '';
+};
+exports.QuerystringParser = QuerystringParser;
+
+QuerystringParser.prototype.write = function(buffer) {
+ this.buffer += buffer.toString('ascii');
+ return buffer.length;
+};
+
+QuerystringParser.prototype.end = function() {
+ var fields = querystring.parse(this.buffer);
+ for (var field in fields) {
+ this.onField(field, fields[field]);
+ }
+ this.buffer = '';
+
+ this.onEnd();
+};
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js
new file mode 100644
index 0000000..e9493e9
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js
@@ -0,0 +1,6 @@
+// Backwards compatibility ...
+try {
+ module.exports = require('util');
+} catch (e) {
+ module.exports = require('sys');
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile
new file mode 100644
index 0000000..01f7140
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile
@@ -0,0 +1,4 @@
+test:
+ @find test/simple/test-*.js | xargs -n 1 -t node
+
+.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md
new file mode 100644
index 0000000..f8f0c66
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md
@@ -0,0 +1,167 @@
+# Gently
+
+## Purpose
+
+A node.js module that helps with stubbing and behavior verification. It allows you to test the most remote and nested corners of your code while keeping being fully unobtrusive.
+
+## Features
+
+* Overwrite and stub individual object functions
+* Verify that all expected calls have been made in the expected order
+* Restore stubbed functions to their original behavior
+* Detect object / class names from obj.constructor.name and obj.toString()
+* Hijack any required module function or class constructor
+
+## Installation
+
+Via [npm](http://github.com/isaacs/npm):
+
+ npm install gently@latest
+
+## Example
+
+Make sure your dog is working properly:
+
+ function Dog() {}
+
+ Dog.prototype.seeCat = function() {
+ this.bark('whuf, whuf');
+ this.run();
+ }
+
+ Dog.prototype.bark = function(bark) {
+ require('sys').puts(bark);
+ }
+
+ var gently = new (require('gently'))
+ , assert = require('assert')
+ , dog = new Dog();
+
+ gently.expect(dog, 'bark', function(bark) {
+ assert.equal(bark, 'whuf, whuf');
+ });
+ gently.expect(dog, 'run');
+
+ dog.seeCat();
+
+You can also easily test event emitters with this, for example a simple sequence of 2 events emitted by `fs.WriteStream`:
+
+ var gently = new (require('gently'))
+ , stream = new (require('fs').WriteStream)('my_file.txt');
+
+ gently.expect(stream, 'emit', function(event) {
+ assert.equal(event, 'open');
+ });
+
+ gently.expect(stream, 'emit', function(event) {
+ assert.equal(event, 'drain');
+ });
+
+For a full read world example, check out this test case: [test-incoming-form.js](http://github.com/felixge/node-formidable/blob/master/test/simple/test-incoming-form.js) (in [node-formdiable](http://github.com/felixge/node-formidable)).
+
+## API
+
+### Gently
+
+#### new Gently()
+
+Creates a new gently instance. It listens to the process `'exit'` event to make sure all expectations have been verified.
+
+#### gently.expect(obj, method, [[count], stubFn])
+
+Creates an expectation for an objects method to be called. You can optionally specify the call `count` you are expecting, as well as `stubFn` function that will run instead of the original function.
+
+Returns a reference to the function that is getting overwritten.
+
+#### gently.expect([count], stubFn)
+
+Returns a function that is supposed to be executed `count` times, delegating any calls to the provided `stubFn` function. Naming your stubFn closure will help to properly diagnose errors that are being thrown:
+
+ childProcess.exec('ls', gently.expect(function lsCallback(code) {
+ assert.equal(0, code);
+ }));
+
+#### gently.restore(obj, method)
+
+Restores an object method that has been previously overwritten using `gently.expect()`.
+
+#### gently.hijack(realRequire)
+
+Returns a new require functions that catches a reference to all required modules into `gently.hijacked`.
+
+To use this function, include a line like this in your `'my-module.js'`.
+
+ if (global.GENTLY) require = GENTLY.hijack(require);
+
+ var sys = require('sys');
+ exports.hello = function() {
+ sys.log('world');
+ };
+
+Now you can write a test for the module above:
+
+ var gently = global.GENTLY = new (require('gently'))
+ , myModule = require('./my-module');
+
+ gently.expect(gently.hijacked.sys, 'log', function(str) {
+ assert.equal(str, 'world');
+ });
+
+ myModule.hello();
+
+#### gently.stub(location, [exportsName])
+
+Returns a stub class that will be used instead of the real class from the module at `location` with the given `exportsName`.
+
+This allows to test an OOP version of the previous example, where `'my-module.js'`.
+
+ if (global.GENTLY) require = GENTLY.hijack(require);
+
+ var World = require('./world');
+
+ exports.hello = function() {
+ var world = new World();
+ world.hello();
+ }
+
+And `world.js` looks like this:
+
+ var sys = require('sys');
+
+ function World() {
+
+ }
+ module.exports = World;
+
+ World.prototype.hello = function() {
+ sys.log('world');
+ };
+
+Testing `'my-module.js'` can now easily be accomplished:
+
+ var gently = global.GENTLY = new (require('gently'))
+ , WorldStub = gently.stub('./world')
+ , myModule = require('./my-module')
+ , WORLD;
+
+ gently.expect(WorldStub, 'new', function() {
+ WORLD = this;
+ });
+
+ gently.expect(WORLD, 'hello');
+
+ myModule.hello();
+
+#### gently.hijacked
+
+An object that holds the references to all hijacked modules.
+
+#### gently.verify([msg])
+
+Verifies that all expectations of this gently instance have been satisfied. If not called manually, this method is called when the process `'exit'` event is fired.
+
+If `msg` is given, it will appear in any error that might be thrown.
+
+## License
+
+Gently is licensed under the MIT license.
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js
new file mode 100644
index 0000000..022fae0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js
@@ -0,0 +1,22 @@
+require('../test/common');
+function Dog() {}
+
+Dog.prototype.seeCat = function() {
+ this.bark('whuf, whuf');
+ this.run();
+}
+
+Dog.prototype.bark = function(bark) {
+ require('sys').puts(bark);
+}
+
+var gently = new (require('gently'))
+ , assert = require('assert')
+ , dog = new Dog();
+
+gently.expect(dog, 'bark', function(bark) {
+ assert.equal(bark, 'whuf, whuf');
+});
+gently.expect(dog, 'run');
+
+dog.seeCat();
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js
new file mode 100644
index 0000000..7def134
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js
@@ -0,0 +1,11 @@
+require('../test/common');
+var gently = new (require('gently'))
+ , stream = new (require('fs').WriteStream)('my_file.txt');
+
+gently.expect(stream, 'emit', function(event) {
+ assert.equal(event, 'open');
+});
+
+gently.expect(stream, 'emit', function(event) {
+ assert.equal(event, 'drain');
+});
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js
new file mode 100644
index 0000000..69122bd
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/gently');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js
new file mode 100644
index 0000000..8af0e1e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js
@@ -0,0 +1,184 @@
+var path = require('path');
+
+function Gently() {
+ this.expectations = [];
+ this.hijacked = {};
+
+ var self = this;
+ process.addListener('exit', function() {
+ self.verify('process exit');
+ });
+};
+module.exports = Gently;
+
+Gently.prototype.stub = function(location, exportsName) {
+ function Stub() {
+ return Stub['new'].apply(this, arguments);
+ };
+
+ Stub['new'] = function () {};
+
+ var stubName = 'require('+JSON.stringify(location)+')';
+ if (exportsName) {
+ stubName += '.'+exportsName;
+ }
+
+ Stub.prototype.toString = Stub.toString = function() {
+ return stubName;
+ };
+
+ var exports = this.hijacked[location] || {};
+ if (exportsName) {
+ exports[exportsName] = Stub;
+ } else {
+ exports = Stub;
+ }
+
+ this.hijacked[location] = exports;
+ return Stub;
+};
+
+Gently.prototype.hijack = function(realRequire) {
+ var self = this;
+ return function(location) {
+ return self.hijacked[location] = (self.hijacked[location])
+ ? self.hijacked[location]
+ : realRequire(location);
+ };
+};
+
+Gently.prototype.expect = function(obj, method, count, stubFn) {
+ if (typeof obj != 'function' && typeof obj != 'object' && typeof obj != 'number') {
+ throw new Error
+ ( 'Bad 1st argument for gently.expect(), '
+ + 'object, function, or number expected, got: '+(typeof obj)
+ );
+ } else if (typeof obj == 'function' && (typeof method != 'string')) {
+ // expect(stubFn) interface
+ stubFn = obj;
+ obj = null;
+ method = null;
+ count = 1;
+ } else if (typeof method == 'function') {
+ // expect(count, stubFn) interface
+ count = obj;
+ stubFn = method;
+ obj = null;
+ method = null;
+ } else if (typeof count == 'function') {
+ // expect(obj, method, stubFn) interface
+ stubFn = count;
+ count = 1;
+ } else if (count === undefined) {
+ // expect(obj, method) interface
+ count = 1;
+ }
+
+ var name = this._name(obj, method, stubFn);
+ this.expectations.push({obj: obj, method: method, stubFn: stubFn, name: name, count: count});
+
+ var self = this;
+ function delegate() {
+ return self._stubFn(this, obj, method, name, Array.prototype.slice.call(arguments));
+ }
+
+ if (!obj) {
+ return delegate;
+ }
+
+ var original = (obj[method])
+ ? obj[method]._original || obj[method]
+ : undefined;
+
+ obj[method] = delegate;
+ return obj[method]._original = original;
+};
+
+Gently.prototype.restore = function(obj, method) {
+ if (!obj[method] || !obj[method]._original) {
+ throw new Error(this._name(obj, method)+' is not gently stubbed');
+ }
+ obj[method] = obj[method]._original;
+};
+
+Gently.prototype.verify = function(msg) {
+ if (!this.expectations.length) {
+ return;
+ }
+
+ var validExpectations = [];
+ for (var i = 0, l = this.expectations.length; i < l; i++) {
+ var expectation = this.expectations[i];
+
+ if (expectation.count > 0) {
+ validExpectations.push(expectation);
+ }
+ }
+
+ this.expectations = []; // reset so that no duplicate verification attempts are made
+
+ if (!validExpectations.length) {
+ return;
+ }
+
+ var expectation = validExpectations[0];
+
+ throw new Error
+ ( 'Expected call to '+expectation.name+' did not happen'
+ + ( (msg)
+ ? ' ('+msg+')'
+ : ''
+ )
+ );
+};
+
+Gently.prototype._stubFn = function(self, obj, method, name, args) {
+ var expectation = this.expectations[0], obj, method;
+
+ if (!expectation) {
+ throw new Error('Unexpected call to '+name+', no call was expected');
+ }
+
+ if (expectation.obj !== obj || expectation.method !== method) {
+ throw new Error('Unexpected call to '+name+', expected call to '+ expectation.name);
+ }
+
+ expectation.count -= 1;
+ if (expectation.count === 0) {
+ this.expectations.shift();
+
+ // autorestore original if its not a closure
+ // and no more expectations on that object
+ var has_more_expectations = this.expectations.reduce(function (memo, expectation) {
+ return memo || (expectation.obj === obj && expectation.method === method);
+ }, false);
+ if (obj !== null && method !== null && !has_more_expectations) {
+ if (typeof obj[method]._original !== 'undefined') {
+ obj[method] = obj[method]._original;
+ delete obj[method]._original;
+ } else {
+ delete obj[method];
+ }
+ }
+ }
+
+ if (expectation.stubFn) {
+ return expectation.stubFn.apply(self, args);
+ }
+};
+
+Gently.prototype._name = function(obj, method, stubFn) {
+ if (obj) {
+ var objectName = obj.toString();
+ if (objectName == '[object Object]' && obj.constructor.name) {
+ objectName = '['+obj.constructor.name+']';
+ }
+ return (objectName)+'.'+method+'()';
+ }
+
+ if (stubFn.name) {
+ return stubFn.name+'()';
+ }
+
+ return '>> '+stubFn.toString()+' <<';
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js
new file mode 100644
index 0000000..64c1977
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js
@@ -0,0 +1 @@
+module.exports = require('./gently');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json
new file mode 100644
index 0000000..9c1b7a0
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "gently",
+ "version": "0.9.2",
+ "directories": {
+ "lib": "./lib/gently"
+ },
+ "main": "./lib/gently/index",
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": "*"
+ },
+ "optionalDependencies": {}
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js
new file mode 100644
index 0000000..978b5c5
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js
@@ -0,0 +1,8 @@
+var path = require('path')
+ , sys = require('sys');
+
+require.paths.unshift(path.dirname(__dirname)+'/lib');
+
+global.puts = sys.puts;
+global.p = function() {sys.error(sys.inspect.apply(null, arguments))};;
+global.assert = require('assert');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js
new file mode 100644
index 0000000..4f8fe2d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js
@@ -0,0 +1,348 @@
+require('../common');
+var Gently = require('gently')
+ , gently;
+
+function test(test) {
+ process.removeAllListeners('exit');
+ gently = new Gently();
+ test();
+}
+
+test(function constructor() {
+ assert.deepEqual(gently.expectations, []);
+ assert.deepEqual(gently.hijacked, {});
+ assert.equal(gently.constructor.name, 'Gently');
+});
+
+test(function expectBadArgs() {
+ var BAD_ARG = 'oh no';
+ try {
+ gently.expect(BAD_ARG);
+ assert.ok(false, 'throw needs to happen');
+ } catch (e) {
+ assert.equal(e.message, 'Bad 1st argument for gently.expect(), object, function, or number expected, got: '+(typeof BAD_ARG));
+ }
+});
+
+test(function expectObjMethod() {
+ var OBJ = {}, NAME = 'foobar';
+ OBJ.foo = function(x) {
+ return x;
+ };
+
+ gently._name = function() {
+ return NAME;
+ };
+
+ var original = OBJ.foo
+ , stubFn = function() {};
+
+ (function testAddOne() {
+ assert.strictEqual(gently.expect(OBJ, 'foo', stubFn), original);
+
+ assert.equal(gently.expectations.length, 1);
+ var expectation = gently.expectations[0];
+ assert.strictEqual(expectation.obj, OBJ);
+ assert.strictEqual(expectation.method, 'foo');
+ assert.strictEqual(expectation.stubFn, stubFn);
+ assert.strictEqual(expectation.name, NAME);
+ assert.strictEqual(OBJ.foo._original, original);
+ })();
+
+ (function testAddTwo() {
+ gently.expect(OBJ, 'foo', 2, stubFn);
+ assert.equal(gently.expectations.length, 2);
+ assert.strictEqual(OBJ.foo._original, original);
+ })();
+
+ (function testAddOneWithoutMock() {
+ gently.expect(OBJ, 'foo');
+ assert.equal(gently.expectations.length, 3);
+ })();
+
+ var stubFnCalled = 0, SELF = {};
+ gently._stubFn = function(self, obj, method, name, args) {
+ stubFnCalled++;
+ assert.strictEqual(self, SELF);
+ assert.strictEqual(obj, OBJ);
+ assert.strictEqual(method, 'foo');
+ assert.strictEqual(name, NAME);
+ assert.deepEqual(args, [1, 2]);
+ return 23;
+ };
+ assert.equal(OBJ.foo.apply(SELF, [1, 2]), 23);
+ assert.equal(stubFnCalled, 1);
+});
+
+test(function expectClosure() {
+ var NAME = 'MY CLOSURE';
+ function closureFn() {};
+
+ gently._name = function() {
+ return NAME;
+ };
+
+ var fn = gently.expect(closureFn);
+ assert.equal(gently.expectations.length, 1);
+ var expectation = gently.expectations[0];
+ assert.strictEqual(expectation.obj, null);
+ assert.strictEqual(expectation.method, null);
+ assert.strictEqual(expectation.stubFn, closureFn);
+ assert.strictEqual(expectation.name, NAME);
+
+ var stubFnCalled = 0, SELF = {};
+ gently._stubFn = function(self, obj, method, name, args) {
+ stubFnCalled++;
+ assert.strictEqual(self, SELF);
+ assert.strictEqual(obj, null);
+ assert.strictEqual(method, null);
+ assert.strictEqual(name, NAME);
+ assert.deepEqual(args, [1, 2]);
+ return 23;
+ };
+ assert.equal(fn.apply(SELF, [1, 2]), 23);
+ assert.equal(stubFnCalled, 1);
+});
+
+test(function expectClosureCount() {
+ var stubFnCalled = 0;
+ function closureFn() {stubFnCalled++};
+
+ var fn = gently.expect(2, closureFn);
+ assert.equal(gently.expectations.length, 1);
+ fn();
+ assert.equal(gently.expectations.length, 1);
+ fn();
+ assert.equal(stubFnCalled, 2);
+});
+
+test(function restore() {
+ var OBJ = {}, NAME = '[my object].myFn()';
+ OBJ.foo = function(x) {
+ return x;
+ };
+
+ gently._name = function() {
+ return NAME;
+ };
+
+ var original = OBJ.foo;
+ gently.expect(OBJ, 'foo');
+ gently.restore(OBJ, 'foo');
+ assert.strictEqual(OBJ.foo, original);
+
+ (function testError() {
+ try {
+ gently.restore(OBJ, 'foo');
+ assert.ok(false, 'throw needs to happen');
+ } catch (e) {
+ assert.equal(e.message, NAME+' is not gently stubbed');
+ }
+ })();
+});
+
+test(function _stubFn() {
+ var OBJ1 = {toString: function() {return '[OBJ 1]'}}
+ , OBJ2 = {toString: function() {return '[OBJ 2]'}, foo: function () {return 'bar';}}
+ , SELF = {};
+
+ gently.expect(OBJ1, 'foo', function(x) {
+ assert.strictEqual(this, SELF);
+ return x * 2;
+ });
+
+ assert.equal(gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]), 10);
+
+ (function testAutorestore() {
+ assert.equal(OBJ2.foo(), 'bar');
+
+ gently.expect(OBJ2, 'foo', function() {
+ return 'stubbed foo';
+ });
+
+ gently.expect(OBJ2, 'foo', function() {
+ return "didn't restore yet";
+ });
+
+ assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), 'stubbed foo');
+ assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), "didn't restore yet");
+ assert.equal(OBJ2.foo(), 'bar');
+ assert.deepEqual(gently.expectations, []);
+ })();
+
+ (function testNoMoreCallExpected() {
+ try {
+ gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]);
+ assert.ok(false, 'throw needs to happen');
+ } catch (e) {
+ assert.equal(e.message, 'Unexpected call to dummy_name, no call was expected');
+ }
+ })();
+
+ (function testDifferentCallExpected() {
+ gently.expect(OBJ2, 'bar');
+ try {
+ gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]);
+ assert.ok(false, 'throw needs to happen');
+ } catch (e) {
+ assert.equal(e.message, 'Unexpected call to dummy_name, expected call to '+gently._name(OBJ2, 'bar'));
+ }
+
+ assert.equal(gently.expectations.length, 1);
+ })();
+
+ (function testNoMockCallback() {
+ OBJ2.bar();
+ assert.equal(gently.expectations.length, 0);
+ })();
+});
+
+test(function stub() {
+ var LOCATION = './my_class';
+
+ (function testRegular() {
+ var Stub = gently.stub(LOCATION);
+ assert.ok(Stub instanceof Function);
+ assert.strictEqual(gently.hijacked[LOCATION], Stub);
+ assert.ok(Stub['new'] instanceof Function);
+ assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+')');
+
+ (function testConstructor() {
+ var newCalled = 0
+ , STUB
+ , ARGS = ['foo', 'bar'];
+
+ Stub['new'] = function(a, b) {
+ assert.equal(a, ARGS[0]);
+ assert.equal(b, ARGS[1]);
+ newCalled++;
+ STUB = this;
+ };
+
+ var stub = new Stub(ARGS[0], ARGS[1]);
+ assert.strictEqual(stub, STUB);
+ assert.equal(newCalled, 1);
+ assert.equal(stub.toString(), 'require('+JSON.stringify(LOCATION)+')');
+ })();
+
+ (function testUseReturnValueAsInstance() {
+ var R = {};
+
+ Stub['new'] = function() {
+ return R;
+ };
+
+ var stub = new Stub();
+ assert.strictEqual(stub, R);
+
+ })();
+ })();
+
+ var EXPORTS_NAME = 'MyClass';
+ test(function testExportsName() {
+ var Stub = gently.stub(LOCATION, EXPORTS_NAME);
+ assert.strictEqual(gently.hijacked[LOCATION][EXPORTS_NAME], Stub);
+ assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME);
+
+ (function testConstructor() {
+ var stub = new Stub();
+ assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME);
+ })();
+ });
+});
+
+test(function hijack() {
+ var LOCATION = './foo'
+ , REQUIRE_CALLS = 0
+ , EXPORTS = {}
+ , REQUIRE = function() {
+ REQUIRE_CALLS++;
+ return EXPORTS;
+ };
+
+ var hijackedRequire = gently.hijack(REQUIRE);
+ hijackedRequire(LOCATION);
+ assert.strictEqual(gently.hijacked[LOCATION], EXPORTS);
+
+ assert.equal(REQUIRE_CALLS, 1);
+
+ // make sure we are caching the hijacked module
+ hijackedRequire(LOCATION);
+ assert.equal(REQUIRE_CALLS, 1);
+});
+
+test(function verify() {
+ var OBJ = {toString: function() {return '[OBJ]'}};
+ gently.verify();
+
+ gently.expect(OBJ, 'foo');
+ try {
+ gently.verify();
+ assert.ok(false, 'throw needs to happen');
+ } catch (e) {
+ assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen');
+ }
+
+ try {
+ gently.verify('foo');
+ assert.ok(false, 'throw needs to happen');
+ } catch (e) {
+ assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen (foo)');
+ }
+});
+
+test(function processExit() {
+ var verifyCalled = 0;
+ gently.verify = function(msg) {
+ verifyCalled++;
+ assert.equal(msg, 'process exit');
+ };
+
+ process.emit('exit');
+ assert.equal(verifyCalled, 1);
+});
+
+test(function _name() {
+ (function testNamedClass() {
+ function Foo() {};
+ var foo = new Foo();
+ assert.equal(gently._name(foo, 'bar'), '[Foo].bar()');
+ })();
+
+ (function testToStringPreference() {
+ function Foo() {};
+ Foo.prototype.toString = function() {
+ return '[Superman 123]';
+ };
+ var foo = new Foo();
+ assert.equal(gently._name(foo, 'bar'), '[Superman 123].bar()');
+ })();
+
+ (function testUnamedClass() {
+ var Foo = function() {};
+ var foo = new Foo();
+ assert.equal(gently._name(foo, 'bar'), foo.toString()+'.bar()');
+ })();
+
+ (function testNamedClosure() {
+ function myClosure() {};
+ assert.equal(gently._name(null, null, myClosure), myClosure.name+'()');
+ })();
+
+ (function testUnamedClosure() {
+ var myClosure = function() {2+2 == 5};
+ assert.equal(gently._name(null, null, myClosure), '>> '+myClosure.toString()+' <<');
+ })();
+});
+
+test(function verifyExpectNone() {
+ var OBJ = {toString: function() {return '[OBJ]'}};
+ gently.verify();
+
+ gently.expect(OBJ, 'foo', 0);
+ try {
+ gently.verify();
+ } catch (e) {
+ assert.fail('Exception should not have been thrown');
+ }
+});
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/package.json
new file mode 100644
index 0000000..6d368f3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "formidable",
+ "version": "1.0.11",
+ "dependencies": {},
+ "devDependencies": {
+ "gently": "0.8.0",
+ "findit": "0.1.1",
+ "hashish": "0.0.4",
+ "urun": "0.0.4",
+ "utest": "0.0.3"
+ },
+ "directories": {
+ "lib": "./lib"
+ },
+ "main": "./lib/index",
+ "scripts": {
+ "test": "make test"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "optionalDependencies": {},
+ "readme": "# Formidable\n\n[](http://travis-ci.org/felixge/node-formidable)\n\n## Purpose\n\nA node.js module for parsing form data, especially file uploads.\n\n## Current status\n\nThis module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading\nand encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from\na large variety of clients and is considered production-ready.\n\n## Features\n\n* Fast (~500mb/sec), non-buffering multipart parser\n* Automatically writing file uploads to disk\n* Low memory footprint\n* Graceful error handling\n* Very high test coverage\n\n## Changelog\n\n### v1.0.9\n\n* Emit progress when content length header parsed (Tim Koschützki)\n* Fix Readme syntax due to GitHub changes (goob)\n* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)\n\n### v1.0.8\n\n* Strip potentially unsafe characters when using `keepExtensions: true`.\n* Switch to utest / urun for testing\n* Add travis build\n\n### v1.0.7\n\n* Remove file from package that was causing problems when installing on windows. (#102)\n* Fix typos in Readme (Jason Davies).\n\n### v1.0.6\n\n* Do not default to the default to the field name for file uploads where\n filename=\"\".\n\n### v1.0.5\n\n* Support filename=\"\" in multipart parts\n* Explain unexpected end() errors in parser better\n\n**Note:** Starting with this version, formidable emits 'file' events for empty\nfile input fields. Previously those were incorrectly emitted as regular file\ninput fields with value = \"\".\n\n### v1.0.4\n\n* Detect a good default tmp directory regardless of platform. (#88)\n\n### v1.0.3\n\n* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)\n* Small performance improvements\n* New test suite and fixture system\n\n### v1.0.2\n\n* Exclude node\\_modules folder from git\n* Implement new `'aborted'` event\n* Fix files in example folder to work with recent node versions\n* Make gently a devDependency\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)\n\n### v1.0.1\n\n* Fix package.json to refer to proper main directory. (#68, Dean Landolt)\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)\n\n### v1.0.0\n\n* Add support for multipart boundaries that are quoted strings. (Jeff Craig)\n\nThis marks the beginning of development on version 2.0 which will include\nseveral architectural improvements.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)\n\n### v0.9.11\n\n* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)\n* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class\n\n**Important:** The old property names of the File class will be removed in a\nfuture release.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)\n\n### Older releases\n\nThese releases were done before starting to maintain the above Changelog:\n\n* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)\n* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)\n* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)\n* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)\n* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)\n* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)\n* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)\n* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)\n* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)\n* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)\n\n## Installation\n\nVia [npm](http://github.com/isaacs/npm):\n\n npm install formidable@latest\n\nManually:\n\n git clone git://github.com/felixge/node-formidable.git formidable\n vim my.js\n # var formidable = require('./formidable');\n\nNote: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.\n\n## Example\n\nParse an incoming file upload.\n\n var formidable = require('formidable'),\n http = require('http'),\n\n util = require('util');\n\n http.createServer(function(req, res) {\n if (req.url == '/upload' && req.method.toLowerCase() == 'post') {\n // parse a file upload\n var form = new formidable.IncomingForm();\n form.parse(req, function(err, fields, files) {\n res.writeHead(200, {'content-type': 'text/plain'});\n res.write('received upload:\\n\\n');\n res.end(util.inspect({fields: fields, files: files}));\n });\n return;\n }\n\n // show a file upload form\n res.writeHead(200, {'content-type': 'text/html'});\n res.end(\n ''\n );\n }).listen(80);\n\n## API\n\n### formidable.IncomingForm\n\n__new formidable.IncomingForm()__\n\nCreates a new incoming form.\n\n__incomingForm.encoding = 'utf-8'__\n\nThe encoding to use for incoming form fields.\n\n__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__\n\nThe directory for placing file uploads in. You can move them later on using\n`fs.rename()`. The default directory is picked at module load time depending on\nthe first existing directory from those listed above.\n\n__incomingForm.keepExtensions = false__\n\nIf you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n__incomingForm.type__\n\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n__incomingForm.maxFieldsSize = 2 * 1024 * 1024__\n\nLimits the amount of memory a field (not file) can allocate in bytes.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 2MB.\n\n__incomingForm.hash = false__\n\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n__incomingForm.bytesReceived__\n\nThe amount of bytes received for this form so far.\n\n__incomingForm.bytesExpected__\n\nThe expected number of bytes in this form.\n\n__incomingForm.parse(request, [cb])__\n\nParses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:\n\n incomingForm.parse(req, function(err, fields, files) {\n // ...\n });\n\n__incomingForm.onPart(part)__\n\nYou may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.\n\n incomingForm.onPart = function(part) {\n part.addListener('data', function() {\n // ...\n });\n }\n\nIf you want to use formidable to only handle certain parts for you, you can do so:\n\n incomingForm.onPart = function(part) {\n if (!part.filename) {\n // let formidable handle all non-file parts\n incomingForm.handlePart(part);\n }\n }\n\nCheck the code in this method for further inspiration.\n\n__Event: 'progress' (bytesReceived, bytesExpected)__\n\nEmitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.\n\n__Event: 'field' (name, value)__\n\nEmitted whenever a field / value pair has been received.\n\n__Event: 'fileBegin' (name, file)__\n\nEmitted whenever a new file is detected in the upload stream. Use this even if\nyou want to stream the file to somewhere else while buffering the upload on\nthe file system.\n\n__Event: 'file' (name, file)__\n\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n\n__Event: 'error' (err)__\n\nEmitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.\n\n__Event: 'aborted'__\n\nEmitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).\n\n__Event: 'end' ()__\n\nEmitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.\n\n### formidable.File\n\n__file.size = 0__\n\nThe size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.\n\n__file.path = null__\n\nThe path this file is being written to. You can modify this in the `'fileBegin'` event in\ncase you are unhappy with the way formidable generates a temporary path for your files.\n\n__file.name = null__\n\nThe name this file had according to the uploading client.\n\n__file.type = null__\n\nThe mime type of this file, according to the uploading client.\n\n__file.lastModifiedDate = null__\n\nA date object (or `null`) containing the time this file was last written to. Mostly\nhere for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).\n\n__file.hash = null__\n\nIf hash calculation was set, you can read the hex digest out of this var.\n\n## License\n\nFormidable is licensed under the MIT license.\n\n## Ports\n\n* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable\n\n## Credits\n\n* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js\n",
+ "_id": "formidable@1.0.11",
+ "description": "[](http://travis-ci.org/felixge/node-formidable)",
+ "_from": "formidable@1.0.11"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
new file mode 100644
index 0000000..eb432ad
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
@@ -0,0 +1,19 @@
+var mysql = require('..');
+var path = require('path');
+
+var root = path.join(__dirname, '../');
+exports.dir = {
+ root : root,
+ lib : root + '/lib',
+ fixture : root + '/test/fixture',
+ tmp : root + '/test/tmp',
+};
+
+exports.port = 13532;
+
+exports.formidable = require('..');
+exports.assert = require('assert');
+
+exports.require = function(lib) {
+ return require(exports.dir.lib + '/' + lib);
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
new file mode 100644
index 0000000..e7a4785
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
@@ -0,0 +1 @@
+I am a text file with a funky name!
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
new file mode 100644
index 0000000..9b6903e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
@@ -0,0 +1 @@
+I am a plain text file
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
new file mode 100644
index 0000000..3c9dbe3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
@@ -0,0 +1,3 @@
+* Opera does not allow submitting this file, it shows a warning to the
+ user that the file could not be found instead. Tested in 9.8, 11.51 on OSX.
+ Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com).
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
new file mode 100644
index 0000000..0bae449
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
@@ -0,0 +1,3 @@
+module.exports['generic.http'] = [
+ {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'},
+];
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
new file mode 100644
index 0000000..eb76fdc
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
@@ -0,0 +1,21 @@
+var properFilename = 'funkyfilename.txt';
+
+function expect(filename) {
+ return [
+ {type: 'field', name: 'title', value: 'Weird filename'},
+ {type: 'file', name: 'upload', filename: filename, fixture: properFilename},
+ ];
+};
+
+var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
+var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt";
+
+module.exports = {
+ 'osx-chrome-13.http' : expect(webkit),
+ 'osx-firefox-3.6.http' : expect(ffOrIe),
+ 'osx-safari-5.http' : expect(webkit),
+ 'xp-chrome-12.http' : expect(webkit),
+ 'xp-ie-7.http' : expect(ffOrIe),
+ 'xp-ie-8.http' : expect(ffOrIe),
+ 'xp-safari-5.http' : expect(webkit),
+};
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
new file mode 100644
index 0000000..a476169
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
@@ -0,0 +1,72 @@
+exports['rfc1867'] =
+ { boundary: 'AaB03x',
+ raw:
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="field1"\r\n'+
+ '\r\n'+
+ 'Joe Blow\r\nalmost tricked you!\r\n'+
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
+ 'Content-Type: text/plain\r\n'+
+ '\r\n'+
+ '... contents of file1.txt ...\r\r\n'+
+ '--AaB03x--\r\n',
+ parts:
+ [ { headers: {
+ 'content-disposition': 'form-data; name="field1"',
+ },
+ data: 'Joe Blow\r\nalmost tricked you!',
+ },
+ { headers: {
+ 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
+ 'Content-Type': 'text/plain',
+ },
+ data: '... contents of file1.txt ...\r',
+ }
+ ]
+ };
+
+exports['noTrailing\r\n'] =
+ { boundary: 'AaB03x',
+ raw:
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="field1"\r\n'+
+ '\r\n'+
+ 'Joe Blow\r\nalmost tricked you!\r\n'+
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
+ 'Content-Type: text/plain\r\n'+
+ '\r\n'+
+ '... contents of file1.txt ...\r\r\n'+
+ '--AaB03x--',
+ parts:
+ [ { headers: {
+ 'content-disposition': 'form-data; name="field1"',
+ },
+ data: 'Joe Blow\r\nalmost tricked you!',
+ },
+ { headers: {
+ 'content-disposition': 'form-data; name="pics"; filename="file1.txt"',
+ 'Content-Type': 'text/plain',
+ },
+ data: '... contents of file1.txt ...\r',
+ }
+ ]
+ };
+
+exports['emptyHeader'] =
+ { boundary: 'AaB03x',
+ raw:
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="field1"\r\n'+
+ ': foo\r\n'+
+ '\r\n'+
+ 'Joe Blow\r\nalmost tricked you!\r\n'+
+ '--AaB03x\r\n'+
+ 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+
+ 'Content-Type: text/plain\r\n'+
+ '\r\n'+
+ '... contents of file1.txt ...\r\r\n'+
+ '--AaB03x--\r\n',
+ expectError: true,
+ };
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
new file mode 100644
index 0000000..66ad259
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
@@ -0,0 +1,89 @@
+var hashish = require('hashish');
+var fs = require('fs');
+var findit = require('findit');
+var path = require('path');
+var http = require('http');
+var net = require('net');
+var assert = require('assert');
+
+var common = require('../common');
+var formidable = common.formidable;
+
+var server = http.createServer();
+server.listen(common.port, findFixtures);
+
+function findFixtures() {
+ var fixtures = [];
+ findit
+ .sync(common.dir.fixture + '/js')
+ .forEach(function(jsPath) {
+ if (!/\.js$/.test(jsPath)) return;
+
+ var group = path.basename(jsPath, '.js');
+ hashish.forEach(require(jsPath), function(fixture, name) {
+ fixtures.push({
+ name : group + '/' + name,
+ fixture : fixture,
+ });
+ });
+ });
+
+ testNext(fixtures);
+}
+
+function testNext(fixtures) {
+ var fixture = fixtures.shift();
+ if (!fixture) return server.close();
+
+ var name = fixture.name;
+ var fixture = fixture.fixture;
+
+ uploadFixture(name, function(err, parts) {
+ if (err) throw err;
+
+ fixture.forEach(function(expectedPart, i) {
+ var parsedPart = parts[i];
+ assert.equal(parsedPart.type, expectedPart.type);
+ assert.equal(parsedPart.name, expectedPart.name);
+
+ if (parsedPart.type === 'file') {
+ var filename = parsedPart.value.name;
+ assert.equal(filename, expectedPart.filename);
+ }
+ });
+
+ testNext(fixtures);
+ });
+};
+
+function uploadFixture(name, cb) {
+ server.once('request', function(req, res) {
+ var form = new formidable.IncomingForm();
+ form.uploadDir = common.dir.tmp;
+ form.parse(req);
+
+ function callback() {
+ var realCallback = cb;
+ cb = function() {};
+ realCallback.apply(null, arguments);
+ }
+
+ var parts = [];
+ form
+ .on('error', callback)
+ .on('fileBegin', function(name, value) {
+ parts.push({type: 'file', name: name, value: value});
+ })
+ .on('field', function(name, value) {
+ parts.push({type: 'field', name: name, value: value});
+ })
+ .on('end', function() {
+ callback(null, parts);
+ });
+ });
+
+ var socket = net.createConnection(common.port);
+ var file = fs.createReadStream(common.dir.fixture + '/http/' + name);
+
+ file.pipe(socket);
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
new file mode 100644
index 0000000..2b98598
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
@@ -0,0 +1,24 @@
+var path = require('path'),
+ fs = require('fs');
+
+try {
+ global.Gently = require('gently');
+} catch (e) {
+ throw new Error('this test suite requires node-gently');
+}
+
+exports.lib = path.join(__dirname, '../../lib');
+
+global.GENTLY = new Gently();
+
+global.assert = require('assert');
+global.TEST_PORT = 13532;
+global.TEST_FIXTURES = path.join(__dirname, '../fixture');
+global.TEST_TMP = path.join(__dirname, '../tmp');
+
+// Stupid new feature in node that complains about gently attaching too many
+// listeners to process 'exit'. This is a workaround until I can think of a
+// better way to deal with this.
+if (process.setMaxListeners) {
+ process.setMaxListeners(10000);
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
new file mode 100644
index 0000000..75232aa
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
@@ -0,0 +1,80 @@
+var common = require('../common');
+var CHUNK_LENGTH = 10,
+ multipartParser = require(common.lib + '/multipart_parser'),
+ MultipartParser = multipartParser.MultipartParser,
+ parser = new MultipartParser(),
+ fixtures = require(TEST_FIXTURES + '/multipart'),
+ Buffer = require('buffer').Buffer;
+
+Object.keys(fixtures).forEach(function(name) {
+ var fixture = fixtures[name],
+ buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')),
+ offset = 0,
+ chunk,
+ nparsed,
+
+ parts = [],
+ part = null,
+ headerField,
+ headerValue,
+ endCalled = '';
+
+ parser.initWithBoundary(fixture.boundary);
+ parser.onPartBegin = function() {
+ part = {headers: {}, data: ''};
+ parts.push(part);
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onHeaderField = function(b, start, end) {
+ headerField += b.toString('ascii', start, end);
+ };
+
+ parser.onHeaderValue = function(b, start, end) {
+ headerValue += b.toString('ascii', start, end);
+ }
+
+ parser.onHeaderEnd = function() {
+ part.headers[headerField] = headerValue;
+ headerField = '';
+ headerValue = '';
+ };
+
+ parser.onPartData = function(b, start, end) {
+ var str = b.toString('ascii', start, end);
+ part.data += b.slice(start, end);
+ }
+
+ parser.onEnd = function() {
+ endCalled = true;
+ }
+
+ buffer.write(fixture.raw, 'binary', 0);
+
+ while (offset < buffer.length) {
+ if (offset + CHUNK_LENGTH < buffer.length) {
+ chunk = buffer.slice(offset, offset+CHUNK_LENGTH);
+ } else {
+ chunk = buffer.slice(offset, buffer.length);
+ }
+ offset = offset + CHUNK_LENGTH;
+
+ nparsed = parser.write(chunk);
+ if (nparsed != chunk.length) {
+ if (fixture.expectError) {
+ return;
+ }
+ puts('-- ERROR --');
+ p(chunk.toString('ascii'));
+ throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!');
+ }
+ }
+
+ if (fixture.expectError) {
+ throw new Error('expected parse error did not happen');
+ }
+
+ assert.ok(endCalled);
+ assert.deepEqual(parts, fixture.parts);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
new file mode 100644
index 0000000..52ceedb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
@@ -0,0 +1,104 @@
+var common = require('../common');
+var WriteStreamStub = GENTLY.stub('fs', 'WriteStream');
+
+var File = require(common.lib + '/file'),
+ EventEmitter = require('events').EventEmitter,
+ file,
+ gently;
+
+function test(test) {
+ gently = new Gently();
+ file = new File();
+ test();
+ gently.verify(test.name);
+}
+
+test(function constructor() {
+ assert.ok(file instanceof EventEmitter);
+ assert.strictEqual(file.size, 0);
+ assert.strictEqual(file.path, null);
+ assert.strictEqual(file.name, null);
+ assert.strictEqual(file.type, null);
+ assert.strictEqual(file.lastModifiedDate, null);
+
+ assert.strictEqual(file._writeStream, null);
+
+ (function testSetProperties() {
+ var file2 = new File({foo: 'bar'});
+ assert.equal(file2.foo, 'bar');
+ })();
+});
+
+test(function open() {
+ var WRITE_STREAM;
+ file.path = '/foo';
+
+ gently.expect(WriteStreamStub, 'new', function (path) {
+ WRITE_STREAM = this;
+ assert.strictEqual(path, file.path);
+ });
+
+ file.open();
+ assert.strictEqual(file._writeStream, WRITE_STREAM);
+});
+
+test(function write() {
+ var BUFFER = {length: 10},
+ CB_STUB,
+ CB = function() {
+ CB_STUB.apply(this, arguments);
+ };
+
+ file._writeStream = {};
+
+ gently.expect(file._writeStream, 'write', function (buffer, cb) {
+ assert.strictEqual(buffer, BUFFER);
+
+ gently.expect(file, 'emit', function (event, bytesWritten) {
+ assert.ok(file.lastModifiedDate instanceof Date);
+ assert.equal(event, 'progress');
+ assert.equal(bytesWritten, file.size);
+ });
+
+ CB_STUB = gently.expect(function writeCb() {
+ assert.equal(file.size, 10);
+ });
+
+ cb();
+
+ gently.expect(file, 'emit', function (event, bytesWritten) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesWritten, file.size);
+ });
+
+ CB_STUB = gently.expect(function writeCb() {
+ assert.equal(file.size, 20);
+ });
+
+ cb();
+ });
+
+ file.write(BUFFER, CB);
+});
+
+test(function end() {
+ var CB_STUB,
+ CB = function() {
+ CB_STUB.apply(this, arguments);
+ };
+
+ file._writeStream = {};
+
+ gently.expect(file._writeStream, 'end', function (cb) {
+ gently.expect(file, 'emit', function (event) {
+ assert.equal(event, 'end');
+ });
+
+ CB_STUB = gently.expect(function endCb() {
+ });
+
+ cb();
+ });
+
+ file.end(CB);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
new file mode 100644
index 0000000..84de439
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
@@ -0,0 +1,727 @@
+var common = require('../common');
+var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'),
+ QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'),
+ EventEmitterStub = GENTLY.stub('events', 'EventEmitter'),
+ StreamStub = GENTLY.stub('stream', 'Stream'),
+ FileStub = GENTLY.stub('./file');
+
+var formidable = require(common.lib + '/index'),
+ IncomingForm = formidable.IncomingForm,
+ events = require('events'),
+ fs = require('fs'),
+ path = require('path'),
+ Buffer = require('buffer').Buffer,
+ fixtures = require(TEST_FIXTURES + '/multipart'),
+ form,
+ gently;
+
+function test(test) {
+ gently = new Gently();
+ gently.expect(EventEmitterStub, 'call');
+ form = new IncomingForm();
+ test();
+ gently.verify(test.name);
+}
+
+test(function constructor() {
+ assert.strictEqual(form.error, null);
+ assert.strictEqual(form.ended, false);
+ assert.strictEqual(form.type, null);
+ assert.strictEqual(form.headers, null);
+ assert.strictEqual(form.keepExtensions, false);
+ assert.strictEqual(form.uploadDir, '/tmp');
+ assert.strictEqual(form.encoding, 'utf-8');
+ assert.strictEqual(form.bytesReceived, null);
+ assert.strictEqual(form.bytesExpected, null);
+ assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024);
+ assert.strictEqual(form._parser, null);
+ assert.strictEqual(form._flushing, 0);
+ assert.strictEqual(form._fieldsSize, 0);
+ assert.ok(form instanceof EventEmitterStub);
+ assert.equal(form.constructor.name, 'IncomingForm');
+
+ (function testSimpleConstructor() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = IncomingForm();
+ assert.ok(form instanceof IncomingForm);
+ })();
+
+ (function testSimpleConstructorShortcut() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = formidable();
+ assert.ok(form instanceof IncomingForm);
+ })();
+});
+
+test(function parse() {
+ var REQ = {headers: {}}
+ , emit = {};
+
+ gently.expect(form, 'writeHeaders', function(headers) {
+ assert.strictEqual(headers, REQ.headers);
+ });
+
+ var events = ['error', 'aborted', 'data', 'end'];
+ gently.expect(REQ, 'on', events.length, function(event, fn) {
+ assert.equal(event, events.shift());
+ emit[event] = fn;
+ return this;
+ });
+
+ form.parse(REQ);
+
+ (function testPause() {
+ gently.expect(REQ, 'pause');
+ assert.strictEqual(form.pause(), true);
+ })();
+
+ (function testPauseCriticalException() {
+ form.ended = false;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'pause', function() {
+ throw ERR;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.strictEqual(err, ERR);
+ });
+
+ assert.strictEqual(form.pause(), false);
+ })();
+
+ (function testPauseHarmlessException() {
+ form.ended = true;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'pause', function() {
+ throw ERR;
+ });
+
+ assert.strictEqual(form.pause(), false);
+ })();
+
+ (function testResume() {
+ gently.expect(REQ, 'resume');
+ assert.strictEqual(form.resume(), true);
+ })();
+
+ (function testResumeCriticalException() {
+ form.ended = false;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'resume', function() {
+ throw ERR;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.strictEqual(err, ERR);
+ });
+
+ assert.strictEqual(form.resume(), false);
+ })();
+
+ (function testResumeHarmlessException() {
+ form.ended = true;
+
+ var ERR = new Error('dasdsa');
+ gently.expect(REQ, 'resume', function() {
+ throw ERR;
+ });
+
+ assert.strictEqual(form.resume(), false);
+ })();
+
+ (function testEmitError() {
+ var ERR = new Error('something bad happened');
+ gently.expect(form, '_error',function(err) {
+ assert.strictEqual(err, ERR);
+ });
+ emit.error(ERR);
+ })();
+
+ (function testEmitAborted() {
+ gently.expect(form, 'emit',function(event) {
+ assert.equal(event, 'aborted');
+ });
+
+ emit.aborted();
+ })();
+
+
+ (function testEmitData() {
+ var BUFFER = [1, 2, 3];
+ gently.expect(form, 'write', function(buffer) {
+ assert.strictEqual(buffer, BUFFER);
+ });
+ emit.data(BUFFER);
+ })();
+
+ (function testEmitEnd() {
+ form._parser = {};
+
+ (function testWithError() {
+ var ERR = new Error('haha');
+ gently.expect(form._parser, 'end', function() {
+ return ERR;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.strictEqual(err, ERR);
+ });
+
+ emit.end();
+ })();
+
+ (function testWithoutError() {
+ gently.expect(form._parser, 'end');
+ emit.end();
+ })();
+
+ (function testAfterError() {
+ form.error = true;
+ emit.end();
+ })();
+ })();
+
+ (function testWithCallback() {
+ gently.expect(EventEmitterStub, 'call');
+ var form = new IncomingForm(),
+ REQ = {headers: {}},
+ parseCalled = 0;
+
+ gently.expect(form, 'writeHeaders');
+ gently.expect(REQ, 'on', 4, function() {
+ return this;
+ });
+
+ gently.expect(form, 'on', 4, function(event, fn) {
+ if (event == 'field') {
+ fn('field1', 'foo');
+ fn('field1', 'bar');
+ fn('field2', 'nice');
+ }
+
+ if (event == 'file') {
+ fn('file1', '1');
+ fn('file1', '2');
+ fn('file2', '3');
+ }
+
+ if (event == 'end') {
+ fn();
+ }
+ return this;
+ });
+
+ form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) {
+ assert.deepEqual(fields, {field1: 'bar', field2: 'nice'});
+ assert.deepEqual(files, {file1: '2', file2: '3'});
+ }));
+
+ gently.expect(form, 'writeHeaders');
+ gently.expect(REQ, 'on', 4, function() {
+ return this;
+ });
+
+ var ERR = new Error('test');
+ gently.expect(form, 'on', 3, function(event, fn) {
+ if (event == 'field') {
+ fn('foo', 'bar');
+ }
+
+ if (event == 'error') {
+ fn(ERR);
+ gently.expect(form, 'on');
+ }
+ return this;
+ });
+
+ form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) {
+ assert.strictEqual(err, ERR);
+ assert.deepEqual(fields, {foo: 'bar'});
+ }));
+ })();
+});
+
+test(function pause() {
+ assert.strictEqual(form.pause(), false);
+});
+
+test(function resume() {
+ assert.strictEqual(form.resume(), false);
+});
+
+
+test(function writeHeaders() {
+ var HEADERS = {};
+ gently.expect(form, '_parseContentLength');
+ gently.expect(form, '_parseContentType');
+
+ form.writeHeaders(HEADERS);
+ assert.strictEqual(form.headers, HEADERS);
+});
+
+test(function write() {
+ var parser = {},
+ BUFFER = [1, 2, 3];
+
+ form._parser = parser;
+ form.bytesExpected = 523423;
+
+ (function testBasic() {
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, BUFFER.length);
+ assert.equal(bytesExpected, form.bytesExpected);
+ });
+
+ gently.expect(parser, 'write', function(buffer) {
+ assert.strictEqual(buffer, BUFFER);
+ return buffer.length;
+ });
+
+ assert.equal(form.write(BUFFER), BUFFER.length);
+ assert.equal(form.bytesReceived, BUFFER.length);
+ })();
+
+ (function testParserError() {
+ gently.expect(form, 'emit');
+
+ gently.expect(parser, 'write', function(buffer) {
+ assert.strictEqual(buffer, BUFFER);
+ return buffer.length - 1;
+ });
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/parser error/i));
+ });
+
+ assert.equal(form.write(BUFFER), BUFFER.length - 1);
+ assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length);
+ })();
+
+ (function testUninitialized() {
+ delete form._parser;
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/unintialized parser/i));
+ });
+ form.write(BUFFER);
+ })();
+});
+
+test(function parseContentType() {
+ var HEADERS = {};
+
+ form.headers = {'content-type': 'application/x-www-form-urlencoded'};
+ gently.expect(form, '_initUrlencoded');
+ form._parseContentType();
+
+ // accept anything that has 'urlencoded' in it
+ form.headers = {'content-type': 'broken-client/urlencoded-stupid'};
+ gently.expect(form, '_initUrlencoded');
+ form._parseContentType();
+
+ var BOUNDARY = '---------------------------57814261102167618332366269';
+ form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY};
+
+ gently.expect(form, '_initMultipart', function(boundary) {
+ assert.equal(boundary, BOUNDARY);
+ });
+ form._parseContentType();
+
+ (function testQuotedBoundary() {
+ form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'};
+
+ gently.expect(form, '_initMultipart', function(boundary) {
+ assert.equal(boundary, BOUNDARY);
+ });
+ form._parseContentType();
+ })();
+
+ (function testNoBoundary() {
+ form.headers = {'content-type': 'multipart/form-data'};
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/no multipart boundary/i));
+ });
+ form._parseContentType();
+ })();
+
+ (function testNoContentType() {
+ form.headers = {};
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/no content-type/i));
+ });
+ form._parseContentType();
+ })();
+
+ (function testUnknownContentType() {
+ form.headers = {'content-type': 'invalid'};
+
+ gently.expect(form, '_error', function(err) {
+ assert.ok(err.message.match(/unknown content-type/i));
+ });
+ form._parseContentType();
+ })();
+});
+
+test(function parseContentLength() {
+ var HEADERS = {};
+
+ form.headers = {};
+ form._parseContentLength();
+ assert.strictEqual(form.bytesReceived, null);
+ assert.strictEqual(form.bytesExpected, null);
+
+ form.headers['content-length'] = '8';
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, 0);
+ assert.equal(bytesExpected, 8);
+ });
+ form._parseContentLength();
+ assert.strictEqual(form.bytesReceived, 0);
+ assert.strictEqual(form.bytesExpected, 8);
+
+ // JS can be evil, lets make sure we are not
+ form.headers['content-length'] = '08';
+ gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) {
+ assert.equal(event, 'progress');
+ assert.equal(bytesReceived, 0);
+ assert.equal(bytesExpected, 8);
+ });
+ form._parseContentLength();
+ assert.strictEqual(form.bytesExpected, 8);
+});
+
+test(function _initMultipart() {
+ var BOUNDARY = '123',
+ PARSER;
+
+ gently.expect(MultipartParserStub, 'new', function() {
+ PARSER = this;
+ });
+
+ gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) {
+ assert.equal(boundary, BOUNDARY);
+ });
+
+ form._initMultipart(BOUNDARY);
+ assert.equal(form.type, 'multipart');
+ assert.strictEqual(form._parser, PARSER);
+
+ (function testRegularField() {
+ var PART;
+ gently.expect(StreamStub, 'new', function() {
+ PART = this;
+ });
+
+ gently.expect(form, 'onPart', function(part) {
+ assert.strictEqual(part, PART);
+ assert.deepEqual
+ ( part.headers
+ , { 'content-disposition': 'form-data; name="field1"'
+ , 'foo': 'bar'
+ }
+ );
+ assert.equal(part.name, 'field1');
+
+ var strings = ['hello', ' world'];
+ gently.expect(part, 'emit', 2, function(event, b) {
+ assert.equal(event, 'data');
+ assert.equal(b.toString(), strings.shift());
+ });
+
+ gently.expect(part, 'emit', function(event, b) {
+ assert.equal(event, 'end');
+ });
+ });
+
+ PARSER.onPartBegin();
+ PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10);
+ PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19);
+ PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14);
+ PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24);
+ PARSER.onHeaderEnd();
+ PARSER.onHeaderField(new Buffer('foo'), 0, 3);
+ PARSER.onHeaderValue(new Buffer('bar'), 0, 3);
+ PARSER.onHeaderEnd();
+ PARSER.onHeadersEnd();
+ PARSER.onPartData(new Buffer('hello world'), 0, 5);
+ PARSER.onPartData(new Buffer('hello world'), 5, 11);
+ PARSER.onPartEnd();
+ })();
+
+ (function testFileField() {
+ var PART;
+ gently.expect(StreamStub, 'new', function() {
+ PART = this;
+ });
+
+ gently.expect(form, 'onPart', function(part) {
+ assert.deepEqual
+ ( part.headers
+ , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'
+ , 'content-type': 'text/plain'
+ }
+ );
+ assert.equal(part.name, 'field2');
+ assert.equal(part.filename, 'Sun"et.jpg');
+ assert.equal(part.mime, 'text/plain');
+
+ gently.expect(part, 'emit', function(event, b) {
+ assert.equal(event, 'data');
+ assert.equal(b.toString(), '... contents of file1.txt ...');
+ });
+
+ gently.expect(part, 'emit', function(event, b) {
+ assert.equal(event, 'end');
+ });
+ });
+
+ PARSER.onPartBegin();
+ PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19);
+ PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85);
+ PARSER.onHeaderEnd();
+ PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12);
+ PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10);
+ PARSER.onHeaderEnd();
+ PARSER.onHeadersEnd();
+ PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29);
+ PARSER.onPartEnd();
+ })();
+
+ (function testEnd() {
+ gently.expect(form, '_maybeEnd');
+ PARSER.onEnd();
+ assert.ok(form.ended);
+ })();
+});
+
+test(function _fileName() {
+ // TODO
+ return;
+});
+
+test(function _initUrlencoded() {
+ var PARSER;
+
+ gently.expect(QuerystringParserStub, 'new', function() {
+ PARSER = this;
+ });
+
+ form._initUrlencoded();
+ assert.equal(form.type, 'urlencoded');
+ assert.strictEqual(form._parser, PARSER);
+
+ (function testOnField() {
+ var KEY = 'KEY', VAL = 'VAL';
+ gently.expect(form, 'emit', function(field, key, val) {
+ assert.equal(field, 'field');
+ assert.equal(key, KEY);
+ assert.equal(val, VAL);
+ });
+
+ PARSER.onField(KEY, VAL);
+ })();
+
+ (function testOnEnd() {
+ gently.expect(form, '_maybeEnd');
+
+ PARSER.onEnd();
+ assert.equal(form.ended, true);
+ })();
+});
+
+test(function _error() {
+ var ERR = new Error('bla');
+
+ gently.expect(form, 'pause');
+ gently.expect(form, 'emit', function(event, err) {
+ assert.equal(event, 'error');
+ assert.strictEqual(err, ERR);
+ });
+
+ form._error(ERR);
+ assert.strictEqual(form.error, ERR);
+
+ // make sure _error only does its thing once
+ form._error(ERR);
+});
+
+test(function onPart() {
+ var PART = {};
+ gently.expect(form, 'handlePart', function(part) {
+ assert.strictEqual(part, PART);
+ });
+
+ form.onPart(PART);
+});
+
+test(function handlePart() {
+ (function testUtf8Field() {
+ var PART = new events.EventEmitter();
+ PART.name = 'my_field';
+
+ gently.expect(form, 'emit', function(event, field, value) {
+ assert.equal(event, 'field');
+ assert.equal(field, 'my_field');
+ assert.equal(value, 'hello world: €');
+ });
+
+ form.handlePart(PART);
+ PART.emit('data', new Buffer('hello'));
+ PART.emit('data', new Buffer(' world: '));
+ PART.emit('data', new Buffer([0xE2]));
+ PART.emit('data', new Buffer([0x82, 0xAC]));
+ PART.emit('end');
+ })();
+
+ (function testBinaryField() {
+ var PART = new events.EventEmitter();
+ PART.name = 'my_field2';
+
+ gently.expect(form, 'emit', function(event, field, value) {
+ assert.equal(event, 'field');
+ assert.equal(field, 'my_field2');
+ assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary'));
+ });
+
+ form.encoding = 'binary';
+ form.handlePart(PART);
+ PART.emit('data', new Buffer('hello'));
+ PART.emit('data', new Buffer(' world: '));
+ PART.emit('data', new Buffer([0xE2]));
+ PART.emit('data', new Buffer([0x82, 0xAC]));
+ PART.emit('end');
+ })();
+
+ (function testFieldSize() {
+ form.maxFieldsSize = 8;
+ var PART = new events.EventEmitter();
+ PART.name = 'my_field';
+
+ gently.expect(form, '_error', function(err) {
+ assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data');
+ });
+
+ form.handlePart(PART);
+ form._fieldsSize = 1;
+ PART.emit('data', new Buffer(7));
+ PART.emit('data', new Buffer(1));
+ })();
+
+ (function testFilePart() {
+ var PART = new events.EventEmitter(),
+ FILE = new events.EventEmitter(),
+ PATH = '/foo/bar';
+
+ PART.name = 'my_file';
+ PART.filename = 'sweet.txt';
+ PART.mime = 'sweet.txt';
+
+ gently.expect(form, '_uploadPath', function(filename) {
+ assert.equal(filename, PART.filename);
+ return PATH;
+ });
+
+ gently.expect(FileStub, 'new', function(properties) {
+ assert.equal(properties.path, PATH);
+ assert.equal(properties.name, PART.filename);
+ assert.equal(properties.type, PART.mime);
+ FILE = this;
+
+ gently.expect(form, 'emit', function (event, field, file) {
+ assert.equal(event, 'fileBegin');
+ assert.strictEqual(field, PART.name);
+ assert.strictEqual(file, FILE);
+ });
+
+ gently.expect(FILE, 'open');
+ });
+
+ form.handlePart(PART);
+ assert.equal(form._flushing, 1);
+
+ var BUFFER;
+ gently.expect(form, 'pause');
+ gently.expect(FILE, 'write', function(buffer, cb) {
+ assert.strictEqual(buffer, BUFFER);
+ gently.expect(form, 'resume');
+ // @todo handle cb(new Err)
+ cb();
+ });
+
+ PART.emit('data', BUFFER = new Buffer('test'));
+
+ gently.expect(FILE, 'end', function(cb) {
+ gently.expect(form, 'emit', function(event, field, file) {
+ assert.equal(event, 'file');
+ assert.strictEqual(file, FILE);
+ });
+
+ gently.expect(form, '_maybeEnd');
+
+ cb();
+ assert.equal(form._flushing, 0);
+ });
+
+ PART.emit('end');
+ })();
+});
+
+test(function _uploadPath() {
+ (function testUniqueId() {
+ var UUID_A, UUID_B;
+ gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
+ assert.equal(uploadDir, form.uploadDir);
+ UUID_A = uuid;
+ });
+ form._uploadPath();
+
+ gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) {
+ UUID_B = uuid;
+ });
+ form._uploadPath();
+
+ assert.notEqual(UUID_A, UUID_B);
+ })();
+
+ (function testFileExtension() {
+ form.keepExtensions = true;
+ var FILENAME = 'foo.jpg',
+ EXT = '.bar';
+
+ gently.expect(GENTLY.hijacked.path, 'extname', function(filename) {
+ assert.equal(filename, FILENAME);
+ gently.restore(path, 'extname');
+
+ return EXT;
+ });
+
+ gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) {
+ assert.equal(path.extname(name), EXT);
+ });
+ form._uploadPath(FILENAME);
+ })();
+});
+
+test(function _maybeEnd() {
+ gently.expect(form, 'emit', 0);
+ form._maybeEnd();
+
+ form.ended = true;
+ form._flushing = 1;
+ form._maybeEnd();
+
+ gently.expect(form, 'emit', function(event) {
+ assert.equal(event, 'end');
+ });
+
+ form.ended = true;
+ form._flushing = 0;
+ form._maybeEnd();
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
new file mode 100644
index 0000000..d8dc968
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
@@ -0,0 +1,50 @@
+var common = require('../common');
+var multipartParser = require(common.lib + '/multipart_parser'),
+ MultipartParser = multipartParser.MultipartParser,
+ events = require('events'),
+ Buffer = require('buffer').Buffer,
+ parser;
+
+function test(test) {
+ parser = new MultipartParser();
+ test();
+}
+
+test(function constructor() {
+ assert.equal(parser.boundary, null);
+ assert.equal(parser.state, 0);
+ assert.equal(parser.flags, 0);
+ assert.equal(parser.boundaryChars, null);
+ assert.equal(parser.index, null);
+ assert.equal(parser.lookbehind, null);
+ assert.equal(parser.constructor.name, 'MultipartParser');
+});
+
+test(function initWithBoundary() {
+ var boundary = 'abc';
+ parser.initWithBoundary(boundary);
+ assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]);
+ assert.equal(parser.state, multipartParser.START);
+
+ assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true});
+});
+
+test(function parserError() {
+ var boundary = 'abc',
+ buffer = new Buffer(5);
+
+ parser.initWithBoundary(boundary);
+ buffer.write('--ad', 'ascii', 0);
+ assert.equal(parser.write(buffer), 3);
+});
+
+test(function end() {
+ (function testError() {
+ assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain());
+ })();
+
+ (function testRegular() {
+ parser.state = multipartParser.END;
+ assert.strictEqual(parser.end(), undefined);
+ })();
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
new file mode 100644
index 0000000..54d3e2d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
@@ -0,0 +1,45 @@
+var common = require('../common');
+var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser,
+ Buffer = require('buffer').Buffer,
+ gently,
+ parser;
+
+function test(test) {
+ gently = new Gently();
+ parser = new QuerystringParser();
+ test();
+ gently.verify(test.name);
+}
+
+test(function constructor() {
+ assert.equal(parser.buffer, '');
+ assert.equal(parser.constructor.name, 'QuerystringParser');
+});
+
+test(function write() {
+ var a = new Buffer('a=1');
+ assert.equal(parser.write(a), a.length);
+
+ var b = new Buffer('&b=2');
+ parser.write(b);
+ assert.equal(parser.buffer, a + b);
+});
+
+test(function end() {
+ var FIELDS = {a: ['b', {c: 'd'}], e: 'f'};
+
+ gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) {
+ assert.equal(str, parser.buffer);
+ return FIELDS;
+ });
+
+ gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) {
+ assert.deepEqual(FIELDS[key], val);
+ });
+
+ gently.expect(parser, 'onEnd');
+
+ parser.buffer = 'my buffer';
+ parser.end();
+ assert.equal(parser.buffer, '');
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
new file mode 100644
index 0000000..479e46d
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
@@ -0,0 +1,75 @@
+var common = require('../common');
+var BOUNDARY = '---------------------------10102754414578508781458777923',
+ FIXTURE = TEST_FIXTURES+'/multi_video.upload',
+ fs = require('fs'),
+ util = require(common.lib + '/util'),
+ http = require('http'),
+ formidable = require(common.lib + '/index'),
+ server = http.createServer();
+
+server.on('request', function(req, res) {
+ var form = new formidable.IncomingForm(),
+ uploads = {};
+
+ form.uploadDir = TEST_TMP;
+ form.hash = 'sha1';
+ form.parse(req);
+
+ form
+ .on('fileBegin', function(field, file) {
+ assert.equal(field, 'upload');
+
+ var tracker = {file: file, progress: [], ended: false};
+ uploads[file.filename] = tracker;
+ file
+ .on('progress', function(bytesReceived) {
+ tracker.progress.push(bytesReceived);
+ assert.equal(bytesReceived, file.length);
+ })
+ .on('end', function() {
+ tracker.ended = true;
+ });
+ })
+ .on('field', function(field, value) {
+ assert.equal(field, 'title');
+ assert.equal(value, '');
+ })
+ .on('file', function(field, file) {
+ assert.equal(field, 'upload');
+ assert.strictEqual(uploads[file.filename].file, file);
+ })
+ .on('end', function() {
+ assert.ok(uploads['shortest_video.flv']);
+ assert.ok(uploads['shortest_video.flv'].ended);
+ assert.ok(uploads['shortest_video.flv'].progress.length > 3);
+ assert.equal(uploads['shortest_video.flv'].file.hash, 'd6a17616c7143d1b1438ceeef6836d1a09186b3a');
+ assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length);
+ assert.ok(uploads['shortest_video.mp4']);
+ assert.ok(uploads['shortest_video.mp4'].ended);
+ assert.ok(uploads['shortest_video.mp4'].progress.length > 3);
+ assert.equal(uploads['shortest_video.mp4'].file.hash, '937dfd4db263f4887ceae19341dcc8d63bcd557f');
+
+ server.close();
+ res.writeHead(200);
+ res.end('good');
+ });
+});
+
+server.listen(TEST_PORT, function() {
+ var client = http.createClient(TEST_PORT),
+ stat = fs.statSync(FIXTURE),
+ headers = {
+ 'content-type': 'multipart/form-data; boundary='+BOUNDARY,
+ 'content-length': stat.size,
+ }
+ request = client.request('POST', '/', headers),
+ fixture = new fs.ReadStream(FIXTURE);
+
+ fixture
+ .on('data', function(b) {
+ request.write(b);
+ })
+ .on('end', function() {
+ request.end();
+ });
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
new file mode 100644
index 0000000..50b2361
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
@@ -0,0 +1,2 @@
+#!/usr/bin/env node
+require('urun')(__dirname)
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
new file mode 100644
index 0000000..fe2ac1c
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
@@ -0,0 +1,63 @@
+var common = require('../common');
+var test = require('utest');
+var assert = common.assert;
+var IncomingForm = common.require('incoming_form').IncomingForm;
+var path = require('path');
+
+var form;
+test('IncomingForm', {
+ before: function() {
+ form = new IncomingForm();
+ },
+
+ '#_fileName with regular characters': function() {
+ var filename = 'foo.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'foo.txt');
+ },
+
+ '#_fileName with unescaped quote': function() {
+ var filename = 'my".txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
+ },
+
+ '#_fileName with escaped quote': function() {
+ var filename = 'my%22.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my".txt');
+ },
+
+ '#_fileName with bad quote and additional sub-header': function() {
+ var filename = 'my".txt';
+ var header = makeHeader(filename) + '; foo="bar"';
+ assert.equal(form._fileName(header), filename);
+ },
+
+ '#_fileName with semicolon': function() {
+ var filename = 'my;.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my;.txt');
+ },
+
+ '#_fileName with utf8 character': function() {
+ var filename = 'my☃.txt';
+ assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt');
+ },
+
+ '#_uploadPath strips harmful characters from extension when keepExtensions': function() {
+ form.keepExtensions = true;
+
+ var ext = path.extname(form._uploadPath('fine.jpg?foo=bar'));
+ assert.equal(ext, '.jpg');
+
+ var ext = path.extname(form._uploadPath('fine?foo=bar'));
+ assert.equal(ext, '');
+
+ var ext = path.extname(form._uploadPath('super.cr2+dsad'));
+ assert.equal(ext, '.cr2');
+
+ var ext = path.extname(form._uploadPath('super.bar'));
+ assert.equal(ext, '.bar');
+ },
+});
+
+function makeHeader(filename) {
+ return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"';
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
new file mode 100644
index 0000000..9f1cef8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
@@ -0,0 +1,47 @@
+var http = require('http');
+var fs = require('fs');
+var connections = 0;
+
+var server = http.createServer(function(req, res) {
+ var socket = req.socket;
+ console.log('Request: %s %s -> %s', req.method, req.url, socket.filename);
+
+ req.on('end', function() {
+ if (req.url !== '/') {
+ res.end(JSON.stringify({
+ method: req.method,
+ url: req.url,
+ filename: socket.filename,
+ }));
+ return;
+ }
+
+ res.writeHead(200, {'content-type': 'text/html'});
+ res.end(
+ ''
+ );
+ });
+});
+
+server.on('connection', function(socket) {
+ connections++;
+
+ socket.id = connections;
+ socket.filename = 'connection-' + socket.id + '.http';
+ socket.file = fs.createWriteStream(socket.filename);
+ socket.pipe(socket.file);
+
+ console.log('--> %s', socket.filename);
+ socket.on('close', function() {
+ console.log('<-- %s', socket.filename);
+ });
+});
+
+var port = process.env.PORT || 8080;
+server.listen(port, function() {
+ console.log('Recording connections on port %s', port);
+});
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore
new file mode 100644
index 0000000..f1250e5
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore
@@ -0,0 +1,4 @@
+support
+test
+examples
+*.sock
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/History.md b/node_modules/express/node_modules/connect/node_modules/pause/History.md
new file mode 100644
index 0000000..c8aa68f
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/History.md
@@ -0,0 +1,5 @@
+
+0.0.1 / 2010-01-03
+==================
+
+ * Initial release
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/node_modules/express/node_modules/connect/node_modules/pause/Makefile
new file mode 100644
index 0000000..4e9c8d3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --reporter spec
+
+.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Readme.md b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
new file mode 100644
index 0000000..1cdd68a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
@@ -0,0 +1,29 @@
+
+# pause
+
+ Pause streams...
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/index.js b/node_modules/express/node_modules/connect/node_modules/pause/index.js
new file mode 100644
index 0000000..1b7b379
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/index.js
@@ -0,0 +1,29 @@
+
+module.exports = function(obj){
+ var onData
+ , onEnd
+ , events = [];
+
+ // buffer data
+ obj.on('data', onData = function(data, encoding){
+ events.push(['data', data, encoding]);
+ });
+
+ // buffer end
+ obj.on('end', onEnd = function(data, encoding){
+ events.push(['end', data, encoding]);
+ });
+
+ return {
+ end: function(){
+ obj.removeListener('data', onData);
+ obj.removeListener('end', onEnd);
+ },
+ resume: function(){
+ this.end();
+ for (var i = 0, len = events.length; i < len; ++i) {
+ obj.emit.apply(obj, events[i]);
+ }
+ }
+ };
+};
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/pause/package.json b/node_modules/express/node_modules/connect/node_modules/pause/package.json
new file mode 100644
index 0000000..1b66942
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/pause/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "pause",
+ "version": "0.0.1",
+ "description": "Pause streams...",
+ "keywords": [],
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "main": "index",
+ "readme": "\n# pause\n\n Pause streams...\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "_id": "pause@0.0.1",
+ "_from": "pause@0.0.1"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules
new file mode 100644
index 0000000..49e31da
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "support/expresso"]
+ path = support/expresso
+ url = git://github.com/visionmedia/expresso.git
+[submodule "support/should"]
+ path = support/should
+ url = git://github.com/visionmedia/should.js.git
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml b/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml
new file mode 100644
index 0000000..2c0a8f6
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.4
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/History.md b/node_modules/express/node_modules/connect/node_modules/qs/History.md
new file mode 100644
index 0000000..1feef45
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/History.md
@@ -0,0 +1,83 @@
+
+0.5.1 / 2012-09-18
+==================
+
+ * fix encoded `=`. Closes #43
+
+0.5.0 / 2012-05-04
+==================
+
+ * Added component support
+
+0.4.2 / 2012-02-08
+==================
+
+ * Fixed: ensure objects are created when appropriate not arrays [aheckmann]
+
+0.4.1 / 2012-01-26
+==================
+
+ * Fixed stringify()ing numbers. Closes #23
+
+0.4.0 / 2011-11-21
+==================
+
+ * Allow parsing of an existing object (for `bodyParser()`) [jackyz]
+ * Replaced expresso with mocha
+
+0.3.2 / 2011-11-08
+==================
+
+ * Fixed global variable leak
+
+0.3.1 / 2011-08-17
+==================
+
+ * Added `try/catch` around malformed uri components
+ * Add test coverage for Array native method bleed-though
+
+0.3.0 / 2011-07-19
+==================
+
+ * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart]
+
+0.2.0 / 2011-06-29
+==================
+
+ * Added `qs.stringify()` [Cory Forsyth]
+
+0.1.0 / 2011-04-13
+==================
+
+ * Added jQuery-ish array support
+
+0.0.7 / 2011-03-13
+==================
+
+ * Fixed; handle empty string and `== null` in `qs.parse()` [dmit]
+ allows for convenient `qs.parse(url.parse(str).query)`
+
+0.0.6 / 2011-02-14
+==================
+
+ * Fixed; support for implicit arrays
+
+0.0.4 / 2011-02-09
+==================
+
+ * Fixed `+` as a space
+
+0.0.3 / 2011-02-08
+==================
+
+ * Fixed case when right-hand value contains "]"
+
+0.0.2 / 2011-02-07
+==================
+
+ * Fixed "=" presence in key
+
+0.0.1 / 2011-02-07
+==================
+
+ * Initial release
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Makefile b/node_modules/express/node_modules/connect/node_modules/qs/Makefile
new file mode 100644
index 0000000..0a21cf7
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/Makefile
@@ -0,0 +1,12 @@
+
+test/browser/qs.js: querystring.js
+ component build package.json test/browser/qs
+
+querystring.js: lib/head.js lib/querystring.js lib/tail.js
+ cat $^ > $@
+
+test:
+ @./node_modules/.bin/mocha \
+ --ui bdd
+
+.PHONY: test
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md
new file mode 100644
index 0000000..27e54a4
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md
@@ -0,0 +1,58 @@
+# node-querystring
+
+ query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.
+
+## Installation
+
+ $ npm install qs
+
+## Examples
+
+```js
+var qs = require('qs');
+
+qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');
+// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }
+
+qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})
+// => user[name]=Tobi&user[email]=tobi%40learnboost.com
+```
+
+## Testing
+
+Install dev dependencies:
+
+ $ npm install -d
+
+and execute:
+
+ $ make test
+
+browser:
+
+ $ open test/browser/index.html
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js b/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js
new file mode 100644
index 0000000..97e2c93
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js
@@ -0,0 +1,17 @@
+
+var qs = require('./');
+
+var times = 100000
+ , start = new Date
+ , n = times;
+
+console.log('times: %d', times);
+
+while (n--) qs.parse('foo=bar');
+console.log('simple: %dms', new Date - start);
+
+var start = new Date
+ , n = times;
+
+while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
+console.log('nested: %dms', new Date - start);
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/component.json b/node_modules/express/node_modules/connect/node_modules/qs/component.json
new file mode 100644
index 0000000..ba34ead
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/component.json
@@ -0,0 +1,6 @@
+{
+ "name": "querystring",
+ "description": "Querystring parser / stringifier with nesting support",
+ "keywords": ["querystring", "query", "parser"],
+ "main": "lib/querystring.js"
+}
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/examples.js b/node_modules/express/node_modules/connect/node_modules/qs/examples.js
new file mode 100644
index 0000000..27617b7
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/examples.js
@@ -0,0 +1,51 @@
+
+/**
+ * Module dependencies.
+ */
+
+var qs = require('./');
+
+var obj = qs.parse('foo');
+console.log(obj)
+
+var obj = qs.parse('foo=bar=baz');
+console.log(obj)
+
+var obj = qs.parse('users[]');
+console.log(obj)
+
+var obj = qs.parse('name=tj&email=tj@vision-media.ca');
+console.log(obj)
+
+var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane');
+console.log(obj)
+
+var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk');
+console.log(obj)
+
+var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk');
+console.log(obj)
+
+var obj = qs.parse('a=a&a=b&a=c');
+console.log(obj)
+
+var obj = qs.parse('user[tj]=tj&user[tj]=TJ');
+console.log(obj)
+
+var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler');
+console.log(obj)
+
+var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ');
+console.log(obj)
+
+var obj = qs.parse('user[0]=tj&user[1]=TJ');
+console.log(obj)
+
+var obj = qs.parse('user[0]=tj&user[]=TJ');
+console.log(obj)
+
+var obj = qs.parse('user[0]=tj&user[foo]=TJ');
+console.log(obj)
+
+var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }});
+console.log(str);
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/index.js b/node_modules/express/node_modules/connect/node_modules/qs/index.js
new file mode 100644
index 0000000..d177d20
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/index.js
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/querystring');
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js
new file mode 100644
index 0000000..55d3817
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js
@@ -0,0 +1 @@
+;(function(){
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js
new file mode 100644
index 0000000..d3689bb
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js
@@ -0,0 +1,262 @@
+
+/**
+ * Object#toString() ref for stringify().
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Cache non-integer test regexp.
+ */
+
+var isint = /^[0-9]+$/;
+
+function promote(parent, key) {
+ if (parent[key].length == 0) return parent[key] = {};
+ var t = {};
+ for (var i in parent[key]) t[i] = parent[key][i];
+ parent[key] = t;
+ return t;
+}
+
+function parse(parts, parent, key, val) {
+ var part = parts.shift();
+ // end
+ if (!part) {
+ if (Array.isArray(parent[key])) {
+ parent[key].push(val);
+ } else if ('object' == typeof parent[key]) {
+ parent[key] = val;
+ } else if ('undefined' == typeof parent[key]) {
+ parent[key] = val;
+ } else {
+ parent[key] = [parent[key], val];
+ }
+ // array
+ } else {
+ var obj = parent[key] = parent[key] || [];
+ if (']' == part) {
+ if (Array.isArray(obj)) {
+ if ('' != val) obj.push(val);
+ } else if ('object' == typeof obj) {
+ obj[Object.keys(obj).length] = val;
+ } else {
+ obj = parent[key] = [parent[key], val];
+ }
+ // prop
+ } else if (~part.indexOf(']')) {
+ part = part.substr(0, part.length - 1);
+ if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
+ parse(parts, obj, part, val);
+ // key
+ } else {
+ if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
+ parse(parts, obj, part, val);
+ }
+ }
+}
+
+/**
+ * Merge parent key/val pair.
+ */
+
+function merge(parent, key, val){
+ if (~key.indexOf(']')) {
+ var parts = key.split('[')
+ , len = parts.length
+ , last = len - 1;
+ parse(parts, parent, 'base', val);
+ // optimize
+ } else {
+ if (!isint.test(key) && Array.isArray(parent.base)) {
+ var t = {};
+ for (var k in parent.base) t[k] = parent.base[k];
+ parent.base = t;
+ }
+ set(parent.base, key, val);
+ }
+
+ return parent;
+}
+
+/**
+ * Parse the given obj.
+ */
+
+function parseObject(obj){
+ var ret = { base: {} };
+ Object.keys(obj).forEach(function(name){
+ merge(ret, name, obj[name]);
+ });
+ return ret.base;
+}
+
+/**
+ * Parse the given str.
+ */
+
+function parseString(str){
+ return String(str)
+ .split('&')
+ .reduce(function(ret, pair){
+ var eql = pair.indexOf('=')
+ , brace = lastBraceInKey(pair)
+ , key = pair.substr(0, brace || eql)
+ , val = pair.substr(brace || eql, pair.length)
+ , val = val.substr(val.indexOf('=') + 1, val.length);
+
+ // ?foo
+ if ('' == key) key = pair, val = '';
+
+ return merge(ret, decode(key), decode(val));
+ }, { base: {} }).base;
+}
+
+/**
+ * Parse the given query `str` or `obj`, returning an object.
+ *
+ * @param {String} str | {Object} obj
+ * @return {Object}
+ * @api public
+ */
+
+exports.parse = function(str){
+ if (null == str || '' == str) return {};
+ return 'object' == typeof str
+ ? parseObject(str)
+ : parseString(str);
+};
+
+/**
+ * Turn the given `obj` into a query string
+ *
+ * @param {Object} obj
+ * @return {String}
+ * @api public
+ */
+
+var stringify = exports.stringify = function(obj, prefix) {
+ if (Array.isArray(obj)) {
+ return stringifyArray(obj, prefix);
+ } else if ('[object Object]' == toString.call(obj)) {
+ return stringifyObject(obj, prefix);
+ } else if ('string' == typeof obj) {
+ return stringifyString(obj, prefix);
+ } else {
+ return prefix + '=' + obj;
+ }
+};
+
+/**
+ * Stringify the given `str`.
+ *
+ * @param {String} str
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyString(str, prefix) {
+ if (!prefix) throw new TypeError('stringify expects an object');
+ return prefix + '=' + encodeURIComponent(str);
+}
+
+/**
+ * Stringify the given `arr`.
+ *
+ * @param {Array} arr
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyArray(arr, prefix) {
+ var ret = [];
+ if (!prefix) throw new TypeError('stringify expects an object');
+ for (var i = 0; i < arr.length; i++) {
+ ret.push(stringify(arr[i], prefix + '['+i+']'));
+ }
+ return ret.join('&');
+}
+
+/**
+ * Stringify the given `obj`.
+ *
+ * @param {Object} obj
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyObject(obj, prefix) {
+ var ret = []
+ , keys = Object.keys(obj)
+ , key;
+
+ for (var i = 0, len = keys.length; i < len; ++i) {
+ key = keys[i];
+ ret.push(stringify(obj[key], prefix
+ ? prefix + '[' + encodeURIComponent(key) + ']'
+ : encodeURIComponent(key)));
+ }
+
+ return ret.join('&');
+}
+
+/**
+ * Set `obj`'s `key` to `val` respecting
+ * the weird and wonderful syntax of a qs,
+ * where "foo=bar&foo=baz" becomes an array.
+ *
+ * @param {Object} obj
+ * @param {String} key
+ * @param {String} val
+ * @api private
+ */
+
+function set(obj, key, val) {
+ var v = obj[key];
+ if (undefined === v) {
+ obj[key] = val;
+ } else if (Array.isArray(v)) {
+ v.push(val);
+ } else {
+ obj[key] = [v, val];
+ }
+}
+
+/**
+ * Locate last brace in `str` within the key.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+function lastBraceInKey(str) {
+ var len = str.length
+ , brace
+ , c;
+ for (var i = 0; i < len; ++i) {
+ c = str[i];
+ if (']' == c) brace = false;
+ if ('[' == c) brace = true;
+ if ('=' == c && !brace) return i;
+ }
+}
+
+/**
+ * Decode `str`.
+ *
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+function decode(str) {
+ try {
+ return decodeURIComponent(str.replace(/\+/g, ' '));
+ } catch (err) {
+ return str;
+ }
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js
new file mode 100644
index 0000000..158693a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js
@@ -0,0 +1 @@
+})();
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/package.json b/node_modules/express/node_modules/connect/node_modules/qs/package.json
new file mode 100644
index 0000000..ebf4cc3
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "qs",
+ "description": "querystring parser",
+ "version": "0.5.1",
+ "keywords": [
+ "query string",
+ "parser",
+ "component"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/visionmedia/node-querystring.git"
+ },
+ "devDependencies": {
+ "mocha": "*",
+ "expect.js": "*"
+ },
+ "component": {
+ "scripts": {
+ "querystring": "querystring.js"
+ }
+ },
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "main": "index",
+ "engines": {
+ "node": "*"
+ },
+ "readme": "# node-querystring\n\n query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
+ "_id": "qs@0.5.1",
+ "_from": "qs@0.5.1"
+}
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/querystring.js
new file mode 100644
index 0000000..7466b06
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/querystring.js
@@ -0,0 +1,254 @@
+;(function(){
+
+/**
+ * Object#toString() ref for stringify().
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Cache non-integer test regexp.
+ */
+
+var isint = /^[0-9]+$/;
+
+function promote(parent, key) {
+ if (parent[key].length == 0) return parent[key] = {};
+ var t = {};
+ for (var i in parent[key]) t[i] = parent[key][i];
+ parent[key] = t;
+ return t;
+}
+
+function parse(parts, parent, key, val) {
+ var part = parts.shift();
+ // end
+ if (!part) {
+ if (Array.isArray(parent[key])) {
+ parent[key].push(val);
+ } else if ('object' == typeof parent[key]) {
+ parent[key] = val;
+ } else if ('undefined' == typeof parent[key]) {
+ parent[key] = val;
+ } else {
+ parent[key] = [parent[key], val];
+ }
+ // array
+ } else {
+ var obj = parent[key] = parent[key] || [];
+ if (']' == part) {
+ if (Array.isArray(obj)) {
+ if ('' != val) obj.push(val);
+ } else if ('object' == typeof obj) {
+ obj[Object.keys(obj).length] = val;
+ } else {
+ obj = parent[key] = [parent[key], val];
+ }
+ // prop
+ } else if (~part.indexOf(']')) {
+ part = part.substr(0, part.length - 1);
+ if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
+ parse(parts, obj, part, val);
+ // key
+ } else {
+ if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key);
+ parse(parts, obj, part, val);
+ }
+ }
+}
+
+/**
+ * Merge parent key/val pair.
+ */
+
+function merge(parent, key, val){
+ if (~key.indexOf(']')) {
+ var parts = key.split('[')
+ , len = parts.length
+ , last = len - 1;
+ parse(parts, parent, 'base', val);
+ // optimize
+ } else {
+ if (!isint.test(key) && Array.isArray(parent.base)) {
+ var t = {};
+ for (var k in parent.base) t[k] = parent.base[k];
+ parent.base = t;
+ }
+ set(parent.base, key, val);
+ }
+
+ return parent;
+}
+
+/**
+ * Parse the given obj.
+ */
+
+function parseObject(obj){
+ var ret = { base: {} };
+ Object.keys(obj).forEach(function(name){
+ merge(ret, name, obj[name]);
+ });
+ return ret.base;
+}
+
+/**
+ * Parse the given str.
+ */
+
+function parseString(str){
+ return String(str)
+ .split('&')
+ .reduce(function(ret, pair){
+ try{
+ pair = decodeURIComponent(pair.replace(/\+/g, ' '));
+ } catch(e) {
+ // ignore
+ }
+
+ var eql = pair.indexOf('=')
+ , brace = lastBraceInKey(pair)
+ , key = pair.substr(0, brace || eql)
+ , val = pair.substr(brace || eql, pair.length)
+ , val = val.substr(val.indexOf('=') + 1, val.length);
+
+ // ?foo
+ if ('' == key) key = pair, val = '';
+
+ return merge(ret, key, val);
+ }, { base: {} }).base;
+}
+
+/**
+ * Parse the given query `str` or `obj`, returning an object.
+ *
+ * @param {String} str | {Object} obj
+ * @return {Object}
+ * @api public
+ */
+
+exports.parse = function(str){
+ if (null == str || '' == str) return {};
+ return 'object' == typeof str
+ ? parseObject(str)
+ : parseString(str);
+};
+
+/**
+ * Turn the given `obj` into a query string
+ *
+ * @param {Object} obj
+ * @return {String}
+ * @api public
+ */
+
+var stringify = exports.stringify = function(obj, prefix) {
+ if (Array.isArray(obj)) {
+ return stringifyArray(obj, prefix);
+ } else if ('[object Object]' == toString.call(obj)) {
+ return stringifyObject(obj, prefix);
+ } else if ('string' == typeof obj) {
+ return stringifyString(obj, prefix);
+ } else {
+ return prefix + '=' + obj;
+ }
+};
+
+/**
+ * Stringify the given `str`.
+ *
+ * @param {String} str
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyString(str, prefix) {
+ if (!prefix) throw new TypeError('stringify expects an object');
+ return prefix + '=' + encodeURIComponent(str);
+}
+
+/**
+ * Stringify the given `arr`.
+ *
+ * @param {Array} arr
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyArray(arr, prefix) {
+ var ret = [];
+ if (!prefix) throw new TypeError('stringify expects an object');
+ for (var i = 0; i < arr.length; i++) {
+ ret.push(stringify(arr[i], prefix + '['+i+']'));
+ }
+ return ret.join('&');
+}
+
+/**
+ * Stringify the given `obj`.
+ *
+ * @param {Object} obj
+ * @param {String} prefix
+ * @return {String}
+ * @api private
+ */
+
+function stringifyObject(obj, prefix) {
+ var ret = []
+ , keys = Object.keys(obj)
+ , key;
+
+ for (var i = 0, len = keys.length; i < len; ++i) {
+ key = keys[i];
+ ret.push(stringify(obj[key], prefix
+ ? prefix + '[' + encodeURIComponent(key) + ']'
+ : encodeURIComponent(key)));
+ }
+
+ return ret.join('&');
+}
+
+/**
+ * Set `obj`'s `key` to `val` respecting
+ * the weird and wonderful syntax of a qs,
+ * where "foo=bar&foo=baz" becomes an array.
+ *
+ * @param {Object} obj
+ * @param {String} key
+ * @param {String} val
+ * @api private
+ */
+
+function set(obj, key, val) {
+ var v = obj[key];
+ if (undefined === v) {
+ obj[key] = val;
+ } else if (Array.isArray(v)) {
+ v.push(val);
+ } else {
+ obj[key] = [v, val];
+ }
+}
+
+/**
+ * Locate last brace in `str` within the key.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+function lastBraceInKey(str) {
+ var len = str.length
+ , brace
+ , c;
+ for (var i = 0; i < len; ++i) {
+ c = str[i];
+ if (']' == c) brace = false;
+ if ('[' == c) brace = true;
+ if ('=' == c && !brace) return i;
+ }
+}
+})();
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js
new file mode 100644
index 0000000..76aa4e8
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js
@@ -0,0 +1,1202 @@
+
+(function (global, module) {
+
+ if ('undefined' == typeof module) {
+ var module = { exports: {} }
+ , exports = module.exports
+ }
+
+ /**
+ * Exports.
+ */
+
+ module.exports = expect;
+ expect.Assertion = Assertion;
+
+ /**
+ * Exports version.
+ */
+
+ expect.version = '0.1.2';
+
+ /**
+ * Possible assertion flags.
+ */
+
+ var flags = {
+ not: ['to', 'be', 'have', 'include', 'only']
+ , to: ['be', 'have', 'include', 'only', 'not']
+ , only: ['have']
+ , have: ['own']
+ , be: ['an']
+ };
+
+ function expect (obj) {
+ return new Assertion(obj);
+ }
+
+ /**
+ * Constructor
+ *
+ * @api private
+ */
+
+ function Assertion (obj, flag, parent) {
+ this.obj = obj;
+ this.flags = {};
+
+ if (undefined != parent) {
+ this.flags[flag] = true;
+
+ for (var i in parent.flags) {
+ if (parent.flags.hasOwnProperty(i)) {
+ this.flags[i] = true;
+ }
+ }
+ }
+
+ var $flags = flag ? flags[flag] : keys(flags)
+ , self = this
+
+ if ($flags) {
+ for (var i = 0, l = $flags.length; i < l; i++) {
+ // avoid recursion
+ if (this.flags[$flags[i]]) continue;
+
+ var name = $flags[i]
+ , assertion = new Assertion(this.obj, name, this)
+
+ if ('function' == typeof Assertion.prototype[name]) {
+ // clone the function, make sure we dont touch the prot reference
+ var old = this[name];
+ this[name] = function () {
+ return old.apply(self, arguments);
+ }
+
+ for (var fn in Assertion.prototype) {
+ if (Assertion.prototype.hasOwnProperty(fn) && fn != name) {
+ this[name][fn] = bind(assertion[fn], assertion);
+ }
+ }
+ } else {
+ this[name] = assertion;
+ }
+ }
+ }
+ };
+
+ /**
+ * Performs an assertion
+ *
+ * @api private
+ */
+
+ Assertion.prototype.assert = function (truth, msg, error) {
+ var msg = this.flags.not ? error : msg
+ , ok = this.flags.not ? !truth : truth;
+
+ if (!ok) {
+ throw new Error(msg);
+ }
+
+ this.and = new Assertion(this.obj);
+ };
+
+ /**
+ * Check if the value is truthy
+ *
+ * @api public
+ */
+
+ Assertion.prototype.ok = function () {
+ this.assert(
+ !!this.obj
+ , 'expected ' + i(this.obj) + ' to be truthy'
+ , 'expected ' + i(this.obj) + ' to be falsy');
+ };
+
+ /**
+ * Assert that the function throws.
+ *
+ * @param {Function|RegExp} callback, or regexp to match error string against
+ * @api public
+ */
+
+ Assertion.prototype.throwError =
+ Assertion.prototype.throwException = function (fn) {
+ expect(this.obj).to.be.a('function');
+
+ var thrown = false
+ , not = this.flags.not
+
+ try {
+ this.obj();
+ } catch (e) {
+ if ('function' == typeof fn) {
+ fn(e);
+ } else if ('object' == typeof fn) {
+ var subject = 'string' == typeof e ? e : e.message;
+ if (not) {
+ expect(subject).to.not.match(fn);
+ } else {
+ expect(subject).to.match(fn);
+ }
+ }
+ thrown = true;
+ }
+
+ if ('object' == typeof fn && not) {
+ // in the presence of a matcher, ensure the `not` only applies to
+ // the matching.
+ this.flags.not = false;
+ }
+
+ var name = this.obj.name || 'fn';
+ this.assert(
+ thrown
+ , 'expected ' + name + ' to throw an exception'
+ , 'expected ' + name + ' not to throw an exception');
+ };
+
+ /**
+ * Checks if the array is empty.
+ *
+ * @api public
+ */
+
+ Assertion.prototype.empty = function () {
+ var expectation;
+
+ if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) {
+ if ('number' == typeof this.obj.length) {
+ expectation = !this.obj.length;
+ } else {
+ expectation = !keys(this.obj).length;
+ }
+ } else {
+ if ('string' != typeof this.obj) {
+ expect(this.obj).to.be.an('object');
+ }
+
+ expect(this.obj).to.have.property('length');
+ expectation = !this.obj.length;
+ }
+
+ this.assert(
+ expectation
+ , 'expected ' + i(this.obj) + ' to be empty'
+ , 'expected ' + i(this.obj) + ' to not be empty');
+ return this;
+ };
+
+ /**
+ * Checks if the obj exactly equals another.
+ *
+ * @api public
+ */
+
+ Assertion.prototype.be =
+ Assertion.prototype.equal = function (obj) {
+ this.assert(
+ obj === this.obj
+ , 'expected ' + i(this.obj) + ' to equal ' + i(obj)
+ , 'expected ' + i(this.obj) + ' to not equal ' + i(obj));
+ return this;
+ };
+
+ /**
+ * Checks if the obj sortof equals another.
+ *
+ * @api public
+ */
+
+ Assertion.prototype.eql = function (obj) {
+ this.assert(
+ expect.eql(obj, this.obj)
+ , 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj)
+ , 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj));
+ return this;
+ };
+
+ /**
+ * Assert within start to finish (inclusive).
+ *
+ * @param {Number} start
+ * @param {Number} finish
+ * @api public
+ */
+
+ Assertion.prototype.within = function (start, finish) {
+ var range = start + '..' + finish;
+ this.assert(
+ this.obj >= start && this.obj <= finish
+ , 'expected ' + i(this.obj) + ' to be within ' + range
+ , 'expected ' + i(this.obj) + ' to not be within ' + range);
+ return this;
+ };
+
+ /**
+ * Assert typeof / instance of
+ *
+ * @api public
+ */
+
+ Assertion.prototype.a =
+ Assertion.prototype.an = function (type) {
+ if ('string' == typeof type) {
+ // proper english in error msg
+ var n = /^[aeiou]/.test(type) ? 'n' : '';
+
+ // typeof with support for 'array'
+ this.assert(
+ 'array' == type ? isArray(this.obj) :
+ 'object' == type
+ ? 'object' == typeof this.obj && null !== this.obj
+ : type == typeof this.obj
+ , 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type
+ , 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type);
+ } else {
+ // instanceof
+ var name = type.name || 'supplied constructor';
+ this.assert(
+ this.obj instanceof type
+ , 'expected ' + i(this.obj) + ' to be an instance of ' + name
+ , 'expected ' + i(this.obj) + ' not to be an instance of ' + name);
+ }
+
+ return this;
+ };
+
+ /**
+ * Assert numeric value above _n_.
+ *
+ * @param {Number} n
+ * @api public
+ */
+
+ Assertion.prototype.greaterThan =
+ Assertion.prototype.above = function (n) {
+ this.assert(
+ this.obj > n
+ , 'expected ' + i(this.obj) + ' to be above ' + n
+ , 'expected ' + i(this.obj) + ' to be below ' + n);
+ return this;
+ };
+
+ /**
+ * Assert numeric value below _n_.
+ *
+ * @param {Number} n
+ * @api public
+ */
+
+ Assertion.prototype.lessThan =
+ Assertion.prototype.below = function (n) {
+ this.assert(
+ this.obj < n
+ , 'expected ' + i(this.obj) + ' to be below ' + n
+ , 'expected ' + i(this.obj) + ' to be above ' + n);
+ return this;
+ };
+
+ /**
+ * Assert string value matches _regexp_.
+ *
+ * @param {RegExp} regexp
+ * @api public
+ */
+
+ Assertion.prototype.match = function (regexp) {
+ this.assert(
+ regexp.exec(this.obj)
+ , 'expected ' + i(this.obj) + ' to match ' + regexp
+ , 'expected ' + i(this.obj) + ' not to match ' + regexp);
+ return this;
+ };
+
+ /**
+ * Assert property "length" exists and has value of _n_.
+ *
+ * @param {Number} n
+ * @api public
+ */
+
+ Assertion.prototype.length = function (n) {
+ expect(this.obj).to.have.property('length');
+ var len = this.obj.length;
+ this.assert(
+ n == len
+ , 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len
+ , 'expected ' + i(this.obj) + ' to not have a length of ' + len);
+ return this;
+ };
+
+ /**
+ * Assert property _name_ exists, with optional _val_.
+ *
+ * @param {String} name
+ * @param {Mixed} val
+ * @api public
+ */
+
+ Assertion.prototype.property = function (name, val) {
+ if (this.flags.own) {
+ this.assert(
+ Object.prototype.hasOwnProperty.call(this.obj, name)
+ , 'expected ' + i(this.obj) + ' to have own property ' + i(name)
+ , 'expected ' + i(this.obj) + ' to not have own property ' + i(name));
+ return this;
+ }
+
+ if (this.flags.not && undefined !== val) {
+ if (undefined === this.obj[name]) {
+ throw new Error(i(this.obj) + ' has no property ' + i(name));
+ }
+ } else {
+ var hasProp;
+ try {
+ hasProp = name in this.obj
+ } catch (e) {
+ hasProp = undefined !== this.obj[name]
+ }
+
+ this.assert(
+ hasProp
+ , 'expected ' + i(this.obj) + ' to have a property ' + i(name)
+ , 'expected ' + i(this.obj) + ' to not have a property ' + i(name));
+ }
+
+ if (undefined !== val) {
+ this.assert(
+ val === this.obj[name]
+ , 'expected ' + i(this.obj) + ' to have a property ' + i(name)
+ + ' of ' + i(val) + ', but got ' + i(this.obj[name])
+ , 'expected ' + i(this.obj) + ' to not have a property ' + i(name)
+ + ' of ' + i(val));
+ }
+
+ this.obj = this.obj[name];
+ return this;
+ };
+
+ /**
+ * Assert that the array contains _obj_ or string contains _obj_.
+ *
+ * @param {Mixed} obj|string
+ * @api public
+ */
+
+ Assertion.prototype.string =
+ Assertion.prototype.contain = function (obj) {
+ if ('string' == typeof this.obj) {
+ this.assert(
+ ~this.obj.indexOf(obj)
+ , 'expected ' + i(this.obj) + ' to contain ' + i(obj)
+ , 'expected ' + i(this.obj) + ' to not contain ' + i(obj));
+ } else {
+ this.assert(
+ ~indexOf(this.obj, obj)
+ , 'expected ' + i(this.obj) + ' to contain ' + i(obj)
+ , 'expected ' + i(this.obj) + ' to not contain ' + i(obj));
+ }
+ return this;
+ };
+
+ /**
+ * Assert exact keys or inclusion of keys by using
+ * the `.own` modifier.
+ *
+ * @param {Array|String ...} keys
+ * @api public
+ */
+
+ Assertion.prototype.key =
+ Assertion.prototype.keys = function ($keys) {
+ var str
+ , ok = true;
+
+ $keys = isArray($keys)
+ ? $keys
+ : Array.prototype.slice.call(arguments);
+
+ if (!$keys.length) throw new Error('keys required');
+
+ var actual = keys(this.obj)
+ , len = $keys.length;
+
+ // Inclusion
+ ok = every($keys, function (key) {
+ return ~indexOf(actual, key);
+ });
+
+ // Strict
+ if (!this.flags.not && this.flags.only) {
+ ok = ok && $keys.length == actual.length;
+ }
+
+ // Key string
+ if (len > 1) {
+ $keys = map($keys, function (key) {
+ return i(key);
+ });
+ var last = $keys.pop();
+ str = $keys.join(', ') + ', and ' + last;
+ } else {
+ str = i($keys[0]);
+ }
+
+ // Form
+ str = (len > 1 ? 'keys ' : 'key ') + str;
+
+ // Have / include
+ str = (!this.flags.only ? 'include ' : 'only have ') + str;
+
+ // Assertion
+ this.assert(
+ ok
+ , 'expected ' + i(this.obj) + ' to ' + str
+ , 'expected ' + i(this.obj) + ' to not ' + str);
+
+ return this;
+ };
+
+ /**
+ * Function bind implementation.
+ */
+
+ function bind (fn, scope) {
+ return function () {
+ return fn.apply(scope, arguments);
+ }
+ }
+
+ /**
+ * Array every compatibility
+ *
+ * @see bit.ly/5Fq1N2
+ * @api public
+ */
+
+ function every (arr, fn, thisObj) {
+ var scope = thisObj || global;
+ for (var i = 0, j = arr.length; i < j; ++i) {
+ if (!fn.call(scope, arr[i], i, arr)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ /**
+ * Array indexOf compatibility.
+ *
+ * @see bit.ly/a5Dxa2
+ * @api public
+ */
+
+ function indexOf (arr, o, i) {
+ if (Array.prototype.indexOf) {
+ return Array.prototype.indexOf.call(arr, o, i);
+ }
+
+ if (arr.length === undefined) {
+ return -1;
+ }
+
+ for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
+ ; i < j && arr[i] !== o; i++);
+
+ return j <= i ? -1 : i;
+ };
+
+ /**
+ * Inspects an object.
+ *
+ * @see taken from node.js `util` module (copyright Joyent, MIT license)
+ * @api private
+ */
+
+ function i (obj, showHidden, depth) {
+ var seen = [];
+
+ function stylize (str) {
+ return str;
+ };
+
+ function format (value, recurseTimes) {
+ // Provide a hook for user-specified inspect functions.
+ // Check that value is an object with an inspect function on it
+ if (value && typeof value.inspect === 'function' &&
+ // Filter out the util module, it's inspect function is special
+ value !== exports &&
+ // Also filter out any prototype objects using the circular check.
+ !(value.constructor && value.constructor.prototype === value)) {
+ return value.inspect(recurseTimes);
+ }
+
+ // Primitive types cannot have properties
+ switch (typeof value) {
+ case 'undefined':
+ return stylize('undefined', 'undefined');
+
+ case 'string':
+ var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '')
+ .replace(/'/g, "\\'")
+ .replace(/\\"/g, '"') + '\'';
+ return stylize(simple, 'string');
+
+ case 'number':
+ return stylize('' + value, 'number');
+
+ case 'boolean':
+ return stylize('' + value, 'boolean');
+ }
+ // For some reason typeof null is "object", so special case here.
+ if (value === null) {
+ return stylize('null', 'null');
+ }
+
+ // Look up the keys of the object.
+ var visible_keys = keys(value);
+ var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys;
+
+ // Functions without properties can be shortcutted.
+ if (typeof value === 'function' && $keys.length === 0) {
+ if (isRegExp(value)) {
+ return stylize('' + value, 'regexp');
+ } else {
+ var name = value.name ? ': ' + value.name : '';
+ return stylize('[Function' + name + ']', 'special');
+ }
+ }
+
+ // Dates without properties can be shortcutted
+ if (isDate(value) && $keys.length === 0) {
+ return stylize(value.toUTCString(), 'date');
+ }
+
+ var base, type, braces;
+ // Determine the object type
+ if (isArray(value)) {
+ type = 'Array';
+ braces = ['[', ']'];
+ } else {
+ type = 'Object';
+ braces = ['{', '}'];
+ }
+
+ // Make functions say that they are functions
+ if (typeof value === 'function') {
+ var n = value.name ? ': ' + value.name : '';
+ base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']';
+ } else {
+ base = '';
+ }
+
+ // Make dates with properties first say the date
+ if (isDate(value)) {
+ base = ' ' + value.toUTCString();
+ }
+
+ if ($keys.length === 0) {
+ return braces[0] + base + braces[1];
+ }
+
+ if (recurseTimes < 0) {
+ if (isRegExp(value)) {
+ return stylize('' + value, 'regexp');
+ } else {
+ return stylize('[Object]', 'special');
+ }
+ }
+
+ seen.push(value);
+
+ var output = map($keys, function (key) {
+ var name, str;
+ if (value.__lookupGetter__) {
+ if (value.__lookupGetter__(key)) {
+ if (value.__lookupSetter__(key)) {
+ str = stylize('[Getter/Setter]', 'special');
+ } else {
+ str = stylize('[Getter]', 'special');
+ }
+ } else {
+ if (value.__lookupSetter__(key)) {
+ str = stylize('[Setter]', 'special');
+ }
+ }
+ }
+ if (indexOf(visible_keys, key) < 0) {
+ name = '[' + key + ']';
+ }
+ if (!str) {
+ if (indexOf(seen, value[key]) < 0) {
+ if (recurseTimes === null) {
+ str = format(value[key]);
+ } else {
+ str = format(value[key], recurseTimes - 1);
+ }
+ if (str.indexOf('\n') > -1) {
+ if (isArray(value)) {
+ str = map(str.split('\n'), function (line) {
+ return ' ' + line;
+ }).join('\n').substr(2);
+ } else {
+ str = '\n' + map(str.split('\n'), function (line) {
+ return ' ' + line;
+ }).join('\n');
+ }
+ }
+ } else {
+ str = stylize('[Circular]', 'special');
+ }
+ }
+ if (typeof name === 'undefined') {
+ if (type === 'Array' && key.match(/^\d+$/)) {
+ return str;
+ }
+ name = json.stringify('' + key);
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
+ name = name.substr(1, name.length - 2);
+ name = stylize(name, 'name');
+ } else {
+ name = name.replace(/'/g, "\\'")
+ .replace(/\\"/g, '"')
+ .replace(/(^"|"$)/g, "'");
+ name = stylize(name, 'string');
+ }
+ }
+
+ return name + ': ' + str;
+ });
+
+ seen.pop();
+
+ var numLinesEst = 0;
+ var length = reduce(output, function (prev, cur) {
+ numLinesEst++;
+ if (indexOf(cur, '\n') >= 0) numLinesEst++;
+ return prev + cur.length + 1;
+ }, 0);
+
+ if (length > 50) {
+ output = braces[0] +
+ (base === '' ? '' : base + '\n ') +
+ ' ' +
+ output.join(',\n ') +
+ ' ' +
+ braces[1];
+
+ } else {
+ output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
+ }
+
+ return output;
+ }
+ return format(obj, (typeof depth === 'undefined' ? 2 : depth));
+ };
+
+ function isArray (ar) {
+ return Object.prototype.toString.call(ar) == '[object Array]';
+ };
+
+ function isRegExp(re) {
+ var s = '' + re;
+ return re instanceof RegExp || // easy case
+ // duck-type for context-switching evalcx case
+ typeof(re) === 'function' &&
+ re.constructor.name === 'RegExp' &&
+ re.compile &&
+ re.test &&
+ re.exec &&
+ s.match(/^\/.*\/[gim]{0,3}$/);
+ };
+
+ function isDate(d) {
+ if (d instanceof Date) return true;
+ return false;
+ };
+
+ function keys (obj) {
+ if (Object.keys) {
+ return Object.keys(obj);
+ }
+
+ var keys = [];
+
+ for (var i in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, i)) {
+ keys.push(i);
+ }
+ }
+
+ return keys;
+ }
+
+ function map (arr, mapper, that) {
+ if (Array.prototype.map) {
+ return Array.prototype.map.call(arr, mapper, that);
+ }
+
+ var other= new Array(arr.length);
+
+ for (var i= 0, n = arr.length; i= 2) {
+ var rv = arguments[1];
+ } else {
+ do {
+ if (i in this) {
+ rv = this[i++];
+ break;
+ }
+
+ // if array contains no values, no initial value to return
+ if (++i >= len)
+ throw new TypeError();
+ } while (true);
+ }
+
+ for (; i < len; i++) {
+ if (i in this)
+ rv = fun.call(null, rv, this[i], i, this);
+ }
+
+ return rv;
+ };
+
+ /**
+ * Asserts deep equality
+ *
+ * @see taken from node.js `assert` module (copyright Joyent, MIT license)
+ * @api private
+ */
+
+ expect.eql = function eql (actual, expected) {
+ // 7.1. All identical values are equivalent, as determined by ===.
+ if (actual === expected) {
+ return true;
+ } else if ('undefined' != typeof Buffer
+ && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
+ if (actual.length != expected.length) return false;
+
+ for (var i = 0; i < actual.length; i++) {
+ if (actual[i] !== expected[i]) return false;
+ }
+
+ return true;
+
+ // 7.2. If the expected value is a Date object, the actual value is
+ // equivalent if it is also a Date object that refers to the same time.
+ } else if (actual instanceof Date && expected instanceof Date) {
+ return actual.getTime() === expected.getTime();
+
+ // 7.3. Other pairs that do not both pass typeof value == "object",
+ // equivalence is determined by ==.
+ } else if (typeof actual != 'object' && typeof expected != 'object') {
+ return actual == expected;
+
+ // 7.4. For all other Object pairs, including Array objects, equivalence is
+ // determined by having the same number of owned properties (as verified
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
+ // (although not necessarily the same order), equivalent values for every
+ // corresponding key, and an identical "prototype" property. Note: this
+ // accounts for both named and indexed properties on Arrays.
+ } else {
+ return objEquiv(actual, expected);
+ }
+ }
+
+ function isUndefinedOrNull (value) {
+ return value === null || value === undefined;
+ }
+
+ function isArguments (object) {
+ return Object.prototype.toString.call(object) == '[object Arguments]';
+ }
+
+ function objEquiv (a, b) {
+ if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
+ return false;
+ // an identical "prototype" property.
+ if (a.prototype !== b.prototype) return false;
+ //~~~I've managed to break Object.keys through screwy arguments passing.
+ // Converting to array solves the problem.
+ if (isArguments(a)) {
+ if (!isArguments(b)) {
+ return false;
+ }
+ a = pSlice.call(a);
+ b = pSlice.call(b);
+ return expect.eql(a, b);
+ }
+ try{
+ var ka = keys(a),
+ kb = keys(b),
+ key, i;
+ } catch (e) {//happens when one is a string literal and the other isn't
+ return false;
+ }
+ // having the same number of owned properties (keys incorporates hasOwnProperty)
+ if (ka.length != kb.length)
+ return false;
+ //the same set of keys (although not necessarily the same order),
+ ka.sort();
+ kb.sort();
+ //~~~cheap key test
+ for (i = ka.length - 1; i >= 0; i--) {
+ if (ka[i] != kb[i])
+ return false;
+ }
+ //equivalent values for every corresponding key, and
+ //~~~possibly expensive deep test
+ for (i = ka.length - 1; i >= 0; i--) {
+ key = ka[i];
+ if (!expect.eql(a[key], b[key]))
+ return false;
+ }
+ return true;
+ }
+
+ var json = (function () {
+ "use strict";
+
+ if ('object' == typeof JSON && JSON.parse && JSON.stringify) {
+ return {
+ parse: nativeJSON.parse
+ , stringify: nativeJSON.stringify
+ }
+ }
+
+ var JSON = {};
+
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ function date(d, key) {
+ return isFinite(d.valueOf()) ?
+ d.getUTCFullYear() + '-' +
+ f(d.getUTCMonth() + 1) + '-' +
+ f(d.getUTCDate()) + 'T' +
+ f(d.getUTCHours()) + ':' +
+ f(d.getUTCMinutes()) + ':' +
+ f(d.getUTCSeconds()) + 'Z' : null;
+ };
+
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ gap,
+ indent,
+ meta = { // table of character substitutions
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ },
+ rep;
+
+
+ function quote(string) {
+
+ // If the string contains no control characters, no quote characters, and no
+ // backslash characters, then we can safely slap some quotes around it.
+ // Otherwise we must also replace the offending characters with safe escape
+ // sequences.
+
+ escapable.lastIndex = 0;
+ return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
+ var c = meta[a];
+ return typeof c === 'string' ? c :
+ '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"' : '"' + string + '"';
+ }
+
+
+ function str(key, holder) {
+
+ // Produce a string from holder[key].
+
+ var i, // The loop counter.
+ k, // The member key.
+ v, // The member value.
+ length,
+ mind = gap,
+ partial,
+ value = holder[key];
+
+ // If the value has a toJSON method, call it to obtain a replacement value.
+
+ if (value instanceof Date) {
+ value = date(key);
+ }
+
+ // If we were called with a replacer function, then call the replacer to
+ // obtain a replacement value.
+
+ if (typeof rep === 'function') {
+ value = rep.call(holder, key, value);
+ }
+
+ // What happens next depends on the value's type.
+
+ switch (typeof value) {
+ case 'string':
+ return quote(value);
+
+ case 'number':
+
+ // JSON numbers must be finite. Encode non-finite numbers as null.
+
+ return isFinite(value) ? String(value) : 'null';
+
+ case 'boolean':
+ case 'null':
+
+ // If the value is a boolean or null, convert it to a string. Note:
+ // typeof null does not produce 'null'. The case is included here in
+ // the remote chance that this gets fixed someday.
+
+ return String(value);
+
+ // If the type is 'object', we might be dealing with an object or an array or
+ // null.
+
+ case 'object':
+
+ // Due to a specification blunder in ECMAScript, typeof null is 'object',
+ // so watch out for that case.
+
+ if (!value) {
+ return 'null';
+ }
+
+ // Make an array to hold the partial results of stringifying this object value.
+
+ gap += indent;
+ partial = [];
+
+ // Is the value an array?
+
+ if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+ // The value is an array. Stringify every element. Use null as a placeholder
+ // for non-JSON values.
+
+ length = value.length;
+ for (i = 0; i < length; i += 1) {
+ partial[i] = str(i, value) || 'null';
+ }
+
+ // Join all of the elements together, separated with commas, and wrap them in
+ // brackets.
+
+ v = partial.length === 0 ? '[]' : gap ?
+ '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
+ '[' + partial.join(',') + ']';
+ gap = mind;
+ return v;
+ }
+
+ // If the replacer is an array, use it to select the members to be stringified.
+
+ if (rep && typeof rep === 'object') {
+ length = rep.length;
+ for (i = 0; i < length; i += 1) {
+ if (typeof rep[i] === 'string') {
+ k = rep[i];
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ } else {
+
+ // Otherwise, iterate through all of the keys in the object.
+
+ for (k in value) {
+ if (Object.prototype.hasOwnProperty.call(value, k)) {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ }
+
+ // Join all of the member texts together, separated with commas,
+ // and wrap them in braces.
+
+ v = partial.length === 0 ? '{}' : gap ?
+ '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
+ '{' + partial.join(',') + '}';
+ gap = mind;
+ return v;
+ }
+ }
+
+ // If the JSON object does not yet have a stringify method, give it one.
+
+ JSON.stringify = function (value, replacer, space) {
+
+ // The stringify method takes a value and an optional replacer, and an optional
+ // space parameter, and returns a JSON text. The replacer can be a function
+ // that can replace values, or an array of strings that will select the keys.
+ // A default replacer method can be provided. Use of the space parameter can
+ // produce text that is more easily readable.
+
+ var i;
+ gap = '';
+ indent = '';
+
+ // If the space parameter is a number, make an indent string containing that
+ // many spaces.
+
+ if (typeof space === 'number') {
+ for (i = 0; i < space; i += 1) {
+ indent += ' ';
+ }
+
+ // If the space parameter is a string, it will be used as the indent string.
+
+ } else if (typeof space === 'string') {
+ indent = space;
+ }
+
+ // If there is a replacer, it must be a function or an array.
+ // Otherwise, throw an error.
+
+ rep = replacer;
+ if (replacer && typeof replacer !== 'function' &&
+ (typeof replacer !== 'object' ||
+ typeof replacer.length !== 'number')) {
+ throw new Error('JSON.stringify');
+ }
+
+ // Make a fake root object containing our value under the key of ''.
+ // Return the result of stringifying the value.
+
+ return str('', {'': value});
+ };
+
+ // If the JSON object does not yet have a parse method, give it one.
+
+ JSON.parse = function (text, reviver) {
+ // The parse method takes a text and an optional reviver function, and returns
+ // a JavaScript value if the text is a valid JSON text.
+
+ var j;
+
+ function walk(holder, key) {
+
+ // The walk method is used to recursively walk the resulting structure so
+ // that modifications can be made.
+
+ var k, v, value = holder[key];
+ if (value && typeof value === 'object') {
+ for (k in value) {
+ if (Object.prototype.hasOwnProperty.call(value, k)) {
+ v = walk(value, k);
+ if (v !== undefined) {
+ value[k] = v;
+ } else {
+ delete value[k];
+ }
+ }
+ }
+ }
+ return reviver.call(holder, key, value);
+ }
+
+
+ // Parsing happens in four stages. In the first stage, we replace certain
+ // Unicode characters with escape sequences. JavaScript handles many characters
+ // incorrectly, either silently deleting them, or treating them as line endings.
+
+ text = String(text);
+ cx.lastIndex = 0;
+ if (cx.test(text)) {
+ text = text.replace(cx, function (a) {
+ return '\\u' +
+ ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+ // In the second stage, we run the text against regular expressions that look
+ // for non-JSON patterns. We are especially concerned with '()' and 'new'
+ // because they can cause invocation, and '=' because it can cause mutation.
+ // But just to be safe, we want to reject all unexpected forms.
+
+ // We split the second stage into 4 regexp operations in order to work around
+ // crippling inefficiencies in IE's and Safari's regexp engines. First we
+ // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+ // replace all simple value tokens with ']' characters. Third, we delete all
+ // open brackets that follow a colon or comma or that begin the text. Finally,
+ // we look to see that the remaining characters are only whitespace or ']' or
+ // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+ if (/^[\],:{}\s]*$/
+ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+ // In the third stage we use the eval function to compile the text into a
+ // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+ // in JavaScript: it can begin a block or an object literal. We wrap the text
+ // in parens to eliminate the ambiguity.
+
+ j = eval('(' + text + ')');
+
+ // In the optional fourth stage, we recursively walk the new structure, passing
+ // each name/value pair to a reviver function for possible transformation.
+
+ return typeof reviver === 'function' ?
+ walk({'': j}, '') : j;
+ }
+
+ // If the text is not JSON parseable, then a SyntaxError is thrown.
+
+ throw new SyntaxError('JSON.parse');
+ };
+
+ return JSON;
+ })();
+
+ if ('undefined' != typeof window) {
+ window.expect = module.exports;
+ }
+
+})(
+ this
+ , 'undefined' != typeof module ? module : {}
+ , 'undefined' != typeof exports ? exports : {}
+);
\ No newline at end of file
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html
new file mode 100644
index 0000000..c73147a
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html
@@ -0,0 +1,18 @@
+
+
+ Mocha
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js
new file mode 100644
index 0000000..f3201aa
--- /dev/null
+++ b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js
@@ -0,0 +1,8981 @@
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+(function( window, undefined ) {
+
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document,
+ navigator = window.navigator,
+ location = window.location;
+var jQuery = (function() {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+
+ // Used for trimming whitespace
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+
+ // Check for digits
+ rdigit = /\d/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z])/ig,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context && document.body ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = quickExpr.exec( selector );
+ }
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+ doc = (context ? context.ownerDocument || context : document);
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
+ selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return (context || rootjQuery).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if (selector.selector !== undefined) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.6.2",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = this.constructor();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // Add the callback
+ readyList.done( fn );
+
+ return this;
+ },
+
+ eq: function( i ) {
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, +i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+ // Either a released hold or an DOMready/load event and not yet ready
+ if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
+ }
+ }
+ },
+
+ bindReady: function() {
+ if ( readyList ) {
+ return;
+ }
+
+ readyList = jQuery._Deferred();
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ // A crude way of determining if an object is a window
+ isWindow: function( obj ) {
+ return obj && typeof obj === "object" && "setInterval" in obj;
+ },
+
+ isNaN: function( obj ) {
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ toString.call(obj) ] || "object";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw msg;
+ },
+
+ parseJSON: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return (new Function( "return " + data ))();
+
+ }
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ // (xml & tmp used internally)
+ parseXML: function( data , xml , tmp ) {
+
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+
+ tmp = xml.documentElement;
+
+ if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Converts a dashed string to camelCased string;
+ // Used by both the css and data modules
+ camelCase: function( string ) {
+ return string.replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction( object );
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return object;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: trim ?
+ function( text ) {
+ return text == null ?
+ "" :
+ trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( array, results ) {
+ var ret = results || [];
+
+ if ( array != null ) {
+ // The window, strings (and functions) also have 'length'
+ // The extra typeof function check is to prevent crashes
+ // in Safari 2 (See: #3039)
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+ var type = jQuery.type( array );
+
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
+ push.call( ret, array );
+ } else {
+ jQuery.merge( ret, array );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+
+ if ( indexOf ) {
+ return indexOf.call( array, elem );
+ }
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ if ( array[ i ] === elem ) {
+ return i;
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var i = first.length,
+ j = 0;
+
+ if ( typeof second.length === "number" ) {
+ for ( var l = second.length; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [], retVal;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value, key, ret = [],
+ i = 0,
+ length = elems.length,
+ // jquery objects are treated as arrays
+ isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( key in elems ) {
+ value = callback( elems[ key ], key, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return ret.concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ if ( typeof context === "string" ) {
+ var tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ var args = slice.call( arguments, 2 ),
+ proxy = function() {
+ return fn.apply( context, args.concat( slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Mutifunctional method to get and set values to a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, key, value, exec, fn, pass ) {
+ var length = elems.length;
+
+ // Setting many attributes
+ if ( typeof key === "object" ) {
+ for ( var k in key ) {
+ jQuery.access( elems, k, key[k], exec, fn, value );
+ }
+ return elems;
+ }
+
+ // Setting one attribute
+ if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = !pass && exec && jQuery.isFunction(value);
+
+ for ( var i = 0; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+
+ return elems;
+ }
+
+ // Getting an attribute
+ return length ? fn( elems[0], key ) : undefined;
+ },
+
+ now: function() {
+ return (new Date()).getTime();
+ },
+
+ // Use of jQuery.browser is frowned upon.
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
+ uaMatch: function( ua ) {
+ ua = ua.toLowerCase();
+
+ var match = rwebkit.exec( ua ) ||
+ ropera.exec( ua ) ||
+ rmsie.exec( ua ) ||
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
+ [];
+
+ return { browser: match[1] || "", version: match[2] || "0" };
+ },
+
+ sub: function() {
+ function jQuerySub( selector, context ) {
+ return new jQuerySub.fn.init( selector, context );
+ }
+ jQuery.extend( true, jQuerySub, this );
+ jQuerySub.superclass = this;
+ jQuerySub.fn = jQuerySub.prototype = this();
+ jQuerySub.fn.constructor = jQuerySub;
+ jQuerySub.sub = this.sub;
+ jQuerySub.fn.init = function init( selector, context ) {
+ if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+ context = jQuerySub( context );
+ }
+
+ return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+ };
+ jQuerySub.fn.init.prototype = jQuerySub.fn;
+ var rootjQuerySub = jQuerySub(document);
+ return jQuerySub;
+ },
+
+ browser: {}
+});
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+browserMatch = jQuery.uaMatch( userAgent );
+if ( browserMatch.browser ) {
+ jQuery.browser[ browserMatch.browser ] = true;
+ jQuery.browser.version = browserMatch.version;
+}
+
+// Deprecated, use jQuery.browser.webkit instead
+if ( jQuery.browser.webkit ) {
+ jQuery.browser.safari = true;
+}
+
+// IE doesn't match non-breaking spaces with \s
+if ( rnotwhite.test( "\xA0" ) ) {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+ DOMContentLoaded = function() {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ };
+
+} else if ( document.attachEvent ) {
+ DOMContentLoaded = function() {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+}
+
+// The DOM ready check for Internet Explorer
+function doScrollCheck() {
+ if ( jQuery.isReady ) {
+ return;
+ }
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch(e) {
+ setTimeout( doScrollCheck, 1 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+}
+
+return jQuery;
+
+})();
+
+
+var // Promise methods
+ promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
+ // Static reference to slice
+ sliceDeferred = [].slice;
+
+jQuery.extend({
+ // Create a simple deferred (one callbacks list)
+ _Deferred: function() {
+ var // callbacks list
+ callbacks = [],
+ // stored [ context , args ]
+ fired,
+ // to avoid firing when already doing so
+ firing,
+ // flag to know if the deferred has been cancelled
+ cancelled,
+ // the deferred itself
+ deferred = {
+
+ // done( f1, f2, ...)
+ done: function() {
+ if ( !cancelled ) {
+ var args = arguments,
+ i,
+ length,
+ elem,
+ type,
+ _fired;
+ if ( fired ) {
+ _fired = fired;
+ fired = 0;
+ }
+ for ( i = 0, length = args.length; i < length; i++ ) {
+ elem = args[ i ];
+ type = jQuery.type( elem );
+ if ( type === "array" ) {
+ deferred.done.apply( deferred, elem );
+ } else if ( type === "function" ) {
+ callbacks.push( elem );
+ }
+ }
+ if ( _fired ) {
+ deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
+ }
+ }
+ return this;
+ },
+
+ // resolve with given context and args
+ resolveWith: function( context, args ) {
+ if ( !cancelled && !fired && !firing ) {
+ // make sure args are available (#8421)
+ args = args || [];
+ firing = 1;
+ try {
+ while( callbacks[ 0 ] ) {
+ callbacks.shift().apply( context, args );
+ }
+ }
+ finally {
+ fired = [ context, args ];
+ firing = 0;
+ }
+ }
+ return this;
+ },
+
+ // resolve with this as context and given arguments
+ resolve: function() {
+ deferred.resolveWith( this, arguments );
+ return this;
+ },
+
+ // Has this deferred been resolved?
+ isResolved: function() {
+ return !!( firing || fired );
+ },
+
+ // Cancel
+ cancel: function() {
+ cancelled = 1;
+ callbacks = [];
+ return this;
+ }
+ };
+
+ return deferred;
+ },
+
+ // Full fledged deferred (two callbacks list)
+ Deferred: function( func ) {
+ var deferred = jQuery._Deferred(),
+ failDeferred = jQuery._Deferred(),
+ promise;
+ // Add errorDeferred methods, then and promise
+ jQuery.extend( deferred, {
+ then: function( doneCallbacks, failCallbacks ) {
+ deferred.done( doneCallbacks ).fail( failCallbacks );
+ return this;
+ },
+ always: function() {
+ return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
+ },
+ fail: failDeferred.done,
+ rejectWith: failDeferred.resolveWith,
+ reject: failDeferred.resolve,
+ isRejected: failDeferred.isResolved,
+ pipe: function( fnDone, fnFail ) {
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( {
+ done: [ fnDone, "resolve" ],
+ fail: [ fnFail, "reject" ]
+ }, function( handler, data ) {
+ var fn = data[ 0 ],
+ action = data[ 1 ],
+ returned;
+ if ( jQuery.isFunction( fn ) ) {
+ deferred[ handler ](function() {
+ returned = fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise().then( newDefer.resolve, newDefer.reject );
+ } else {
+ newDefer[ action ]( returned );
+ }
+ });
+ } else {
+ deferred[ handler ]( newDefer[ action ] );
+ }
+ });
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ if ( obj == null ) {
+ if ( promise ) {
+ return promise;
+ }
+ promise = obj = {};
+ }
+ var i = promiseMethods.length;
+ while( i-- ) {
+ obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
+ }
+ return obj;
+ }
+ });
+ // Make sure only one callback list will be used
+ deferred.done( failDeferred.cancel ).fail( deferred.cancel );
+ // Unexpose cancel
+ delete deferred.cancel;
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( firstParam ) {
+ var args = arguments,
+ i = 0,
+ length = args.length,
+ count = length,
+ deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
+ firstParam :
+ jQuery.Deferred();
+ function resolveFunc( i ) {
+ return function( value ) {
+ args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
+ if ( !( --count ) ) {
+ // Strange bug in FF4:
+ // Values changed onto the arguments object sometimes end up as undefined values
+ // outside the $.when method. Cloning the object into a fresh array solves the issue
+ deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
+ }
+ };
+ }
+ if ( length > 1 ) {
+ for( ; i < length; i++ ) {
+ if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
+ args[ i ].promise().then( resolveFunc(i), deferred.reject );
+ } else {
+ --count;
+ }
+ }
+ if ( !count ) {
+ deferred.resolveWith( deferred, args );
+ }
+ } else if ( deferred !== firstParam ) {
+ deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
+ }
+ return deferred.promise();
+ }
+});
+
+
+
+jQuery.support = (function() {
+
+ var div = document.createElement( "div" ),
+ documentElement = document.documentElement,
+ all,
+ a,
+ select,
+ opt,
+ input,
+ marginDiv,
+ support,
+ fragment,
+ body,
+ testElementParent,
+ testElement,
+ testElementStyle,
+ tds,
+ events,
+ eventName,
+ i,
+ isSupported;
+
+ // Preliminary tests
+ div.setAttribute("className", "t");
+ div.innerHTML = "
a";
+
+ all = div.getElementsByTagName( "*" );
+ a = div.getElementsByTagName( "a" )[ 0 ];
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return {};
+ }
+
+ // First batch of supports tests
+ select = document.createElement( "select" );
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName( "input" )[ 0 ];
+
+ support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: ( div.firstChild.nodeType === 3 ),
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName( "tbody" ).length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName( "link" ).length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.55$/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: ( input.value === "on" ),
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // Will be defined later
+ submitBubbles: true,
+ changeBubbles: true,
+ focusinBubbles: false,
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true
+ };
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
+ div.attachEvent( "onclick", function() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ support.noCloneEvent = false;
+ });
+ div.cloneNode( true ).fireEvent( "onclick" );
+ }
+
+ // Check if a radio maintains it's value
+ // after being appended to the DOM
+ input = document.createElement("input");
+ input.value = "t";
+ input.setAttribute("type", "radio");
+ support.radioValue = input.value === "t";
+
+ input.setAttribute("checked", "checked");
+ div.appendChild( input );
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( div.firstChild );
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ div.innerHTML = "";
+
+ // Figure out if the W3C box model works as expected
+ div.style.width = div.style.paddingLeft = "1px";
+
+ body = document.getElementsByTagName( "body" )[ 0 ];
+ // We use our own, invisible, body unless the body is already present
+ // in which case we use a div (#9239)
+ testElement = document.createElement( body ? "div" : "body" );
+ testElementStyle = {
+ visibility: "hidden",
+ width: 0,
+ height: 0,
+ border: 0,
+ margin: 0
+ };
+ if ( body ) {
+ jQuery.extend( testElementStyle, {
+ position: "absolute",
+ left: -1000,
+ top: -1000
+ });
+ }
+ for ( i in testElementStyle ) {
+ testElement.style[ i ] = testElementStyle[ i ];
+ }
+ testElement.appendChild( div );
+ testElementParent = body || documentElement;
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ support.boxModel = div.offsetWidth === 2;
+
+ if ( "zoom" in div.style ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.style.display = "inline";
+ div.style.zoom = 1;
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "";
+ div.innerHTML = "";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
+ }
+
+ div.innerHTML = "
t
";
+ tds = div.getElementsByTagName( "td" );
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE < 8 fail this test)
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+ div.innerHTML = "";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. For more
+ // info see bug #3333
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ if ( document.defaultView && document.defaultView.getComputedStyle ) {
+ marginDiv = document.createElement( "div" );
+ marginDiv.style.width = "0";
+ marginDiv.style.marginRight = "0";
+ div.appendChild( marginDiv );
+ support.reliableMarginRight =
+ ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
+ }
+
+ // Remove the body element we added
+ testElement.innerHTML = "";
+ testElementParent.removeChild( testElement );
+
+ // Technique from Juriy Zaytsev
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
+ // We only care about the case where non-standard event systems
+ // are used, namely in IE. Short-circuiting here helps us to
+ // avoid an eval call (in setAttribute) which can cause CSP
+ // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
+ if ( div.attachEvent ) {
+ for( i in {
+ submit: 1,
+ change: 1,
+ focusin: 1
+ } ) {
+ eventName = "on" + i;
+ isSupported = ( eventName in div );
+ if ( !isSupported ) {
+ div.setAttribute( eventName, "return;" );
+ isSupported = ( typeof div[ eventName ] === "function" );
+ }
+ support[ i + "Bubbles" ] = isSupported;
+ }
+ }
+
+ // Null connected elements to avoid leaks in IE
+ testElement = fragment = select = opt = body = marginDiv = div = input = null;
+
+ return support;
+})();
+
+// Keep track of boxModel
+jQuery.boxModel = jQuery.support.boxModel;
+
+
+
+
+var rbrace = /^(?:\{.*\}|\[.*\])$/,
+ rmultiDash = /([a-z])([A-Z])/g;
+
+jQuery.extend({
+ cache: {},
+
+ // Please use with caution
+ uuid: 0,
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
+ } else {
+ id = jQuery.expando;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
+ // metadata on plain JS objects when the object is serialized using
+ // JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
+ } else {
+ cache[ id ] = jQuery.extend(cache[ id ], name);
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // Internal jQuery data is stored in a separate object inside the object's data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data
+ if ( pvt ) {
+ if ( !thisCache[ internalKey ] ) {
+ thisCache[ internalKey ] = {};
+ }
+
+ thisCache = thisCache[ internalKey ];
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
+ // not attempt to inspect the internal events object using jQuery.data, as this
+ // internal data object is undocumented and subject to change.
+ if ( name === "events" && !thisCache[name] ) {
+ return thisCache[ internalKey ] && thisCache[ internalKey ].events;
+ }
+
+ return getByName ?
+ // Check for both converted-to-camel and non-converted data property names
+ thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
+ thisCache;
+ },
+
+ removeData: function( elem, name, pvt /* Internal Use Only */ ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var internalKey = jQuery.expando, isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+
+ // See jQuery.data for more information
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+ var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
+
+ if ( thisCache ) {
+ delete thisCache[ name ];
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !isEmptyDataObject(thisCache) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( pvt ) {
+ delete cache[ id ][ internalKey ];
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject(cache[ id ]) ) {
+ return;
+ }
+ }
+
+ var internalCache = cache[ id ][ internalKey ];
+
+ // Browsers that fail expando deletion also refuse to delete expandos on
+ // the window, but it will allow it on all other JS objects; other browsers
+ // don't care
+ if ( jQuery.support.deleteExpando || cache != window ) {
+ delete cache[ id ];
+ } else {
+ cache[ id ] = null;
+ }
+
+ // We destroyed the entire user cache at once because it's faster than
+ // iterating through each key, but we need to continue to persist internal
+ // data if it existed
+ if ( internalCache ) {
+ cache[ id ] = {};
+ // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
+ // metadata on plain JS objects when the object is serialized using
+ // JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+
+ cache[ id ][ internalKey ] = internalCache;
+
+ // Otherwise, we need to eliminate the expando on the node to avoid
+ // false lookups in the cache for entries that no longer exist
+ } else if ( isNode ) {
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( jQuery.support.deleteExpando ) {
+ delete elem[ jQuery.expando ];
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ } else {
+ elem[ jQuery.expando ] = null;
+ }
+ }
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return jQuery.data( elem, name, data, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ if ( elem.nodeName ) {
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ if ( match ) {
+ return !(match === true || elem.getAttribute("classid") !== match);
+ }
+ }
+
+ return true;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var data = null;
+
+ if ( typeof key === "undefined" ) {
+ if ( this.length ) {
+ data = jQuery.data( this[0] );
+
+ if ( this[0].nodeType === 1 ) {
+ var attr = this[0].attributes, name;
+ for ( var i = 0, l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
+
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = jQuery.camelCase( name.substring(5) );
+
+ dataAttr( this[0], name, data[ name ] );
+ }
+ }
+ }
+ }
+
+ return data;
+
+ } else if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ // Try to fetch any internally stored data first
+ if ( data === undefined && this.length ) {
+ data = jQuery.data( this[0], key );
+ data = dataAttr( this[0], key, data );
+ }
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+
+ } else {
+ return this.each(function() {
+ var $this = jQuery( this ),
+ args = [ parts[0], value ];
+
+ $this.triggerHandler( "setData" + parts[1] + "!", args );
+ jQuery.data( this, key, value );
+ $this.triggerHandler( "changeData" + parts[1] + "!", args );
+ });
+ }
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+ var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ !jQuery.isNaN( data ) ? parseFloat( data ) :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
+// property to be considered empty objects; this property always exists in
+// order to make sure JSON.stringify does not expose internal metadata
+function isEmptyDataObject( obj ) {
+ for ( var name in obj ) {
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+
+
+function handleQueueMarkDefer( elem, type, src ) {
+ var deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ defer = jQuery.data( elem, deferDataKey, undefined, true );
+ if ( defer &&
+ ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
+ ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
+ // Give room for hard-coded callbacks to fire first
+ // and eventually mark/queue something else on the element
+ setTimeout( function() {
+ if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
+ !jQuery.data( elem, markDataKey, undefined, true ) ) {
+ jQuery.removeData( elem, deferDataKey, true );
+ defer.resolve();
+ }
+ }, 0 );
+ }
+}
+
+jQuery.extend({
+
+ _mark: function( elem, type ) {
+ if ( elem ) {
+ type = (type || "fx") + "mark";
+ jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
+ }
+ },
+
+ _unmark: function( force, elem, type ) {
+ if ( force !== true ) {
+ type = elem;
+ elem = force;
+ force = false;
+ }
+ if ( elem ) {
+ type = type || "fx";
+ var key = type + "mark",
+ count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
+ if ( count ) {
+ jQuery.data( elem, key, count, true );
+ } else {
+ jQuery.removeData( elem, key, true );
+ handleQueueMarkDefer( elem, type, "mark" );
+ }
+ }
+ },
+
+ queue: function( elem, type, data ) {
+ if ( elem ) {
+ type = (type || "fx") + "queue";
+ var q = jQuery.data( elem, type, undefined, true );
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery.data( elem, type, jQuery.makeArray(data), true );
+ } else {
+ q.push( data );
+ }
+ }
+ return q || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift(),
+ defer;
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
+
+ if ( fn ) {
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift("inprogress");
+ }
+
+ fn.call(elem, function() {
+ jQuery.dequeue(elem, type);
+ });
+ }
+
+ if ( !queue.length ) {
+ jQuery.removeData( elem, type + "queue", true );
+ handleQueueMarkDefer( elem, type, "queue" );
+ }
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ }
+
+ if ( data === undefined ) {
+ return jQuery.queue( this[0], type );
+ }
+ return this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function() {
+ var elem = this;
+ setTimeout(function() {
+ jQuery.dequeue( elem, type );
+ }, time );
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, object ) {
+ if ( typeof type !== "string" ) {
+ object = type;
+ type = undefined;
+ }
+ type = type || "fx";
+ var defer = jQuery.Deferred(),
+ elements = this,
+ i = elements.length,
+ count = 1,
+ deferDataKey = type + "defer",
+ queueDataKey = type + "queue",
+ markDataKey = type + "mark",
+ tmp;
+ function resolve() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ }
+ while( i-- ) {
+ if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
+ ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
+ jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
+ jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
+ count++;
+ tmp.done( resolve );
+ }
+ }
+ resolve();
+ return defer.promise();
+ }
+});
+
+
+
+
+var rclass = /[\n\t\r]/g,
+ rspace = /\s+/,
+ rreturn = /\r/g,
+ rtype = /^(?:button|input)$/i,
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
+ rclickable = /^a(?:rea)?$/i,
+ rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+ rinvalidChar = /\:|^on/,
+ formHook, boolHook;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, name, value, true, jQuery.attr );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, name, value, true, jQuery.prop );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classNames, i, l, elem,
+ setClass, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( value && typeof value === "string" ) {
+ classNames = value.split( rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className && classNames.length === 1 ) {
+ elem.className = value;
+
+ } else {
+ setClass = " " + elem.className + " ";
+
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
+ setClass += classNames[ c ] + " ";
+ }
+ }
+ elem.className = jQuery.trim( setClass );
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classNames, i, l, elem, className, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
+ });
+ }
+
+ if ( (value && typeof value === "string") || value === undefined ) {
+ classNames = (value || "").split( rspace );
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
+
+ if ( elem.nodeType === 1 && elem.className ) {
+ if ( value ) {
+ className = (" " + elem.className + " ").replace( rclass, " " );
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[ c ] + " ", " ");
+ }
+ elem.className = jQuery.trim( className );
+
+ } else {
+ elem.className = "";
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.split( rspace );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space seperated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ";
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var hooks, ret,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return undefined;
+ }
+
+ var isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var self = jQuery(this), val;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value,
+ index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
+
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
+ if ( one && !values.length && options.length ) {
+ return jQuery( options[ index ] ).val();
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attrFn: {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
+ },
+
+ attrFix: {
+ // Always normalize to ensure hook usage
+ tabindex: "tabIndex"
+ },
+
+ attr: function( elem, name, value, pass ) {
+ var nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return undefined;
+ }
+
+ if ( pass && name in jQuery.attrFn ) {
+ return jQuery( elem )[ name ]( value );
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( !("getAttribute" in elem) ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ var ret, hooks,
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // Normalize the name if needed
+ if ( notxml ) {
+ name = jQuery.attrFix[ name ] || name;
+
+ hooks = jQuery.attrHooks[ name ];
+
+ if ( !hooks ) {
+ // Use boolHook for boolean attributes
+ if ( rboolean.test( name ) ) {
+
+ hooks = boolHook;
+
+ // Use formHook for forms and if the name contains certain characters
+ } else if ( formHook && name !== "className" &&
+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
+
+ hooks = formHook;
+ }
+ }
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+ return undefined;
+
+ } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, "" + value );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ ret = elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret === null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, name ) {
+ var propName;
+ if ( elem.nodeType === 1 ) {
+ name = jQuery.attrFix[ name ] || name;
+
+ if ( jQuery.support.getSetAttribute ) {
+ // Use removeAttribute in browsers that support it
+ elem.removeAttribute( name );
+ } else {
+ jQuery.attr( elem, name, "" );
+ elem.removeAttributeNode( elem.getAttributeNode( name ) );
+ }
+
+ // Set corresponding property to false for boolean attributes
+ if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
+ elem[ propName ] = false;
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to it's default in case type is set after value
+ // This is for element creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ },
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabIndex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ },
+ // Use the value property for back compat
+ // Use the formHook for button elements in IE6/7 (#1954)
+ value: {
+ get: function( elem, name ) {
+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
+ return formHook.get( elem, name );
+ }
+ return name in elem ?
+ elem.value :
+ null;
+ },
+ set: function( elem, value, name ) {
+ if ( formHook && jQuery.nodeName( elem, "button" ) ) {
+ return formHook.set( elem, value, name );
+ }
+ // Does not return so that setAttribute is also used
+ elem.value = value;
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return undefined;
+ }
+
+ var ret, hooks,
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return (elem[ name ] = value);
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {}
+});
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ // Align boolean attributes with corresponding properties
+ return jQuery.prop( elem, name ) ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ var propName;
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else {
+ // value is true since we know at this point it's type boolean and not false
+ // Set boolean attributes to the same name and set the DOM property
+ propName = jQuery.propFix[ name ] || name;
+ if ( propName in elem ) {
+ // Only set the IDL specifically if it already exists on the element
+ elem[ propName ] = true;
+ }
+
+ elem.setAttribute( name, name.toLowerCase() );
+ }
+ return name;
+ }
+};
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !jQuery.support.getSetAttribute ) {
+
+ // propFix is more comprehensive and contains all fixes
+ jQuery.attrFix = jQuery.propFix;
+
+ // Use this for any attribute on a form in IE6/7
+ formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret;
+ ret = elem.getAttributeNode( name );
+ // Return undefined if nodeValue is empty string
+ return ret && ret.nodeValue !== "" ?
+ ret.nodeValue :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Check form objects in IE (multiple bugs related)
+ // Only use nodeValue if the attribute node exists on the form
+ var ret = elem.getAttributeNode( name );
+ if ( ret ) {
+ ret.nodeValue = value;
+ return value;
+ }
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+}
+
+
+// Some attributes require a special call on IE
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret === null ? undefined : ret;
+ }
+ });
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Normalize to lowercase since IE uppercases css property names
+ return elem.style.cssText.toLowerCase() || undefined;
+ },
+ set: function( elem, value ) {
+ return (elem.style.cssText = "" + value);
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ }
+ });
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
+ }
+ }
+ });
+});
+
+
+
+
+var rnamespaces = /\.(.*)$/,
+ rformElems = /^(?:textarea|input|select)$/i,
+ rperiod = /\./g,
+ rspaces = / /g,
+ rescape = /[^\w\s.|`]/g,
+ fcleanup = function( nm ) {
+ return nm.replace(rescape, "\\$&");
+ };
+
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code originated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function( elem, types, handler, data ) {
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ if ( handler === false ) {
+ handler = returnFalse;
+ } else if ( !handler ) {
+ // Fixes bug #7229. Fix recommended by jdalton
+ return;
+ }
+
+ var handleObjIn, handleObj;
+
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ }
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure
+ var elemData = jQuery._data( elem );
+
+ // If no elemData is found then we must be trying to bind to one of the
+ // banned noData elements
+ if ( !elemData ) {
+ return;
+ }
+
+ var events = elemData.events,
+ eventHandle = elemData.handle;
+
+ if ( !events ) {
+ elemData.events = events = {};
+ }
+
+ if ( !eventHandle ) {
+ elemData.handle = eventHandle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.handle.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ }
+
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native events in IE.
+ eventHandle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = types.split(" ");
+
+ var type, i = 0, namespaces;
+
+ while ( (type = types[ i++ ]) ) {
+ handleObj = handleObjIn ?
+ jQuery.extend({}, handleObjIn) :
+ { handler: handler, data: data };
+
+ // Namespaced event handlers
+ if ( type.indexOf(".") > -1 ) {
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ handleObj.namespace = namespaces.slice(0).sort().join(".");
+
+ } else {
+ namespaces = [];
+ handleObj.namespace = "";
+ }
+
+ handleObj.type = type;
+ if ( !handleObj.guid ) {
+ handleObj.guid = handler.guid;
+ }
+
+ // Get the current list of functions bound to this event
+ var handlers = events[ type ],
+ special = jQuery.event.special[ type ] || {};
+
+ // Init the event handler queue
+ if ( !handlers ) {
+ handlers = events[ type ] = [];
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers.push( handleObj );
+
+ // Keep track of which events have been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, pos ) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ if ( handler === false ) {
+ handler = returnFalse;
+ }
+
+ var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
+ events = elemData && elemData.events;
+
+ if ( !elemData || !events ) {
+ return;
+ }
+
+ // types is actually an event object here
+ if ( types && types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Unbind all events for the element
+ if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
+ types = types || "";
+
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types );
+ }
+
+ return;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ types = types.split(" ");
+
+ while ( (type = types[ i++ ]) ) {
+ origType = type;
+ handleObj = null;
+ all = type.indexOf(".") < 0;
+ namespaces = [];
+
+ if ( !all ) {
+ // Namespaced event handlers
+ namespaces = type.split(".");
+ type = namespaces.shift();
+
+ namespace = new RegExp("(^|\\.)" +
+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
+
+ eventType = events[ type ];
+
+ if ( !eventType ) {
+ continue;
+ }
+
+ if ( !handler ) {
+ for ( j = 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ jQuery.event.remove( elem, origType, handleObj.handler, j );
+ eventType.splice( j--, 1 );
+ }
+ }
+
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+
+ for ( j = pos || 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( handler.guid === handleObj.guid ) {
+ // remove the given handler for the given type
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ if ( pos == null ) {
+ eventType.splice( j--, 1 );
+ }
+
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+
+ if ( pos != null ) {
+ break;
+ }
+ }
+ }
+
+ // remove generic event handler if no more handlers exist
+ if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ ret = null;
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ var handle = elemData.handle;
+ if ( handle ) {
+ handle.elem = null;
+ }
+
+ delete elemData.events;
+ delete elemData.handle;
+
+ if ( jQuery.isEmptyObject( elemData ) ) {
+ jQuery.removeData( elem, undefined, true );
+ }
+ }
+ },
+
+ // Events that are safe to short-circuit if no handlers are attached.
+ // Native DOM events should not be added, they may have inline handlers.
+ customEvent: {
+ "getData": true,
+ "setData": true,
+ "changeData": true
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ // Event object or event type
+ var type = event.type || event,
+ namespaces = [],
+ exclusive;
+
+ if ( type.indexOf("!") >= 0 ) {
+ // Exclusive events trigger only for the exact event (no namespaces)
+ type = type.slice(0, -1);
+ exclusive = true;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+
+ if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
+ // No jQuery handlers for this event type, and it can't have inline handlers
+ return;
+ }
+
+ // Caller can pass in an Event, Object, or just an event type string
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[ jQuery.expando ] ? event :
+ // Object literal
+ new jQuery.Event( type, event ) :
+ // Just the event type (string)
+ new jQuery.Event( type );
+
+ event.type = type;
+ event.exclusive = exclusive;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
+
+ // triggerHandler() and global events don't bubble or run the default action
+ if ( onlyHandlers || !elem ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // TODO: Stop taunting the data cache; remove global events and always attach to document
+ jQuery.each( jQuery.cache, function() {
+ // internalKey variable is just used to make it easier to find
+ // and potentially change this stuff later; currently it just
+ // points to jQuery.expando
+ var internalKey = jQuery.expando,
+ internalCache = this[ internalKey ];
+ if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
+ jQuery.event.trigger( event, data, internalCache.handle.elem );
+ }
+ });
+ return;
+ }
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ event.target = elem;
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data != null ? jQuery.makeArray( data ) : [];
+ data.unshift( event );
+
+ var cur = elem,
+ // IE doesn't like method names with a colon (#3533, #8272)
+ ontype = type.indexOf(":") < 0 ? "on" + type : "";
+
+ // Fire event on the current element, then bubble up the DOM tree
+ do {
+ var handle = jQuery._data( cur, "handle" );
+
+ event.currentTarget = cur;
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Trigger an inline bound script
+ if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
+ event.result = false;
+ event.preventDefault();
+ }
+
+ // Bubble up to document, then to window
+ cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
+ } while ( cur && !event.isPropagationStopped() );
+
+ // If nobody prevented the default action, do it now
+ if ( !event.isDefaultPrevented() ) {
+ var old,
+ special = jQuery.event.special[ type ] || {};
+
+ if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction)() check here because IE6/7 fails that test.
+ // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
+ try {
+ if ( ontype && elem[ type ] ) {
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ old = elem[ ontype ];
+
+ if ( old ) {
+ elem[ ontype ] = null;
+ }
+
+ jQuery.event.triggered = type;
+ elem[ type ]();
+ }
+ } catch ( ieError ) {}
+
+ if ( old ) {
+ elem[ ontype ] = old;
+ }
+
+ jQuery.event.triggered = undefined;
+ }
+ }
+
+ return event.result;
+ },
+
+ handle: function( event ) {
+ event = jQuery.event.fix( event || window.event );
+ // Snapshot the handlers list since a called handler may add/remove events.
+ var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
+ run_all = !event.exclusive && !event.namespace,
+ args = Array.prototype.slice.call( arguments, 0 );
+
+ // Use the fix-ed Event rather than the (read-only) native event
+ args[0] = event;
+ event.currentTarget = this;
+
+ for ( var j = 0, l = handlers.length; j < l; j++ ) {
+ var handleObj = handlers[ j ];
+
+ // Triggered event must 1) be non-exclusive and have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event.
+ if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handleObj.handler;
+ event.data = handleObj.data;
+ event.handleObj = handleObj;
+
+ var ret = handleObj.handler.apply( this, args );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
+ }
+ }
+ return event.result;
+ },
+
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = jQuery.Event( originalEvent );
+
+ for ( var i = this.props.length, prop; i; ) {
+ prop = this.props[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary
+ if ( !event.target ) {
+ // Fixes #1925 where srcElement might not be defined either
+ event.target = event.srcElement || document;
+ }
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement ) {
+ event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
+ }
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var eventDocument = event.target.ownerDocument || document,
+ doc = eventDocument.documentElement,
+ body = eventDocument.body;
+
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
+ event.which = event.charCode != null ? event.charCode : event.keyCode;
+ }
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey ) {
+ event.metaKey = event.ctrlKey;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button !== undefined ) {
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+ }
+
+ return event;
+ },
+
+ // Deprecated, use jQuery.guid instead
+ guid: 1E8,
+
+ // Deprecated, use jQuery.proxy instead
+ proxy: jQuery.proxy,
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: jQuery.bindReady,
+ teardown: jQuery.noop
+ },
+
+ live: {
+ add: function( handleObj ) {
+ jQuery.event.add( this,
+ liveConvert( handleObj.origType, handleObj.selector ),
+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
+ },
+
+ remove: function( handleObj ) {
+ jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
+ }
+ },
+
+ beforeunload: {
+ setup: function( data, namespaces, eventHandle ) {
+ // We only want to do this special case on windows
+ if ( jQuery.isWindow( this ) ) {
+ this.onbeforeunload = eventHandle;
+ }
+ },
+
+ teardown: function( namespaces, eventHandle ) {
+ if ( this.onbeforeunload === eventHandle ) {
+ this.onbeforeunload = null;
+ }
+ }
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ if ( elem.detachEvent ) {
+ elem.detachEvent( "on" + type, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !this.preventDefault ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // otherwise set the returnValue property of the original event to false (IE)
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function( event ) {
+
+ // Check if mouse(over|out) are still within the same parent element
+ var related = event.relatedTarget,
+ inside = false,
+ eventType = event.type;
+
+ event.type = event.data;
+
+ if ( related !== this ) {
+
+ if ( related ) {
+ inside = jQuery.contains( this, related );
+ }
+
+ if ( !inside ) {
+
+ jQuery.event.handle.apply( this, arguments );
+
+ event.type = eventType;
+ }
+ }
+},
+
+// In case of event delegation, we only need to rename the event.type,
+// liveHandler will take care of the rest.
+delegate = function( event ) {
+ event.type = event.data;
+ jQuery.event.handle.apply( this, arguments );
+};
+
+// Create mouseenter and mouseleave events
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ setup: function( data ) {
+ jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
+ },
+ teardown: function( data ) {
+ jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
+ }
+ };
+});
+
+// submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function( data, namespaces ) {
+ if ( !jQuery.nodeName( this, "form" ) ) {
+ jQuery.event.add(this, "click.specialSubmit", function( e ) {
+ var elem = e.target,
+ type = elem.type;
+
+ if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
+ trigger( "submit", this, arguments );
+ }
+ });
+
+ jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
+ var elem = e.target,
+ type = elem.type;
+
+ if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
+ trigger( "submit", this, arguments );
+ }
+ });
+
+ } else {
+ return false;
+ }
+ },
+
+ teardown: function( namespaces ) {
+ jQuery.event.remove( this, ".specialSubmit" );
+ }
+ };
+
+}
+
+// change delegation, happens here so we have bind.
+if ( !jQuery.support.changeBubbles ) {
+
+ var changeFilters,
+
+ getVal = function( elem ) {
+ var type = elem.type, val = elem.value;
+
+ if ( type === "radio" || type === "checkbox" ) {
+ val = elem.checked;
+
+ } else if ( type === "select-multiple" ) {
+ val = elem.selectedIndex > -1 ?
+ jQuery.map( elem.options, function( elem ) {
+ return elem.selected;
+ }).join("-") :
+ "";
+
+ } else if ( jQuery.nodeName( elem, "select" ) ) {
+ val = elem.selectedIndex;
+ }
+
+ return val;
+ },
+
+ testChange = function testChange( e ) {
+ var elem = e.target, data, val;
+
+ if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
+ return;
+ }
+
+ data = jQuery._data( elem, "_change_data" );
+ val = getVal(elem);
+
+ // the current data will be also retrieved by beforeactivate
+ if ( e.type !== "focusout" || elem.type !== "radio" ) {
+ jQuery._data( elem, "_change_data", val );
+ }
+
+ if ( data === undefined || val === data ) {
+ return;
+ }
+
+ if ( data != null || val ) {
+ e.type = "change";
+ e.liveFired = undefined;
+ jQuery.event.trigger( e, arguments[1], elem );
+ }
+ };
+
+ jQuery.event.special.change = {
+ filters: {
+ focusout: testChange,
+
+ beforedeactivate: testChange,
+
+ click: function( e ) {
+ var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
+
+ if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
+ testChange.call( this, e );
+ }
+ },
+
+ // Change has to be called before submit
+ // Keydown will be called before keypress, which is used in submit-event delegation
+ keydown: function( e ) {
+ var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
+
+ if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
+ (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
+ type === "select-multiple" ) {
+ testChange.call( this, e );
+ }
+ },
+
+ // Beforeactivate happens also before the previous element is blurred
+ // with this event you can't trigger a change event, but you can store
+ // information
+ beforeactivate: function( e ) {
+ var elem = e.target;
+ jQuery._data( elem, "_change_data", getVal(elem) );
+ }
+ },
+
+ setup: function( data, namespaces ) {
+ if ( this.type === "file" ) {
+ return false;
+ }
+
+ for ( var type in changeFilters ) {
+ jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
+ }
+
+ return rformElems.test( this.nodeName );
+ },
+
+ teardown: function( namespaces ) {
+ jQuery.event.remove( this, ".specialChange" );
+
+ return rformElems.test( this.nodeName );
+ }
+ };
+
+ changeFilters = jQuery.event.special.change.filters;
+
+ // Handle when the input is .focus()'d
+ changeFilters.focus = changeFilters.beforeactivate;
+}
+
+function trigger( type, elem, args ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ // Don't pass args or remember liveFired; they apply to the donor event.
+ var event = jQuery.extend( {}, args[ 0 ] );
+ event.type = type;
+ event.originalEvent = {};
+ event.liveFired = undefined;
+ jQuery.event.handle.call( elem, event );
+ if ( event.isDefaultPrevented() ) {
+ args[ 0 ].preventDefault();
+ }
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0;
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+
+ function handler( donor ) {
+ // Donor event is always a native one; fix it and switch its type.
+ // Let focusin/out handler cancel the donor focus/blur event.
+ var e = jQuery.event.fix( donor );
+ e.type = fix;
+ e.originalEvent = {};
+ jQuery.event.trigger( e, null, e.target );
+ if ( e.isDefaultPrevented() ) {
+ donor.preventDefault();
+ }
+ }
+ });
+}
+
+jQuery.each(["bind", "one"], function( i, name ) {
+ jQuery.fn[ name ] = function( type, data, fn ) {
+ var handler;
+
+ // Handle object literals
+ if ( typeof type === "object" ) {
+ for ( var key in type ) {
+ this[ name ](key, data, type[key], fn);
+ }
+ return this;
+ }
+
+ if ( arguments.length === 2 || data === false ) {
+ fn = data;
+ data = undefined;
+ }
+
+ if ( name === "one" ) {
+ handler = function( event ) {
+ jQuery( this ).unbind( event, handler );
+ return fn.apply( this, arguments );
+ };
+ handler.guid = fn.guid || jQuery.guid++;
+ } else {
+ handler = fn;
+ }
+
+ if ( type === "unload" && name !== "one" ) {
+ this.one( type, data, fn );
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ jQuery.event.add( this[i], type, handler, data );
+ }
+ }
+
+ return this;
+ };
+});
+
+jQuery.fn.extend({
+ unbind: function( type, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" && !type.preventDefault ) {
+ for ( var key in type ) {
+ this.unbind(key, type[key]);
+ }
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ jQuery.event.remove( this[i], type, fn );
+ }
+ }
+
+ return this;
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.live( types, data, fn, selector );
+ },
+
+ undelegate: function( selector, types, fn ) {
+ if ( arguments.length === 0 ) {
+ return this.unbind( "live" );
+
+ } else {
+ return this.die( types, null, fn, selector );
+ }
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ return jQuery.event.trigger( type, data, this[0], true );
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments,
+ guid = fn.guid || jQuery.guid++,
+ i = 0,
+ toggler = function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ };
+
+ // link all the functions, so any of them can unbind this click handler
+ toggler.guid = guid;
+ while ( i < args.length ) {
+ args[ i++ ].guid = guid;
+ }
+
+ return this.click( toggler );
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+var liveMap = {
+ focus: "focusin",
+ blur: "focusout",
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+};
+
+jQuery.each(["live", "die"], function( i, name ) {
+ jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
+ var type, i = 0, match, namespaces, preType,
+ selector = origSelector || this.selector,
+ context = origSelector ? this : jQuery( this.context );
+
+ if ( typeof types === "object" && !types.preventDefault ) {
+ for ( var key in types ) {
+ context[ name ]( key, data, types[key], selector );
+ }
+
+ return this;
+ }
+
+ if ( name === "die" && !types &&
+ origSelector && origSelector.charAt(0) === "." ) {
+
+ context.unbind( origSelector );
+
+ return this;
+ }
+
+ if ( data === false || jQuery.isFunction( data ) ) {
+ fn = data || returnFalse;
+ data = undefined;
+ }
+
+ types = (types || "").split(" ");
+
+ while ( (type = types[ i++ ]) != null ) {
+ match = rnamespaces.exec( type );
+ namespaces = "";
+
+ if ( match ) {
+ namespaces = match[0];
+ type = type.replace( rnamespaces, "" );
+ }
+
+ if ( type === "hover" ) {
+ types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
+ continue;
+ }
+
+ preType = type;
+
+ if ( liveMap[ type ] ) {
+ types.push( liveMap[ type ] + namespaces );
+ type = type + namespaces;
+
+ } else {
+ type = (liveMap[ type ] || type) + namespaces;
+ }
+
+ if ( name === "live" ) {
+ // bind live handler
+ for ( var j = 0, l = context.length; j < l; j++ ) {
+ jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
+ { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
+ }
+
+ } else {
+ // unbind live handler
+ context.unbind( "live." + liveConvert( type, selector ), fn );
+ }
+ }
+
+ return this;
+ };
+});
+
+function liveHandler( event ) {
+ var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
+ elems = [],
+ selectors = [],
+ events = jQuery._data( this, "events" );
+
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
+ if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
+ return;
+ }
+
+ if ( event.namespace ) {
+ namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
+
+ event.liveFired = this;
+
+ var live = events.live.slice(0);
+
+ for ( j = 0; j < live.length; j++ ) {
+ handleObj = live[j];
+
+ if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
+ selectors.push( handleObj.selector );
+
+ } else {
+ live.splice( j--, 1 );
+ }
+ }
+
+ match = jQuery( event.target ).closest( selectors, event.currentTarget );
+
+ for ( i = 0, l = match.length; i < l; i++ ) {
+ close = match[i];
+
+ for ( j = 0; j < live.length; j++ ) {
+ handleObj = live[j];
+
+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
+ elem = close.elem;
+ related = null;
+
+ // Those two events require additional checking
+ if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
+ event.type = handleObj.preType;
+ related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
+
+ // Make sure not to accidentally match a child element with the same selector
+ if ( related && jQuery.contains( elem, related ) ) {
+ related = elem;
+ }
+ }
+
+ if ( !related || related !== elem ) {
+ elems.push({ elem: elem, handleObj: handleObj, level: close.level });
+ }
+ }
+ }
+ }
+
+ for ( i = 0, l = elems.length; i < l; i++ ) {
+ match = elems[i];
+
+ if ( maxLevel && match.level > maxLevel ) {
+ break;
+ }
+
+ event.currentTarget = match.elem;
+ event.data = match.handleObj.data;
+ event.handleObj = match.handleObj;
+
+ ret = match.handleObj.origHandler.apply( match.elem, arguments );
+
+ if ( ret === false || event.isPropagationStopped() ) {
+ maxLevel = match.level;
+
+ if ( ret === false ) {
+ stop = false;
+ }
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
+ }
+ }
+
+ return stop;
+}
+
+function liveConvert( type, selector ) {
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
+}
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ if ( fn == null ) {
+ fn = data;
+ data = null;
+ }
+
+ return arguments.length > 0 ?
+ this.bind( name, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( jQuery.attrFn ) {
+ jQuery.attrFn[ name ] = true;
+ }
+});
+
+
+
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+ done = 0,
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true,
+ rBackslash = /\\/g,
+ rNonWord = /\W/;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function() {
+ baseHasDuplicate = false;
+ return 0;
+});
+
+var Sizzle = function( selector, context, results, seed ) {
+ results = results || [];
+ context = context || document;
+
+ var origContext = context;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var m, set, checkSet, extra, ret, cur, pop, i,
+ prune = true,
+ contextXML = Sizzle.isXML( context ),
+ parts = [],
+ soFar = selector;
+
+ // Reset the position of the chunker regexp (start from head)
+ do {
+ chunker.exec( "" );
+ m = chunker.exec( soFar );
+
+ if ( m ) {
+ soFar = m[3];
+
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
+ }
+ } while ( m );
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context );
+
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] ) {
+ selector += parts.shift();
+ }
+
+ set = posProcess( selector, set );
+ }
+ }
+
+ } else {
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+
+ ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set )[0] :
+ ret.set[0];
+ }
+
+ if ( context ) {
+ ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+
+ set = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set ) :
+ ret.set;
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray( set );
+
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ cur = parts.pop();
+ pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+
+ } else {
+ checkSet = parts = [];
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ Sizzle.error( cur || selector );
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+
+ } else if ( context && context.nodeType === 1 ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+
+ } else {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
+
+ return results;
+};
+
+Sizzle.uniqueSort = function( results ) {
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function( expr, set ) {
+ return Sizzle( expr, null, null, set );
+};
+
+Sizzle.matchesSelector = function( node, expr ) {
+ return Sizzle( expr, null, null, [node] ).length > 0;
+};
+
+Sizzle.find = function( expr, context, isXML ) {
+ var set;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+ var match,
+ type = Expr.order[i];
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ var left = match[1];
+ match.splice( 1, 1 );
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace( rBackslash, "" );
+ set = Expr.find[ type ]( match, context, isXML );
+
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = typeof context.getElementsByTagName !== "undefined" ?
+ context.getElementsByTagName( "*" ) :
+ [];
+ }
+
+ return { set: set, expr: expr };
+};
+
+Sizzle.filter = function( expr, set, inplace, not ) {
+ var match, anyFound,
+ old = expr,
+ result = [],
+ curLoop = set,
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
+
+ while ( expr && set.length ) {
+ for ( var type in Expr.filter ) {
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ var found, item,
+ filter = Expr.filter[ type ],
+ left = match[1];
+
+ anyFound = false;
+
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ var pass = not ^ !!found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+
+ } else {
+ curLoop[i] = false;
+ }
+
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr === old ) {
+ if ( anyFound == null ) {
+ Sizzle.error( expr );
+
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+ throw "Syntax error, unrecognized expression: " + msg;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ },
+
+ leftMatch: {},
+
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+
+ attrHandle: {
+ href: function( elem ) {
+ return elem.getAttribute( "href" );
+ },
+ type: function( elem ) {
+ return elem.getAttribute( "type" );
+ }
+ },
+
+ relative: {
+ "+": function(checkSet, part){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !rNonWord.test( part ),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag ) {
+ part = part.toLowerCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+
+ ">": function( checkSet, part ) {
+ var elem,
+ isPartStr = typeof part === "string",
+ i = 0,
+ l = checkSet.length;
+
+ if ( isPartStr && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+ }
+ }
+
+ } else {
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+
+ "": function(checkSet, part, isXML){
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
+ },
+
+ "~": function( checkSet, part, isXML ) {
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !rNonWord.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
+ }
+ },
+
+ find: {
+ ID: function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ },
+
+ NAME: function( match, context ) {
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [],
+ results = context.getElementsByName( match[1] );
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+
+ TAG: function( match, context ) {
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
+ return context.getElementsByTagName( match[1] );
+ }
+ }
+ },
+ preFilter: {
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
+ match = " " + match[1].replace( rBackslash, "" ) + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
+ result.push( elem );
+ }
+
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+
+ ID: function( match ) {
+ return match[1].replace( rBackslash, "" );
+ },
+
+ TAG: function( match, curLoop ) {
+ return match[1].replace( rBackslash, "" ).toLowerCase();
+ },
+
+ CHILD: function( match ) {
+ if ( match[1] === "nth" ) {
+ if ( !match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ match[2] = match[2].replace(/^\+|\s*/g, '');
+
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+ else if ( match[2] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
+ var name = match[1] = match[1].replace( rBackslash, "" );
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ // Handle if an un-quoted value was used
+ match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+
+ return false;
+ }
+
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+
+ POS: function( match ) {
+ match.unshift( true );
+
+ return match;
+ }
+ },
+
+ filters: {
+ enabled: function( elem ) {
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+
+ disabled: function( elem ) {
+ return elem.disabled === true;
+ },
+
+ checked: function( elem ) {
+ return elem.checked === true;
+ },
+
+ selected: function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ parent: function( elem ) {
+ return !!elem.firstChild;
+ },
+
+ empty: function( elem ) {
+ return !elem.firstChild;
+ },
+
+ has: function( elem, i, match ) {
+ return !!Sizzle( match[3], elem ).length;
+ },
+
+ header: function( elem ) {
+ return (/h\d/i).test( elem.nodeName );
+ },
+
+ text: function( elem ) {
+ var attr = elem.getAttribute( "type" ), type = elem.type;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
+ },
+
+ radio: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
+ },
+
+ checkbox: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
+ },
+
+ file: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
+ },
+
+ password: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
+ },
+
+ submit: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && "submit" === elem.type;
+ },
+
+ image: function( elem ) {
+ return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
+ },
+
+ reset: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && "reset" === elem.type;
+ },
+
+ button: function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && "button" === elem.type || name === "button";
+ },
+
+ input: function( elem ) {
+ return (/input|select|textarea|button/i).test( elem.nodeName );
+ },
+
+ focus: function( elem ) {
+ return elem === elem.ownerDocument.activeElement;
+ }
+ },
+ setFilters: {
+ first: function( elem, i ) {
+ return i === 0;
+ },
+
+ last: function( elem, i, match, array ) {
+ return i === array.length - 1;
+ },
+
+ even: function( elem, i ) {
+ return i % 2 === 0;
+ },
+
+ odd: function( elem, i ) {
+ return i % 2 === 1;
+ },
+
+ lt: function( elem, i, match ) {
+ return i < match[3] - 0;
+ },
+
+ gt: function( elem, i, match ) {
+ return i > match[3] - 0;
+ },
+
+ nth: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ },
+
+ eq: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ }
+ },
+ filter: {
+ PSEUDO: function( elem, match, i, array ) {
+ var name = match[1],
+ filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var j = 0, l = not.length; j < l; j++ ) {
+ if ( not[j] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ } else {
+ Sizzle.error( name );
+ }
+ },
+
+ CHILD: function( elem, match ) {
+ var type = match[1],
+ node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ if ( type === "first" ) {
+ return true;
+ }
+
+ node = elem;
+
+ case "last":
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ case "nth":
+ var first = match[2],
+ last = match[3];
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ var doneName = match[0],
+ parent = elem.parentNode;
+
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+ var count = 0;
+
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+
+ parent.sizcache = doneName;
+ }
+
+ var diff = elem.nodeIndex - last;
+
+ if ( first === 0 ) {
+ return diff === 0;
+
+ } else {
+ return ( diff % first === 0 && diff / first >= 0 );
+ }
+ }
+ },
+
+ ID: function( elem, match ) {
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+
+ TAG: function( elem, match ) {
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
+ },
+
+ CLASS: function( elem, match ) {
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+
+ ATTR: function( elem, match ) {
+ var name = match[1],
+ result = Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value !== check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+
+ POS: function( elem, match, i, array ) {
+ var name = match[2],
+ filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS,
+ fescape = function(all, num){
+ return "\\" + (num - 0 + 1);
+ };
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+
+var makeArray = function( array, results ) {
+ array = Array.prototype.slice.call( array, 0 );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch( e ) {
+ makeArray = function( array, results ) {
+ var i = 0,
+ ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+
+ } else {
+ for ( ; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder, siblingCheck;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+ };
+
+} else {
+ sortOrder = function( a, b ) {
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Fallback to using sourceIndex (in IE) if it's available on both nodes
+ } else if ( a.sourceIndex && b.sourceIndex ) {
+ return a.sourceIndex - b.sourceIndex;
+ }
+
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
+ }
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
+ }
+ }
+
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+ siblingCheck = function( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
+ }
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
+ }
+
+ cur = cur.nextSibling;
+ }
+
+ return 1;
+ };
+}
+
+// Utility function for retreiving the text value of an array of DOM nodes
+Sizzle.getText = function( elems ) {
+ var ret = "", elem;
+
+ for ( var i = 0; elems[i]; i++ ) {
+ elem = elems[i];
+
+ // Get the text from text nodes and CDATA nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+ ret += elem.nodeValue;
+
+ // Traverse everything else, except comment nodes
+ } else if ( elem.nodeType !== 8 ) {
+ ret += Sizzle.getText( elem.childNodes );
+ }
+ }
+
+ return ret;
+};
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("div"),
+ id = "script" + (new Date()).getTime(),
+ root = document.documentElement;
+
+ form.innerHTML = "";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( document.getElementById( id ) ) {
+ Expr.find.ID = function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+
+ return m ?
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+
+ Expr.filter.ID = function( elem, match ) {
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+
+ // release memory in IE
+ root = form = null;
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function( match, context ) {
+ var results = context.getElementsByTagName( match[1] );
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "";
+
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+
+ Expr.attrHandle.href = function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ };
+ }
+
+ // release memory in IE
+ div = null;
+})();
+
+if ( document.querySelectorAll ) {
+ (function(){
+ var oldSizzle = Sizzle,
+ div = document.createElement("div"),
+ id = "__sizzle__";
+
+ div.innerHTML = "";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function( query, context, extra, seed ) {
+ context = context || document;
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && !Sizzle.isXML(context) ) {
+ // See if we find a selector to speed up
+ var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
+
+ if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
+ // Speed-up: Sizzle("TAG")
+ if ( match[1] ) {
+ return makeArray( context.getElementsByTagName( query ), extra );
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
+ return makeArray( context.getElementsByClassName( match[2] ), extra );
+ }
+ }
+
+ if ( context.nodeType === 9 ) {
+ // Speed-up: Sizzle("body")
+ // The body element only exists once, optimize finding it
+ if ( query === "body" && context.body ) {
+ return makeArray( [ context.body ], extra );
+
+ // Speed-up: Sizzle("#ID")
+ } else if ( match && match[3] ) {
+ var elem = context.getElementById( match[3] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id === match[3] ) {
+ return makeArray( [ elem ], extra );
+ }
+
+ } else {
+ return makeArray( [], extra );
+ }
+ }
+
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(qsaError) {}
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ var oldContext = context,
+ old = context.getAttribute( "id" ),
+ nid = old || id,
+ hasParent = context.parentNode,
+ relativeHierarchySelector = /^\s*[+~]/.test( query );
+
+ if ( !old ) {
+ context.setAttribute( "id", nid );
+ } else {
+ nid = nid.replace( /'/g, "\\$&" );
+ }
+ if ( relativeHierarchySelector && hasParent ) {
+ context = context.parentNode;
+ }
+
+ try {
+ if ( !relativeHierarchySelector || hasParent ) {
+ return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
+ }
+
+ } catch(pseudoError) {
+ } finally {
+ if ( !old ) {
+ oldContext.removeAttribute( "id" );
+ }
+ }
+ }
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ for ( var prop in oldSizzle ) {
+ Sizzle[ prop ] = oldSizzle[ prop ];
+ }
+
+ // release memory in IE
+ div = null;
+ })();
+}
+
+(function(){
+ var html = document.documentElement,
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
+
+ if ( matches ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9 fails this)
+ var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
+ pseudoWorks = false;
+
+ try {
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( document.documentElement, "[test!='']:sizzle" );
+
+ } catch( pseudoError ) {
+ pseudoWorks = true;
+ }
+
+ Sizzle.matchesSelector = function( node, expr ) {
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+ if ( !Sizzle.isXML( node ) ) {
+ try {
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
+ var ret = matches.call( node, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || !disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9, so check for that
+ node.document && node.document.nodeType !== 11 ) {
+ return ret;
+ }
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle(expr, null, null, [node]).length > 0;
+ };
+ }
+})();
+
+(function(){
+ var div = document.createElement("div");
+
+ div.innerHTML = "";
+
+ // Opera can't find a second classname (in 9.6)
+ // Also, make sure that getElementsByClassName actually exists
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+ return;
+ }
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 ) {
+ return;
+ }
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function( match, context, isXML ) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+
+ // release memory in IE
+ div = null;
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName.toLowerCase() === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+if ( document.documentElement.contains ) {
+ Sizzle.contains = function( a, b ) {
+ return a !== b && (a.contains ? a.contains(b) : true);
+ };
+
+} else if ( document.documentElement.compareDocumentPosition ) {
+ Sizzle.contains = function( a, b ) {
+ return !!(a.compareDocumentPosition(b) & 16);
+ };
+
+} else {
+ Sizzle.contains = function() {
+ return false;
+ };
+}
+
+Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function( selector, context ) {
+ var match,
+ tmpSet = [],
+ later = "",
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})();
+
+
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
+ rmultiselector = /,/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ slice = Array.prototype.slice,
+ POS = jQuery.expr.match.POS,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var self = this,
+ i, l;
+
+ if ( typeof selector !== "string" ) {
+ return jQuery( selector ).filter(function() {
+ for ( i = 0, l = self.length; i < l; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ });
+ }
+
+ var ret = this.pushStack( "", "find", selector ),
+ length, n, r;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( n = length; n < ret.length; n++ ) {
+ for ( r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ has: function( target ) {
+ var targets = jQuery( target );
+ return this.filter(function() {
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && ( typeof selector === "string" ?
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var ret = [], i, l, cur = this[0];
+
+ // Array
+ if ( jQuery.isArray( selectors ) ) {
+ var match, selector,
+ matches = {},
+ level = 1;
+
+ if ( cur && selectors.length ) {
+ for ( i = 0, l = selectors.length; i < l; i++ ) {
+ selector = selectors[i];
+
+ if ( !matches[ selector ] ) {
+ matches[ selector ] = POS.test( selector ) ?
+ jQuery( selector, context || this.context ) :
+ selector;
+ }
+ }
+
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ for ( selector in matches ) {
+ match = matches[ selector ];
+
+ if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
+ ret.push({ selector: selector, elem: cur, level: level });
+ }
+ }
+
+ cur = cur.parentNode;
+ level++;
+ }
+ }
+
+ return ret;
+ }
+
+ // String
+ var pos = POS.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+
+ } else {
+ cur = cur.parentNode;
+ if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
+ break;
+ }
+ }
+ }
+ }
+
+ ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
+
+ return this.pushStack( ret, "closest", selectors );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ if ( !elem || typeof elem === "string" ) {
+ return jQuery.inArray( this[0],
+ // If it receives a string, the selector is used
+ // If it receives nothing, the siblings are used
+ elem ? jQuery( elem ) : this.parent().children() );
+ }
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+ all :
+ jQuery.unique( all ) );
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ }
+});
+
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return jQuery.nth( elem, 2, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return jQuery.nth( elem, 2, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( elem.parentNode.firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.makeArray( elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until ),
+ // The variable 'args' was introduced in
+ // https://github.com/jquery/jquery/commit/52a0238
+ // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
+ // http://code.google.com/p/v8/issues/detail?id=1050
+ args = slice.call(arguments);
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret, name, args.join(",") );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function( cur, result, dir, elem ) {
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && ++num === result ) {
+ break;
+ }
+ }
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return (elem === qualifier) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
+ });
+}
+
+
+
+
+var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
+ rtagName = /<([\w:]+)/,
+ rtbody = /", "" ],
+ legend: [ 1, "" ],
+ thead: [ 1, "