Uploading Application Communication Service source code 05/70105/1
authorJihoon Park <jpark0@samsung.com>
Wed, 18 May 2016 06:25:48 +0000 (15:25 +0900)
committerJihoon Park <jpark0@samsung.com>
Wed, 18 May 2016 06:25:48 +0000 (15:25 +0900)
Application Communication Service provides a feature to launch
and communicate to an application in a remote device.
This service can be used by Device-toDevice Convergence framework.

Change-Id: I96a058dffe2094eb2cf5210d9988eab7c7f681bb
Signed-off-by: Jihoon Park <jpark0@samsung.com>
1067 files changed:
CMakeLists.txt [new file with mode: 0755]
Inc/CCDebugRemote.h [new file with mode: 0755]
Inc/Common/REMOTEApp.h [new file with mode: 0755]
Inc/Common/REMOTECommon.h [new file with mode: 0755]
Inc/Common/REMOTEMutex.h [new file with mode: 0755]
Inc/Common/REMOTESemaphore.h [new file with mode: 0755]
Inc/Common/REMOTEString.h [new file with mode: 0755]
Inc/Common/REMOTEThread.h [new file with mode: 0755]
LICENSE.APLv2 [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/LICENSE.APLv2 [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/config.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/config.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/device/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/events/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/logging/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/multiscreen-service.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/404.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap-theme.min.css [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap.min.css [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap.min.css.bak [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.eot [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.svg [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.ttf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.woff [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/img/icon.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/js/bootstrap.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/js/jquery.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.ttf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.woff [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/cross-out.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded-3d.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/js/bootstrap.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/js/less-1.7.5.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/websockets/main.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/websockets/styles.less [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/css/style.css [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/index.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/js/main.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/routes/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/settings/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/utils/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferPool.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferUtil.fallback.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferUtil.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/ErrorCodes.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Receiver.hixie.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Receiver.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Sender.hixie.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Sender.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Validation.fallback.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Validation.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/WebSocket.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/WebSocketServer.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/browser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/lib/commander.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/nan.h [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/lib/options.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/test/fixtures/test.conf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/test/options.test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/example.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/tinycolor.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/async/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/async/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/async/component.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/async/lib/async.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/async/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/examples/app.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/examples/examples.iml [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/lib/captchapng.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/lib/lib.iml [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/lib/pnglib.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/lib/eventemitter2.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/bin/express [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/application.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/express.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/middleware.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/request.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/response.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/router/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/router/route.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/utils.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/view.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/lib/commander.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/cache.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/connect.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/compress.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/csrf.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/directory.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/favicon.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/json.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/limit.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/logger.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/multipart.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/query.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/responseTime.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/memory.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/session.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/store.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/static.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/staticCache.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/timeout.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/vhost.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/patch.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/proto.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/directory.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/error.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/favicon.ico [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_add.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_code.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_error.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_find.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_go.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_green.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_key.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_link.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_red.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_save.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_word.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_world.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/style.css [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/utils.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/component.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/mocha.opts [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/serialize.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/bower.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/browser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/component.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/debug.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/methods/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/methods/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/README.markdown [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/examples/pow.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/chmod.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/clobber.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/mkdirp.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/perm.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/race.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/rel.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/return.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/return_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/root.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/umask.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/History.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/lib/send.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/lib/utils.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/mime.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/types/mime.types [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/types/node.types [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/express/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/HISTORY.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/inherits.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/inherits_browser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/codes.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/LICENSE.txt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.compat.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.compat.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.underscore.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.underscore.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/lodash.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/bin/cmd.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/bin/usage.txt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/examples/pow.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/example/parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/readme.markdown [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/dash.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/default_bool.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/dotted.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/long.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/short.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/whitespace.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/readme.markdown [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/chmod.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/clobber.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/mkdirp.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/opts_fs.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/opts_fs_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/perm.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/perm_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/race.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/rel.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/return.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/return_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/root.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/umask.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/umask_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/bin/ngrok.cmd [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/Gruntfile.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/bin/decompress-zip [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/download-test-assets.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/decompress-zip.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/extractors.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/file-details.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/signatures.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/structures.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/README.markdown [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/buf.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/stream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/lib/vars.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/README.markdown [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/examples/slice.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/examples/splice.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/test/buffers.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/README.markdown [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/examples/add_do.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/examples/prompt.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/test/chainsaw.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/perf/loop.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/perf/small.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/bu.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/deferred.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/dots.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/eof.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/flush.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/from_buffer.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/get_buffer.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/immediate.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/interval.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/into_buffer.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/into_stream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/loop.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/loop_scan.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/lu.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/negbs.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/negls.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/nested.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/not_enough_buf.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/not_enough_parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/peek.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/pipe.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/posbs.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/posls.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan_buf.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan_buf_null.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/skip.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/split.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/fs.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/graceful-fs.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/polyfills.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/max-open.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/open.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/readdir-sort.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/write-then-read.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/mkpath.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/chmod.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/clobber.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/mkpath.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/perm.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/perm_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/rel.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/root.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/umask.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/umask_sync.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/bin/nopt.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/examples/my-program.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/lib/nopt.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/abbrev.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/test/basic.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/q.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/queue.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/duplex.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/float.patch [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_duplex.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_passthrough.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_readable.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_transform.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_writable.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/isarray/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/isarray/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/passthrough.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/readable.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/transform.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/writable.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/bin/touch.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/bin/nopt.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/examples/my-program.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/lib/nopt.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/test/sanity.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/touch.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/test/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/postinstall.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/chai.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/mocha.opts [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/ngrok.eventemitter.spec.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/ngrok.spec.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/LICENSE.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/bench.gnu [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/bench.sh [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/benchmark-native.c [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/benchmark.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/bin/uuid [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/bower.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/component.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/compare_v1.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/test.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/uuid.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/copy.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/debug.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/getSafe.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/jar.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/run.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/test-cookie.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/test-cookiejar.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/License [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/lib/form_data.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/component.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/License [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/example/usage.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/hawk.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/logo.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/browser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/client.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/crypto.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/server.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/utils.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/browser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/client.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/crypto.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/message.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/readme.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/server.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/uri.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/utils.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/http_signing.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/parser.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/signer.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/util.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/verify.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/README [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/stringify.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/mime.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/types/mime.types [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/types/node.types [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/request.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/googledoodle.jpg [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/run.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/server.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/squid.conf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.cnf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.crl [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.crt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.csr [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.key [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.srl [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.cnf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.crt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.csr [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.key [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/npm-ca.crt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/test.crt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/test.key [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-agentOptions.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-basic-auth.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-body.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-defaults.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-digest-auth.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-emptyBody.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-errors.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-follow-all-303.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-follow-all.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-form.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-hawk.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-headers.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-http-signature.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-httpModule.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-https-strict.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-https.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-isUrl.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-localAddress.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-oauth.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-onelineproxy.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-params.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-piped-redirect.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-pipes.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-pool.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-protocol-changing-redirect.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-proxy.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-qs.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-redirect.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-s3.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-timeout.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-toJSON.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-tunnel.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/unicycle.jpg [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/CHANGELOG.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/docs/transports.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/couchdb.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/custom-levels.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/exception.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/raw-mode.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/webhook-post.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/common.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/cli-config.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/npm-config.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/syslog-config.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/container.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/exception.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/logger.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/console.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/daily-rotate-file.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/file.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/http.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/memory.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/transport.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/webhook.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/MIT-LICENSE.txt [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/ReadMe.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/colors.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/example.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/example.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/themes/winston-dark.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/themes/winston-light.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/cycle.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/lib/eyes.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/test/eyes-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/LICENSE.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/isstream.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/docs/docco.css [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/docs/pkginfo.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/all-properties.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/array-argument.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/multiple-properties.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/object-argument.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/single-property.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/subdir/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/target-dir.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/test/pkginfo-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/License [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/Makefile [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/Readme.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/cli-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/container-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/custom-timestamp-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/exception-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/keys/agent2-cert.pem [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/keys/agent2-key.pem [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/default-exceptions.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/exit-on-error.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/log-exceptions.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/log-string-exception.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/helpers.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/log-exception-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/log-rewriter-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/logger-levels-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/logger-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/stress/http-server.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/console-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/daily-rotate-file-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-maxfiles-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-maxsize-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-open-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-stress-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/memory-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/transport.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/webhook-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/winston-test.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/LICENSE [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/README.md [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/bool.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/boolean_double.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/boolean_single.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/count.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/default_hash.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/default_singles.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/demand_count.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/divide.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/help.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/implies.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/implies_hash.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count_options.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count_wrap.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/nonopt.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/requires_arg.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/short.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/strict.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/string.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/usage-options.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/xup.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/lib/minimist.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/lib/wordwrap.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/_.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/_/bin.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/config.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/count.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/dash.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/mocha.opts [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_camelCase.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_defaults.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_modified.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/short.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/usage.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/whitespace.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/package.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin-tizen/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin-tizen/lib/IpcClient.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-api-v2/channels/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-api-v2/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/index.tpl [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/logs.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/tool.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-mdns-js/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin-msfd/index.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/plugin.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/plugins/service.json [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/server.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/api-v2-channels.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/api-v2-rest.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.ttf [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.woff [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/img/cross-out.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded-3d.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border.png [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/js/bootstrap.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/js/jquery.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/js/less-1.7.5.min.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/index.html [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/main.js [new file with mode: 0755]
MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/styles.less [new file with mode: 0755]
NOTICE [new file with mode: 0755]
PinCodeService/IPCServer.cpp [new file with mode: 0755]
PinCodeService/IPCServer.h [new file with mode: 0755]
PinCodeService/MSFServer.cpp [new file with mode: 0755]
PinCodeService/MSFServer.h [new file with mode: 0755]
PinCodeService/Util/MSFSend.cpp [new file with mode: 0755]
PinCodeService/Util/MSFSend.h [new file with mode: 0755]
PinCodeService/Util/MSFVconfDefine.h [new file with mode: 0755]
PinCodeService/Util/RemoteLogger.cpp [new file with mode: 0755]
PinCodeService/Util/RemoteLogger.h [new file with mode: 0755]
Src/Common/REMOTEApp.cpp [new file with mode: 0755]
Src/Common/REMOTEMutex.cpp [new file with mode: 0755]
Src/Common/REMOTESemaphore.cpp [new file with mode: 0755]
Src/Common/REMOTEString.cpp [new file with mode: 0755]
Src/Common/REMOTEThread.cpp [new file with mode: 0755]
main.cpp [new file with mode: 0755]
msf_tizen_client/AUTHORS [new file with mode: 0644]
msf_tizen_client/CMakeLists.txt [new file with mode: 0755]
msf_tizen_client/LICENSE [new file with mode: 0644]
msf_tizen_client/include/Application.h [new file with mode: 0644]
msf_tizen_client/include/ApplicationInfo.h [new file with mode: 0644]
msf_tizen_client/include/Channel.h [new file with mode: 0644]
msf_tizen_client/include/Client.h [new file with mode: 0644]
msf_tizen_client/include/Clients.h [new file with mode: 0644]
msf_tizen_client/include/Debug.h [new file with mode: 0755]
msf_tizen_client/include/Device.h [new file with mode: 0644]
msf_tizen_client/include/Error.h [new file with mode: 0644]
msf_tizen_client/include/MSFDSearchProvider.h [new file with mode: 0644]
msf_tizen_client/include/Message.h [new file with mode: 0644]
msf_tizen_client/include/Result.h [new file with mode: 0644]
msf_tizen_client/include/Search.h [new file with mode: 0644]
msf_tizen_client/include/SearchProvider.h [new file with mode: 0644]
msf_tizen_client/include/Service.h [new file with mode: 0644]
msf_tizen_client/include/URIparser.h [new file with mode: 0644]
msf_tizen_client/include/mDNSSearchProvider.h [new file with mode: 0644]
msf_tizen_client/msf-api.pc.in [new file with mode: 0755]
msf_tizen_client/packaging/msf-api.manifest [new file with mode: 0755]
msf_tizen_client/packaging/msf-api.spec [new file with mode: 0755]
msf_tizen_client/src/Application.cpp [new file with mode: 0644]
msf_tizen_client/src/ApplicationInfo.cpp [new file with mode: 0755]
msf_tizen_client/src/Channel.cpp [new file with mode: 0644]
msf_tizen_client/src/Client.cpp [new file with mode: 0644]
msf_tizen_client/src/Clients.cpp [new file with mode: 0644]
msf_tizen_client/src/Device.cpp [new file with mode: 0644]
msf_tizen_client/src/Error.cpp [new file with mode: 0644]
msf_tizen_client/src/MSFDSearchProvider.cpp [new file with mode: 0644]
msf_tizen_client/src/Message.cpp [new file with mode: 0644]
msf_tizen_client/src/Result.cpp [new file with mode: 0644]
msf_tizen_client/src/Search.cpp [new file with mode: 0644]
msf_tizen_client/src/SearchProvider.cpp [new file with mode: 0644]
msf_tizen_client/src/Service.cpp [new file with mode: 0644]
msf_tizen_client/src/URIparser.cpp [new file with mode: 0644]
msf_tizen_client/src/mDNSSearchProvider.cpp [new file with mode: 0644]
msf_tizen_client/test/CMakeLists.txt [new file with mode: 0644]
msf_tizen_client/test/main.cpp [new file with mode: 0644]
packaging/org.tizen.multiscreen.service [new file with mode: 0755]
packaging/remote-server.service [new file with mode: 0755]
packaging/remote-server.spec [new file with mode: 0755]
remote-server.manifest [new file with mode: 0755]
remote-server.xml [new file with mode: 0755]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..fcc6200
--- /dev/null
@@ -0,0 +1,147 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(remote-server CXX)
+SET(EXTERNAL_RESOURCES_DIR ${CMAKE_CURRENT_BINARY_DIR}/external)
+
+
+# --- VARIABLES 
+
+# -- building options
+
+# C++
+SET(CMAKE_CXX_FLAGS "-Wall -DHAVE_NETINET_IN_H -lsystemd-daemon -lpthread -Wno-variadic-macros -fPIC") 
+SET(CMAKE_CXX_FLAGS_DEBUG "-g -O2")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+SET(CMAKE_BUILD_TYPE "Debug")
+
+SET(CMAKE_VERBOSE_MAKEFILE ON) # make verbosity
+
+SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+
+SET(NODE_DIR "/usr/apps/")
+
+LINK_DIRECTORIES(/usr/lib)
+
+include_directories(${EXTERNAL_RESOURCES_DIR}/include)
+link_directories(${EXTERNAL_RESOURCES_DIR}/lib)
+include_directories(${DBUS_INCLUDE})
+include_directories(${DBUS_TRY})
+
+
+
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0)
+PKG_CHECK_MODULES(DBUS-GLIB REQUIRED dbus-glib-1)
+
+INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS} ${DBUS-GLIB_INCLUDE_DIRS})
+LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS} ${DBUS-GLIB_LIBRARY_DIRS})
+
+set(CMAKE_FIND_ROOT_PATH ${EXTERNAL_RESOURCES_DIR})
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+# Available Modules : ACL, DIAL, SmartView(Pincode), MSF
+# All support : High grade TV model (ex. HawkP, HawkM)
+# ACL only support : LFD
+
+IF("${PRODUCT_TYPE}" STREQUAL "LFD")
+       ADD_DEFINITIONS("-DSUPPORT_ACL_ONLY")
+
+SET( CM-MANAGER-SRCS
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEMutex.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTESemaphore.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEThread.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEString.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEApp.cpp
+        )
+
+else()
+SET( CM-MANAGER-SRCS
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEMutex.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTESemaphore.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEThread.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEString.cpp
+        ${CMAKE_SOURCE_DIR}/Src/Common/REMOTEApp.cpp
+               ${CMAKE_SOURCE_DIR}/PinCodeService/IPCServer.cpp
+               ${CMAKE_SOURCE_DIR}/PinCodeService/MSFServer.cpp
+               ${CMAKE_SOURCE_DIR}/PinCodeService/Util/MSFSend.cpp
+               ${CMAKE_SOURCE_DIR}/PinCodeService/Util/RemoteLogger.cpp
+               )
+
+ENDIF("${PRODUCT_TYPE}" STREQUAL "LFD")
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/Inc
+#        ${CMAKE_SOURCE_DIR}/usr/include/webconv
+        ${CMAKE_SOURCE_DIR}/Inc/Common
+       ${CMAKE_SOURCE_DIR}/PinCodeService
+       ${CMAKE_SOURCE_DIR}/PinCodeService/Util
+       ${DBUS_INCLUDE}
+       /usr/include/vd_kernel-headers
+       )
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(packages REQUIRED 
+       capi-system-info 
+       capi-network-wifi 
+       capi-network-connection  
+       capi-appfw-app-manager
+       glib-2.0 
+       libcurl 
+       dlog 
+       dbus-glib-1 
+       gobject-2.0 
+       gmodule-2.0 
+       syspopup 
+       syspopup-caller 
+       capi-appfw-application 
+       vconf 
+       capi-system-system-settings 
+       gio-2.0 
+       libsystemd 
+       jsoncpp 
+       deviced 
+       libxml-2.0
+       bluetooth-api
+       argos_watchdog
+       aul
+       libtzplatform-config
+)
+
+
+FOREACH(flag ${packages_CFLAGS})
+       SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -fvisibility=hidden -Wall")
+SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} -g ")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
+
+ADD_LIBRARY(CManager ${CM-MANAGER-SRCS})
+
+ADD_EXECUTABLE(${PROJECT_NAME}  ${CMAKE_SOURCE_DIR}/main.cpp ) # compile the main executable file
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}
+    ${GLIB2_LIBRARIES}
+    ${DBUS-GLIB_LIBRARIES}
+    ${packages_LDFLAGS}
+    boost_system
+    boost_thread
+    libexpat.so
+    libcrypto.so
+    CManager
+) # link the main executable file with libraries
+
+
+
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/MSF-Node/org.tizen.multiscreen DESTINATION ${NODE_DIR})
+
+INSTALL(FILES packaging/org.tizen.multiscreen.service packaging/remote-server.service DESTINATION /usr/lib/systemd/system)
+INSTALL(TARGETS ${PROJECT_NAME}  
+    RUNTIME DESTINATION bin
+    LIBRARY DESTINATION lib
+)
+
+ADD_SUBDIRECTORY(msf_tizen_client)
diff --git a/Inc/CCDebugRemote.h b/Inc/CCDebugRemote.h
new file mode 100755 (executable)
index 0000000..b155804
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _CCDEBUG_REMOTE_H_
+#define _CCDEBUG_REMOTE_H_
+
+#include <dlog/dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "Remote_CM"
+
+#define REMOTE_PRINT_DEBUG(format, args...) LOGD(format"\n", ##args)
+#define REMOTE_PRINT_INFO(format, args...) LOGI(format"\n", ##args)
+#define REMOTE_PRINT_WARN(format, args...) LOGW(format"\n", ##args)
+#define REMOTE_PRINT_MAJOR(format, args...) LOGE(format"\n", ##args)
+#define REMOTE_PRINT_FATAL(format, args...) LOGE(format"\n", ##args)
+
+#define REMOTE_SYSPRINT_DEBUG(format, args...) SLOGD(format"\n", ##args)
+#define REMOTE_SYSPRINT_INFO(format, args...) SLOGI(format"\n", ##args)
+#define REMOTE_SYSPRINT_WARN(format, args...) SLOGW(format"\n", ##args)
+#define REMOTE_SYSPRINT_MAJOR(format, args...) SLOGE(format"\n", ##args)
+#define REMOTE_SYSPRINT_FATAL(format, args...) SLOGE(format"\n", ##args)
+
+//No Need
+#define REMOTERCR_PRINT_DEBUG(format, args...) LOGD(format"\n", ##args)
+#define REMOTERCR_PRINT_INFO(format, args...) LOGI(format"\n", ##args)
+#define REMOTERCR_PRINT_WARN(format, args...) LOGW(format"\n",  ##args)
+#define REMOTERCR_PRINT_MAJOR(format, args...) LOGE(format"\n", ##args)
+#define REMOTERCR_PRINT_FATAL(format, args...) LOGE(format"\n", ##args)
+
+//No Need
+#define REMOTECM_PRINT_DEBUG(format, args...) LOGD(format"\n", ##args)
+#define REMOTECM_PRINT_INFO(format, args...) LOGI(format"\n", ##args)
+#define REMOTECM_PRINT_WARN(format, args...) LOGW(format"\n", ##args)
+#define REMOTECM_PRINT_MAJOR(format, args...) LOGE(format"\n", ##args)
+#define REMOTECM_PRINT_FATAL(format, args...) LOGE(format"\n", ##args)
+
+#define __WDC_LOG_FUNC_START__ LOGV("Enter")
+#define __WDC_LOG_FUNC_END__ LOGV("Quit")
+
+/*
+
+#define REMOTE_PRINT_DEBUG(format, args...) 
+#define REMOTE_PRINT_INFO(format, args...) 
+#define REMOTE_PRINT_WARN(format, args...) 
+#define REMOTE_PRINT_MAJOR(format, args...)
+#define REMOTE_PRINT_FATAL(format, args...) 
+
+#define REMOTERCR_PRINT_DEBUG(format, args...) 
+#define REMOTERCR_PRINT_INFO(format, args...) 
+#define REMOTERCR_PRINT_WARN(format, args...) 
+#define REMOTERCR_PRINT_MAJOR(format, args...)
+#define REMOTERCR_PRINT_FATAL(format, args...) 
+
+#define REMOTECM_PRINT_DEBUG(format, args...) 
+#define REMOTECM_PRINT_INFO(format, args...) 
+#define REMOTECM_PRINT_WARN(format, args...) 
+#define REMOTECM_PRINT_MAJOR(format, args...)
+#define REMOTECM_PRINT_FATAL(format, args...) 
+
+#define __WDC_LOG_FUNC_START__
+#define __WDC_LOG_FUNC_END__
+
+*/
+
+#endif //_CCDEBUG_REMOTE_H_
+
diff --git a/Inc/Common/REMOTEApp.h b/Inc/Common/REMOTEApp.h
new file mode 100755 (executable)
index 0000000..63065e4
--- /dev/null
@@ -0,0 +1,65 @@
+
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*Product: Samsung NService Framework (remote-server)
+ * Version: 1.0
+ *
+ * Copyright 2013-2014 SWC, Samsung Electronics, Inc.
+ * All rights reserved.
+ */
+
+
+/**
+ * @file        REMOTEApp.h
+ * @brief       App class provides functions that manage the App.
+ * @created on: 2016.05.16
+ * @author: Hongkuk Son (hongkuk.son@samsung.com)
+ * @reviewer: Jihoon Park (jpark0@samsung.com)
+ */
+
+#ifndef REMOTEAPP_H_
+#define REMOTEAPP_H_
+
+#undef LOG_TAG
+#define LOG_TAG "rep_WAS"
+#define PRINT_INFO(format, args...) LOGI(format"\n", ##args)
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <dlog/dlog.h>
+#include "REMOTECommon.h"
+
+namespace REMOTE {
+
+class App {
+private:
+    App(void) {}
+
+public:
+       static int launch_app(const char *appid);               // launch application
+       static int launch_browser(const char *url);     // launch org.tizen.browser with given url
+       static int terminate_app(int pid);              // terminate application
+       static int get_current_showing_app(int *pid);
+       static int get_current_showing_app(char **appid);
+       static int get_app_status(int pid, int *status);
+};
+
+}
+
+#endif /* REMOTEAPP_H_ */
diff --git a/Inc/Common/REMOTECommon.h b/Inc/Common/REMOTECommon.h
new file mode 100755 (executable)
index 0000000..6f42e7e
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * @file        REMOTECommon.h        
+ * @brief       This file consists of all necessary #define and necessary typedefs borrowed 
+                from other Orsay projects (e.g. from BP_HAL, AP_Calla etc.) 
+ * @created on: 2013.10.30
+ * @author: Shivaram Yadav (shivaram.y@samsung.com)
+ * @reviewer: Ji-Hoon Kim(jihoon95.kim@samsung.com), Han Kang (han264,kang@samsung.com)
+ */
+
+#ifndef REMOTECOMMON_H_
+#define REMOTECOMMON_H_
+
+//#define NULL 0
+
+#include <assert.h>
+#include <stddef.h>
+
+#define ASSERT(t) assert(t)
+
+#ifndef INT_APP_ASSERT
+#define INT_APP_ASSERT(VAL)        \
+    {            \
+        bool __ret = (VAL)? true: false;    \
+        if (!__ret) {     \
+            ASSERT(VAL);        \
+            return 0;    \
+        }            \
+    }
+#endif
+
+//Borrowed from BP_HAL - shivaram.y:
+
+#endif /* REMOTECOMMON_H_ */
diff --git a/Inc/Common/REMOTEMutex.h b/Inc/Common/REMOTEMutex.h
new file mode 100755 (executable)
index 0000000..c0a71f8
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*Product: Samsung NService Framework (remote-server)
+ * Version: 1.0
+ *
+ * Copyright 2013-2014 SWC, Samsung Electronics, Inc.
+ * All rights reserved.
+ */
+
+
+/**
+ * @file        REMOTEMutex.h   
+ * @brief       Mutex class provides functions that create and manage mutex. 
+ * @created on: 2013.08.31
+ * @author: Shivaram Yadav (shivaram.y@samsung.com)
+ * @reviewer: Ji-Hoon Kim(jihoon95.kim@samsung.com), Han Kang (han264,kang@samsung.com)
+ */
+
+#ifndef REMOTEMUTEX_H_
+#define REMOTEMUTEX_H_
+
+#include "REMOTECommon.h"
+#include "REMOTESemaphore.h"
+#include "pthread.h"
+#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
+
+namespace REMOTE {
+       class Mutex {
+       public:
+               //! The constructor of REMOTE::Mutex.
+               Mutex(void) { m_threadId = 0; }
+               //! The destructor of REMOTE::Mutex.
+               virtual ~Mutex(void) {}
+
+               //! Create the instance
+               bool Create(void);
+               //! Check if the instance was created
+               bool FlagCreate(void) { return m_sem.FlagCreate(); }
+               //! Destroy the instance
+               virtual void Destroy(void);
+
+               //! Locks the created REMOTE::Mutex object.
+               void Lock();
+               //! Tries to lock the REMOTE::Mutex object.
+               bool Try(unsigned long msec = 0);
+               //! Unlocks the REMOTE::Mutex object.
+               bool Unlock(void);
+
+       private:
+               REMOTE::Semaphore m_sem;
+               int m_threadId;
+               int m_count;
+       };
+}
+
+#endif /* REMOTEMUTEX_H_ */
diff --git a/Inc/Common/REMOTESemaphore.h b/Inc/Common/REMOTESemaphore.h
new file mode 100755 (executable)
index 0000000..e1bdb33
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+/*Product: Samsung NService Framework (remote-server)
+ * Version: 1.0
+ *
+ * Copyright 2013-2014 SWC, Samsung Electronics, Inc.
+ * All rights reserved.
+ */
+
+
+/**
+ * @file        REMOTESemaphore.h   
+ * @brief       Semaphore class provides functions that create and manage Semaphore. 
+ * @created on: 2013.08.31
+ * @author: Shivaram Yadav (shivaram.y@samsung.com)
+ * @reviewer: Ji-Hoon Kim(jihoon95.kim@samsung.com), Han Kang (han264,kang@samsung.com)
+ */
+
+#ifndef REMOTESEMAPHORE_H_
+#define REMOTESEMAPHORE_H_
+
+#include <errno.h>
+#include "REMOTECommon.h"
+
+struct PTSemaphore;
+
+namespace REMOTE {
+       class Semaphore {
+       public:
+               Semaphore(void) { m_id = NULL; }
+               virtual ~Semaphore(void) {}
+
+               //! Create the instance
+               bool Create(int count);
+               //! Check if the instance was created
+               bool FlagCreate(void) { return m_id != NULL; }
+               //! Destroy the instance
+               virtual void Destroy(void);
+
+               //! Decreases the counter of REMOTE::Semaphore.
+               void Take(void);
+               //! Tries to decrease the counter of REMOTE::Semaphore.
+               bool Try(unsigned long msec = 0);
+               //! Increases the counter of REMOTE::Semaphore.
+               void Give(void);
+
+       private:
+               PTSemaphore *m_id;
+       };
+}
+
+#endif /* REMOTESEMAPHORE_H_ */
diff --git a/Inc/Common/REMOTEString.h b/Inc/Common/REMOTEString.h
new file mode 100755 (executable)
index 0000000..5b90662
--- /dev/null
@@ -0,0 +1,71 @@
+
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*Product: Samsung NService Framework (remote-server)
+ * Version: 1.0
+ *
+ * Copyright 2013-2014 SWC, Samsung Electronics, Inc.
+ * All rights reserved.
+ */
+
+
+/**
+ * @file        REMOTEString.h   
+ * @brief       String class provides functions that manage the String. 
+ * @created on: 2013.08.31
+ * @author: Shivaram Yadav (shivaram.y@samsung.com)
+ * @reviewer: Ji-Hoon Kim(jihoon95.kim@samsung.com), Han Kang (han264,kang@samsung.com)
+ */
+
+#ifndef REMOTESTRING_H_
+#define REMOTESTRING_H_
+
+#include <string.h>
+#include <string>
+#include <vector>
+
+#include "REMOTECommon.h"
+
+using namespace std;
+
+namespace REMOTE {
+       class String {
+       private:
+               String(void) {}
+
+       public:
+               //! Compares strings.
+               static int          Diff(const char *dest, const char *source);
+               //! Compares strings.
+               static int          Diff(const char *dest, const char *source, unsigned long nSize);
+               //! Copies characters of one string to another.
+               static void         Copy(char *dest, const char *source);
+               //! Copies characters of one string to another.
+               static void         Copy(char *dest, const char *source, unsigned long nSize);
+               //! Gets the length of a string.
+               static unsigned int Length(const char *pString);
+
+               static std::string ReplaceAll(const std::string& targetString, const std::string& src, const std::string& dest);
+
+               // split targetString to tokens datastructure.
+               static int Split(const std::string& targetString, std::vector<std::string>& tokens, const std::string& delimiters);
+       };
+}
+
+#endif /* REMOTESTRING_H_ */
diff --git a/Inc/Common/REMOTEThread.h b/Inc/Common/REMOTEThread.h
new file mode 100755 (executable)
index 0000000..2d841e3
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*Product: Samsung NService Framework (remote-server)
+ * Version: 1.0
+ *
+ * Copyright 2013-2014 SWC, Samsung Electronics, Inc.
+ * All rights reserved.
+ */
+
+
+/**
+ * @file        REMOTEThread.h   
+ * @brief       Theard class provides functions that create and manage the Threads. 
+ * @created on: 2013.08.31
+ * @author: Shivaram Yadav (shivaram.y@samsung.com)
+ * @reviewer: Ji-Hoon Kim(jihoon95.kim@samsung.com), Han Kang (han264,kang@samsung.com)
+ */
+
+#ifndef REMOTETHREAD_H_
+#define REMOTETHREAD_H_
+#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include "REMOTECommon.h"
+
+namespace REMOTE {
+       class Thread {
+       public:
+               Thread();
+               virtual ~Thread(void);
+
+               //! Create the instance
+               bool Create(unsigned long stackSize = CONFIG_STACK_SIZE);
+               //! Check if the instance was created
+               bool FlagCreate(void) { return isREMOTEThreadRunning; }
+               //! Destroy the instance
+               virtual void Destroy(void);
+               //! Returns the ID of the REMOTE::Thread.
+               int Id();
+
+               friend void runREMOTEThread(REMOTE::Thread *thread);
+
+               virtual void t_Main(void) = 0;
+
+               //! Configuration constants
+               enum PTConfigType {
+                       CONFIG_STACK_SIZE = 4096
+               };
+
+       protected:
+
+               //! The thread main virtual function
+               //        virtual void t_Main(void) = 0;
+               /*!<
+               * This function is the thread main virtual function.
+               * As soon as a thread starts, this function is called.
+               * When this function returns, the thread is terminated.
+               *
+               * You have to define this function when you define a new
+               * class that inherits REMOTE::Thread class.
+               */
+
+       private:
+               bool isREMOTEThreadRunning;
+               boost::mutex REMOTEThreadMutex;
+    };
+}
+
+#endif /* REMOTETHREAD_H_ */
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100755 (executable)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/MSF-Node/org.tizen.multiscreen/server/LICENSE.APLv2 b/MSF-Node/org.tizen.multiscreen/server/LICENSE.APLv2
new file mode 100755 (executable)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/MSF-Node/org.tizen.multiscreen/server/config.json b/MSF-Node/org.tizen.multiscreen/server/config.json
new file mode 100755 (executable)
index 0000000..c89f16b
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "plugins" : {
+    "plugin-dev-tools"          : {},
+    "plugin-api-v2"             : {},
+    "plugin-mdns-js"            : {},
+    "plugin-msfd"               : {},
+    "device-plugin-tizen"       : {}
+  }
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/index.js b/MSF-Node/org.tizen.multiscreen/server/index.js
new file mode 100755 (executable)
index 0000000..a35f05c
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+module.exports = require("./lib/multiscreen-service");
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/config.js b/MSF-Node/org.tizen.multiscreen/server/lib/config.js
new file mode 100755 (executable)
index 0000000..9ae14dc
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require('lodash');
+var pkg = require('../package.json');
+var path = require('path');
+var localConfig;
+
+try{
+    localConfig = require(path.join(__dirname,'../config.json'));
+}catch(e){
+    console.warn("[MultiScreen] No service config found! ... using default");
+}
+
+var configuration = {
+
+    allowAllContent : false,
+
+    logging : {
+
+        level : 'debug',
+        handleExceptions : true,
+        exitOnError : false
+    },
+
+    service : {
+        version     : pkg.version,
+        port        : '8001',
+        secureport  : '8002',
+        apiVersion  : '2.0',
+        remoteVersion: '1.0'
+
+    },
+
+       developement : {
+               os : "default",
+       developerMode : '0' ,
+               developerIP : '0.0.0.0'
+       },
+
+    plugins : {}
+};
+
+if(localConfig){
+    _.merge(configuration, localConfig);
+}
+
+console.info("[MultiScreen] config : ", configuration);
+
+module.exports = configuration;
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/device/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/device/index.js
new file mode 100755 (executable)
index 0000000..e8d7e03
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var EventEmitter = require('eventemitter2').EventEmitter2;
+var logger = require('../logging/index').createNamedLogger('Device');
+var request = require('request');
+var createError = require('http-errors');
+var msfUtils = require('../utils/index');
+var async = require('async');
+
+var LAUNCHER_PROXY_URL = 'http://multiscreen.samsung.com/launchservice/v2/launch';
+
+var device = new EventEmitter();
+device.lastLaunchData = {};
+device.allowAllContent = false;
+
+/*
+ A private reference to the underlying device implementation
+ set by the registerDevice method
+*/
+var _device;
+
+
+/*
+ Use a getter for attributes so that we can see errors
+ if anything is accessing them before registerDevice is called;
+ */
+Object.defineProperty(device, 'attributes', {
+    get: function() {
+        if(!_device) logger.warn('Access of device attribute before device implementation was registered');
+        return _device.attributes;
+    }
+});
+
+
+/*
+ Registers a device implementation (typically a device plugin)
+ that handles the underlying implementation for providing attributes about the device
+ The preferred way to register a device implementation is using the device plugin base
+*/
+
+device.registerDevice = function(impl){
+    if(!_device){
+        _device = impl;
+        logger.info(impl.constructor.name + " is now registered and ready");
+        device.emit('ready');
+    }
+    else logger.error('The device ('+impl.constructor.name+') has already been registered');
+};
+
+/*
+  Applications
+*/
+
+device.getApplication = function(options, callback){
+    logger.verbose("getApplication", options);
+    _device.getApplication(options, callback);
+    device.emit('getApplication', options);
+};
+
+device.getPartyMode = function(options, callback){
+    logger.verbose("getPartyMode", options);
+    _device.getPartyMode(options, callback);
+    device.emit('getPartyMode', options);
+};
+device.getApplicationData = function(options, callback){
+    logger.verbose("getApplicationData", options);
+    _device.getApplicationData(options, callback);
+    device.emit('getApplicationData', options);
+
+};
+
+device.launchApplication = function(options, callback){
+    logger.verbose("launchApplication", options);
+    _device.launchApplication(options, callback);
+    device.emit('launchApplication', options);
+
+};
+
+device.terminateApplication = function(options, callback){
+    logger.verbose("terminateApplication", options);
+    _device.terminateApplication(options, callback);
+    device.emit('terminateApplication', options);
+};
+
+device.installApplication = function(options, callback){
+    logger.verbose("installApplication", options);
+    _device.installApplication(options, callback);
+    device.emit('installApplication', options);
+};
+
+
+device.getWebApplication = function(options, callback){
+    logger.verbose("getWebApplication", options);
+    _device.getWebApplication(options, callback);
+    device.emit('getWebApplication', options);
+
+};
+
+device.terminateWebApplication = function(options, callback){
+    logger.verbose("terminateWebApplication", options);
+    _device.terminateWebApplication(options, callback);
+    device.emit('terminateWebApplication', options);
+};
+
+
+device.launchWebApplication = function(options, callback){
+
+               logger.verbose("launchWebApplication", options);
+
+               options.testmode = this.allowAllContent;
+         
+         var inputurl;
+    var resultString = options.url.split("//");
+    if(options.url.length === resultString[0].length) {
+       inputurl = options.url;
+    } else {
+               inputurl = resultString[1];
+    }
+    inputurl = inputurl.replace("www.","");
+    inputurl = inputurl.replace( /(\s*)/g, "" );
+    if(inputurl.charAt(inputurl.length - 1) === "/")
+    inputurl = inputurl.substr(0,inputurl.length - 1);
+
+         switch(inputurl)
+         {
+               case 'dev-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv':
+               case 'dev-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/index.html':
+               case 'dev-multiscreen.samsung.com/casteroids/tv/index.html':
+               case 'fling-tv.herokuapp.com':
+               case 'google.com':
+               case 'multiscreen.samsung.com/app-sample-photos/tv/index.html':
+               case 'multiscreen.samsung.com/casteroids/tv/index.html':
+               case 'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv':
+               case 'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/index.html':
+               case 'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/photoshare/tv':
+               case 'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/photoshare/tv/index.html':
+               case 'yahoo.com':
+                       options.testmode = true;
+                       break;
+         }
+        
+               _device.launchWebApplication(options, callback);\r
+               device.emit('launchWebApplication', options);
+\r
+};\r
+\r
+device.requestRemoteControl = function (options, callback) {\r
+    logger.silly("requestRemoteControl", options);\r
+    _device.requestRemoteControl(options, callback);\r
+    //device.emit("requestRemoteControl", options);\r
+};
+
+device.requestACLPairing = function (options, callback) {
+    logger.verbose("requestACLPairing", options);
+    _device.requestACLPairing(options, callback);
+    device.emit("requestACLPairing", options);
+};
+
+module.exports = device;
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/events/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/events/index.js
new file mode 100755 (executable)
index 0000000..10f2620
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var EventEmitter = require('eventemitter2').EventEmitter2;
+
+module.exports.EventBus = new EventEmitter({
+    wildcard: true,
+    delimiter: ':',
+    newListener: false,
+    maxListeners: 20
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/logging/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/logging/index.js
new file mode 100755 (executable)
index 0000000..a69e351
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require('lodash');
+var winston = require('winston');
+var config = require('../config');
+
+var logger = new (winston.Logger)({
+    transports : [
+        new (winston.transports.Console)({
+            level : config.logging.level,
+            /*prettyPrint : true,*/
+            colorize: 'true',
+            label: 'MultiScreen',
+            handleExceptions: config.logging.handleExceptions
+        }),
+        new (winston.transports.File)({
+            level : config.logging.level,
+            colorize: 'true',
+            label: 'MultiScreen',
+            filename : '/tmp/multiscreen.log',
+            maxsize : 10000000,
+            maxFiles : 3,
+            handleExceptions: config.logging.handleExceptions
+        })
+    ],
+    exitOnError : config.logging.exitOnError
+});
+
+logger.level = config.logging.level;
+
+logger.setLogLevel = function(level){
+    logger.level = level;
+    _.each(logger.transports, function(transport){
+        transport.level = level;
+    });
+};
+
+logger.createNamedLogger = function(name){
+    var namedLogger = {};
+
+    // Extend the logger
+    logger.extend(namedLogger);
+
+    // Augment the logging methods to prefix the name
+    Object.keys(winston.levels).forEach(function (method) {
+        namedLogger[method] = function () {
+            var args = Array.prototype.slice.call(arguments);
+            args.unshift('['+name+']');
+            return logger[method].apply(namedLogger, args);
+        };
+    });
+
+    return namedLogger;
+
+};
+
+module.exports = logger;
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/multiscreen-service.js b/MSF-Node/org.tizen.multiscreen/server/lib/multiscreen-service.js
new file mode 100755 (executable)
index 0000000..56dc99c
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var pkg = require("../package.json");
+var _ = require('lodash');
+var express = require('express');
+var createError = require('http-errors');
+var EventEmitter = require('eventemitter2').EventEmitter2;
+
+var config = require("./config");
+var routes = require('./routes');
+var logger = require('./logging');
+var events = require('./events').EventBus;
+var device = require('./device');
+var utils  = require('./utils');
+var settings  = require('./settings');
+
+var service = new EventEmitter();
+var running = false;
+
+/*
+ Set the public properties for the service
+ */
+service.plugins = {};
+service.config = config;
+service.port = config.service.port;
+service.app = null;
+service.server = null;
+service.logger = logger;
+service.version = pkg.version;
+service.events = events;
+service.device = device;
+service.utils  = utils;
+service.settings  = settings;\r
+service.remoteVersion = '0';
+/*
+ Loads a plugin by name
+ */
+service.loadPlugin = function loadPlugin(name, path, config){
+    // TODO : Add some validation here before this method is exported
+    var PluginClass = require(path);
+    this.plugins[name] = new PluginClass(config);
+};
+
+/*
+ Starts the service
+ */
+service.start = function(){
+
+    if(running) return logger.warn('MULTISCREEN SERVICE IS ALREADY RUNNING');
+
+    logger.info('STARTING MULTISCREEN SERVICE');
+
+
+    /*
+     Set allowing of launching unverified urls
+     */
+    if(config.allowAllContent){
+        device.allowAllContent = config.allowAllContent;
+    }
+
+
+    /*
+     Store a public reference to the express application
+     */
+    this.app = express();
+
+
+    /*
+     Subscribe to all global events for logging
+     */
+    this.events.onAny(function(value){
+        logger.silly('eventbus published : ', this.event);
+    });
+
+
+    /*
+     Store the app configuration
+     */
+    this.app.set('config', this.config);
+
+
+    /*
+     Configure routes
+     */
+    routes.configure(this.app);
+
+
+    /*
+     Store a reference to the http server
+     */
+    this.server = this.app.listen(this.config.service.port);
+
+
+    /*
+     Load Plugins from the config
+     */
+    _.each(this.config.plugins,function(config, key, list){
+        this.loadPlugin(key, '../plugins/'+key, config);
+    },this);
+
+
+    /*
+     404 Handler (this needs to be the last `app.use` request handler)
+     */
+    this.app.use(function(req, res, next){
+
+        res.status(404);
+
+        // respond with JSON
+        if(req.accepts('json') && (req.url.indexOf('/api') === 0 || req.method === 'POST' )){
+            next(createError(404));
+            return;
+        }
+
+        // respond with html 404
+        if (req.accepts('html')) {
+            res.sendfile(require('path').join(__dirname,'resources/public/404.html'));
+            return;
+        }
+
+        // default to plain-text. send()
+        res.type('txt').send('Not found');
+    });
+
+    /*
+     Application level Error Handler (this needs to be the last `app.use` error handler)
+     */
+    this.app.use(function(err, req, res, next) {
+        //logger.error(err.stack);
+        var e = {};
+        if(err.status && err.status < 500){
+            e.status    = err.status || err.statusCode || 500;
+            e.message   = err.message || 'Error '+ e.message;
+            e.code      = e.code || e.status;
+            e.details   = err.details || void 0;
+        }else{
+            e.status    = 500;
+            e.message   = 'Internal Server Error';
+            e.code      = e.status;
+        }
+        res.send(e.status,e);
+    });
+
+    running = true;
+
+};
+
+
+service.stop = function(){
+    this.logger.info('STOPPING MULTISCREEN SERVICE');
+    if(this.server){
+        this.server.close();
+    }
+    // TODO : Stop any necessary plugins and remove any unused resources
+    running = false;
+};
+
+module.exports = service;
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/404.html b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/404.html
new file mode 100755 (executable)
index 0000000..34ec163
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title>404 : Not Found</title>
+
+    <link rel="stylesheet" href="/resources/css/bootstrap.min.css">
+    <script src="/resources/js/bootstrap.min.js"></script>
+
+</head>
+<body>
+
+<div class="container-fluid">
+    <div class="page-header">
+        <h1>Oops!</h1>
+    </div>
+    <div class="panel panel-default">
+        <div class="panel-heading">404 : Page Not Found</div>
+        <div class="panel-body">
+            These are not the droids your looking for....
+        </div>
+    </div>
+
+</div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap-theme.min.css b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap-theme.min.css
new file mode 100755 (executable)
index 0000000..ba4bd28
--- /dev/null
@@ -0,0 +1,7 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+.btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn:active,.btn.active{background-image:none}.btn-default{background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;text-shadow:0 1px 0 #fff;border-color:#ccc}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#2b669a}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-color:#e8e8e8}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);background-color:#357ebd}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f3f3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#222 0,#282828 100%);background-image:linear-gradient(to bottom,#222 0,#282828 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0)}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0)}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0)}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0)}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0)}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);border-color:#3278b3}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0)}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0)}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0)}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0)}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0)}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0)}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap.min.css b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap.min.css
new file mode 100755 (executable)
index 0000000..251c9bf
--- /dev/null
@@ -0,0 +1,7 @@
+/*!
+ * Bootswatch v3.2.0
+ * Homepage: http://bootswatch.com
+ * Copyright 2012-2014 Thomas Park
+ * Licensed under MIT
+ * Based on Bootstrap
+*//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}@media print{*{text-shadow:none !important;color:#000 !important;background:transparent !important;box-shadow:none !important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff !important}.navbar{display:none}.table td,.table th{background-color:#fff !important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000 !important}.label{border:1px solid #000}.table{border-collapse:collapse !important}.table-bordered th,.table-bordered td{border:1px solid #ddd !important}}@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphicons-halflings-regular.eot');src:url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphicons-halflings-regular.woff') format('woff'),url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#c8c8c8;background-color:#272b30}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#ffffff;text-decoration:none}a:hover,a:focus{color:#ffffff;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;width:100% \9;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#1c1e22;border:1px solid #0c0d0e;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;width:100% \9;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #1c1e22}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:normal;line-height:1;color:#7a8288}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}mark,.mark{background-color:#f89406;padding:.2em}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#7a8288}.text-primary{color:#7a8288}a.text-primary:hover{color:#62686d}.text-success{color:#ffffff}a.text-success:hover{color:#e6e6e6}.text-info{color:#ffffff}a.text-info:hover{color:#e6e6e6}.text-warning{color:#ffffff}a.text-warning:hover{color:#e6e6e6}.text-danger{color:#ffffff}a.text-danger:hover{color:#e6e6e6}.bg-primary{color:#fff;background-color:#7a8288}a.bg-primary:hover{background-color:#62686d}.bg-success{background-color:#62c462}a.bg-success:hover{background-color:#42b142}.bg-info{background-color:#5bc0de}a.bg-info:hover{background-color:#31b0d5}.bg-warning{background-color:#f89406}a.bg-warning:hover{background-color:#c67605}.bg-danger{background-color:#ee5f5b}a.bg-danger:hover{background-color:#e9322d}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #1c1e22}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none;margin-left:-5px}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:bold}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #7a8288}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #7a8288}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#7a8288}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #7a8288;border-left:0;text-align:right}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#ffffff;background-color:#333333;border-radius:3px;box-shadow:inset 0 -1px 0 rgba(0,0,0,0.25)}kbd kbd{padding:0;font-size:100%;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;word-break:break-all;word-wrap:break-word;color:#3a3f44;background-color:#f5f5f5;border:1px solid #cccccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.row{margin-left:-15px;margin-right:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-left:15px;padding-right:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0%}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0%}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0%}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0%}}table{background-color:#2e3338}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #1c1e22}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #1c1e22}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #1c1e22}.table .table{background-color:#272b30}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #1c1e22}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #1c1e22}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#353a41}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#49515a}table col[class*="col-"]{position:static;float:none;display:table-column}table td[class*="col-"],table th[class*="col-"]{position:static;float:none;display:table-cell}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#49515a}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#3e444c}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#62c462}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#4fbd4f}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#5bc0de}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#46b8da}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#f89406}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#df8505}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#ee5f5b}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ec4844}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;overflow-x:auto;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #1c1e22;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0;min-width:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#c8c8c8;border:0;border-bottom:1px solid #1c1e22}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}input[type="range"]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:9px;font-size:14px;line-height:1.42857143;color:#272b30}.form-control{display:block;width:100%;height:38px;padding:8px 12px;font-size:14px;line-height:1.42857143;color:#272b30;background-color:#ffffff;background-image:none;border:1px solid #cccccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control::-moz-placeholder{color:#7a8288;opacity:1}.form-control:-ms-input-placeholder{color:#7a8288}.form-control::-webkit-input-placeholder{color:#7a8288}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#999999;opacity:1}textarea.form-control{height:auto}input[type="search"]{-webkit-appearance:none}input[type="date"],input[type="time"],input[type="datetime-local"],input[type="month"]{line-height:38px;line-height:1.42857143 \0}input[type="date"].input-sm,input[type="time"].input-sm,input[type="datetime-local"].input-sm,input[type="month"].input-sm{line-height:30px}input[type="date"].input-lg,input[type="time"].input-lg,input[type="datetime-local"].input-lg,input[type="month"].input-lg{line-height:54px}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;min-height:20px;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{position:absolute;margin-left:-20px;margin-top:4px \9}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:normal;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"].disabled,input[type="checkbox"].disabled,fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:9px;padding-bottom:9px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-left:0;padding-right:0}.input-sm,.form-horizontal .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg,.form-horizontal .form-group-lg .form-control{height:54px;padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:54px;line-height:54px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:47.5px}.form-control-feedback{position:absolute;top:25px;right:0;z-index:2;display:block;width:38px;height:38px;line-height:38px;text-align:center}.input-lg+.form-control-feedback{width:54px;height:54px;line-height:54px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#ffffff}.has-success .form-control{border-color:#ffffff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#e6e6e6;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #fff;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #fff}.has-success .input-group-addon{color:#ffffff;border-color:#ffffff;background-color:#62c462}.has-success .form-control-feedback{color:#ffffff}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#ffffff}.has-warning .form-control{border-color:#ffffff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#e6e6e6;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #fff;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #fff}.has-warning .input-group-addon{color:#ffffff;border-color:#ffffff;background-color:#f89406}.has-warning .form-control-feedback{color:#ffffff}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#ffffff}.has-error .form-control{border-color:#ffffff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#e6e6e6;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #fff;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #fff}.has-error .input-group-addon{color:#ffffff;border-color:#ffffff;background-color:#ee5f5b}.has-error .form-control-feedback{color:#ffffff}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#ffffff}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:9px}.form-horizontal .radio,.form-horizontal .checkbox{min-height:29px}.form-horizontal .form-group{margin-left:-15px;margin-right:-15px}@media (min-width:768px){.form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:9px}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:19.62px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:8px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#ffffff;text-decoration:none}.btn:active,.btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#ffffff;background-color:#3a3f44;border-color:#3a3f44}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#ffffff;background-color:#232628;border-color:#1e2023}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#3a3f44;border-color:#3a3f44}.btn-default .badge{color:#3a3f44;background-color:#ffffff}.btn-primary{color:#ffffff;background-color:#7a8288;border-color:#7a8288}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#ffffff;background-color:#62686d;border-color:#5d6368}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#7a8288;border-color:#7a8288}.btn-primary .badge{color:#7a8288;background-color:#ffffff}.btn-success{color:#ffffff;background-color:#62c462;border-color:#62c462}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#ffffff;background-color:#42b142;border-color:#40a940}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#62c462;border-color:#62c462}.btn-success .badge{color:#62c462;background-color:#ffffff}.btn-info{color:#ffffff;background-color:#5bc0de;border-color:#5bc0de}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#ffffff;background-color:#31b0d5;border-color:#2aabd2}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#5bc0de}.btn-info .badge{color:#5bc0de;background-color:#ffffff}.btn-warning{color:#ffffff;background-color:#f89406;border-color:#f89406}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#ffffff;background-color:#c67605;border-color:#bc7005}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f89406;border-color:#f89406}.btn-warning .badge{color:#f89406;background-color:#ffffff}.btn-danger{color:#ffffff;background-color:#ee5f5b;border-color:#ee5f5b}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#ffffff;background-color:#e9322d;border-color:#e82924}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#ee5f5b;border-color:#ee5f5b}.btn-danger .badge{color:#ee5f5b;background-color:#ffffff}.btn-link{color:#ffffff;font-weight:normal;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#ffffff;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#7a8288;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;text-align:left;background-color:#3a3f44;border:1px solid #272b30;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#272b30}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.42857143;color:#c8c8c8;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{text-decoration:none;color:#ffffff;background-color:#272b30}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#ffffff;text-decoration:none;outline:0;background-color:#272b30}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#7a8288}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#7a8288;white-space:nowrap}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{left:auto;right:0}.navbar-right .dropdown-menu-left{left:0;right:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:4px;border-top-right-radius:0;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle="buttons"]>.btn>input[type="radio"],[data-toggle="buttons"]>.btn>input[type="checkbox"]{position:absolute;z-index:-1;opacity:0;filter:alpha(opacity=0)}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*="col-"]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:54px;padding:14px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:54px;line-height:54px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:8px 12px;font-size:14px;font-weight:normal;line-height:1;color:#272b30;text-align:center;background-color:#999999;border:1px solid #cccccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:14px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#3e444c}.nav>li.disabled>a{color:#7a8288}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#7a8288;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#3e444c;border-color:#ffffff}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #1c1e22}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#1c1e22 #1c1e22 #1c1e22}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#ffffff;background-color:#3e444c;border:1px solid #1c1e22;border-bottom-color:transparent;cursor:default}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #1c1e22}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #1c1e22;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#272b30}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#ffffff;background-color:transparent}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #1c1e22}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #1c1e22;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#272b30}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{overflow-x:visible;padding-right:15px;padding-left:15px;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);-webkit-overflow-scrolling:touch}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block !important;height:auto !important;padding-bottom:0;overflow:visible !important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-left:0;padding-right:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px 15px;font-size:18px;line-height:20px;height:50px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;margin-right:15px;padding:9px 10px;margin-top:8px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left !important}.navbar-right{float:right !important}}.navbar-form{margin-left:-15px;margin-right:-15px;padding:10px 15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);margin-top:6px;margin-bottom:6px}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type="radio"],.navbar-form .checkbox input[type="checkbox"]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:6px;margin-bottom:6px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-left:15px;margin-right:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#3a3f44;border-color:#2b2e32}.navbar-default .navbar-brand{color:#c8c8c8}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#ffffff;background-color:none}.navbar-default .navbar-text{color:#c8c8c8}.navbar-default .navbar-nav>li>a{color:#c8c8c8}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#ffffff;background-color:#272b2e}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#ffffff;background-color:#272b2e}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#cccccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#272b2e}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#272b2e}.navbar-default .navbar-toggle .icon-bar{background-color:#c8c8c8}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#2b2e32}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{background-color:#272b2e;color:#ffffff}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#c8c8c8}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#ffffff;background-color:#272b2e}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#ffffff;background-color:#272b2e}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#cccccc;background-color:transparent}}.navbar-default .navbar-link{color:#c8c8c8}.navbar-default .navbar-link:hover{color:#ffffff}.navbar-default .btn-link{color:#c8c8c8}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#ffffff}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#cccccc}.navbar-inverse{background-color:#7a8288;border-color:#62686d}.navbar-inverse .navbar-brand{color:#cccccc}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#ffffff;background-color:none}.navbar-inverse .navbar-text{color:#cccccc}.navbar-inverse .navbar-nav>li>a{color:#cccccc}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#ffffff;background-color:#5d6368}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#ffffff;background-color:#5d6368}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#cccccc;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#5d6368}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#5d6368}.navbar-inverse .navbar-toggle .icon-bar{background-color:#ffffff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#697075}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{background-color:#5d6368;color:#ffffff}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#62686d}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#62686d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#cccccc}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#ffffff;background-color:#5d6368}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#ffffff;background-color:#5d6368}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#cccccc;background-color:transparent}}.navbar-inverse .navbar-link{color:#cccccc}.navbar-inverse .navbar-link:hover{color:#ffffff}.navbar-inverse .btn-link{color:#cccccc}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#ffffff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#cccccc}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:transparent;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#cccccc}.breadcrumb>.active{color:#7a8288}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:8px 12px;line-height:1.42857143;text-decoration:none;color:#ffffff;background-color:#3a3f44;border:1px solid rgba(0,0,0,0.6);margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:4px;border-top-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#ffffff;background-color:transparent;border-color:rgba(0,0,0,0.6)}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#ffffff;background-color:#232628;border-color:rgba(0,0,0,0.6);cursor:default}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#7a8288;background-color:#ffffff;border-color:rgba(0,0,0,0.6);cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:14px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pager{padding-left:0;margin:20px 0;list-style:none;text-align:center}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#3a3f44;border:1px solid rgba(0,0,0,0.6);border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:transparent}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#7a8288;background-color:#3a3f44;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#ffffff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#3a3f44}.label-default[href]:hover,.label-default[href]:focus{background-color:#232628}.label-primary{background-color:#7a8288}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#62686d}.label-success{background-color:#62c462}.label-success[href]:hover,.label-success[href]:focus{background-color:#42b142}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f89406}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#c67605}.label-danger{background-color:#ee5f5b}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#e9322d}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:bold;color:#ffffff;line-height:1;vertical-align:baseline;white-space:nowrap;text-align:center;background-color:#7a8288;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#ffffff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#ffffff;background-color:#7a8288}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#1c1e22}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#050506}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-left:60px;padding-right:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#1c1e22;border:1px solid #0c0d0e;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-left:auto;margin-right:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#ffffff}.thumbnail .caption{padding:9px;color:#c8c8c8}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:bold}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{background-color:#62c462;border-color:#62bd4f;color:#ffffff}.alert-success hr{border-top-color:#55b142}.alert-success .alert-link{color:#e6e6e6}.alert-info{background-color:#5bc0de;border-color:#3dced8;color:#ffffff}.alert-info hr{border-top-color:#2ac7d2}.alert-info .alert-link{color:#e6e6e6}.alert-warning{background-color:#f89406;border-color:#e96506;color:#ffffff}.alert-warning hr{border-top-color:#d05a05}.alert-warning .alert-link{color:#e6e6e6}.alert-danger{background-color:#ee5f5b;border-color:#ed4d63;color:#ffffff}.alert-danger hr{border-top-color:#ea364f}.alert-danger .alert-link{color:#e6e6e6}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#1c1e22;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress-bar{float:left;width:0%;height:100%;font-size:12px;line-height:20px;color:#ffffff;text-align:center;background-color:#7a8288;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar[aria-valuenow="1"],.progress-bar[aria-valuenow="2"]{min-width:30px}.progress-bar[aria-valuenow="0"]{color:#7a8288;min-width:30px;background-color:transparent;background-image:none;box-shadow:none}.progress-bar-success{background-color:#62c462}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.progress-bar-warning{background-color:#f89406}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.progress-bar-danger{background-color:#ee5f5b}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#32383e;border:1px solid rgba(0,0,0,0.6)}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#c8c8c8}a.list-group-item .list-group-item-heading{color:#ffffff}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;color:#c8c8c8;background-color:#3e444c}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{background-color:#999999;color:#7a8288}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#7a8288}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#ffffff;background-color:#3e444c;border-color:rgba(0,0,0,0.6)}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#a2aab4}.list-group-item-success{color:#ffffff;background-color:#62c462}a.list-group-item-success{color:#ffffff}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#ffffff;background-color:#4fbd4f}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#ffffff;border-color:#ffffff}.list-group-item-info{color:#ffffff;background-color:#5bc0de}a.list-group-item-info{color:#ffffff}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#ffffff;background-color:#46b8da}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#ffffff;border-color:#ffffff}.list-group-item-warning{color:#ffffff;background-color:#f89406}a.list-group-item-warning{color:#ffffff}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#ffffff;background-color:#df8505}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#ffffff;border-color:#ffffff}.list-group-item-danger{color:#ffffff;background-color:#ee5f5b}a.list-group-item-danger{color:#ffffff}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#ffffff;background-color:#ec4844}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#ffffff;border-color:#ffffff}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#2e3338;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#3e444c;border-top:1px solid rgba(0,0,0,0.6);border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-right-radius:3px;border-top-left-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-right-radius:3px;border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #1c1e22}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{border:0;margin-bottom:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid rgba(0,0,0,0.6)}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid rgba(0,0,0,0.6)}.panel-default{border-color:rgba(0,0,0,0.6)}.panel-default>.panel-heading{color:#c8c8c8;background-color:#3e444c;border-color:rgba(0,0,0,0.6)}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:rgba(0,0,0,0.6)}.panel-default>.panel-heading .badge{color:#3e444c;background-color:#c8c8c8}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:rgba(0,0,0,0.6)}.panel-primary{border-color:rgba(0,0,0,0.6)}.panel-primary>.panel-heading{color:#ffffff;background-color:#7a8288;border-color:rgba(0,0,0,0.6)}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:rgba(0,0,0,0.6)}.panel-primary>.panel-heading .badge{color:#7a8288;background-color:#ffffff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:rgba(0,0,0,0.6)}.panel-success{border-color:rgba(0,0,0,0.6)}.panel-success>.panel-heading{color:#ffffff;background-color:#62c462;border-color:rgba(0,0,0,0.6)}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:rgba(0,0,0,0.6)}.panel-success>.panel-heading .badge{color:#62c462;background-color:#ffffff}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:rgba(0,0,0,0.6)}.panel-info{border-color:rgba(0,0,0,0.6)}.panel-info>.panel-heading{color:#ffffff;background-color:#5bc0de;border-color:rgba(0,0,0,0.6)}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:rgba(0,0,0,0.6)}.panel-info>.panel-heading .badge{color:#5bc0de;background-color:#ffffff}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:rgba(0,0,0,0.6)}.panel-warning{border-color:rgba(0,0,0,0.6)}.panel-warning>.panel-heading{color:#ffffff;background-color:#f89406;border-color:rgba(0,0,0,0.6)}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:rgba(0,0,0,0.6)}.panel-warning>.panel-heading .badge{color:#f89406;background-color:#ffffff}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:rgba(0,0,0,0.6)}.panel-danger{border-color:rgba(0,0,0,0.6)}.panel-danger>.panel-heading{color:#ffffff;background-color:#ee5f5b;border-color:rgba(0,0,0,0.6)}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:rgba(0,0,0,0.6)}.panel-danger>.panel-heading .badge{color:#ee5f5b;background-color:#ffffff}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:rgba(0,0,0,0.6)}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#1c1e22;border:1px solid #0c0d0e;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:bold;line-height:1;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000000;text-decoration:none;cursor:pointer;opacity:0.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{display:none;overflow:hidden;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate3d(0, -25%, 0);transform:translate3d(0, -25%, 0);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#2e3338;border:1px solid #999999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:0.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #1c1e22;min-height:16.42857143px}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:20px}.modal-footer{padding:20px;text-align:right;border-top:1px solid #1c1e22}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;visibility:visible;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:0.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#ffffff;text-align:center;text-decoration:none;background-color:rgba(0,0,0,0.9);border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:rgba(0,0,0,0.9)}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:rgba(0,0,0,0.9)}.tooltip.top-right .tooltip-arrow{bottom:0;right:5px;border-width:5px 5px 0;border-top-color:rgba(0,0,0,0.9)}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:rgba(0,0,0,0.9)}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:rgba(0,0,0,0.9)}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:rgba(0,0,0,0.9)}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:rgba(0,0,0,0.9)}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:rgba(0,0,0,0.9)}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;text-align:left;background-color:#2e3338;background-clip:padding-box;border:1px solid #999999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);white-space:normal}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:normal;line-height:18px;background-color:#2e3338;border-bottom:1px solid #22262a;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{border-width:10px;content:""}.popover.top>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#666666;border-top-color:rgba(0,0,0,0.25);bottom:-11px}.popover.top>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#2e3338}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#666666;border-right-color:rgba(0,0,0,0.25)}.popover.right>.arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#2e3338}.popover.bottom>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#666666;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.popover.bottom>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#2e3338}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#666666;border-left-color:rgba(0,0,0,0.25)}.popover.left>.arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#2e3338;bottom:-10px}.carousel{position:relative}.carousel-inner{position:relative;overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:0.5;filter:alpha(opacity=50);font-size:20px;color:#ffffff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-control.left{background-image:-webkit-linear-gradient(left, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.0001) 100%);background-image:-o-linear-gradient(left, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.0001) 100%);background-image:linear-gradient(to right, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:-webkit-linear-gradient(left, rgba(0,0,0,0.0001) 0, rgba(0,0,0,0.5) 100%);background-image:-o-linear-gradient(left, rgba(0,0,0,0.0001) 0, rgba(0,0,0,0.5) 100%);background-image:linear-gradient(to right, rgba(0,0,0,0.0001) 0, rgba(0,0,0,0.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:hover,.carousel-control:focus{outline:0;color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #ffffff;border-radius:10px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0)}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#ffffff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px;color:#ffffff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{content:" ";display:table}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right !important}.pull-left{float:left !important}.hide{display:none !important}.show{display:block !important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none !important;visibility:hidden !important}.affix{position:fixed;-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none !important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none !important}@media (max-width:767px){.visible-xs{display:block !important}table.visible-xs{display:table}tr.visible-xs{display:table-row !important}th.visible-xs,td.visible-xs{display:table-cell !important}}@media (max-width:767px){.visible-xs-block{display:block !important}}@media (max-width:767px){.visible-xs-inline{display:inline !important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block !important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block !important}table.visible-sm{display:table}tr.visible-sm{display:table-row !important}th.visible-sm,td.visible-sm{display:table-cell !important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block !important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline !important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block !important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block !important}table.visible-md{display:table}tr.visible-md{display:table-row !important}th.visible-md,td.visible-md{display:table-cell !important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block !important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline !important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block !important}}@media (min-width:1200px){.visible-lg{display:block !important}table.visible-lg{display:table}tr.visible-lg{display:table-row !important}th.visible-lg,td.visible-lg{display:table-cell !important}}@media (min-width:1200px){.visible-lg-block{display:block !important}}@media (min-width:1200px){.visible-lg-inline{display:inline !important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block !important}}@media (max-width:767px){.hidden-xs{display:none !important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none !important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none !important}}@media (min-width:1200px){.hidden-lg{display:none !important}}.visible-print{display:none !important}@media print{.visible-print{display:block !important}table.visible-print{display:table}tr.visible-print{display:table-row !important}th.visible-print,td.visible-print{display:table-cell !important}}.visible-print-block{display:none !important}@media print{.visible-print-block{display:block !important}}.visible-print-inline{display:none !important}@media print{.visible-print-inline{display:inline !important}}.visible-print-inline-block{display:none !important}@media print{.visible-print-inline-block{display:inline-block !important}}@media print{.hidden-print{display:none !important}}.navbar{background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none;border:1px solid rgba(0,0,0,0.6);text-shadow:1px 1px 1px rgba(0,0,0,0.3)}.navbar-inverse{background-image:-webkit-linear-gradient(#8a9196, #7a8288 60%, #70787d);background-image:-o-linear-gradient(#8a9196, #7a8288 60%, #70787d);background-image:linear-gradient(#8a9196, #7a8288 60%, #70787d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8a9196', endColorstr='#ff70787d', GradientType=0);filter:none}.navbar-inverse .badge{background-color:#5d6368}.navbar-nav>li>a{border-right:1px solid rgba(0,0,0,0.2);border-left:1px solid rgba(255,255,255,0.1)}.navbar-nav>li>a:hover{background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none;border-left-color:transparent}.navbar .nav .open>a{border-color:transparent}.navbar-nav>li.active>a{border-left-color:transparent}.navbar-form{margin-left:5px;margin-right:5px}.btn,.btn:hover{border-color:rgba(0,0,0,0.6);text-shadow:1px 1px 1px rgba(0,0,0,0.3)}.btn-default{background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none}.btn-default:hover{background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none}.btn-primary{background-image:-webkit-linear-gradient(#8a9196, #7a8288 60%, #70787d);background-image:-o-linear-gradient(#8a9196, #7a8288 60%, #70787d);background-image:linear-gradient(#8a9196, #7a8288 60%, #70787d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff8a9196', endColorstr='#ff70787d', GradientType=0);filter:none}.btn-primary:hover{background-image:-webkit-linear-gradient(#404448, #4e5458 40%, #585e62);background-image:-o-linear-gradient(#404448, #4e5458 40%, #585e62);background-image:linear-gradient(#404448, #4e5458 40%, #585e62);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff404448', endColorstr='#ff585e62', GradientType=0);filter:none}.btn-success{background-image:-webkit-linear-gradient(#78cc78, #62c462 60%, #53be53);background-image:-o-linear-gradient(#78cc78, #62c462 60%, #53be53);background-image:linear-gradient(#78cc78, #62c462 60%, #53be53);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff78cc78', endColorstr='#ff53be53', GradientType=0);filter:none}.btn-success:hover{background-image:-webkit-linear-gradient(#2f7d2f, #379337 40%, #3da23d);background-image:-o-linear-gradient(#2f7d2f, #379337 40%, #3da23d);background-image:linear-gradient(#2f7d2f, #379337 40%, #3da23d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff2f7d2f', endColorstr='#ff3da23d', GradientType=0);filter:none}.btn-info{background-image:-webkit-linear-gradient(#74cae3, #5bc0de 60%, #4ab9db);background-image:-o-linear-gradient(#74cae3, #5bc0de 60%, #4ab9db);background-image:linear-gradient(#74cae3, #5bc0de 60%, #4ab9db);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff74cae3', endColorstr='#ff4ab9db', GradientType=0);filter:none}.btn-info:hover{background-image:-webkit-linear-gradient(#20829f, #2596b8 40%, #28a4c9);background-image:-o-linear-gradient(#20829f, #2596b8 40%, #28a4c9);background-image:linear-gradient(#20829f, #2596b8 40%, #28a4c9);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff20829f', endColorstr='#ff28a4c9', GradientType=0);filter:none}.btn-warning{background-image:-webkit-linear-gradient(#faa123, #f89406 60%, #e48806);background-image:-o-linear-gradient(#faa123, #f89406 60%, #e48806);background-image:linear-gradient(#faa123, #f89406 60%, #e48806);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffaa123', endColorstr='#ffe48806', GradientType=0);filter:none}.btn-warning:hover{background-image:-webkit-linear-gradient(#804d03, #9e5f04 40%, #b26a04);background-image:-o-linear-gradient(#804d03, #9e5f04 40%, #b26a04);background-image:linear-gradient(#804d03, #9e5f04 40%, #b26a04);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff804d03', endColorstr='#ffb26a04', GradientType=0);filter:none}.btn-danger{background-image:-webkit-linear-gradient(#f17a77, #ee5f5b 60%, #ec4d49);background-image:-o-linear-gradient(#f17a77, #ee5f5b 60%, #ec4d49);background-image:linear-gradient(#f17a77, #ee5f5b 60%, #ec4d49);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff17a77', endColorstr='#ffec4d49', GradientType=0);filter:none}.btn-danger:hover{background-image:-webkit-linear-gradient(#bb1813, #d71c16 40%, #e7201a);background-image:-o-linear-gradient(#bb1813, #d71c16 40%, #e7201a);background-image:linear-gradient(#bb1813, #d71c16 40%, #e7201a);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffbb1813', endColorstr='#ffe7201a', GradientType=0);filter:none}.btn-link,.btn-link:hover{border-color:transparent}h1,h2,h3,h4,h5,h6{text-shadow:-1px -1px 0 rgba(0,0,0,0.3)}.text-primary,.text-primary:hover{color:#7a8288}.text-success,.text-success:hover{color:#62c462}.text-danger,.text-danger:hover{color:#ee5f5b}.text-warning,.text-warning:hover{color:#f89406}.text-info,.text-info:hover{color:#5bc0de}.table a:not(.btn){text-decoration:underline}.table .success,.table .warning,.table .danger,.table .info{color:#fff}.table-bordered tbody tr.success td,.table-bordered tbody tr.warning td,.table-bordered tbody tr.danger td,.table-bordered tbody tr.success:hover td,.table-bordered tbody tr.warning:hover td,.table-bordered tbody tr.danger:hover td{border-color:#1c1e22}.table-responsive>.table{background-color:#2e3338}input,textarea{color:#272b30}.has-warning .help-block,.has-warning .control-label,.has-warning .form-control-feedback{color:#f89406}.has-warning .form-control,.has-warning .form-control:focus{border-color:#f89406}.has-warning .input-group-addon{background-color:#272b30;border:none}.has-error .help-block,.has-error .control-label,.has-error .form-control-feedback{color:#ee5f5b}.has-error .form-control,.has-error .form-control:focus{border-color:#ee5f5b}.has-error .input-group-addon{background-color:#272b30;border:none}.has-success .help-block,.has-success .control-label,.has-success .form-control-feedback{color:#62c462}.has-success .form-control,.has-success .form-control:focus{border-color:#62c462}.has-success .input-group-addon{background-color:#272b30;border:none}legend{color:#fff}.input-group-addon{border-color:rgba(0,0,0,0.6);text-shadow:1px 1px 1px rgba(0,0,0,0.3);background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none;color:#ffffff}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{border-color:rgba(0,0,0,0.6)}.nav-pills>li>a{background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none;border:1px solid rgba(0,0,0,0.6);text-shadow:1px 1px 1px rgba(0,0,0,0.3)}.nav-pills>li>a:hover{background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none;border:1px solid rgba(0,0,0,0.6)}.nav-pills>li.active>a,.nav-pills>li.active>a:hover{background-color:none;background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none;border:1px solid rgba(0,0,0,0.6)}.nav-pills>li.disabled>a,.nav-pills>li.disabled>a:hover{background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none}.pagination>li>a{text-shadow:1px 1px 1px rgba(0,0,0,0.3);background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none}.pagination>li>a:hover{background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none}.pagination>li.active>a{background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none}.pagination>li.disabled>a,.pagination>li.disabled>a:hover{background-color:transparent;background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none}.pager>li>a{background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none;text-shadow:1px 1px 1px rgba(0,0,0,0.3)}.pager>li>a:hover{background-image:-webkit-linear-gradient(#020202, #101112 40%, #191b1d);background-image:-o-linear-gradient(#020202, #101112 40%, #191b1d);background-image:linear-gradient(#020202, #101112 40%, #191b1d);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff020202', endColorstr='#ff191b1d', GradientType=0);filter:none}.pager>li.disabled>a,.pager>li.disabled>a:hover{background-color:transparent;background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none}.breadcrumb{border:1px solid rgba(0,0,0,0.6);text-shadow:1px 1px 1px rgba(0,0,0,0.3);background-image:-webkit-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:-o-linear-gradient(#484e55, #3a3f44 60%, #313539);background-image:linear-gradient(#484e55, #3a3f44 60%, #313539);background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff484e55', endColorstr='#ff313539', GradientType=0);filter:none}.alert .alert-link,.alert a{color:#fff;text-decoration:underline}.alert .close{color:#000000;text-decoration:none}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#0c0d0e}.jumbotron{border:1px solid rgba(0,0,0,0.6)}.panel-primary .panel-heading,.panel-success .panel-heading,.panel-danger .panel-heading,.panel-warning .panel-heading,.panel-info .panel-heading{border-color:#000}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap.min.css.bak b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/css/bootstrap.min.css.bak
new file mode 100755 (executable)
index 0000000..679272d
--- /dev/null
@@ -0,0 +1,7 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+/*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}@media print{*{text-shadow:none!important;color:#000!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#999}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-muted{color:#999}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none;margin-left:-5px}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#999}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0;text-align:right}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;white-space:nowrap;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.row{margin-left:-15px;margin-right:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-left:15px;padding-right:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:0}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:0}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:0}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:0}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:0}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:0}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:0}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:0}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{position:static;float:none;display:table-column}table td[class*=col-],table th[class*=col-]{position:static;float:none;display:table-cell}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}@media (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0;min-width:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date]{line-height:34px}.form-group{margin-bottom:15px}.radio,.checkbox{display:block;min-height:20px;margin-top:10px;margin-bottom:10px;padding-left:20px}.radio label,.checkbox label{display:inline;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{float:left;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.has-feedback .form-control-feedback{position:absolute;top:25px;right:0;display:block;width:34px;height:34px;line-height:34px;text-align:center}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.has-error .form-control-feedback{color:#a94442}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;padding-left:0;vertical-align:middle}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{float:none;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:7px}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-left:-15px;margin-right:-15px}.form-horizontal .form-control-static{padding-top:7px}@media (min-width:768px){.form-horizontal .control-label{text-align:right}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}.btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{color:#428bca;font-weight:400;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;outline:0;background-color:#428bca}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#999}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{left:auto;right:0}.navbar-right .dropdown-menu-left{left:0;right:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:4px;border-top-right-radius:0;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.btn-group-justified>.btn-group .btn{width:100%}[data-toggle=buttons]>.btn>input[type=radio],[data-toggle=buttons]>.btn>input[type=checkbox]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;overflow-x:visible;padding-right:15px;padding-left:15px;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.1);-webkit-overflow-scrolling:touch}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-left:0;padding-right:0}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px;font-size:18px;line-height:20px;height:50px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;margin-right:15px;padding:9px 10px;margin-top:8px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{margin-left:-15px;margin-right:-15px;padding:10px 15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);margin-top:8px;margin-bottom:8px}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;padding-left:0;vertical-align:middle}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{float:none;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-left:15px;margin-right:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{background-color:#e7e7e7;color:#555}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#999}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .navbar-nav>li>a{color:#999}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{background-color:#080808;color:#fff}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#999}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;line-height:1.42857143;text-decoration:none;color:#428bca;background-color:#fff;border:1px solid #ddd;margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:4px;border-top-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca;cursor:default}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999;background-color:#fff;border-color:#ddd;cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pager{padding-left:0;margin:20px 0;list-style:none;text-align:center}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;background-color:#fff;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:hover,.label[href]:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#999}.label-default[href]:hover,.label-default[href]:focus{background-color:gray}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;color:#fff;line-height:1;vertical-align:baseline;white-space:nowrap;text-align:center;background-color:#999;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-left:60px;padding-right:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-left:auto;margin-right:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{overflow:hidden;height:20px;margin-bottom:20px;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:hover .list-group-item-text,a.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-right-radius:3px;border-top-left-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-right-radius:3px;border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{border:0;margin-bottom:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px;overflow:hidden}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#428bca}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#d6e9c6}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#bce8f1}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#faebcc}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ebccd1}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ebccd1}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{display:none;overflow:auto;overflow-y:scroll;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5;min-height:16.42857143px}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:20px}.modal-footer{margin-top:15px;padding:19px 20px 20px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;right:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);white-space:normal}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{border-width:10px;content:""}.popover.top>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0,0,0,.25);bottom:-11px}.popover.top>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,.25)}.popover.right>.arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff}.popover.bottom>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25);top:-11px}.popover.bottom>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#fff;bottom:-10px}.carousel{position:relative}.carousel-inner{position:relative;overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:.5;filter:alpha(opacity=50);font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-control.left{background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,.5) 0),color-stop(rgba(0,0,0,.0001) 100%));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,.0001) 0),color-stop(rgba(0,0,0,.5) 100%));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:hover,.carousel-control:focus{outline:0;color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #fff;border-radius:10px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0)}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#fff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{content:" ";display:table}.clearfix:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}@media print{.hidden-print{display:none!important}}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.eot b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.eot
new file mode 100755 (executable)
index 0000000..4a4ca86
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.eot differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.svg b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.svg
new file mode 100755 (executable)
index 0000000..e3e2dc7
--- /dev/null
@@ -0,0 +1,229 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata></metadata>
+<defs>
+<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
+<font-face units-per-em="1200" ascent="960" descent="-240" />
+<missing-glyph horiz-adv-x="500" />
+<glyph />
+<glyph />
+<glyph unicode="&#xd;" />
+<glyph unicode=" " />
+<glyph unicode="*" d="M100 500v200h259l-183 183l141 141l183 -183v259h200v-259l183 183l141 -141l-183 -183h259v-200h-259l183 -183l-141 -141l-183 183v-259h-200v259l-183 -183l-141 141l183 183h-259z" />
+<glyph unicode="+" d="M0 400v300h400v400h300v-400h400v-300h-400v-400h-300v400h-400z" />
+<glyph unicode="&#xa0;" />
+<glyph unicode="&#x2000;" horiz-adv-x="652" />
+<glyph unicode="&#x2001;" horiz-adv-x="1304" />
+<glyph unicode="&#x2002;" horiz-adv-x="652" />
+<glyph unicode="&#x2003;" horiz-adv-x="1304" />
+<glyph unicode="&#x2004;" horiz-adv-x="434" />
+<glyph unicode="&#x2005;" horiz-adv-x="326" />
+<glyph unicode="&#x2006;" horiz-adv-x="217" />
+<glyph unicode="&#x2007;" horiz-adv-x="217" />
+<glyph unicode="&#x2008;" horiz-adv-x="163" />
+<glyph unicode="&#x2009;" horiz-adv-x="260" />
+<glyph unicode="&#x200a;" horiz-adv-x="72" />
+<glyph unicode="&#x202f;" horiz-adv-x="260" />
+<glyph unicode="&#x205f;" horiz-adv-x="326" />
+<glyph unicode="&#x20ac;" d="M100 500l100 100h113q0 47 5 100h-218l100 100h135q37 167 112 257q117 141 297 141q242 0 354 -189q60 -103 66 -209h-181q0 55 -25.5 99t-63.5 68t-75 36.5t-67 12.5q-24 0 -52.5 -10t-62.5 -32t-65.5 -67t-50.5 -107h379l-100 -100h-300q-6 -46 -6 -100h406l-100 -100 h-300q9 -74 33 -132t52.5 -91t62 -54.5t59 -29t46.5 -7.5q29 0 66 13t75 37t63.5 67.5t25.5 96.5h174q-31 -172 -128 -278q-107 -117 -274 -117q-205 0 -324 158q-36 46 -69 131.5t-45 205.5h-217z" />
+<glyph unicode="&#x2212;" d="M200 400h900v300h-900v-300z" />
+<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
+<glyph unicode="&#x2601;" d="M-14 494q0 -80 56.5 -137t135.5 -57h750q120 0 205 86.5t85 207.5t-85 207t-205 86q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5z" />
+<glyph unicode="&#x2709;" d="M0 100l400 400l200 -200l200 200l400 -400h-1200zM0 300v600l300 -300zM0 1100l600 -603l600 603h-1200zM900 600l300 300v-600z" />
+<glyph unicode="&#x270f;" d="M-13 -13l333 112l-223 223zM187 403l214 -214l614 614l-214 214zM887 1103l214 -214l99 92q13 13 13 32.5t-13 33.5l-153 153q-15 13 -33 13t-33 -13z" />
+<glyph unicode="&#xe001;" d="M0 1200h1200l-500 -550v-550h300v-100h-800v100h300v550z" />
+<glyph unicode="&#xe002;" d="M14 84q18 -55 86 -75.5t147 5.5q65 21 109 69t44 90v606l600 155v-521q-64 16 -138 -7q-79 -26 -122.5 -83t-25.5 -111q18 -55 86 -75.5t147 4.5q70 23 111.5 63.5t41.5 95.5v881q0 10 -7 15.5t-17 2.5l-752 -193q-10 -3 -17 -12.5t-7 -19.5v-689q-64 17 -138 -7 q-79 -25 -122.5 -82t-25.5 -112z" />
+<glyph unicode="&#xe003;" d="M23 693q0 200 142 342t342 142t342 -142t142 -342q0 -142 -78 -261l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233z" />
+<glyph unicode="&#xe005;" d="M100 784q0 64 28 123t73 100.5t104.5 64t119 20.5t120 -38.5t104.5 -104.5q48 69 109.5 105t121.5 38t118.5 -20.5t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-149.5 152.5t-126.5 127.5 t-94 124.5t-33.5 117.5z" />
+<glyph unicode="&#xe006;" d="M-72 800h479l146 400h2l146 -400h472l-382 -278l145 -449l-384 275l-382 -275l146 447zM168 71l2 1z" />
+<glyph unicode="&#xe007;" d="M-72 800h479l146 400h2l146 -400h472l-382 -278l145 -449l-384 275l-382 -275l146 447zM168 71l2 1zM237 700l196 -142l-73 -226l192 140l195 -141l-74 229l193 140h-235l-77 211l-78 -211h-239z" />
+<glyph unicode="&#xe008;" d="M0 0v143l400 257v100q-37 0 -68.5 74.5t-31.5 125.5v200q0 124 88 212t212 88t212 -88t88 -212v-200q0 -51 -31.5 -125.5t-68.5 -74.5v-100l400 -257v-143h-1200z" />
+<glyph unicode="&#xe009;" d="M0 0v1100h1200v-1100h-1200zM100 100h100v100h-100v-100zM100 300h100v100h-100v-100zM100 500h100v100h-100v-100zM100 700h100v100h-100v-100zM100 900h100v100h-100v-100zM300 100h600v400h-600v-400zM300 600h600v400h-600v-400zM1000 100h100v100h-100v-100z M1000 300h100v100h-100v-100zM1000 500h100v100h-100v-100zM1000 700h100v100h-100v-100zM1000 900h100v100h-100v-100z" />
+<glyph unicode="&#xe010;" d="M0 50v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5zM0 650v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400 q-21 0 -35.5 14.5t-14.5 35.5zM600 50v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5zM600 650v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5v-400 q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5z" />
+<glyph unicode="&#xe011;" d="M0 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM0 450v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5zM0 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5 t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 450v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5 v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 450v200q0 21 14.5 35.5t35.5 14.5h200 q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM800 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5z" />
+<glyph unicode="&#xe012;" d="M0 50v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM0 450q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v200q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5 t-14.5 -35.5v-200zM0 850v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5zM400 50v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5 t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5zM400 450v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5zM400 850v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5 v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5z" />
+<glyph unicode="&#xe013;" d="M29 454l419 -420l818 820l-212 212l-607 -607l-206 207z" />
+<glyph unicode="&#xe014;" d="M106 318l282 282l-282 282l212 212l282 -282l282 282l212 -212l-282 -282l282 -282l-212 -212l-282 282l-282 -282z" />
+<glyph unicode="&#xe015;" d="M23 693q0 200 142 342t342 142t342 -142t142 -342q0 -142 -78 -261l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233zM300 600v200h100v100h200v-100h100v-200h-100v-100h-200v100h-100z" />
+<glyph unicode="&#xe016;" d="M23 694q0 200 142 342t342 142t342 -142t142 -342q0 -141 -78 -262l300 -299q7 -7 7 -18t-7 -18l-109 -109q-8 -8 -18 -8t-18 8l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342zM176 694q0 -136 97 -233t234 -97t233.5 97t96.5 233t-96.5 233t-233.5 97t-234 -97 t-97 -233zM300 601h400v200h-400v-200z" />
+<glyph unicode="&#xe017;" d="M23 600q0 183 105 331t272 210v-166q-103 -55 -165 -155t-62 -220q0 -177 125 -302t302 -125t302 125t125 302q0 120 -62 220t-165 155v166q167 -62 272 -210t105 -331q0 -118 -45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5 zM500 750q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5v400q0 21 -14.5 35.5t-35.5 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-400z" />
+<glyph unicode="&#xe018;" d="M100 1h200v300h-200v-300zM400 1v500h200v-500h-200zM700 1v800h200v-800h-200zM1000 1v1200h200v-1200h-200z" />
+<glyph unicode="&#xe019;" d="M26 601q0 -33 6 -74l151 -38l2 -6q14 -49 38 -93l3 -5l-80 -134q45 -59 105 -105l133 81l5 -3q45 -26 94 -39l5 -2l38 -151q40 -5 74 -5q27 0 74 5l38 151l6 2q46 13 93 39l5 3l134 -81q56 44 104 105l-80 134l3 5q24 44 39 93l1 6l152 38q5 40 5 74q0 28 -5 73l-152 38 l-1 6q-16 51 -39 93l-3 5l80 134q-44 58 -104 105l-134 -81l-5 3q-45 25 -93 39l-6 1l-38 152q-40 5 -74 5q-27 0 -74 -5l-38 -152l-5 -1q-50 -14 -94 -39l-5 -3l-133 81q-59 -47 -105 -105l80 -134l-3 -5q-25 -47 -38 -93l-2 -6l-151 -38q-6 -48 -6 -73zM385 601 q0 88 63 151t152 63t152 -63t63 -151q0 -89 -63 -152t-152 -63t-152 63t-63 152z" />
+<glyph unicode="&#xe020;" d="M100 1025v50q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5v-100h275q10 0 17.5 -7.5t7.5 -17.5v-50q0 -11 -7 -18t-18 -7h-1050q-11 0 -18 7t-7 18zM200 100v800h900v-800q0 -41 -29.5 -71t-70.5 -30h-700q-41 0 -70.5 30 t-29.5 71zM300 100h100v700h-100v-700zM500 100h100v700h-100v-700zM500 1100h300v100h-300v-100zM700 100h100v700h-100v-700zM900 100h100v700h-100v-700z" />
+<glyph unicode="&#xe021;" d="M1 601l656 644l644 -644h-200v-600h-300v400h-300v-400h-300v600h-200z" />
+<glyph unicode="&#xe022;" d="M100 25v1150q0 11 7 18t18 7h475v-500h400v-675q0 -11 -7 -18t-18 -7h-850q-11 0 -18 7t-7 18zM700 800v300l300 -300h-300z" />
+<glyph unicode="&#xe023;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM500 500v400h100 v-300h200v-100h-300z" />
+<glyph unicode="&#xe024;" d="M-100 0l431 1200h209l-21 -300h162l-20 300h208l431 -1200h-538l-41 400h-242l-40 -400h-539zM488 500h224l-27 300h-170z" />
+<glyph unicode="&#xe025;" d="M0 0v400h490l-290 300h200v500h300v-500h200l-290 -300h490v-400h-1100zM813 200h175v100h-175v-100z" />
+<glyph unicode="&#xe026;" d="M1 600q0 122 47.5 233t127.5 191t191 127.5t233 47.5t233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233zM188 600q0 -170 121 -291t291 -121t291 121t121 291t-121 291t-291 121 t-291 -121t-121 -291zM350 600h150v300h200v-300h150l-250 -300z" />
+<glyph unicode="&#xe027;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM350 600l250 300 l250 -300h-150v-300h-200v300h-150z" />
+<glyph unicode="&#xe028;" d="M0 25v475l200 700h800l199 -700l1 -475q0 -11 -7 -18t-18 -7h-1150q-11 0 -18 7t-7 18zM200 500h200l50 -200h300l50 200h200l-97 500h-606z" />
+<glyph unicode="&#xe029;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM500 397v401 l297 -200z" />
+<glyph unicode="&#xe030;" d="M23 600q0 -118 45.5 -224.5t123 -184t184 -123t224.5 -45.5t224.5 45.5t184 123t123 184t45.5 224.5h-150q0 -177 -125 -302t-302 -125t-302 125t-125 302t125 302t302 125q136 0 246 -81l-146 -146h400v400l-145 -145q-157 122 -355 122q-118 0 -224.5 -45.5t-184 -123 t-123 -184t-45.5 -224.5z" />
+<glyph unicode="&#xe031;" d="M23 600q0 118 45.5 224.5t123 184t184 123t224.5 45.5q198 0 355 -122l145 145v-400h-400l147 147q-112 80 -247 80q-177 0 -302 -125t-125 -302h-150zM100 0v400h400l-147 -147q112 -80 247 -80q177 0 302 125t125 302h150q0 -118 -45.5 -224.5t-123 -184t-184 -123 t-224.5 -45.5q-198 0 -355 122z" />
+<glyph unicode="&#xe032;" d="M100 0h1100v1200h-1100v-1200zM200 100v900h900v-900h-900zM300 200v100h100v-100h-100zM300 400v100h100v-100h-100zM300 600v100h100v-100h-100zM300 800v100h100v-100h-100zM500 200h500v100h-500v-100zM500 400v100h500v-100h-500zM500 600v100h500v-100h-500z M500 800v100h500v-100h-500z" />
+<glyph unicode="&#xe033;" d="M0 100v600q0 41 29.5 70.5t70.5 29.5h100v200q0 82 59 141t141 59h300q82 0 141 -59t59 -141v-200h100q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-900q-41 0 -70.5 29.5t-29.5 70.5zM400 800h300v150q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-150z" />
+<glyph unicode="&#xe034;" d="M100 0v1100h100v-1100h-100zM300 400q60 60 127.5 84t127.5 17.5t122 -23t119 -30t110 -11t103 42t91 120.5v500q-40 -81 -101.5 -115.5t-127.5 -29.5t-138 25t-139.5 40t-125.5 25t-103 -29.5t-65 -115.5v-500z" />
+<glyph unicode="&#xe035;" d="M0 275q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 127 70.5 231.5t184.5 161.5t245 57t245 -57t184.5 -161.5t70.5 -231.5v-300q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 116 -49.5 227t-131 192.5t-192.5 131t-227 49.5t-227 -49.5t-192.5 -131t-131 -192.5 t-49.5 -227v-300zM200 20v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14zM800 20v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14z" />
+<glyph unicode="&#xe036;" d="M0 400h300l300 -200v800l-300 -200h-300v-400zM688 459l141 141l-141 141l71 71l141 -141l141 141l71 -71l-141 -141l141 -141l-71 -71l-141 141l-141 -141z" />
+<glyph unicode="&#xe037;" d="M0 400h300l300 -200v800l-300 -200h-300v-400zM700 857l69 53q111 -135 111 -310q0 -169 -106 -302l-67 54q86 110 86 248q0 146 -93 257z" />
+<glyph unicode="&#xe038;" d="M0 401v400h300l300 200v-800l-300 200h-300zM702 858l69 53q111 -135 111 -310q0 -170 -106 -303l-67 55q86 110 86 248q0 145 -93 257zM889 951l7 -8q123 -151 123 -344q0 -189 -119 -339l-7 -8l81 -66l6 8q142 178 142 405q0 230 -144 408l-6 8z" />
+<glyph unicode="&#xe039;" d="M0 0h500v500h-200v100h-100v-100h-200v-500zM0 600h100v100h400v100h100v100h-100v300h-500v-600zM100 100v300h300v-300h-300zM100 800v300h300v-300h-300zM200 200v100h100v-100h-100zM200 900h100v100h-100v-100zM500 500v100h300v-300h200v-100h-100v-100h-200v100 h-100v100h100v200h-200zM600 0v100h100v-100h-100zM600 1000h100v-300h200v-300h300v200h-200v100h200v500h-600v-200zM800 800v300h300v-300h-300zM900 0v100h300v-100h-300zM900 900v100h100v-100h-100zM1100 200v100h100v-100h-100z" />
+<glyph unicode="&#xe040;" d="M0 200h100v1000h-100v-1000zM100 0v100h300v-100h-300zM200 200v1000h100v-1000h-100zM500 0v91h100v-91h-100zM500 200v1000h200v-1000h-200zM700 0v91h100v-91h-100zM800 200v1000h100v-1000h-100zM900 0v91h200v-91h-200zM1000 200v1000h200v-1000h-200z" />
+<glyph unicode="&#xe041;" d="M0 700l1 475q0 10 7.5 17.5t17.5 7.5h474l700 -700l-500 -500zM148 953q0 -42 29 -71q30 -30 71.5 -30t71.5 30q29 29 29 71t-29 71q-30 30 -71.5 30t-71.5 -30q-29 -29 -29 -71z" />
+<glyph unicode="&#xe042;" d="M1 700l1 475q0 11 7 18t18 7h474l700 -700l-500 -500zM148 953q0 -42 30 -71q29 -30 71 -30t71 30q30 29 30 71t-30 71q-29 30 -71 30t-71 -30q-30 -29 -30 -71zM701 1200h100l700 -700l-500 -500l-50 50l450 450z" />
+<glyph unicode="&#xe043;" d="M100 0v1025l175 175h925v-1000l-100 -100v1000h-750l-100 -100h750v-1000h-900z" />
+<glyph unicode="&#xe044;" d="M200 0l450 444l450 -443v1150q0 20 -14.5 35t-35.5 15h-800q-21 0 -35.5 -15t-14.5 -35v-1151z" />
+<glyph unicode="&#xe045;" d="M0 100v700h200l100 -200h600l100 200h200v-700h-200v200h-800v-200h-200zM253 829l40 -124h592l62 124l-94 346q-2 11 -10 18t-18 7h-450q-10 0 -18 -7t-10 -18zM281 24l38 152q2 10 11.5 17t19.5 7h500q10 0 19.5 -7t11.5 -17l38 -152q2 -10 -3.5 -17t-15.5 -7h-600 q-10 0 -15.5 7t-3.5 17z" />
+<glyph unicode="&#xe046;" d="M0 200q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5v600q0 41 -29.5 70.5t-70.5 29.5h-150q-4 8 -11.5 21.5t-33 48t-53 61t-69 48t-83.5 21.5h-200q-41 0 -82 -20.5t-70 -50t-52 -59t-34 -50.5l-12 -20h-150q-41 0 -70.5 -29.5t-29.5 -70.5v-600z M356 500q0 100 72 172t172 72t172 -72t72 -172t-72 -172t-172 -72t-172 72t-72 172zM494 500q0 -44 31 -75t75 -31t75 31t31 75t-31 75t-75 31t-75 -31t-31 -75zM900 700v100h100v-100h-100z" />
+<glyph unicode="&#xe047;" d="M53 0h365v66q-41 0 -72 11t-49 38t1 71l92 234h391l82 -222q16 -45 -5.5 -88.5t-74.5 -43.5v-66h417v66q-34 1 -74 43q-18 19 -33 42t-21 37l-6 13l-385 998h-93l-399 -1006q-24 -48 -52 -75q-12 -12 -33 -25t-36 -20l-15 -7v-66zM416 521l178 457l46 -140l116 -317h-340 z" />
+<glyph unicode="&#xe048;" d="M100 0v89q41 7 70.5 32.5t29.5 65.5v827q0 28 -1 39.5t-5.5 26t-15.5 21t-29 14t-49 14.5v71l471 -1q120 0 213 -88t93 -228q0 -55 -11.5 -101.5t-28 -74t-33.5 -47.5t-28 -28l-12 -7q8 -3 21.5 -9t48 -31.5t60.5 -58t47.5 -91.5t21.5 -129q0 -84 -59 -156.5t-142 -111 t-162 -38.5h-500zM400 200h161q89 0 153 48.5t64 132.5q0 90 -62.5 154.5t-156.5 64.5h-159v-400zM400 700h139q76 0 130 61.5t54 138.5q0 82 -84 130.5t-239 48.5v-379z" />
+<glyph unicode="&#xe049;" d="M200 0v57q77 7 134.5 40.5t65.5 80.5l173 849q10 56 -10 74t-91 37q-6 1 -10.5 2.5t-9.5 2.5v57h425l2 -57q-33 -8 -62 -25.5t-46 -37t-29.5 -38t-17.5 -30.5l-5 -12l-128 -825q-10 -52 14 -82t95 -36v-57h-500z" />
+<glyph unicode="&#xe050;" d="M-75 200h75v800h-75l125 167l125 -167h-75v-800h75l-125 -167zM300 900v300h150h700h150v-300h-50q0 29 -8 48.5t-18.5 30t-33.5 15t-39.5 5.5t-50.5 1h-200v-850l100 -50v-100h-400v100l100 50v850h-200q-34 0 -50.5 -1t-40 -5.5t-33.5 -15t-18.5 -30t-8.5 -48.5h-49z " />
+<glyph unicode="&#xe051;" d="M33 51l167 125v-75h800v75l167 -125l-167 -125v75h-800v-75zM100 901v300h150h700h150v-300h-50q0 29 -8 48.5t-18 30t-33.5 15t-40 5.5t-50.5 1h-200v-650l100 -50v-100h-400v100l100 50v650h-200q-34 0 -50.5 -1t-39.5 -5.5t-33.5 -15t-18.5 -30t-8 -48.5h-50z" />
+<glyph unicode="&#xe052;" d="M0 50q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 350q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5 v-100zM0 650q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1000q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 950q0 -20 14.5 -35t35.5 -15h600q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-600q-21 0 -35.5 -14.5 t-14.5 -35.5v-100z" />
+<glyph unicode="&#xe053;" d="M0 50q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM0 650q0 -20 14.5 -35t35.5 -15h1100q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5 v-100zM200 350q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM200 950q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5 t-14.5 -35.5v-100z" />
+<glyph unicode="&#xe054;" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1000q-21 0 -35.5 15 t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-600 q-21 0 -35.5 15t-14.5 35z" />
+<glyph unicode="&#xe055;" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 950v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100 q-21 0 -35.5 15t-14.5 35z" />
+<glyph unicode="&#xe056;" d="M0 50v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM0 950v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15 t-14.5 35zM300 50v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800 q-21 0 -35.5 15t-14.5 35zM300 650v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM300 950v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15 h-800q-21 0 -35.5 15t-14.5 35z" />
+<glyph unicode="&#xe057;" d="M-101 500v100h201v75l166 -125l-166 -125v75h-201zM300 0h100v1100h-100v-1100zM500 50q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 350q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35 v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 650q0 -20 14.5 -35t35.5 -15h500q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM500 950q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35v100 q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100z" />
+<glyph unicode="&#xe058;" d="M1 50q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 350q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 650 q0 -20 14.5 -35t35.5 -15h500q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM1 950q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35v100q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100zM801 0v1100h100v-1100 h-100zM934 550l167 -125v75h200v100h-200v75z" />
+<glyph unicode="&#xe059;" d="M0 275v650q0 31 22 53t53 22h750q31 0 53 -22t22 -53v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53zM900 600l300 300v-600z" />
+<glyph unicode="&#xe060;" d="M0 44v1012q0 18 13 31t31 13h1112q19 0 31.5 -13t12.5 -31v-1012q0 -18 -12.5 -31t-31.5 -13h-1112q-18 0 -31 13t-13 31zM100 263l247 182l298 -131l-74 156l293 318l236 -288v500h-1000v-737zM208 750q0 56 39 95t95 39t95 -39t39 -95t-39 -95t-95 -39t-95 39t-39 95z " />
+<glyph unicode="&#xe062;" d="M148 745q0 124 60.5 231.5t165 172t226.5 64.5q123 0 227 -63t164.5 -169.5t60.5 -229.5t-73 -272q-73 -114 -166.5 -237t-150.5 -189l-57 -66q-10 9 -27 26t-66.5 70.5t-96 109t-104 135.5t-100.5 155q-63 139 -63 262zM342 772q0 -107 75.5 -182.5t181.5 -75.5 q107 0 182.5 75.5t75.5 182.5t-75.5 182t-182.5 75t-182 -75.5t-75 -181.5z" />
+<glyph unicode="&#xe063;" d="M1 600q0 122 47.5 233t127.5 191t191 127.5t233 47.5t233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233zM173 600q0 -177 125.5 -302t301.5 -125v854q-176 0 -301.5 -125 t-125.5 -302z" />
+<glyph unicode="&#xe064;" d="M117 406q0 94 34 186t88.5 172.5t112 159t115 177t87.5 194.5q21 -71 57.5 -142.5t76 -130.5t83 -118.5t82 -117t70 -116t50 -125.5t18.5 -136q0 -89 -39 -165.5t-102 -126.5t-140 -79.5t-156 -33.5q-114 6 -211.5 53t-161.5 139t-64 210zM243 414q14 -82 59.5 -136 t136.5 -80l16 98q-7 6 -18 17t-34 48t-33 77q-15 73 -14 143.5t10 122.5l9 51q-92 -110 -119.5 -185t-12.5 -156z" />
+<glyph unicode="&#xe065;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5q366 -6 397 -14l-186 -186h-311q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v125l200 200v-225q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5 t-117.5 282.5zM436 341l161 50l412 412l-114 113l-405 -405zM995 1015l113 -113l113 113l-21 85l-92 28z" />
+<glyph unicode="&#xe066;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h261l2 -80q-133 -32 -218 -120h-145q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5l200 153v-53q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5 zM423 524q30 38 81.5 64t103 35.5t99 14t77.5 3.5l29 -1v-209l360 324l-359 318v-216q-7 0 -19 -1t-48 -8t-69.5 -18.5t-76.5 -37t-76.5 -59t-62 -88t-39.5 -121.5z" />
+<glyph unicode="&#xe067;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q61 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69l200 200v-169q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5 t-117.5 282.5zM342 632l283 -284l567 567l-137 137l-430 -431l-146 147z" />
+<glyph unicode="&#xe068;" d="M0 603l300 296v-198h200v200h-200l300 300l295 -300h-195v-200h200v198l300 -296l-300 -300v198h-200v-200h195l-295 -300l-300 300h200v200h-200v-198z" />
+<glyph unicode="&#xe069;" d="M200 50v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-1100l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5z" />
+<glyph unicode="&#xe070;" d="M0 50v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-487l500 487v-1100l-500 488v-488l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5z" />
+<glyph unicode="&#xe071;" d="M136 550l564 550v-487l500 487v-1100l-500 488v-488z" />
+<glyph unicode="&#xe072;" d="M200 0l900 550l-900 550v-1100z" />
+<glyph unicode="&#xe073;" d="M200 150q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v800q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5t-14.5 -35.5v-800zM600 150q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v800q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-800z" />
+<glyph unicode="&#xe074;" d="M200 150q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35v800q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5v-800z" />
+<glyph unicode="&#xe075;" d="M0 0v1100l500 -487v487l564 -550l-564 -550v488z" />
+<glyph unicode="&#xe076;" d="M0 0v1100l500 -487v487l500 -487v437q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-500 -488v488z" />
+<glyph unicode="&#xe077;" d="M300 0v1100l500 -487v437q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438z" />
+<glyph unicode="&#xe078;" d="M100 250v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5zM100 500h1100l-550 564z" />
+<glyph unicode="&#xe079;" d="M185 599l592 -592l240 240l-353 353l353 353l-240 240z" />
+<glyph unicode="&#xe080;" d="M272 194l353 353l-353 353l241 240l572 -571l21 -22l-1 -1v-1l-592 -591z" />
+<glyph unicode="&#xe081;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM300 500h200v-200h200v200h200v200h-200v200h-200v-200h-200v-200z" />
+<glyph unicode="&#xe082;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM300 500h600v200h-600v-200z" />
+<glyph unicode="&#xe083;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM246 459l213 -213l141 142l141 -142l213 213l-142 141l142 141l-213 212l-141 -141l-141 142l-212 -213l141 -141 z" />
+<glyph unicode="&#xe084;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM270 551l276 -277l411 411l-175 174l-236 -236l-102 102z" />
+<glyph unicode="&#xe085;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM364 700h143q4 0 11.5 -1t11 -1t6.5 3t3 9t1 11t3.5 8.5t3.5 6t5.5 4t6.5 2.5t9 1.5t9 0.5h11.5h12.5 q19 0 30 -10t11 -26q0 -22 -4 -28t-27 -22q-5 -1 -12.5 -3t-27 -13.5t-34 -27t-26.5 -46t-11 -68.5h200q5 3 14 8t31.5 25.5t39.5 45.5t31 69t14 94q0 51 -17.5 89t-42 58t-58.5 32t-58.5 15t-51.5 3q-50 0 -90.5 -12t-75 -38.5t-53.5 -74.5t-19 -114zM500 300h200v100h-200 v-100z" />
+<glyph unicode="&#xe086;" d="M3 600q0 162 80 299.5t217.5 217.5t299.5 80t299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5zM400 300h400v100h-100v300h-300v-100h100v-200h-100v-100zM500 800h200v100h-200v-100z" />
+<glyph unicode="&#xe087;" d="M0 500v200h195q31 125 98.5 199.5t206.5 100.5v200h200v-200q54 -20 113 -60t112.5 -105.5t71.5 -134.5h203v-200h-203q-25 -102 -116.5 -186t-180.5 -117v-197h-200v197q-140 27 -208 102.5t-98 200.5h-194zM290 500q24 -73 79.5 -127.5t130.5 -78.5v206h200v-206 q149 48 201 206h-201v200h200q-25 74 -75.5 127t-124.5 77v-204h-200v203q-75 -23 -130 -77t-79 -126h209v-200h-210z" />
+<glyph unicode="&#xe088;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM356 465l135 135 l-135 135l109 109l135 -135l135 135l109 -109l-135 -135l135 -135l-109 -109l-135 135l-135 -135z" />
+<glyph unicode="&#xe089;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM322 537l141 141 l87 -87l204 205l142 -142l-346 -345z" />
+<glyph unicode="&#xe090;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -115 62 -215l568 567q-100 62 -216 62q-171 0 -292.5 -121.5t-121.5 -292.5zM391 245q97 -59 209 -59q171 0 292.5 121.5t121.5 292.5 q0 112 -59 209z" />
+<glyph unicode="&#xe091;" d="M0 547l600 453v-300h600v-300h-600v-301z" />
+<glyph unicode="&#xe092;" d="M0 400v300h600v300l600 -453l-600 -448v301h-600z" />
+<glyph unicode="&#xe093;" d="M204 600l450 600l444 -600h-298v-600h-300v600h-296z" />
+<glyph unicode="&#xe094;" d="M104 600h296v600h300v-600h298l-449 -600z" />
+<glyph unicode="&#xe095;" d="M0 200q6 132 41 238.5t103.5 193t184 138t271.5 59.5v271l600 -453l-600 -448v301q-95 -2 -183 -20t-170 -52t-147 -92.5t-100 -135.5z" />
+<glyph unicode="&#xe096;" d="M0 0v400l129 -129l294 294l142 -142l-294 -294l129 -129h-400zM635 777l142 -142l294 294l129 -129v400h-400l129 -129z" />
+<glyph unicode="&#xe097;" d="M34 176l295 295l-129 129h400v-400l-129 130l-295 -295zM600 600v400l129 -129l295 295l142 -141l-295 -295l129 -130h-400z" />
+<glyph unicode="&#xe101;" d="M23 600q0 118 45.5 224.5t123 184t184 123t224.5 45.5t224.5 -45.5t184 -123t123 -184t45.5 -224.5t-45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5zM456 851l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5 t21.5 34.5l58 302q4 20 -8 34.5t-32 14.5h-207q-21 0 -33 -14.5t-8 -34.5zM500 300h200v100h-200v-100z" />
+<glyph unicode="&#xe102;" d="M0 800h100v-200h400v300h200v-300h400v200h100v100h-111q1 1 1 6.5t-1.5 15t-3.5 17.5l-34 172q-11 39 -41.5 63t-69.5 24q-32 0 -61 -17l-239 -144q-22 -13 -40 -35q-19 24 -40 36l-238 144q-33 18 -62 18q-39 0 -69.5 -23t-40.5 -61l-35 -177q-2 -8 -3 -18t-1 -15v-6 h-111v-100zM100 0h400v400h-400v-400zM200 900q-3 0 14 48t36 96l18 47l213 -191h-281zM700 0v400h400v-400h-400zM731 900l202 197q5 -12 12 -32.5t23 -64t25 -72t7 -28.5h-269z" />
+<glyph unicode="&#xe103;" d="M0 -22v143l216 193q-9 53 -13 83t-5.5 94t9 113t38.5 114t74 124q47 60 99.5 102.5t103 68t127.5 48t145.5 37.5t184.5 43.5t220 58.5q0 -189 -22 -343t-59 -258t-89 -181.5t-108.5 -120t-122 -68t-125.5 -30t-121.5 -1.5t-107.5 12.5t-87.5 17t-56.5 7.5l-99 -55z M238.5 300.5q19.5 -6.5 86.5 76.5q55 66 367 234q70 38 118.5 69.5t102 79t99 111.5t86.5 148q22 50 24 60t-6 19q-7 5 -17 5t-26.5 -14.5t-33.5 -39.5q-35 -51 -113.5 -108.5t-139.5 -89.5l-61 -32q-369 -197 -458 -401q-48 -111 -28.5 -117.5z" />
+<glyph unicode="&#xe104;" d="M111 408q0 -33 5 -63q9 -56 44 -119.5t105 -108.5q31 -21 64 -16t62 23.5t57 49.5t48 61.5t35 60.5q32 66 39 184.5t-13 157.5q79 -80 122 -164t26 -184q-5 -33 -20.5 -69.5t-37.5 -80.5q-10 -19 -14.5 -29t-12 -26t-9 -23.5t-3 -19t2.5 -15.5t11 -9.5t19.5 -5t30.5 2.5 t42 8q57 20 91 34t87.5 44.5t87 64t65.5 88.5t47 122q38 172 -44.5 341.5t-246.5 278.5q22 -44 43 -129q39 -159 -32 -154q-15 2 -33 9q-79 33 -120.5 100t-44 175.5t48.5 257.5q-13 -8 -34 -23.5t-72.5 -66.5t-88.5 -105.5t-60 -138t-8 -166.5q2 -12 8 -41.5t8 -43t6 -39.5 t3.5 -39.5t-1 -33.5t-6 -31.5t-13.5 -24t-21 -20.5t-31 -12q-38 -10 -67 13t-40.5 61.5t-15 81.5t10.5 75q-52 -46 -83.5 -101t-39 -107t-7.5 -85z" />
+<glyph unicode="&#xe105;" d="M-61 600l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5t145.5 -23.5t132.5 -59t116.5 -83.5t97 -90t74.5 -85.5t49 -63.5t20 -30l26 -40l-26 -40q-6 -10 -20 -30t-49 -63.5t-74.5 -85.5t-97 -90t-116.5 -83.5t-132.5 -59t-145.5 -23.5 t-145.5 23.5t-132.5 59t-116.5 83.5t-97 90t-74.5 85.5t-49 63.5t-20 30zM120 600q7 -10 40.5 -58t56 -78.5t68 -77.5t87.5 -75t103 -49.5t125 -21.5t123.5 20t100.5 45.5t85.5 71.5t66.5 75.5t58 81.5t47 66q-1 1 -28.5 37.5t-42 55t-43.5 53t-57.5 63.5t-58.5 54 q49 -74 49 -163q0 -124 -88 -212t-212 -88t-212 88t-88 212q0 85 46 158q-102 -87 -226 -258zM377 656q49 -124 154 -191l105 105q-37 24 -75 72t-57 84l-20 36z" />
+<glyph unicode="&#xe106;" d="M-61 600l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5q61 0 121 -17l37 142h148l-314 -1200h-148l37 143q-82 21 -165 71.5t-140 102t-109.5 112t-72 88.5t-29.5 43zM120 600q210 -282 393 -336l37 141q-107 18 -178.5 101.5t-71.5 193.5 q0 85 46 158q-102 -87 -226 -258zM377 656q49 -124 154 -191l47 47l23 87q-30 28 -59 69t-44 68l-14 26zM780 161l38 145q22 15 44.5 34t46 44t40.5 44t41 50.5t33.5 43.5t33 44t24.5 34q-97 127 -140 175l39 146q67 -54 131.5 -125.5t87.5 -103.5t36 -52l26 -40l-26 -40 q-7 -12 -25.5 -38t-63.5 -79.5t-95.5 -102.5t-124 -100t-146.5 -79z" />
+<glyph unicode="&#xe107;" d="M-97.5 34q13.5 -34 50.5 -34h1294q37 0 50.5 35.5t-7.5 67.5l-642 1056q-20 34 -48 36.5t-48 -29.5l-642 -1066q-21 -32 -7.5 -66zM155 200l445 723l445 -723h-345v100h-200v-100h-345zM500 600l100 -300l100 300v100h-200v-100z" />
+<glyph unicode="&#xe108;" d="M100 262v41q0 20 11 44.5t26 38.5l363 325v339q0 62 44 106t106 44t106 -44t44 -106v-339l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -91 100 -113v-64q0 -20 -13 -28.5t-32 0.5l-94 78h-222l-94 -78q-19 -9 -32 -0.5t-13 28.5 v64q0 22 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5z" />
+<glyph unicode="&#xe109;" d="M0 50q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v750h-1100v-750zM0 900h1100v150q0 21 -14.5 35.5t-35.5 14.5h-150v100h-100v-100h-500v100h-100v-100h-150q-21 0 -35.5 -14.5t-14.5 -35.5v-150zM100 100v100h100v-100h-100zM100 300v100h100v-100h-100z M100 500v100h100v-100h-100zM300 100v100h100v-100h-100zM300 300v100h100v-100h-100zM300 500v100h100v-100h-100zM500 100v100h100v-100h-100zM500 300v100h100v-100h-100zM500 500v100h100v-100h-100zM700 100v100h100v-100h-100zM700 300v100h100v-100h-100zM700 500 v100h100v-100h-100zM900 100v100h100v-100h-100zM900 300v100h100v-100h-100zM900 500v100h100v-100h-100z" />
+<glyph unicode="&#xe110;" d="M0 200v200h259l600 600h241v198l300 -295l-300 -300v197h-159l-600 -600h-341zM0 800h259l122 -122l141 142l-181 180h-341v-200zM678 381l141 142l122 -123h159v198l300 -295l-300 -300v197h-241z" />
+<glyph unicode="&#xe111;" d="M0 400v600q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5z" />
+<glyph unicode="&#xe112;" d="M100 600v200h300v-250q0 -113 6 -145q17 -92 102 -117q39 -11 92 -11q37 0 66.5 5.5t50 15.5t36 24t24 31.5t14 37.5t7 42t2.5 45t0 47v25v250h300v-200q0 -42 -3 -83t-15 -104t-31.5 -116t-58 -109.5t-89 -96.5t-129 -65.5t-174.5 -25.5t-174.5 25.5t-129 65.5t-89 96.5 t-58 109.5t-31.5 116t-15 104t-3 83zM100 900v300h300v-300h-300zM800 900v300h300v-300h-300z" />
+<glyph unicode="&#xe113;" d="M-30 411l227 -227l352 353l353 -353l226 227l-578 579z" />
+<glyph unicode="&#xe114;" d="M70 797l580 -579l578 579l-226 227l-353 -353l-352 353z" />
+<glyph unicode="&#xe115;" d="M-198 700l299 283l300 -283h-203v-400h385l215 -200h-800v600h-196zM402 1000l215 -200h381v-400h-198l299 -283l299 283h-200v600h-796z" />
+<glyph unicode="&#xe116;" d="M18 939q-5 24 10 42q14 19 39 19h896l38 162q5 17 18.5 27.5t30.5 10.5h94q20 0 35 -14.5t15 -35.5t-15 -35.5t-35 -14.5h-54l-201 -961q-2 -4 -6 -10.5t-19 -17.5t-33 -11h-31v-50q0 -20 -14.5 -35t-35.5 -15t-35.5 15t-14.5 35v50h-300v-50q0 -20 -14.5 -35t-35.5 -15 t-35.5 15t-14.5 35v50h-50q-21 0 -35.5 15t-14.5 35q0 21 14.5 35.5t35.5 14.5h535l48 200h-633q-32 0 -54.5 21t-27.5 43z" />
+<glyph unicode="&#xe117;" d="M0 0v800h1200v-800h-1200zM0 900v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-100h-1200z" />
+<glyph unicode="&#xe118;" d="M1 0l300 700h1200l-300 -700h-1200zM1 400v600h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-200h-1000z" />
+<glyph unicode="&#xe119;" d="M302 300h198v600h-198l298 300l298 -300h-198v-600h198l-298 -300z" />
+<glyph unicode="&#xe120;" d="M0 600l300 298v-198h600v198l300 -298l-300 -297v197h-600v-197z" />
+<glyph unicode="&#xe121;" d="M0 100v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM31 400l172 739q5 22 23 41.5t38 19.5h672q19 0 37.5 -22.5t23.5 -45.5l172 -732h-1138zM800 100h100v100h-100v-100z M1000 100h100v100h-100v-100z" />
+<glyph unicode="&#xe122;" d="M-101 600v50q0 24 25 49t50 38l25 13v-250l-11 5.5t-24 14t-30 21.5t-24 27.5t-11 31.5zM100 500v250v8v8v7t0.5 7t1.5 5.5t2 5t3 4t4.5 3.5t6 1.5t7.5 0.5h200l675 250v-850l-675 200h-38l47 -276q2 -12 -3 -17.5t-11 -6t-21 -0.5h-8h-83q-20 0 -34.5 14t-18.5 35 q-55 337 -55 351zM1100 200v850q0 21 14.5 35.5t35.5 14.5q20 0 35 -14.5t15 -35.5v-850q0 -20 -15 -35t-35 -15q-21 0 -35.5 15t-14.5 35z" />
+<glyph unicode="&#xe123;" d="M74 350q0 21 13.5 35.5t33.5 14.5h18l117 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3 32t29 13h94q20 0 29 -10.5t3 -29.5q-18 -36 -18 -37q83 -19 144 -82.5t76 -140.5l63 -327l118 -173h17q20 0 33.5 -14.5t13.5 -35.5q0 -20 -13 -40t-31 -27q-8 -3 -23 -8.5 t-65 -20t-103 -25t-132.5 -19.5t-158.5 -9q-125 0 -245.5 20.5t-178.5 40.5l-58 20q-18 7 -31 27.5t-13 40.5zM497 110q12 -49 40 -79.5t63 -30.5t63 30.5t39 79.5q-48 -6 -102 -6t-103 6z" />
+<glyph unicode="&#xe124;" d="M21 445l233 -45l-78 -224l224 78l45 -233l155 179l155 -179l45 233l224 -78l-78 224l234 45l-180 155l180 156l-234 44l78 225l-224 -78l-45 233l-155 -180l-155 180l-45 -233l-224 78l78 -225l-233 -44l179 -156z" />
+<glyph unicode="&#xe125;" d="M0 200h200v600h-200v-600zM300 275q0 -75 100 -75h61q124 -100 139 -100h250q46 0 83 57l238 344q29 31 29 74v100q0 44 -30.5 84.5t-69.5 40.5h-328q28 118 28 125v150q0 44 -30.5 84.5t-69.5 40.5h-50q-27 0 -51 -20t-38 -48l-96 -198l-145 -196q-20 -26 -20 -63v-400z M400 300v375l150 213l100 212h50v-175l-50 -225h450v-125l-250 -375h-214l-136 100h-100z" />
+<glyph unicode="&#xe126;" d="M0 400v600h200v-600h-200zM300 525v400q0 75 100 75h61q124 100 139 100h250q46 0 83 -57l238 -344q29 -31 29 -74v-100q0 -44 -30.5 -84.5t-69.5 -40.5h-328q28 -118 28 -125v-150q0 -44 -30.5 -84.5t-69.5 -40.5h-50q-27 0 -51 20t-38 48l-96 198l-145 196 q-20 26 -20 63zM400 525l150 -212l100 -213h50v175l-50 225h450v125l-250 375h-214l-136 -100h-100v-375z" />
+<glyph unicode="&#xe127;" d="M8 200v600h200v-600h-200zM308 275v525q0 17 14 35.5t28 28.5l14 9l362 230q14 6 25 6q17 0 29 -12l109 -112q14 -14 14 -34q0 -18 -11 -32l-85 -121h302q85 0 138.5 -38t53.5 -110t-54.5 -111t-138.5 -39h-107l-130 -339q-7 -22 -20.5 -41.5t-28.5 -19.5h-341 q-7 0 -90 81t-83 94zM408 289l100 -89h293l131 339q6 21 19.5 41t28.5 20h203q16 0 25 15t9 36q0 20 -9 34.5t-25 14.5h-457h-6.5h-7.5t-6.5 0.5t-6 1t-5 1.5t-5.5 2.5t-4 4t-4 5.5q-5 12 -5 20q0 14 10 27l147 183l-86 83l-339 -236v-503z" />
+<glyph unicode="&#xe128;" d="M-101 651q0 72 54 110t139 38l302 -1l-85 121q-11 16 -11 32q0 21 14 34l109 113q13 12 29 12q11 0 25 -6l365 -230q7 -4 17 -10.5t26.5 -26t16.5 -36.5v-526q0 -13 -86 -93.5t-94 -80.5h-341q-16 0 -29.5 20t-19.5 41l-130 339h-107q-84 0 -139 39t-55 111zM-1 601h222 q15 0 28.5 -20.5t19.5 -40.5l131 -339h293l107 89v502l-343 237l-87 -83l145 -184q10 -11 10 -26q0 -11 -5 -20q-1 -3 -3.5 -5.5l-4 -4t-5 -2.5t-5.5 -1.5t-6.5 -1t-6.5 -0.5h-7.5h-6.5h-476v-100zM1000 201v600h200v-600h-200z" />
+<glyph unicode="&#xe129;" d="M97 719l230 -363q4 -6 10.5 -15.5t26 -25t36.5 -15.5h525q13 0 94 83t81 90v342q0 15 -20 28.5t-41 19.5l-339 131v106q0 84 -39 139t-111 55t-110 -53.5t-38 -138.5v-302l-121 84q-15 12 -33.5 11.5t-32.5 -13.5l-112 -110q-22 -22 -6 -53zM172 739l83 86l183 -146 q22 -18 47 -5q3 1 5.5 3.5l4 4t2.5 5t1.5 5.5t1 6.5t0.5 6.5v7.5v6.5v456q0 22 25 31t50 -0.5t25 -30.5v-202q0 -16 20 -29.5t41 -19.5l339 -130v-294l-89 -100h-503zM400 0v200h600v-200h-600z" />
+<glyph unicode="&#xe130;" d="M2 585q-16 -31 6 -53l112 -110q13 -13 32 -13.5t34 10.5l121 85q0 -51 -0.5 -153.5t-0.5 -148.5q0 -84 38.5 -138t110.5 -54t111 55t39 139v106l339 131q20 6 40.5 19.5t20.5 28.5v342q0 7 -81 90t-94 83h-525q-17 0 -35.5 -14t-28.5 -28l-10 -15zM77 565l236 339h503 l89 -100v-294l-340 -130q-20 -6 -40 -20t-20 -29v-202q0 -22 -25 -31t-50 0t-25 31v456v14.5t-1.5 11.5t-5 12t-9.5 7q-24 13 -46 -5l-184 -146zM305 1104v200h600v-200h-600z" />
+<glyph unicode="&#xe131;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM298 701l2 -201h300l-2 -194l402 294l-402 298v-197h-300z" />
+<glyph unicode="&#xe132;" d="M0 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t231.5 47.5q122 0 232.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-218 -217.5t-300 -80t-299.5 80t-217.5 217.5t-80 299.5zM200 600l402 -294l-2 194h300l2 201h-300v197z" />
+<glyph unicode="&#xe133;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 600h200v-300h200v300h200l-300 400z" />
+<glyph unicode="&#xe134;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM300 600l300 -400l300 400h-200v300h-200v-300h-200z" />
+<glyph unicode="&#xe135;" d="M5 597q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5zM254 780q-8 -33 5.5 -92.5t7.5 -87.5q0 -9 17 -44t16 -60 q12 0 23 -5.5t23 -15t20 -13.5q24 -12 108 -42q22 -8 53 -31.5t59.5 -38.5t57.5 -11q8 -18 -15 -55t-20 -57q42 -71 87 -80q0 -6 -3 -15.5t-3.5 -14.5t4.5 -17q104 -3 221 112q30 29 47 47t34.5 49t20.5 62q-14 9 -37 9.5t-36 7.5q-14 7 -49 15t-52 19q-9 0 -39.5 -0.5 t-46.5 -1.5t-39 -6.5t-39 -16.5q-50 -35 -66 -12q-4 2 -3.5 25.5t0.5 25.5q-6 13 -26.5 17t-24.5 7q2 22 -2 41t-16.5 28t-38.5 -20q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q12 -19 32 -37.5t34 -27.5l14 -8q0 3 9.5 39.5t5.5 57.5 q-4 23 14.5 44.5t22.5 31.5q5 14 10 35t8.5 31t15.5 22.5t34 21.5q-6 18 10 37q8 0 23.5 -1.5t24.5 -1.5t20.5 4.5t20.5 15.5q-10 23 -30.5 42.5t-38 30t-49 26.5t-43.5 23q11 39 2 44q31 -13 58 -14.5t39 3.5l11 4q7 36 -16.5 53.5t-64.5 28.5t-56 23q-19 -3 -37 0 q-15 -12 -36.5 -21t-34.5 -12t-44 -8t-39 -6q-15 -3 -45.5 0.5t-45.5 -2.5q-21 -7 -52 -26.5t-34 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -90.5t-29.5 -79.5zM518 916q3 12 16 30t16 25q10 -10 18.5 -10t14 6t14.5 14.5t16 12.5q0 -24 17 -66.5t17 -43.5 q-9 2 -31 5t-36 5t-32 8t-30 14zM692 1003h1h-1z" />
+<glyph unicode="&#xe136;" d="M0 164.5q0 21.5 15 37.5l600 599q-33 101 6 201.5t135 154.5q164 92 306 -9l-259 -138l145 -232l251 126q13 -175 -151 -267q-123 -70 -253 -23l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5z" />
+<glyph unicode="&#xe137;" horiz-adv-x="1220" d="M0 196v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM0 596v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5zM0 996v100q0 41 29.5 70.5t70.5 29.5h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM600 596h500v100h-500v-100zM800 196h300v100h-300v-100zM900 996h200v100h-200v-100z" />
+<glyph unicode="&#xe138;" d="M100 1100v100h1000v-100h-1000zM150 1000h900l-350 -500v-300l-200 -200v500z" />
+<glyph unicode="&#xe139;" d="M0 200v200h1200v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5zM0 500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5h200q41 0 70.5 -29.5t29.5 -70.5v-100h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500z M500 1000h200v100h-200v-100z" />
+<glyph unicode="&#xe140;" d="M0 0v400l129 -129l200 200l142 -142l-200 -200l129 -129h-400zM0 800l129 129l200 -200l142 142l-200 200l129 129h-400v-400zM729 329l142 142l200 -200l129 129v-400h-400l129 129zM729 871l200 200l-129 129h400v-400l-129 129l-200 -200z" />
+<glyph unicode="&#xe141;" d="M0 596q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM182 596q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM291 655 q0 23 15.5 38.5t38.5 15.5t39 -16t16 -38q0 -23 -16 -39t-39 -16q-22 0 -38 16t-16 39zM400 850q0 22 16 38.5t39 16.5q22 0 38 -16t16 -39t-16 -39t-38 -16q-23 0 -39 16.5t-16 38.5zM514 609q0 32 20.5 56.5t51.5 29.5l122 126l1 1q-9 14 -9 28q0 22 16 38.5t39 16.5 q22 0 38 -16t16 -39t-16 -39t-38 -16q-14 0 -29 10l-55 -145q17 -22 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5zM800 655q0 22 16 38t39 16t38.5 -15.5t15.5 -38.5t-16 -39t-38 -16q-23 0 -39 16t-16 39z" />
+<glyph unicode="&#xe142;" d="M-40 375q-13 -95 35 -173q35 -57 94 -89t129 -32q63 0 119 28q33 16 65 40.5t52.5 45.5t59.5 64q40 44 57 61l394 394q35 35 47 84t-3 96q-27 87 -117 104q-20 2 -29 2q-46 0 -78.5 -16.5t-67.5 -51.5l-389 -396l-7 -7l69 -67l377 373q20 22 39 38q23 23 50 23 q38 0 53 -36q16 -39 -20 -75l-547 -547q-52 -52 -125 -52q-55 0 -100 33t-54 96q-5 35 2.5 66t31.5 63t42 50t56 54q24 21 44 41l348 348q52 52 82.5 79.5t84 54t107.5 26.5q25 0 48 -4q95 -17 154 -94.5t51 -175.5q-7 -101 -98 -192l-252 -249l-253 -256l7 -7l69 -60 l517 511q67 67 95 157t11 183q-16 87 -67 154t-130 103q-69 33 -152 33q-107 0 -197 -55q-40 -24 -111 -95l-512 -512q-68 -68 -81 -163z" />
+<glyph unicode="&#xe143;" d="M80 784q0 131 98.5 229.5t230.5 98.5q143 0 241 -129q103 129 246 129q129 0 226 -98.5t97 -229.5q0 -46 -17.5 -91t-61 -99t-77 -89.5t-104.5 -105.5q-197 -191 -293 -322l-17 -23l-16 23q-43 58 -100 122.5t-92 99.5t-101 100q-71 70 -104.5 105.5t-77 89.5t-61 99 t-17.5 91zM250 784q0 -27 30.5 -70t61.5 -75.5t95 -94.5l22 -22q93 -90 190 -201q82 92 195 203l12 12q64 62 97.5 97t64.5 79t31 72q0 71 -48 119.5t-105 48.5q-74 0 -132 -83l-118 -171l-114 174q-51 80 -123 80q-60 0 -109.5 -49.5t-49.5 -118.5z" />
+<glyph unicode="&#xe144;" d="M57 353q0 -95 66 -159l141 -142q68 -66 159 -66q93 0 159 66l283 283q66 66 66 159t-66 159l-141 141q-8 9 -19 17l-105 -105l212 -212l-389 -389l-247 248l95 95l-18 18q-46 45 -75 101l-55 -55q-66 -66 -66 -159zM269 706q0 -93 66 -159l141 -141q7 -7 19 -17l105 105 l-212 212l389 389l247 -247l-95 -96l18 -17q47 -49 77 -100l29 29q35 35 62.5 88t27.5 96q0 93 -66 159l-141 141q-66 66 -159 66q-95 0 -159 -66l-283 -283q-66 -64 -66 -159z" />
+<glyph unicode="&#xe145;" d="M200 100v953q0 21 30 46t81 48t129 38t163 15t162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5zM300 300h600v700h-600v-700zM496 150q0 -43 30.5 -73.5t73.5 -30.5t73.5 30.5t30.5 73.5t-30.5 73.5t-73.5 30.5 t-73.5 -30.5t-30.5 -73.5z" />
+<glyph unicode="&#xe146;" d="M0 0l303 380l207 208l-210 212h300l267 279l-35 36q-15 14 -15 35t15 35q14 15 35 15t35 -15l283 -282q15 -15 15 -36t-15 -35q-14 -15 -35 -15t-35 15l-36 35l-279 -267v-300l-212 210l-208 -207z" />
+<glyph unicode="&#xe148;" d="M295 433h139q5 -77 48.5 -126.5t117.5 -64.5v335q-6 1 -15.5 4t-11.5 3q-46 14 -79 26.5t-72 36t-62.5 52t-40 72.5t-16.5 99q0 92 44 159.5t109 101t144 40.5v78h100v-79q38 -4 72.5 -13.5t75.5 -31.5t71 -53.5t51.5 -84t24.5 -118.5h-159q-8 72 -35 109.5t-101 50.5 v-307l64 -14q34 -7 64 -16.5t70 -31.5t67.5 -52t47.5 -80.5t20 -112.5q0 -139 -89 -224t-244 -96v-77h-100v78q-152 17 -237 104q-40 40 -52.5 93.5t-15.5 139.5zM466 889q0 -29 8 -51t16.5 -34t29.5 -22.5t31 -13.5t38 -10q7 -2 11 -3v274q-61 -8 -97.5 -37.5t-36.5 -102.5 zM700 237q170 18 170 151q0 64 -44 99.5t-126 60.5v-311z" />
+<glyph unicode="&#xe149;" d="M100 600v100h166q-24 49 -44 104q-10 26 -14.5 55.5t-3 72.5t25 90t68.5 87q97 88 263 88q129 0 230 -89t101 -208h-153q0 52 -34 89.5t-74 51.5t-76 14q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -28 16.5 -69.5t28 -62.5t41.5 -72h241v-100h-197q8 -50 -2.5 -115 t-31.5 -94q-41 -59 -99 -113q35 11 84 18t70 7q33 1 103 -16t103 -17q76 0 136 30l50 -147q-41 -25 -80.5 -36.5t-59 -13t-61.5 -1.5q-23 0 -128 33t-155 29q-39 -4 -82 -17t-66 -25l-24 -11l-55 145l16.5 11t15.5 10t13.5 9.5t14.5 12t14.5 14t17.5 18.5q48 55 54 126.5 t-30 142.5h-221z" />
+<glyph unicode="&#xe150;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM602 900l298 300l298 -300h-198v-900h-200v900h-198z" />
+<glyph unicode="&#xe151;" d="M2 300h198v900h200v-900h198l-298 -300zM700 0v200h100v-100h200v-100h-300zM700 400v100h300v-200h-99v-100h-100v100h99v100h-200zM700 700v500h300v-500h-100v100h-100v-100h-100zM801 900h100v200h-100v-200z" />
+<glyph unicode="&#xe152;" d="M2 300h198v900h200v-900h198l-298 -300zM700 0v500h300v-500h-100v100h-100v-100h-100zM700 700v200h100v-100h200v-100h-300zM700 1100v100h300v-200h-99v-100h-100v100h99v100h-200zM801 200h100v200h-100v-200z" />
+<glyph unicode="&#xe153;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM800 100v400h300v-500h-100v100h-200zM800 1100v100h200v-500h-100v400h-100zM901 200h100v200h-100v-200z" />
+<glyph unicode="&#xe154;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM800 400v100h200v-500h-100v400h-100zM800 800v400h300v-500h-100v100h-200zM901 900h100v200h-100v-200z" />
+<glyph unicode="&#xe155;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM700 100v200h500v-200h-500zM700 400v200h400v-200h-400zM700 700v200h300v-200h-300zM700 1000v200h200v-200h-200z" />
+<glyph unicode="&#xe156;" d="M2 300l298 -300l298 300h-198v900h-200v-900h-198zM700 100v200h200v-200h-200zM700 400v200h300v-200h-300zM700 700v200h400v-200h-400zM700 1000v200h500v-200h-500z" />
+<glyph unicode="&#xe157;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q162 0 281 -118.5t119 -281.5v-300q0 -165 -118.5 -282.5t-281.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500z" />
+<glyph unicode="&#xe158;" d="M0 400v300q0 163 119 281.5t281 118.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-163 0 -281.5 117.5t-118.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM400 300l333 250l-333 250v-500z" />
+<glyph unicode="&#xe159;" d="M0 400v300q0 163 117.5 281.5t282.5 118.5h300q163 0 281.5 -119t118.5 -281v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM300 700l250 -333l250 333h-500z" />
+<glyph unicode="&#xe160;" d="M0 400v300q0 165 117.5 282.5t282.5 117.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -162 -118.5 -281t-281.5 -119h-300q-165 0 -282.5 118.5t-117.5 281.5zM200 300q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5 h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM300 400h500l-250 333z" />
+<glyph unicode="&#xe161;" d="M0 400v300h300v200l400 -350l-400 -350v200h-300zM500 0v200h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-500v200h400q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-400z" />
+<glyph unicode="&#xe162;" d="M217 519q8 -19 31 -19h302q-155 -438 -160 -458q-5 -21 4 -32l9 -8h9q14 0 26 15q11 13 274.5 321.5t264.5 308.5q14 19 5 36q-8 17 -31 17l-301 -1q1 4 78 219.5t79 227.5q2 15 -5 27l-9 9h-9q-15 0 -25 -16q-4 -6 -98 -111.5t-228.5 -257t-209.5 -237.5q-16 -19 -6 -41 z" />
+<glyph unicode="&#xe163;" d="M0 400q0 -165 117.5 -282.5t282.5 -117.5h300q47 0 100 15v185h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h500v185q-14 4 -114 7.5t-193 5.5l-93 2q-165 0 -282.5 -117.5t-117.5 -282.5v-300zM600 400v300h300v200l400 -350l-400 -350v200h-300z " />
+<glyph unicode="&#xe164;" d="M0 400q0 -165 117.5 -282.5t282.5 -117.5h300q163 0 281.5 117.5t118.5 282.5v98l-78 73l-122 -123v-148q0 -41 -29.5 -70.5t-70.5 -29.5h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h156l118 122l-74 78h-100q-165 0 -282.5 -117.5t-117.5 -282.5 v-300zM496 709l353 342l-149 149h500v-500l-149 149l-342 -353z" />
+<glyph unicode="&#xe165;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM406 600 q0 80 57 137t137 57t137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137z" />
+<glyph unicode="&#xe166;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 800l445 -500l450 500h-295v400h-300v-400h-300zM900 150h100v50h-100v-50z" />
+<glyph unicode="&#xe167;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 700h300v-300h300v300h295l-445 500zM900 150h100v50h-100v-50z" />
+<glyph unicode="&#xe168;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 705l305 -305l596 596l-154 155l-442 -442l-150 151zM900 150h100v50h-100v-50z" />
+<glyph unicode="&#xe169;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM100 988l97 -98l212 213l-97 97zM200 400l697 1l3 699l-250 -239l-149 149l-212 -212l149 -149zM900 150h100v50h-100v-50z" />
+<glyph unicode="&#xe170;" d="M0 0v275q0 11 7 18t18 7h1048q11 0 19 -7.5t8 -17.5v-275h-1100zM200 612l212 -212l98 97l-213 212zM300 1200l239 -250l-149 -149l212 -212l149 148l249 -237l-1 697zM900 150h100v50h-100v-50z" />
+<glyph unicode="&#xe171;" d="M23 415l1177 784v-1079l-475 272l-310 -393v416h-392zM494 210l672 938l-672 -712v-226z" />
+<glyph unicode="&#xe172;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-850q0 -21 -15 -35.5t-35 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 1000h100v200h-100v-200z" />
+<glyph unicode="&#xe173;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-218l-276 -275l-120 120l-126 -127h-378v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM581 306l123 123l120 -120l353 352l123 -123l-475 -476zM600 1000h100v200h-100v-200z" />
+<glyph unicode="&#xe174;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-269l-103 -103l-170 170l-298 -298h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 1000h100v200h-100v-200zM700 133l170 170l-170 170l127 127l170 -170l170 170l127 -128l-170 -169l170 -170 l-127 -127l-170 170l-170 -170z" />
+<glyph unicode="&#xe175;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-300h-400v-200h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 300l300 -300l300 300h-200v300h-200v-300h-200zM600 1000v200h100v-200h-100z" />
+<glyph unicode="&#xe176;" d="M0 150v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-402l-200 200l-298 -298h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5zM600 300h200v-300h200v300h200l-300 300zM600 1000v200h100v-200h-100z" />
+<glyph unicode="&#xe177;" d="M0 250q0 -21 14.5 -35.5t35.5 -14.5h1100q21 0 35.5 14.5t14.5 35.5v550h-1200v-550zM0 900h1200v150q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-150zM100 300v200h400v-200h-400z" />
+<glyph unicode="&#xe178;" d="M0 400l300 298v-198h400v-200h-400v-198zM100 800v200h100v-200h-100zM300 800v200h100v-200h-100zM500 800v200h400v198l300 -298l-300 -298v198h-400zM800 300v200h100v-200h-100zM1000 300h100v200h-100v-200z" />
+<glyph unicode="&#xe179;" d="M100 700v400l50 100l50 -100v-300h100v300l50 100l50 -100v-300h100v300l50 100l50 -100v-400l-100 -203v-447q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447zM800 597q0 -29 10.5 -55.5t25 -43t29 -28.5t25.5 -18l10 -5v-397q0 -21 14.5 -35.5 t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5v1106q0 31 -18 40.5t-44 -7.5l-276 -116q-25 -17 -43.5 -51.5t-18.5 -65.5v-359z" />
+<glyph unicode="&#xe180;" d="M100 0h400v56q-75 0 -87.5 6t-12.5 44v394h500v-394q0 -38 -12.5 -44t-87.5 -6v-56h400v56q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5v888q0 22 25 34.5t50 13.5l25 2v56h-400v-56q75 0 87.5 -6t12.5 -44v-394h-500v394q0 38 12.5 44t87.5 6v56h-400v-56q4 0 11 -0.5 t24 -3t30 -7t24 -15t11 -24.5v-888q0 -22 -25 -34.5t-50 -13.5l-25 -2v-56z" />
+<glyph unicode="&#xe181;" d="M0 300q0 -41 29.5 -70.5t70.5 -29.5h300q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-300q-41 0 -70.5 -29.5t-29.5 -70.5v-500zM100 100h400l200 200h105l295 98v-298h-425l-100 -100h-375zM100 300v200h300v-200h-300zM100 600v200h300v-200h-300z M100 1000h400l200 -200v-98l295 98h105v200h-425l-100 100h-375zM700 402v163l400 133v-163z" />
+<glyph unicode="&#xe182;" d="M16.5 974.5q0.5 -21.5 16 -90t46.5 -140t104 -177.5t175 -208q103 -103 207.5 -176t180 -103.5t137 -47t92.5 -16.5l31 1l163 162q17 18 13.5 41t-22.5 37l-192 136q-19 14 -45 12t-42 -19l-118 -118q-142 101 -268 227t-227 268l118 118q17 17 20 41.5t-11 44.5 l-139 194q-14 19 -36.5 22t-40.5 -14l-162 -162q-1 -11 -0.5 -32.5z" />
+<glyph unicode="&#xe183;" d="M0 50v212q0 20 10.5 45.5t24.5 39.5l365 303v50q0 4 1 10.5t12 22.5t30 28.5t60 23t97 10.5t97 -10t60 -23.5t30 -27.5t12 -24l1 -10v-50l365 -303q14 -14 24.5 -39.5t10.5 -45.5v-212q0 -21 -14.5 -35.5t-35.5 -14.5h-1100q-20 0 -35 14.5t-15 35.5zM0 712 q0 -21 14.5 -33.5t34.5 -8.5l202 33q20 4 34.5 21t14.5 38v146q141 24 300 24t300 -24v-146q0 -21 14.5 -38t34.5 -21l202 -33q20 -4 34.5 8.5t14.5 33.5v200q-6 8 -19 20.5t-63 45t-112 57t-171 45t-235 20.5q-92 0 -175 -10.5t-141.5 -27t-108.5 -36.5t-81.5 -40 t-53.5 -36.5t-31 -27.5l-9 -10v-200z" />
+<glyph unicode="&#xe184;" d="M100 0v100h1100v-100h-1100zM175 200h950l-125 150v250l100 100v400h-100v-200h-100v200h-200v-200h-100v200h-200v-200h-100v200h-100v-400l100 -100v-250z" />
+<glyph unicode="&#xe185;" d="M100 0h300v400q0 41 -29.5 70.5t-70.5 29.5h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-400zM500 0v1000q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-1000h-300zM900 0v700q0 41 29.5 70.5t70.5 29.5h100q41 0 70.5 -29.5t29.5 -70.5v-700h-300z" />
+<glyph unicode="&#xe186;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v300h-200v100h200v100h-300v-300h200v-100h-200v-100zM600 300h200v100h100v300h-100v100h-200v-500 zM700 400v300h100v-300h-100z" />
+<glyph unicode="&#xe187;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h100v200h100v-200h100v500h-100v-200h-100v200h-100v-500zM600 300h200v100h100v300h-100v100h-200v-500 zM700 400v300h100v-300h-100z" />
+<glyph unicode="&#xe188;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v100h-200v300h200v100h-300v-500zM600 300h300v100h-200v300h200v100h-300v-500z" />
+<glyph unicode="&#xe189;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 550l300 -150v300zM600 400l300 150l-300 150v-300z" />
+<glyph unicode="&#xe190;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300v500h700v-500h-700zM300 400h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130v-300zM575 549 q0 -65 27 -107t68 -42h130v300h-130q-38 0 -66.5 -43t-28.5 -108z" />
+<glyph unicode="&#xe191;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v300h-200v100h200v100h-300v-300h200v-100h-200v-100zM601 300h100v100h-100v-100zM700 700h100 v-400h100v500h-200v-100z" />
+<glyph unicode="&#xe192;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 300h300v400h-200v100h-100v-500zM301 400v200h100v-200h-100zM601 300h100v100h-100v-100zM700 700h100 v-400h100v500h-200v-100z" />
+<glyph unicode="&#xe193;" d="M-100 300v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212zM100 200h900v700h-900v-700zM200 700v100h300v-300h-99v-100h-100v100h99v200h-200zM201 300v100h100v-100h-100zM601 300v100h100v-100h-100z M700 700v100h200v-500h-100v400h-100z" />
+<glyph unicode="&#xe194;" d="M4 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM186 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM400 500v200 l100 100h300v-100h-300v-200h300v-100h-300z" />
+<glyph unicode="&#xe195;" d="M0 600q0 162 80 299t217 217t299 80t299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299zM182 600q0 -171 121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5t-292.5 -121.5t-121.5 -292.5zM400 400v400h300 l100 -100v-100h-100v100h-200v-100h200v-100h-200v-100h-100zM700 400v100h100v-100h-100z" />
+<glyph unicode="&#xe197;" d="M-14 494q0 -80 56.5 -137t135.5 -57h222v300h400v-300h128q120 0 205 86.5t85 207.5t-85 207t-205 86q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5zM300 200h200v300h200v-300h200 l-300 -300z" />
+<glyph unicode="&#xe198;" d="M-14 494q0 -80 56.5 -137t135.5 -57h8l414 414l403 -403q94 26 154.5 104.5t60.5 178.5q0 120 -85 206.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5zM300 200l300 300 l300 -300h-200v-300h-200v300h-200z" />
+<glyph unicode="&#xe199;" d="M100 200h400v-155l-75 -45h350l-75 45v155h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170z" />
+<glyph unicode="&#xe200;" d="M121 700q0 -53 28.5 -97t75.5 -65q-4 -16 -4 -38q0 -74 52.5 -126.5t126.5 -52.5q56 0 100 30v-306l-75 -45h350l-75 45v306q46 -30 100 -30q74 0 126.5 52.5t52.5 126.5q0 24 -9 55q50 32 79.5 83t29.5 112q0 90 -61.5 155.5t-150.5 71.5q-26 89 -99.5 145.5 t-167.5 56.5q-116 0 -197.5 -81.5t-81.5 -197.5q0 -4 1 -11.5t1 -11.5q-14 2 -23 2q-74 0 -126.5 -52.5t-52.5 -126.5z" />
+</font>
+</defs></svg> 
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.ttf b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.ttf
new file mode 100755 (executable)
index 0000000..67fa00b
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.ttf differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.woff b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.woff
new file mode 100755 (executable)
index 0000000..8c54182
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/fonts/glyphicons-halflings-regular.woff differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/img/icon.png b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/img/icon.png
new file mode 100755 (executable)
index 0000000..ff413e2
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/img/icon.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/js/bootstrap.min.js b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/js/bootstrap.min.js
new file mode 100755 (executable)
index 0000000..b04a0e8
--- /dev/null
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu], [role=listbox]",f.prototype.keydown)}(jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i<p?"right":e,d.removeClass(l).addClass(e)}var q=this.getCalculatedOffset(e,h,i,j);this.applyPlacement(q,e),this.hoverState=null;var r=function(){c.$element.trigger("shown.bs."+c.type)};a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,r).emulateTransitionEnd(150):r()}},b.prototype.applyPlacement=function(b,c){var d,e=this.tip(),f=e[0].offsetWidth,g=e[0].offsetHeight,h=parseInt(e.css("margin-top"),10),i=parseInt(e.css("margin-left"),10);isNaN(h)&&(h=0),isNaN(i)&&(i=0),b.top=b.top+h,b.left=b.left+i,a.offset.setOffset(e[0],a.extend({using:function(a){e.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),e.addClass("in");var j=e[0].offsetWidth,k=e[0].offsetHeight;if("top"==c&&k!=g&&(d=!0,b.top=b.top+g-k),/bottom|top/.test(c)){var l=0;b.left<0&&(l=-2*b.left,b.left=0,e.offset(b),j=e[0].offsetWidth,k=e[0].offsetHeight),this.replaceArrow(l-f+j,j,"left")}else this.replaceArrow(k-g,k,"top");d&&e.offset(b)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/js/jquery.min.js b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/js/jquery.min.js
new file mode 100755 (executable)
index 0000000..e5ace11
--- /dev/null
@@ -0,0 +1,4 @@
+/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)
+},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
+},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.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 contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n});
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.ttf b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.ttf
new file mode 100755 (executable)
index 0000000..d030dc0
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.ttf differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.woff b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.woff
new file mode 100755 (executable)
index 0000000..2c77d6e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/fonts/amaticsc-regular.woff differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/cross-out.png b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/cross-out.png
new file mode 100755 (executable)
index 0000000..376e5bd
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/cross-out.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded-3d.png b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded-3d.png
new file mode 100755 (executable)
index 0000000..9ca4e3d
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded-3d.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded.png b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded.png
new file mode 100755 (executable)
index 0000000..e289cf2
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border-rounded.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border.png b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border.png
new file mode 100755 (executable)
index 0000000..91864e6
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/img/sketch-border.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/js/bootstrap.min.js b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/js/bootstrap.min.js
new file mode 100755 (executable)
index 0000000..b04a0e8
--- /dev/null
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu], [role=listbox]",f.prototype.keydown)}(jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i<p?"right":e,d.removeClass(l).addClass(e)}var q=this.getCalculatedOffset(e,h,i,j);this.applyPlacement(q,e),this.hoverState=null;var r=function(){c.$element.trigger("shown.bs."+c.type)};a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,r).emulateTransitionEnd(150):r()}},b.prototype.applyPlacement=function(b,c){var d,e=this.tip(),f=e[0].offsetWidth,g=e[0].offsetHeight,h=parseInt(e.css("margin-top"),10),i=parseInt(e.css("margin-left"),10);isNaN(h)&&(h=0),isNaN(i)&&(i=0),b.top=b.top+h,b.left=b.left+i,a.offset.setOffset(e[0],a.extend({using:function(a){e.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),e.addClass("in");var j=e[0].offsetWidth,k=e[0].offsetHeight;if("top"==c&&k!=g&&(d=!0,b.top=b.top+g-k),/bottom|top/.test(c)){var l=0;b.left<0&&(l=-2*b.left,b.left=0,e.offset(b),j=e[0].offsetWidth,k=e[0].offsetHeight),this.replaceArrow(l-f+j,j,"left")}else this.replaceArrow(k-g,k,"top");d&&e.offset(b)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/js/less-1.7.5.min.js b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/js/less-1.7.5.min.js
new file mode 100755 (executable)
index 0000000..331f4e6
--- /dev/null
@@ -0,0 +1,16 @@
+/*!
+ * Less - Leaner CSS v1.7.5
+ * http://lesscss.org
+ *
+ * Copyright (c) 2009-2014, Alexis Sellier <self@cloudhead.net>
+ * Licensed under the Apache v2 License.
+ *
+ */
+
+ /** * @license Apache v2
+ */
+
+!function(a,b){function c(b){return a.less[b.split("/")[1]]}function d(a,b){"undefined"!=typeof console&&w.logLevel>=b&&console.log("less: "+a)}function e(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function f(a,c){var e="{line} {content}",f=a.filename||c,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,c,d){a.extract[c]!==b&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(c-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[c]))};a.extract?(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")):a.stack&&(h+=a.stack),d(h,z.errors)}function g(a,b,c){var f=b.href||"",g="less:"+(b.title||e(f)),h=document.getElementById(g),i=!1,j=document.createElement("style");j.setAttribute("type","text/css"),b.media&&j.setAttribute("media",b.media),j.id=g,j.styleSheet||(j.appendChild(document.createTextNode(a)),i=null!==h&&h.childNodes.length>0&&j.childNodes.length>0&&h.firstChild.nodeValue===j.firstChild.nodeValue);var k=document.getElementsByTagName("head")[0];if(null===h||i===!1){var l=b&&b.nextSibling||null;l?l.parentNode.insertBefore(j,l):k.appendChild(j)}if(h&&i===!1&&h.parentNode.removeChild(h),j.styleSheet)try{j.styleSheet.cssText=a}catch(m){throw new Error("Couldn't reassign styleSheet.cssText.")}if(c&&D){d("saving "+f+" to cache.",z.info);try{D.setItem(f,a),D.setItem(f+":timestamp",c)}catch(m){d("failed to save",z.errors)}}}function h(a){return w.postProcessor&&"function"==typeof w.postProcessor&&(a=w.postProcessor.call(a,a)||a),a}function i(a,c){var d,f,h="less-error-message:"+e(c||""),i='<li><label>{line}</label><pre class="{class}">{content}</pre></li>',j=document.createElement("div"),k=[],l=a.filename||c,m=l.match(/([^\/]+(\?.*)?)$/)[1];j.id=h,j.className="less-error-message",f="<h3>"+(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+'</h3><p>in <a href="'+l+'">'+m+"</a> ";var n=function(a,c,d){a.extract[c]!==b&&k.push(i.replace(/\{line\}/,(parseInt(a.line,10)||0)+(c-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[c]))};a.extract?(n(a,0,""),n(a,1,"line"),n(a,2,""),f+="on line "+a.line+", column "+(a.column+1)+":</p><ul>"+k.join("")+"</ul>"):a.stack&&(f+="<br/>"+a.stack.split("\n").slice(1).join("<br/>")),j.innerHTML=f,g([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),j.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"==w.env&&(d=setInterval(function(){document.body&&(document.getElementById(h)?document.body.replaceChild(j,document.getElementById(h)):document.body.insertBefore(j,document.body.firstChild),clearInterval(d))},10))}function j(a,b){w.errorReporting&&"html"!==w.errorReporting?"console"===w.errorReporting?f(a,b):"function"==typeof w.errorReporting&&w.errorReporting("add",a,b):i(a,b)}function k(a){var b=document.getElementById("less-error-message:"+e(a));b&&b.parentNode.removeChild(b)}function l(){}function m(a){w.errorReporting&&"html"!==w.errorReporting?"console"===w.errorReporting?l(a):"function"==typeof w.errorReporting&&w.errorReporting("remove",a):k(a)}function n(a){for(var b,c=document.getElementsByTagName("style"),d=0;d<c.length;d++)if(b=c[d],b.type.match(C)){var e=new w.tree.parseEnv(w),f=b.innerHTML||"";e.filename=document.location.href.replace(/#.*$/,""),(a||w.globalVars)&&(e.useFileCache=!0);var g=function(a){return function(b,c){if(b)return j(b,"inline");var d=c.toCSS(w);a.type="text/css",a.styleSheet?a.styleSheet.cssText=d:a.innerHTML=d}}(b);new w.Parser(e).parse(f,g,{globalVars:w.globalVars,modifyVars:a})}}function o(a,b){var c,d,e=/^((?:[a-z-]+:)?\/+?(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,f=a.match(e),g={},h=[];if(!f)throw new Error("Could not parse sheet href - '"+a+"'");if(!f[1]||f[2]){if(d=b.match(e),!d)throw new Error("Could not parse page url - '"+b+"'");f[1]=f[1]||d[1]||"",f[2]||(f[3]=d[3]+f[3])}if(f[3]){for(h=f[3].replace(/\\/g,"/").split("/"),c=0;c<h.length;c++)"."===h[c]&&(h.splice(c,1),c-=1);for(c=0;c<h.length;c++)".."===h[c]&&c>0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=f[1]+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g}function p(a,b){var c,d,e,f,g=o(a),h=o(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;c<f.length-1;c++)i+="../";for(c=0;c<e.length-1;c++)i+=e[c]+"/";return i}function q(){if(a.XMLHttpRequest&&!("file:"===a.location.protocol&&"ActiveXObject"in a))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(b){return d("browser doesn't support AJAX.",z.errors),null}}function r(a,b,c,e){function f(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var g=q(),h=y?w.fileAsync:w.async;"function"==typeof g.overrideMimeType&&g.overrideMimeType("text/css"),d("XHR: Getting '"+a+"'",z.debug),g.open("GET",a,h),g.setRequestHeader("Accept",b||"text/x-less, text/css; q=0.9, */*; q=0.5"),g.send(null),y&&!w.fileAsync?0===g.status||g.status>=200&&g.status<300?c(g.responseText):e(g.status,a):h?g.onreadystatechange=function(){4==g.readyState&&f(g,c,e)}:f(g,c,e)}function s(b,c,d,e){c&&c.currentDirectory&&!/^([A-Za-z-]+:)?\//.test(b)&&(b=c.currentDirectory+b);var f=o(b,a.location.href),g=f.url,h={currentDirectory:f.path,filename:g};if(c?(h.entryPath=c.entryPath,h.rootpath=c.rootpath,h.rootFilename=c.rootFilename,h.relativeUrls=c.relativeUrls):(h.entryPath=f.path,h.rootpath=w.rootpath||f.path,h.rootFilename=g,h.relativeUrls=e.relativeUrls),h.relativeUrls&&(h.rootpath=e.rootpath?o(e.rootpath+p(f.path,h.entryPath)).path:f.path),e.useFileCache&&E[g])try{var i=E[g];d(null,i,g,h,{lastModified:new Date})}catch(j){d(j,null,g)}else r(g,e.mime,function(a,b){E[g]=a;try{d(null,a,g,h,{lastModified:b})}catch(c){d(c,null,g)}},function(a,b){d({type:"File",message:"'"+b+"' wasn't found ("+a+")"},null,g)})}function t(a,b,c,d,e){var f=new w.tree.parseEnv(w);f.mime=a.type,(e||w.globalVars)&&(f.useFileCache=!0),s(a.href,null,function(h,i,j,k,l){if(l){l.remaining=d;var n=D&&D.getItem(j),o=D&&D.getItem(j+":timestamp");if(!c&&o&&l.lastModified&&new Date(l.lastModified).valueOf()===new Date(o).valueOf())return g(n,a),l.local=!0,void b(null,null,i,a,l,j)}m(j),i?(f.currentFileInfo=k,new w.Parser(f).parse(i,function(c,d){if(c)return b(c,null,null,a);try{b(c,d,i,a,l,j)}catch(c){b(c,null,null,a)}},{modifyVars:e,globalVars:w.globalVars})):b(h,null,null,a,l,j)},f,e)}function u(a,b,c){for(var d=0;d<w.sheets.length;d++)t(w.sheets[d],a,b,w.sheets.length-(d+1),c)}function v(){"development"===w.env?(w.optimization=0,w.watchTimer=setInterval(function(){w.watchMode&&u(function(a,b,c,d,e){if(a)j(a,d.href);else if(b){var f=b.toCSS(w);f=h(f),g(f,d,e.lastModified)}})},w.poll)):w.optimization=3}("undefined"==typeof a.less||"undefined"!=typeof a.less.nodeType)&&(a.less={}),w=a.less,x=a.less.tree={},w.mode="browser";var w,x;w===b&&(w=exports,x=c("./tree"),w.mode="node"),w.Parser=function(a){function d(){D=y,G.push({current:C,i:y,j:z})}function e(){var a=G.pop();C=a.current,D=y=a.i,z=a.j}function f(){G.pop()}function g(){y>D&&(C=C.slice(y-D),D=y)}function h(a,b){var c=a.charCodeAt(0|b);return 32>=c&&(32===c||10===c||9===c)}function i(a){var b,c,d=typeof a;return"string"===d?v.charAt(y)!==a?null:(l(1),a):(g(),(b=a.exec(C))?(c=b[0].length,l(c),"string"==typeof b?b:1===b.length?b[0]:b):null)}function j(a){y>D&&(C=C.slice(y-D),D=y);var b=a.exec(C);return b?(l(b[0].length),"string"==typeof b?b:1===b.length?b[0]:b):null}function k(a){return v.charAt(y)!==a?null:(l(1),a)}function l(a){for(var b,c=y,d=z,e=y-D,f=y+C.length-e,g=y+=a,h=v;f>y&&(b=h.charCodeAt(y),!(b>32))&&(32===b||10===b||9===b||13===b);y++);return C=C.slice(a+y-g+e),D=y,!C.length&&z<B.length-1?(C=B[++z],l(0),!0):c!==y||d!==z}function m(a,b){var c="[object Function]"===Object.prototype.toString.call(a)?a.call(F):i(a);return c?c:void o(b||("string"==typeof a?"expected '"+a+"' got '"+v.charAt(y)+"'":"unexpected token"))}function n(a,b){return v.charAt(y)===a?(l(1),a):void o(b||"expected '"+a+"' got '"+v.charAt(y)+"'")}function o(a,b){var c=new Error(a);throw c.index=y,c.type=b||"Syntax",c}function p(a){return"string"==typeof a?v.charAt(y)===a:a.test(C)}function q(a){return v.charAt(y)===a}function r(a,b){return a.filename&&b.currentFileInfo.filename&&a.filename!==b.currentFileInfo.filename?E.imports.contents[a.filename]:v}function s(a,b){for(var c=a+1,d=null,e=-1;--c>=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}function t(a,b,d){var e=d.currentFileInfo.filename;return"browser"!==w.mode&&"rhino"!==w.mode&&(e=c("path").resolve(e)),{lineNumber:s(a,b).line+1,fileName:e}}function u(a,b){var c=r(a,b),d=s(a.index,c),e=d.line,f=d.column,g=a.call&&s(a.call,c).line,h=c.split("\n");this.type=a.type||"Syntax",this.message=a.message,this.filename=a.filename||b.currentFileInfo.filename,this.index=a.index,this.line="number"==typeof e?e+1:null,this.callLine=g+1,this.callExtract=h[g],this.stack=a.stack,this.column=f,this.extract=[h[e-1],h[e],h[e+1]]}var v,y,z,A,B,C,D,E,F,G=[],H=a&&a.filename;a instanceof x.parseEnv||(a=new x.parseEnv(a));var I=this.imports={paths:a.paths||[],queue:[],files:a.files,contents:a.contents,contentsIgnoredChars:a.contentsIgnoredChars,mime:a.mime,error:null,push:function(b,c,d,e){var f=this;this.queue.push(b);var g=function(a,c,d){f.queue.splice(f.queue.indexOf(b),1);var g=d===H;f.files[d]=c,a&&!f.error&&(f.error=a),e(a,c,g,d)};w.Parser.importer?w.Parser.importer(b,c,g,a):w.Parser.fileLoader(b,c,function(b,e,f,h){if(b)return void g(b);var i=new x.parseEnv(a);i.currentFileInfo=h,i.processImports=!1,i.contents[f]=e,(c.reference||d.reference)&&(h.reference=!0),d.inline?g(null,e,f):new w.Parser(i).parse(e,function(a,b){g(a,b,f)})},a)}},J=j;return u.prototype=new Error,u.prototype.constructor=u,this.env=a=a||{},this.optimization="optimization"in this.env?this.env.optimization:1,E={imports:I,parse:function(d,e,f){var g,h,i,j,k,l=null,m="";if(y=z=D=A=0,j=f&&f.globalVars?w.Parser.serializeVars(f.globalVars)+"\n":"",k=f&&f.modifyVars?"\n"+w.Parser.serializeVars(f.modifyVars):"",(j||f&&f.banner)&&(m=(f&&f.banner?f.banner:"")+j,E.imports.contentsIgnoredChars[a.currentFileInfo.filename]=m.length),d=d.replace(/\r\n/g,"\n"),v=d=m+d.replace(/^\uFEFF/,"")+k,E.imports.contents[a.currentFileInfo.filename]=d,B=function(b){function c(b,c){l=new u({index:c||i,type:"Parse",message:b,filename:a.currentFileInfo.filename},a)}function d(a){var c=i-s;512>c&&!a||!c||(r.push(b.slice(s,i+1)),s=i+1)}var e,f,g,h,i,j,k,m,n,o=b.length,p=0,q=0,r=[],s=0;for(i=0;o>i;i++)if(k=b.charCodeAt(i),!(k>=97&&122>=k||34>k))switch(k){case 40:q++,f=i;continue;case 41:if(--q<0)return c("missing opening `(`");continue;case 59:q||d();continue;case 123:p++,e=i;continue;case 125:if(--p<0)return c("missing opening `{`");p||q||d();continue;case 92:if(o-1>i){i++;continue}return c("unescaped `\\`");case 34:case 39:case 96:for(n=0,j=i,i+=1;o>i;i++)if(m=b.charCodeAt(i),!(m>96)){if(m==k){n=1;break}if(92==m){if(i==o-1)return c("unescaped `\\`");i++}}if(n)continue;return c("unmatched `"+String.fromCharCode(k)+"`",j);case 47:if(q||i==o-1)continue;if(m=b.charCodeAt(i+1),47==m)for(i+=2;o>i&&(m=b.charCodeAt(i),!(13>=m)||10!=m&&13!=m);i++);else if(42==m){for(g=j=i,i+=2;o-1>i&&(m=b.charCodeAt(i),125==m&&(h=i),42!=m||47!=b.charCodeAt(i+1));i++);if(i==o-1)return c("missing closing `*/`",j);i++}continue;case 42:if(o-1>i&&47==b.charCodeAt(i+1))return c("unmatched `/*`");continue}return 0!==p?g>e&&h>g?c("missing closing `}` or `*/`",e):c("missing closing `}`",e):0!==q?c("missing closing `)`",f):(d(!0),r)}(d),l)return e(new u(l,a));C=B[0];try{g=new x.Ruleset(null,this.parsers.primary()),g.root=!0,g.firstRoot=!0}catch(n){return e(new u(n,a))}if(g.toCSS=function(d){return function(e,f){e=e||{};var g,h,i=new x.evalEnv(e);"object"!=typeof f||Array.isArray(f)||(f=Object.keys(f).map(function(a){var b=f[a];return b instanceof x.Value||(b instanceof x.Expression||(b=new x.Expression([b])),b=new x.Value([b])),new x.Rule("@"+a,b,!1,null,0)}),i.frames=[new x.Ruleset(null,f)]);try{var j,k=[],l=[new x.joinSelectorVisitor,new x.processExtendsVisitor,new x.toCSSVisitor({compress:Boolean(e.compress)})],m=this;if(e.plugins)for(j=0;j<e.plugins.length;j++)e.plugins[j].isPreEvalVisitor?k.push(e.plugins[j]):e.plugins[j].isPreVisitor?l.splice(0,0,e.plugins[j]):l.push(e.plugins[j]);for(j=0;j<k.length;j++)k[j].run(m);for(g=d.call(m,i),j=0;j<l.length;j++)l[j].run(g);e.sourceMap&&(g=new x.sourceMapOutput({contentsIgnoredCharsMap:E.imports.contentsIgnoredChars,writeSourceMap:e.writeSourceMap,rootNode:g,contentsMap:E.imports.contents,sourceMapFilename:e.sourceMapFilename,sourceMapURL:e.sourceMapURL,outputFilename:e.sourceMapOutputFilename,sourceMapBasepath:e.sourceMapBasepath,sourceMapRootpath:e.sourceMapRootpath,outputSourceFiles:e.outputSourceFiles,sourceMapGenerator:e.sourceMapGenerator})),h=g.toCSS({compress:Boolean(e.compress),dumpLineNumbers:a.dumpLineNumbers,strictUnits:Boolean(e.strictUnits),numPrecision:8})}catch(n){throw new u(n,a)}if(e.cleancss&&"node"===w.mode){var o=c("clean-css"),p=e.cleancssOptions||{};return p.keepSpecialComments===b&&(p.keepSpecialComments="*"),p.processImport=!1,p.noRebase=!0,p.noAdvanced===b&&(p.noAdvanced=!0),new o(p).minify(h)}return e.compress?h.replace(/(^(\s)+)|((\s)+$)/g,""):h}}(g.eval),y<v.length-1){y=A;var o=s(y,v);i=v.split("\n"),h=o.line+1,l={type:"Parse",message:"Unrecognised input",index:y,filename:a.currentFileInfo.filename,line:h,column:o.column,extract:[i[h-2],i[h-1],i[h]]}}var p=function(b){return b=l||b||E.imports.error,b?(b instanceof u||(b=new u(b,a)),e(b)):e(null,g)};return a.processImports===!1?p():void new x.importVisitor(this.imports,p).run(g)},parsers:F={primary:function(){for(var a,b=this.mixin,c=J,d=[];C;){if(a=this.extendRule()||b.definition()||this.rule()||this.ruleset()||b.call()||this.comment()||this.rulesetCall()||this.directive())d.push(a);else if(!c(/^[\s\n]+/)&&!c(/^;+/))break;if(q("}"))break}return d},comment:function(){var b;if("/"===v.charAt(y))return"/"===v.charAt(y+1)?new x.Comment(j(/^\/\/.*/),!0,y,a.currentFileInfo):(b=j(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/),b?new x.Comment(b,!1,y,a.currentFileInfo):void 0)},comments:function(){for(var a,b=[];;){if(a=this.comment(),!a)break;b.push(a)}return b},entities:{quoted:function(){var b,c,d=y,e=y;return"~"===v.charAt(d)&&(d++,c=!0),'"'===v.charAt(d)||"'"===v.charAt(d)?(c&&k("~"),b=j(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/),b?new x.Quoted(b[0],b[1]||b[2],c,e,a.currentFileInfo):void 0):void 0},keyword:function(){var a;if(a=j(/^%|^[_A-Za-z-][_A-Za-z0-9-]*/)){var b=x.Color.fromKeyword(a);return b?b:new x.Keyword(a)}},call:function(){var b,c,d,e,f=y;if(b=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(C)){if(b=b[1],c=b.toLowerCase(),"url"===c)return null;if(y+=b.length,"alpha"===c&&(e=F.alpha(),"undefined"!=typeof e))return e;if(k("("),d=this.arguments(),k(")"))return b?new x.Call(b,d,f,a.currentFileInfo):void 0}},arguments:function(){for(var a,b=[];;){if(a=this.assignment()||F.expression(),!a)break;if(b.push(a),!k(","))break}return b},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return a=j(/^\w+(?=\s?=)/i),a&&k("=")?(b=F.entity(),b?new x.Assignment(a,b):void 0):void 0},url:function(){var b;if("u"===v.charAt(y)&&j(/^url\(/))return b=this.quoted()||this.variable()||j(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",n(")"),new x.URL(null!=b.value||b instanceof x.Variable?b:new x.Anonymous(b),a.currentFileInfo)},variable:function(){var b,c=y;return"@"===v.charAt(y)&&(b=j(/^@@?[\w-]+/))?new x.Variable(b,c,a.currentFileInfo):void 0},variableCurly:function(){var b,c=y;return"@"===v.charAt(y)&&(b=j(/^@\{([\w-]+)\}/))?new x.Variable("@"+b[1],c,a.currentFileInfo):void 0},color:function(){var a;if("#"===v.charAt(y)&&(a=j(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||o("Invalid HEX color code"),new x.Color(a[1])}},dimension:function(){var a,b=v.charCodeAt(y);if(!(b>57||43>b||47===b||44==b))return a=j(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/),a?new x.Dimension(a[1],a[2]):void 0},unicodeDescriptor:function(){var a;return a=j(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),a?new x.UnicodeDescriptor(a[0]):void 0},javascript:function(){var c,d,e=y;return"~"===v.charAt(e)&&(e++,d=!0),"`"===v.charAt(e)?(a.javascriptEnabled===b||a.javascriptEnabled||o("You are using JavaScript, which has been disabled."),d&&k("~"),c=j(/^`([^`]*)`/),c?new x.JavaScript(c[1],y,d):void 0):void 0}},variable:function(){var a;return"@"===v.charAt(y)&&(a=j(/^(@[\w-]+)\s*:/))?a[1]:void 0},rulesetCall:function(){var a;return"@"===v.charAt(y)&&(a=j(/^(@[\w-]+)\s*\(\s*\)\s*;/))?new x.RulesetCall(a[1]):void 0},extend:function(a){var b,c,d,e,f,g=y;if(j(a?/^&:extend\(/:/^:extend\(/)){do{for(d=null,b=null;!(d=j(/^(all)(?=\s*(\)|,))/))&&(c=this.element());)b?b.push(c):b=[c];d=d&&d[1],b||o("Missing target selector for :extend()."),f=new x.Extend(new x.Selector(b),d,g),e?e.push(f):e=[f]}while(k(","));return m(/^\)/),a&&m(/^;/),e}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var b,c,g,h,i,l,m=v.charAt(y),o=!1,p=y;if("."===m||"#"===m){for(d();;){if(b=y,h=j(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!h)break;g=new x.Element(i,h,b,a.currentFileInfo),c?c.push(g):c=[g],i=k(">")}return c&&(k("(")&&(l=this.args(!0).args,n(")")),F.important()&&(o=!0),F.end())?(f(),new x.mixin.Call(c,l,p,a.currentFileInfo,o)):void e()}},args:function(a){var b,c,g,h,i,l,m=E.parsers,n=m.entities,p={args:null,variadic:!1},q=[],r=[],s=[];for(d();;){if(a)l=m.detachedRuleset()||m.expression();else{if(m.comments(),"."===v.charAt(y)&&j(/^\.{3}/)){p.variadic=!0,k(";")&&!b&&(b=!0),(b?r:s).push({variadic:!0});break}l=n.variable()||n.literal()||n.keyword()}if(!l)break;h=null,l.throwAwayComments&&l.throwAwayComments(),i=l;var t=null;if(a?l.value&&1==l.value.length&&(t=l.value[0]):t=l,t&&t instanceof x.Variable)if(k(":")){if(q.length>0&&(b&&o("Cannot mix ; and , as delimiter types"),c=!0),i=a&&m.detachedRuleset()||m.expression(),!i){if(!a)return e(),p.args=[],p;o("could not understand value for named argument")}h=g=t.name}else{if(!a&&j(/^\.{3}/)){p.variadic=!0,k(";")&&!b&&(b=!0),(b?r:s).push({name:l.name,variadic:!0});break}a||(g=h=t.name,i=null)}i&&q.push(i),s.push({name:h,value:i}),k(",")||(k(";")||b)&&(c&&o("Cannot mix ; and , as delimiter types"),b=!0,q.length>1&&(i=new x.Value(q)),r.push({name:g,value:i}),g=null,q=[],c=!1)}return f(),p.args=b?r:s,p},definition:function(){var a,b,c,g,h=[],i=!1;if(!("."!==v.charAt(y)&&"#"!==v.charAt(y)||p(/^[^{]*\}/)))if(d(),b=j(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var l=this.args(!1);if(h=l.args,i=l.variadic,!k(")"))return A=y,void e();if(F.comments(),j(/^when/)&&(g=m(F.conditions,"expected condition")),c=F.block())return f(),new x.mixin.Definition(a,h,c,g,i);e()}else f()}},entity:function(){var a=this.entities;return a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()||this.comment()},end:function(){return k(";")||q("}")},alpha:function(){var a;if(j(/^\(opacity=/i))return a=j(/^\d+/)||this.entities.variable(),a?(n(")"),new x.Alpha(a)):void 0},element:function(){var b,c,g,h=y;return c=this.combinator(),b=j(/^(?:\d+\.\d+|\d+)%/)||j(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||k("*")||k("&")||this.attribute()||j(/^\([^()@]+\)/)||j(/^[\.#](?=@)/)||this.entities.variableCurly(),b||(d(),k("(")?(g=this.selector())&&k(")")?(b=new x.Paren(g),f()):e():f()),b?new x.Element(c,b,h,a.currentFileInfo):void 0},combinator:function(){var a=v.charAt(y);if("/"===a){d();var b=j(/^\/[a-z]+\//i);if(b)return f(),new x.Combinator(b);e()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(y++,"^"===a&&"^"===v.charAt(y)&&(a="^^",y++);h(v,y);)y++;return new x.Combinator(a)}return new x.Combinator(h(v,y-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(b){for(var c,d,e,f,g,h,i,j=y,k=J;(b&&(g=this.extend())||b&&(h=k(/^when/))||(f=this.element()))&&(h?i=m(this.conditions,"expected condition"):i?o("CSS guard can only be used at the end of selector"):g?d?d.push(g):d=[g]:(d&&o("Extend can only be used at the end of selector"),e=v.charAt(y),c?c.push(f):c=[f],f=null),"{"!==e&&"}"!==e&&";"!==e&&","!==e&&")"!==e););return c?new x.Selector(c,d,i,j,a.currentFileInfo):void(d&&o("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(k("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=m(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=j(/^[|~*$^]?=/),c&&(b=d.quoted()||j(/^[0-9]+%/)||j(/^[\w-]+/)||d.variableCurly()),n("]"),new x.Attribute(a,c,b)}},block:function(){var a;return k("{")&&(a=this.primary())&&k("}")?a:void 0},blockRuleset:function(){var a=this.block();return a&&(a=new x.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();return a?new x.DetachedRuleset(a):void 0},ruleset:function(){var b,c,g,h;for(d(),a.dumpLineNumbers&&(h=t(y,v,a));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],this.comments(),c.condition&&b.length>1&&o("Guards are only currently allowed on a single selector."),!k(","))break;c.condition&&o("Guards are only currently allowed on a single selector."),this.comments()}if(b&&(g=this.block())){f();var i=new x.Ruleset(b,g,a.strictImports);return a.dumpLineNumbers&&(i.debugInfo=h),i}A=y,e()},rule:function(b){var c,g,h,i,j,k=y,l=v.charAt(k);if("."!==l&&"#"!==l&&"&"!==l)if(d(),c=this.variable()||this.ruleProperty()){if(j="string"==typeof c,j&&(g=this.detachedRuleset()),this.comments(),g||(g=b||!a.compress&&!j?this.anonymousValue()||this.value():this.value()||this.anonymousValue(),h=this.important(),i=!j&&c.pop().value),g&&this.end())return f(),new x.Rule(c,g,h,i,k,a.currentFileInfo);if(A=y,e(),g&&!b)return this.rule(!0)}else f()},anonymousValue:function(){var a;return a=/^([^@+\/'"*`(;{}-]*);/.exec(C),a?(y+=a[0].length-1,new x.Anonymous(a[1])):void 0},"import":function(){var b,c,d=y,e=j(/^@import?\s+/);if(e){var f=(e?this.importOptions():null)||{};if(b=this.entities.quoted()||this.entities.url())return c=this.mediaFeatures(),i(";")||(y=d,o("missing semi-colon or unrecognised media features on import")),c=c&&new x.Value(c),new x.Import(b,c,f,d,a.currentFileInfo);y=d,o("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!k("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!k(","))break}while(a);return n(")"),d},importOption:function(){var a=j(/^(less|css|multiple|once|inline|reference)/);return a?a[1]:void 0},mediaFeature:function(){var b,c,d=this.entities,e=[];do if(b=d.keyword()||d.variable())e.push(b);else if(k("(")){if(c=this.property(),b=this.value(),!k(")"))return null;if(c&&b)e.push(new x.Paren(new x.Rule(c,b,null,null,y,a.currentFileInfo,!0)));else{if(!b)return null;e.push(new x.Paren(b))}}while(b);return e.length>0?new x.Expression(e):void 0},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!k(","))break}else if(a=b.variable(),a&&(c.push(a),!k(",")))break;while(a);return c.length>0?c:null},media:function(){var b,c,d,e;return a.dumpLineNumbers&&(e=t(y,v,a)),j(/^@media/)&&(b=this.mediaFeatures(),c=this.block())?(d=new x.Media(c,b,y,a.currentFileInfo),a.dumpLineNumbers&&(d.debugInfo=e),d):void 0},directive:function(){var b,c,g,h,i,l,m,n=y,p=!0;if("@"===v.charAt(y)){if(c=this["import"]()||this.media())return c;if(d(),b=j(/^@[a-z-]+/)){switch(h=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(h="@"+b.slice(b.indexOf("-",2)+1)),h){case"@charset":i=!0,p=!1;break;case"@namespace":l=!0,p=!1;break;case"@keyframes":i=!0;break;case"@host":case"@page":case"@document":case"@supports":m=!0}return this.comments(),i?(c=this.entity(),c||o("expected "+b+" identifier")):l?(c=this.expression(),c||o("expected "+b+" expression")):m&&(c=(j(/^[^{;]+/)||"").trim(),c&&(c=new x.Anonymous(c))),this.comments(),p&&(g=this.blockRuleset()),g||!p&&c&&k(";")?(f(),new x.Directive(b,c,g,n,a.currentFileInfo,a.dumpLineNumbers?t(n,v,a):null)):void e()}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!k(",")))break;while(a);return b.length>0?new x.Value(b):void 0},important:function(){return"!"===v.charAt(y)?j(/^! *important/):void 0},sub:function(){var a,b;return k("(")&&(a=this.addition())?(b=new x.Expression([a]),n(")"),b.parens=!0,b):void 0},multiplication:function(){var a,b,c,g,i;if(a=this.operand()){for(i=h(v,y-1);;){if(p(/^\/[*\/]/))break;if(d(),c=k("/")||k("*"),!c){f();break}if(b=this.operand(),!b){e();break}f(),a.parensInOp=!0,b.parensInOp=!0,g=new x.Operation(c,[g||a,b],i),i=h(v,y-1)}return g||a}},addition:function(){var a,b,c,d,e;if(a=this.multiplication()){for(e=h(v,y-1);;){if(c=j(/^[-+]\s+/)||!e&&(k("+")||k("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new x.Operation(c,[d||a,b],e),e=h(v,y-1)}return d||a}},conditions:function(){var a,b,c,d=y;if(a=this.condition()){for(;;){if(!p(/^,\s*(not\s*)?\(/)||!k(","))break;if(b=this.condition(),!b)break;c=new x.Condition("or",c||a,b,d)}return c||a}},condition:function(){var a,b,c,d,e=this.entities,f=y,g=!1;return j(/^not/)&&(g=!0),n("("),a=this.addition()||e.keyword()||e.quoted(),a?(d=j(/^(?:>=|<=|=<|[<=>])/),d?(b=this.addition()||e.keyword()||e.quoted(),b?c=new x.Condition(d,a,b,f,g):o("expected expression")):c=new x.Condition("=",a,new x.Keyword("true"),f,g),n(")"),j(/^and/)?new x.Condition("and",c,this.condition()):c):void 0},operand:function(){var a,b=this.entities,c=v.charAt(y+1);"-"!==v.charAt(y)||"@"!==c&&"("!==c||(a=k("-"));var d=this.sub()||b.dimension()||b.color()||b.variable()||b.call();return a&&(d.parensInOp=!0,d=new x.Negative(d)),d},expression:function(){var a,b,c=[];do a=this.addition()||this.entity(),a&&(c.push(a),p(/^\/[\/*]/)||(b=k("/"),b&&c.push(new x.Anonymous(b))));while(a);return c.length>0?new x.Expression(c):void 0},property:function(){var a=j(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);return a?a[1]:void 0},ruleProperty:function(){function b(a){var b=a.exec(f);return b?(h.push(y+i),i+=b[0].length,f=f.slice(b[1].length),g.push(b[1])):void 0}function c(){var a=/^\s*\/\*(?:[^*]|\*+[^\/*])*\*+\//.exec(f);return a?(i+=a[0].length,f=f.slice(a[0].length),!0):!1}var d,e,f=C,g=[],h=[],i=0;for(b(/^(\*?)/);b(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/););for(;c(););if(g.length>1&&b(/^\s*((?:\+_|\+)?)\s*:/)){for(l(i),""===g[0]&&(g.shift(),h.shift()),e=0;e<g.length;e++)d=g[e],g[e]="@"!==d.charAt(0)?new x.Keyword(d):new x.Variable("@"+d.slice(2,-1),h[e],a.currentFileInfo);return g}}}}},w.Parser.serializeVars=function(a){var b="";for(var c in a)if(Object.hasOwnProperty.call(a,c)){var d=a[c];b+=("@"===c[0]?"":"@")+c+": "+d+(";"===(""+d).slice(-1)?"":";")}return b},function(d){function e(a,b,c){if(!(c instanceof d.Dimension))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d.Dimension(a(parseFloat(c.value)),b)}function f(a,b,c){var e,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;3>l;l++)e=b.rgb[l]/255,f=c.rgb[l]/255,h=a(e,f),g&&(h=(j*f+i*(e-j*(e+f-h)))/g),k[l]=255*h;return new d.Color(k,g)}function g(){var a,b=d.functions;for(a in l)l.hasOwnProperty(a)&&(b[a]=e.bind(null,Math[a],l[a]));for(a in m)m.hasOwnProperty(a)&&(b[a]=f.bind(null,m[a]));a=d.defaultFunc,b["default"]=a.eval.bind(a)}function h(a){return d.functions.hsla(a.h,a.s,a.l,a.a)}function i(a,b){return a instanceof d.Dimension&&a.unit.is("%")?parseFloat(a.value*b/100):j(a)}function j(a){if(a instanceof d.Dimension)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function k(a){return Math.min(1,Math.max(0,a))}d.functions={rgb:function(a,b,c){return this.rgba(a,b,c,1)},rgba:function(a,b,c,e){var f=[a,b,c].methodMap(function(a){return i(a,255)});return e=j(e),new d.Color(f,e)},hsl:function(a,b,c){return this.hsla(a,b,c,1)},hsla:function(a,b,c,d){function e(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?g+(f-g)*a*6:1>2*a?f:2>3*a?g+(f-g)*(2/3-a)*6:g}a=j(a)%360/360,b=k(j(b)),c=k(j(c)),d=k(j(d));var f=.5>=c?c*(b+1):c+b-c*b,g=2*c-f;return this.rgba(255*e(a+1/3),255*e(a),255*e(a-1/3),d)},hsv:function(a,b,c){return this.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=j(a)%360/360*360,b=j(b),c=j(c),d=j(d);var e,f;e=Math.floor(a/60%6),f=a/60-e;var g=[c,c*(1-b),c*(1-f*b),c*(1-(1-f)*b)],h=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(255*g[h[e][0]],255*g[h[e][1]],255*g[h[e][2]],d)},hue:function(a){return new d.Dimension(a.toHSL().h)},saturation:function(a){return new d.Dimension(100*a.toHSL().s,"%")},lightness:function(a){return new d.Dimension(100*a.toHSL().l,"%")},hsvhue:function(a){return new d.Dimension(a.toHSV().h)},hsvsaturation:function(a){return new d.Dimension(100*a.toHSV().s,"%")},hsvvalue:function(a){return new d.Dimension(100*a.toHSV().v,"%")},red:function(a){return new d.Dimension(a.rgb[0])},green:function(a){return new d.Dimension(a.rgb[1])},blue:function(a){return new d.Dimension(a.rgb[2])},alpha:function(a){return new d.Dimension(a.toHSL().a)},luma:function(a){return new d.Dimension(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new d.Dimension(b*a.alpha*100,"%")},saturate:function(a,b){if(!a.rgb)return null;var c=a.toHSL();return c.s+=b.value/100,c.s=k(c.s),h(c)},desaturate:function(a,b){var c=a.toHSL();return c.s-=b.value/100,c.s=k(c.s),h(c)},lighten:function(a,b){var c=a.toHSL();return c.l+=b.value/100,c.l=k(c.l),h(c)},darken:function(a,b){var c=a.toHSL();return c.l-=b.value/100,c.l=k(c.l),h(c)},fadein:function(a,b){var c=a.toHSL();return c.a+=b.value/100,c.a=k(c.a),h(c)},fadeout:function(a,b){var c=a.toHSL();return c.a-=b.value/100,c.a=k(c.a),h(c)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=k(c.a),h(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=0>d?360+d:d,h(c)},mix:function(a,b,c){c||(c=new d.Dimension(50));var e=c.value/100,f=2*e-1,g=a.toHSL().a-b.toHSL().a,h=((f*g==-1?f:(f+g)/(1+f*g))+1)/2,i=1-h,j=[a.rgb[0]*h+b.rgb[0]*i,a.rgb[1]*h+b.rgb[1]*i,a.rgb[2]*h+b.rgb[2]*i],k=a.alpha*e+b.alpha*(1-e);return new d.Color(j,k)},greyscale:function(a){return this.desaturate(a,new d.Dimension(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=this.rgba(255,255,255,1)),"undefined"==typeof b&&(b=this.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:j(d),a.luma()<d?c:b},e:function(a){return new d.Anonymous(a instanceof d.JavaScript?a.evaluated:a.value)},escape:function(a){return new d.Anonymous(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))
+},replace:function(a,b,c,e){var f=a.value;return f=f.replace(new RegExp(b.value,e?e.value:""),c.value),new d.Quoted(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e<b.length;e++)c=c.replace(/%[sda]/i,function(a){var c=a.match(/s/i)?b[e].value:b[e].toCSS();return a.match(/[A-Z]$/)?encodeURIComponent(c):c});return c=c.replace(/%%/g,"%"),new d.Quoted(a.quote||"",c,a.escaped)},unit:function(a,b){if(!(a instanceof d.Dimension))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof d.Operation?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d.Keyword?b.value:b.toCSS():"",new d.Dimension(a.value,b)},convert:function(a,b){return a.convertTo(b.value)},round:function(a,b){var c="undefined"==typeof b?0:b.value;return e(function(a){return a.toFixed(c)},null,a)},pi:function(){return new d.Dimension(Math.PI)},mod:function(a,b){return new d.Dimension(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d.Dimension(a),b=new d.Dimension(b);else if(!(a instanceof d.Dimension&&b instanceof d.Dimension))throw{type:"Argument",message:"arguments must be numbers"};return new d.Dimension(Math.pow(a.value,b.value),a.unit)},_minmax:function(a,c){switch(c=Array.prototype.slice.call(c),c.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var e,f,g,h,i,j,k,l,m=[],n={};for(e=0;e<c.length;e++)if(g=c[e],g instanceof d.Dimension)if(h=""===g.unit.toString()&&l!==b?new d.Dimension(g.value,l).unify():g.unify(),j=""===h.unit.toString()&&k!==b?k:h.unit.toString(),k=""!==j&&k===b||""!==j&&""===m[0].unify().unit.toString()?j:k,l=""!==j&&l===b?g.unit.toString():l,f=n[""]!==b&&""!==j&&j===k?n[""]:n[j],f!==b)i=""===m[f].unit.toString()&&l!==b?new d.Dimension(m[f].value,l).unify():m[f].unify(),(a&&h.value<i.value||!a&&h.value>i.value)&&(m[f]=g);else{if(k!==b&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(c[e].value)&&Array.prototype.push.apply(c,Array.prototype.slice.call(c[e].value));return 1==m.length?m[0]:(c=m.map(function(a){return a.toCSS(this.env)}).join(this.env.compress?",":", "),new d.Anonymous((a?"min":"max")+"("+c+")"))},min:function(){return this._minmax(!0,arguments)},max:function(){return this._minmax(!1,arguments)},"get-unit":function(a){return new d.Anonymous(a.unit)},argb:function(a){return new d.Anonymous(a.toARGB())},percentage:function(a){return new d.Dimension(100*a.value,"%")},color:function(a){if(a instanceof d.Quoted){var b,c=a.value;if(b=d.Color.fromKeyword(c))return b;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(c))return new d.Color(c.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}}throw{type:"Argument",message:"argument must be a string"}},iscolor:function(a){return this._isa(a,d.Color)},isnumber:function(a){return this._isa(a,d.Dimension)},isstring:function(a){return this._isa(a,d.Quoted)},iskeyword:function(a){return this._isa(a,d.Keyword)},isurl:function(a){return this._isa(a,d.URL)},ispixel:function(a){return this.isunit(a,"px")},ispercentage:function(a){return this.isunit(a,"%")},isem:function(a){return this.isunit(a,"em")},isunit:function(a,b){return a instanceof d.Dimension&&a.unit.is(b.value||b)?d.True:d.False},_isa:function(a,b){return a instanceof b?d.True:d.False},tint:function(a,b){return this.mix(this.rgb(255,255,255),a,b)},shade:function(a,b){return this.mix(this.rgb(0,0,0),a,b)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){var b=Array.isArray(a.value)?a.value.length:1;return new d.Dimension(b)},"data-uri":function(b,e){if("undefined"!=typeof a)return new d.URL(e||b,this.currentFileInfo).eval(this.env);var f=b.value,g=e&&e.value,h=c("./fs"),i=c("path"),j=!1;arguments.length<2&&(g=f);var k=g.indexOf("#"),l="";if(-1!==k&&(l=g.slice(k),g=g.slice(0,k)),this.env.isPathRelative(g)&&(g=this.currentFileInfo.relativeUrls?i.join(this.currentFileInfo.currentDirectory,g):i.join(this.currentFileInfo.entryPath,g)),arguments.length<2){var m;try{m=c("mime")}catch(n){m=d._mime}f=m.lookup(g);var o=m.charsets.lookup(f);j=["US-ASCII","UTF-8"].indexOf(o)<0,j&&(f+=";base64")}else j=/;base64$/.test(f);var p=h.readFileSync(g),q=32,r=parseInt(p.length/1024,10);if(r>=q&&this.env.ieCompat!==!1)return this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",g,r,q),new d.URL(e||b,this.currentFileInfo).eval(this.env);p=j?p.toString("base64"):encodeURIComponent(p);var s='"data:'+f+","+p+l+'"';return new d.URL(new d.Anonymous(s))},"svg-gradient":function(a){function e(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"}}arguments.length<3&&e();var f,g,h,i,j,k,l,m=Array.prototype.slice.call(arguments,1),n="linear",o='x="0" y="0" width="1" height="1"',p=!0,q={compress:!1},r=a.toCSS(q);switch(r){case"to bottom":f='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":f='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":f='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":f='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":n="radial",f='cx="50%" cy="50%" r="75%"',o='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(g='<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><'+n+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+f+">",h=0;h<m.length;h+=1)m[h].value?(i=m[h].value[0],j=m[h].value[1]):(i=m[h],j=b),i instanceof d.Color&&((0===h||h+1===m.length)&&j===b||j instanceof d.Dimension)||e(),k=j?j.toCSS(q):0===h?"0%":"100%",l=i.alpha,g+='<stop offset="'+k+'" stop-color="'+i.toRGB()+'"'+(1>l?' stop-opacity="'+l+'"':"")+"/>";if(g+="</"+n+"Gradient><rect "+o+' fill="url(#gradient)" /></svg>',p)try{g=c("./encoder").encodeBase64(g)}catch(s){p=!1}return g="'data:image/svg+xml"+(p?";base64":"")+","+g+"'",new d.URL(new d.Anonymous(g))}},d._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(a){var e=c("path").extname(a),f=d._mime._types[e];if(f===b)throw new Error('Optional dependency "mime" is required for '+e);return f},charsets:{lookup:function(a){return a&&/^text\//.test(a)?"UTF-8":""}}};var l={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"},m={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,1>=a?m.multiply(a,b):m.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return m.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};d.defaultFunc={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;return null!=a?a?d.True:d.False:void 0},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}},g(),d.fround=function(a,b){var c=a&&a.numPrecision;return null==c?b:Number((b+2e-16).toFixed(c))},d.functionCall=function(a,b){this.env=a,this.currentFileInfo=b},d.functionCall.prototype=d.functions}(c("./tree")),function(a){a.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(c("./tree")),function(a){a.debugInfo=function(b,c,d){var e="";if(b.dumpLineNumbers&&!b.compress)switch(b.dumpLineNumbers){case"comments":e=a.debugInfo.asComment(c);break;case"mediaquery":e=a.debugInfo.asMediaQuery(c);break;case"all":e=a.debugInfo.asComment(c)+(d||"")+a.debugInfo.asMediaQuery(c)}return e},a.debugInfo.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},a.debugInfo.asMediaQuery=function(a){return"@media -sass-debug-info{filename{font-family:"+("file://"+a.debugInfo.fileName).replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},a.find=function(a,b){for(var c,d=0;d<a.length;d++)if(c=b.call(a,a[d]))return c;return null},a.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},a.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},a.outputRuleset=function(a,b,c){var d,e=c.length;if(a.tabLevel=(0|a.tabLevel)+1,a.compress){for(b.add("{"),d=0;e>d;d++)c[d].genCSS(a,b);return b.add("}"),void a.tabLevel--}var f="\n"+Array(a.tabLevel).join("  "),g=f+"  ";if(e){for(b.add(" {"+g),c[0].genCSS(a,b),d=1;e>d;d++)b.add(g),c[d].genCSS(a,b);b.add(f+"}")}else b.add(" {"+f+"}");a.tabLevel--}}(c("./tree")),function(a){a.Alpha=function(a){this.value=a},a.Alpha.prototype={type:"Alpha",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Alpha(this.value.eval(b)):this},genCSS:function(a,b){b.add("alpha(opacity="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value),b.add(")")},toCSS:a.toCSS}}(c("../tree")),function(a){a.Anonymous=function(a,b,c,d,e){this.value=a,this.index=b,this.mapLines=d,this.currentFileInfo=c,this.rulesetLike="undefined"==typeof e?!1:e},a.Anonymous.prototype={type:"Anonymous",eval:function(){return new a.Anonymous(this.value,this.index,this.currentFileInfo,this.mapLines,this.rulesetLike)},compare:function(a){if(!a.toCSS)return-1;var b=this.toCSS(),c=a.toCSS();return b===c?0:c>b?-1:1},isRulesetLike:function(){return this.rulesetLike},genCSS:function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Assignment=function(a,b){this.key=a,this.value=b},a.Assignment.prototype={type:"Assignment",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Assignment(this.key,this.value.eval(b)):this},genCSS:function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Call=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d},a.Call.prototype={type:"Call",accept:function(a){this.args&&(this.args=a.visitArray(this.args))},eval:function(b){var c,d,e=this.args.map(function(a){return a.eval(b)}),f=this.name.toLowerCase();if(f in a.functions)try{if(d=new a.functionCall(b,this.currentFileInfo),c=d[f].apply(d,e),null!=c)return c}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}return new a.Call(this.name,e,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;c<this.args.length;c++)this.args[c].genCSS(a,b),c+1<this.args.length&&b.add(", ");b.add(")")},toCSS:a.toCSS}}(c("../tree")),function(a){function b(a){return"#"+a.map(function(a){return a=c(Math.round(a),255),(16>a?"0":"")+a.toString(16)}).join("")}function c(a,b){return Math.min(Math.max(a,0),b)}a.Color=function(a,b){this.rgb=Array.isArray(a)?a:6==a.length?a.match(/.{2}/g).map(function(a){return parseInt(a,16)}):a.split("").map(function(a){return parseInt(a+a,16)}),this.alpha="number"==typeof b?b:1};var d="transparent";a.Color.prototype={type:"Color",eval:function(){return this},luma:function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255;return a=.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4),b=.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4),c=.03928>=c?c/12.92:Math.pow((c+.055)/1.055,2.4),.2126*a+.7152*b+.0722*c},genCSS:function(a,b){b.add(this.toCSS(a))},toCSS:function(b,e){var f=b&&b.compress&&!e,g=a.fround(b,this.alpha);if(1>g)return 0===g&&this.isTransparentKeyword?d:"rgba("+this.rgb.map(function(a){return c(Math.round(a),255)}).concat(c(g,1)).join(","+(f?"":" "))+")";var h=this.toRGB();if(f){var i=h.split("");i[1]===i[2]&&i[3]===i[4]&&i[5]===i[6]&&(h="#"+i[1]+i[3]+i[5])}return h},operate:function(b,c,d){for(var e=[],f=this.alpha*(1-d.alpha)+d.alpha,g=0;3>g;g++)e[g]=a.operate(b,c,this.rgb[g],d.rgb[g]);return new a.Color(e,f)},toRGB:function(){return b(this.rgb)},toHSL:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},toHSV:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},toARGB:function(){return b([255*this.alpha].concat(this.rgb))},compare:function(a){return a.rgb&&a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:-1}},a.Color.fromKeyword=function(b){if(b=b.toLowerCase(),a.colors.hasOwnProperty(b))return new a.Color(a.colors[b].slice(1));if(b===d){var c=new a.Color([0,0,0],0);return c.isTransparentKeyword=!0,c}}}(c("../tree")),function(a){a.Comment=function(a,b,c,d){this.value=a,this.silent=!!b,this.currentFileInfo=d},a.Comment.prototype={type:"Comment",genCSS:function(b,c){this.debugInfo&&c.add(a.debugInfo(b,this),this.currentFileInfo,this.index),c.add(this.value.trim())},toCSS:a.toCSS,isSilent:function(a){var b=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,c=a.compress&&!this.value.match(/^\/\*!/);return this.silent||b||c},eval:function(){return this},markReferenced:function(){this.isReferenced=!0}}}(c("../tree")),function(a){a.Condition=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e},a.Condition.prototype={type:"Condition",accept:function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},eval:function(a){var b,c=this.lvalue.eval(a),d=this.rvalue.eval(a),e=this.index;return b=function(a){switch(a){case"and":return c&&d;case"or":return c||d;default:if(c.compare)b=c.compare(d);else{if(!d.compare)throw{type:"Type",message:"Unable to perform comparison",index:e};b=d.compare(c)}switch(b){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a}}}(this.op),this.negate?!b:b}}}(c("../tree")),function(a){a.DetachedRuleset=function(a,b){this.ruleset=a,this.frames=b},a.DetachedRuleset.prototype={type:"DetachedRuleset",accept:function(a){this.ruleset=a.visit(this.ruleset)},eval:function(b){var c=this.frames||b.frames.slice(0);return new a.DetachedRuleset(this.ruleset,c)},callEval:function(b){return this.ruleset.eval(this.frames?new a.evalEnv(b,this.frames.concat(b.frames)):b)}}}(c("../tree")),function(a){a.Dimension=function(c,d){this.value=parseFloat(c),this.unit=d&&d instanceof a.Unit?d:new a.Unit(d?[d]:b)},a.Dimension.prototype={type:"Dimension",accept:function(a){this.unit=a.visit(this.unit)},eval:function(){return this},toColor:function(){return new a.Color([this.value,this.value,this.value])},genCSS:function(b,c){if(b&&b.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var d=a.fround(b,this.value),e=String(d);if(0!==d&&1e-6>d&&d>-1e-6&&(e=d.toFixed(20).replace(/0+$/,"")),b&&b.compress){if(0===d&&this.unit.isLength())return void c.add(e);d>0&&1>d&&(e=e.substr(1))}c.add(e),this.unit.genCSS(b,c)},toCSS:a.toCSS,operate:function(b,c,d){var e=a.operate(b,c,this.value,d.value),f=this.unit.clone();if("+"===c||"-"===c)if(0===f.numerator.length&&0===f.denominator.length)f.numerator=d.unit.numerator.slice(0),f.denominator=d.unit.denominator.slice(0);else if(0===d.unit.numerator.length&&0===f.denominator.length);else{if(d=d.convertTo(this.unit.usedUnits()),b.strictUnits&&d.unit.toString()!==f.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+f.toString()+"' and '"+d.unit.toString()+"'.");e=a.operate(b,c,this.value,d.value)}else"*"===c?(f.numerator=f.numerator.concat(d.unit.numerator).sort(),f.denominator=f.denominator.concat(d.unit.denominator).sort(),f.cancel()):"/"===c&&(f.numerator=f.numerator.concat(d.unit.denominator).sort(),f.denominator=f.denominator.concat(d.unit.numerator).sort(),f.cancel());return new a.Dimension(e,f)},compare:function(b){if(b instanceof a.Dimension){var c,d,e,f;if(this.unit.isEmpty()||b.unit.isEmpty())c=this,d=b;else if(c=this.unify(),d=b.unify(),0!==c.unit.compare(d.unit))return-1;return e=c.value,f=d.value,f>e?-1:e>f?1:0}return-1},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(b){var c,d,e,f,g,h=this.value,i=this.unit.clone(),j={};if("string"==typeof b){for(c in a.UnitConversions)a.UnitConversions[c].hasOwnProperty(b)&&(j={},j[c]=b);b=j}g=function(a,b){return e.hasOwnProperty(a)?(b?h/=e[a]/e[f]:h*=e[a]/e[f],f):a};for(d in b)b.hasOwnProperty(d)&&(f=b[d],e=a.UnitConversions[d],i.map(g));return i.cancel(),new a.Dimension(h,i)}},a.UnitConversions={length:{m:1,cm:.01,mm:.001,"in":.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}},a.Unit=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],this.backupUnit=c},a.Unit.prototype={type:"Unit",clone:function(){return new a.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},genCSS:function(a,b){this.numerator.length>=1?b.add(this.numerator[0]):this.denominator.length>=1?b.add(this.denominator[0]):a&&a.strictUnits||!this.backupUnit||b.add(this.backupUnit)},toCSS:a.toCSS,toString:function(){var a,b=this.numerator.join("*");for(a=0;a<this.denominator.length;a++)b+="/"+this.denominator[a];return b},compare:function(a){return this.is(a.toString())?0:-1},is:function(a){return this.toString()===a},isLength:function(){return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/))},isEmpty:function(){return 0===this.numerator.length&&0===this.denominator.length},isSingular:function(){return this.numerator.length<=1&&0===this.denominator.length},map:function(a){var b;for(b=0;b<this.numerator.length;b++)this.numerator[b]=a(this.numerator[b],!1);for(b=0;b<this.denominator.length;b++)this.denominator[b]=a(this.denominator[b],!0)},usedUnits:function(){var b,c,d={};c=function(a){return b.hasOwnProperty(a)&&!d[e]&&(d[e]=a),a};for(var e in a.UnitConversions)a.UnitConversions.hasOwnProperty(e)&&(b=a.UnitConversions[e],this.map(c));return d},cancel:function(){var a,b,c,d={};for(b=0;b<this.numerator.length;b++)a=this.numerator[b],c||(c=a),d[a]=(d[a]||0)+1;for(b=0;b<this.denominator.length;b++)a=this.denominator[b],c||(c=a),d[a]=(d[a]||0)-1;this.numerator=[],this.denominator=[];for(a in d)if(d.hasOwnProperty(a)){var e=d[a];if(e>0)for(b=0;e>b;b++)this.numerator.push(a);else if(0>e)for(b=0;-e>b;b++)this.denominator.push(a)}0===this.numerator.length&&0===this.denominator.length&&c&&(this.backupUnit=c),this.numerator.sort(),this.denominator.sort()}}}(c("../tree")),function(a){a.Directive=function(a,b,c,d,e,f){this.name=a,this.value=b,c&&(this.rules=c,this.rules.allowImports=!0),this.index=d,this.currentFileInfo=e,this.debugInfo=f},a.Directive.prototype={type:"Directive",accept:function(a){var b=this.value,c=this.rules;c&&(c=a.visit(c)),b&&(b=a.visit(b))},isRulesetLike:function(){return!this.isCharset()},isCharset:function(){return"@charset"===this.name},genCSS:function(b,c){var d=this.value,e=this.rules;c.add(this.name,this.currentFileInfo,this.index),d&&(c.add(" "),d.genCSS(b,c)),e?a.outputRuleset(b,c,[e]):c.add(";")},toCSS:a.toCSS,eval:function(b){var c=this.value,d=this.rules;return c&&(c=c.eval(b)),d&&(d=d.eval(b),d.root=!0),new a.Directive(this.name,c,d,this.index,this.currentFileInfo,this.debugInfo)},variable:function(b){return this.rules?a.Ruleset.prototype.variable.call(this.rules,b):void 0},find:function(){return this.rules?a.Ruleset.prototype.find.apply(this.rules,arguments):void 0},rulesets:function(){return this.rules?a.Ruleset.prototype.rulesets.apply(this.rules):void 0},markReferenced:function(){var a,b;if(this.isReferenced=!0,this.rules)for(b=this.rules.rules,a=0;a<b.length;a++)b[a].markReferenced&&b[a].markReferenced()}}}(c("../tree")),function(a){a.Element=function(b,c,d,e){this.combinator=b instanceof a.Combinator?b:new a.Combinator(b),this.value="string"==typeof c?c.trim():c?c:"",this.index=d,this.currentFileInfo=e},a.Element.prototype={type:"Element",accept:function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},eval:function(b){return new a.Element(this.combinator,this.value.eval?this.value.eval(b):this.value,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},toCSS:function(a){var b=this.value.toCSS?this.value.toCSS(a):this.value;return""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a||{})+b}},a.Attribute=function(a,b,c){this.key=a,this.op=b,this.value=c},a.Attribute.prototype={type:"Attribute",eval:function(b){return new a.Attribute(this.key.eval?this.key.eval(b):this.key,this.op,this.value&&this.value.eval?this.value.eval(b):this.value)},genCSS:function(a,b){b.add(this.toCSS(a))},toCSS:function(a){var b=this.key.toCSS?this.key.toCSS(a):this.key;return this.op&&(b+=this.op,b+=this.value.toCSS?this.value.toCSS(a):this.value),"["+b+"]"}},a.Combinator=function(a){this.value=" "===a?" ":a?a.trim():""},a.Combinator.prototype={type:"Combinator",_noSpaceCombinators:{"":!0," ":!0,"|":!0},genCSS:function(a,b){var c=a.compress||this._noSpaceCombinators[this.value]?"":" ";b.add(c+this.value+c)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Expression=function(a){this.value=a},a.Expression.prototype={type:"Expression",accept:function(a){this.value&&(this.value=a.visitArray(this.value))},eval:function(b){var c,d=this.parens&&!this.parensInOp,e=!1;return d&&b.inParenthesis(),this.value.length>1?c=new a.Expression(this.value.map(function(a){return a.eval(b)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(e=!0),c=this.value[0].eval(b)):c=this,d&&b.outOfParenthesis(),this.parens&&this.parensInOp&&!b.isMathOn()&&!e&&(c=new a.Paren(c)),c},genCSS:function(a,b){for(var c=0;c<this.value.length;c++)this.value[c].genCSS(a,b),c+1<this.value.length&&b.add(" ")},toCSS:a.toCSS,throwAwayComments:function(){this.value=this.value.filter(function(b){return!(b instanceof a.Comment)})}}}(c("../tree")),function(a){a.Extend=function(b,c,d){switch(this.selector=b,this.option=c,this.index=d,this.object_id=a.Extend.next_id++,this.parent_ids=[this.object_id],c){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}},a.Extend.next_id=0,a.Extend.prototype={type:"Extend",accept:function(a){this.selector=a.visit(this.selector)},eval:function(b){return new a.Extend(this.selector.eval(b),this.option,this.index)},clone:function(){return new a.Extend(this.selector,this.option,this.index)},findSelfSelectors:function(a){var b,c,d=[];for(b=0;b<a.length;b++)c=a[b].elements,b>0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[{elements:d}]}}}(c("../tree")),function(a){a.Import=function(a,c,d,e,f){if(this.options=d,this.index=e,this.path=a,this.features=c,this.currentFileInfo=f,this.options.less!==b||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/css([\?;].*)?$/.test(g)&&(this.css=!0)}},a.Import.prototype={type:"Import",accept:function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),!this.options.inline&&this.root&&(this.root=a.visit(this.root))},genCSS:function(a,b){this.css&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},toCSS:a.toCSS,getPath:function(){if(this.path instanceof a.Quoted){var c=this.path.value;return this.css!==b||/(\.[a-z]*$)|([\?;].*)$/.test(c)?c:c+".less"}return this.path instanceof a.URL?this.path.value.value:null},evalForImport:function(b){return new a.Import(this.path.eval(b),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(b){var c=this.path.eval(b),d=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(c instanceof a.URL)){if(d){var e=c.value;e&&b.isPathRelative(e)&&(c.value=d+e)}c.value=b.normalizePath(c.value)}return c},eval:function(b){var c,d=this.features&&this.features.eval(b);if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var e=new a.Anonymous(this.root,0,{filename:this.importedFilename},!0,!0);return this.features?new a.Media([e],this.features.value):[e]}if(this.css){var f=new a.Import(this.evalPath(b),d,this.options,this.index);if(!f.css&&this.error)throw this.error;return f}return c=new a.Ruleset(null,this.root.rules.slice(0)),c.evalImports(b),this.features?new a.Media(c.rules,this.features.value):c.rules}}}(c("../tree")),function(a){a.JavaScript=function(a,b,c){this.escaped=c,this.expression=a,this.index=b},a.JavaScript.prototype={type:"JavaScript",eval:function(b){var c,d=this,e={},f=this.expression.replace(/@\{([\w-]+)\}/g,function(c,e){return a.jsify(new a.Variable("@"+e,d.index).eval(b))});try{f=new Function("return ("+f+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+f+"`",index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(e[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=f.call(e)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",index:this.index}}return"number"==typeof c?new a.Dimension(c):"string"==typeof c?new a.Quoted('"'+c+'"',c,this.escaped,this.index):new a.Anonymous(Array.isArray(c)?c.join(", "):c)}}}(c("../tree")),function(a){a.Keyword=function(a){this.value=a},a.Keyword.prototype={type:"Keyword",eval:function(){return this},genCSS:function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},toCSS:a.toCSS,compare:function(b){return b instanceof a.Keyword?b.value===this.value?0:1:-1}},a.True=new a.Keyword("true"),a.False=new a.Keyword("false")}(c("../tree")),function(a){a.Media=function(b,c,d,e){this.index=d,this.currentFileInfo=e;var f=this.emptySelectors();this.features=new a.Value(c),this.rules=[new a.Ruleset(f,b)],this.rules[0].allowImports=!0},a.Media.prototype={type:"Media",accept:function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},genCSS:function(b,c){c.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(b,c),a.outputRuleset(b,c,this.rules)},toCSS:a.toCSS,eval:function(b){b.mediaBlocks||(b.mediaBlocks=[],b.mediaPath=[]);var c=new a.Media(null,[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,c.debugInfo=this.debugInfo);var d=!1;b.strictMath||(d=!0,b.strictMath=!0);try{c.features=this.features.eval(b)}finally{d&&(b.strictMath=!1)}return b.mediaPath.push(c),b.mediaBlocks.push(c),b.frames.unshift(this.rules[0]),c.rules=[this.rules[0].eval(b)],b.frames.shift(),b.mediaPath.pop(),0===b.mediaPath.length?c.evalTop(b):c.evalNested(b)},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},emptySelectors:function(){var b=new a.Element("","&",this.index,this.currentFileInfo),c=[new a.Selector([b],null,null,this.index,this.currentFileInfo)];return c[0].mediaEmpty=!0,c},markReferenced:function(){var a,b=this.rules[0].rules;for(this.rules[0].markReferenced(),this.isReferenced=!0,a=0;a<b.length;a++)b[a].markReferenced&&b[a].markReferenced()},evalTop:function(b){var c=this;if(b.mediaBlocks.length>1){var d=this.emptySelectors();c=new a.Ruleset(d,b.mediaBlocks),c.multiMedia=!0}return delete b.mediaBlocks,delete b.mediaPath,c},evalNested:function(b){var c,d,e=b.mediaPath.concat([this]);for(c=0;c<e.length;c++)d=e[c].features instanceof a.Value?e[c].features.value:e[c].features,e[c]=Array.isArray(d)?d:[d];return this.features=new a.Value(this.permute(e).map(function(b){for(b=b.map(function(b){return b.toCSS?b:new a.Anonymous(b)}),c=b.length-1;c>0;c--)b.splice(c,0,new a.Anonymous("and"));return new a.Expression(b)})),new a.Ruleset([],[])},permute:function(a){if(0===a.length)return[];
+if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d<c.length;d++)for(var e=0;e<a[0].length;e++)b.push([a[0][e]].concat(c[d]));return b},bubbleSelectors:function(b){b&&(this.rules=[new a.Ruleset(b.slice(0),[this.rules[0]])])}}}(c("../tree")),function(a){a.mixin={},a.mixin.Call=function(b,c,d,e,f){this.selector=new a.Selector(b),this.arguments=c&&c.length?c:null,this.index=d,this.currentFileInfo=e,this.important=f},a.mixin.Call.prototype={type:"MixinCall",accept:function(a){this.selector&&(this.selector=a.visit(this.selector)),this.arguments&&(this.arguments=a.visitArray(this.arguments))},eval:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p=[],q=!1,r=[],s=[],t=a.defaultFunc,u=0,v=1,w=2;for(e=this.arguments&&this.arguments.map(function(a){return{name:a.name,value:a.value.eval(b)}}),f=0;f<b.frames.length;f++)if((c=b.frames[f].find(this.selector)).length>0){for(j=!0,g=0;g<c.length;g++){for(d=c[g],i=!1,h=0;h<b.frames.length;h++)if(!(d instanceof a.mixin.Definition)&&d===(b.frames[h].originalRuleset||b.frames[h])){i=!0;break}if(!i&&d.matchArgs(e,b)){if(l={mixin:d,group:u},d.matchCondition){for(h=0;2>h;h++)t.value(h),s[h]=d.matchCondition(e,b);(s[0]||s[1])&&(s[0]!=s[1]&&(l.group=s[1]?v:w),r.push(l))}else r.push(l);q=!0}}for(t.reset(),n=[0,0,0],g=0;g<r.length;g++)n[r[g].group]++;if(n[u]>0)m=w;else if(m=v,n[v]+n[w]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename};for(g=0;g<r.length;g++)if(l=r[g].group,l===u||l===m)try{d=r[g].mixin,d instanceof a.mixin.Definition||(o=d.originalRuleset||d,d=new a.mixin.Definition("",[],d.rules,null,!1),d.originalRuleset=o),Array.prototype.push.apply(p,d.evalCall(b,e,this.important).rules)}catch(x){throw{message:x.message,index:this.index,filename:this.currentFileInfo.filename,stack:x.stack}}if(q){if(!this.currentFileInfo||!this.currentFileInfo.reference)for(f=0;f<p.length;f++)k=p[f],k.markReferenced&&k.markReferenced();return p}}throw j?{type:"Runtime",message:"No matching definition was found for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}},format:function(a){return this.selector.toCSS().trim()+"("+(a?a.map(function(a){var b="";return a.name&&(b+=a.name+":"),b+=a.value.toCSS?a.value.toCSS():"???"}).join(", "):"")+")"}},a.mixin.Definition=function(b,c,d,e,f,g){this.name=b,this.selectors=[new a.Selector([new a.Element(null,b,this.index,this.currentFileInfo)])],this.params=c,this.condition=e,this.variadic=f,this.arity=c.length,this.rules=d,this._lookups={},this.required=c.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:a},0),this.parent=a.Ruleset.prototype,this.frames=g},a.mixin.Definition.prototype={type:"MixinDefinition",accept:function(a){this.params&&this.params.length&&(this.params=a.visitArray(this.params)),this.rules=a.visitArray(this.rules),this.condition&&(this.condition=a.visit(this.condition))},variable:function(a){return this.parent.variable.call(this,a)},variables:function(){return this.parent.variables.call(this)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},evalParams:function(b,c,d,e){var f,g,h,i,j,k,l,m,n=new a.Ruleset(null,null),o=this.params.slice(0),p=0;if(c=new a.evalEnv(c,[n].concat(c.frames)),d)for(d=d.slice(0),p=d.length,h=0;p>h;h++)if(g=d[h],k=g&&g.name){for(l=!1,i=0;i<o.length;i++)if(!e[i]&&k===o[i].name){e[i]=g.value.eval(b),n.prependRule(new a.Rule(k,g.value.eval(b))),l=!0;break}if(l){d.splice(h,1),h--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+d[h].name+" not found"}}for(m=0,h=0;h<o.length;h++)if(!e[h]){if(g=d&&d[m],k=o[h].name)if(o[h].variadic){for(f=[],i=m;p>i;i++)f.push(d[i].value.eval(b));n.prependRule(new a.Rule(k,new a.Expression(f).eval(b)))}else{if(j=g&&g.value)j=j.eval(b);else{if(!o[h].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+p+" for "+this.arity+")"};j=o[h].value.eval(c),n.resetCache()}n.prependRule(new a.Rule(k,j)),e[h]=j}if(o[h].variadic&&d)for(i=m;p>i;i++)e[i]=d[i].value.eval(b);m++}return n},eval:function(b){return new a.mixin.Definition(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||b.frames.slice(0))},evalCall:function(b,c,d){var e,f,g=[],h=this.frames?this.frames.concat(b.frames):b.frames,i=this.evalParams(b,new a.evalEnv(b,h),c,g);return i.prependRule(new a.Rule("@arguments",new a.Expression(g).eval(b))),e=this.rules.slice(0),f=new a.Ruleset(null,e),f.originalRuleset=this,f=f.eval(new a.evalEnv(b,[this,i].concat(h))),d&&(f=this.parent.makeImportant.apply(f)),f},matchCondition:function(b,c){return this.condition&&!this.condition.eval(new a.evalEnv(c,[this.evalParams(c,new a.evalEnv(c,this.frames?this.frames.concat(c.frames):c.frames),b,[])].concat(this.frames).concat(c.frames)))?!1:!0},matchArgs:function(a,b){var c,d=a&&a.length||0;if(this.variadic){if(d<this.required-1)return!1}else{if(d<this.required)return!1;if(d>this.params.length)return!1}c=Math.min(d,this.arity);for(var e=0;c>e;e++)if(!this.params[e].name&&!this.params[e].variadic&&a[e].value.eval(b).toCSS()!=this.params[e].value.eval(b).toCSS())return!1;return!0}}}(c("../tree")),function(a){a.Negative=function(a){this.value=a},a.Negative.prototype={type:"Negative",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("-"),this.value.genCSS(a,b)},toCSS:a.toCSS,eval:function(b){return b.isMathOn()?new a.Operation("*",[new a.Dimension(-1),this.value]).eval(b):new a.Negative(this.value.eval(b))}}}(c("../tree")),function(a){a.Operation=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c},a.Operation.prototype={type:"Operation",accept:function(a){this.operands=a.visit(this.operands)},eval:function(b){var c=this.operands[0].eval(b),d=this.operands[1].eval(b);if(b.isMathOn()){if(c instanceof a.Dimension&&d instanceof a.Color&&(c=c.toColor()),d instanceof a.Dimension&&c instanceof a.Color&&(d=d.toColor()),!c.operate)throw{type:"Operation",message:"Operation on an invalid type"};return c.operate(b,this.op,d)}return new a.Operation(this.op,[c,d],this.isSpaced)},genCSS:function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},toCSS:a.toCSS},a.operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}}}(c("../tree")),function(a){a.Paren=function(a){this.value=a},a.Paren.prototype={type:"Paren",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){return new a.Paren(this.value.eval(b))}}}(c("../tree")),function(a){a.Quoted=function(a,b,c,d,e){this.escaped=c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e},a.Quoted.prototype={type:"Quoted",genCSS:function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},toCSS:a.toCSS,eval:function(b){var c=this,d=this.value.replace(/`([^`]+)`/g,function(d,e){return new a.JavaScript(e,c.index,!0).eval(b).value}).replace(/@\{([\w-]+)\}/g,function(d,e){var f=new a.Variable("@"+e,c.index,c.currentFileInfo).eval(b,!0);return f instanceof a.Quoted?f.value:f.toCSS()});return new a.Quoted(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},compare:function(a){if(!a.toCSS)return-1;var b,c;return"Quoted"!==a.type||this.escaped||a.escaped?(b=this.toCSS(),c=a.toCSS()):(b=a.value,c=this.value),b===c?0:c>b?-1:1}}}(c("../tree")),function(a){function c(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;e>c;c++)b[c].eval(a).genCSS(a,f);return d}a.Rule=function(c,d,e,f,g,h,i,j){this.name=c,this.value=d instanceof a.Value||d instanceof a.Ruleset?d:new a.Value([d]),this.important=e?" "+e.trim():"",this.merge=f,this.index=g,this.currentFileInfo=h,this.inline=i||!1,this.variable=j!==b?j:c.charAt&&"@"===c.charAt(0)},a.Rule.prototype={type:"Rule",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},toCSS:a.toCSS,eval:function(b){var d,e=!1,f=this.name,g=this.variable;"string"!=typeof f&&(f=1===f.length&&f[0]instanceof a.Keyword?f[0].value:c(b,f),g=!1),"font"!==f||b.strictMath||(e=!0,b.strictMath=!0);try{if(d=this.value.eval(b),!this.variable&&"DetachedRuleset"===d.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};return new a.Rule(f,d,this.important,this.merge,this.index,this.currentFileInfo,this.inline,g)}catch(h){throw"number"!=typeof h.index&&(h.index=this.index,h.filename=this.currentFileInfo.filename),h}finally{e&&(b.strictMath=!1)}},makeImportant:function(){return new a.Rule(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)}}}(c("../tree")),function(a){a.RulesetCall=function(a){this.variable=a},a.RulesetCall.prototype={type:"RulesetCall",accept:function(){},eval:function(b){var c=new a.Variable(this.variable).eval(b);return c.callEval(b)}}}(c("../tree")),function(a){a.Ruleset=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c},a.Ruleset.prototype={type:"Ruleset",accept:function(a){this.paths?a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},eval:function(b){var c,d,e,f,g=this.selectors,h=a.defaultFunc,i=!1;if(g&&(d=g.length)){for(c=[],h.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),f=0;d>f;f++)e=g[f].eval(b),c.push(e),e.evaldCondition&&(i=!0);h.reset()}else i=!0;var j,k,l=this.rules?this.rules.slice(0):null,m=new a.Ruleset(c,l,this.strictImports);m.originalRuleset=this,m.root=this.root,m.firstRoot=this.firstRoot,m.allowImports=this.allowImports,this.debugInfo&&(m.debugInfo=this.debugInfo),i||(l.length=0);var n=b.frames;n.unshift(m);var o=b.selectors;o||(b.selectors=o=[]),o.unshift(this.selectors),(m.root||m.allowImports||!m.strictImports)&&m.evalImports(b);var p=m.rules,q=p?p.length:0;for(f=0;q>f;f++)(p[f]instanceof a.mixin.Definition||p[f]instanceof a.DetachedRuleset)&&(p[f]=p[f].eval(b));var r=b.mediaBlocks&&b.mediaBlocks.length||0;for(f=0;q>f;f++)p[f]instanceof a.mixin.Call?(l=p[f].eval(b).filter(function(b){return b instanceof a.Rule&&b.variable?!m.variable(b.name):!0}),p.splice.apply(p,[f,1].concat(l)),q+=l.length-1,f+=l.length-1,m.resetCache()):p[f]instanceof a.RulesetCall&&(l=p[f].eval(b).rules.filter(function(b){return b instanceof a.Rule&&b.variable?!1:!0}),p.splice.apply(p,[f,1].concat(l)),q+=l.length-1,f+=l.length-1,m.resetCache());for(f=0;f<p.length;f++)j=p[f],j instanceof a.mixin.Definition||j instanceof a.DetachedRuleset||(p[f]=j=j.eval?j.eval(b):j);for(f=0;f<p.length;f++)if(j=p[f],j instanceof a.Ruleset&&j.selectors&&1===j.selectors.length&&j.selectors[0].isJustParentSelector()){p.splice(f--,1);for(var s=0;s<j.rules.length;s++)k=j.rules[s],k instanceof a.Rule&&k.variable||p.splice(++f,0,k)}if(n.shift(),o.shift(),b.mediaBlocks)for(f=r;f<b.mediaBlocks.length;f++)b.mediaBlocks[f].bubbleSelectors(c);return m},evalImports:function(b){var c,d,e=this.rules;if(e)for(c=0;c<e.length;c++)e[c]instanceof a.Import&&(d=e[c].eval(b),d&&d.length?(e.splice.apply(e,[c,1].concat(d)),c+=d.length-1):e.splice(c,1,d),this.resetCache())},makeImportant:function(){return new a.Ruleset(this.selectors,this.rules.map(function(a){return a.makeImportant?a.makeImportant():a}),this.strictImports)},matchArgs:function(a){return!a||0===a.length},matchCondition:function(b,c){var d=this.selectors[this.selectors.length-1];return d.evaldCondition?d.condition&&!d.condition.eval(new a.evalEnv(c,c.frames))?!1:!0:!1},resetCache:function(){this._rulesets=null,this._variables=null,this._lookups={}},variables:function(){return this._variables||(this._variables=this.rules?this.rules.reduce(function(b,c){return c instanceof a.Rule&&c.variable===!0&&(b[c.name]=c),b},{}):{}),this._variables},variable:function(a){return this.variables()[a]},rulesets:function(){if(!this.rules)return null;var b,c,d=a.Ruleset,e=a.mixin.Definition,f=[],g=this.rules,h=g.length;for(b=0;h>b;b++)c=g[b],(c instanceof d||c instanceof e)&&f.push(c);return f},prependRule:function(a){var b=this.rules;b?b.unshift(a):this.rules=[a]},find:function(b,c){c=c||this;var d,e=[],f=b.toCSS();return f in this._lookups?this._lookups[f]:(this.rulesets().forEach(function(f){if(f!==c)for(var g=0;g<f.selectors.length;g++)if(d=b.match(f.selectors[g])){b.elements.length>d?Array.prototype.push.apply(e,f.find(new a.Selector(b.elements.slice(d)),c)):e.push(f);break}}),this._lookups[f]=e,e)},genCSS:function(b,c){function d(b,c){return b.rules?!0:b instanceof a.Media||c&&b instanceof a.Comment?!0:b instanceof a.Directive||b instanceof a.Anonymous?b.isRulesetLike():!1}var e,f,g,h,i,j,k=[],l=[],m=[];b.tabLevel=b.tabLevel||0,this.root||b.tabLevel++;var n,o=b.compress?"":Array(b.tabLevel+1).join("  "),p=b.compress?"":Array(b.tabLevel).join("  ");for(e=0;e<this.rules.length;e++)i=this.rules[e],d(i,this.root)?m.push(i):i.isCharset&&i.isCharset()?k.push(i):l.push(i);if(l=k.concat(l),!this.root){h=a.debugInfo(b,this,p),h&&(c.add(h),c.add(p));var q,r=this.paths,s=r.length;for(n=b.compress?",":",\n"+p,e=0;s>e;e++)if(j=r[e],q=j.length)for(e>0&&c.add(n),b.firstSelector=!0,j[0].genCSS(b,c),b.firstSelector=!1,f=1;q>f;f++)j[f].genCSS(b,c);c.add((b.compress?"{":" {\n")+o)}for(e=0;e<l.length;e++)i=l[e],e+1!==l.length||this.root&&0!==m.length&&!this.firstRoot||(b.lastRule=!0),i.genCSS?i.genCSS(b,c):i.value&&c.add(i.value.toString()),b.lastRule?b.lastRule=!1:c.add(b.compress?"":"\n"+o);if(this.root||(c.add(b.compress?"}":"\n"+p+"}"),b.tabLevel--),n=(b.compress?"":"\n")+(this.root?o:p),g=m.length)for(l.length&&n&&c.add(n),m[0].genCSS(b,c),e=1;g>e;e++)n&&c.add(n),m[e].genCSS(b,c);c.isEmpty()||b.compress||!this.firstRoot||c.add("\n")},toCSS:a.toCSS,markReferenced:function(){if(this.selectors)for(var a=0;a<this.selectors.length;a++)this.selectors[a].markReferenced()},joinSelectors:function(a,b,c){for(var d=0;d<c.length;d++)this.joinSelector(a,b,c[d])},joinSelector:function(b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;for(e=0;e<d.elements.length;e++)j=d.elements[e],"&"===j.value&&(h=!0);if(h){for(r=[],i=[[]],e=0;e<d.elements.length;e++)if(j=d.elements[e],"&"!==j.value)r.push(j);else{for(s=[],r.length>0&&this.mergeElementsOnToSelectors(r,i),f=0;f<i.length;f++)if(k=i[f],0===c.length)k.length>0&&(k[0].elements=k[0].elements.slice(0),k[0].elements.push(new a.Element(j.combinator,"",j.index,j.currentFileInfo))),s.push(k);else for(g=0;g<c.length;g++)l=c[g],m=[],n=[],p=!0,k.length>0?(m=k.slice(0),q=m.pop(),o=d.createDerived(q.elements.slice(0)),p=!1):o=d.createDerived([]),l.length>1&&(n=n.concat(l.slice(1))),l.length>0&&(p=!1,o.elements.push(new a.Element(j.combinator,l[0].elements[0].value,j.index,j.currentFileInfo)),o.elements=o.elements.concat(l[0].elements.slice(1))),p||m.push(o),m=m.concat(n),s.push(m);i=s,r=[]}for(r.length>0&&this.mergeElementsOnToSelectors(r,i),e=0;e<i.length;e++)i[e].length>0&&b.push(i[e])}else if(c.length>0)for(e=0;e<c.length;e++)b.push(c[e].concat(d));else b.push([d])},mergeElementsOnToSelectors:function(b,c){var d,e;if(0===c.length)return void c.push([new a.Selector(b)]);for(d=0;d<c.length;d++)e=c[d],e.length>0?e[e.length-1]=e[e.length-1].createDerived(e[e.length-1].elements.concat(b)):e.push(new a.Selector(b))}}}(c("../tree")),function(a){a.Selector=function(a,b,c,d,e,f){this.elements=a,this.extendList=b,this.condition=c,this.currentFileInfo=e||{},this.isReferenced=f,c||(this.evaldCondition=!0)},a.Selector.prototype={type:"Selector",accept:function(a){this.elements&&(this.elements=a.visitArray(this.elements)),this.extendList&&(this.extendList=a.visitArray(this.extendList)),this.condition&&(this.condition=a.visit(this.condition))},createDerived:function(b,c,d){d=null!=d?d:this.evaldCondition;var e=new a.Selector(b,c||this.extendList,null,this.index,this.currentFileInfo,this.isReferenced);return e.evaldCondition=d,e.mediaEmpty=this.mediaEmpty,e},match:function(a){var b,c,d=this.elements,e=d.length;if(a.CacheElements(),b=a._elements.length,0===b||b>e)return 0;for(c=0;b>c;c++)if(d[c].value!==a._elements[c])return 0;return b},CacheElements:function(){var a,b,c,d="";if(!this._elements){for(a=this.elements.length,c=0;a>c;c++)if(b=this.elements[c],d+=b.combinator.value,b.value.value){if("string"!=typeof b.value.value){d="";break}d+=b.value.value}else d+=b.value;this._elements=d.match(/[,&#\*\.\w-]([\w-]|(\\.))*/g),this._elements?"&"===this._elements[0]&&this._elements.shift():this._elements=[]}},isJustParentSelector:function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},eval:function(a){var b=this.condition&&this.condition.eval(a),c=this.elements,d=this.extendList;return c=c&&c.map(function(b){return b.eval(a)}),d=d&&d.map(function(b){return b.eval(a)}),this.createDerived(c,d,b)},genCSS:function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;c<this.elements.length;c++)d=this.elements[c],d.genCSS(a,b)},toCSS:a.toCSS,markReferenced:function(){this.isReferenced=!0},getIsReferenced:function(){return!this.currentFileInfo.reference||this.isReferenced},getIsOutput:function(){return this.evaldCondition}}}(c("../tree")),function(a){a.UnicodeDescriptor=function(a){this.value=a},a.UnicodeDescriptor.prototype={type:"UnicodeDescriptor",genCSS:function(a,b){b.add(this.value)},toCSS:a.toCSS,eval:function(){return this}}}(c("../tree")),function(a){a.URL=function(a,b,c){this.value=a,this.currentFileInfo=b,this.isEvald=c},a.URL.prototype={type:"Url",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("url("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){var c,d=this.value.eval(b);if(!this.isEvald&&(c=this.currentFileInfo&&this.currentFileInfo.rootpath,c&&"string"==typeof d.value&&b.isPathRelative(d.value)&&(d.quote||(c=c.replace(/[\(\)'"\s]/g,function(a){return"\\"+a})),d.value=c+d.value),d.value=b.normalizePath(d.value),b.urlArgs&&!d.value.match(/^\s*data:/))){var e=-1===d.value.indexOf("?")?"?":"&",f=e+b.urlArgs;-1!==d.value.indexOf("#")?d.value=d.value.replace("#",f+"#"):d.value+=f}return new a.URL(d,this.currentFileInfo,!0)}}}(c("../tree")),function(a){a.Value=function(a){this.value=a},a.Value.prototype={type:"Value",accept:function(a){this.value&&(this.value=a.visitArray(this.value))},eval:function(b){return 1===this.value.length?this.value[0].eval(b):new a.Value(this.value.map(function(a){return a.eval(b)}))},genCSS:function(a,b){var c;for(c=0;c<this.value.length;c++)this.value[c].genCSS(a,b),c+1<this.value.length&&b.add(a&&a.compress?",":", ")},toCSS:a.toCSS}}(c("../tree")),function(a){a.Variable=function(a,b,c){this.name=a,this.index=b,this.currentFileInfo=c||{}},a.Variable.prototype={type:"Variable",eval:function(b){var c,d=this.name;if(0===d.indexOf("@@")&&(d="@"+new a.Variable(d.slice(1)).eval(b).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+d,filename:this.currentFileInfo.file,index:this.index};if(this.evaluating=!0,c=a.find(b.frames,function(a){var c=a.variable(d);return c?c.value.eval(b):void 0}))return this.evaluating=!1,c;throw{type:"Name",message:"variable "+d+" is undefined",filename:this.currentFileInfo.filename,index:this.index}}}}(c("../tree")),function(a){var b=["paths","optimization","files","contents","contentsIgnoredChars","relativeUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","processImports","syncImport","javascriptEnabled","mime","useFileCache","currentFileInfo"];a.parseEnv=function(a){if(d(a,this,b),this.contents||(this.contents={}),this.contentsIgnoredChars||(this.contentsIgnoredChars={}),this.files||(this.files={}),"string"==typeof this.paths&&(this.paths=[this.paths]),!this.currentFileInfo){var c=a&&a.filename||"input",e=c.replace(/[^\/\\]*$/,"");a&&(a.filename=null),this.currentFileInfo={filename:c,relativeUrls:this.relativeUrls,rootpath:a&&a.rootpath||"",currentDirectory:e,entryPath:e,rootFilename:c}}};var c=["silent","verbose","compress","yuicompress","ieCompat","strictMath","strictUnits","cleancss","sourceMap","importMultiple","urlArgs"];a.evalEnv=function(a,b){d(a,this,c),this.frames=b||[]},a.evalEnv.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},a.evalEnv.prototype.outOfParenthesis=function(){this.parensStack.pop()},a.evalEnv.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0},a.evalEnv.prototype.isPathRelative=function(a){return!/^(?:[a-z-]+:|\/)/.test(a)},a.evalEnv.prototype.normalizePath=function(a){var b,c=a.split("/").reverse();for(a=[];0!==c.length;)switch(b=c.pop()){case".":break;case"..":0===a.length||".."===a[a.length-1]?a.push(b):a.pop();break;default:a.push(b)}return a.join("/")};var d=function(a,b,c){if(a)for(var d=0;d<c.length;d++)a.hasOwnProperty(c[d])&&(b[c[d]]=a[c[d]])}}(c("./tree")),function(a){function b(a){return a}function c(a,b){var d,e;for(d in a)if(a.hasOwnProperty(d))switch(e=a[d],typeof e){case"function":e.prototype&&e.prototype.type&&(e.prototype.typeIndex=b++);break;case"object":b=c(e,b)}return b}var d={visitDeeper:!0},e=!1;a.visitor=function(b){this._implementation=b,this._visitFnCache=[],e||(c(a,1),e=!0)},a.visitor.prototype={visit:function(a){if(!a)return a;var c=a.typeIndex;if(!c)return a;var e,f=this._visitFnCache,g=this._implementation,h=c<<1,i=1|h,j=f[h],k=f[i],l=d;if(l.visitDeeper=!0,j||(e="visit"+a.type,j=g[e]||b,k=g[e+"Out"]||b,f[h]=j,f[i]=k),j!==b){var m=j.call(g,a,l);g.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=b&&k.call(g,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;d>c;c++)this.visit(a[c]);return a}var e=[];for(c=0;d>c;c++){var f=this.visit(a[c]);f.splice?f.length&&this.flatten(f,e):e.push(f)}return e},flatten:function(a,b){b||(b=[]);var c,d,e,f,g,h;for(d=0,c=a.length;c>d;d++)if(e=a[d],e.splice)for(g=0,f=e.length;f>g;g++)h=e[g],h.splice?h.length&&this.flatten(h,b):b.push(h);else b.push(e);return b}}}(c("./tree")),function(a){a.importVisitor=function(b,c,d,e,f){if(this._visitor=new a.visitor(this),this._importer=b,this._finish=c,this.env=d||new a.evalEnv,this.importCount=0,this.onceFileDetectionMap=e||{},this.recursionDetector={},f)for(var g in f)f.hasOwnProperty(g)&&(this.recursionDetector[g]=!0)},a.importVisitor.prototype={isReplacing:!0,run:function(a){var b;try{this._visitor.visit(a)}catch(c){b=c}this.isFinished=!0,0===this.importCount&&this._finish(b)},visitImport:function(b,c){var d,e=this,f=b.options.inline;if(!b.css||f){try{d=b.evalForImport(this.env)}catch(g){g.filename||(g.index=b.index,g.filename=b.currentFileInfo.filename),b.css=!0,b.error=g}if(d&&(!d.css||f)){b=d,this.importCount++;var h=new a.evalEnv(this.env,this.env.frames.slice(0));b.options.multiple&&(h.importMultiple=!0),this._importer.push(b.getPath(),b.currentFileInfo,b.options,function(c,d,g,i){c&&!c.filename&&(c.index=b.index,c.filename=b.currentFileInfo.filename);var j=g||i in e.recursionDetector;h.importMultiple||(b.skip=j?!0:function(){return i in e.onceFileDetectionMap?!0:(e.onceFileDetectionMap[i]=!0,!1)});var k=function(a){e.importCount--,0===e.importCount&&e.isFinished&&e._finish(a)};return!d||(b.root=d,b.importedFilename=i,f||!h.importMultiple&&j)?void k():(e.recursionDetector[i]=!0,void new a.importVisitor(e._importer,k,h,e.onceFileDetectionMap,e.recursionDetector).run(d))})}}return c.visitDeeper=!1,b},visitRule:function(a,b){return b.visitDeeper=!1,a},visitDirective:function(a){return this.env.frames.unshift(a),a},visitDirectiveOut:function(){this.env.frames.shift()},visitMixinDefinition:function(a){return this.env.frames.unshift(a),a},visitMixinDefinitionOut:function(){this.env.frames.shift()},visitRuleset:function(a){return this.env.frames.unshift(a),a},visitRulesetOut:function(){this.env.frames.shift()},visitMedia:function(a){return this.env.frames.unshift(a.rules[0]),a},visitMediaOut:function(){this.env.frames.shift()}}}(c("./tree")),function(a){a.joinSelectorVisitor=function(){this.contexts=[[]],this._visitor=new a.visitor(this)},a.joinSelectorVisitor.prototype={run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){var b,c=this.contexts[this.contexts.length-1],d=[];this.contexts.push(d),a.root||(b=a.selectors,b&&(b=b.filter(function(a){return a.getIsOutput()}),a.selectors=b.length?b:b=null,b&&a.joinSelectors(d,c,b)),b||(a.rules=null),a.paths=d)},visitRulesetOut:function(){this.contexts.length=this.contexts.length-1},visitMedia:function(a){var b=this.contexts[this.contexts.length-1];a.rules[0].root=0===b.length||b[0].multiMedia}}}(c("./tree")),function(a){a.toCSSVisitor=function(b){this._visitor=new a.visitor(this),this._env=b},a.toCSSVisitor.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a){return a.variable?[]:a},visitMixinDefinition:function(a){return a.frames=[],[]},visitExtend:function(){return[]},visitComment:function(a){return a.isSilent(this._env)?[]:a},visitMedia:function(a,b){return a.accept(this._visitor),b.visitDeeper=!1,a.rules.length?a:[]},visitDirective:function(b){if(b.currentFileInfo.reference&&!b.isReferenced)return[];if("@charset"===b.name){if(this.charset){if(b.debugInfo){var c=new a.Comment("/* "+b.toCSS(this._env).replace(/\n/g,"")+" */\n");return c.debugInfo=b.debugInfo,this._visitor.visit(c)}return[]}this.charset=!0}return b.rules&&b.rules.rules&&this._mergeRules(b.rules.rules),b},checkPropertiesInRoot:function(b){for(var c,d=0;d<b.length;d++)if(c=b[d],c instanceof a.Rule&&!c.variable)throw{message:"properties must be inside selector blocks, they cannot be in the root.",index:c.index,filename:c.currentFileInfo?c.currentFileInfo.filename:null}},visitRuleset:function(b,c){var d,e=[];if(b.firstRoot&&this.checkPropertiesInRoot(b.rules),b.root)b.accept(this._visitor),c.visitDeeper=!1,(b.firstRoot||b.rules&&b.rules.length>0)&&e.splice(0,0,b);else{b.paths&&(b.paths=b.paths.filter(function(b){var c;for(" "===b[0].elements[0].combinator.value&&(b[0].elements[0].combinator=new a.Combinator("")),c=0;c<b.length;c++)if(b[c].getIsReferenced()&&b[c].getIsOutput())return!0;return!1}));for(var f=b.rules,g=f?f.length:0,h=0;g>h;)d=f[h],d&&d.rules?(e.push(this._visitor.visit(d)),f.splice(h,1),g--):h++;g>0?b.accept(this._visitor):b.rules=null,c.visitDeeper=!1,f=b.rules,f&&(this._mergeRules(f),f=b.rules),f&&(this._removeDuplicateRules(f),f=b.rules),f&&f.length>0&&b.paths.length>0&&e.splice(0,0,b)}return 1===e.length?e[0]:e},_removeDuplicateRules:function(b){if(b){var c,d,e,f={};for(e=b.length-1;e>=0;e--)if(d=b[e],d instanceof a.Rule)if(f[d.name]){c=f[d.name],c instanceof a.Rule&&(c=f[d.name]=[f[d.name].toCSS(this._env)]);var g=d.toCSS(this._env);-1!==c.indexOf(g)?b.splice(e,1):c.push(g)}else f[d.name]=d}},_mergeRules:function(b){if(b){for(var c,d,e,f={},g=0;g<b.length;g++)d=b[g],d instanceof a.Rule&&d.merge&&(e=[d.name,d.important?"!":""].join(","),f[e]?b.splice(g--,1):f[e]=[],f[e].push(d));Object.keys(f).map(function(b){function e(b){return new a.Expression(b.map(function(a){return a.value}))}function g(b){return new a.Value(b.map(function(a){return a}))}if(c=f[b],c.length>1){d=c[0];var h=[],i=[];c.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),d.value=g(h)}})}}}}(c("./tree")),function(a){a.extendFinderVisitor=function(){this._visitor=new a.visitor(this),this.contexts=[],this.allExtendsStack=[[]]},a.extendFinderVisitor.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(b){if(!b.root){var c,d,e,f,g=[],h=b.rules,i=h?h.length:0;for(c=0;i>c;c++)b.rules[c]instanceof a.Extend&&(g.push(h[c]),b.extendOnEveryPath=!0);var j=b.paths;for(c=0;c<j.length;c++){var k=j[c],l=k[k.length-1],m=l.extendList;for(f=m?m.slice(0).concat(g):g,f&&(f=f.map(function(a){return a.clone()})),d=0;d<f.length;d++)this.foundExtends=!0,e=f[d],e.findSelfSelectors(k),e.ruleset=b,0===d&&(e.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(e)}this.contexts.push(b.selectors)}},visitRulesetOut:function(a){a.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(a){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}},a.processExtendsVisitor=function(){this._visitor=new a.visitor(this)},a.processExtendsVisitor.prototype={run:function(b){var c=new a.extendFinderVisitor;return c.run(b),c.foundExtends?(b.allExtends=b.allExtends.concat(this.doExtendChaining(b.allExtends,b.allExtends)),this.allExtendsStack=[b.allExtends],this._visitor.visit(b)):b},doExtendChaining:function(b,c,d){var e,f,g,h,i,j,k,l,m=[],n=this;for(d=d||0,e=0;e<b.length;e++)for(f=0;f<c.length;f++)j=b[e],k=c[f],j.parent_ids.indexOf(k.object_id)>=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&j.selfSelectors.forEach(function(b){h=n.extendSelector(g,i,b),l=new a.Extend(k.selector,k.option,0),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))}));if(m.length){if(this.extendChainCount++,d>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,c,d+1))}return m},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){if(!a.root){var b,c,d,e,f=this.allExtendsStack[this.allExtendsStack.length-1],g=[],h=this;for(d=0;d<f.length;d++)for(c=0;c<a.paths.length;c++)if(e=a.paths[c],!a.extendOnEveryPath){var i=e[e.length-1].extendList;i&&i.length||(b=this.findMatch(f[d],e),b.length&&f[d].selfSelectors.forEach(function(a){g.push(h.extendSelector(b,e,a))}))}a.paths=a.paths.concat(g)}},findMatch:function(a,b){var c,d,e,f,g,h,i,j=this,k=a.selector.elements,l=[],m=[];for(c=0;c<b.length;c++)for(d=b[c],e=0;e<d.elements.length;e++)for(f=d.elements[e],(a.allowBefore||0===c&&0===e)&&l.push({pathIndex:c,index:e,matched:0,initialCombinator:f.combinator}),h=0;h<l.length;h++)i=l[h],g=f.combinator.value,""===g&&0===e&&(g=" "),!j.isElementValuesEqual(k[i.matched].value,f.value)||i.matched>0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1<d.elements.length||c+1<b.length)&&(i=null)),i?i.finished&&(i.length=k.length,i.endPathIndex=c,i.endPathElementIndex=e+1,l.length=0,m.push(i)):(l.splice(h,1),h--);return m},isElementValuesEqual:function(b,c){if("string"==typeof b||"string"==typeof c)return b===c;if(b instanceof a.Attribute)return b.op!==c.op||b.key!==c.key?!1:b.value&&c.value?(b=b.value.value||b.value,c=c.value.value||c.value,b===c):b.value||c.value?!1:!0;
+if(b=b.value,c=c.value,b instanceof a.Selector){if(!(c instanceof a.Selector)||b.elements.length!==c.elements.length)return!1;for(var d=0;d<b.elements.length;d++){if(b.elements[d].combinator.value!==c.elements[d].combinator.value&&(0!==d||(b.elements[d].combinator.value||" ")!==(c.elements[d].combinator.value||" ")))return!1;if(!this.isElementValuesEqual(b.elements[d].value,c.elements[d].value))return!1}return!0}return!1},extendSelector:function(b,c,d){var e,f,g,h,i,j=0,k=0,l=[];for(e=0;e<b.length;e++)h=b[e],f=c[h.pathIndex],g=new a.Element(h.initialCombinator,d.elements[0].value,d.elements[0].index,d.elements[0].currentFileInfo),h.pathIndex>j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),k=0,j++),i=f.elements.slice(k,h.index).concat([g]).concat(d.elements.slice(1)),j===h.pathIndex&&e>0?l[l.length-1].elements=l[l.length-1].elements.concat(i):(l=l.concat(c.slice(j,h.pathIndex)),l.push(new a.Selector(i))),j=h.endPathIndex,k=h.endPathElementIndex,k>=c[j].elements.length&&(k=0,j++);return j<c.length&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),j++),l=l.concat(c.slice(j,c.length))},visitRulesetOut:function(){},visitMedia:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(c("./tree")),function(a){a.sourceMapOutput=function(a){this._css=[],this._rootNode=a.rootNode,this._writeSourceMap=a.writeSourceMap,this._contentsMap=a.contentsMap,this._contentsIgnoredCharsMap=a.contentsIgnoredCharsMap,this._sourceMapFilename=a.sourceMapFilename,this._outputFilename=a.outputFilename,this._sourceMapURL=a.sourceMapURL,a.sourceMapBasepath&&(this._sourceMapBasepath=a.sourceMapBasepath.replace(/\\/g,"/")),this._sourceMapRootpath=a.sourceMapRootpath,this._outputSourceFiles=a.outputSourceFiles,this._sourceMapGeneratorConstructor=a.sourceMapGenerator||c("source-map").SourceMapGenerator,this._sourceMapRootpath&&"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/"),this._lineNumber=0,this._column=0},a.sourceMapOutput.prototype.normalizeFilename=function(a){return a=a.replace(/\\/g,"/"),this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),("\\"===a.charAt(0)||"/"===a.charAt(0))&&(a=a.substring(1))),(this._sourceMapRootpath||"")+a},a.sourceMapOutput.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename];this._contentsIgnoredCharsMap[b.filename]&&(c-=this._contentsIgnoredCharsMap[b.filename],0>c&&(c=0),j=j.slice(this._contentsIgnoredCharsMap[b.filename])),j=j.substring(0,c),f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;i<e.length;i++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+i+1,column:0===i?this._column:0},original:{line:f.length+i,column:0===i?h.length:0},source:this.normalizeFilename(b.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:f.length,column:h.length},source:this.normalizeFilename(b.filename)});1===e.length?this._column+=g.length:(this._lineNumber+=e.length-1,this._column=g.length),this._css.push(a)}},a.sourceMapOutput.prototype.isEmpty=function(){return 0===this._css.length},a.sourceMapOutput.prototype.toCSS=function(a){if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(var b in this._contentsMap)if(this._contentsMap.hasOwnProperty(b)){var d=this._contentsMap[b];this._contentsIgnoredCharsMap[b]&&(d=d.slice(this._contentsIgnoredCharsMap[b])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(b),d)}if(this._rootNode.genCSS(a,this),this._css.length>0){var e,f=JSON.stringify(this._sourceMapGenerator.toJSON());this._sourceMapURL?e=this._sourceMapURL:this._sourceMapFilename&&(e=this.normalizeFilename(this._sourceMapFilename)),this._writeSourceMap?this._writeSourceMap(f):e="data:application/json;base64,"+c("./encoder.js").encodeBase64(f),e&&this._css.push("/*# sourceMappingURL="+e+" */")}return this._css.join("")}}(c("./tree"));var y=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);w.env=w.env||("127.0.0.1"==location.hostname||"0.0.0.0"==location.hostname||"localhost"==location.hostname||location.port&&location.port.length>0||y?"development":"production");var z={debug:3,info:2,errors:1,none:0};if(w.logLevel="undefined"!=typeof w.logLevel?w.logLevel:"development"===w.env?z.debug:z.errors,w.async=w.async||!1,w.fileAsync=w.fileAsync||!1,w.poll=w.poll||(y?1e3:1500),w.functions)for(var A in w.functions)w.functions.hasOwnProperty(A)&&(w.tree.functions[A]=w.functions[A]);var B=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);B&&(w.dumpLineNumbers=B[1]);var C=/^text\/(x-)?less$/,D=null,E={};if(w.watch=function(){return w.watchMode||(w.env="development",v()),this.watchMode=!0,!0},w.unwatch=function(){return clearInterval(w.watchTimer),this.watchMode=!1,!1},/!watch/.test(location.hash)&&w.watch(),"development"!=w.env)try{D="undefined"==typeof a.localStorage?null:a.localStorage}catch(F){}var G=document.getElementsByTagName("link");w.sheets=[];for(var H=0;H<G.length;H++)("stylesheet/less"===G[H].rel||G[H].rel.match(/stylesheet/)&&G[H].type.match(C))&&w.sheets.push(G[H]);w.modifyVars=function(a){w.refresh(!1,a)},w.refresh=function(a,b){var c,e;c=e=new Date,u(function(a,b,f,i,k){if(a)return j(a,i.href);if(k.local)d("loading "+i.href+" from cache.",z.info);else{d("parsed "+i.href+" successfully.",z.debug);var l=b.toCSS(w);l=h(l),g(l,i,k.lastModified)}d("css for "+i.href+" generated in "+(new Date-e)+"ms",z.info),0===k.remaining&&d("less has finished. css generated in "+(new Date-c)+"ms",z.info),e=new Date},a,b),n(b)},w.refreshStyles=n,w.Parser.fileLoader=s,w.refresh("development"===w.env),"function"==typeof define&&define.amd&&define(function(){return w})}(window);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/websockets/main.js b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/websockets/main.js
new file mode 100755 (executable)
index 0000000..a9797f8
--- /dev/null
@@ -0,0 +1,199 @@
+$(function(){
+
+    var socket;
+
+    /*
+        UI Elements
+     */
+    var txtConnectUrl   = $("#txtConnectUrl");
+    var btnConnect      = $("#btnConnect");
+    var btnDisconnect   = $("#btnDisconnect");
+    var selectMethod    = $("#selectMethod");
+    var btnSend         = $("#btnSend");
+    var txtSend         = $("#txtSend");
+    var txtReceive      = $("#txtReceive");
+    var txtNotification = $("#txtNotification");
+
+
+    btnConnect.on('click', function(){
+        console.debug('btnConnect : click');
+        socket = new WebSocket(txtConnectUrl.val(),['msf-2','msf-3']);
+        console.debug('connecting to '+txtConnectUrl.val());
+        socket.addEventListener('open',     onSocketOpen );
+        socket.addEventListener('message',  onSocketMessage );
+        socket.addEventListener('close',    onSocketClose );
+        socket.addEventListener('error',    onSocketError );
+    });
+
+    btnDisconnect.on('click', function(){
+        console.debug('btnDisconnect : click');
+        if(socket){
+            socket.close();
+        }
+    });
+
+    btnSend.on('click', function(){
+        console.debug('btnSend : click');
+        if(socket){
+            socket.send(txtSend.val());
+        }
+    });
+
+    selectMethod.on('change', function(){
+        console.debug('selectMethod : change');
+        var key = $(this).val();
+        if(methods[key]){
+            var tplObj = methods[key];
+            txtSend.val(JSON.stringify(tplObj, null, 2));
+        }else{
+            console.warn('no template defined for selected method');
+        }
+
+    });
+
+    var onSocketOpen = function(){
+        console.info('websocket connected');
+        btnConnect.prop("disabled",true);
+        btnSend.prop("disabled",false);
+        btnDisconnect.prop("disabled",false);
+        $('body').css('background-color','#C9FF9C');
+    };
+
+    var onSocketMessage = function(msg){
+        try{
+            msg = JSON.parse(msg.data);
+            console.info('websocket message : ', msg);
+        }catch(e){
+            console.error('Unable to parse message : ', msg.data);
+        }
+
+        if(msg.id){
+            txtReceive.val(JSON.stringify(msg, null, 2));
+            txtReceive.addClass('flash');
+            txtReceive.one('animationend webkitAnimationEnd', function() {
+                $(this).removeClass('flash');
+            });
+        }else{
+            txtNotification.val(JSON.stringify(msg, null, 2));
+            txtNotification.addClass('flash');
+            txtNotification.one('animationend webkitAnimationEnd', function() {
+                $(this).removeClass('flash');
+            });
+        }
+
+    };
+
+    var onSocketClose = function(){
+        console.warn('websocket disconnected');
+        btnConnect.prop("disabled",false);
+        btnDisconnect.prop("disabled",true);
+        btnSend.prop("disabled",true);
+        socket = null;
+        $('body').css('background-color','#E5E5E5');
+    };
+
+    var onSocketError = function(evt){
+        console.error('websocket error : ', evt);
+    };
+
+    var initUI = function(){
+        txtConnectUrl.val('ws://'+location.host+'/api/v2/channels/test');
+        btnDisconnect.prop("disabled",true);
+        btnSend.prop("disabled",true);
+        for(var key in methods){
+            if (methods.hasOwnProperty(key)) {
+                var option = $('<option />')
+                    .attr('value', key)
+                    .text(key)
+                    .appendTo(selectMethod);
+            }
+        }
+        selectMethod.change();
+    };
+
+
+    var methods = {
+
+        "ms.channel.emit" : {
+            method : "ms.channel.emit",
+            params : {
+                event : "say",
+                data  : "Hello World!",
+                to    : "all"
+            }
+        },
+
+        "ms.application.get" : {
+            method : "ms.application.get",
+            get id(){return Date.now();},
+            params : {
+                id : "HelloWorld"
+            }
+        },
+
+        "ms.application.start" : {
+            method : "ms.application.start",
+            get id(){return Date.now();},
+            params : {
+                id : "HelloWorld"
+            }
+        },
+
+        "ms.application.stop" : {
+            method : "ms.application.stop",
+            get id(){return Date.now();},
+            params : {
+                id : "HelloWorld"
+            }
+        },
+
+        "ms.application.install" : {
+            method : "ms.application.install",
+            get id(){return Date.now();},
+            params : {
+                id : "HelloWorld"
+            }
+        },
+
+        "ms.webapplication.get" : {
+            method : "ms.webapplication.get",
+            get id(){return Date.now();},
+            params : {
+                url : "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/"
+            }
+        },
+
+        "ms.webapplication.start" : {
+            method : "ms.webapplication.start",
+            get id(){return Date.now();},
+            params : {
+                url : "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/"
+            }
+        },
+
+        "ms.webapplication.stop" : {
+            method : "ms.webapplication.stop",
+            get id(){return Date.now();},
+            params : {
+                url : "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/"
+            }
+        },
+
+        "ms.pincode.show" : {
+            method : "ms.pincode.show",
+            get id(){return Date.now();}
+        },
+
+        "ms.pincode.hide" : {
+            method : "ms.pincode.hide",
+            get id(){return Date.now();}
+        },
+
+        "custom" : {}
+
+    };
+
+    initUI();
+
+
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/websockets/styles.less b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/tools/websockets/styles.less
new file mode 100755 (executable)
index 0000000..129b059
--- /dev/null
@@ -0,0 +1,168 @@
+
+@font-face {
+    font-family: 'amatic';
+    src:url('../fonts/amaticsc-regular.woff') format('woff'),
+        url('../fonts/amaticsc-regular.ttf') format('truetype');
+    font-weight: normal;
+    font-style: normal;
+}
+
+html {
+    width: 100%;
+    height: 100%;
+}
+
+body {
+    width: 100%;
+    height: 100%;
+    background-color: #E5E5E5;
+    font-family: 'amatic', cursive;
+}
+
+*, *:before, *:after {
+    box-sizing: border-box;
+    margin: 0;
+    padding: 0;
+}
+
+h1, h2, h3, h4, h5, h6{
+    font-family: 'amatic', cursive;
+}
+
+label{
+    font-weight: bolder;
+    font-size: 24px;
+    margin-bottom : 10px;
+}
+
+input, button, textarea, select {
+    padding : 5px;
+    border-radius: 5px;
+    background : #fff;
+    &:focus{
+        outline: 0;
+    }
+    &:disabled{
+        display: none;
+        background: url(../img/cross-out.png) center center no-repeat;
+        background-size: contain;
+        border : none;
+    }
+}
+
+button { .sketch-rounded-3d; }
+
+select, textarea{ .sketch-rounded; }
+
+input{ .sketch; }
+
+.sketch {
+    border: 7px solid transparent;
+    border-image: url('../img/sketch-border.png') 7 stretch;
+}
+
+.sketch-rounded {
+    border: 7px solid transparent;
+    border-image: url('../img/sketch-border-rounded.png') 7 stretch;
+}
+
+.sketch-rounded-3d {
+    border: 10px solid transparent;
+    border-image: url('../img/sketch-border-rounded-3d.png') 10 stretch;
+}
+
+#wrapper{
+    display: flex;
+    flex-flow: row wrap;
+    padding : 10px;
+}
+
+section, header{
+    display: flex;
+    flex-flow: row wrap;
+    background-color: #fff;
+    padding : 20px;
+    margin : 10px;
+    .sketch;
+}
+
+#cntHeading{
+    width: 100%;
+}
+
+#cntConnection{
+    width: 100%;
+    label {
+        width : 100%;
+    }
+    input {
+        width: 300px;
+    }
+    button {
+        margin-left: 10px;
+    }
+}
+
+#cntSend{
+    flex : 1;
+    label {
+        width : 100%;
+        &:not(:first-child){
+            margin-top: 20px;
+        }
+    }
+    select{
+        flex : 2;
+
+    }
+    button{
+        flex : 1;
+        margin-left: 10px;
+    }
+    textarea{
+        width :100%;
+        min-height: 200px;
+    }
+}
+
+#cntReceive{
+    flex : 1;
+    label {
+        width : 100%;
+    }
+    textarea{
+        width :100%;
+        min-height: 200px;
+    }
+}
+
+#cntNotifications{
+    flex : 1;
+    label {
+        width : 100%;
+    }
+    textarea{
+        width :100%;
+        min-height: 200px;
+    }
+}
+
+@-webkit-keyframes flash {
+    0% {
+        background-color: transparent;
+    }
+    50% {
+        background-color: #fff085;
+    }
+    100% {
+        background-color: transparent;
+    }
+}
+
+.flash{
+    -webkit-animation-name: flash;
+    -webkit-animation-duration: 500ms;
+    -webkit-animation-iteration-count: 1;
+    -webkit-animation-timing-function: ease-out;
+}
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/css/style.css b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/css/style.css
new file mode 100755 (executable)
index 0000000..566a584
--- /dev/null
@@ -0,0 +1,102 @@
+*, *:before, *:after {
+    box-sizing: border-box;
+    margin : 0;
+    padding : 0;
+}
+
+html, body {
+     width: 100%;
+     height: 100%;
+     overflow: hidden;
+     background: transparent;
+}
+
+h1{
+    font-size: 24px;
+    margin-bottom : 14px;
+}
+h2{
+    font-size: 20px;
+    margin-bottom : 10px;
+}
+h3{
+    font-size: 16px;
+    margin-bottom : 6px;
+}
+
+#wrapper {
+    position: relative;
+    width: 100%;
+    height: 100%;
+    margin: 0 auto;
+    padding: 0;
+    overflow: hidden;
+    font : normal 12px Arial;
+}
+
+#loading{
+    position: absolute;
+    top: 40%;
+}
+
+#loadingMsg{
+    display : none;
+}
+
+
+#error{
+    position: absolute;
+    top: 40%;
+    display : none;
+}
+
+#version {
+  position: absolute;
+  margin: 0;
+  padding: 0;
+  bottom: 10px;
+  left: 10px;
+  color: #4c4c4c;
+  font-weight: bold;  
+}
+
+#out{
+  position: absolute;
+  top : 0;
+  left : 0;
+  width : 100%;
+  height : 100%;
+  font-size : 24px;
+  display : none;
+}
+
+.message{
+    text-align: center;
+    width: 100%;
+    padding: 15px;
+    text-shadow: 0 1px 0 rgba(0,0,0,.5);
+    color : #4c4c4c;
+}
+
+.spinner {
+  width: 50px;
+  height: 50px;
+  border: solid 5px #4c4c4c;
+  margin: 50px auto;
+  -webkit-animation: rotateplane 1.2s infinite ease-in-out;
+}
+
+@-webkit-keyframes animate-message {
+    from {
+        background-position: 0 0;
+    }
+    to {
+        background-position: -80px 0;
+    }
+}
+
+@-webkit-keyframes rotateplane {
+  0% { -webkit-transform: perspective(120px) }
+  50% { -webkit-transform: perspective(120px) rotateY(180deg) }
+  100% { -webkit-transform: perspective(120px) rotateY(180deg)  rotateX(180deg) }
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/index.html b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/index.html
new file mode 100755 (executable)
index 0000000..0486f70
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+    <meta name="description" content="Samsung MultiScreen WebApplication Launcher"/>
+    <title>MultiScreen WebApplication</title>
+    <link rel="stylesheet" type="text/css" href="css/style.css"/>
+</head>
+<body>
+<div id="wrapper">
+    <div id="loading" class="message">
+        <h1>LOADING</h1>
+        <h2 id="loadingMsg"></h2>
+        <div class="spinner"></div>
+    </div>
+    <div id="error" class="message">
+        <h1>OOPS!</h1>
+        <h2 id="errorMsg">UNKNOWN ERROR</h2>
+        <h3>Closing in 5 seconds...</h3>
+    </div>
+    <p id="version">v2.0.13</p>
+</div>
+<textarea id="out"></textarea>
+<script src="js/main.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/js/main.js b/MSF-Node/org.tizen.multiscreen/server/lib/resources/public/webapplauncher/js/main.js
new file mode 100755 (executable)
index 0000000..f47c118
--- /dev/null
@@ -0,0 +1,124 @@
+(function(){
+
+       if(typeof tizen !== "undefined") {
+               var app = tizen.application.getCurrentApplication();
+       }
+
+       var out = document.getElementById('out');
+       var loading = document.getElementById('loading');
+       var loadingMsg = document.getElementById('loadingMsg');
+       var error = document.getElementById('error');
+       var errorMsg = document.getElementById('errorMsg');
+
+       var logError = function (msg) {
+               if(typeof(msg) !== 'string') msg = JSON.stringify(msg);
+               log('ERROR : '+msg);
+       };
+
+       var log = function (msg) {
+               if(typeof(msg) !== 'string') msg = JSON.stringify(msg);
+               if(out) out.value += msg + '\n';
+       };
+
+
+       var showError = function(msg){
+
+               errorMsg.innerHTML = msg;
+               error.style.display = 'block';
+               loading.style.display = 'none';
+
+               setTimeout(function(){
+                       if(app)app.exit();
+               },5000);
+
+
+       };
+
+       var showLoading = function(msg){
+
+               loadingMsg.innerHTML = msg;
+               loadingMsg.style.display = 'block';
+               loading.style.display = 'block';
+               error.style.display = 'none';
+       };
+
+       var getLaunchData = function (callback){
+
+               log("getLaunchData() called");
+
+               var request = new XMLHttpRequest();
+               request.timeout = 5000;
+
+               request.onload = function(e){
+                       log("getLaunchData() : result : "+this.responseText);
+                       if (this.status === 200) {
+                               var result;
+                               try{
+                                       result = JSON.parse(this.responseText);
+                                       callback(null, result);
+                               } catch(e){
+                                       callback(e);
+                               }
+                       }else{
+                               callback(new Error('Unable to retrieve launch data, server responded with '+this.status));
+                       }
+
+               };
+               request.onerror = function(e){
+                       callback(e.message);
+               };
+               request.ontimeout = function(e){
+                       callback(new Error('Request timeout'));
+               };
+
+               request.open("GET",'http://127.0.0.1:8001/api/v2/webapplication/data');
+               request.send();
+       };
+
+
+       var init = function () {
+
+               log("init : "+window.location.href);
+
+               getLaunchData(function(err, result){
+
+                       if(err) {
+
+                               logError(err.message);
+                               showError('UNABLE TO LOAD LAUNCH DATA');
+
+                       }else if(!result.url) {
+
+                               logError('data has no url property');
+                               showError('NO URL FOUND IN LAUNCH DATA');
+
+                       }else {
+
+                               if(result.url.indexOf('msf-debug') > -1) out.style.display = "block";
+
+                               var parser = document.createElement('a');
+                               parser.href = result.url;
+                               showLoading(parser.hostname);
+
+                               window.location = result.url;
+                       }
+
+               });
+
+       };
+
+       window.onerror = function (errorMsg){
+               logError(errorMsg);
+       };
+
+       window.onload = function(){
+               init();
+       };
+
+       window.addEventListener('keydown', function(e) {
+               log('key pressed : '+e.keyCode);
+       });
+
+
+
+})();
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/routes/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/routes/index.js
new file mode 100755 (executable)
index 0000000..ae70669
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var express = require('express');
+var path = require('path');
+var logger = require('../logging').createNamedLogger('Router');
+var fs = require('fs');
+
+function configure(app){
+
+    /*
+
+    BUG FIX : Helper
+
+    Handles situations where a post, put, delete.... is sent with type application/json and empty body.
+    Just converts the request to text/plain instead
+     */
+    app.use(function(req, res, next){
+        if(req.headers['content-type'] === "application/json" && req.headers['content-length'] === "0"){
+            req.headers['content-type'] = "text/plain";
+        }
+        next();
+    });
+
+
+
+    /*
+     Middleware : Parses body for different content types including forms/json/ect...
+     */
+    app.use(express.bodyParser());
+
+
+    /*
+     Middleware : Logs all request
+     */
+    app.use(function log(req, res, next){
+
+        // Log the port number (requested by wasp team)
+        //var thePortNo = (req.headers.host.slice(req.headers.host.indexOf(":")+1));
+        //console.log("thePortNo  is -->>>> ",thePortNo );
+
+        logger.silly('Incoming Request',{
+            ip      : req.headers['x-forwarded-for'] || req.connection.remoteAddress,
+            port    : req.headers.host.slice(req.headers.host.indexOf(":")+1),
+            method  : req.method,
+            url     : req.url,
+            body    : req.body
+        });
+
+        res.on('_send', function(body){
+            logger.silly('Outgoing Response : ', body.toString());
+        });
+        next();
+    });
+
+
+
+    /*
+     Headers added to all request (also contains origin policy, which should be tightened up)
+     */
+    app.all('*', function(req, res, next) {
+        res.header("Access-Control-Allow-Origin", "*");
+        res.header("Access-Control-Allow-Credentials", true);
+        res.header('Access-Control-Allow-Methods', "GET,PUT,POST,DELETE");
+        res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, SilentLaunch");
+
+        // TODO : Perhaps lock this down a little more (discuss when browsers should be able to use the API)
+        if (req.method === 'OPTIONS') {
+            return res.send('MultiScreen Server 2.0');
+        }
+        next();
+    });
+
+
+    /*
+     Static resources
+     */
+    app.use('/resources',express.static(path.join(__dirname,'../resources/public')));
+
+}
+
+module.exports.configure = configure;
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/settings/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/settings/index.js
new file mode 100755 (executable)
index 0000000..d38db51
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var utils = require('../utils');
+var path = require("path");
+var fs = require("fs");
+var logger = require('../logging/index').createNamedLogger('Settings');
+
+var settingsPath = path.join(__dirname,'../../../.settings.json');
+var _data;
+
+var settings = {
+
+    get data(){
+
+        if(_data) {
+            return _data;
+        }else if(fs.existsSync(settingsPath)){
+            try{
+                logger.info('Loading settings from '+settingsPath);
+                _data = require(settingsPath);
+            }catch(e){
+                logger.warn('Unable to load settings : ', e.message);
+                _data = {};
+            }
+            return _data;
+        }else{
+            logger.info('No settings file detected, creating...');
+            _data = {};
+            this.save();
+            return _data;
+        }
+
+
+    },
+
+    save : function(){
+        try{
+            fs.writeFileSync(settingsPath, JSON.stringify(_data,null,4));
+            logger.info('Settings saved to disk at '+settingsPath);
+        }catch(e){
+            logger.error('Unable to write settings to disk. Settings will not persist after this session : ', e.message);
+        }
+    }
+
+};
+
+module.exports = settings;
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/utils/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/utils/index.js
new file mode 100755 (executable)
index 0000000..cd9b3c4
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var fs = require('fs');
+var path = require('path');
+var uuid = require("node-uuid");
+var logger = require('../logging/index').createNamedLogger('Utils');
+var config = require('../config');
+
+function generateDeviceId(){
+
+    var id = "";
+    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+    for( var i=0; i < 13; i++ ){
+        id += possible.charAt(Math.floor(Math.random() * possible.length));
+    }
+    return id;
+}
+
+function generateUdn(){
+    return uuid.v1();
+}
+
+function getInternalAddresses(){
+
+    var os = require('os');
+    var interfaces = os.networkInterfaces();
+    var addresses = [];
+    for (var k in interfaces) {
+        for (var k2 in interfaces[k]) {
+            var address = interfaces[k][k2];
+            if (address.family === 'IPv4' && !address.internal) {
+                addresses.push(address.address);
+            }
+        }
+    }
+    return addresses;
+}
+
+function getInternalIP(){
+    var addresses = getInternalAddresses();
+    return addresses[0];
+}
+
+
+function isInternalIp(ip){
+    var addresses = getInternalAddresses();
+    addresses.push('127.0.0.1');
+    logger.debug('isInternalIp('+ip+') verifying from addresses ', addresses);
+    return (addresses.indexOf(ip) > -1);
+}\r
+\r
+function checkWhetherIpv6(clienIP) {\r
+    var ip4address = clienIP.replace("::ffff:", "");\r
+    return ip4address;
+}
+
+function isSupportDevelopement(clientIP)
+{
+    if(config.developement.os == "Tizen")
+    {
+               if(config.developement.developerMode == '0')
+                       return false;
+               if(clientIP == config.developement.developerIP)
+                       return true;
+
+               return false;
+    }
+    else
+    {
+               return true;
+    }
+}
+
+exports.getInternalIP = getInternalIP;\r
+exports.isInternalIp = isInternalIp;\r
+exports.checkWhetherIpv6 = checkWhetherIpv6;
+exports.generateDeviceId = generateDeviceId;
+exports.generateUdn = generateUdn;
+exports.isSupportDevelopement = isSupportDevelopement;
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/index.js
new file mode 100755 (executable)
index 0000000..3423ff2
--- /dev/null
@@ -0,0 +1,26 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports = require('./lib/WebSocket');
+module.exports.Server = require('./lib/WebSocketServer');
+module.exports.Sender = require('./lib/Sender');
+module.exports.Receiver = require('./lib/Receiver');
+
+module.exports.createServer = function (options, connectionListener) {
+  var server = new module.exports.Server(options);
+  if (typeof connectionListener === 'function') {
+    server.on('connection', connectionListener);
+  }
+  return server;
+};
+
+module.exports.connect = module.exports.createConnection = function (address, openListener) {
+  var client = new module.exports(address);
+  if (typeof openListener === 'function') {
+    client.on('open', openListener);
+  }
+  return client;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferPool.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferPool.js
new file mode 100755 (executable)
index 0000000..faf8637
--- /dev/null
@@ -0,0 +1,59 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util');
+
+function BufferPool(initialSize, growStrategy, shrinkStrategy) {
+  if (typeof initialSize === 'function') {
+    shrinkStrategy = growStrategy;
+    growStrategy = initialSize;
+    initialSize = 0;
+  }
+  else if (typeof initialSize === 'undefined') {
+    initialSize = 0;
+  }
+  this._growStrategy = (growStrategy || function(db, size) {
+    return db.used + size;
+  }).bind(null, this);
+  this._shrinkStrategy = (shrinkStrategy || function(db) {
+    return initialSize;
+  }).bind(null, this);
+  this._buffer = initialSize ? new Buffer(initialSize) : null;
+  this._offset = 0;
+  this._used = 0;
+  this._changeFactor = 0;
+  this.__defineGetter__('size', function(){
+    return this._buffer == null ? 0 : this._buffer.length;
+  });
+  this.__defineGetter__('used', function(){
+    return this._used;
+  });
+}
+
+BufferPool.prototype.get = function(length) {
+  if (this._buffer == null || this._offset + length > this._buffer.length) {
+    var newBuf = new Buffer(this._growStrategy(length));
+    this._buffer = newBuf;
+    this._offset = 0;
+  }
+  this._used += length;
+  var buf = this._buffer.slice(this._offset, this._offset + length);
+  this._offset += length;
+  return buf;
+}
+
+BufferPool.prototype.reset = function(forceNewBuffer) {
+  var len = this._shrinkStrategy();
+  if (len < this.size) this._changeFactor -= 1;
+  if (forceNewBuffer || this._changeFactor < -2) {
+    this._changeFactor = 0;
+    this._buffer = len ? new Buffer(len) : null;
+  }
+  this._offset = 0;
+  this._used = 0;
+}
+
+module.exports = BufferPool;
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferUtil.fallback.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferUtil.fallback.js
new file mode 100755 (executable)
index 0000000..508542c
--- /dev/null
@@ -0,0 +1,47 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports.BufferUtil = {
+  merge: function(mergedBuffer, buffers) {
+    var offset = 0;
+    for (var i = 0, l = buffers.length; i < l; ++i) {
+      var buf = buffers[i];
+      buf.copy(mergedBuffer, offset);
+      offset += buf.length;
+    }
+  },
+  mask: function(source, mask, output, offset, length) {
+    var maskNum = mask.readUInt32LE(0, true);
+    var i = 0;
+    for (; i < length - 3; i += 4) {
+      var num = maskNum ^ source.readUInt32LE(i, true);
+      if (num < 0) num = 4294967296 + num;
+      output.writeUInt32LE(num, offset + i, true);
+    }
+    switch (length % 4) {
+      case 3: output[offset + i + 2] = source[i + 2] ^ mask[2];
+      case 2: output[offset + i + 1] = source[i + 1] ^ mask[1];
+      case 1: output[offset + i] = source[i] ^ mask[0];
+      case 0:;
+    }
+  },
+  unmask: function(data, mask) {
+    var maskNum = mask.readUInt32LE(0, true);
+    var length = data.length;
+    var i = 0;
+    for (; i < length - 3; i += 4) {
+      var num = maskNum ^ data.readUInt32LE(i, true);
+      if (num < 0) num = 4294967296 + num;
+      data.writeUInt32LE(num, i, true);
+    }
+    switch (length % 4) {
+      case 3: data[i + 2] = data[i + 2] ^ mask[2];
+      case 2: data[i + 1] = data[i + 1] ^ mask[1];
+      case 1: data[i] = data[i] ^ mask[0];
+      case 0:;
+    }
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferUtil.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/BufferUtil.js
new file mode 100755 (executable)
index 0000000..094d3b5
--- /dev/null
@@ -0,0 +1,16 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+try {
+  module.exports = require('../build/Release/bufferutil');
+} catch (e) { try {
+  module.exports = require('../build/default/bufferutil');
+} catch (e) { try {
+  module.exports = require('./BufferUtil.fallback.js');
+} catch (e) {
+  console.error('bufferutil.node seems to not have been built. Run npm install.');
+  throw e;
+}}}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/ErrorCodes.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/ErrorCodes.js
new file mode 100755 (executable)
index 0000000..55ebd52
--- /dev/null
@@ -0,0 +1,24 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+module.exports = {
+  isValidErrorCode: function(code) {
+    return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) ||
+         (code >= 3000 && code <= 4999);
+  },
+  1000: 'normal',
+  1001: 'going away',
+  1002: 'protocol error',
+  1003: 'unsupported data',
+  1004: 'reserved',
+  1005: 'reserved for extensions',
+  1006: 'reserved for extensions',
+  1007: 'inconsistent or invalid data',
+  1008: 'policy violation',
+  1009: 'message too big',
+  1010: 'extension handshake missing',
+  1011: 'an unexpected condition prevented the request from being fulfilled',
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Receiver.hixie.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Receiver.hixie.js
new file mode 100755 (executable)
index 0000000..f54ad96
--- /dev/null
@@ -0,0 +1,180 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util');
+
+/**
+ * State constants
+ */
+
+var EMPTY = 0
+  , BODY = 1;
+var BINARYLENGTH = 2
+  , BINARYBODY = 3;
+
+/**
+ * Hixie Receiver implementation
+ */
+
+function Receiver () {
+  this.state = EMPTY;
+  this.buffers = [];
+  this.messageEnd = -1;
+  this.spanLength = 0;
+  this.dead = false;
+
+  this.onerror = function() {};
+  this.ontext = function() {};
+  this.onbinary = function() {};
+  this.onclose = function() {};
+  this.onping = function() {};
+  this.onpong = function() {};
+}
+
+module.exports = Receiver;
+
+/**
+ * Add new data to the parser.
+ *
+ * @api public
+ */
+
+Receiver.prototype.add = function(data) {
+  var self = this;
+  function doAdd() {
+    if (self.state === EMPTY) {
+      if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) {
+        self.reset();
+        self.onclose();
+        return;
+      }
+      if (data[0] === 0x80) {
+        self.messageEnd = 0;
+       self.state = BINARYLENGTH;
+        data = data.slice(1);
+      } else {
+
+      if (data[0] !== 0x00) {
+        self.error('payload must start with 0x00 byte', true);
+        return;
+      }
+      data = data.slice(1);
+      self.state = BODY;
+
+      }
+    }
+    if (self.state === BINARYLENGTH) {
+      var i = 0;
+      while ((i < data.length) && (data[i] & 0x80)) {
+        self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
+        ++i;
+      }
+      if (i < data.length) {
+        self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f);
+        self.state = BINARYBODY;
+        ++i;
+      }
+      if (i > 0)
+        data = data.slice(i);
+    }
+    if (self.state === BINARYBODY) {
+      var dataleft = self.messageEnd - self.spanLength;
+      if (data.length >= dataleft) {
+       // consume the whole buffer to finish the frame
+        self.buffers.push(data);
+        self.spanLength += dataleft;
+        self.messageEnd = dataleft;
+        return self.parse();
+      }
+      // frame's not done even if we consume it all
+      self.buffers.push(data);
+      self.spanLength += data.length;
+      return;
+    }
+    self.buffers.push(data);
+    if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) {
+      self.spanLength += self.messageEnd;
+      return self.parse();
+    }
+    else self.spanLength += data.length;
+  }
+  while(data) data = doAdd();
+}
+
+/**
+ * Releases all resources used by the receiver.
+ *
+ * @api public
+ */
+
+Receiver.prototype.cleanup = function() {
+  this.dead = true;
+  this.state = EMPTY;
+  this.buffers = [];
+}
+
+/**
+ * Process buffered data.
+ *
+ * @api public
+ */
+
+Receiver.prototype.parse = function() {
+  var output = new Buffer(this.spanLength);
+  var outputIndex = 0;
+  for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) {
+    var buffer = this.buffers[bi];
+    buffer.copy(output, outputIndex);
+    outputIndex += buffer.length;
+  }
+  var lastBuffer = this.buffers[this.buffers.length - 1];
+  if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd);
+  if (this.state !== BODY) --this.messageEnd;
+  var tail = null;
+  if (this.messageEnd < lastBuffer.length - 1) {
+    tail = lastBuffer.slice(this.messageEnd + 1);
+  }
+  this.reset();
+  this.ontext(output.toString('utf8'));
+  return tail;
+}
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Receiver.prototype.error = function (reason, terminate) {
+  this.reset();
+  this.onerror(reason, terminate);
+  return this;
+}
+
+/**
+ * Reset parser state
+ *
+ * @api private
+ */
+
+Receiver.prototype.reset = function (reason) {
+  if (this.dead) return;
+  this.state = EMPTY;
+  this.buffers = [];
+  this.messageEnd = -1;
+  this.spanLength = 0;
+}
+
+/**
+ * Internal api
+ */
+
+function bufferIndex(buffer, byte) {
+  for (var i = 0, l = buffer.length; i < l; ++i) {
+    if (buffer[i] === byte) return i;
+  }
+  return -1;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Receiver.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Receiver.js
new file mode 100755 (executable)
index 0000000..2752726
--- /dev/null
@@ -0,0 +1,591 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+  , Validation = require('./Validation').Validation
+  , ErrorCodes = require('./ErrorCodes')
+  , BufferPool = require('./BufferPool')
+  , bufferUtil = require('./BufferUtil').BufferUtil;
+
+/**
+ * Node version 0.4 and 0.6 compatibility
+ */
+
+var isNodeV4 = /^v0\.4/.test(process.version);
+
+/**
+ * HyBi Receiver implementation
+ */
+
+function Receiver () {
+  // memory pool for fragmented messages
+  var fragmentedPoolPrevUsed = -1;
+  this.fragmentedBufferPool = new BufferPool(1024, function(db, length) {
+    return db.used + length;
+  }, function(db) {
+    return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ?
+      (fragmentedPoolPrevUsed + db.used) / 2 :
+      db.used;
+  });
+
+  // memory pool for unfragmented messages
+  var unfragmentedPoolPrevUsed = -1;
+  this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) {
+    return db.used + length;
+  }, function(db) {
+    return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ?
+      (unfragmentedPoolPrevUsed + db.used) / 2 :
+      db.used;
+  });
+
+  this.state = {
+    activeFragmentedOperation: null,
+    lastFragment: false,
+    masked: false,
+    opcode: 0,
+    fragmentedOperation: false
+  };
+  this.overflow = [];
+  this.headerBuffer = new Buffer(10);
+  this.expectOffset = 0;
+  this.expectBuffer = null;
+  this.expectHandler = null;
+  this.currentMessage = [];
+  this.expectHeader(2, this.processPacket);
+  this.dead = false;
+
+  this.onerror = function() {};
+  this.ontext = function() {};
+  this.onbinary = function() {};
+  this.onclose = function() {};
+  this.onping = function() {};
+  this.onpong = function() {};
+};
+
+module.exports = Receiver;
+
+/**
+ * Add new data to the parser.
+ *
+ * @api public
+ */
+
+Receiver.prototype.add = function(data) {
+  var dataLength = data.length;
+  if (dataLength == 0) return;
+  if (this.expectBuffer == null) {
+    this.overflow.push(data);
+    return;
+  }
+  var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset);
+  fastCopy(toRead, data, this.expectBuffer, this.expectOffset);
+  this.expectOffset += toRead;
+  if (toRead < dataLength) {
+    this.overflow.push(data.slice(toRead));
+  }
+  while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) {
+    var bufferForHandler = this.expectBuffer;
+    this.expectBuffer = null;
+    this.expectOffset = 0;
+    this.expectHandler.call(this, bufferForHandler);
+  }
+}
+
+/**
+ * Releases all resources used by the receiver.
+ *
+ * @api public
+ */
+
+Receiver.prototype.cleanup = function() {
+  this.dead = true;
+  this.overflow = null;
+  this.headerBuffer = null;
+  this.expectBuffer = null;
+  this.expectHandler = null;
+  this.unfragmentedBufferPool = null;
+  this.fragmentedBufferPool = null;
+  this.state = null;
+  this.currentMessage = null;
+  this.onerror = null;
+  this.ontext = null;
+  this.onbinary = null;
+  this.onclose = null;
+  this.onping = null;
+  this.onpong = null;
+}
+
+/**
+ * Waits for a certain amount of header bytes to be available, then fires a callback.
+ *
+ * @api private
+ */
+
+Receiver.prototype.expectHeader = function(length, handler) {
+  if (length == 0) {
+    handler(null);
+    return;
+  }
+  this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length);
+  this.expectHandler = handler;
+  var toRead = length;
+  while (toRead > 0 && this.overflow.length > 0) {
+    var fromOverflow = this.overflow.pop();
+    if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
+    var read = Math.min(fromOverflow.length, toRead);
+    fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
+    this.expectOffset += read;
+    toRead -= read;
+  }
+}
+
+/**
+ * Waits for a certain amount of data bytes to be available, then fires a callback.
+ *
+ * @api private
+ */
+
+Receiver.prototype.expectData = function(length, handler) {
+  if (length == 0) {
+    handler(null);
+    return;
+  }
+  this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation);
+  this.expectHandler = handler;
+  var toRead = length;
+  while (toRead > 0 && this.overflow.length > 0) {
+    var fromOverflow = this.overflow.pop();
+    if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead));
+    var read = Math.min(fromOverflow.length, toRead);
+    fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset);
+    this.expectOffset += read;
+    toRead -= read;
+  }
+}
+
+/**
+ * Allocates memory from the buffer pool.
+ *
+ * @api private
+ */
+
+Receiver.prototype.allocateFromPool = !isNodeV4
+  ? function(length, isFragmented) { return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); }
+  : function(length) { return new Buffer(length); };
+
+/**
+ * Start processing a new packet.
+ *
+ * @api private
+ */
+
+Receiver.prototype.processPacket = function (data) {
+  if ((data[0] & 0x70) != 0) {
+    this.error('reserved fields must be empty', 1002);
+    return;
+  }
+  this.state.lastFragment = (data[0] & 0x80) == 0x80;
+  this.state.masked = (data[1] & 0x80) == 0x80;
+  var opcode = data[0] & 0xf;
+  if (opcode === 0) {
+    // continuation frame
+    this.state.fragmentedOperation = true;
+    this.state.opcode = this.state.activeFragmentedOperation;
+    if (!(this.state.opcode == 1 || this.state.opcode == 2)) {
+      this.error('continuation frame cannot follow current opcode', 1002);
+      return;
+    }
+  }
+  else {
+    if (opcode < 3 && this.state.activeFragmentedOperation != null) {
+      this.error('data frames after the initial data frame must have opcode 0', 1002);
+      return;
+    }
+    this.state.opcode = opcode;
+    if (this.state.lastFragment === false) {
+      this.state.fragmentedOperation = true;
+      this.state.activeFragmentedOperation = opcode;
+    }
+    else this.state.fragmentedOperation = false;
+  }
+  var handler = opcodes[this.state.opcode];
+  if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002);
+  else {
+    handler.start.call(this, data);
+  }
+}
+
+/**
+ * Endprocessing a packet.
+ *
+ * @api private
+ */
+
+Receiver.prototype.endPacket = function() {
+  if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true);
+  else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false);
+  this.expectOffset = 0;
+  this.expectBuffer = null;
+  this.expectHandler = null;
+  if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) {
+    // end current fragmented operation
+    this.state.activeFragmentedOperation = null;
+  }
+  this.state.lastFragment = false;
+  this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0;
+  this.state.masked = false;
+  this.expectHeader(2, this.processPacket);
+}
+
+/**
+ * Reset the parser state.
+ *
+ * @api private
+ */
+
+Receiver.prototype.reset = function() {
+  if (this.dead) return;
+  this.state = {
+    activeFragmentedOperation: null,
+    lastFragment: false,
+    masked: false,
+    opcode: 0,
+    fragmentedOperation: false
+  };
+  this.fragmentedBufferPool.reset(true);
+  this.unfragmentedBufferPool.reset(true);
+  this.expectOffset = 0;
+  this.expectBuffer = null;
+  this.expectHandler = null;
+  this.overflow = [];
+  this.currentMessage = [];
+}
+
+/**
+ * Unmask received data.
+ *
+ * @api private
+ */
+
+Receiver.prototype.unmask = function (mask, buf, binary) {
+  if (mask != null && buf != null) bufferUtil.unmask(buf, mask);
+  if (binary) return buf;
+  return buf != null ? buf.toString('utf8') : '';
+}
+
+/**
+ * Concatenates a list of buffers.
+ *
+ * @api private
+ */
+
+Receiver.prototype.concatBuffers = function(buffers) {
+  var length = 0;
+  for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length;
+  var mergedBuffer = new Buffer(length);
+  bufferUtil.merge(mergedBuffer, buffers);
+  return mergedBuffer;
+}
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Receiver.prototype.error = function (reason, protocolErrorCode) {
+  this.reset();
+  this.onerror(reason, protocolErrorCode);
+  return this;
+}
+
+/**
+ * Buffer utilities
+ */
+
+function readUInt16BE(start) {
+  return (this[start]<<8) +
+         this[start+1];
+}
+
+function readUInt32BE(start) {
+  return (this[start]<<24) +
+         (this[start+1]<<16) +
+         (this[start+2]<<8) +
+         this[start+3];
+}
+
+function fastCopy(length, srcBuffer, dstBuffer, dstOffset) {
+  switch (length) {
+    default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break;
+    case 16: dstBuffer[dstOffset+15] = srcBuffer[15];
+    case 15: dstBuffer[dstOffset+14] = srcBuffer[14];
+    case 14: dstBuffer[dstOffset+13] = srcBuffer[13];
+    case 13: dstBuffer[dstOffset+12] = srcBuffer[12];
+    case 12: dstBuffer[dstOffset+11] = srcBuffer[11];
+    case 11: dstBuffer[dstOffset+10] = srcBuffer[10];
+    case 10: dstBuffer[dstOffset+9] = srcBuffer[9];
+    case 9: dstBuffer[dstOffset+8] = srcBuffer[8];
+    case 8: dstBuffer[dstOffset+7] = srcBuffer[7];
+    case 7: dstBuffer[dstOffset+6] = srcBuffer[6];
+    case 6: dstBuffer[dstOffset+5] = srcBuffer[5];
+    case 5: dstBuffer[dstOffset+4] = srcBuffer[4];
+    case 4: dstBuffer[dstOffset+3] = srcBuffer[3];
+    case 3: dstBuffer[dstOffset+2] = srcBuffer[2];
+    case 2: dstBuffer[dstOffset+1] = srcBuffer[1];
+    case 1: dstBuffer[dstOffset] = srcBuffer[0];
+  }
+}
+
+/**
+ * Opcode handlers
+ */
+
+var opcodes = {
+  // text
+  '1': {
+    start: function(data) {
+      var self = this;
+      // decode length
+      var firstLength = data[1] & 0x7f;
+      if (firstLength < 126) {
+        opcodes['1'].getData.call(self, firstLength);
+      }
+      else if (firstLength == 126) {
+        self.expectHeader(2, function(data) {
+          opcodes['1'].getData.call(self, readUInt16BE.call(data, 0));
+        });
+      }
+      else if (firstLength == 127) {
+        self.expectHeader(8, function(data) {
+          if (readUInt32BE.call(data, 0) != 0) {
+            self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
+            return;
+          }
+          opcodes['1'].getData.call(self, readUInt32BE.call(data, 4));
+        });
+      }
+    },
+    getData: function(length) {
+      var self = this;
+      if (self.state.masked) {
+        self.expectHeader(4, function(data) {
+          var mask = data;
+          self.expectData(length, function(data) {
+            opcodes['1'].finish.call(self, mask, data);
+          });
+        });
+      }
+      else {
+        self.expectData(length, function(data) {
+          opcodes['1'].finish.call(self, null, data);
+        });
+      }
+    },
+    finish: function(mask, data) {
+      var packet = this.unmask(mask, data, true);
+      if (packet != null) this.currentMessage.push(packet);
+      if (this.state.lastFragment) {
+        var messageBuffer = this.concatBuffers(this.currentMessage);
+        if (!Validation.isValidUTF8(messageBuffer)) {
+          this.error('invalid utf8 sequence', 1007);
+          return;
+        }
+        this.ontext(messageBuffer.toString('utf8'), {masked: this.state.masked, buffer: messageBuffer});
+        this.currentMessage = [];
+      }
+      this.endPacket();
+    }
+  },
+  // binary
+  '2': {
+    start: function(data) {
+      var self = this;
+      // decode length
+      var firstLength = data[1] & 0x7f;
+      if (firstLength < 126) {
+        opcodes['2'].getData.call(self, firstLength);
+      }
+      else if (firstLength == 126) {
+        self.expectHeader(2, function(data) {
+          opcodes['2'].getData.call(self, readUInt16BE.call(data, 0));
+        });
+      }
+      else if (firstLength == 127) {
+        self.expectHeader(8, function(data) {
+          if (readUInt32BE.call(data, 0) != 0) {
+            self.error('packets with length spanning more than 32 bit is currently not supported', 1008);
+            return;
+          }
+          opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true));
+        });
+      }
+    },
+    getData: function(length) {
+      var self = this;
+      if (self.state.masked) {
+        self.expectHeader(4, function(data) {
+          var mask = data;
+          self.expectData(length, function(data) {
+            opcodes['2'].finish.call(self, mask, data);
+          });
+        });
+      }
+      else {
+        self.expectData(length, function(data) {
+          opcodes['2'].finish.call(self, null, data);
+        });
+      }
+    },
+    finish: function(mask, data) {
+      var packet = this.unmask(mask, data, true);
+      if (packet != null) this.currentMessage.push(packet);
+      if (this.state.lastFragment) {
+        var messageBuffer = this.concatBuffers(this.currentMessage);
+        this.onbinary(messageBuffer, {masked: this.state.masked, buffer: messageBuffer});
+        this.currentMessage = [];
+      }
+      this.endPacket();
+    }
+  },
+  // close
+  '8': {
+    start: function(data) {
+      var self = this;
+      if (self.state.lastFragment == false) {
+        self.error('fragmented close is not supported', 1002);
+        return;
+      }
+
+      // decode length
+      var firstLength = data[1] & 0x7f;
+      if (firstLength < 126) {
+        opcodes['8'].getData.call(self, firstLength);
+      }
+      else {
+        self.error('control frames cannot have more than 125 bytes of data', 1002);
+      }
+    },
+    getData: function(length) {
+      var self = this;
+      if (self.state.masked) {
+        self.expectHeader(4, function(data) {
+          var mask = data;
+          self.expectData(length, function(data) {
+            opcodes['8'].finish.call(self, mask, data);
+          });
+        });
+      }
+      else {
+        self.expectData(length, function(data) {
+          opcodes['8'].finish.call(self, null, data);
+        });
+      }
+    },
+    finish: function(mask, data) {
+      var self = this;
+      data = self.unmask(mask, data, true);
+      if (data && data.length == 1) {
+        self.error('close packets with data must be at least two bytes long', 1002);
+        return;
+      }
+      var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000;
+      if (!ErrorCodes.isValidErrorCode(code)) {
+        self.error('invalid error code', 1002);
+        return;
+      }
+      var message = '';
+      if (data && data.length > 2) {
+        var messageBuffer = data.slice(2);
+        if (!Validation.isValidUTF8(messageBuffer)) {
+          self.error('invalid utf8 sequence', 1007);
+          return;
+        }
+        message = messageBuffer.toString('utf8');
+      }
+      this.onclose(code, message, {masked: self.state.masked});
+      this.reset();
+    },
+  },
+  // ping
+  '9': {
+    start: function(data) {
+      var self = this;
+      if (self.state.lastFragment == false) {
+        self.error('fragmented ping is not supported', 1002);
+        return;
+      }
+
+      // decode length
+      var firstLength = data[1] & 0x7f;
+      if (firstLength < 126) {
+        opcodes['9'].getData.call(self, firstLength);
+      }
+      else {
+        self.error('control frames cannot have more than 125 bytes of data', 1002);
+      }
+    },
+    getData: function(length) {
+      var self = this;
+      if (self.state.masked) {
+        self.expectHeader(4, function(data) {
+          var mask = data;
+          self.expectData(length, function(data) {
+            opcodes['9'].finish.call(self, mask, data);
+          });
+        });
+      }
+      else {
+        self.expectData(length, function(data) {
+          opcodes['9'].finish.call(self, null, data);
+        });
+      }
+    },
+    finish: function(mask, data) {
+      this.onping(this.unmask(mask, data, true), {masked: this.state.masked, binary: true});
+      this.endPacket();
+    }
+  },
+  // pong
+  '10': {
+    start: function(data) {
+      var self = this;
+      if (self.state.lastFragment == false) {
+        self.error('fragmented pong is not supported', 1002);
+        return;
+      }
+
+      // decode length
+      var firstLength = data[1] & 0x7f;
+      if (firstLength < 126) {
+        opcodes['10'].getData.call(self, firstLength);
+      }
+      else {
+        self.error('control frames cannot have more than 125 bytes of data', 1002);
+      }
+    },
+    getData: function(length) {
+      var self = this;
+      if (this.state.masked) {
+        this.expectHeader(4, function(data) {
+          var mask = data;
+          self.expectData(length, function(data) {
+            opcodes['10'].finish.call(self, mask, data);
+          });
+        });
+      }
+      else {
+        this.expectData(length, function(data) {
+          opcodes['10'].finish.call(self, null, data);
+        });
+      }
+    },
+    finish: function(mask, data) {
+      this.onpong(this.unmask(mask, data, true), {masked: this.state.masked, binary: true});
+      this.endPacket();
+    }
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Sender.hixie.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Sender.hixie.js
new file mode 100755 (executable)
index 0000000..1754afb
--- /dev/null
@@ -0,0 +1,123 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var events = require('events')
+  , util = require('util')
+  , EventEmitter = events.EventEmitter;
+
+/**
+ * Hixie Sender implementation
+ */
+
+function Sender(socket) {
+  this.socket = socket;
+  this.continuationFrame = false;
+  this.isClosed = false;
+}
+
+module.exports = Sender;
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(Sender, events.EventEmitter);
+
+/**
+ * Frames and writes data.
+ *
+ * @api public
+ */
+
+Sender.prototype.send = function(data, options, cb) {
+  if (this.isClosed) return;
+/*
+  if (options && options.binary) {
+    this.error('hixie websockets do not support binary');
+    return;
+  }
+*/
+  var isString = typeof data == 'string'
+    , length = isString ? Buffer.byteLength(data) : data.length
+    , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes
+    , writeStartMarker = this.continuationFrame == false
+    , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin)
+    , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0))
+    , offset = writeStartMarker ? 1 : 0;
+
+  if (writeStartMarker) {
+    if (options && options.binary) {
+      buffer.write('\x80', 'binary');
+      // assume length less than 2**14 bytes
+      if (lengthbytes > 1) 
+        buffer.write(String.fromCharCode(128+length/128), offset++, 'binary');
+      buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary');
+    } else
+      buffer.write('\x00', 'binary');
+  }
+
+  if (isString) buffer.write(data, offset, 'utf8');
+  else data.copy(buffer, offset, 0);
+
+  if (writeEndMarker) {
+    if (options && options.binary) {
+      // sending binary, not writing end marker
+    } else 
+      buffer.write('\xff', offset + length, 'binary');
+    this.continuationFrame = false;
+  }
+  else this.continuationFrame = true;
+
+  try {
+    this.socket.write(buffer, 'binary', cb);
+  } catch (e) {
+    this.error(e.toString());
+  }
+}
+
+/**
+ * Sends a close instruction to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.close = function(code, data, mask, cb) {
+  if (this.isClosed) return;
+  this.isClosed = true;
+  try {
+    if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary'));
+    this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb);
+  } catch (e) {
+    this.error(e.toString());
+  }
+}
+
+/**
+ * Sends a ping message to the remote party. Not available for hixie.
+ *
+ * @api public
+ */
+
+Sender.prototype.ping = function(data, options) {}
+
+/**
+ * Sends a pong message to the remote party. Not available for hixie.
+ *
+ * @api public
+ */
+
+Sender.prototype.pong = function(data, options) {}
+
+/**
+ * Handles an error
+ *
+ * @api private
+ */
+
+Sender.prototype.error = function (reason) {
+  this.emit('error', reason);
+  return this;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Sender.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Sender.js
new file mode 100755 (executable)
index 0000000..fc3b437
--- /dev/null
@@ -0,0 +1,227 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var events = require('events')
+  , util = require('util')
+  , EventEmitter = events.EventEmitter
+  , ErrorCodes = require('./ErrorCodes')
+  , bufferUtil = require('./BufferUtil').BufferUtil;
+
+/**
+ * HyBi Sender implementation
+ */
+
+function Sender(socket) {
+  this._socket = socket;
+  this.firstFragment = true;
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(Sender, events.EventEmitter);
+
+/**
+ * Sends a close instruction to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.close = function(code, data, mask) {
+  if (typeof code !== 'undefined') {
+    if (typeof code !== 'number' ||
+      !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number');
+  }
+  code = code || 1000;
+  var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0));
+  writeUInt16BE.call(dataBuffer, code, 0);
+  if (dataBuffer.length > 2) dataBuffer.write(data, 2);
+  this.frameAndSend(0x8, dataBuffer, true, mask);
+}
+
+/**
+ * Sends a ping message to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.ping = function(data, options) {
+  var mask = options && options.mask;
+  this.frameAndSend(0x9, data || '', true, mask);
+}
+
+/**
+ * Sends a pong message to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.pong = function(data, options) {
+  var mask = options && options.mask;
+  this.frameAndSend(0xa, data || '', true, mask);
+}
+
+/**
+ * Sends text or binary data to the remote party.
+ *
+ * @api public
+ */
+
+Sender.prototype.send = function(data, options, cb) {
+  var finalFragment = options && options.fin === false ? false : true;
+  var mask = options && options.mask;
+  var opcode = options && options.binary ? 2 : 1;
+  if (this.firstFragment === false) opcode = 0;
+  else this.firstFragment = false;
+  if (finalFragment) this.firstFragment = true
+  this.frameAndSend(opcode, data, finalFragment, mask, cb);
+}
+
+/**
+ * Frames and sends a piece of data according to the HyBi WebSocket protocol.
+ *
+ * @api private
+ */
+
+Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, cb) {
+  var canModifyData = false;
+
+  if (!data) {
+    try {
+      this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb);
+    }
+    catch (e) {
+      if (typeof cb == 'function') cb(e);
+      else this.emit('error', e);
+    }
+    return;
+  }
+
+  if (!Buffer.isBuffer(data)) {
+    canModifyData = true;
+    if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) {
+      data = getArrayBuffer(data);
+    } else {
+      data = new Buffer(data);
+    }
+  }
+
+  var dataLength = data.length
+    , dataOffset = maskData ? 6 : 2
+    , secondByte = dataLength;
+
+  if (dataLength >= 65536) {
+    dataOffset += 8;
+    secondByte = 127;
+  }
+  else if (dataLength > 125) {
+    dataOffset += 2;
+    secondByte = 126;
+  }
+
+  var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData);
+  var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset;
+  var outputBuffer = new Buffer(totalLength);
+  outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode;
+
+  switch (secondByte) {
+    case 126:
+      writeUInt16BE.call(outputBuffer, dataLength, 2);
+      break;
+    case 127:
+      writeUInt32BE.call(outputBuffer, 0, 2);
+      writeUInt32BE.call(outputBuffer, dataLength, 6);
+  }
+
+  if (maskData) {
+    outputBuffer[1] = secondByte | 0x80;
+    var mask = this._randomMask || (this._randomMask = getRandomMask());
+    outputBuffer[dataOffset - 4] = mask[0];
+    outputBuffer[dataOffset - 3] = mask[1];
+    outputBuffer[dataOffset - 2] = mask[2];
+    outputBuffer[dataOffset - 1] = mask[3];
+    if (mergeBuffers) {
+      bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength);
+      try {
+        this._socket.write(outputBuffer, 'binary', cb);
+      }
+      catch (e) {
+        if (typeof cb == 'function') cb(e);
+        else this.emit('error', e);
+      }
+    }
+    else {
+      bufferUtil.mask(data, mask, data, 0, dataLength);
+      try {
+        this._socket.write(outputBuffer, 'binary');
+        this._socket.write(data, 'binary', cb);
+      }
+      catch (e) {
+        if (typeof cb == 'function') cb(e);
+        else this.emit('error', e);
+      }
+    }
+  }
+  else {
+    outputBuffer[1] = secondByte;
+    if (mergeBuffers) {
+      data.copy(outputBuffer, dataOffset);
+      try {
+        this._socket.write(outputBuffer, 'binary', cb);
+      }
+      catch (e) {
+        if (typeof cb == 'function') cb(e);
+        else this.emit('error', e);
+      }
+    }
+    else {
+      try {
+        this._socket.write(outputBuffer, 'binary');
+        this._socket.write(data, 'binary', cb);
+      }
+      catch (e) {
+        if (typeof cb == 'function') cb(e);
+        else this.emit('error', e);
+      }
+    }
+  }
+}
+
+module.exports = Sender;
+
+function writeUInt16BE(value, offset) {
+  this[offset] = (value & 0xff00)>>8;
+  this[offset+1] = value & 0xff;
+}
+
+function writeUInt32BE(value, offset) {
+  this[offset] = (value & 0xff000000)>>24;
+  this[offset+1] = (value & 0xff0000)>>16;
+  this[offset+2] = (value & 0xff00)>>8;
+  this[offset+3] = value & 0xff;
+}
+
+function getArrayBuffer(data) {
+  // data is either an ArrayBuffer or ArrayBufferView.
+  var array = new Uint8Array(data.buffer || data)
+    , l = data.byteLength || data.length
+    , o = data.byteOffset || 0
+    , buffer = new Buffer(l);
+  for (var i = 0; i < l; ++i) {
+    buffer[i] = array[o+i];
+  }
+  return buffer;
+}
+
+function getRandomMask() {
+  return new Buffer([
+    ~~(Math.random() * 255),
+    ~~(Math.random() * 255),
+    ~~(Math.random() * 255),
+    ~~(Math.random() * 255)
+  ]);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Validation.fallback.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Validation.fallback.js
new file mode 100755 (executable)
index 0000000..2c7c4fd
--- /dev/null
@@ -0,0 +1,12 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+module.exports.Validation = {
+  isValidUTF8: function(buffer) {
+    return true;
+  }
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Validation.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/Validation.js
new file mode 100755 (executable)
index 0000000..99faf5f
--- /dev/null
@@ -0,0 +1,16 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+try {
+  module.exports = require('../build/Release/validation');
+} catch (e) { try {
+  module.exports = require('../build/default/validation');
+} catch (e) { try {
+  module.exports = require('./Validation.fallback.js');
+} catch (e) {
+  console.error('validation.node seems to not have been built. Run npm install.');
+  throw e;
+}}}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/WebSocket.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/WebSocket.js
new file mode 100755 (executable)
index 0000000..bc29453
--- /dev/null
@@ -0,0 +1,819 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+  , events = require('events')
+  , http = require('http')
+  , https = require('https')
+  , crypto = require('crypto')
+  , url = require('url')
+  , fs = require('fs')
+  , Options = require('options')
+  , Sender = require('./Sender')
+  , Receiver = require('./Receiver')
+  , SenderHixie = require('./Sender.hixie.js')
+  , ReceiverHixie = require('./Receiver.hixie.js');
+
+/**
+ * Constants
+ */
+
+// Default protocol version
+
+var protocolVersion = 13;
+
+// Close timeout
+
+var closeTimeout = 5000; // Allow 5 seconds to terminate the connection cleanly
+
+/**
+ * Node version 0.4 and 0.6 compatibility
+ */
+
+var isNodeV4 = /^v0\.4/.test(process.version);
+
+/**
+ * WebSocket implementation
+ */
+
+function WebSocket(address, protocols, options) {
+
+  if (protocols && !Array.isArray(protocols) && 'object' == typeof protocols) {
+    // accept the "options" Object as the 2nd argument
+    options = protocols;
+    protocols = null;
+  }
+  if ('string' == typeof protocols) {
+    protocols = [ protocols ];
+  }
+  if (!Array.isArray(protocols)) {
+    protocols = [];
+  }
+  // TODO: actually handle the `Sub-Protocols` part of the WebSocket client
+
+  this._socket = null;
+  this.bytesReceived = 0;
+  this.readyState = null;
+  this.supports = {};
+  this.req = address;
+
+  if (Array.isArray(address)) {
+    initAsServerClient.apply(this, address.concat(options));
+  } else {
+    initAsClient.apply(this, [address, protocols, options]);
+  }
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(WebSocket, events.EventEmitter);
+
+/**
+ * Ready States
+ */
+
+["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function (state, index) {
+    WebSocket.prototype[state] = WebSocket[state] = index;
+});
+
+/**
+ * Gracefully closes the connection, after sending a description message to the server
+ *
+ * @param {Object} data to be sent to the server
+ * @api public
+ */
+
+WebSocket.prototype.close = function(code, data) {
+  if (this.readyState == WebSocket.CLOSING || this.readyState == WebSocket.CLOSED) return;
+  if (this.readyState == WebSocket.CONNECTING) {
+    this.readyState = WebSocket.CLOSED;
+    return;
+  }
+  try {
+    this.readyState = WebSocket.CLOSING;
+    this._closeCode = code;
+    this._closeMessage = data;
+    var mask = !this._isServer;
+    this._sender.close(code, data, mask);
+  }
+  catch (e) {
+    this.emit('error', e);
+  }
+  finally {
+    this.terminate();
+  }
+}
+
+/**
+ * Pause the client stream
+ *
+ * @api public
+ */
+
+WebSocket.prototype.pause = function() {
+  if (this.readyState != WebSocket.OPEN) throw new Error('not opened');
+  return this._socket.pause();
+}
+
+/**
+ * Sends a ping
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
+ * @api public
+ */
+
+WebSocket.prototype.ping = function(data, options, dontFailWhenClosed) {
+  if (this.readyState != WebSocket.OPEN) {
+    if (dontFailWhenClosed === true) return;
+    throw new Error('not opened');
+  }
+  options = options || {};
+  if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+  this._sender.ping(data, options);
+}
+
+/**
+ * Sends a pong
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open
+ * @api public
+ */
+
+WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) {
+  if (this.readyState != WebSocket.OPEN) {
+    if (dontFailWhenClosed === true) return;
+    throw new Error('not opened');
+  }
+  options = options || {};
+  if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+  this._sender.pong(data, options);
+}
+
+/**
+ * Resume the client stream
+ *
+ * @api public
+ */
+
+WebSocket.prototype.resume = function() {
+  if (this.readyState != WebSocket.OPEN) throw new Error('not opened');
+  return this._socket.resume();
+}
+
+/**
+ * Sends a piece of data
+ *
+ * @param {Object} data to be sent to the server
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {function} Optional callback which is executed after the send completes
+ * @api public
+ */
+
+WebSocket.prototype.send = function(data, options, cb) {
+  if (typeof options == 'function') {
+    cb = options;
+    options = {};
+  }
+  if (this.readyState != WebSocket.OPEN) {
+    if (typeof cb == 'function') cb(new Error('not opened'));
+    else throw new Error('not opened');
+    return;
+  }
+  if (!data) data = '';
+  if (this._queue) {
+    var self = this;
+    this._queue.push(function() { self.send(data, options, cb); });
+    return;
+  }
+  options = options || {};
+  options.fin = true;
+  if (typeof options.binary == 'undefined') {
+    options.binary = (data instanceof ArrayBuffer || data instanceof Buffer ||
+      data instanceof Uint8Array ||
+      data instanceof Uint16Array ||
+      data instanceof Uint32Array ||
+      data instanceof Int8Array ||
+      data instanceof Int16Array ||
+      data instanceof Int32Array ||
+      data instanceof Float32Array ||
+      data instanceof Float64Array);
+  }
+  if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+  if (data instanceof fs.ReadStream) {
+    startQueue(this);
+    var self = this;
+    sendStream(this, data, options, function(error) {
+      process.nextTick(function() { executeQueueSends(self); });
+      if (typeof cb == 'function') cb(error);
+    });
+  }
+  else this._sender.send(data, options, cb);
+}
+
+/**
+ * Streams data through calls to a user supplied function
+ *
+ * @param {Object} Members - mask: boolean, binary: boolean
+ * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'.
+ * @api public
+ */
+
+WebSocket.prototype.stream = function(options, cb) {
+  if (typeof options == 'function') {
+    cb = options;
+    options = {};
+  }
+  var self = this;
+  if (typeof cb != 'function') throw new Error('callback must be provided');
+  if (this.readyState != WebSocket.OPEN) {
+    if (typeof cb == 'function') cb(new Error('not opened'));
+    else throw new Error('not opened');
+    return;
+  }
+  if (this._queue) {
+    this._queue.push(function() { self.stream(options, cb); });
+    return;
+  }
+  options = options || {};
+  if (typeof options.mask == 'undefined') options.mask = !this._isServer;
+  startQueue(this);
+  var send = function(data, final) {
+    try {
+      if (self.readyState != WebSocket.OPEN) throw new Error('not opened');
+      options.fin = final === true;
+      self._sender.send(data, options);
+      if (!final) process.nextTick(cb.bind(null, null, send));
+      else executeQueueSends(self);
+    }
+    catch (e) {
+      if (typeof cb == 'function') cb(e);
+      else {
+        delete self._queue;
+        self.emit('error', e);
+      }
+    }
+  }
+  process.nextTick(cb.bind(null, null, send));
+}
+
+/**
+ * Immediately shuts down the connection
+ *
+ * @api public
+ */
+
+WebSocket.prototype.terminate = function() {
+  if (this.readyState == WebSocket.CLOSED) return;
+  if (this._socket) {
+    try {
+      // End the connection
+      this._socket.end();
+    }
+    catch (e) {
+      // Socket error during end() call, so just destroy it right now
+      cleanupWebsocketResources.call(this, true);
+      return;
+    }
+
+    // Add a timeout to ensure that the connection is completely
+    // cleaned up within 30 seconds, even if the clean close procedure
+    // fails for whatever reason
+    this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout);
+  }
+  else if (this.readyState == WebSocket.CONNECTING) {
+    cleanupWebsocketResources.call(this, true);
+  }
+};
+
+/**
+ * Expose bufferedAmount
+ *
+ * @api public
+ */
+
+Object.defineProperty(WebSocket.prototype, 'bufferedAmount', {
+  get: function get() {
+    var amount = 0;
+    if (this._socket) {
+      amount = this._socket.bufferSize || 0;
+    }
+    return amount;
+  }
+});
+
+/**
+ * Emulates the W3C Browser based WebSocket interface using function members.
+ *
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
+ * @api public
+ */
+
+['open', 'error', 'close', 'message'].forEach(function(method) {
+  Object.defineProperty(WebSocket.prototype, 'on' + method, {
+    /**
+     * Returns the current listener
+     *
+     * @returns {Mixed} the set function or undefined
+     * @api public
+     */
+
+    get: function get() {
+      var listener = this.listeners(method)[0];
+      return listener ? (listener._listener ? listener._listener : listener) : undefined;
+    },
+
+    /**
+     * Start listening for events
+     *
+     * @param {Function} listener the listener
+     * @returns {Mixed} the set function or undefined
+     * @api public
+     */
+
+    set: function set(listener) {
+      this.removeAllListeners(method);
+      this.addEventListener(method, listener);
+    }
+  });
+});
+
+/**
+ * Emulates the W3C Browser based WebSocket interface using addEventListener.
+ *
+ * @see https://developer.mozilla.org/en/DOM/element.addEventListener
+ * @see http://dev.w3.org/html5/websockets/#the-websocket-interface
+ * @api public
+ */
+WebSocket.prototype.addEventListener = function(method, listener) {
+  var target = this;
+  if (typeof listener === 'function') {
+    if (method === 'message') {
+      function onMessage (data, flags) {
+        listener.call(this, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target));
+      }
+      // store a reference so we can return the original function from the addEventListener hook
+      onMessage._listener = listener;
+      this.on(method, onMessage);
+    } else if (method === 'close') {
+      function onClose (code, message) {
+        listener.call(this, new CloseEvent(code, message, target));
+      }
+      // store a reference so we can return the original function from the addEventListener hook
+      onClose._listener = listener;
+      this.on(method, onClose);
+    } else if (method === 'error') {
+      function onError (event) {
+        event.target = target;
+        listener.call(this, event);
+      }
+      // store a reference so we can return the original function from the addEventListener hook
+      onError._listener = listener;
+      this.on(method, onError);
+    } else if (method === 'open') {
+      function onOpen () {
+        listener.call(this, new OpenEvent(target));
+      }
+      // store a reference so we can return the original function from the addEventListener hook
+      onOpen._listener = listener;
+      this.on(method, onOpen);
+    } else {
+      this.on(method, listener);
+    }
+  }
+}
+
+module.exports = WebSocket;
+
+/**
+ * W3C MessageEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function MessageEvent(dataArg, typeArg, target) {
+  this.data = dataArg;
+  this.type = typeArg;
+  this.target = target;
+}
+
+/**
+ * W3C CloseEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function CloseEvent(code, reason, target) {
+  this.wasClean = (typeof code == 'undefined' || code == 1000);
+  this.code = code;
+  this.reason = reason;
+  this.target = target;
+}
+
+/**
+ * W3C OpenEvent
+ *
+ * @see http://www.w3.org/TR/html5/comms.html
+ * @api private
+ */
+
+function OpenEvent(target) {
+  this.target = target;
+}
+
+/**
+ * Entirely private apis,
+ * which may or may not be bound to a sepcific WebSocket instance.
+ */
+
+function initAsServerClient(req, socket, upgradeHead, options) {
+  options = new Options({
+    protocolVersion: protocolVersion,
+    protocol: null
+  }).merge(options);
+
+  // expose state properties
+  this.protocol = options.value.protocol;
+  this.protocolVersion = options.value.protocolVersion;
+  this.supports.binary = (this.protocolVersion != 'hixie-76');
+  this.upgradeReq = req;
+  this.readyState = WebSocket.CONNECTING;
+  this._isServer = true;
+
+  // establish connection
+  if (options.value.protocolVersion == 'hixie-76') establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead);
+  else establishConnection.call(this, Receiver, Sender, socket, upgradeHead);
+}
+
+function initAsClient(address, protocols, options) {
+  options = new Options({
+    origin: null,
+    protocolVersion: protocolVersion,
+    host: null,
+    headers: null,
+    protocol: null,
+    agent: null,
+
+    // ssl-related options
+    pfx: null,
+    key: null,
+    passphrase: null,
+    cert: null,
+    ca: null,
+    ciphers: null,
+    rejectUnauthorized: null
+  }).merge(options);
+  if (options.value.protocolVersion != 8 && options.value.protocolVersion != 13) {
+    throw new Error('unsupported protocol version');
+  }
+
+  // verify url and establish http class
+  var serverUrl = url.parse(address);
+  var isUnixSocket = serverUrl.protocol === 'ws+unix:';
+  if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url');
+  var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:';
+  var httpObj = isSecure ? https : http;
+  var port = serverUrl.port || (isSecure ? 443 : 80);
+  var auth = serverUrl.auth;
+
+  // expose state properties
+  this._isServer = false;
+  this.url = address;
+  this.protocolVersion = options.value.protocolVersion;
+  this.supports.binary = (this.protocolVersion != 'hixie-76');
+
+  // begin handshake
+  var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64');
+  var shasum = crypto.createHash('sha1');
+  shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11');
+  var expectedServerKey = shasum.digest('base64');
+
+  var agent = options.value.agent;
+  // node<=v0.4.x compatibility
+  if (!agent && isNodeV4) {
+    isNodeV4 = true;
+    agent = new httpObj.Agent({
+      host: serverUrl.hostname,
+      port: port
+    });
+  }
+
+  var headerHost = serverUrl.hostname;
+  // Append port number to Host and Origin header, only if specified in the url and non-default
+  if(serverUrl.port) {
+    if((isSecure && (port != 443)) || (!isSecure && (port != 80))){
+      headerHost = headerHost + ':' + port;
+    }
+  }
+
+  var requestOptions = {
+    port: port,
+    host: serverUrl.hostname,
+    headers: {
+      'Connection': 'Upgrade',
+      'Upgrade': 'websocket',
+      'Host': headerHost,
+      'Origin': headerHost,
+      'Sec-WebSocket-Version': options.value.protocolVersion,
+      'Sec-WebSocket-Key': key
+    }
+  };
+
+  // If we have basic auth.
+  if (auth) {
+    requestOptions.headers['Authorization'] = 'Basic ' + new Buffer(auth).toString('base64');
+  }
+
+  if (options.value.protocol) {
+    requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol;
+  }
+
+  if (options.value.host) {
+    requestOptions.headers['Host'] = options.value.host;
+  }
+
+  if (options.value.headers) {
+    for (var header in options.value.headers) {
+       if (options.value.headers.hasOwnProperty(header)) {
+        requestOptions.headers[header] = options.value.headers[header];
+       }
+    }
+  }
+
+  if (options.isDefinedAndNonNull('pfx')
+   || options.isDefinedAndNonNull('key')
+   || options.isDefinedAndNonNull('passphrase')
+   || options.isDefinedAndNonNull('cert')
+   || options.isDefinedAndNonNull('ca')
+   || options.isDefinedAndNonNull('ciphers')
+   || options.isDefinedAndNonNull('rejectUnauthorized')) {
+
+    if (isNodeV4) {
+      throw new Error('Client side certificates are not supported on Node 0.4.x');
+    }
+
+    if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx;
+    if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key;
+    if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase;
+    if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert;
+    if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca;
+    if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers;
+    if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized;
+
+    if (!agent) {
+        // global agent ignores client side certificates
+        agent = new httpObj.Agent(requestOptions);
+    }
+  }
+
+  if (isNodeV4) {
+    requestOptions.path = (serverUrl.pathname || '/') + (serverUrl.search || '');
+  }
+  else requestOptions.path = serverUrl.path || '/';
+
+  if (agent) {
+    requestOptions.agent = agent;
+  }
+
+  if (isUnixSocket) {
+    requestOptions.socketPath = serverUrl.pathname;
+  }
+  if (options.value.origin) {
+    if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin;
+    else requestOptions.headers['Origin'] = options.value.origin;
+  }
+
+  var self = this;
+  var req = httpObj.request(requestOptions);
+
+  (isNodeV4 ? agent : req).on('error', function(error) {
+    self.emit('error', error);
+    cleanupWebsocketResources.call(this, error);
+  });
+  (isNodeV4 ? agent : req).once('response', function(res) {
+    var error = new Error('unexpected server response (' + res.statusCode + ')');
+    self.emit('error', error);
+    cleanupWebsocketResources.call(this, error);
+  });
+  (isNodeV4 ? agent : req).once('upgrade', function(res, socket, upgradeHead) {
+    if (self.readyState == WebSocket.CLOSED) {
+      // client closed before server accepted connection
+      self.emit('close');
+      removeAllListeners(self);
+      socket.end();
+      return;
+    }
+    var serverKey = res.headers['sec-websocket-accept'];
+    if (typeof serverKey == 'undefined' || serverKey !== expectedServerKey) {
+      self.emit('error', 'invalid server key');
+      removeAllListeners(self);
+      socket.end();
+      return;
+    }
+
+    var serverProt = res.headers['sec-websocket-protocol'];
+    var protList = (options.value.protocol || "").split(/, */);
+    var protError = null;
+    if (!options.value.protocol && serverProt) {
+        protError = 'server sent a subprotocol even though none requested';
+    } else if (options.value.protocol && !serverProt) {
+        protError = 'server sent no subprotocol even though requested';
+    } else if (serverProt && protList.indexOf(serverProt) === -1) {
+        protError = 'server responded with an invalid protocol';
+    }
+    if (protError) {
+        self.emit('error', protError);
+        removeAllListeners(self);
+        socket.end();
+        return;
+    } else if (serverProt) {
+        self.protocol = serverProt;
+    }
+
+    establishConnection.call(self, Receiver, Sender, socket, upgradeHead);
+
+    // perform cleanup on http resources
+    removeAllListeners(isNodeV4 ? agent : req);
+    req = null;
+    agent = null;
+  });
+
+  req.end();
+  this.readyState = WebSocket.CONNECTING;
+}
+
+function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) {
+  this._socket = socket;
+  socket.setTimeout(0);
+  socket.setNoDelay(true);
+  var self = this;
+  this._receiver = new ReceiverClass();
+
+  // socket cleanup handlers
+  socket.on('end', cleanupWebsocketResources.bind(this));
+  socket.on('close', cleanupWebsocketResources.bind(this));
+  socket.on('error', cleanupWebsocketResources.bind(this));
+
+  // ensure that the upgradeHead is added to the receiver
+  function firstHandler(data) {
+    if (self.readyState != WebSocket.OPEN) return;
+    if (upgradeHead && upgradeHead.length > 0) {
+      self.bytesReceived += upgradeHead.length;
+      var head = upgradeHead;
+      upgradeHead = null;
+      self._receiver.add(head);
+    }
+    dataHandler = realHandler;
+    if (data) {
+      self.bytesReceived += data.length;
+      self._receiver.add(data);
+    }
+  }
+  // subsequent packets are pushed straight to the receiver
+  function realHandler(data) {
+    if (data) self.bytesReceived += data.length;
+    self._receiver.add(data);
+  }
+  var dataHandler = firstHandler;
+  // if data was passed along with the http upgrade,
+  // this will schedule a push of that on to the receiver.
+  // this has to be done on next tick, since the caller
+  // hasn't had a chance to set event handlers on this client
+  // object yet.
+  process.nextTick(firstHandler);
+
+  // receiver event handlers
+  self._receiver.ontext = function (data, flags) {
+    flags = flags || {};
+    self.emit('message', data, flags);
+  };
+  self._receiver.onbinary = function (data, flags) {
+    flags = flags || {};
+    flags.binary = true;
+    self.emit('message', data, flags);
+  };
+  self._receiver.onping = function(data, flags) {
+    flags = flags || {};
+    self.pong(data, {mask: !self._isServer, binary: flags.binary === true}, true);
+    self.emit('ping', data, flags);
+  };
+  self._receiver.onpong = function(data, flags) {
+    self.emit('pong', data, flags);
+  };
+  self._receiver.onclose = function(code, data, flags) {
+    flags = flags || {};
+    self.close(code, data);
+  };
+  self._receiver.onerror = function(reason, errorCode) {
+    // close the connection when the receiver reports a HyBi error code
+    self.close(typeof errorCode != 'undefined' ? errorCode : 1002, '');
+    self.emit('error', reason, errorCode);
+  };
+
+  // finalize the client
+  this._sender = new SenderClass(socket);
+  this._sender.on('error', function(error) {
+    self.close(1002, '');
+    self.emit('error', error);
+  });
+  this.readyState = WebSocket.OPEN;
+  this.emit('open');
+
+  socket.on('data', dataHandler);
+}
+
+function startQueue(instance) {
+  instance._queue = instance._queue || [];
+}
+
+function executeQueueSends(instance) {
+  var queue = instance._queue;
+  if (typeof queue == 'undefined') return;
+  delete instance._queue;
+  for (var i = 0, l = queue.length; i < l; ++i) {
+    queue[i]();
+  }
+}
+
+function sendStream(instance, stream, options, cb) {
+  stream.on('data', function(data) {
+    if (instance.readyState != WebSocket.OPEN) {
+      if (typeof cb == 'function') cb(new Error('not opened'));
+      else {
+        delete instance._queue;
+        instance.emit('error', new Error('not opened'));
+      }
+      return;
+    }
+    options.fin = false;
+    instance._sender.send(data, options);
+  });
+  stream.on('end', function() {
+    if (instance.readyState != WebSocket.OPEN) {
+      if (typeof cb == 'function') cb(new Error('not opened'));
+      else {
+        delete instance._queue;
+        instance.emit('error', new Error('not opened'));
+      }
+      return;
+    }
+    options.fin = true;
+    instance._sender.send(null, options);
+    if (typeof cb == 'function') cb(null);
+  });
+}
+
+function cleanupWebsocketResources(error) {
+  if (this.readyState == WebSocket.CLOSED) return;
+  var emitClose = this.readyState != WebSocket.CONNECTING;
+  this.readyState = WebSocket.CLOSED;
+
+  clearTimeout(this._closeTimer);
+  this._closeTimer = null;
+  if (emitClose) this.emit('close', this._closeCode || 1000, this._closeMessage || '');
+
+  if (this._socket) {
+    removeAllListeners(this._socket);
+    // catch all socket error after removing all standard handlers
+    var socket = this._socket;
+    this._socket.on('error', function() {
+      try { socket.destroy(); } catch (e) {}
+    });
+    try {
+      if (!error) this._socket.end();
+      else this._socket.destroy();
+    }
+    catch (e) { /* Ignore termination errors */ }
+    this._socket = null;
+  }
+  if (this._sender) {
+    removeAllListeners(this._sender);
+    this._sender = null;
+  }
+  if (this._receiver) {
+    this._receiver.cleanup();
+    this._receiver = null;
+  }
+  removeAllListeners(this);
+  this.on('error', function() {}); // catch all errors after this
+  delete this._queue;
+}
+
+function removeAllListeners(instance) {
+  if (isNodeV4) {
+    // node v4 doesn't *actually* remove all listeners globally,
+    // so we do that instead
+    instance._events = {};
+  }
+  else instance.removeAllListeners();
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/WebSocketServer.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/WebSocketServer.js
new file mode 100755 (executable)
index 0000000..8d0197d
--- /dev/null
@@ -0,0 +1,508 @@
+/*!
+ * ws: a node.js websocket client
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var util = require('util')
+  , events = require('events')
+  , http = require('http')
+  , crypto = require('crypto')
+  , url = require('url')
+  , Options = require('options')
+  , WebSocket = require('./WebSocket')
+  , tls = require('tls')
+  , url = require('url');
+
+/**
+ * WebSocket Server implementation
+ */
+
+function WebSocketServer(options, callback) {
+  options = new Options({
+    host: '0.0.0.0',
+    port: null,
+    server: null,
+    verifyClient: null,
+    handleProtocols: null,
+    path: null,
+    noServer: false,
+    disableHixie: false,
+    clientTracking: true
+  }).merge(options);
+
+  if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) {
+    throw new TypeError('`port` or a `server` must be provided');
+  }
+
+  var self = this;
+
+  if (options.isDefinedAndNonNull('port')) {
+    this._server = http.createServer(function (req, res) {
+      res.writeHead(200, {'Content-Type': 'text/plain'});
+      res.end('Not implemented');
+    });
+    this._server.listen(options.value.port, options.value.host, callback);
+    this._closeServer = function() { self._server.close(); };
+  }
+  else if (options.value.server) {
+    this._server = options.value.server;
+    if (options.value.path) {
+      // take note of the path, to avoid collisions when multiple websocket servers are
+      // listening on the same http server
+      if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) {
+        throw new Error('two instances of WebSocketServer cannot listen on the same http server path');
+      }
+      if (typeof this._server._webSocketPaths !== 'object') {
+        this._server._webSocketPaths = {};
+      }
+      this._server._webSocketPaths[options.value.path] = 1;
+    }
+  }
+
+    /******************* Begin Samsung MultiScreen Changes ********************/
+    // This code fixes issue where listeners cannot be removed to to anonymous callbacks
+
+    if (this._server) {
+
+        // TODO : Contribute this back to WS repo after cleaning up
+        this._onListening = function() {
+            self.emit('listening');
+        };
+
+        this._server.once('listening', this._onListening);
+
+    }
+
+
+
+    if (typeof this._server != 'undefined') {
+
+        // TODO : Contribute this back to WS repo after cleaning up
+        this._onServerError = function(error) {
+            self.emit('error', error);
+        };
+
+        // TODO : Contribute this back to WS repo after cleaning up
+        this._onHandleUpgrade = function(req, socket, upgradeHead) {
+            //copy upgradeHead to avoid retention of large slab buffers used in node core
+            var head = new Buffer(upgradeHead.length);
+            upgradeHead.copy(head);
+
+            self.handleUpgrade(req, socket, head, function(client) {
+                self.emit('connection'+req.url, client);
+                self.emit('connection', client);
+            });
+        };
+
+        this._server.on('error', this._onServerError);
+        this._server.on('upgrade', this._onHandleUpgrade);
+
+    }
+
+    /******************* Begin Samsung MultiScreen Changes ********************/
+
+
+    this.options = options.value;
+    this.path = options.value.path;
+    this.clients = [];
+}
+
+/**
+ * Inherits from EventEmitter.
+ */
+
+util.inherits(WebSocketServer, events.EventEmitter);
+
+/**
+ * Immediately shuts down the connection.
+ *
+ * @api public
+ */
+
+WebSocketServer.prototype.close = function() {
+
+  var error = null;
+  try {
+    for (var i = 0, l = this.clients.length; i < l; ++i) {
+      this.clients[i].terminate();
+    }
+  }
+  catch (e) {
+    error = e;
+  }
+
+  // remove path descriptor, if any
+  if (this.path && this._server._webSocketPaths) {
+    delete this._server._webSocketPaths[this.path];
+    if (Object.keys(this._server._webSocketPaths).length == 0) {
+      delete this._server._webSocketPaths;
+    }
+  }
+
+  /******************* Begin Samsung MultiScreen Changes ********************/
+
+  // remove any listeners created by the instance from the server
+  try {
+      if(this._onListening){
+          this._server.removeListener("listening",this._onListening);
+      }
+      if(this._onHandleUpgrade){
+          this._server.removeListener("upgrade",this._onHandleUpgrade);
+      }
+      if(this._onServerError){
+          this._server.removeListener("error",this._onServerError);
+      }
+  }
+  catch (e) {
+      error = e;
+  }
+
+  /******************* Begin Samsung MultiScreen Changes ********************/
+
+  // close the http server if it was internally created
+  try {
+    if (typeof this._closeServer !== 'undefined') {
+      this._closeServer();
+    }
+  }
+  finally {
+    delete this._server;
+  }
+
+  this.removeAllListeners();
+  if (error) throw error;
+}
+
+/**
+ * Handle a HTTP Upgrade request.
+ *
+ * @api public
+ */
+
+WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) {
+  // check for wrong path
+  if (this.options.path) {
+    var u = url.parse(req.url);
+    if (u && u.pathname !== this.options.path) return;
+  }
+
+  if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') {
+    abortConnection(socket, 400, 'Bad Request');
+    return;
+  }
+
+  if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments);
+  else handleHybiUpgrade.apply(this, arguments);
+}
+
+module.exports = WebSocketServer;
+
+/**
+ * Entirely private apis,
+ * which may or may not be bound to a sepcific WebSocket instance.
+ */
+
+function handleHybiUpgrade(req, socket, upgradeHead, cb) {
+  // handle premature socket errors
+  var errorHandler = function() {
+    try { socket.destroy(); } catch (e) {}
+  }
+  socket.on('error', errorHandler);
+
+  // verify key presence
+  if (!req.headers['sec-websocket-key']) {
+    abortConnection(socket, 400, 'Bad Request');
+    return;
+  }
+
+  // verify version
+  var version = parseInt(req.headers['sec-websocket-version']);
+  if ([8, 13].indexOf(version) === -1) {
+    abortConnection(socket, 400, 'Bad Request');
+    return;
+  }
+
+  // verify protocol
+  var protocols = req.headers['sec-websocket-protocol'];
+
+  // verify client
+  var origin = version < 13 ?
+    req.headers['sec-websocket-origin'] :
+    req.headers['origin'];
+
+  // handler to call when the connection sequence completes
+  var self = this;
+  var completeHybiUpgrade2 = function(protocol) {
+
+    // calc key
+    var key = req.headers['sec-websocket-key'];
+    var shasum = crypto.createHash('sha1');
+    shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+    key = shasum.digest('base64');
+
+    var headers = [
+        'HTTP/1.1 101 Switching Protocols'
+      , 'Upgrade: websocket'
+      , 'Connection: Upgrade'
+      , 'Sec-WebSocket-Accept: ' + key
+    ];
+
+    if (typeof protocol != 'undefined') {
+      headers.push('Sec-WebSocket-Protocol: ' + protocol);
+    }
+
+    // allows external modification/inspection of handshake headers
+    self.emit('headers', headers);
+
+    socket.setTimeout(0);
+    socket.setNoDelay(true);
+    try {
+      socket.write(headers.concat('', '').join('\r\n'));
+    }
+    catch (e) {
+      // if the upgrade write fails, shut the connection down hard
+      try { socket.destroy(); } catch (e) {}
+      return;
+    }
+
+    var client = new WebSocket([req, socket, upgradeHead], {
+      protocolVersion: version,
+      protocol: protocol
+    });
+
+    if (self.options.clientTracking) {
+      self.clients.push(client);
+      client.on('close', function() {
+        var index = self.clients.indexOf(client);
+        if (index != -1) {
+          self.clients.splice(index, 1);
+        }
+      });
+    }
+
+    // signal upgrade complete
+    socket.removeListener('error', errorHandler);
+    cb(client);
+  }
+
+  // optionally call external protocol selection handler before
+  // calling completeHybiUpgrade2
+  var completeHybiUpgrade1 = function() {
+    // choose from the sub-protocols
+    if (typeof self.options.handleProtocols == 'function') {
+        var protList = (protocols || "").split(/, */);
+        var callbackCalled = false;
+        var res = self.options.handleProtocols(protList, function(result, protocol) {
+          callbackCalled = true;
+          if (!result) abortConnection(socket, 404, 'Unauthorized')
+          else completeHybiUpgrade2(protocol);
+        });
+        if (!callbackCalled) {
+            // the handleProtocols handler never called our callback
+            abortConnection(socket, 501, 'Could not process protocols');
+        }
+        return;
+    } else {
+        if (typeof protocols !== 'undefined') {
+            completeHybiUpgrade2(protocols.split(/, */)[0]);
+        }
+        else {
+            completeHybiUpgrade2();
+        }
+    }
+  }
+
+  // optionally call external client verification handler
+  if (typeof this.options.verifyClient == 'function') {
+    var info = {
+      origin: origin,
+      secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
+      req: req
+    };
+    if (this.options.verifyClient.length == 2) {
+      this.options.verifyClient(info, function(result) {
+        if (!result) abortConnection(socket, 401, 'Unauthorized')
+        else completeHybiUpgrade1();
+      });
+      return;
+    }
+    else if (!this.options.verifyClient(info)) {
+      abortConnection(socket, 401, 'Unauthorized');
+      return;
+    }
+  }
+
+  completeHybiUpgrade1();
+}
+
+function handleHixieUpgrade(req, socket, upgradeHead, cb) {
+  // handle premature socket errors
+  var errorHandler = function() {
+    try { socket.destroy(); } catch (e) {}
+  }
+  socket.on('error', errorHandler);
+
+  // bail if options prevent hixie
+  if (this.options.disableHixie) {
+    abortConnection(socket, 401, 'Hixie support disabled');
+    return;
+  }
+
+  // verify key presence
+  if (!req.headers['sec-websocket-key2']) {
+    abortConnection(socket, 400, 'Bad Request');
+    return;
+  }
+
+  var origin = req.headers['origin']
+    , self = this;
+
+  // setup handshake completion to run after client has been verified
+  var onClientVerified = function() {
+    var wshost;
+    if (!req.headers['x-forwarded-host'])
+        wshost = req.headers.host;
+    else
+        wshost = req.headers['x-forwarded-host'];
+    var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url
+      , protocol = req.headers['sec-websocket-protocol'];
+
+    // handshake completion code to run once nonce has been successfully retrieved
+    var completeHandshake = function(nonce, rest) {
+      // calculate key
+      var k1 = req.headers['sec-websocket-key1']
+        , k2 = req.headers['sec-websocket-key2']
+        , md5 = crypto.createHash('md5');
+
+      [k1, k2].forEach(function (k) {
+        var n = parseInt(k.replace(/[^\d]/g, ''))
+          , spaces = k.replace(/[^ ]/g, '').length;
+        if (spaces === 0 || n % spaces !== 0){
+          abortConnection(socket, 400, 'Bad Request');
+          return;
+        }
+        n /= spaces;
+        md5.update(String.fromCharCode(
+          n >> 24 & 0xFF,
+          n >> 16 & 0xFF,
+          n >> 8  & 0xFF,
+          n       & 0xFF));
+      });
+      md5.update(nonce.toString('binary'));
+
+      var headers = [
+          'HTTP/1.1 101 Switching Protocols'
+        , 'Upgrade: WebSocket'
+        , 'Connection: Upgrade'
+        , 'Sec-WebSocket-Location: ' + location
+      ];
+      if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol);
+      if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin);
+
+      socket.setTimeout(0);
+      socket.setNoDelay(true);
+      try {
+        // merge header and hash buffer
+        var headerBuffer = new Buffer(headers.concat('', '').join('\r\n'));
+        var hashBuffer = new Buffer(md5.digest('binary'), 'binary');
+        var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length);
+        headerBuffer.copy(handshakeBuffer, 0);
+        hashBuffer.copy(handshakeBuffer, headerBuffer.length);
+
+        // do a single write, which - upon success - causes a new client websocket to be setup
+        socket.write(handshakeBuffer, 'binary', function(err) {
+          if (err) return; // do not create client if an error happens
+          var client = new WebSocket([req, socket, rest], {
+            protocolVersion: 'hixie-76',
+            protocol: protocol
+          });
+          if (self.options.clientTracking) {
+            self.clients.push(client);
+            client.on('close', function() {
+              var index = self.clients.indexOf(client);
+              if (index != -1) {
+                self.clients.splice(index, 1);
+              }
+            });
+          }
+
+          // signal upgrade complete
+          socket.removeListener('error', errorHandler);
+          cb(client);
+        });
+      }
+      catch (e) {
+        try { socket.destroy(); } catch (e) {}
+        return;
+      }
+    }
+
+    // retrieve nonce
+    var nonceLength = 8;
+    if (upgradeHead && upgradeHead.length >= nonceLength) {
+      var nonce = upgradeHead.slice(0, nonceLength);
+      var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null;
+      completeHandshake.call(self, nonce, rest);
+    }
+    else {
+      // nonce not present in upgradeHead, so we must wait for enough data
+      // data to arrive before continuing
+      var nonce = new Buffer(nonceLength);
+      upgradeHead.copy(nonce, 0);
+      var received = upgradeHead.length;
+      var rest = null;
+      var handler = function (data) {
+        var toRead = Math.min(data.length, nonceLength - received);
+        if (toRead === 0) return;
+        data.copy(nonce, received, 0, toRead);
+        received += toRead;
+        if (received == nonceLength) {
+          socket.removeListener('data', handler);
+          if (toRead < data.length) rest = data.slice(toRead);
+          completeHandshake.call(self, nonce, rest);
+        }
+      }
+      socket.on('data', handler);
+    }
+  }
+
+  // verify client
+  if (typeof this.options.verifyClient == 'function') {
+    var info = {
+      origin: origin,
+      secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined',
+      req: req
+    };
+    if (this.options.verifyClient.length == 2) {
+      var self = this;
+      this.options.verifyClient(info, function(result) {
+        if (!result) abortConnection(socket, 401, 'Unauthorized')
+        else onClientVerified.apply(self);
+      });
+      return;
+    }
+    else if (!this.options.verifyClient(info)) {
+      abortConnection(socket, 401, 'Unauthorized');
+      return;
+    }
+  }
+
+  // no client verification required
+  onClientVerified();
+}
+
+function abortConnection(socket, code, name) {
+  try {
+    var response = [
+      'HTTP/1.1 ' + code + ' ' + name,
+      'Content-type: text/html'
+    ];
+    socket.write(response.concat('', '').join('\r\n'));
+  }
+  catch (e) { /* ignore errors - we've aborted this connection */ }
+  finally {
+    // ensure that an early aborted connection is shut down completely
+    try { socket.destroy(); } catch (e) {}
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/browser.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/lib/browser.js
new file mode 100755 (executable)
index 0000000..8d3a755
--- /dev/null
@@ -0,0 +1,43 @@
+
+/**
+ * Module dependencies.
+ */
+
+var global = (function() { return this; })();
+
+/**
+ * WebSocket constructor.
+ */
+
+var WebSocket = global.WebSocket || global.MozWebSocket;
+
+/**
+ * Module exports.
+ */
+
+module.exports = WebSocket ? ws : null;
+
+/**
+ * WebSocket constructor.
+ *
+ * The third `opts` options object gets ignored in web browsers, since it's
+ * non-standard, and throws a TypeError if passed to the constructor.
+ * See: https://github.com/einaros/ws/issues/227
+ *
+ * @param {String} uri
+ * @param {Array} protocols (optional)
+ * @param {Object) opts (optional)
+ * @api public
+ */
+
+function ws(uri, protocols, opts) {
+  var instance;
+  if (protocols) {
+    instance = new WebSocket(uri, protocols);
+  } else {
+    instance = new WebSocket(uri);
+  }
+  return instance;
+}
+
+if (WebSocket) ws.prototype = WebSocket.prototype;
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/History.md b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/History.md
new file mode 100755 (executable)
index 0000000..4961d2e
--- /dev/null
@@ -0,0 +1,107 @@
+
+0.6.1 / 2012-06-01 
+==================
+
+  * Added: append (yes or no) on confirmation
+  * Added: allow node.js v0.7.x
+
+0.6.0 / 2012-04-10 
+==================
+
+  * Added `.prompt(obj, callback)` support. Closes #49
+  * Added default support to .choose(). Closes #41
+  * Fixed the choice example
+
+0.5.1 / 2011-12-20 
+==================
+
+  * Fixed `password()` for recent nodes. Closes #36
+
+0.5.0 / 2011-12-04 
+==================
+
+  * Added sub-command option support [itay]
+
+0.4.3 / 2011-12-04 
+==================
+
+  * Fixed custom help ordering. Closes #32
+
+0.4.2 / 2011-11-24 
+==================
+
+  * Added travis support
+  * Fixed: line-buffered input automatically trimmed. Closes #31
+
+0.4.1 / 2011-11-18 
+==================
+
+  * Removed listening for "close" on --help
+
+0.4.0 / 2011-11-15 
+==================
+
+  * Added support for `--`. Closes #24
+
+0.3.3 / 2011-11-14 
+==================
+
+  * Fixed: wait for close event when writing help info [Jerry Hamlet]
+
+0.3.2 / 2011-11-01 
+==================
+
+  * Fixed long flag definitions with values [felixge]
+
+0.3.1 / 2011-10-31 
+==================
+
+  * Changed `--version` short flag to `-V` from `-v`
+  * Changed `.version()` so it's configurable [felixge]
+
+0.3.0 / 2011-10-31 
+==================
+
+  * Added support for long flags only. Closes #18
+
+0.2.1 / 2011-10-24 
+==================
+
+  * "node": ">= 0.4.x < 0.7.0". Closes #20
+
+0.2.0 / 2011-09-26 
+==================
+
+  * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
+
+0.1.0 / 2011-08-24 
+==================
+
+  * Added support for custom `--help` output
+
+0.0.5 / 2011-08-18 
+==================
+
+  * Changed: when the user enters nothing prompt for password again
+  * Fixed issue with passwords beginning with numbers [NuckChorris]
+
+0.0.4 / 2011-08-15 
+==================
+
+  * Fixed `Commander#args`
+
+0.0.3 / 2011-08-15 
+==================
+
+  * Added default option value support
+
+0.0.2 / 2011-08-15 
+==================
+
+  * Added mask support to `Command#password(str[, mask], fn)`
+  * Added `Command#password(str, fn)`
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/Makefile b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/Makefile
new file mode 100755 (executable)
index 0000000..0074625
--- /dev/null
@@ -0,0 +1,7 @@
+
+TESTS = $(shell find test/test.*.js)
+
+test:
+       @./test/run $(TESTS)
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/Readme.md b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/Readme.md
new file mode 100755 (executable)
index 0000000..b8328c3
--- /dev/null
@@ -0,0 +1,262 @@
+# Commander.js
+
+  The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+    $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+  .version('0.0.1')
+  .option('-p, --peppers', 'Add peppers')
+  .option('-P, --pineapple', 'Add pineapple')
+  .option('-b, --bbq', 'Add bbq sauce')
+  .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+  .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log('  - peppers');
+if (program.pineapple) console.log('  - pineappe');
+if (program.bbq) console.log('  - bbq');
+console.log('  - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```  
+ $ ./examples/pizza --help
+
+   Usage: pizza [options]
+
+   Options:
+
+     -V, --version        output the version number
+     -p, --peppers        Add peppers
+     -P, --pineapple      Add pineappe
+     -b, --bbq            Add bbq sauce
+     -c, --cheese <type>  Add the specified type of cheese [marble]
+     -h, --help           output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+  return val.split('..').map(Number);
+}
+
+function list(val) {
+  return val.split(',');
+}
+
+program
+  .version('0.0.1')
+  .usage('[options] <file ...>')
+  .option('-i, --integer <n>', 'An integer argument', parseInt)
+  .option('-f, --float <n>', 'A float argument', parseFloat)
+  .option('-r, --range <a>..<b>', 'A range', range)
+  .option('-l, --list <items>', 'A list', list)
+  .option('-o, --optional [value]', 'An optional value')
+  .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+  return val.split(',').map(Number);
+}
+
+program
+  .version('0.0.1')
+  .option('-f, --foo', 'enable some foo')
+  .option('-b, --bar', 'enable some bar')
+  .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+  console.log('  Examples:');
+  console.log('');
+  console.log('    $ custom-help --help');
+  console.log('    $ custom-help -h');
+  console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+  -h, --help     output usage information
+  -V, --version  output the version number
+  -f, --foo      enable some foo
+  -b, --bar      enable some bar
+  -B, --baz      enable some baz
+
+Examples:
+
+  $ custom-help --help
+  $ custom-help -h
+
+```
+
+## .prompt(msg, fn)
+
+ Single-line prompt:
+
+```js
+program.prompt('name: ', function(name){
+  console.log('hi %s', name);
+});
+```
+
+ Multi-line prompt:
+
+```js
+program.prompt('description:', function(name){
+  console.log('hi %s', name);
+});
+```
+
+ Coercion:
+
+```js
+program.prompt('Age: ', Number, function(age){
+  console.log('age: %j', age);
+});
+```
+
+```js
+program.prompt('Birthdate: ', Date, function(date){
+  console.log('date: %s', date);
+});
+```
+
+## .password(msg[, mask], fn)
+
+Prompt for password without echoing:
+
+```js
+program.password('Password: ', function(pass){
+  console.log('got "%s"', pass);
+  process.stdin.destroy();
+});
+```
+
+Prompt for password with mask char "*":
+
+```js
+program.password('Password: ', '*', function(pass){
+  console.log('got "%s"', pass);
+  process.stdin.destroy();
+});
+```
+
+## .confirm(msg, fn)
+
+ Confirm with the given `msg`:
+
+```js
+program.confirm('continue? ', function(ok){
+  console.log(' got %j', ok);
+});
+```
+
+## .choose(list, fn)
+
+ Let the user choose from a `list`:
+
+```js
+var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+
+console.log('Choose the coolest pet:');
+program.choose(list, function(i){
+  console.log('you chose %d "%s"', i, list[i]);
+});
+```
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/index.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/index.js
new file mode 100755 (executable)
index 0000000..06ec1e4
--- /dev/null
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/commander');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/lib/commander.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/lib/commander.js
new file mode 100755 (executable)
index 0000000..afc9fd8
--- /dev/null
@@ -0,0 +1,1026 @@
+
+/*!
+ * commander
+ * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+  , path = require('path')
+  , tty = require('tty')
+  , basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+  this.flags = flags;
+  this.required = ~flags.indexOf('<');
+  this.optional = ~flags.indexOf('[');
+  this.bool = !~flags.indexOf('-no-');
+  flags = flags.split(/[ ,|]+/);
+  if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+  this.long = flags.shift();
+  this.description = description;
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+  return this.long
+    .replace('--', '')
+    .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+  return arg == this.short
+    || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+  this.commands = [];
+  this.options = [];
+  this.args = [];
+  this.name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ *      program
+ *        .version('0.0.1')
+ *        .option('-C, --chdir <path>', 'change the working directory')
+ *        .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ *        .option('-T, --no-tests', 'ignore test hook')
+ *     
+ *      program
+ *        .command('setup')
+ *        .description('run remote setup commands')
+ *        .action(function(){
+ *          console.log('setup');
+ *        });
+ *     
+ *      program
+ *        .command('exec <cmd>')
+ *        .description('run the given remote command')
+ *        .action(function(cmd){
+ *          console.log('exec "%s"', cmd);
+ *        });
+ *     
+ *      program
+ *        .command('*')
+ *        .description('deploy the given env')
+ *        .action(function(env){
+ *          console.log('deploying "%s"', env);
+ *        });
+ *     
+ *      program.parse(process.argv);
+  *
+ * @param {String} name
+ * @return {JSONMessage} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name){
+  var args = name.split(/ +/);
+  var cmd = new Command(args.shift());
+  this.commands.push(cmd);
+  cmd.parseExpectedArgs(args);
+  cmd.parent = this;
+  return cmd;
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {JSONMessage} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+  if (!args.length) return;
+  var self = this;
+  args.forEach(function(arg){
+    switch (arg[0]) {
+      case '<':
+        self.args.push({ required: true, name: arg.slice(1, -1) });
+        break;
+      case '[':
+        self.args.push({ required: false, name: arg.slice(1, -1) });
+        break;
+    }
+  });
+  return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ *      program
+ *        .command('help')
+ *        .description('display verbose help')
+ *        .action(function(){
+ *           // output help here
+ *        });
+ *
+ * @param {Function} fn
+ * @return {JSONMessage} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+  var self = this;
+  this.parent.on(this.name, function(args, unknown){    
+    // Parse any so-far unknown options
+    unknown = unknown || [];
+    var parsed = self.parseOptions(unknown);
+    
+    // Output help if necessary
+    outputHelpIfNecessary(self, parsed.unknown);
+    
+    // If there are still any unknown options, then we simply 
+    // die, unless someone asked for help, in which case we give it
+    // to them, and then we die.
+    if (parsed.unknown.length > 0) {      
+      self.unknownOption(parsed.unknown[0]);
+    }
+    
+    self.args.forEach(function(arg, i){
+      if (arg.required && null == args[i]) {
+        self.missingArgument(arg.name);
+      }
+    });
+    
+    // Always append ourselves to the end of the arguments,
+    // to make sure we match the number of arguments the user
+    // expects
+    if (self.args.length) {
+      args[self.args.length] = self;
+    } else {
+      args.push(self);
+    }
+    
+    fn.apply(this, args);
+  });
+  return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`. 
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ *    "-p, --pepper"
+ *    "-p|--pepper"
+ *    "-p --pepper"
+ *
+ * Examples:
+ *
+ *     // simple boolean defaulting to false
+ *     program.option('-p, --pepper', 'add pepper');
+ *
+ *     --pepper
+ *     program.pepper
+ *     // => Boolean
+ *
+ *     // simple boolean defaulting to false
+ *     program.option('-C, --no-cheese', 'remove cheese');
+ *
+ *     program.cheese
+ *     // => true
+ *
+ *     --no-cheese
+ *     program.cheese
+ *     // => true
+ *
+ *     // required argument
+ *     program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ *     --chdir /tmp
+ *     program.chdir
+ *     // => "/tmp"
+ *
+ *     // optional argument
+ *     program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {JSONMessage} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+  var self = this
+    , option = new Option(flags, description)
+    , oname = option.name()
+    , name = camelcase(oname);
+
+  // default as 3rd arg
+  if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+  // preassign default value only for --no-*, [optional], or <required>
+  if (false == option.bool || option.optional || option.required) {
+    // when --no-* we make sure default is true
+    if (false == option.bool) defaultValue = true;
+    // preassign only if we have a default
+    if (undefined !== defaultValue) self[name] = defaultValue;
+  }
+
+  // register the option
+  this.options.push(option);
+
+  // when it's passed assign the value
+  // and conditionally invoke the callback
+  this.on(oname, function(val){
+    // coercion
+    if (null != val && fn) val = fn(val);
+
+    // unassigned or bool
+    if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+      // if no value, bool true, and we have a default, then use it!
+      if (null == val) {
+        self[name] = option.bool
+          ? defaultValue || true
+          : false;
+      } else {
+        self[name] = val;
+      }
+    } else if (null !== val) {
+      // reassign
+      self[name] = val;
+    }
+  });
+
+  return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {JSONMessage} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+  // store raw args
+  this.rawArgs = argv;
+
+  // guess name
+  if (!this.name) this.name = basename(argv[1]);
+
+  // process argv
+  var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+  this.args = parsed.args;
+  return this.parseArgs(this.args, parsed.unknown);
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+  var ret = []
+    , arg;
+
+  for (var i = 0, len = args.length; i < len; ++i) {
+    arg = args[i];
+    if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+      arg.slice(1).split('').forEach(function(c){
+        ret.push('-' + c);
+      });
+    } else {
+      ret.push(arg);
+    }
+  }
+
+  return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {JSONMessage} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+  var cmds = this.commands
+    , len = cmds.length
+    , name;
+
+  if (args.length) {
+    name = args[0];
+    if (this.listeners(name).length) {
+      this.emit(args.shift(), args, unknown);
+    } else {
+      this.emit('*', args);
+    }
+  } else {
+    outputHelpIfNecessary(this, unknown);
+    
+    // If there were no args and we have unknown options,
+    // then they are extraneous and we need to error.
+    if (unknown.length > 0) {      
+      this.unknownOption(unknown[0]);
+    }
+  }
+
+  return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+  for (var i = 0, len = this.options.length; i < len; ++i) {
+    if (this.options[i].is(arg)) {
+      return this.options[i];
+    }
+  }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+  var args = []
+    , len = argv.length
+    , literal
+    , option
+    , arg;
+
+  var unknownOptions = [];
+
+  // parse options
+  for (var i = 0; i < len; ++i) {
+    arg = argv[i];
+
+    // literal args after --
+    if ('--' == arg) {
+      literal = true;
+      continue;
+    }
+
+    if (literal) {
+      args.push(arg);
+      continue;
+    }
+
+    // find matching Option
+    option = this.optionFor(arg);
+
+    // option is defined
+    if (option) {
+      // requires arg
+      if (option.required) {
+        arg = argv[++i];
+        if (null == arg) return this.optionMissingArgument(option);
+        if ('-' == arg[0]) return this.optionMissingArgument(option, arg);
+        this.emit(option.name(), arg);
+      // optional arg
+      } else if (option.optional) {
+        arg = argv[i+1];
+        if (null == arg || '-' == arg[0]) {
+          arg = null;
+        } else {
+          ++i;
+        }
+        this.emit(option.name(), arg);
+      // bool
+      } else {
+        this.emit(option.name());
+      }
+      continue;
+    }
+    
+    // looks like an option
+    if (arg.length > 1 && '-' == arg[0]) {
+      unknownOptions.push(arg);
+      
+      // If the next argument looks like it might be
+      // an argument for this option, we pass it on.
+      // If it isn't, then it'll simply be ignored
+      if (argv[i+1] && '-' != argv[i+1][0]) {
+        unknownOptions.push(argv[++i]);
+      }
+      continue;
+    }
+    
+    // arg
+    args.push(arg);
+  }
+  
+  return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+  console.error();
+  console.error("  error: missing required argument `%s'", name);
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+  console.error();
+  if (flag) {
+    console.error("  error: option `%s' argument missing, got `%s'", option.flags, flag);
+  } else {
+    console.error("  error: option `%s' argument missing", option.flags);
+  }
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+  console.error();
+  console.error("  error: unknown option `%s'", flag);
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {JSONMessage} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+  if (0 == arguments.length) return this._version;
+  this._version = str;
+  flags = flags || '-V, --version';
+  this.option(flags, 'output the version number');
+  this.on('version', function(){
+    console.log(str);
+    process.exit(0);
+  });
+  return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|JSONMessage}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+  if (0 == arguments.length) return this._description;
+  this._description = str;
+  return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|JSONMessage}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+  var args = this.args.map(function(arg){
+    return arg.required
+      ? '<' + arg.name + '>'
+      : '[' + arg.name + ']';
+  });
+
+  var usage = '[options'
+    + (this.commands.length ? '] [command' : '')
+    + ']'
+    + (this.args.length ? ' ' + args : '');
+  if (0 == arguments.length) return this._usage || usage;
+  this._usage = str;
+
+  return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+  return this.options.reduce(function(max, option){
+    return Math.max(max, option.flags.length);
+  }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+  var width = this.largestOptionLength();
+  
+  // Prepend the help information
+  return [pad('-h, --help', width) + '  ' + 'output usage information']
+    .concat(this.options.map(function(option){
+      return pad(option.flags, width)
+        + '  ' + option.description;
+      }))
+    .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+  if (!this.commands.length) return '';
+  return [
+      ''
+    , '  Commands:'
+    , ''
+    , this.commands.map(function(cmd){
+      var args = cmd.args.map(function(arg){
+        return arg.required
+          ? '<' + arg.name + '>'
+          : '[' + arg.name + ']';
+      }).join(' ');
+
+      return cmd.name 
+        + (cmd.options.length 
+          ? ' [options]'
+          : '') + ' ' + args
+        + (cmd.description()
+          ? '\n' + cmd.description()
+          : '');
+    }).join('\n\n').replace(/^/gm, '    ')
+    , ''
+  ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+  return [
+      ''
+    , '  Usage: ' + this.name + ' ' + this.usage()
+    , '' + this.commandHelp()
+    , '  Options:'
+    , ''
+    , '' + this.optionHelp().replace(/^/gm, '    ')
+    , ''
+    , ''
+  ].join('\n');
+};
+
+/**
+ * Prompt for a `Number`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForNumber = function(str, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseNumber(val){
+    val = Number(val);
+    if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber);
+    fn(val);
+  });
+};
+
+/**
+ * Prompt for a `Date`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForDate = function(str, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseDate(val){
+    val = new Date(val);
+    if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate);
+    fn(val);
+  });
+};
+
+/**
+ * Single-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptSingleLine = function(str, fn){
+  if ('function' == typeof arguments[2]) {
+    return this['promptFor' + (fn.name || fn)](str, arguments[2]);
+  }
+
+  process.stdout.write(str);
+  process.stdin.setEncoding('utf8');
+  process.stdin.once('data', function(val){
+    fn(val.trim());
+  }).resume();
+};
+
+/**
+ * Multi-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptMultiLine = function(str, fn){
+  var buf = [];
+  console.log(str);
+  process.stdin.setEncoding('utf8');
+  process.stdin.on('data', function(val){
+    if ('\n' == val || '\r\n' == val) {
+      process.stdin.removeAllListeners('data');
+      fn(buf.join('\n'));
+    } else {
+      buf.push(val.trimRight());
+    }
+  }).resume();
+};
+
+/**
+ * Prompt `str` and callback `fn(val)`
+ *
+ * Commander supports single-line and multi-line prompts.
+ * To issue a single-line prompt simply add white-space
+ * to the end of `str`, something like "name: ", whereas
+ * for a multi-line prompt omit this "description:".
+ *
+ *
+ * Examples:
+ *
+ *     program.prompt('Username: ', function(name){
+ *       console.log('hi %s', name);
+ *     });
+ *     
+ *     program.prompt('Description:', function(desc){
+ *       console.log('description was "%s"', desc.trim());
+ *     });
+ *
+ * @param {String|Object} str
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.prompt = function(str, fn){
+  var self = this;
+
+  if ('string' == typeof str) {
+    if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments);
+    this.promptMultiLine(str, fn);
+  } else {
+    var keys = Object.keys(str)
+      , obj = {};
+
+    function next() {
+      var key = keys.shift()
+        , label = str[key];
+
+      if (!key) return fn(obj);
+      self.prompt(label, function(val){
+        obj[key] = val;
+        next();
+      });
+    }
+
+    next();
+  }
+};
+
+/**
+ * Prompt for password with `str`, `mask` char and callback `fn(val)`.
+ *
+ * The mask string defaults to '', aka no output is
+ * written while typing, you may want to use "*" etc.
+ *
+ * Examples:
+ *
+ *     program.password('Password: ', function(pass){
+ *       console.log('got "%s"', pass);
+ *       process.stdin.destroy();
+ *     });
+ *
+ *     program.password('Password: ', '*', function(pass){
+ *       console.log('got "%s"', pass);
+ *       process.stdin.destroy();
+ *     });
+ *
+ * @param {String} str
+ * @param {String} mask
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.password = function(str, mask, fn){
+  var self = this
+    , buf = '';
+
+  // default mask
+  if ('function' == typeof mask) {
+    fn = mask;
+    mask = '';
+  }
+
+  process.stdin.resume();
+  tty.setRawMode(true);
+  process.stdout.write(str);
+
+  // keypress
+  process.stdin.on('keypress', function(c, key){
+    if (key && 'enter' == key.name) {
+      console.log();
+      process.stdin.removeAllListeners('keypress');
+      tty.setRawMode(false);
+      if (!buf.trim().length) return self.password(str, mask, fn);
+      fn(buf);
+      return;
+    }
+
+    if (key && key.ctrl && 'c' == key.name) {
+      console.log('%s', buf);
+      process.exit();
+    }
+
+    process.stdout.write(mask);
+    buf += c;
+  }).resume();
+};
+
+/**
+ * Confirmation prompt with `str` and callback `fn(bool)`
+ *
+ * Examples:
+ *
+ *      program.confirm('continue? ', function(ok){
+ *        console.log(' got %j', ok);
+ *        process.stdin.destroy();
+ *      });
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api public
+ */
+
+
+Command.prototype.confirm = function(str, fn, verbose){
+  var self = this;
+  this.prompt(str, function(ok){
+    if (!ok.trim()) {
+      if (!verbose) str += '(yes or no) ';
+      return self.confirm(str, fn, true);
+    }
+    fn(parseBool(ok));
+  });
+};
+
+/**
+ * Choice prompt with `list` of items and callback `fn(index, item)`
+ *
+ * Examples:
+ *
+ *      var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+ *      
+ *      console.log('Choose the coolest pet:');
+ *      program.choose(list, function(i){
+ *        console.log('you chose %d "%s"', i, list[i]);
+ *        process.stdin.destroy();
+ *      });
+ *
+ * @param {Array} list
+ * @param {Number|Function} index or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.choose = function(list, index, fn){
+  var self = this
+    , hasDefault = 'number' == typeof index;
+
+  if (!hasDefault) {
+    fn = index;
+    index = null;
+  }
+
+  list.forEach(function(item, i){
+    if (hasDefault && i == index) {
+      console.log('* %d) %s', i + 1, item);
+    } else {
+      console.log('  %d) %s', i + 1, item);
+    }
+  });
+
+  function again() {
+    self.prompt('  : ', function(val){
+      val = parseInt(val, 10) - 1;
+      if (hasDefault && isNaN(val)) val = index;
+
+      if (null == list[val]) {
+        again();
+      } else {
+        fn(val, list[val]);
+      }
+    });
+  }
+
+  again();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+  return flag.split('-').reduce(function(str, word){
+    return str + word[0].toUpperCase() + word.slice(1);
+  });
+}
+
+/**
+ * Parse a boolean `str`.
+ *
+ * @param {String} str
+ * @return {Boolean}
+ * @api private
+ */
+
+function parseBool(str) {
+  return /^y|yes|ok|true$/i.test(str);
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+  var len = Math.max(0, width - str.length);
+  return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {JSONMessage} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+  options = options || [];
+  for (var i = 0; i < options.length; i++) {
+    if (options[i] == '--help' || options[i] == '-h') {
+      process.stdout.write(cmd.helpInformation());
+      cmd.emit('--help');
+      process.exit(0);
+    }
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/package.json b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/commander/package.json
new file mode 100755 (executable)
index 0000000..bb8a2c2
--- /dev/null
@@ -0,0 +1,38 @@
+{
+  "name": "commander",
+  "version": "0.6.1",
+  "description": "the complete solution for node.js command-line programs",
+  "keywords": [
+    "command",
+    "option",
+    "parser",
+    "prompt",
+    "stdin"
+  ],
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/visionmedia/commander.js.git"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "should": ">= 0.0.1"
+  },
+  "scripts": {
+    "test": "make test"
+  },
+  "main": "index",
+  "engines": {
+    "node": ">= 0.4.x"
+  },
+  "readme": "# Commander.js\n\n  The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n    $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n  .version('0.0.1')\n  .option('-p, --peppers', 'Add peppers')\n  .option('-P, --pineapple', 'Add pineapple')\n  .option('-b, --bbq', 'Add bbq sauce')\n  .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n  .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log('  - peppers');\nif (program.pineapple) console.log('  - pineappe');\nif (program.bbq) console.log('  - bbq');\nconsole.log('  - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n```  \n $ ./examples/pizza --help\n\n   Usage: pizza [options]\n\n   Options:\n\n     -V, --version        output the version number\n     -p, --peppers        Add peppers\n     -P, --pineapple      Add pineappe\n     -b, --bbq            Add bbq sauce\n     -c, --cheese <type>  Add the specified type of cheese [marble]\n     -h, --help           output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n  return val.split('..').map(Number);\n}\n\nfunction list(val) {\n  return val.split(',');\n}\n\nprogram\n  .version('0.0.1')\n  .usage('[options] <file ...>')\n  .option('-i, --integer <n>', 'An integer argument', parseInt)\n  .option('-f, --float <n>', 'A float argument', parseFloat)\n  .option('-r, --range <a>..<b>', 'A range', range)\n  .option('-l, --list <items>', 'A list', list)\n  .option('-o, --optional [value]', 'An optional value')\n  .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n  return val.split(',').map(Number);\n}\n\nprogram\n  .version('0.0.1')\n  .option('-f, --foo', 'enable some foo')\n  .option('-b, --bar', 'enable some bar')\n  .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n  console.log('  Examples:');\n  console.log('');\n  console.log('    $ custom-help --help');\n  console.log('    $ custom-help -h');\n  console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n  -h, --help     output usage information\n  -V, --version  output the version number\n  -f, --foo      enable some foo\n  -b, --bar      enable some bar\n  -B, --baz      enable some baz\n\nExamples:\n\n  $ custom-help --help\n  $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n  console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n  console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n  console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n  console.log('date: %s', date);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n  console.log('got \"%s\"', pass);\n  process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n  console.log('got \"%s\"', pass);\n  process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n  console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n  console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\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.",
+  "readmeFilename": "Readme.md",
+  "bugs": {
+    "url": "https://github.com/visionmedia/commander.js/issues"
+  },
+  "_id": "commander@0.6.1",
+  "_from": "commander@~0.6.1"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/LICENSE b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/LICENSE
new file mode 100755 (executable)
index 0000000..352c287
--- /dev/null
@@ -0,0 +1,43 @@
+Copyright 2013, NAN contributors:
+  - Rod Vagg <https://github.com/rvagg>
+  - Benjamin Byholm <https://github.com/kkoopa>
+  - Trevor Norris <https://github.com/trevnorris>
+(the "Original Author")
+All rights reserved.
+
+MIT +no-false-attribs License
+
+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.
+
+Distributions of all or part of the Software intended to be used
+by the recipients as they would use the unmodified Software,
+containing modifications that substantially alter, remove, or
+disable functionality of the Software, outside of the documented
+configuration mechanisms provided by the Software, shall be
+modified such that the Original Author's bug reporting email
+addresses and urls are either replaced with the contact information
+of the parties responsible for the changes, or removed entirely.
+
+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.
+
+
+Except where noted, this license applies to any and all software
+programs and associated documentation files created by the
+Original Author, when distributed with the Software.
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/README.md b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/README.md
new file mode 100755 (executable)
index 0000000..6ba57f7
--- /dev/null
@@ -0,0 +1,705 @@
+Native Abstractions for Node.js
+===============================
+
+**A header file filled with macro and utility goodness for making addon development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.**
+
+***Current version: 0.3.2*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for changelog)*
+
+[![NPM](https://nodei.co/npm/nan.png?downloads=true&stars=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a bit more pleasant.
+
+ * **[Usage](#usage)**
+ * **[Example](#example)**
+ * **[API](#api)**
+
+<a name="usage"></a>
+## Usage
+
+Simply add **NAN** as a dependency in the *package.json* of your Node addon:
+
+```js
+"dependencies": {
+    ...
+    "nan" : "~0.3.1"
+    ...
+}
+```
+
+Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include "nan.h"` in your *.cpp*:
+
+```js
+"include_dirs" : [
+    ...
+    "<!(node -p -e \"require('path').dirname(require.resolve('nan'))\")"
+    ...
+]
+```
+
+This works like a `-I<path-to-NAN>` when compiling your addon.
+
+<a name="example"></a>
+## Example
+
+See **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use.
+
+For a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.
+
+Compare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work).
+
+Note that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class.
+
+```c++
+// addon.cc
+#include <node.h>
+#include "nan.h"
+// ...
+
+using namespace v8;
+
+void InitAll(Handle<Object> exports) {
+  exports->Set(NanSymbol("calculateSync"),
+    FunctionTemplate::New(CalculateSync)->GetFunction());
+
+  exports->Set(NanSymbol("calculateAsync"),
+    FunctionTemplate::New(CalculateAsync)->GetFunction());
+}
+
+NODE_MODULE(addon, InitAll)
+```
+
+```c++
+// sync.h
+#include <node.h>
+#include "nan.h"
+
+NAN_METHOD(CalculateSync);
+```
+
+```c++
+// sync.cc
+#include <node.h>
+#include "nan.h"
+#include "sync.h"
+// ...
+
+using namespace v8;
+
+// Simple synchronous access to the `Estimate()` function
+NAN_METHOD(CalculateSync) {
+  NanScope();
+
+  // expect a number as the first argument
+  int points = args[0]->Uint32Value();
+  double est = Estimate(points);
+
+  NanReturnValue(Number::New(est));
+}
+```
+
+```c++
+// async.cc
+#include <node.h>
+#include "nan.h"
+#include "async.h"
+
+// ...
+
+using namespace v8;
+
+class PiWorker : public NanAsyncWorker {
+ public:
+  PiWorker(NanCallback *callback, int points)
+    : NanAsyncWorker(callback), points(points) {}
+  ~PiWorker() {}
+
+  // Executed inside the worker-thread.
+  // It is not safe to access V8, or V8 data structures
+  // here, so everything we need for input and output
+  // should go on `this`.
+  void Execute () {
+    estimate = Estimate(points);
+  }
+
+  // Executed when the async work is complete
+  // this function will be run inside the main event loop
+  // so it is safe to use V8 again
+  void HandleOKCallback () {
+    NanScope();
+
+    Local<Value> argv[] = {
+        Local<Value>::New(Null())
+      , Number::New(estimate)
+    };
+
+    callback->Call(2, argv);
+  };
+
+ private:
+  int points;
+  double estimate;
+};
+
+// Asynchronous access to the `Estimate()` function
+NAN_METHOD(CalculateAsync) {
+  NanScope();
+
+  int points = args[0]->Uint32Value();
+  NanCallback *callback = new NanCallback(args[1].As<Function>());
+
+  NanAsyncQueueWorker(new PiWorker(callback, points));
+  NanReturnUndefined();
+}
+```
+
+<a name="api"></a>
+## API
+
+ * <a href="#api_nan_method"><b><code>NAN_METHOD</code></b></a>
+ * <a href="#api_nan_getter"><b><code>NAN_GETTER</code></b></a>
+ * <a href="#api_nan_setter"><b><code>NAN_SETTER</code></b></a>
+ * <a href="#api_nan_property_getter"><b><code>NAN_PROPERTY_GETTER</code></b></a>
+ * <a href="#api_nan_property_setter"><b><code>NAN_PROPERTY_SETTER</code></b></a>
+ * <a href="#api_nan_property_enumerator"><b><code>NAN_PROPERTY_ENUMERATOR</code></b></a>
+ * <a href="#api_nan_property_deleter"><b><code>NAN_PROPERTY_DELETER</code></b></a>
+ * <a href="#api_nan_property_query"><b><code>NAN_PROPERTY_QUERY</code></b></a>
+ * <a href="#api_nan_weak_callback"><b><code>NAN_WEAK_CALLBACK</code></b></a>
+ * <a href="#api_nan_return_value"><b><code>NanReturnValue</code></b></a>
+ * <a href="#api_nan_return_undefined"><b><code>NanReturnUndefined</code></b></a>
+ * <a href="#api_nan_return_null"><b><code>NanReturnNull</code></b></a>
+ * <a href="#api_nan_return_empty_string"><b><code>NanReturnEmptyString</code></b></a>
+ * <a href="#api_nan_scope"><b><code>NanScope</code></b></a>
+ * <a href="#api_nan_locker"><b><code>NanLocker</code></b></a>
+ * <a href="#api_nan_unlocker"><b><code>NanUnlocker</code></b></a>
+ * <a href="#api_nan_get_internal_field_pointer"><b><code>NanGetInternalFieldPointer</code></b></a>
+ * <a href="#api_nan_set_internal_field_pointer"><b><code>NanSetInternalFieldPointer</code></b></a>
+ * <a href="#api_nan_object_wrap_handle"><b><code>NanObjectWrapHandle</code></b></a>
+ * <a href="#api_nan_make_weak"><b><code>NanMakeWeak</code></b></a>
+ * <a href="#api_nan_symbol"><b><code>NanSymbol</code></b></a>
+ * <a href="#api_nan_get_pointer_safe"><b><code>NanGetPointerSafe</code></b></a>
+ * <a href="#api_nan_set_pointer_safe"><b><code>NanSetPointerSafe</code></b></a>
+ * <a href="#api_nan_from_v8_string"><b><code>NanFromV8String</code></b></a>
+ * <a href="#api_nan_boolean_option_value"><b><code>NanBooleanOptionValue</code></b></a>
+ * <a href="#api_nan_uint32_option_value"><b><code>NanUInt32OptionValue</code></b></a>
+ * <a href="#api_nan_throw_error"><b><code>NanThrowError</code></b>, <b><code>NanThrowTypeError</code></b>, <b><code>NanThrowRangeError</code></b>, <b><code>NanThrowError(Handle<Value>)</code></b>, <b><code>NanThrowError(Handle<Value>, int)</code></b></a>
+ * <a href="#api_nan_new_buffer_handle"><b><code>NanNewBufferHandle(char *, size_t, FreeCallback, void *)</code></b>, <b><code>NanNewBufferHandle(char *, uint32_t)</code></b>, <b><code>NanNewBufferHandle(uint32_t)</code></b></a>
+ * <a href="#api_nan_buffer_use"><b><code>NanBufferUse(char *, uint32_t)</code></b></a>
+ * <a href="#api_nan_new_context_handle"><b><code>NanNewContextHandle</code></b></a>
+ * <a href="#api_nan_has_instance"><b><code>NanHasInstance</code></b></a>
+ * <a href="#api_nan_persistent_to_local"><b><code>NanPersistentToLocal</code></b></a>
+ * <a href="#api_nan_dispose"><b><code>NanDispose</code></b></a>
+ * <a href="#api_nan_assign_persistent"><b><code>NanAssignPersistent</code></b></a>
+ * <a href="#api_nan_init_persistent"><b><code>NanInitPersistent</code></b></a>
+ * <a href="#api_nan_callback"><b><code>NanCallback</code></b></a>
+ * <a href="#api_nan_async_worker"><b><code>NanAsyncWorker</code></b></a>
+ * <a href="#api_nan_async_queue_worker"><b><code>NanAsyncQueueWorker</code></b></a>
+
+<a name="api_nan_method"></a>
+### NAN_METHOD(methodname)
+
+Use `NAN_METHOD` to define your V8 accessible methods:
+
+```c++
+// .h:
+class Foo : public node::ObjectWrap {
+  ...
+
+  static NAN_METHOD(Bar);
+  static NAN_METHOD(Baz);
+}
+
+
+// .cc:
+NAN_METHOD(Foo::Bar) {
+  ...
+}
+
+NAN_METHOD(Foo::Baz) {
+  ...
+}
+```
+
+The reason for this macro is because of the method signature change in 0.11:
+
+```c++
+// 0.10 and below:
+Handle<Value> name(const Arguments& args)
+
+// 0.11 and above
+void name(const FunctionCallbackInfo<Value>& args)
+```
+
+The introduction of `FunctionCallbackInfo` brings additional complications:
+
+<a name="api_nan_getter"></a>
+### NAN_GETTER(methodname)
+
+Use `NAN_GETTER` to declare your V8 accessible getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`.
+
+<a name="api_nan_setter"></a>
+### NAN_SETTER(methodname)
+
+Use `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_SETTER`.
+
+<a name="api_nan_property_getter"></a>
+### NAN_PROPERTY_GETTER(cbname)
+Use `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`.
+
+<a name="api_nan_property_setter"></a>
+### NAN_PROPERTY_SETTER(cbname)
+Use `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local<Value>` `value` object to work with.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_SETTER`.
+
+<a name="api_nan_property_enumerator"></a>
+### NAN_PROPERTY_ENUMERATOR(cbname)
+Use `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`.
+
+<a name="api_nan_property_deleter"></a>
+### NAN_PROPERTY_DELETER(cbname)
+Use `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`.
+
+<a name="api_nan_property_query"></a>
+### NAN_PROPERTY_QUERY(cbname)
+Use `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`.
+
+You can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`.
+
+<a name="api_nan_weak_callback"></a>
+### NAN_WEAK_CALLBACK(type, cbname)
+
+Use `NAN_WEAK_CALLBACK` to declare your V8 WeakReference callbacks. There is an object argument accessible through `NAN_WEAK_CALLBACK_OBJECT`. The `type` argument gives the type of the `data` argument, accessible through `NAN_WEAK_CALLBACK_DATA(type)`.
+
+```c++
+static NAN_WEAK_CALLBACK(BufferReference*, WeakCheck) {
+  if (NAN_WEAK_CALLBACK_DATA(BufferReference*)->noLongerNeeded_) {
+    delete NAN_WEAK_CALLBACK_DATA(BufferReference*);
+  } else {
+    // Still in use, revive, prevent GC
+    NanMakeWeak(NAN_WEAK_CALLBACK_OBJECT, NAN_WEAK_CALLBACK_DATA(BufferReference*), &WeakCheck);
+  }
+}
+
+```
+<a name="api_nan_return_value"></a>
+### NanReturnValue(Handle&lt;Value&gt;)
+
+Use `NanReturnValue` when you want to return a value from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+  ...
+
+  NanReturnValue(String::New("FooBar!"));
+}
+```
+
+No `return` statement required.
+
+<a name="api_nan_return_undefined"></a>
+### NanReturnUndefined()
+
+Use `NanReturnUndefined` when you don't want to return anything from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+  ...
+
+  NanReturnUndefined();
+}
+```
+
+<a name="api_nan_return_null"></a>
+### NanReturnNull()
+
+Use `NanReturnNull` when you want to return `Null` from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+  ...
+
+  NanReturnNull();
+}
+```
+
+<a name="api_nan_return_empty_string"></a>
+### NanReturnEmptyString()
+
+Use `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method:
+
+```c++
+NAN_METHOD(Foo::Baz) {
+  ...
+
+  NanReturnEmptyString();
+}
+```
+
+<a name="api_nan_scope"></a>
+### NanScope()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+  NanScope();
+
+  NanReturnValue(String::New("FooBar!"));
+}
+```
+
+<a name="api_nan_locker"></a>
+### NanLocker()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+  NanLocker();
+  ...
+  NanUnlocker();
+}
+```
+
+<a name="api_nan_unlocker"></a>
+### NanUnlocker()
+
+The introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`:
+
+```c++
+NAN_METHOD(Foo::Bar) {
+  NanLocker();
+  ...
+  NanUnlocker();
+}
+```
+
+<a name="api_nan_get_internal_field_pointer"></a>
+### void * NanGetInternalFieldPointer(Handle&lt;Object&gt;, int)
+
+Gets a pointer to the internal field with at `index` from a V8 `Object` handle.
+
+```c++
+Local<Object> obj;
+...
+NanGetInternalFieldPointer(obj, 0);
+```
+<a name="api_nan_set_internal_field_pointer"></a>
+### void NanSetInternalFieldPointer(Handle&lt;Object&gt;, int, void *)
+
+Sets the value of the internal field at `index` on a V8 `Object` handle.
+
+```c++
+static Persistent<Function> dataWrapperCtor;
+...
+Local<Object> wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();
+NanSetInternalFieldPointer(wrapper, 0, this);
+```
+
+<a name="api_nan_object_wrap_handle"></a>
+### Local&lt;Object&gt; NanObjectWrapHandle(Object)
+
+When you want to fetch the V8 object handle from a native object you've wrapped with Node's `ObjectWrap`, you should use `NanObjectWrapHandle`:
+
+```c++
+NanObjectWrapHandle(iterator)->Get(String::NewSymbol("end"))
+```
+
+<a name="api_nan_make_weak"></a>
+### NanMakeWeak(Persistent&lt;T&gt;, parameter, callback)
+
+Make a persistent reference weak.
+
+<a name="api_nan_symbol"></a>
+### String NanSymbol(char *)
+
+This isn't strictly about compatibility, it's just an easier way to create string symbol objects (i.e. `String::NewSymbol(x)`), for getting and setting object properties, or names of objects.
+
+```c++
+bool foo = false;
+if (obj->Has(NanSymbol("foo")))
+  foo = optionsObj->Get(NanSymbol("foo"))->BooleanValue()
+```
+
+<a name="api_nan_get_pointer_safe"></a>
+### Type NanGetPointerSafe(Type *[, Type])
+
+A helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`.  Otherwise, the function returns the value the pointer points to.
+
+```c++
+char *plugh(uint32_t *optional) {
+  char res[] = "xyzzy";
+  uint32_t param = NanGetPointerSafe<uint32_t>(optional, 0x1337);
+  switch (param) {
+    ...
+  }
+  NanSetPointerSafe<uint32_t>(optional, 0xDEADBEEF);
+}  
+```
+
+<a name="api_nan_set_pointer_safe"></a>
+### bool NanSetPointerSafe(Type *, Type)
+
+A helper for setting optional argument pointers. If the pointer is `NULL`, the function simply return `false`.  Otherwise, the value is assigned to the variable the pointer points to.
+
+```c++
+const char *plugh(size_t *outputsize) {
+  char res[] = "xyzzy";
+  if !(NanSetPointerSafe<size_t>(outputsize, strlen(res) + 1)) {
+    ...
+  }
+
+  ...
+}
+```
+
+<a name="api_nan_from_v8_string"></a>
+### char* NanFromV8String(Handle&lt;Value&gt;[, enum Nan::Encoding, size_t *, char *, size_t, int])
+
+When you want to convert a V8 `String` to a `char*` use `NanFromV8String`. It is possible to define an encoding that defaults to `Nan::UTF8` as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `String::HINT_MANY_WRITES_EXPECTED | String::NO_NULL_TERMINATION`.
+Just remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:
+
+```c++
+size_t count;
+char* name = NanFromV8String(args[0]);
+char* decoded = NanFromV8String(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED);
+char param_copy[count];
+memcpy(param_copy, decoded, count);
+delete[] decoded;
+```
+
+<a name="api_nan_boolean_option_value"></a>
+### bool NanBooleanOptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;[, bool])
+
+When you have an "options" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`.
+
+The optional last parameter is the *default* value, which is `false` if left off:
+
+```c++
+// `foo` is false unless the user supplies a truthy value for it
+bool foo = NanBooleanOptionValue(optionsObj, NanSymbol("foo"));
+// `bar` is true unless the user supplies a falsy value for it
+bool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol("bar"), true);
+```
+
+<a name="api_nan_uint32_option_value"></a>
+### uint32_t NanUInt32OptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;, uint32_t)
+
+Similar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer.
+
+Requires all 3 arguments as a default is not optional:
+
+```c++
+uint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol("count"), 1024);
+```
+
+<a name="api_nan_throw_error"></a>
+### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local&lt;Value&gt;), NanThrowError(Local&lt;Value&gt;, int)
+
+For throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:
+
+```c++
+return NanThrowError("you must supply a callback argument");
+```
+
+Can also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`.
+
+<a name="api_nan_new_buffer_handle"></a>
+### Local&lt;Object&gt; NanNewBufferHandle(char *, uint32_t), Local&lt;Object&gt; NanNewBufferHandle(uint32_t)
+
+The `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation:
+
+```c++
+NanNewBufferHandle((char*)value.data(), value.size());
+```
+
+Can also be used to initialize a `Buffer` with just a `size` argument.
+
+Can also be supplied with a `NAN_WEAK_CALLBACK` and a hint for the garbage collector, when dealing with weak references.
+
+<a name="api_nan_buffer_use"></a>
+### Local&lt;Object&gt; NanBufferUse(char*, uint32_t)
+
+`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data.
+While it was possible to get around this, it required a shim by passing a
+callback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove
+needing to use this shim.
+
+`NanBufferUse` uses the `char*` passed as the backing data, and will free the
+memory automatically when the weak callback is called. Keep this in mind, as
+careless use can lead to "double free or corruption" and other cryptic failures.
+
+<a name="api_nan_has_instance"></a>
+### bool NanHasInstance(Persistent&lt;FunctionTemplate&gt;&, Handle&lt;Value&gt;)
+
+Can be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent<FunctionTemplate>` handle for.
+
+<a name="api_nan_persistent_to_local"></a>
+### Local&lt;Type&gt; NanPersistentToLocal(Persistent&lt;Type&gt;&)
+
+Aside from `FunctionCallbackInfo`, the biggest and most painful change to V8 in Node 0.11 is the many restrictions now placed on `Persistent` handles. They are difficult to assign and difficult to fetch the original value out of.
+
+Use `NanPersistentToLocal` to convert a `Persistent` handle back to a `Local` handle.
+
+```c++
+Local<Object> handle = NanPersistentToLocal(persistentHandle);
+```
+
+<a href="#api_nan_new_context_handle">
+### Local&lt;Context&gt; NanNewContextHandle([ExtensionConfiguration*, Handle&lt;ObjectTemplate&gt;, Handle&lt;Value&gt;])
+Creates a new `Local<Context>` handle.
+
+```c++
+Local<FunctionTemplate> ftmpl = FunctionTemplate::New();
+Local<ObjectTemplate> otmpl = ftmpl->InstanceTemplate();
+Local<Context> ctx =  NanNewContextHandle(NULL, otmpl);
+```
+
+<a name="api_nan_dispose"></a>
+### void NanDispose(Persistent&lt;T&gt; &)
+
+Use `NanDispose` to dispose a `Persistent` handle.
+
+```c++
+NanDispose(persistentHandle);
+```
+
+<a name="api_nan_assign_persistent"></a>
+### NanAssignPersistent(type, handle, object)
+
+Use `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.
+
+In general it is now better to place anything you want to protect from V8's garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`:
+
+```c++
+Persistent<Object> persistentHandle;
+
+...
+
+Local<Object> obj = Object::New();
+obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>
+NanAssignPersistent(Object, persistentHandle, obj)
+```
+
+<a name="api_nan_init_persistent"></a>
+### NanInitPersistent(type, name, object)
+
+User `NanInitPersistent` to declare and initialize a new `Persistent` with the supplied object. The assignment operator for `Persistent` is no longer public in Node 0.11, so this macro makes it easier to declare and initializing a new `Persistent`. See <a href="#api_nan_assign_persistent"><b><code>NanAssignPersistent</code></b></a> for more information.
+
+```c++
+Local<Object> obj = Object::New();
+obj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>
+NanInitPersistent(Object, persistentHandle, obj);
+```
+
+<a name="api_nan_callback"></a>
+### NanCallback
+
+Because of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Local<Function>` handles is annoyingly tricky. `NanCallback` makes it easier by taking your `Local` handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`.
+
+```c++
+Local<Function> callbackHandle = callback = args[0].As<Function>();
+NanCallback *callback = new NanCallback(callbackHandle);
+// pass `callback` around and it's safe from GC until you:
+delete callback;
+```
+
+You can execute the callback like so:
+
+```c++
+// no arguments:
+callback->Call(0, NULL);
+
+// an error argument:
+Local<Value> argv[] = {
+  Exception::Error(String::New("fail!"))
+};
+callback->Call(1, argv);
+
+// a success argument:
+Local<Value> argv[] = {
+  Local<Value>::New(Null()),
+  String::New("w00t!")
+};
+callback->Call(2, argv);
+```
+
+`NanCallback` also has a `Local<Function> GetCallback()` method that you can use to fetch a local handle to the underlying callback function if you need it.
+
+<a name="api_nan_async_worker"></a>
+### NanAsyncWorker
+
+`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress.
+
+See a rough outline of the implementation:
+
+```c++
+class NanAsyncWorker {
+public:
+  NanAsyncWorker (NanCallback *callback);
+
+  // Clean up persistent handles and delete the *callback
+  virtual ~NanAsyncWorker ();
+
+  // Check the `char *errmsg` property and call HandleOKCallback()
+  // or HandleErrorCallback depending on whether it has been set or not
+  virtual void WorkComplete ();
+
+  // You must implement this to do some async work. If there is an
+  // error then allocate `errmsg` to to a message and the callback will
+  // be passed that string in an Error object
+  virtual void Execute ();
+
+protected:
+  // Set this if there is an error, otherwise it's NULL
+  const char *errmsg;
+
+  // Save a V8 object in a Persistent handle to protect it from GC
+  void SavePersistent(const char *key, Local<Object> &obj);
+
+  // Fetch a stored V8 object (don't call from within `Execute()`)
+  Local<Object> GetFromPersistent(const char *key);
+
+  // Default implementation calls the callback function with no arguments.
+  // Override this to return meaningful data
+  virtual void HandleOKCallback ();
+
+  // Default implementation calls the callback function with an Error object
+  // wrapping the `errmsg` string
+  virtual void HandleErrorCallback ();
+};
+```
+
+<a name="api_nan_async_queue_worker"></a>
+### NanAsyncQueueWorker(NanAsyncWorker *)
+
+`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you&mdash;most of the logic for this is embedded in `NanAsyncWorker`.
+
+### Contributors
+
+NAN is only possible due to the excellent work of the following contributors:
+
+<table><tbody>
+<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>
+<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td></tr>
+<tr><th align="left">Trevor Norris</th><td><a href="https://github.com/trevnorris">GitHub/trevnorris</a></td><td><a href="http://twitter.com/trevnorris">Twitter/@trevnorris</a></td></tr>
+</tbody></table>
+
+Licence &amp; copyright
+-----------------------
+
+Copyright (c) 2013 Rod Vagg & NAN contributors (listed above).
+
+Native Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/nan.h b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/nan.h
new file mode 100755 (executable)
index 0000000..b3eb02d
--- /dev/null
@@ -0,0 +1,884 @@
+/**********************************************************************************
+ * NAN - Native Abstractions for Node.js
+ *
+ * Copyright (c) 2013 NAN contributors:
+ *   - Rod Vagg <https://github.com/rvagg>
+ *   - Benjamin Byholm <https://github.com/kkoopa>
+ *   - Trevor Norris <https://github.com/trevnorris>
+ *
+ * MIT +no-false-attribs License <https://github.com/rvagg/nan/blob/master/LICENSE>
+ *
+ * Version 0.3.2 (current Node unstable: 0.11.6, Node stable: 0.10.17)
+ *
+ * ChangeLog:
+ *  * 0.3.2 Aug 30 2013
+ *    - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent
+ *      in NanAsyncWorker
+ *
+ *  * 0.3.1 Aug 20 2013
+ *    - fix "not all control paths return a value" compile warning on some platforms
+ *
+ *  * 0.3.0 Aug 19 2013
+ *    - Made NAN work with NPM
+ *    - Lots of fixes to NanFromV8String, pulling in features from new Node core
+ *    - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API
+ *    - Added optional error number argument for NanThrowError()
+ *    - Added NanInitPersistent()
+ *    - Added NanReturnNull() and NanReturnEmptyString()
+ *    - Added NanLocker and NanUnlocker
+ *    - Added missing scopes
+ *    - Made sure to clear disposed Persistent handles
+ *    - Changed NanAsyncWorker to allocate error messages on the heap
+ *    - Changed NanThrowError(Local<Value>) to NanThrowError(Handle<Value>)
+ *    - Fixed leak in NanAsyncWorker when errmsg is used
+ *
+ *  * 0.2.2 Aug 5 2013
+ *    - Fixed usage of undefined variable with node::BASE64 in NanFromV8String()
+ *
+ *  * 0.2.1 Aug 5 2013
+ *    - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for
+ *      NanFromV8String()
+ *
+ *  * 0.2.0 Aug 5 2013
+ *    - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR,
+ *      NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY
+ *    - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS,
+ *      _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS,
+ *      _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS,
+ *      _NAN_PROPERTY_QUERY_ARGS
+ *    - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer
+ *    - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT,
+ *      NAN_WEAK_CALLBACK_DATA, NanMakeWeak
+ *    - Renamed THROW_ERROR to _NAN_THROW_ERROR
+ *    - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*)
+ *    - Added NanBufferUse(char*, uint32_t)
+ *    - Added NanNewContextHandle(v8::ExtensionConfiguration*,
+ *        v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)
+ *    - Fixed broken NanCallback#GetFunction()
+ *    - Added optional encoding and size arguments to NanFromV8String()
+ *    - Added NanGetPointerSafe() and NanSetPointerSafe()
+ *    - Added initial test suite (to be expanded)
+ *    - Allow NanUInt32OptionValue to convert any Number object
+ *
+ *  * 0.1.0 Jul 21 2013
+ *    - Added `NAN_GETTER`, `NAN_SETTER`
+ *    - Added `NanThrowError` with single Local<Value> argument
+ *    - Added `NanNewBufferHandle` with single uint32_t argument
+ *    - Added `NanHasInstance(Persistent<FunctionTemplate>&, Handle<Value>)`
+ *    - Added `Local<Function> NanCallback#GetFunction()`
+ *    - Added `NanCallback#Call(int, Local<Value>[])`
+ *    - Deprecated `NanCallback#Run(int, Local<Value>[])` in favour of Call
+ *
+ * See https://github.com/rvagg/nan for the latest update to this file
+ **********************************************************************************/
+
+#ifndef NAN_H
+#define NAN_H
+
+#include <node.h>
+#include <node_buffer.h>
+#include <string.h>
+
+// some generic helpers
+
+template<class T> static inline bool NanSetPointerSafe(T *var, T val) {
+  if (var) {
+    *var = val;
+    return true;
+  } else {
+    return false;
+  }
+}
+
+template<class T> static inline T NanGetPointerSafe(
+    T *var,
+    T fallback = reinterpret_cast<T>(0)) {
+  if (var) {
+    return *var;
+  } else {
+    return fallback;
+  }
+}
+
+#define NanSymbol(value) v8::String::NewSymbol(value)
+
+static inline bool NanBooleanOptionValue(
+      v8::Local<v8::Object> optionsObj
+    , v8::Handle<v8::String> opt, bool def) {
+
+  if (def) {
+    return optionsObj.IsEmpty()
+      || !optionsObj->Has(opt)
+      || optionsObj->Get(opt)->BooleanValue();
+  } else {
+    return !optionsObj.IsEmpty()
+      && optionsObj->Has(opt)
+      && optionsObj->Get(opt)->BooleanValue();
+  }
+}
+
+static inline bool NanBooleanOptionValue(
+      v8::Local<v8::Object> optionsObj
+    , v8::Handle<v8::String> opt) {
+  return NanBooleanOptionValue(optionsObj, opt, false);
+}
+
+static inline uint32_t NanUInt32OptionValue(
+      v8::Local<v8::Object> optionsObj
+    , v8::Handle<v8::String> opt
+    , uint32_t def) {
+
+  return !optionsObj.IsEmpty()
+    && optionsObj->Has(opt)
+    && optionsObj->Get(opt)->IsNumber()
+      ? optionsObj->Get(opt)->Uint32Value()
+      : def;
+}
+
+#if (NODE_MODULE_VERSION > 0x000B)
+// Node 0.11+ (0.11.3 and below won't compile with these)
+
+static v8::Isolate* nan_isolate = v8::Isolate::GetCurrent();
+
+# define _NAN_METHOD_ARGS const v8::FunctionCallbackInfo<v8::Value>& args
+# define NAN_METHOD(name) void name(_NAN_METHOD_ARGS)
+# define _NAN_GETTER_ARGS const v8::PropertyCallbackInfo<v8::Value>& args
+# define NAN_GETTER(name)                                                      \
+    void name(v8::Local<v8::String> property, _NAN_GETTER_ARGS)
+# define _NAN_SETTER_ARGS const v8::PropertyCallbackInfo<void>& args
+# define NAN_SETTER(name)                                                      \
+    void name(                                                                 \
+        v8::Local<v8::String> property                                         \
+      , v8::Local<v8::Value> value                                             \
+      , _NAN_SETTER_ARGS)
+# define _NAN_PROPERTY_GETTER_ARGS                                             \
+    const v8::PropertyCallbackInfo<v8::Value>& args
+# define NAN_PROPERTY_GETTER(name)                                             \
+    void name(v8::Local<v8::String> property                                   \
+      , _NAN_PROPERTY_GETTER_ARGS)
+# define _NAN_PROPERTY_SETTER_ARGS                                             \
+    const v8::PropertyCallbackInfo<v8::Value>& args
+# define NAN_PROPERTY_SETTER(name)                                             \
+    void name(v8::Local<v8::String> property                                   \
+    , v8::Local<v8::Value> value                                               \
+    , _NAN_PROPERTY_SETTER_ARGS)
+# define _NAN_PROPERTY_ENUMERATOR_ARGS                                         \
+    const v8::PropertyCallbackInfo<v8::Array>& args
+# define NAN_PROPERTY_ENUMERATOR(name)                                         \
+    void name(_NAN_PROPERTY_ENUMERATOR_ARGS)
+# define _NAN_PROPERTY_DELETER_ARGS                                            \
+    const v8::PropertyCallbackInfo<v8::Boolean>& args
+# define NAN_PROPERTY_DELETER(name)                                            \
+    void name(                                                                 \
+        v8::Local<v8::String> property                                         \
+      , _NAN_PROPERTY_DELETER_ARGS)
+# define _NAN_PROPERTY_QUERY_ARGS                                              \
+    const v8::PropertyCallbackInfo<v8::Integer>& args
+# define NAN_PROPERTY_QUERY(name)                                              \
+    void name(v8::Local<v8::String> property, _NAN_PROPERTY_QUERY_ARGS)
+# define NanGetInternalFieldPointer(object, index)                             \
+    object->GetAlignedPointerFromInternalField(index)
+# define NanSetInternalFieldPointer(object, index, value)                      \
+    object->SetAlignedPointerInInternalField(index, value)
+
+# define NAN_WEAK_CALLBACK(type, name)                                         \
+    void name(                                                                 \
+      v8::Isolate* isolate,                                                    \
+      v8::Persistent<v8::Object>* object,                                      \
+      type data)
+# define NAN_WEAK_CALLBACK_OBJECT (*object)
+# define NAN_WEAK_CALLBACK_DATA(type) ((type) data)
+
+# define NanScope() v8::HandleScope scope(nan_isolate)
+# define NanLocker() v8::Locker locker(nan_isolate)
+# define NanUnlocker() v8::Unlocker unlocker(nan_isolate)
+# define NanReturnValue(value) return args.GetReturnValue().Set(value)
+# define NanReturnUndefined() return
+# define NanReturnNull() return args.GetReturnValue().SetNull()
+# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString()
+# define NanAssignPersistent(type, handle, obj) handle.Reset(nan_isolate, obj)
+# define NanInitPersistent(type, name, obj)                                    \
+    v8::Persistent<type> name(nan_isolate, obj)
+# define NanObjectWrapHandle(obj) obj->handle()
+# define NanMakeWeak(handle, parameter, callback)                              \
+    handle.MakeWeak(nan_isolate, parameter, callback)
+
+# define _NAN_THROW_ERROR(fun, errmsg)                                         \
+    do {                                                                       \
+      NanScope();                                                              \
+      v8::ThrowException(fun(v8::String::New(errmsg)));                        \
+    } while (0);
+
+  inline static void NanThrowError(const char* errmsg) {
+    _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
+  }
+
+  inline static void NanThrowError(v8::Handle<v8::Value> error) {
+    NanScope();
+    v8::ThrowException(error);
+  }
+
+  inline static void NanThrowError(const char *msg, const int errorNumber) {
+    v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
+    v8::Local<v8::Object> obj = err.As<v8::Object>();
+    obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
+    NanThrowError(err);
+  }
+
+  inline static void NanThrowTypeError(const char* errmsg) {
+    _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
+  }
+
+  inline static void NanThrowRangeError(const char* errmsg) {
+    _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
+  }
+
+  template<class T> static inline void NanDispose(v8::Persistent<T> &handle) {
+    handle.Dispose(nan_isolate);
+    handle.Clear();
+  }
+
+  static inline v8::Local<v8::Object> NanNewBufferHandle (
+      char *data,
+      size_t length,
+      node::smalloc::FreeCallback callback,
+      void *hint) {
+    return node::Buffer::New(data, length, callback, hint);
+  }
+
+  static inline v8::Local<v8::Object> NanNewBufferHandle (
+     char *data, uint32_t size) {
+    return node::Buffer::New(data, size);
+  }
+
+  static inline v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
+    return node::Buffer::New(size);
+  }
+
+  static inline v8::Local<v8::Object> NanBufferUse(char* data, uint32_t size) {
+    return node::Buffer::Use(data, size);
+  }
+
+  template <class TypeName>
+  inline v8::Local<TypeName> NanPersistentToLocal(
+     const v8::Persistent<TypeName>& persistent) {
+    if (persistent.IsWeak()) {
+     return v8::Local<TypeName>::New(nan_isolate, persistent);
+    } else {
+     return *reinterpret_cast<v8::Local<TypeName>*>(
+         const_cast<v8::Persistent<TypeName>*>(&persistent));
+    }
+  }
+
+  inline bool NanHasInstance(
+        v8::Persistent<v8::FunctionTemplate>& function_template
+      , v8::Handle<v8::Value> value) {
+    return NanPersistentToLocal(function_template)->HasInstance(value);
+  }
+
+  static inline v8::Local<v8::Context> NanNewContextHandle(
+    v8::ExtensionConfiguration* extensions = NULL,
+    v8::Handle<v8::ObjectTemplate> tmpl = v8::Handle<v8::ObjectTemplate>(),
+    v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()) {
+      return v8::Local<v8::Context>::New(nan_isolate, v8::Context::New(
+          nan_isolate, extensions, tmpl, obj));
+  }
+
+#else
+// Node 0.8 and 0.10
+
+# define _NAN_METHOD_ARGS const v8::Arguments& args
+# define NAN_METHOD(name) v8::Handle<v8::Value> name(_NAN_METHOD_ARGS)
+# define _NAN_GETTER_ARGS const v8::AccessorInfo &args
+# define NAN_GETTER(name)                                                      \
+    v8::Handle<v8::Value> name(v8::Local<v8::String> property, _NAN_GETTER_ARGS)
+# define _NAN_SETTER_ARGS const v8::AccessorInfo &args
+# define NAN_SETTER(name)                                                      \
+    void name(                                                                 \
+      v8::Local<v8::String> property                                           \
+    , v8::Local<v8::Value> value                                               \
+    , _NAN_SETTER_ARGS)
+# define _NAN_PROPERTY_GETTER_ARGS const v8::AccessorInfo& args
+# define NAN_PROPERTY_GETTER(name)                                             \
+    v8::Handle<v8::Value> name(v8::Local<v8::String> property                  \
+    , _NAN_PROPERTY_GETTER_ARGS)
+# define _NAN_PROPERTY_SETTER_ARGS const v8::AccessorInfo& args
+# define NAN_PROPERTY_SETTER(name)                                             \
+    v8::Handle<v8::Value> name(v8::Local<v8::String> property                  \
+    , v8::Local<v8::Value> value                                               \
+    , _NAN_PROPERTY_SETTER_ARGS)
+# define _NAN_PROPERTY_ENUMERATOR_ARGS const v8::AccessorInfo& args
+# define NAN_PROPERTY_ENUMERATOR(name)                                         \
+    v8::Handle<v8::Array> name(_NAN_PROPERTY_ENUMERATOR_ARGS)
+# define _NAN_PROPERTY_DELETER_ARGS const v8::AccessorInfo& args
+# define NAN_PROPERTY_DELETER(name)                                            \
+    v8::Handle<v8::Boolean> name(                                              \
+      v8::Local<v8::String> property                                           \
+    , _NAN_PROPERTY_DELETER_ARGS)
+# define _NAN_PROPERTY_QUERY_ARGS const v8::AccessorInfo& args
+# define NAN_PROPERTY_QUERY(name)                                              \
+    v8::Handle<v8::Integer> name(                                              \
+      v8::Local<v8::String> property                                           \
+    , _NAN_PROPERTY_QUERY_ARGS)
+
+# define NanGetInternalFieldPointer(object, index)                             \
+    object->GetPointerFromInternalField(index)
+# define NanSetInternalFieldPointer(object, index, value)                      \
+    object->SetPointerInInternalField(index, value)
+# define NAN_WEAK_CALLBACK(type, name) void name(                              \
+                v8::Persistent<v8::Value> object,                              \
+                void *data)
+# define NAN_WEAK_CALLBACK_OBJECT object
+# define NAN_WEAK_CALLBACK_DATA(type) ((type) data)
+
+# define NanScope() v8::HandleScope scope
+# define NanLocker() v8::Locker locker
+# define NanUnlocker() v8::Unlocker unlocker
+# define NanReturnValue(value) return scope.Close(value)
+# define NanReturnUndefined() return v8::Undefined()
+# define NanReturnNull() return v8::Null()
+# define NanReturnEmptyString() return v8::String::Empty()
+# define NanInitPersistent(type, name, obj)                                    \
+    v8::Persistent<type> name = v8::Persistent<type>::New(obj)
+# define NanAssignPersistent(type, handle, obj)                                \
+    handle = v8::Persistent<type>::New(obj)
+# define NanObjectWrapHandle(obj) obj->handle_
+# define NanMakeWeak(handle, parameters, callback)                             \
+    handle.MakeWeak(parameters, callback)
+
+# define _NAN_THROW_ERROR(fun, errmsg)                                         \
+    do {                                                                       \
+      NanScope();                                                              \
+      return v8::ThrowException(fun(v8::String::New(errmsg)));                 \
+    } while (0);
+
+  inline static v8::Handle<v8::Value> NanThrowError(const char* errmsg) {
+    _NAN_THROW_ERROR(v8::Exception::Error, errmsg);
+  }
+
+  inline static v8::Handle<v8::Value> NanThrowError(
+      v8::Handle<v8::Value> error) {
+    NanScope();
+    return v8::ThrowException(error);
+  }
+
+  inline static v8::Handle<v8::Value> NanThrowError(
+      const char *msg,
+      const int errorNumber) {
+    v8::Local<v8::Value> err = v8::Exception::Error(v8::String::New(msg));
+    v8::Local<v8::Object> obj = err.As<v8::Object>();
+    obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber));
+    return NanThrowError(err);
+  }
+
+  inline static v8::Handle<v8::Value> NanThrowTypeError(const char* errmsg) {
+    _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg);
+  }
+
+  inline static v8::Handle<v8::Value> NanThrowRangeError(const char* errmsg) {
+    _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg);
+  }
+
+  template<class T> static inline void NanDispose(v8::Persistent<T> &handle) {
+    handle.Dispose();
+    handle.Clear();
+  }
+
+  static inline v8::Local<v8::Object> NanNewBufferHandle (
+      char *data,
+      size_t length,
+      node::Buffer::free_callback callback,
+      void *hint) {
+    return v8::Local<v8::Object>::New(
+        node::Buffer::New(data, length, callback, hint)->handle_);
+  }
+
+  static inline v8::Local<v8::Object> NanNewBufferHandle (
+     char *data, uint32_t size) {
+    return v8::Local<v8::Object>::New(node::Buffer::New(data, size)->handle_);
+  }
+
+  static inline v8::Local<v8::Object> NanNewBufferHandle (uint32_t size) {
+    return v8::Local<v8::Object>::New(node::Buffer::New(size)->handle_);
+  }
+
+  static inline void FreeData(char *data, void *hint) {
+    delete[] data;
+  }
+
+  static inline v8::Local<v8::Object> NanBufferUse(char* data, uint32_t size) {
+    return v8::Local<v8::Object>::New(
+        node::Buffer::New(data, size, FreeData, NULL)->handle_);
+  }
+
+  template <class TypeName>
+  inline v8::Local<TypeName> NanPersistentToLocal(
+     const v8::Persistent<TypeName>& persistent) {
+    if (persistent.IsWeak()) {
+     return v8::Local<TypeName>::New(persistent);
+    } else {
+     return *reinterpret_cast<v8::Local<TypeName>*>(
+         const_cast<v8::Persistent<TypeName>*>(&persistent));
+    }
+  }
+
+  inline bool NanHasInstance(
+        v8::Persistent<v8::FunctionTemplate>& function_template
+      , v8::Handle<v8::Value> value) {
+    return function_template->HasInstance(value);
+  }
+
+  static inline v8::Local<v8::Context> NanNewContextHandle(
+        v8::ExtensionConfiguration* extensions = NULL
+      , v8::Handle<v8::ObjectTemplate> tmpl =
+            v8::Handle<v8::ObjectTemplate>()
+      , v8::Handle<v8::Value> obj = v8::Handle<v8::Value>()
+    ) {
+      v8::Persistent<v8::Context> ctx =
+          v8::Context::New(extensions, tmpl, obj);
+      v8::Local<v8::Context> lctx = v8::Local<v8::Context>::New(ctx);
+      ctx.Dispose();
+      return lctx;
+  }
+
+#endif // node version
+
+class NanCallback {
+ public:
+  NanCallback(const v8::Local<v8::Function> &fn) {
+    NanScope();
+    v8::Local<v8::Object> obj = v8::Object::New();
+    obj->Set(NanSymbol("callback"), fn);
+    NanAssignPersistent(v8::Object, handle, obj);
+  }
+
+  ~NanCallback() {
+    if (handle.IsEmpty()) return;
+    handle.Dispose();
+    handle.Clear();
+  }
+
+  inline v8::Local<v8::Function> GetFunction () {
+    return NanPersistentToLocal(handle)->Get(NanSymbol("callback"))
+        .As<v8::Function>();
+  }
+
+  // deprecated
+  void Run(int argc, v8::Local<v8::Value> argv[]) {
+    Call(argc, argv);
+  }
+
+  void Call(int argc, v8::Local<v8::Value> argv[]) {
+    NanScope();
+
+    v8::Local<v8::Function> callback = NanPersistentToLocal(handle)->
+       Get(NanSymbol("callback")).As<v8::Function>();
+    v8::TryCatch try_catch;
+    callback->Call(v8::Context::GetCurrent()->Global(), argc, argv);
+    if (try_catch.HasCaught()) {
+      node::FatalException(try_catch);
+    }
+  }
+
+ private:
+  v8::Persistent<v8::Object> handle;
+};
+
+/* abstract */ class NanAsyncWorker {
+public:
+  NanAsyncWorker (NanCallback *callback) : callback(callback) {
+    request.data = this;
+    errmsg = NULL;
+  }
+
+  virtual ~NanAsyncWorker () {
+    NanScope();
+
+    if (!persistentHandle.IsEmpty())
+      NanDispose(persistentHandle);
+    if (callback)
+      delete callback;
+    if (errmsg)
+      delete errmsg;
+  }
+
+  virtual void WorkComplete () {
+    NanScope();
+
+    if (errmsg == NULL)
+      HandleOKCallback();
+    else
+      HandleErrorCallback();
+    delete callback;
+    callback = NULL;
+  }
+
+  virtual void Execute () =0;
+
+  uv_work_t request;
+
+protected:
+  v8::Persistent<v8::Object> persistentHandle;
+  NanCallback *callback;
+  const char *errmsg;
+
+  void SavePersistent(const char *key, v8::Local<v8::Object> &obj) {
+    NanScope();
+
+    v8::Local<v8::Object> handle = NanPersistentToLocal(persistentHandle);
+    handle->Set(NanSymbol(key), obj);
+  }
+
+  v8::Local<v8::Object> GetFromPersistent(const char *key) {
+    NanScope();
+
+    v8::Local<v8::Object> handle = NanPersistentToLocal(persistentHandle);
+    return handle->Get(NanSymbol(key)).As<v8::Object>();
+  }
+
+  virtual void HandleOKCallback () {
+    NanScope();
+
+    callback->Call(0, NULL);
+  };
+
+  virtual void HandleErrorCallback () {
+    NanScope();
+
+    v8::Local<v8::Value> argv[] = {
+        v8::Exception::Error(v8::String::New(errmsg))
+    };
+    callback->Call(1, argv);
+  }
+};
+
+inline void NanAsyncExecute (uv_work_t* req) {
+  NanAsyncWorker *worker = static_cast<NanAsyncWorker*>(req->data);
+  worker->Execute();
+}
+
+inline void NanAsyncExecuteComplete (uv_work_t* req) {
+  NanAsyncWorker* worker = static_cast<NanAsyncWorker*>(req->data);
+  worker->WorkComplete();
+  delete worker;
+}
+
+inline void NanAsyncQueueWorker (NanAsyncWorker* worker) {
+  uv_queue_work(
+      uv_default_loop()
+    , &worker->request
+    , NanAsyncExecute
+    , (uv_after_work_cb)NanAsyncExecuteComplete
+  );
+}
+
+//// Base 64 ////
+
+#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)
+
+
+// Doesn't check for padding at the end.  Can be 1-2 bytes over.
+static inline size_t _nan_base64_decoded_size_fast(size_t size) {
+  size_t remainder = size % 4;
+
+  size = (size / 4) * 3;
+  if (remainder) {
+    if (size == 0 && remainder == 1) {
+      // special case: 1-byte input cannot be decoded
+      size = 0;
+    } else {
+      // non-padded input, add 1 or 2 extra bytes
+      size += 1 + (remainder == 3);
+    }
+  }
+
+  return size;
+}
+
+template <typename TypeName>
+static size_t _nan_base64_decoded_size(const TypeName* src, size_t size) {
+  if (size == 0)
+    return 0;
+
+  if (src[size - 1] == '=')
+    size--;
+  if (size > 0 && src[size - 1] == '=')
+    size--;
+
+  return _nan_base64_decoded_size_fast(size);
+}
+
+
+// supports regular and URL-safe base64
+static const int _nan_unbase64_table[] =
+  { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63,
+    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
+    -1,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
+    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63,
+    -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+  };
+
+#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)]
+
+
+template <typename TypeName>
+static size_t _nan_base64_decode(char* buf,
+                     size_t len,
+                     const TypeName* src,
+                     const size_t srcLen) {
+  char a, b, c, d;
+  char* dst = buf;
+  char* dstEnd = buf + len;
+  const TypeName* srcEnd = src + srcLen;
+
+  while (src < srcEnd && dst < dstEnd) {
+    int remaining = srcEnd - src;
+
+    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+    if (remaining == 0 || *src == '=') break;
+    a = _nan_unbase64(*src++);
+
+    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+    if (remaining <= 1 || *src == '=') break;
+    b = _nan_unbase64(*src++);
+
+    *dst++ = (a << 2) | ((b & 0x30) >> 4);
+    if (dst == dstEnd) break;
+
+    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+    if (remaining <= 2 || *src == '=') break;
+    c = _nan_unbase64(*src++);
+
+    *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2);
+    if (dst == dstEnd) break;
+
+    while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--;
+    if (remaining <= 3 || *src == '=') break;
+    d = _nan_unbase64(*src++);
+
+    *dst++ = ((c & 0x03) << 6) | (d & 0x3F);
+  }
+
+  return dst - buf;
+}
+
+//// HEX ////
+
+template <typename TypeName>
+unsigned _nan_hex2bin(TypeName c) {
+  if (c >= '0' && c <= '9') return c - '0';
+  if (c >= 'A' && c <= 'F') return 10 + (c - 'A');
+  if (c >= 'a' && c <= 'f') return 10 + (c - 'a');
+  return static_cast<unsigned>(-1);
+}
+
+
+template <typename TypeName>
+static size_t _nan_hex_decode(char* buf,
+                  size_t len,
+                  const TypeName* src,
+                  const size_t srcLen) {
+  size_t i;
+  for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) {
+    unsigned a = _nan_hex2bin(src[i * 2 + 0]);
+    unsigned b = _nan_hex2bin(src[i * 2 + 1]);
+    if (!~a || !~b) return i;
+    buf[i] = a * 16 + b;
+  }
+
+  return i;
+}
+
+static bool _NanGetExternalParts(
+      v8::Handle<v8::Value> val
+    , const char** data
+    , size_t* len) {
+
+  if (node::Buffer::HasInstance(val)) {
+    *data = node::Buffer::Data(val.As<v8::Object>());
+    *len = node::Buffer::Length(val.As<v8::Object>());
+    return true;
+
+  }
+
+  assert(val->IsString());
+  v8::Local<v8::String> str = v8::Local<v8::String>::New(val.As<v8::String>());
+
+  if (str->IsExternalAscii()) {
+    const v8::String::ExternalAsciiStringResource* ext;
+    ext = str->GetExternalAsciiStringResource();
+    *data = ext->data();
+    *len = ext->length();
+    return true;
+
+  } else if (str->IsExternal()) {
+    const v8::String::ExternalStringResource* ext;
+    ext = str->GetExternalStringResource();
+    *data = reinterpret_cast<const char*>(ext->data());
+    *len = ext->length();
+    return true;
+  }
+
+  return false;
+}
+
+namespace Nan {
+  enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER};
+}
+
+static inline char* NanFromV8String(
+      v8::Handle<v8::Value> from
+    , enum Nan::Encoding encoding = Nan::UTF8
+    , size_t *datalen = NULL
+    , char *buf = NULL
+    , size_t buflen = 0
+    , int flags = v8::String::NO_NULL_TERMINATION
+    | v8::String::HINT_MANY_WRITES_EXPECTED) {
+
+  NanScope();
+
+  size_t sz_;
+  size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION);
+  char *data = NULL;
+  size_t len;
+  bool is_extern = _NanGetExternalParts(
+      from
+    , const_cast<const char**>(&data)
+    , &len);
+
+  if (is_extern && !term_len) {
+    NanSetPointerSafe(datalen, len);
+    return data;
+  }
+
+  v8::Local<v8::String> toStr = from->ToString();
+
+  char *to = buf;
+
+  v8::String::AsciiValue value(toStr);
+  switch(encoding) {
+    case Nan::ASCII:
+#if NODE_MODULE_VERSION < 0x0C
+      sz_ = toStr->Length();
+      if (to == NULL) {
+        to = new char[sz_ + term_len];
+      } else {
+        assert(buflen >= sz_ + term_len && "too small buffer");
+      }
+      NanSetPointerSafe<size_t>(
+          datalen
+        , toStr->WriteAscii(to, 0, sz_ + term_len, flags));
+      return to;
+#endif
+    case Nan::BINARY:
+    case Nan::BUFFER:
+      sz_ = toStr->Length();
+      if (to == NULL) {
+        to = new char[sz_ + term_len];
+      } else {
+        assert(buflen >= sz_ + term_len && "too small buffer");
+      }
+#if NODE_MODULE_VERSION < 0x0C
+      // TODO(isaacs): THIS IS AWFUL!!!
+      // AGREE(kkoopa)
+      {
+        uint16_t* twobytebuf = new uint16_t[sz_ + term_len];
+
+        size_t len = toStr->Write(twobytebuf, 0, sz_ + term_len, flags);
+
+        for (size_t i = 0; i < sz_ + term_len && i < len + term_len; i++) {
+          unsigned char *b = reinterpret_cast<unsigned char*>(&twobytebuf[i]);
+          to[i] = *b;
+        }
+
+        NanSetPointerSafe<size_t>(datalen, len);
+
+        delete[] twobytebuf;
+        return to;
+      }
+#else
+      NanSetPointerSafe<size_t>(
+        datalen,
+        toStr->WriteOneByte(
+            reinterpret_cast<uint8_t *>(to)
+          , 0
+          , sz_ + term_len
+          , flags));
+      return to;
+#endif
+    case Nan::UTF8:
+      sz_ = toStr->Utf8Length();
+      if (to == NULL) {
+        to = new char[sz_ + term_len];
+      } else {
+        assert(buflen >= sz_ + term_len && "too small buffer");
+      }
+      NanSetPointerSafe<size_t>(
+          datalen
+        , toStr->WriteUtf8(to, sz_ + term_len, NULL, flags) - term_len);
+      return to;
+    case Nan::BASE64:
+      sz_ = _nan_base64_decoded_size(*value, toStr->Length());
+      if (to == NULL) {
+        to = new char[sz_ + term_len];
+      } else {
+        assert(buflen >= sz_ + term_len);
+      }
+      NanSetPointerSafe<size_t>(
+          datalen
+        , _nan_base64_decode(to, sz_, *value, value.length()));
+      if (term_len) {
+        to[sz_] = '\0';
+      }
+      return to;
+    case Nan::UCS2:
+      {
+        sz_ = toStr->Length();
+        if (to == NULL) {
+          to = new char[(sz_ + term_len) * 2];
+        } else {
+          assert(buflen >= (sz_ + term_len) * 2 && "too small buffer");
+        }
+
+        int bc = 2 * toStr->Write(
+            reinterpret_cast<uint16_t *>(to)
+          , 0
+          , sz_ + term_len
+          , flags);
+        NanSetPointerSafe<size_t>(datalen, bc);
+        return to;
+      }
+    case Nan::HEX:
+      sz_ = toStr->Length();
+      assert(!(sz_ & 1) && "bad hex data");
+      if (to == NULL) {
+        to = new char[sz_ / 2 + term_len];
+      } else {
+        assert(buflen >= sz_ / 2 + term_len && "too small buffer");
+      }
+
+      NanSetPointerSafe<size_t>(
+          datalen
+        , _nan_hex_decode(to, sz_ / 2, *value, value.length()));
+      if (term_len) {
+        to[sz_ / 2] = '\0';
+      }
+      return to;
+    default:
+      assert(0 && "unknown encoding");
+  }
+  return to;
+}
+
+#endif
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/package.json b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/nan/package.json
new file mode 100755 (executable)
index 0000000..ae3679e
--- /dev/null
@@ -0,0 +1,35 @@
+{
+  "name": "nan",
+  "version": "0.3.2",
+  "description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility",
+  "main": ".index.js",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/rvagg/nan.git"
+  },
+  "contributors": [
+    {
+      "name": "Rod Vagg",
+      "email": "r@va.gg",
+      "url": "https://github.com/rvagg"
+    },
+    {
+      "name": "Benjamin Byholm",
+      "email": "bbyholm@abo.fi",
+      "url": "https://github.com/kkoopa/"
+    },
+    {
+      "name": "Trevor Norris",
+      "email": "trev.norris@gmail.com",
+      "url": "https://github.com/trevnorris"
+    }
+  ],
+  "license": "MIT",
+  "readme": "Native Abstractions for Node.js\n===============================\n\n**A header file filled with macro and utility goodness for making addon development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.**\n\n***Current version: 0.3.2*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for changelog)*\n\n[![NPM](https://nodei.co/npm/nan.png?downloads=true&stars=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)\n\nThanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.\n\nThis project also contains some helper utilities that make addon development a bit more pleasant.\n\n * **[Usage](#usage)**\n * **[Example](#example)**\n * **[API](#api)**\n\n<a name=\"usage\"></a>\n## Usage\n\nSimply add **NAN** as a dependency in the *package.json* of your Node addon:\n\n```js\n\"dependencies\": {\n    ...\n    \"nan\" : \"~0.3.1\"\n    ...\n}\n```\n\nPull in the path to **NAN** in your *binding.gyp* so that you can use `#include \"nan.h\"` in your *.cpp*:\n\n```js\n\"include_dirs\" : [\n    ...\n    \"<!(node -p -e \\\"require('path').dirname(require.resolve('nan'))\\\")\"\n    ...\n]\n```\n\nThis works like a `-I<path-to-NAN>` when compiling your addon.\n\n<a name=\"example\"></a>\n## Example\n\nSee **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use.\n\nFor a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.\n\nCompare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work).\n\nNote that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class.\n\n```c++\n// addon.cc\n#include <node.h>\n#include \"nan.h\"\n// ...\n\nusing namespace v8;\n\nvoid InitAll(Handle<Object> exports) {\n  exports->Set(NanSymbol(\"calculateSync\"),\n    FunctionTemplate::New(CalculateSync)->GetFunction());\n\n  exports->Set(NanSymbol(\"calculateAsync\"),\n    FunctionTemplate::New(CalculateAsync)->GetFunction());\n}\n\nNODE_MODULE(addon, InitAll)\n```\n\n```c++\n// sync.h\n#include <node.h>\n#include \"nan.h\"\n\nNAN_METHOD(CalculateSync);\n```\n\n```c++\n// sync.cc\n#include <node.h>\n#include \"nan.h\"\n#include \"sync.h\"\n// ...\n\nusing namespace v8;\n\n// Simple synchronous access to the `Estimate()` function\nNAN_METHOD(CalculateSync) {\n  NanScope();\n\n  // expect a number as the first argument\n  int points = args[0]->Uint32Value();\n  double est = Estimate(points);\n\n  NanReturnValue(Number::New(est));\n}\n```\n\n```c++\n// async.cc\n#include <node.h>\n#include \"nan.h\"\n#include \"async.h\"\n\n// ...\n\nusing namespace v8;\n\nclass PiWorker : public NanAsyncWorker {\n public:\n  PiWorker(NanCallback *callback, int points)\n    : NanAsyncWorker(callback), points(points) {}\n  ~PiWorker() {}\n\n  // Executed inside the worker-thread.\n  // It is not safe to access V8, or V8 data structures\n  // here, so everything we need for input and output\n  // should go on `this`.\n  void Execute () {\n    estimate = Estimate(points);\n  }\n\n  // Executed when the async work is complete\n  // this function will be run inside the main event loop\n  // so it is safe to use V8 again\n  void HandleOKCallback () {\n    NanScope();\n\n    Local<Value> argv[] = {\n        Local<Value>::New(Null())\n      , Number::New(estimate)\n    };\n\n    callback->Call(2, argv);\n  };\n\n private:\n  int points;\n  double estimate;\n};\n\n// Asynchronous access to the `Estimate()` function\nNAN_METHOD(CalculateAsync) {\n  NanScope();\n\n  int points = args[0]->Uint32Value();\n  NanCallback *callback = new NanCallback(args[1].As<Function>());\n\n  NanAsyncQueueWorker(new PiWorker(callback, points));\n  NanReturnUndefined();\n}\n```\n\n<a name=\"api\"></a>\n## API\n\n * <a href=\"#api_nan_method\"><b><code>NAN_METHOD</code></b></a>\n * <a href=\"#api_nan_getter\"><b><code>NAN_GETTER</code></b></a>\n * <a href=\"#api_nan_setter\"><b><code>NAN_SETTER</code></b></a>\n * <a href=\"#api_nan_property_getter\"><b><code>NAN_PROPERTY_GETTER</code></b></a>\n * <a href=\"#api_nan_property_setter\"><b><code>NAN_PROPERTY_SETTER</code></b></a>\n * <a href=\"#api_nan_property_enumerator\"><b><code>NAN_PROPERTY_ENUMERATOR</code></b></a>\n * <a href=\"#api_nan_property_deleter\"><b><code>NAN_PROPERTY_DELETER</code></b></a>\n * <a href=\"#api_nan_property_query\"><b><code>NAN_PROPERTY_QUERY</code></b></a>\n * <a href=\"#api_nan_weak_callback\"><b><code>NAN_WEAK_CALLBACK</code></b></a>\n * <a href=\"#api_nan_return_value\"><b><code>NanReturnValue</code></b></a>\n * <a href=\"#api_nan_return_undefined\"><b><code>NanReturnUndefined</code></b></a>\n * <a href=\"#api_nan_return_null\"><b><code>NanReturnNull</code></b></a>\n * <a href=\"#api_nan_return_empty_string\"><b><code>NanReturnEmptyString</code></b></a>\n * <a href=\"#api_nan_scope\"><b><code>NanScope</code></b></a>\n * <a href=\"#api_nan_locker\"><b><code>NanLocker</code></b></a>\n * <a href=\"#api_nan_unlocker\"><b><code>NanUnlocker</code></b></a>\n * <a href=\"#api_nan_get_internal_field_pointer\"><b><code>NanGetInternalFieldPointer</code></b></a>\n * <a href=\"#api_nan_set_internal_field_pointer\"><b><code>NanSetInternalFieldPointer</code></b></a>\n * <a href=\"#api_nan_object_wrap_handle\"><b><code>NanObjectWrapHandle</code></b></a>\n * <a href=\"#api_nan_make_weak\"><b><code>NanMakeWeak</code></b></a>\n * <a href=\"#api_nan_symbol\"><b><code>NanSymbol</code></b></a>\n * <a href=\"#api_nan_get_pointer_safe\"><b><code>NanGetPointerSafe</code></b></a>\n * <a href=\"#api_nan_set_pointer_safe\"><b><code>NanSetPointerSafe</code></b></a>\n * <a href=\"#api_nan_from_v8_string\"><b><code>NanFromV8String</code></b></a>\n * <a href=\"#api_nan_boolean_option_value\"><b><code>NanBooleanOptionValue</code></b></a>\n * <a href=\"#api_nan_uint32_option_value\"><b><code>NanUInt32OptionValue</code></b></a>\n * <a href=\"#api_nan_throw_error\"><b><code>NanThrowError</code></b>, <b><code>NanThrowTypeError</code></b>, <b><code>NanThrowRangeError</code></b>, <b><code>NanThrowError(Handle<Value>)</code></b>, <b><code>NanThrowError(Handle<Value>, int)</code></b></a>\n * <a href=\"#api_nan_new_buffer_handle\"><b><code>NanNewBufferHandle(char *, size_t, FreeCallback, void *)</code></b>, <b><code>NanNewBufferHandle(char *, uint32_t)</code></b>, <b><code>NanNewBufferHandle(uint32_t)</code></b></a>\n * <a href=\"#api_nan_buffer_use\"><b><code>NanBufferUse(char *, uint32_t)</code></b></a>\n * <a href=\"#api_nan_new_context_handle\"><b><code>NanNewContextHandle</code></b></a>\n * <a href=\"#api_nan_has_instance\"><b><code>NanHasInstance</code></b></a>\n * <a href=\"#api_nan_persistent_to_local\"><b><code>NanPersistentToLocal</code></b></a>\n * <a href=\"#api_nan_dispose\"><b><code>NanDispose</code></b></a>\n * <a href=\"#api_nan_assign_persistent\"><b><code>NanAssignPersistent</code></b></a>\n * <a href=\"#api_nan_init_persistent\"><b><code>NanInitPersistent</code></b></a>\n * <a href=\"#api_nan_callback\"><b><code>NanCallback</code></b></a>\n * <a href=\"#api_nan_async_worker\"><b><code>NanAsyncWorker</code></b></a>\n * <a href=\"#api_nan_async_queue_worker\"><b><code>NanAsyncQueueWorker</code></b></a>\n\n<a name=\"api_nan_method\"></a>\n### NAN_METHOD(methodname)\n\nUse `NAN_METHOD` to define your V8 accessible methods:\n\n```c++\n// .h:\nclass Foo : public node::ObjectWrap {\n  ...\n\n  static NAN_METHOD(Bar);\n  static NAN_METHOD(Baz);\n}\n\n\n// .cc:\nNAN_METHOD(Foo::Bar) {\n  ...\n}\n\nNAN_METHOD(Foo::Baz) {\n  ...\n}\n```\n\nThe reason for this macro is because of the method signature change in 0.11:\n\n```c++\n// 0.10 and below:\nHandle<Value> name(const Arguments& args)\n\n// 0.11 and above\nvoid name(const FunctionCallbackInfo<Value>& args)\n```\n\nThe introduction of `FunctionCallbackInfo` brings additional complications:\n\n<a name=\"api_nan_getter\"></a>\n### NAN_GETTER(methodname)\n\nUse `NAN_GETTER` to declare your V8 accessible getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`.\n\n<a name=\"api_nan_setter\"></a>\n### NAN_SETTER(methodname)\n\nUse `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local<Value>` `value` object to work with.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_SETTER`.\n\n<a name=\"api_nan_property_getter\"></a>\n### NAN_PROPERTY_GETTER(cbname)\nUse `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`.\n\n<a name=\"api_nan_property_setter\"></a>\n### NAN_PROPERTY_SETTER(cbname)\nUse `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local<Value>` `value` object to work with.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_SETTER`.\n\n<a name=\"api_nan_property_enumerator\"></a>\n### NAN_PROPERTY_ENUMERATOR(cbname)\nUse `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`.\n\n<a name=\"api_nan_property_deleter\"></a>\n### NAN_PROPERTY_DELETER(cbname)\nUse `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`.\n\n<a name=\"api_nan_property_query\"></a>\n### NAN_PROPERTY_QUERY(cbname)\nUse `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`.\n\n<a name=\"api_nan_weak_callback\"></a>\n### NAN_WEAK_CALLBACK(type, cbname)\n\nUse `NAN_WEAK_CALLBACK` to declare your V8 WeakReference callbacks. There is an object argument accessible through `NAN_WEAK_CALLBACK_OBJECT`. The `type` argument gives the type of the `data` argument, accessible through `NAN_WEAK_CALLBACK_DATA(type)`.\n\n```c++\nstatic NAN_WEAK_CALLBACK(BufferReference*, WeakCheck) {\n  if (NAN_WEAK_CALLBACK_DATA(BufferReference*)->noLongerNeeded_) {\n    delete NAN_WEAK_CALLBACK_DATA(BufferReference*);\n  } else {\n    // Still in use, revive, prevent GC\n    NanMakeWeak(NAN_WEAK_CALLBACK_OBJECT, NAN_WEAK_CALLBACK_DATA(BufferReference*), &WeakCheck);\n  }\n}\n\n```\n<a name=\"api_nan_return_value\"></a>\n### NanReturnValue(Handle&lt;Value&gt;)\n\nUse `NanReturnValue` when you want to return a value from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n  ...\n\n  NanReturnValue(String::New(\"FooBar!\"));\n}\n```\n\nNo `return` statement required.\n\n<a name=\"api_nan_return_undefined\"></a>\n### NanReturnUndefined()\n\nUse `NanReturnUndefined` when you don't want to return anything from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n  ...\n\n  NanReturnUndefined();\n}\n```\n\n<a name=\"api_nan_return_null\"></a>\n### NanReturnNull()\n\nUse `NanReturnNull` when you want to return `Null` from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n  ...\n\n  NanReturnNull();\n}\n```\n\n<a name=\"api_nan_return_empty_string\"></a>\n### NanReturnEmptyString()\n\nUse `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n  ...\n\n  NanReturnEmptyString();\n}\n```\n\n<a name=\"api_nan_scope\"></a>\n### NanScope()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n  NanScope();\n\n  NanReturnValue(String::New(\"FooBar!\"));\n}\n```\n\n<a name=\"api_nan_locker\"></a>\n### NanLocker()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n  NanLocker();\n  ...\n  NanUnlocker();\n}\n```\n\n<a name=\"api_nan_unlocker\"></a>\n### NanUnlocker()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n  NanLocker();\n  ...\n  NanUnlocker();\n}\n```\n\n<a name=\"api_nan_get_internal_field_pointer\"></a>\n### void * NanGetInternalFieldPointer(Handle&lt;Object&gt;, int)\n\nGets a pointer to the internal field with at `index` from a V8 `Object` handle.\n\n```c++\nLocal<Object> obj;\n...\nNanGetInternalFieldPointer(obj, 0);\n```\n<a name=\"api_nan_set_internal_field_pointer\"></a>\n### void NanSetInternalFieldPointer(Handle&lt;Object&gt;, int, void *)\n\nSets the value of the internal field at `index` on a V8 `Object` handle.\n\n```c++\nstatic Persistent<Function> dataWrapperCtor;\n...\nLocal<Object> wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();\nNanSetInternalFieldPointer(wrapper, 0, this);\n```\n\n<a name=\"api_nan_object_wrap_handle\"></a>\n### Local&lt;Object&gt; NanObjectWrapHandle(Object)\n\nWhen you want to fetch the V8 object handle from a native object you've wrapped with Node's `ObjectWrap`, you should use `NanObjectWrapHandle`:\n\n```c++\nNanObjectWrapHandle(iterator)->Get(String::NewSymbol(\"end\"))\n```\n\n<a name=\"api_nan_make_weak\"></a>\n### NanMakeWeak(Persistent&lt;T&gt;, parameter, callback)\n\nMake a persistent reference weak.\n\n<a name=\"api_nan_symbol\"></a>\n### String NanSymbol(char *)\n\nThis isn't strictly about compatibility, it's just an easier way to create string symbol objects (i.e. `String::NewSymbol(x)`), for getting and setting object properties, or names of objects.\n\n```c++\nbool foo = false;\nif (obj->Has(NanSymbol(\"foo\")))\n  foo = optionsObj->Get(NanSymbol(\"foo\"))->BooleanValue()\n```\n\n<a name=\"api_nan_get_pointer_safe\"></a>\n### Type NanGetPointerSafe(Type *[, Type])\n\nA helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`.  Otherwise, the function returns the value the pointer points to.\n\n```c++\nchar *plugh(uint32_t *optional) {\n  char res[] = \"xyzzy\";\n  uint32_t param = NanGetPointerSafe<uint32_t>(optional, 0x1337);\n  switch (param) {\n    ...\n  }\n  NanSetPointerSafe<uint32_t>(optional, 0xDEADBEEF);\n}  \n```\n\n<a name=\"api_nan_set_pointer_safe\"></a>\n### bool NanSetPointerSafe(Type *, Type)\n\nA helper for setting optional argument pointers. If the pointer is `NULL`, the function simply return `false`.  Otherwise, the value is assigned to the variable the pointer points to.\n\n```c++\nconst char *plugh(size_t *outputsize) {\n  char res[] = \"xyzzy\";\n  if !(NanSetPointerSafe<size_t>(outputsize, strlen(res) + 1)) {\n    ...\n  }\n\n  ...\n}\n```\n\n<a name=\"api_nan_from_v8_string\"></a>\n### char* NanFromV8String(Handle&lt;Value&gt;[, enum Nan::Encoding, size_t *, char *, size_t, int])\n\nWhen you want to convert a V8 `String` to a `char*` use `NanFromV8String`. It is possible to define an encoding that defaults to `Nan::UTF8` as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `String::HINT_MANY_WRITES_EXPECTED | String::NO_NULL_TERMINATION`.\nJust remember that you'll end up with an object that you'll need to `delete[]` at some point unless you supply your own buffer:\n\n```c++\nsize_t count;\nchar* name = NanFromV8String(args[0]);\nchar* decoded = NanFromV8String(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED);\nchar param_copy[count];\nmemcpy(param_copy, decoded, count);\ndelete[] decoded;\n```\n\n<a name=\"api_nan_boolean_option_value\"></a>\n### bool NanBooleanOptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;[, bool])\n\nWhen you have an \"options\" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`.\n\nThe optional last parameter is the *default* value, which is `false` if left off:\n\n```c++\n// `foo` is false unless the user supplies a truthy value for it\nbool foo = NanBooleanOptionValue(optionsObj, NanSymbol(\"foo\"));\n// `bar` is true unless the user supplies a falsy value for it\nbool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol(\"bar\"), true);\n```\n\n<a name=\"api_nan_uint32_option_value\"></a>\n### uint32_t NanUInt32OptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;, uint32_t)\n\nSimilar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer.\n\nRequires all 3 arguments as a default is not optional:\n\n```c++\nuint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol(\"count\"), 1024);\n```\n\n<a name=\"api_nan_throw_error\"></a>\n### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local&lt;Value&gt;), NanThrowError(Local&lt;Value&gt;, int)\n\nFor throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:\n\n```c++\nreturn NanThrowError(\"you must supply a callback argument\");\n```\n\nCan also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`.\n\n<a name=\"api_nan_new_buffer_handle\"></a>\n### Local&lt;Object&gt; NanNewBufferHandle(char *, uint32_t), Local&lt;Object&gt; NanNewBufferHandle(uint32_t)\n\nThe `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation:\n\n```c++\nNanNewBufferHandle((char*)value.data(), value.size());\n```\n\nCan also be used to initialize a `Buffer` with just a `size` argument.\n\nCan also be supplied with a `NAN_WEAK_CALLBACK` and a hint for the garbage collector, when dealing with weak references.\n\n<a name=\"api_nan_buffer_use\"></a>\n### Local&lt;Object&gt; NanBufferUse(char*, uint32_t)\n\n`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data.\nWhile it was possible to get around this, it required a shim by passing a\ncallback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove\nneeding to use this shim.\n\n`NanBufferUse` uses the `char*` passed as the backing data, and will free the\nmemory automatically when the weak callback is called. Keep this in mind, as\ncareless use can lead to \"double free or corruption\" and other cryptic failures.\n\n<a name=\"api_nan_has_instance\"></a>\n### bool NanHasInstance(Persistent&lt;FunctionTemplate&gt;&, Handle&lt;Value&gt;)\n\nCan be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent<FunctionTemplate>` handle for.\n\n<a name=\"api_nan_persistent_to_local\"></a>\n### Local&lt;Type&gt; NanPersistentToLocal(Persistent&lt;Type&gt;&)\n\nAside from `FunctionCallbackInfo`, the biggest and most painful change to V8 in Node 0.11 is the many restrictions now placed on `Persistent` handles. They are difficult to assign and difficult to fetch the original value out of.\n\nUse `NanPersistentToLocal` to convert a `Persistent` handle back to a `Local` handle.\n\n```c++\nLocal<Object> handle = NanPersistentToLocal(persistentHandle);\n```\n\n<a href=\"#api_nan_new_context_handle\">\n### Local&lt;Context&gt; NanNewContextHandle([ExtensionConfiguration*, Handle&lt;ObjectTemplate&gt;, Handle&lt;Value&gt;])\nCreates a new `Local<Context>` handle.\n\n```c++\nLocal<FunctionTemplate> ftmpl = FunctionTemplate::New();\nLocal<ObjectTemplate> otmpl = ftmpl->InstanceTemplate();\nLocal<Context> ctx =  NanNewContextHandle(NULL, otmpl);\n```\n\n<a name=\"api_nan_dispose\"></a>\n### void NanDispose(Persistent&lt;T&gt; &)\n\nUse `NanDispose` to dispose a `Persistent` handle.\n\n```c++\nNanDispose(persistentHandle);\n```\n\n<a name=\"api_nan_assign_persistent\"></a>\n### NanAssignPersistent(type, handle, object)\n\nUse `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.\n\nIn general it is now better to place anything you want to protect from V8's garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`:\n\n```c++\nPersistent<Object> persistentHandle;\n\n...\n\nLocal<Object> obj = Object::New();\nobj->Set(NanSymbol(\"key\"), keyHandle); // where keyHandle might be a Local<String>\nNanAssignPersistent(Object, persistentHandle, obj)\n```\n\n<a name=\"api_nan_init_persistent\"></a>\n### NanInitPersistent(type, name, object)\n\nUser `NanInitPersistent` to declare and initialize a new `Persistent` with the supplied object. The assignment operator for `Persistent` is no longer public in Node 0.11, so this macro makes it easier to declare and initializing a new `Persistent`. See <a href=\"#api_nan_assign_persistent\"><b><code>NanAssignPersistent</code></b></a> for more information.\n\n```c++\nLocal<Object> obj = Object::New();\nobj->Set(NanSymbol(\"key\"), keyHandle); // where keyHandle might be a Local<String>\nNanInitPersistent(Object, persistentHandle, obj);\n```\n\n<a name=\"api_nan_callback\"></a>\n### NanCallback\n\nBecause of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Local<Function>` handles is annoyingly tricky. `NanCallback` makes it easier by taking your `Local` handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`.\n\n```c++\nLocal<Function> callbackHandle = callback = args[0].As<Function>();\nNanCallback *callback = new NanCallback(callbackHandle);\n// pass `callback` around and it's safe from GC until you:\ndelete callback;\n```\n\nYou can execute the callback like so:\n\n```c++\n// no arguments:\ncallback->Call(0, NULL);\n\n// an error argument:\nLocal<Value> argv[] = {\n  Exception::Error(String::New(\"fail!\"))\n};\ncallback->Call(1, argv);\n\n// a success argument:\nLocal<Value> argv[] = {\n  Local<Value>::New(Null()),\n  String::New(\"w00t!\")\n};\ncallback->Call(2, argv);\n```\n\n`NanCallback` also has a `Local<Function> GetCallback()` method that you can use to fetch a local handle to the underlying callback function if you need it.\n\n<a name=\"api_nan_async_worker\"></a>\n### NanAsyncWorker\n\n`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress.\n\nSee a rough outline of the implementation:\n\n```c++\nclass NanAsyncWorker {\npublic:\n  NanAsyncWorker (NanCallback *callback);\n\n  // Clean up persistent handles and delete the *callback\n  virtual ~NanAsyncWorker ();\n\n  // Check the `char *errmsg` property and call HandleOKCallback()\n  // or HandleErrorCallback depending on whether it has been set or not\n  virtual void WorkComplete ();\n\n  // You must implement this to do some async work. If there is an\n  // error then allocate `errmsg` to to a message and the callback will\n  // be passed that string in an Error object\n  virtual void Execute ();\n\nprotected:\n  // Set this if there is an error, otherwise it's NULL\n  const char *errmsg;\n\n  // Save a V8 object in a Persistent handle to protect it from GC\n  void SavePersistent(const char *key, Local<Object> &obj);\n\n  // Fetch a stored V8 object (don't call from within `Execute()`)\n  Local<Object> GetFromPersistent(const char *key);\n\n  // Default implementation calls the callback function with no arguments.\n  // Override this to return meaningful data\n  virtual void HandleOKCallback ();\n\n  // Default implementation calls the callback function with an Error object\n  // wrapping the `errmsg` string\n  virtual void HandleErrorCallback ();\n};\n```\n\n<a name=\"api_nan_async_queue_worker\"></a>\n### NanAsyncQueueWorker(NanAsyncWorker *)\n\n`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you&mdash;most of the logic for this is embedded in `NanAsyncWorker`.\n\n### Contributors\n\nNAN is only possible due to the excellent work of the following contributors:\n\n<table><tbody>\n<tr><th align=\"left\">Rod Vagg</th><td><a href=\"https://github.com/rvagg\">GitHub/rvagg</a></td><td><a href=\"http://twitter.com/rvagg\">Twitter/@rvagg</a></td></tr>\n<tr><th align=\"left\">Benjamin Byholm</th><td><a href=\"https://github.com/kkoopa/\">GitHub/kkoopa</a></td></tr>\n<tr><th align=\"left\">Trevor Norris</th><td><a href=\"https://github.com/trevnorris\">GitHub/trevnorris</a></td><td><a href=\"http://twitter.com/trevnorris\">Twitter/@trevnorris</a></td></tr>\n</tbody></table>\n\nLicence &amp; copyright\n-----------------------\n\nCopyright (c) 2013 Rod Vagg & NAN contributors (listed above).\n\nNative Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.\n",
+  "readmeFilename": "README.md",
+  "bugs": {
+    "url": "https://github.com/rvagg/nan/issues"
+  },
+  "_id": "nan@0.3.2",
+  "_from": "nan@~0.3.0"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/Makefile b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/Makefile
new file mode 100755 (executable)
index 0000000..7496b6f
--- /dev/null
@@ -0,0 +1,12 @@
+ALL_TESTS = $(shell find test/ -name '*.test.js')
+
+run-tests:
+       @./node_modules/.bin/mocha \
+               -t 2000 \
+               $(TESTFLAGS) \
+               $(TESTS)
+
+test:
+       @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests
+
+.PHONY: test
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/README.md b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/README.md
new file mode 100755 (executable)
index 0000000..4b39a2a
--- /dev/null
@@ -0,0 +1,28 @@
+# options.js #
+
+A very light-weight in-code option parsers for node.js.
+
+## License ##
+
+(The MIT License)
+
+Copyright (c) 2012 Einar Otto Stangvik &lt;einaros@gmail.com&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/lib/options.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/lib/options.js
new file mode 100755 (executable)
index 0000000..4fc45e9
--- /dev/null
@@ -0,0 +1,86 @@
+/*!
+ * Copyright(c) 2011 Einar Otto Stangvik <einaros@gmail.com>
+ * MIT Licensed
+ */
+
+var fs = require('fs');
+
+function Options(defaults) {
+  var internalValues = {};
+  var values = this.value = {};
+  Object.keys(defaults).forEach(function(key) {
+    internalValues[key] = defaults[key];
+    Object.defineProperty(values, key, {
+      get: function() { return internalValues[key]; },
+      configurable: false,
+      enumerable: true
+    });
+  });
+  this.reset = function() {
+    Object.keys(defaults).forEach(function(key) {
+      internalValues[key] = defaults[key];
+    });
+    return this;
+  };
+  this.merge = function(options, required) {
+    options = options || {};
+    if (Object.prototype.toString.call(required) === '[object Array]') {
+      var missing = [];
+      for (var i = 0, l = required.length; i < l; ++i) {
+        var key = required[i];
+        if (!(key in options)) {
+          missing.push(key);
+        }
+      }
+      if (missing.length > 0) {
+        if (missing.length > 1) {
+          throw new Error('options ' +
+            missing.slice(0, missing.length - 1).join(', ') + ' and ' +
+            missing[missing.length - 1] + ' must be defined');
+        }
+        else throw new Error('option ' + missing[0] + ' must be defined');
+      }
+    }
+    Object.keys(options).forEach(function(key) {
+      if (key in internalValues) {
+        internalValues[key] = options[key];
+      }
+    });
+    return this;
+  };
+  this.copy = function(keys) {
+    var obj = {};
+    Object.keys(defaults).forEach(function(key) {
+      if (keys.indexOf(key) !== -1) {
+        obj[key] = values[key];
+      }
+    });
+    return obj;
+  };
+  this.read = function(filename, cb) {
+    if (typeof cb == 'function') {
+      var self = this;
+      fs.readFile(filename, function(error, data) {
+        if (error) return cb(error);
+        var conf = JSON.parse(data);
+        self.merge(conf);
+        cb();
+      });
+    }
+    else {
+      var conf = JSON.parse(fs.readFileSync(filename));
+      this.merge(conf);
+    }
+    return this;
+  };
+  this.isDefined = function(key) {
+    return typeof values[key] != 'undefined';
+  };
+  this.isDefinedAndNonNull = function(key) {
+    return typeof values[key] != 'undefined' && values[key] !== null;
+  };
+  Object.freeze(values);
+  Object.freeze(this);
+}
+
+module.exports = Options;
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/package.json b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/package.json
new file mode 100755 (executable)
index 0000000..04e8978
--- /dev/null
@@ -0,0 +1,32 @@
+{
+  "author": {
+    "name": "Einar Otto Stangvik",
+    "email": "einaros@gmail.com",
+    "url": "http://2x.io"
+  },
+  "name": "options",
+  "description": "A very light-weight in-code option parsers for node.js.",
+  "version": "0.0.5",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/einaros/options.js.git"
+  },
+  "main": "lib/options",
+  "scripts": {
+    "test": "make test"
+  },
+  "engines": {
+    "node": ">=0.4.0"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "mocha": "latest"
+  },
+  "readme": "# options.js #\n\nA very light-weight in-code option parsers for node.js.\n\n## License ##\n\n(The MIT License)\n\nCopyright (c) 2012 Einar Otto Stangvik &lt;einaros@gmail.com&gt;\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",
+  "readmeFilename": "README.md",
+  "bugs": {
+    "url": "https://github.com/einaros/options.js/issues"
+  },
+  "_id": "options@0.0.5",
+  "_from": "options@>=0.0.5"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/test/fixtures/test.conf b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/test/fixtures/test.conf
new file mode 100755 (executable)
index 0000000..6e62444
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "a": "foobar",
+  "b": false
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/test/options.test.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/options/test/options.test.js
new file mode 100755 (executable)
index 0000000..6a1d9f5
--- /dev/null
@@ -0,0 +1,140 @@
+var Options = require('options')
+  , assert = require('assert');
+
+describe('Options', function() {
+  describe('#ctor', function() {
+    it('initializes options', function() {
+      var option = new Options({a: true, b: false});
+      assert.strictEqual(true, option.value.a);
+      assert.strictEqual(false, option.value.b);
+    });
+  });
+
+  describe('#merge', function() {
+    it('merges options from another object', function() {
+      var option = new Options({a: true, b: false});
+      option.merge({b: true});
+      assert.strictEqual(true, option.value.a);
+      assert.strictEqual(true, option.value.b);
+    });
+    it('does nothing when arguments are undefined', function() {
+      var option = new Options({a: true, b: false});
+      option.merge(undefined);
+      assert.strictEqual(true, option.value.a);
+      assert.strictEqual(false, option.value.b);
+    });
+    it('cannot set values that werent already there', function() {
+      var option = new Options({a: true, b: false});
+      option.merge({c: true});
+      assert.strictEqual('undefined', typeof option.value.c);
+    });
+    it('can require certain options to be defined', function() {
+      var option = new Options({a: true, b: false, c: 3});
+      var caughtException = false;
+      try {
+        option.merge({}, ['a', 'b', 'c']);
+      }
+      catch (e) {
+        caughtException = e.toString() == 'Error: options a, b and c must be defined';
+      }
+      assert.strictEqual(true, caughtException);
+    });
+    it('can require certain options to be defined, when options are undefined', function() {
+      var option = new Options({a: true, b: false, c: 3});
+      var caughtException = false;
+      try {
+        option.merge(undefined, ['a', 'b', 'c']);
+      }
+      catch (e) {
+        caughtException = e.toString() == 'Error: options a, b and c must be defined';
+      }
+      assert.strictEqual(true, caughtException);
+    });
+    it('returns "this"', function() {
+      var option = new Options({a: true, b: false, c: 3});
+      assert.strictEqual(option, option.merge());
+    });
+  });
+
+  describe('#copy', function() {
+    it('returns a new object with the indicated options', function() {
+      var option = new Options({a: true, b: false, c: 3});
+      option.merge({c: 4});
+      var obj = option.copy(['a', 'c']);
+      assert.strictEqual(true, obj.a);
+      assert.strictEqual(4, obj.c);
+      assert.strictEqual('undefined', typeof obj.b);
+    });
+  });
+
+  describe('#value', function() {
+    it('can be enumerated', function() {
+      var option = new Options({a: true, b: false});
+      assert.strictEqual(2, Object.keys(option.value).length);
+    });
+    it('can not be used to set values', function() {
+      var option = new Options({a: true, b: false});
+      option.value.b = true;
+      assert.strictEqual(false, option.value.b);
+    });
+    it('can not be used to add values', function() {
+      var option = new Options({a: true, b: false});
+      option.value.c = 3;
+      assert.strictEqual('undefined', typeof option.value.c);
+    });
+  });
+
+  describe('#isDefined', function() {
+    it('returns true if the named value is defined', function() {
+      var option = new Options({a: undefined});
+      assert.strictEqual(false, option.isDefined('a'));
+      option.merge({a: false});
+      assert.strictEqual(true, option.isDefined('a'));
+    });
+  });
+
+  describe('#isDefinedAndNonNull', function() {
+    it('returns true if the named value is defined and non-null', function() {
+      var option = new Options({a: undefined});
+      assert.strictEqual(false, option.isDefinedAndNonNull('a'));
+      option.merge({a: null});
+      assert.strictEqual(false, option.isDefinedAndNonNull('a'));
+      option.merge({a: 2});
+      assert.strictEqual(true, option.isDefinedAndNonNull('a'));
+    });
+  });
+
+  describe('#read', function() {
+    it('reads and merges config from a file', function() {
+      var option = new Options({a: true, b: true});
+      option.read(__dirname + '/fixtures/test.conf');
+      assert.strictEqual('foobar', option.value.a);
+      assert.strictEqual(false, option.value.b);
+    });
+
+    it('asynchronously reads and merges config from a file when a callback is passed', function(done) {
+      var option = new Options({a: true, b: true});
+      option.read(__dirname + '/fixtures/test.conf', function(error) {
+        assert.strictEqual('foobar', option.value.a);
+        assert.strictEqual(false, option.value.b);
+        done();
+      });
+    });
+  });
+
+  describe('#reset', function() {
+    it('resets options to defaults', function() {
+      var option = new Options({a: true, b: false});
+      option.merge({b: true});
+      assert.strictEqual(true, option.value.b);
+      option.reset();
+      assert.strictEqual(false, option.value.b);
+    });
+  });
+
+  it('is immutable', function() {
+    var option = new Options({a: true, b: false});
+    option.foo = 2;
+    assert.strictEqual('undefined', typeof option.foo);
+  });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/README.md b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/README.md
new file mode 100755 (executable)
index 0000000..55eb3c1
--- /dev/null
@@ -0,0 +1,3 @@
+# tinycolor #
+
+This is a no-fuzz, barebone, zero muppetry color module for node.js.
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/example.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/example.js
new file mode 100755 (executable)
index 0000000..f754046
--- /dev/null
@@ -0,0 +1,3 @@
+require('./tinycolor');
+console.log('this should be red and have an underline!'.grey.underline);
+console.log('this should have a blue background!'.bgBlue);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/package.json b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/package.json
new file mode 100755 (executable)
index 0000000..8c56dce
--- /dev/null
@@ -0,0 +1,27 @@
+{
+  "author": {
+    "name": "Einar Otto Stangvik",
+    "email": "einaros@gmail.com",
+    "url": "http://2x.io"
+  },
+  "name": "tinycolor",
+  "description": "a to-the-point color module for node",
+  "version": "0.0.1",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/einaros/tinycolor.git"
+  },
+  "engines": {
+    "node": ">=0.4.0"
+  },
+  "dependencies": {},
+  "devDependencies": {},
+  "main": "tinycolor",
+  "readme": "# tinycolor #\n\nThis is a no-fuzz, barebone, zero muppetry color module for node.js.",
+  "readmeFilename": "README.md",
+  "bugs": {
+    "url": "https://github.com/einaros/tinycolor/issues"
+  },
+  "_id": "tinycolor@0.0.1",
+  "_from": "tinycolor@0.x"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/tinycolor.js b/MSF-Node/org.tizen.multiscreen/server/lib/ws/node_modules/tinycolor/tinycolor.js
new file mode 100755 (executable)
index 0000000..36e552c
--- /dev/null
@@ -0,0 +1,31 @@
+var styles = {
+  'bold':      ['\033[1m', '\033[22m'],
+  'italic':    ['\033[3m', '\033[23m'],
+  'underline': ['\033[4m', '\033[24m'],
+  'inverse':   ['\033[7m', '\033[27m'],
+  'black':     ['\033[30m', '\033[39m'],
+  'red':       ['\033[31m', '\033[39m'],
+  'green':     ['\033[32m', '\033[39m'],
+  'yellow':    ['\033[33m', '\033[39m'],
+  'blue':      ['\033[34m', '\033[39m'],
+  'magenta':   ['\033[35m', '\033[39m'],
+  'cyan':      ['\033[36m', '\033[39m'],
+  'white':     ['\033[37m', '\033[39m'],
+  'default':   ['\033[39m', '\033[39m'],
+  'grey':      ['\033[90m', '\033[39m'],
+  'bgBlack':   ['\033[40m', '\033[49m'],
+  'bgRed':     ['\033[41m', '\033[49m'],
+  'bgGreen':   ['\033[42m', '\033[49m'],
+  'bgYellow':  ['\033[43m', '\033[49m'],
+  'bgBlue':    ['\033[44m', '\033[49m'],
+  'bgMagenta': ['\033[45m', '\033[49m'],
+  'bgCyan':    ['\033[46m', '\033[49m'],
+  'bgWhite':   ['\033[47m', '\033[49m'],
+  'bgDefault': ['\033[49m', '\033[49m']
+}
+Object.keys(styles).forEach(function(style) {
+  Object.defineProperty(String.prototype, style, {
+    get: function() { return styles[style][0] + this + styles[style][1]; },
+    enumerable: false
+  });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/async/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/async/LICENSE
new file mode 100755 (executable)
index 0000000..b7f9d50
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Caolan McMahon
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/async/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/async/README.md
new file mode 100755 (executable)
index 0000000..951f76e
--- /dev/null
@@ -0,0 +1,1425 @@
+# Async.js
+
+Async is a utility module which provides straight-forward, powerful functions
+for working with asynchronous JavaScript. Although originally designed for
+use with [node.js](http://nodejs.org), it can also be used directly in the
+browser. Also supports [component](https://github.com/component/component).
+
+Async provides around 20 functions that include the usual 'functional'
+suspects (map, reduce, filter, each…) as well as some common patterns
+for asynchronous control flow (parallel, series, waterfall…). All these
+functions assume you follow the node.js convention of providing a single
+callback as the last argument of your async function.
+
+
+## Quick Examples
+
+```javascript
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+    // results is now an array of stats for each file
+});
+
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+    // results now equals an array of the existing files
+});
+
+async.parallel([
+    function(){ ... },
+    function(){ ... }
+], callback);
+
+async.series([
+    function(){ ... },
+    function(){ ... }
+]);
+```
+
+There are many more functions available so take a look at the docs below for a
+full list. This module aims to be comprehensive, so if you feel anything is
+missing please create a GitHub issue for it.
+
+## Common Pitfalls
+
+### Binding a context to an iterator
+
+This section is really about bind, not about async. If you are wondering how to
+make async execute your iterators in a given context, or are confused as to why
+a method of another library isn't working as an iterator, study this example:
+
+```js
+// Here is a simple object with an (unnecessarily roundabout) squaring method
+var AsyncSquaringLibrary = {
+  squareExponent: 2,
+  square: function(number, callback){ 
+    var result = Math.pow(number, this.squareExponent);
+    setTimeout(function(){
+      callback(null, result);
+    }, 200);
+  }
+};
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
+  // result is [NaN, NaN, NaN]
+  // This fails because the `this.squareExponent` expression in the square
+  // function is not evaluated in the context of AsyncSquaringLibrary, and is
+  // therefore undefined.
+});
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
+  // result is [1, 4, 9]
+  // With the help of bind we can attach a context to the iterator before
+  // passing it to async. Now the square function will be executed in its 
+  // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
+  // will be as expected.
+});
+```
+
+## Download
+
+The source is available for download from
+[GitHub](http://github.com/caolan/async).
+Alternatively, you can install using Node Package Manager (npm):
+
+    npm install async
+
+__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
+
+## In the Browser
+
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
+
+```html
+<script type="text/javascript" src="async.js"></script>
+<script type="text/javascript">
+
+    async.map(data, asyncProcess, function(err, results){
+        alert(results);
+    });
+
+</script>
+```
+
+## Documentation
+
+### Collections
+
+* [each](#each)
+* [eachSeries](#eachSeries)
+* [eachLimit](#eachLimit)
+* [map](#map)
+* [mapSeries](#mapSeries)
+* [mapLimit](#mapLimit)
+* [filter](#filter)
+* [filterSeries](#filterSeries)
+* [reject](#reject)
+* [rejectSeries](#rejectSeries)
+* [reduce](#reduce)
+* [reduceRight](#reduceRight)
+* [detect](#detect)
+* [detectSeries](#detectSeries)
+* [sortBy](#sortBy)
+* [some](#some)
+* [every](#every)
+* [concat](#concat)
+* [concatSeries](#concatSeries)
+
+### Control Flow
+
+* [series](#series)
+* [parallel](#parallel)
+* [parallelLimit](#parallellimittasks-limit-callback)
+* [whilst](#whilst)
+* [doWhilst](#doWhilst)
+* [until](#until)
+* [doUntil](#doUntil)
+* [forever](#forever)
+* [waterfall](#waterfall)
+* [compose](#compose)
+* [applyEach](#applyEach)
+* [applyEachSeries](#applyEachSeries)
+* [queue](#queue)
+* [cargo](#cargo)
+* [auto](#auto)
+* [iterator](#iterator)
+* [apply](#apply)
+* [nextTick](#nextTick)
+* [times](#times)
+* [timesSeries](#timesSeries)
+
+### Utils
+
+* [memoize](#memoize)
+* [unmemoize](#unmemoize)
+* [log](#log)
+* [dir](#dir)
+* [noConflict](#noConflict)
+
+
+## Collections
+
+<a name="forEach" />
+<a name="each" />
+### each(arr, iterator, callback)
+
+Applies an iterator function to each item in an array, in parallel.
+The iterator is called with an item from the list and a callback for when it
+has finished. If the iterator passes an error to this callback, the main
+callback for the each function is immediately called with the error.
+
+Note, that since this function applies the iterator to each item in parallel
+there is no guarantee that the iterator functions will complete in order.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+  The iterator is passed a callback(err) which must be called once it has 
+  completed. If no error has occured, the callback should be run without 
+  arguments or with an explicit null argument.
+* callback(err) - A callback which is called after all the iterator functions
+  have finished, or an error has occurred.
+
+__Example__
+
+```js
+// assuming openFiles is an array of file names and saveFile is a function
+// to save the modified contents of that file:
+
+async.each(openFiles, saveFile, function(err){
+    // if any of the saves produced an error, err would equal that error
+});
+```
+
+---------------------------------------
+
+<a name="forEachSeries" />
+<a name="eachSeries" />
+### eachSeries(arr, iterator, callback)
+
+The same as each only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. This means the iterator functions will complete in order.
+
+
+---------------------------------------
+
+<a name="forEachLimit" />
+<a name="eachLimit" />
+### eachLimit(arr, limit, iterator, callback)
+
+The same as each only no more than "limit" iterators will be simultaneously 
+running at any time.
+
+Note that the items are not processed in batches, so there is no guarantee that
+ the first "limit" iterator functions will complete before any others are 
+started.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* limit - The maximum number of iterators to run at any time.
+* iterator(item, callback) - A function to apply to each item in the array.
+  The iterator is passed a callback(err) which must be called once it has 
+  completed. If no error has occured, the callback should be run without 
+  arguments or with an explicit null argument.
+* callback(err) - A callback which is called after all the iterator functions
+  have finished, or an error has occurred.
+
+__Example__
+
+```js
+// Assume documents is an array of JSON objects and requestApi is a
+// function that interacts with a rate-limited REST api.
+
+async.eachLimit(documents, 20, requestApi, function(err){
+    // if any of the saves produced an error, err would equal that error
+});
+```
+
+---------------------------------------
+
+<a name="map" />
+### map(arr, iterator, callback)
+
+Produces a new array of values by mapping each value in the given array through
+the iterator function. The iterator is called with an item from the array and a
+callback for when it has finished processing. The callback takes 2 arguments, 
+an error and the transformed item from the array. If the iterator passes an
+error to this callback, the main callback for the map function is immediately
+called with the error.
+
+Note, that since this function applies the iterator to each item in parallel
+there is no guarantee that the iterator functions will complete in order, however
+the results array will be in the same order as the original array.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+  The iterator is passed a callback(err, transformed) which must be called once 
+  it has completed with an error (which can be null) and a transformed item.
+* callback(err, results) - A callback which is called after all the iterator
+  functions have finished, or an error has occurred. Results is an array of the
+  transformed items from the original array.
+
+__Example__
+
+```js
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+    // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
+<a name="mapSeries" />
+### mapSeries(arr, iterator, callback)
+
+The same as map only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+
+---------------------------------------
+
+<a name="mapLimit" />
+### mapLimit(arr, limit, iterator, callback)
+
+The same as map only no more than "limit" iterators will be simultaneously 
+running at any time.
+
+Note that the items are not processed in batches, so there is no guarantee that
+ the first "limit" iterator functions will complete before any others are 
+started.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* limit - The maximum number of iterators to run at any time.
+* iterator(item, callback) - A function to apply to each item in the array.
+  The iterator is passed a callback(err, transformed) which must be called once 
+  it has completed with an error (which can be null) and a transformed item.
+* callback(err, results) - A callback which is called after all the iterator
+  functions have finished, or an error has occurred. Results is an array of the
+  transformed items from the original array.
+
+__Example__
+
+```js
+async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){
+    // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
+<a name="filter" />
+### filter(arr, iterator, callback)
+
+__Alias:__ select
+
+Returns a new array of all the values which pass an async truth test.
+_The callback for each iterator call only accepts a single argument of true or
+false, it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like fs.exists. This operation is
+performed in parallel, but the results array will be in the same order as the
+original.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+  The iterator is passed a callback(truthValue) which must be called with a 
+  boolean argument once it has completed.
+* callback(results) - A callback which is called after all the iterator
+  functions have finished.
+
+__Example__
+
+```js
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+    // results now equals an array of the existing files
+});
+```
+
+---------------------------------------
+
+<a name="filterSeries" />
+### filterSeries(arr, iterator, callback)
+
+__alias:__ selectSeries
+
+The same as filter only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+---------------------------------------
+
+<a name="reject" />
+### reject(arr, iterator, callback)
+
+The opposite of filter. Removes values that pass an async truth test.
+
+---------------------------------------
+
+<a name="rejectSeries" />
+### rejectSeries(arr, iterator, callback)
+
+The same as reject, only the iterator is applied to each item in the array
+in series.
+
+
+---------------------------------------
+
+<a name="reduce" />
+### reduce(arr, memo, iterator, callback)
+
+__aliases:__ inject, foldl
+
+Reduces a list of values into a single value using an async iterator to return
+each successive step. Memo is the initial state of the reduction. This
+function only operates in series. For performance reasons, it may make sense to
+split a call to this function into a parallel map, then use the normal
+Array.prototype.reduce on the results. This function is for situations where
+each step in the reduction needs to be async, if you can get the data before
+reducing it then it's probably a good idea to do so.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* memo - The initial state of the reduction.
+* iterator(memo, item, callback) - A function applied to each item in the
+  array to produce the next step in the reduction. The iterator is passed a
+  callback(err, reduction) which accepts an optional error as its first 
+  argument, and the state of the reduction as the second. If an error is 
+  passed to the callback, the reduction is stopped and the main callback is 
+  immediately called with the error.
+* callback(err, result) - A callback which is called after all the iterator
+  functions have finished. Result is the reduced value.
+
+__Example__
+
+```js
+async.reduce([1,2,3], 0, function(memo, item, callback){
+    // pointless async:
+    process.nextTick(function(){
+        callback(null, memo + item)
+    });
+}, function(err, result){
+    // result is now equal to the last value of memo, which is 6
+});
+```
+
+---------------------------------------
+
+<a name="reduceRight" />
+### reduceRight(arr, memo, iterator, callback)
+
+__Alias:__ foldr
+
+Same as reduce, only operates on the items in the array in reverse order.
+
+
+---------------------------------------
+
+<a name="detect" />
+### detect(arr, iterator, callback)
+
+Returns the first value in a list that passes an async truth test. The
+iterator is applied in parallel, meaning the first iterator to return true will
+fire the detect callback with that result. That means the result might not be
+the first item in the original array (in terms of order) that passes the test.
+
+If order within the original array is important then look at detectSeries.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+  The iterator is passed a callback(truthValue) which must be called with a 
+  boolean argument once it has completed.
+* callback(result) - A callback which is called as soon as any iterator returns
+  true, or after all the iterator functions have finished. Result will be
+  the first item in the array that passes the truth test (iterator) or the
+  value undefined if none passed.
+
+__Example__
+
+```js
+async.detect(['file1','file2','file3'], fs.exists, function(result){
+    // result now equals the first file in the list that exists
+});
+```
+
+---------------------------------------
+
+<a name="detectSeries" />
+### detectSeries(arr, iterator, callback)
+
+The same as detect, only the iterator is applied to each item in the array
+in series. This means the result is always the first in the original array (in
+terms of array order) that passes the truth test.
+
+
+---------------------------------------
+
+<a name="sortBy" />
+### sortBy(arr, iterator, callback)
+
+Sorts a list by the results of running each value through an async iterator.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A function to apply to each item in the array.
+  The iterator is passed a callback(err, sortValue) which must be called once it
+  has completed with an error (which can be null) and a value to use as the sort
+  criteria.
+* callback(err, results) - A callback which is called after all the iterator
+  functions have finished, or an error has occurred. Results is the items from
+  the original array sorted by the values returned by the iterator calls.
+
+__Example__
+
+```js
+async.sortBy(['file1','file2','file3'], function(file, callback){
+    fs.stat(file, function(err, stats){
+        callback(err, stats.mtime);
+    });
+}, function(err, results){
+    // results is now the original array of files sorted by
+    // modified date
+});
+```
+
+---------------------------------------
+
+<a name="some" />
+### some(arr, iterator, callback)
+
+__Alias:__ any
+
+Returns true if at least one element in the array satisfies an async test.
+_The callback for each iterator call only accepts a single argument of true or
+false, it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like fs.exists. Once any iterator
+call returns true, the main callback is immediately called.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+  The iterator is passed a callback(truthValue) which must be called with a 
+  boolean argument once it has completed.
+* callback(result) - A callback which is called as soon as any iterator returns
+  true, or after all the iterator functions have finished. Result will be
+  either true or false depending on the values of the async tests.
+
+__Example__
+
+```js
+async.some(['file1','file2','file3'], fs.exists, function(result){
+    // if result is true then at least one of the files exists
+});
+```
+
+---------------------------------------
+
+<a name="every" />
+### every(arr, iterator, callback)
+
+__Alias:__ all
+
+Returns true if every element in the array satisfies an async test.
+_The callback for each iterator call only accepts a single argument of true or
+false, it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like fs.exists.
+
+__Arguments__
+
+* arr - An array to iterate over.
+* iterator(item, callback) - A truth test to apply to each item in the array.
+  The iterator is passed a callback(truthValue) which must be called with a 
+  boolean argument once it has completed.
+* callback(result) - A callback which is called after all the iterator
+  functions have finished. Result will be either true or false depending on
+  the values of the async tests.
+
+__Example__
+
+```js
+async.every(['file1','file2','file3'], fs.exists, function(result){
+    // if result is true then every file exists
+});
+```
+
+---------------------------------------
+
+<a name="concat" />
+### concat(arr, iterator, callback)
+
+Applies an iterator to each item in a list, concatenating the results. Returns the
+concatenated list. The iterators are called in parallel, and the results are
+concatenated as they return. There is no guarantee that the results array will
+be returned in the original order of the arguments passed to the iterator function.
+
+__Arguments__
+
+* arr - An array to iterate over
+* iterator(item, callback) - A function to apply to each item in the array.
+  The iterator is passed a callback(err, results) which must be called once it 
+  has completed with an error (which can be null) and an array of results.
+* callback(err, results) - A callback which is called after all the iterator
+  functions have finished, or an error has occurred. Results is an array containing
+  the concatenated results of the iterator function.
+
+__Example__
+
+```js
+async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
+    // files is now a list of filenames that exist in the 3 directories
+});
+```
+
+---------------------------------------
+
+<a name="concatSeries" />
+### concatSeries(arr, iterator, callback)
+
+Same as async.concat, but executes in series instead of parallel.
+
+
+## Control Flow
+
+<a name="series" />
+### series(tasks, [callback])
+
+Run an array of functions in series, each one running once the previous
+function has completed. If any functions in the series pass an error to its
+callback, no more functions are run and the callback for the series is
+immediately called with the value of the error. Once the tasks have completed,
+the results are passed to the final callback as an array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final callback as an object
+instead of an array. This can be a more readable way of handling results from
+async.series.
+
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed
+  a callback(err, result) it must call on completion with an error (which can
+  be null) and an optional result value.
+* callback(err, results) - An optional callback to run once all the functions
+  have completed. This function gets a results array (or object) containing all 
+  the result arguments passed to the task callbacks.
+
+__Example__
+
+```js
+async.series([
+    function(callback){
+        // do some stuff ...
+        callback(null, 'one');
+    },
+    function(callback){
+        // do some more stuff ...
+        callback(null, 'two');
+    }
+],
+// optional callback
+function(err, results){
+    // results is now equal to ['one', 'two']
+});
+
+
+// an example using an object instead of an array
+async.series({
+    one: function(callback){
+        setTimeout(function(){
+            callback(null, 1);
+        }, 200);
+    },
+    two: function(callback){
+        setTimeout(function(){
+            callback(null, 2);
+        }, 100);
+    }
+},
+function(err, results) {
+    // results is now equal to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+<a name="parallel" />
+### parallel(tasks, [callback])
+
+Run an array of functions in parallel, without waiting until the previous
+function has completed. If any of the functions pass an error to its
+callback, the main callback is immediately called with the value of the error.
+Once the tasks have completed, the results are passed to the final callback as an
+array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final callback as an object
+instead of an array. This can be a more readable way of handling results from
+async.parallel.
+
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed 
+  a callback(err, result) it must call on completion with an error (which can
+  be null) and an optional result value.
+* callback(err, results) - An optional callback to run once all the functions
+  have completed. This function gets a results array (or object) containing all 
+  the result arguments passed to the task callbacks.
+
+__Example__
+
+```js
+async.parallel([
+    function(callback){
+        setTimeout(function(){
+            callback(null, 'one');
+        }, 200);
+    },
+    function(callback){
+        setTimeout(function(){
+            callback(null, 'two');
+        }, 100);
+    }
+],
+// optional callback
+function(err, results){
+    // the results array will equal ['one','two'] even though
+    // the second function had a shorter timeout.
+});
+
+
+// an example using an object instead of an array
+async.parallel({
+    one: function(callback){
+        setTimeout(function(){
+            callback(null, 1);
+        }, 200);
+    },
+    two: function(callback){
+        setTimeout(function(){
+            callback(null, 2);
+        }, 100);
+    }
+},
+function(err, results) {
+    // results is now equals to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+<a name="parallel" />
+### parallelLimit(tasks, limit, [callback])
+
+The same as parallel only the tasks are executed in parallel with a maximum of "limit" 
+tasks executing at any time.
+
+Note that the tasks are not executed in batches, so there is no guarantee that 
+the first "limit" tasks will complete before any others are started.
+
+__Arguments__
+
+* tasks - An array or object containing functions to run, each function is passed 
+  a callback(err, result) it must call on completion with an error (which can
+  be null) and an optional result value.
+* limit - The maximum number of tasks to run at any time.
+* callback(err, results) - An optional callback to run once all the functions
+  have completed. This function gets a results array (or object) containing all 
+  the result arguments passed to the task callbacks.
+
+---------------------------------------
+
+<a name="whilst" />
+### whilst(test, fn, callback)
+
+Repeatedly call fn, while test returns true. Calls the callback when stopped,
+or an error occurs.
+
+__Arguments__
+
+* test() - synchronous truth test to perform before each execution of fn.
+* fn(callback) - A function to call each time the test passes. The function is
+  passed a callback(err) which must be called once it has completed with an 
+  optional error argument.
+* callback(err) - A callback which is called after the test fails and repeated
+  execution of fn has stopped.
+
+__Example__
+
+```js
+var count = 0;
+
+async.whilst(
+    function () { return count < 5; },
+    function (callback) {
+        count++;
+        setTimeout(callback, 1000);
+    },
+    function (err) {
+        // 5 seconds have passed
+    }
+);
+```
+
+---------------------------------------
+
+<a name="doWhilst" />
+### doWhilst(fn, test, callback)
+
+The post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+
+---------------------------------------
+
+<a name="until" />
+### until(test, fn, callback)
+
+Repeatedly call fn, until test returns true. Calls the callback when stopped,
+or an error occurs.
+
+The inverse of async.whilst.
+
+---------------------------------------
+
+<a name="doUntil" />
+### doUntil(fn, test, callback)
+
+Like doWhilst except the test is inverted. Note the argument ordering differs from `until`.
+
+---------------------------------------
+
+<a name="forever" />
+### forever(fn, callback)
+
+Calls the asynchronous function 'fn' repeatedly, in series, indefinitely.
+If an error is passed to fn's callback then 'callback' is called with the
+error, otherwise it will never be called.
+
+---------------------------------------
+
+<a name="waterfall" />
+### waterfall(tasks, [callback])
+
+Runs an array of functions in series, each passing their results to the next in
+the array. However, if any of the functions pass an error to the callback, the
+next function is not executed and the main callback is immediately called with
+the error.
+
+__Arguments__
+
+* tasks - An array of functions to run, each function is passed a 
+  callback(err, result1, result2, ...) it must call on completion. The first
+  argument is an error (which can be null) and any further arguments will be 
+  passed as arguments in order to the next task.
+* callback(err, [results]) - An optional callback to run once all the functions
+  have completed. This will be passed the results of the last task's callback.
+
+
+
+__Example__
+
+```js
+async.waterfall([
+    function(callback){
+        callback(null, 'one', 'two');
+    },
+    function(arg1, arg2, callback){
+        callback(null, 'three');
+    },
+    function(arg1, callback){
+        // arg1 now equals 'three'
+        callback(null, 'done');
+    }
+], function (err, result) {
+   // result now equals 'done'    
+});
+```
+
+---------------------------------------
+<a name="compose" />
+### compose(fn1, fn2...)
+
+Creates a function which is a composition of the passed asynchronous
+functions. Each function consumes the return value of the function that
+follows. Composing functions f(), g() and h() would produce the result of
+f(g(h())), only this version uses callbacks to obtain the return values.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* functions... - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+function add1(n, callback) {
+    setTimeout(function () {
+        callback(null, n + 1);
+    }, 10);
+}
+
+function mul3(n, callback) {
+    setTimeout(function () {
+        callback(null, n * 3);
+    }, 10);
+}
+
+var add1mul3 = async.compose(mul3, add1);
+
+add1mul3(4, function (err, result) {
+   // result now equals 15
+});
+```
+
+---------------------------------------
+<a name="applyEach" />
+### applyEach(fns, args..., callback)
+
+Applies the provided arguments to each function in the array, calling the
+callback after all functions have completed. If you only provide the first
+argument then it will return a function which lets you pass in the
+arguments as if it were a single function call.
+
+__Arguments__
+
+* fns - the asynchronous functions to all call with the same arguments
+* args... - any number of separate arguments to pass to the function
+* callback - the final argument should be the callback, called when all
+  functions have completed processing
+
+
+__Example__
+
+```js
+async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+
+// partial application example:
+async.each(
+    buckets,
+    async.applyEach([enableSearch, updateSchema]),
+    callback
+);
+```
+
+---------------------------------------
+
+<a name="applyEachSeries" />
+### applyEachSeries(arr, iterator, callback)
+
+The same as applyEach only the functions are applied in series.
+
+---------------------------------------
+
+<a name="queue" />
+### queue(worker, concurrency)
+
+Creates a queue object with the specified concurrency. Tasks added to the
+queue will be processed in parallel (up to the concurrency limit). If all
+workers are in progress, the task is queued until one is available. Once
+a worker has completed a task, the task's callback is called.
+
+__Arguments__
+
+* worker(task, callback) - An asynchronous function for processing a queued
+  task, which must call its callback(err) argument when finished, with an 
+  optional error as an argument.
+* concurrency - An integer for determining how many worker functions should be
+  run in parallel.
+
+__Queue objects__
+
+The queue object returned by this function has the following properties and
+methods:
+
+* length() - a function returning the number of items waiting to be processed.
+* concurrency - an integer for determining how many worker functions should be
+  run in parallel. This property can be changed after a queue is created to
+  alter the concurrency on-the-fly.
+* push(task, [callback]) - add a new task to the queue, the callback is called
+  once the worker has finished processing the task.
+  instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
+* unshift(task, [callback]) - add a new task to the front of the queue.
+* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
+* empty - a callback that is called when the last item from the queue is given to a worker
+* drain - a callback that is called when the last item from the queue has returned from the worker
+
+__Example__
+
+```js
+// create a queue object with concurrency 2
+
+var q = async.queue(function (task, callback) {
+    console.log('hello ' + task.name);
+    callback();
+}, 2);
+
+
+// assign a callback
+q.drain = function() {
+    console.log('all items have been processed');
+}
+
+// add some items to the queue
+
+q.push({name: 'foo'}, function (err) {
+    console.log('finished processing foo');
+});
+q.push({name: 'bar'}, function (err) {
+    console.log('finished processing bar');
+});
+
+// add some items to the queue (batch-wise)
+
+q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
+    console.log('finished processing bar');
+});
+
+// add some items to the front of the queue
+
+q.unshift({name: 'bar'}, function (err) {
+    console.log('finished processing bar');
+});
+```
+
+---------------------------------------
+
+<a name="cargo" />
+### cargo(worker, [payload])
+
+Creates a cargo object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the payload limit). If the
+worker is in progress, the task is queued until it is available. Once
+the worker has completed some tasks, each callback of those tasks is called.
+
+__Arguments__
+
+* worker(tasks, callback) - An asynchronous function for processing an array of
+  queued tasks, which must call its callback(err) argument when finished, with 
+  an optional error as an argument.
+* payload - An optional integer for determining how many tasks should be
+  processed per round; if omitted, the default is unlimited.
+
+__Cargo objects__
+
+The cargo object returned by this function has the following properties and
+methods:
+
+* length() - a function returning the number of items waiting to be processed.
+* payload - an integer for determining how many tasks should be
+  process per round. This property can be changed after a cargo is created to
+  alter the payload on-the-fly.
+* push(task, [callback]) - add a new task to the queue, the callback is called
+  once the worker has finished processing the task.
+  instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
+* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
+* empty - a callback that is called when the last item from the queue is given to a worker
+* drain - a callback that is called when the last item from the queue has returned from the worker
+
+__Example__
+
+```js
+// create a cargo object with payload 2
+
+var cargo = async.cargo(function (tasks, callback) {
+    for(var i=0; i<tasks.length; i++){
+      console.log('hello ' + tasks[i].name);
+    }
+    callback();
+}, 2);
+
+
+// add some items
+
+cargo.push({name: 'foo'}, function (err) {
+    console.log('finished processing foo');
+});
+cargo.push({name: 'bar'}, function (err) {
+    console.log('finished processing bar');
+});
+cargo.push({name: 'baz'}, function (err) {
+    console.log('finished processing baz');
+});
+```
+
+---------------------------------------
+
+<a name="auto" />
+### auto(tasks, [callback])
+
+Determines the best order for running functions based on their requirements.
+Each function can optionally depend on other functions being completed first,
+and each function is run as soon as its requirements are satisfied. If any of
+the functions pass an error to their callback, that function will not complete
+(so any other functions depending on it will not run) and the main callback
+will be called immediately with the error. Functions also receive an object
+containing the results of functions which have completed so far.
+
+Note, all functions are called with a results object as a second argument, 
+so it is unsafe to pass functions in the tasks object which cannot handle the
+extra argument. For example, this snippet of code:
+
+```js
+async.auto({
+  readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
+}, callback);
+```
+
+will have the effect of calling readFile with the results object as the last
+argument, which will fail:
+
+```js
+fs.readFile('data.txt', 'utf-8', cb, {});
+```
+
+Instead, wrap the call to readFile in a function which does not forward the 
+results object:
+
+```js
+async.auto({
+  readData: function(cb, results){
+    fs.readFile('data.txt', 'utf-8', cb);
+  }
+}, callback);
+```
+
+__Arguments__
+
+* tasks - An object literal containing named functions or an array of
+  requirements, with the function itself the last item in the array. The key
+  used for each function or array is used when specifying requirements. The 
+  function receives two arguments: (1) a callback(err, result) which must be 
+  called when finished, passing an error (which can be null) and the result of 
+  the function's execution, and (2) a results object, containing the results of
+  the previously executed functions.
+* callback(err, results) - An optional callback which is called when all the
+  tasks have been completed. The callback will receive an error as an argument
+  if any tasks pass an error to their callback. Results will always be passed
+       but if an error occurred, no other tasks will be performed, and the results
+       object will only contain partial results.
+  
+
+__Example__
+
+```js
+async.auto({
+    get_data: function(callback){
+        // async code to get some data
+    },
+    make_folder: function(callback){
+        // async code to create a directory to store a file in
+        // this is run at the same time as getting the data
+    },
+    write_file: ['get_data', 'make_folder', function(callback){
+        // once there is some data and the directory exists,
+        // write the data to a file in the directory
+        callback(null, filename);
+    }],
+    email_link: ['write_file', function(callback, results){
+        // once the file is written let's email a link to it...
+        // results.write_file contains the filename returned by write_file.
+    }]
+});
+```
+
+This is a fairly trivial example, but to do this using the basic parallel and
+series functions would look like this:
+
+```js
+async.parallel([
+    function(callback){
+        // async code to get some data
+    },
+    function(callback){
+        // async code to create a directory to store a file in
+        // this is run at the same time as getting the data
+    }
+],
+function(err, results){
+    async.series([
+        function(callback){
+            // once there is some data and the directory exists,
+            // write the data to a file in the directory
+        },
+        function(callback){
+            // once the file is written let's email a link to it...
+        }
+    ]);
+});
+```
+
+For a complicated series of async tasks using the auto function makes adding
+new tasks much easier and makes the code more readable.
+
+
+---------------------------------------
+
+<a name="iterator" />
+### iterator(tasks)
+
+Creates an iterator function which calls the next function in the array,
+returning a continuation to call the next one after that. It's also possible to
+'peek' the next iterator by doing iterator.next().
+
+This function is used internally by the async module but can be useful when
+you want to manually control the flow of functions in series.
+
+__Arguments__
+
+* tasks - An array of functions to run.
+
+__Example__
+
+```js
+var iterator = async.iterator([
+    function(){ sys.p('one'); },
+    function(){ sys.p('two'); },
+    function(){ sys.p('three'); }
+]);
+
+node> var iterator2 = iterator();
+'one'
+node> var iterator3 = iterator2();
+'two'
+node> iterator3();
+'three'
+node> var nextfn = iterator2.next();
+node> nextfn();
+'three'
+```
+
+---------------------------------------
+
+<a name="apply" />
+### apply(function, arguments..)
+
+Creates a continuation function with some arguments already applied, a useful
+shorthand when combined with other control flow functions. Any arguments
+passed to the returned function are added to the arguments originally passed
+to apply.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to automatically apply when the
+  continuation is called.
+
+__Example__
+
+```js
+// using apply
+
+async.parallel([
+    async.apply(fs.writeFile, 'testfile1', 'test1'),
+    async.apply(fs.writeFile, 'testfile2', 'test2'),
+]);
+
+
+// the same process without using apply
+
+async.parallel([
+    function(callback){
+        fs.writeFile('testfile1', 'test1', callback);
+    },
+    function(callback){
+        fs.writeFile('testfile2', 'test2', callback);
+    }
+]);
+```
+
+It's possible to pass any number of additional arguments when calling the
+continuation:
+
+```js
+node> var fn = async.apply(sys.puts, 'one');
+node> fn('two', 'three');
+one
+two
+three
+```
+
+---------------------------------------
+
+<a name="nextTick" />
+### nextTick(callback)
+
+Calls the callback on a later loop around the event loop. In node.js this just
+calls process.nextTick, in the browser it falls back to setImmediate(callback)
+if available, otherwise setTimeout(callback, 0), which means other higher priority
+events may precede the execution of the callback.
+
+This is used internally for browser-compatibility purposes.
+
+__Arguments__
+
+* callback - The function to call on a later loop around the event loop.
+
+__Example__
+
+```js
+var call_order = [];
+async.nextTick(function(){
+    call_order.push('two');
+    // call_order now equals ['one','two']
+});
+call_order.push('one')
+```
+
+<a name="times" />
+### times(n, callback)
+
+Calls the callback n times and accumulates results in the same manner
+you would use with async.map.
+
+__Arguments__
+
+* n - The number of times to run the function.
+* callback - The function to call n times.
+
+__Example__
+
+```js
+// Pretend this is some complicated async factory
+var createUser = function(id, callback) {
+  callback(null, {
+    id: 'user' + id
+  })
+}
+// generate 5 users
+async.times(5, function(n, next){
+    createUser(n, function(err, user) {
+      next(err, user)
+    })
+}, function(err, users) {
+  // we should now have 5 users
+});
+```
+
+<a name="timesSeries" />
+### timesSeries(n, callback)
+
+The same as times only the iterator is applied to each item in the array in
+series. The next iterator is only called once the current one has completed
+processing. The results array will be in the same order as the original.
+
+
+## Utils
+
+<a name="memoize" />
+### memoize(fn, [hasher])
+
+Caches the results of an async function. When creating a hash to store function
+results against, the callback is omitted from the hash and an optional hash
+function can be used.
+
+The cache of results is exposed as the `memo` property of the function returned
+by `memoize`.
+
+__Arguments__
+
+* fn - the function you to proxy and cache results from.
+* hasher - an optional function for generating a custom hash for storing
+  results, it has all the arguments applied to it apart from the callback, and
+  must be synchronous.
+
+__Example__
+
+```js
+var slow_fn = function (name, callback) {
+    // do something
+    callback(null, result);
+};
+var fn = async.memoize(slow_fn);
+
+// fn can now be used as if it were slow_fn
+fn('some name', function () {
+    // callback
+});
+```
+
+<a name="unmemoize" />
+### unmemoize(fn)
+
+Undoes a memoized function, reverting it to the original, unmemoized
+form. Comes handy in tests.
+
+__Arguments__
+
+* fn - the memoized function
+
+<a name="log" />
+### log(function, arguments)
+
+Logs the result of an async function to the console. Only works in node.js or
+in browsers that support console.log and console.error (such as FF and Chrome).
+If multiple arguments are returned from the async function, console.log is
+called on each argument in order.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+    setTimeout(function(){
+        callback(null, 'hello ' + name);
+    }, 1000);
+};
+```
+```js
+node> async.log(hello, 'world');
+'hello world'
+```
+
+---------------------------------------
+
+<a name="dir" />
+### dir(function, arguments)
+
+Logs the result of an async function to the console using console.dir to
+display the properties of the resulting object. Only works in node.js or
+in browsers that support console.dir and console.error (such as FF and Chrome).
+If multiple arguments are returned from the async function, console.dir is
+called on each argument in order.
+
+__Arguments__
+
+* function - The function you want to eventually apply all arguments to.
+* arguments... - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+    setTimeout(function(){
+        callback(null, {hello: name});
+    }, 1000);
+};
+```
+```js
+node> async.dir(hello, 'world');
+{hello: 'world'}
+```
+
+---------------------------------------
+
+<a name="noConflict" />
+### noConflict()
+
+Changes the value of async back to its original value, returning a reference to the
+async object.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/async/component.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/async/component.json
new file mode 100755 (executable)
index 0000000..bbb0115
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "name": "async",
+  "repo": "caolan/async",
+  "description": "Higher-order functions and common patterns for asynchronous code",
+  "version": "0.1.23",
+  "keywords": [],
+  "dependencies": {},
+  "development": {},
+  "main": "lib/async.js",
+  "scripts": [ "lib/async.js" ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/async/lib/async.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/async/lib/async.js
new file mode 100755 (executable)
index 0000000..1eebb15
--- /dev/null
@@ -0,0 +1,958 @@
+/*global setImmediate: false, setTimeout: false, console: false */
+(function () {
+
+    var async = {};
+
+    // global on the server, window in the browser
+    var root, previous_async;
+
+    root = this;
+    if (root != null) {
+      previous_async = root.async;
+    }
+
+    async.noConflict = function () {
+        root.async = previous_async;
+        return async;
+    };
+
+    function only_once(fn) {
+        var called = false;
+        return function() {
+            if (called) throw new Error("Callback was already called.");
+            called = true;
+            fn.apply(root, arguments);
+        }
+    }
+
+    //// cross-browser compatiblity functions ////
+
+    var _each = function (arr, iterator) {
+        if (arr.forEach) {
+            return arr.forEach(iterator);
+        }
+        for (var i = 0; i < arr.length; i += 1) {
+            iterator(arr[i], i, arr);
+        }
+    };
+
+    var _map = function (arr, iterator) {
+        if (arr.map) {
+            return arr.map(iterator);
+        }
+        var results = [];
+        _each(arr, function (x, i, a) {
+            results.push(iterator(x, i, a));
+        });
+        return results;
+    };
+
+    var _reduce = function (arr, iterator, memo) {
+        if (arr.reduce) {
+            return arr.reduce(iterator, memo);
+        }
+        _each(arr, function (x, i, a) {
+            memo = iterator(memo, x, i, a);
+        });
+        return memo;
+    };
+
+    var _keys = function (obj) {
+        if (Object.keys) {
+            return Object.keys(obj);
+        }
+        var keys = [];
+        for (var k in obj) {
+            if (obj.hasOwnProperty(k)) {
+                keys.push(k);
+            }
+        }
+        return keys;
+    };
+
+    //// exported async module functions ////
+
+    //// nextTick implementation with browser-compatible fallback ////
+    if (typeof process === 'undefined' || !(process.nextTick)) {
+        if (typeof setImmediate === 'function') {
+            async.nextTick = function (fn) {
+                // not a direct alias for IE10 compatibility
+                setImmediate(fn);
+            };
+            async.setImmediate = async.nextTick;
+        }
+        else {
+            async.nextTick = function (fn) {
+                setTimeout(fn, 0);
+            };
+            async.setImmediate = async.nextTick;
+        }
+    }
+    else {
+        async.nextTick = process.nextTick;
+        if (typeof setImmediate !== 'undefined') {
+            async.setImmediate = function (fn) {
+              // not a direct alias for IE10 compatibility
+              setImmediate(fn);
+            };
+        }
+        else {
+            async.setImmediate = async.nextTick;
+        }
+    }
+
+    async.each = function (arr, iterator, callback) {
+        callback = callback || function () {};
+        if (!arr.length) {
+            return callback();
+        }
+        var completed = 0;
+        _each(arr, function (x) {
+            iterator(x, only_once(function (err) {
+                if (err) {
+                    callback(err);
+                    callback = function () {};
+                }
+                else {
+                    completed += 1;
+                    if (completed >= arr.length) {
+                        callback(null);
+                    }
+                }
+            }));
+        });
+    };
+    async.forEach = async.each;
+
+    async.eachSeries = function (arr, iterator, callback) {
+        callback = callback || function () {};
+        if (!arr.length) {
+            return callback();
+        }
+        var completed = 0;
+        var iterate = function () {
+            iterator(arr[completed], function (err) {
+                if (err) {
+                    callback(err);
+                    callback = function () {};
+                }
+                else {
+                    completed += 1;
+                    if (completed >= arr.length) {
+                        callback(null);
+                    }
+                    else {
+                        iterate();
+                    }
+                }
+            });
+        };
+        iterate();
+    };
+    async.forEachSeries = async.eachSeries;
+
+    async.eachLimit = function (arr, limit, iterator, callback) {
+        var fn = _eachLimit(limit);
+        fn.apply(null, [arr, iterator, callback]);
+    };
+    async.forEachLimit = async.eachLimit;
+
+    var _eachLimit = function (limit) {
+
+        return function (arr, iterator, callback) {
+            callback = callback || function () {};
+            if (!arr.length || limit <= 0) {
+                return callback();
+            }
+            var completed = 0;
+            var started = 0;
+            var running = 0;
+
+            (function replenish () {
+                if (completed >= arr.length) {
+                    return callback();
+                }
+
+                while (running < limit && started < arr.length) {
+                    started += 1;
+                    running += 1;
+                    iterator(arr[started - 1], function (err) {
+                        if (err) {
+                            callback(err);
+                            callback = function () {};
+                        }
+                        else {
+                            completed += 1;
+                            running -= 1;
+                            if (completed >= arr.length) {
+                                callback();
+                            }
+                            else {
+                                replenish();
+                            }
+                        }
+                    });
+                }
+            })();
+        };
+    };
+
+
+    var doParallel = function (fn) {
+        return function () {
+            var args = Array.prototype.slice.call(arguments);
+            return fn.apply(null, [async.each].concat(args));
+        };
+    };
+    var doParallelLimit = function(limit, fn) {
+        return function () {
+            var args = Array.prototype.slice.call(arguments);
+            return fn.apply(null, [_eachLimit(limit)].concat(args));
+        };
+    };
+    var doSeries = function (fn) {
+        return function () {
+            var args = Array.prototype.slice.call(arguments);
+            return fn.apply(null, [async.eachSeries].concat(args));
+        };
+    };
+
+
+    var _asyncMap = function (eachfn, arr, iterator, callback) {
+        var results = [];
+        arr = _map(arr, function (x, i) {
+            return {index: i, value: x};
+        });
+        eachfn(arr, function (x, callback) {
+            iterator(x.value, function (err, v) {
+                results[x.index] = v;
+                callback(err);
+            });
+        }, function (err) {
+            callback(err, results);
+        });
+    };
+    async.map = doParallel(_asyncMap);
+    async.mapSeries = doSeries(_asyncMap);
+    async.mapLimit = function (arr, limit, iterator, callback) {
+        return _mapLimit(limit)(arr, iterator, callback);
+    };
+
+    var _mapLimit = function(limit) {
+        return doParallelLimit(limit, _asyncMap);
+    };
+
+    // reduce only has a series version, as doing reduce in parallel won't
+    // work in many situations.
+    async.reduce = function (arr, memo, iterator, callback) {
+        async.eachSeries(arr, function (x, callback) {
+            iterator(memo, x, function (err, v) {
+                memo = v;
+                callback(err);
+            });
+        }, function (err) {
+            callback(err, memo);
+        });
+    };
+    // inject alias
+    async.inject = async.reduce;
+    // foldl alias
+    async.foldl = async.reduce;
+
+    async.reduceRight = function (arr, memo, iterator, callback) {
+        var reversed = _map(arr, function (x) {
+            return x;
+        }).reverse();
+        async.reduce(reversed, memo, iterator, callback);
+    };
+    // foldr alias
+    async.foldr = async.reduceRight;
+
+    var _filter = function (eachfn, arr, iterator, callback) {
+        var results = [];
+        arr = _map(arr, function (x, i) {
+            return {index: i, value: x};
+        });
+        eachfn(arr, function (x, callback) {
+            iterator(x.value, function (v) {
+                if (v) {
+                    results.push(x);
+                }
+                callback();
+            });
+        }, function (err) {
+            callback(_map(results.sort(function (a, b) {
+                return a.index - b.index;
+            }), function (x) {
+                return x.value;
+            }));
+        });
+    };
+    async.filter = doParallel(_filter);
+    async.filterSeries = doSeries(_filter);
+    // select alias
+    async.select = async.filter;
+    async.selectSeries = async.filterSeries;
+
+    var _reject = function (eachfn, arr, iterator, callback) {
+        var results = [];
+        arr = _map(arr, function (x, i) {
+            return {index: i, value: x};
+        });
+        eachfn(arr, function (x, callback) {
+            iterator(x.value, function (v) {
+                if (!v) {
+                    results.push(x);
+                }
+                callback();
+            });
+        }, function (err) {
+            callback(_map(results.sort(function (a, b) {
+                return a.index - b.index;
+            }), function (x) {
+                return x.value;
+            }));
+        });
+    };
+    async.reject = doParallel(_reject);
+    async.rejectSeries = doSeries(_reject);
+
+    var _detect = function (eachfn, arr, iterator, main_callback) {
+        eachfn(arr, function (x, callback) {
+            iterator(x, function (result) {
+                if (result) {
+                    main_callback(x);
+                    main_callback = function () {};
+                }
+                else {
+                    callback();
+                }
+            });
+        }, function (err) {
+            main_callback();
+        });
+    };
+    async.detect = doParallel(_detect);
+    async.detectSeries = doSeries(_detect);
+
+    async.some = function (arr, iterator, main_callback) {
+        async.each(arr, function (x, callback) {
+            iterator(x, function (v) {
+                if (v) {
+                    main_callback(true);
+                    main_callback = function () {};
+                }
+                callback();
+            });
+        }, function (err) {
+            main_callback(false);
+        });
+    };
+    // any alias
+    async.any = async.some;
+
+    async.every = function (arr, iterator, main_callback) {
+        async.each(arr, function (x, callback) {
+            iterator(x, function (v) {
+                if (!v) {
+                    main_callback(false);
+                    main_callback = function () {};
+                }
+                callback();
+            });
+        }, function (err) {
+            main_callback(true);
+        });
+    };
+    // all alias
+    async.all = async.every;
+
+    async.sortBy = function (arr, iterator, callback) {
+        async.map(arr, function (x, callback) {
+            iterator(x, function (err, criteria) {
+                if (err) {
+                    callback(err);
+                }
+                else {
+                    callback(null, {value: x, criteria: criteria});
+                }
+            });
+        }, function (err, results) {
+            if (err) {
+                return callback(err);
+            }
+            else {
+                var fn = function (left, right) {
+                    var a = left.criteria, b = right.criteria;
+                    return a < b ? -1 : a > b ? 1 : 0;
+                };
+                callback(null, _map(results.sort(fn), function (x) {
+                    return x.value;
+                }));
+            }
+        });
+    };
+
+    async.auto = function (tasks, callback) {
+        callback = callback || function () {};
+        var keys = _keys(tasks);
+        if (!keys.length) {
+            return callback(null);
+        }
+
+        var results = {};
+
+        var listeners = [];
+        var addListener = function (fn) {
+            listeners.unshift(fn);
+        };
+        var removeListener = function (fn) {
+            for (var i = 0; i < listeners.length; i += 1) {
+                if (listeners[i] === fn) {
+                    listeners.splice(i, 1);
+                    return;
+                }
+            }
+        };
+        var taskComplete = function () {
+            _each(listeners.slice(0), function (fn) {
+                fn();
+            });
+        };
+
+        addListener(function () {
+            if (_keys(results).length === keys.length) {
+                callback(null, results);
+                callback = function () {};
+            }
+        });
+
+        _each(keys, function (k) {
+            var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
+            var taskCallback = function (err) {
+                var args = Array.prototype.slice.call(arguments, 1);
+                if (args.length <= 1) {
+                    args = args[0];
+                }
+                if (err) {
+                    var safeResults = {};
+                    _each(_keys(results), function(rkey) {
+                        safeResults[rkey] = results[rkey];
+                    });
+                    safeResults[k] = args;
+                    callback(err, safeResults);
+                    // stop subsequent errors hitting callback multiple times
+                    callback = function () {};
+                }
+                else {
+                    results[k] = args;
+                    async.setImmediate(taskComplete);
+                }
+            };
+            var requires = task.slice(0, Math.abs(task.length - 1)) || [];
+            var ready = function () {
+                return _reduce(requires, function (a, x) {
+                    return (a && results.hasOwnProperty(x));
+                }, true) && !results.hasOwnProperty(k);
+            };
+            if (ready()) {
+                task[task.length - 1](taskCallback, results);
+            }
+            else {
+                var listener = function () {
+                    if (ready()) {
+                        removeListener(listener);
+                        task[task.length - 1](taskCallback, results);
+                    }
+                };
+                addListener(listener);
+            }
+        });
+    };
+
+    async.waterfall = function (tasks, callback) {
+        callback = callback || function () {};
+        if (tasks.constructor !== Array) {
+          var err = new Error('First argument to waterfall must be an array of functions');
+          return callback(err);
+        }
+        if (!tasks.length) {
+            return callback();
+        }
+        var wrapIterator = function (iterator) {
+            return function (err) {
+                if (err) {
+                    callback.apply(null, arguments);
+                    callback = function () {};
+                }
+                else {
+                    var args = Array.prototype.slice.call(arguments, 1);
+                    var next = iterator.next();
+                    if (next) {
+                        args.push(wrapIterator(next));
+                    }
+                    else {
+                        args.push(callback);
+                    }
+                    async.setImmediate(function () {
+                        iterator.apply(null, args);
+                    });
+                }
+            };
+        };
+        wrapIterator(async.iterator(tasks))();
+    };
+
+    var _parallel = function(eachfn, tasks, callback) {
+        callback = callback || function () {};
+        if (tasks.constructor === Array) {
+            eachfn.map(tasks, function (fn, callback) {
+                if (fn) {
+                    fn(function (err) {
+                        var args = Array.prototype.slice.call(arguments, 1);
+                        if (args.length <= 1) {
+                            args = args[0];
+                        }
+                        callback.call(null, err, args);
+                    });
+                }
+            }, callback);
+        }
+        else {
+            var results = {};
+            eachfn.each(_keys(tasks), function (k, callback) {
+                tasks[k](function (err) {
+                    var args = Array.prototype.slice.call(arguments, 1);
+                    if (args.length <= 1) {
+                        args = args[0];
+                    }
+                    results[k] = args;
+                    callback(err);
+                });
+            }, function (err) {
+                callback(err, results);
+            });
+        }
+    };
+
+    async.parallel = function (tasks, callback) {
+        _parallel({ map: async.map, each: async.each }, tasks, callback);
+    };
+
+    async.parallelLimit = function(tasks, limit, callback) {
+        _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
+    };
+
+    async.series = function (tasks, callback) {
+        callback = callback || function () {};
+        if (tasks.constructor === Array) {
+            async.mapSeries(tasks, function (fn, callback) {
+                if (fn) {
+                    fn(function (err) {
+                        var args = Array.prototype.slice.call(arguments, 1);
+                        if (args.length <= 1) {
+                            args = args[0];
+                        }
+                        callback.call(null, err, args);
+                    });
+                }
+            }, callback);
+        }
+        else {
+            var results = {};
+            async.eachSeries(_keys(tasks), function (k, callback) {
+                tasks[k](function (err) {
+                    var args = Array.prototype.slice.call(arguments, 1);
+                    if (args.length <= 1) {
+                        args = args[0];
+                    }
+                    results[k] = args;
+                    callback(err);
+                });
+            }, function (err) {
+                callback(err, results);
+            });
+        }
+    };
+
+    async.iterator = function (tasks) {
+        var makeCallback = function (index) {
+            var fn = function () {
+                if (tasks.length) {
+                    tasks[index].apply(null, arguments);
+                }
+                return fn.next();
+            };
+            fn.next = function () {
+                return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+            };
+            return fn;
+        };
+        return makeCallback(0);
+    };
+
+    async.apply = function (fn) {
+        var args = Array.prototype.slice.call(arguments, 1);
+        return function () {
+            return fn.apply(
+                null, args.concat(Array.prototype.slice.call(arguments))
+            );
+        };
+    };
+
+    var _concat = function (eachfn, arr, fn, callback) {
+        var r = [];
+        eachfn(arr, function (x, cb) {
+            fn(x, function (err, y) {
+                r = r.concat(y || []);
+                cb(err);
+            });
+        }, function (err) {
+            callback(err, r);
+        });
+    };
+    async.concat = doParallel(_concat);
+    async.concatSeries = doSeries(_concat);
+
+    async.whilst = function (test, iterator, callback) {
+        if (test()) {
+            iterator(function (err) {
+                if (err) {
+                    return callback(err);
+                }
+                async.whilst(test, iterator, callback);
+            });
+        }
+        else {
+            callback();
+        }
+    };
+
+    async.doWhilst = function (iterator, test, callback) {
+        iterator(function (err) {
+            if (err) {
+                return callback(err);
+            }
+            if (test()) {
+                async.doWhilst(iterator, test, callback);
+            }
+            else {
+                callback();
+            }
+        });
+    };
+
+    async.until = function (test, iterator, callback) {
+        if (!test()) {
+            iterator(function (err) {
+                if (err) {
+                    return callback(err);
+                }
+                async.until(test, iterator, callback);
+            });
+        }
+        else {
+            callback();
+        }
+    };
+
+    async.doUntil = function (iterator, test, callback) {
+        iterator(function (err) {
+            if (err) {
+                return callback(err);
+            }
+            if (!test()) {
+                async.doUntil(iterator, test, callback);
+            }
+            else {
+                callback();
+            }
+        });
+    };
+
+    async.queue = function (worker, concurrency) {
+        if (concurrency === undefined) {
+            concurrency = 1;
+        }
+        function _insert(q, data, pos, callback) {
+          if(data.constructor !== Array) {
+              data = [data];
+          }
+          _each(data, function(task) {
+              var item = {
+                  data: task,
+                  callback: typeof callback === 'function' ? callback : null
+              };
+
+              if (pos) {
+                q.tasks.unshift(item);
+              } else {
+                q.tasks.push(item);
+              }
+
+              if (q.saturated && q.tasks.length === concurrency) {
+                  q.saturated();
+              }
+              async.setImmediate(q.process);
+          });
+        }
+
+        var workers = 0;
+        var q = {
+            tasks: [],
+            concurrency: concurrency,
+            saturated: null,
+            empty: null,
+            drain: null,
+            push: function (data, callback) {
+              _insert(q, data, false, callback);
+            },
+            unshift: function (data, callback) {
+              _insert(q, data, true, callback);
+            },
+            process: function () {
+                if (workers < q.concurrency && q.tasks.length) {
+                    var task = q.tasks.shift();
+                    if (q.empty && q.tasks.length === 0) {
+                        q.empty();
+                    }
+                    workers += 1;
+                    var next = function () {
+                        workers -= 1;
+                        if (task.callback) {
+                            task.callback.apply(task, arguments);
+                        }
+                        if (q.drain && q.tasks.length + workers === 0) {
+                            q.drain();
+                        }
+                        q.process();
+                    };
+                    var cb = only_once(next);
+                    worker(task.data, cb);
+                }
+            },
+            length: function () {
+                return q.tasks.length;
+            },
+            running: function () {
+                return workers;
+            }
+        };
+        return q;
+    };
+
+    async.cargo = function (worker, payload) {
+        var working     = false,
+            tasks       = [];
+
+        var cargo = {
+            tasks: tasks,
+            payload: payload,
+            saturated: null,
+            empty: null,
+            drain: null,
+            push: function (data, callback) {
+                if(data.constructor !== Array) {
+                    data = [data];
+                }
+                _each(data, function(task) {
+                    tasks.push({
+                        data: task,
+                        callback: typeof callback === 'function' ? callback : null
+                    });
+                    if (cargo.saturated && tasks.length === payload) {
+                        cargo.saturated();
+                    }
+                });
+                async.setImmediate(cargo.process);
+            },
+            process: function process() {
+                if (working) return;
+                if (tasks.length === 0) {
+                    if(cargo.drain) cargo.drain();
+                    return;
+                }
+
+                var ts = typeof payload === 'number'
+                            ? tasks.splice(0, payload)
+                            : tasks.splice(0);
+
+                var ds = _map(ts, function (task) {
+                    return task.data;
+                });
+
+                if(cargo.empty) cargo.empty();
+                working = true;
+                worker(ds, function () {
+                    working = false;
+
+                    var args = arguments;
+                    _each(ts, function (data) {
+                        if (data.callback) {
+                            data.callback.apply(null, args);
+                        }
+                    });
+
+                    process();
+                });
+            },
+            length: function () {
+                return tasks.length;
+            },
+            running: function () {
+                return working;
+            }
+        };
+        return cargo;
+    };
+
+    var _console_fn = function (name) {
+        return function (fn) {
+            var args = Array.prototype.slice.call(arguments, 1);
+            fn.apply(null, args.concat([function (err) {
+                var args = Array.prototype.slice.call(arguments, 1);
+                if (typeof console !== 'undefined') {
+                    if (err) {
+                        if (console.error) {
+                            console.error(err);
+                        }
+                    }
+                    else if (console[name]) {
+                        _each(args, function (x) {
+                            console[name](x);
+                        });
+                    }
+                }
+            }]));
+        };
+    };
+    async.log = _console_fn('log');
+    async.dir = _console_fn('dir');
+    /*async.info = _console_fn('info');
+    async.warn = _console_fn('warn');
+    async.error = _console_fn('error');*/
+
+    async.memoize = function (fn, hasher) {
+        var memo = {};
+        var queues = {};
+        hasher = hasher || function (x) {
+            return x;
+        };
+        var memoized = function () {
+            var args = Array.prototype.slice.call(arguments);
+            var callback = args.pop();
+            var key = hasher.apply(null, args);
+            if (key in memo) {
+                callback.apply(null, memo[key]);
+            }
+            else if (key in queues) {
+                queues[key].push(callback);
+            }
+            else {
+                queues[key] = [callback];
+                fn.apply(null, args.concat([function () {
+                    memo[key] = arguments;
+                    var q = queues[key];
+                    delete queues[key];
+                    for (var i = 0, l = q.length; i < l; i++) {
+                      q[i].apply(null, arguments);
+                    }
+                }]));
+            }
+        };
+        memoized.memo = memo;
+        memoized.unmemoized = fn;
+        return memoized;
+    };
+
+    async.unmemoize = function (fn) {
+      return function () {
+        return (fn.unmemoized || fn).apply(null, arguments);
+      };
+    };
+
+    async.times = function (count, iterator, callback) {
+        var counter = [];
+        for (var i = 0; i < count; i++) {
+            counter.push(i);
+        }
+        return async.map(counter, iterator, callback);
+    };
+
+    async.timesSeries = function (count, iterator, callback) {
+        var counter = [];
+        for (var i = 0; i < count; i++) {
+            counter.push(i);
+        }
+        return async.mapSeries(counter, iterator, callback);
+    };
+
+    async.compose = function (/* functions... */) {
+        var fns = Array.prototype.reverse.call(arguments);
+        return function () {
+            var that = this;
+            var args = Array.prototype.slice.call(arguments);
+            var callback = args.pop();
+            async.reduce(fns, args, function (newargs, fn, cb) {
+                fn.apply(that, newargs.concat([function () {
+                    var err = arguments[0];
+                    var nextargs = Array.prototype.slice.call(arguments, 1);
+                    cb(err, nextargs);
+                }]))
+            },
+            function (err, results) {
+                callback.apply(that, [err].concat(results));
+            });
+        };
+    };
+
+    var _applyEach = function (eachfn, fns /*args...*/) {
+        var go = function () {
+            var that = this;
+            var args = Array.prototype.slice.call(arguments);
+            var callback = args.pop();
+            return eachfn(fns, function (fn, cb) {
+                fn.apply(that, args.concat([cb]));
+            },
+            callback);
+        };
+        if (arguments.length > 2) {
+            var args = Array.prototype.slice.call(arguments, 2);
+            return go.apply(this, args);
+        }
+        else {
+            return go;
+        }
+    };
+    async.applyEach = doParallel(_applyEach);
+    async.applyEachSeries = doSeries(_applyEach);
+
+    async.forever = function (fn, callback) {
+        function next(err) {
+            if (err) {
+                if (callback) {
+                    return callback(err);
+                }
+                throw err;
+            }
+            fn(next);
+        }
+        next();
+    };
+
+    // AMD / RequireJS
+    if (typeof define !== 'undefined' && define.amd) {
+        define([], function () {
+            return async;
+        });
+    }
+    // Node.js
+    else if (typeof module !== 'undefined' && module.exports) {
+        module.exports = async;
+    }
+    // included directly via <script> tag
+    else {
+        root.async = async;
+    }
+
+}());
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/async/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/async/package.json
new file mode 100755 (executable)
index 0000000..a67a0dc
--- /dev/null
@@ -0,0 +1,60 @@
+{
+  "name": "async",
+  "description": "Higher-order functions and common patterns for asynchronous code",
+  "main": "./lib/async",
+  "author": {
+    "name": "Caolan McMahon"
+  },
+  "version": "0.2.10",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/caolan/async.git"
+  },
+  "bugs": {
+    "url": "https://github.com/caolan/async/issues"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://github.com/caolan/async/raw/master/LICENSE"
+    }
+  ],
+  "devDependencies": {
+    "nodeunit": ">0.0.0",
+    "uglify-js": "1.2.x",
+    "nodelint": ">0.0.0"
+  },
+  "jam": {
+    "main": "lib/async.js",
+    "include": [
+      "lib/async.js",
+      "README.md",
+      "LICENSE"
+    ]
+  },
+  "scripts": {
+    "test": "nodeunit test/test-async.js"
+  },
+  "_id": "async@0.2.10",
+  "dist": {
+    "shasum": "b6bbe0b0674b9d719708ca38de8c237cb526c3d1",
+    "tarball": "http://registry.npmjs.org/async/-/async-0.2.10.tgz"
+  },
+  "_from": "async@~0.2.9",
+  "_npmVersion": "1.3.2",
+  "_npmUser": {
+    "name": "caolan",
+    "email": "caolan.mcmahon@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "caolan",
+      "email": "caolan@caolanmcmahon.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "b6bbe0b0674b9d719708ca38de8c237cb526c3d1",
+  "_resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/caolan/async"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/README.md
new file mode 100755 (executable)
index 0000000..e4e5550
--- /dev/null
@@ -0,0 +1,40 @@
+#Captcha PNG generator\r
+A numeric captcha generator for Node.js\r
+\r
+##Features\r
+* Only generate numeric captcha PNG image\r
+* Build-in fonts\r
+* Characters up and down, left and right limits, random displacement\r
+* Full JavaScript\r
+\r
+##Examples\r
+```javascript\r
+/**\r
+ * Captcha PNG img generator\r
+ * @Author: George Chan\r
+ * @Email: gchan@21cn.com\r
+ * @Version: 1.0\r
+ * @Date: 2013-08-18\r
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License\r
+ */\r
+\r
+var http = require('http');\r
+var captchapng = require('captchapng');\r
+\r
+http.createServer(function (request, response) {\r
+    if(request.url == '/captcha.png') {\r
+        var p = new captchapng(80,30,parseInt(Math.random()*9000+1000)); // width,height,numeric captcha\r
+        p.color(0, 0, 0, 0);  // First color: background (red, green, blue, alpha)\r
+        p.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha)\r
+\r
+        var img = p.getBase64();\r
+        var imgbase64 = new Buffer(img,'base64');\r
+        response.writeHead(200, {\r
+            'Content-Type': 'image/png'\r
+        });\r
+        response.end(imgbase64);\r
+    } else response.end('');\r
+}).listen(8181);\r
+\r
+console.log('Web server started.\n http:\\\\127.0.0.1:8181\\captcha.png');\r
+```
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/examples/app.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/examples/app.js
new file mode 100755 (executable)
index 0000000..d5e7efa
--- /dev/null
@@ -0,0 +1,28 @@
+/**\r
+ * Captcha PNG img generator\r
+ * @Author: George Chan\r
+ * @Email: gchan@21cn.com\r
+ * @Version: 1.0\r
+ * @Date: 2013-08-18\r
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License\r
+ */\r
+\r
+var http = require('http');\r
+var captchapng = require('captchapng');\r
+\r
+http.createServer(function (request, response) {\r
+    if(request.url == '/captcha.png') {\r
+        var p = new captchapng(80,30,parseInt(Math.random()*9000+1000)); // width,height,numeric captcha\r
+        p.color(0, 0, 0, 0);  // First color: background (red, green, blue, alpha)\r
+        p.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha)\r
+\r
+        var img = p.getBase64();\r
+        var imgbase64 = new Buffer(img,'base64');\r
+        response.writeHead(200, {\r
+            'Content-Type': 'image/png'\r
+        });\r
+        response.end(imgbase64);\r
+    } else response.end('');\r
+}).listen(8181);\r
+\r
+console.log('Web server started.\n http:\\\\127.0.0.1:8181\\captcha.png');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/examples/examples.iml b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/examples/examples.iml
new file mode 100755 (executable)
index 0000000..57b6d1c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<module type="WEB_MODULE" version="4">\r
+  <component name="NewModuleRootManager" inherit-compiler-output="true">\r
+    <exclude-output />\r
+    <content url="file://$MODULE_DIR$" />\r
+    <orderEntry type="inheritedJdk" />\r
+    <orderEntry type="sourceFolder" forTests="false" />\r
+  </component>\r
+</module>\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/lib/captchapng.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/lib/captchapng.js
new file mode 100755 (executable)
index 0000000..8404c53
--- /dev/null
@@ -0,0 +1,83 @@
+/**\r
+ * captchapng\r
+ * Captcha PNG generator\r
+ * @Author: George Chan\r
+ * @Email: gchan@21cn.com\r
+ * @Version: 0.0.1\r
+ * @Date: 2013-08-18\r
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License\r
+ */\r
+\r
+var pnglib = require('pnglib');\r
+this.numMask = [];\r
+this.numMask[0]=[];\r
+this.numMask[0]=loadNumMask0();\r
+this.numMask[1]=loadNumMask1();\r
+myself = this;\r
+\r
+function loadNumMask0() {\r
+    var numbmp=[];\r
+    numbmp[0]=["0011111000","0111111110","0111111110","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","1110001111","0111111111"," 111111110","0011111100"];\r
+    numbmp[1]=["0000011","0000111","0011111","1111111","1111111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111","0001111"];\r
+    numbmp[2]=["001111100","011111110","111111111","111001111","111001111","111001111","111001111","000011111","000011110","000111110","000111100","000111100","001111000","001111000","011110000","011110000","111111111","111111111","111111111"];\r
+    numbmp[3]=["0011111100","0111111110","1111111111","1111001111","1111001111","1111001111","0000001111","0001111110","0001111100","0001111111","0000001111","1111001111","1111001111","1111001111","1111001111","1111001111","1111111111","0111111110","0011111100"];\r
+    numbmp[4]=["00001111110","00001111110","00011111110","00011111110","00011111110","00111011110","00111011110","00111011110","01110011110","01110011110","01110011110","11100011110","11111111111","11111111111","11111111111","11111111111","00000011110","00000011110","00000011110"];\r
+    numbmp[5]=["1111111111","1111111111","1111111111","1111000000","1111000000","1111011100","1111111110","1111111111","1111001111","1111001111","0000001111","0000001111","1111001111","1111001111","1111001111","1111001111","1111111111","0111111110","0011111100"];\r
+    numbmp[6]=["0011111100","0111111110","0111111111","1111001111","1111001111","1111000000","1111011100","1111111110","1111111111","1111001111","1111001111","1111001111","1111001111","1111001111","1111001111","1111001111","0111111111","0111111110","0011111100"];\r
+    numbmp[7]=["11111111","11111111","11111111","00001111","00001111","00001111","00001110","00001110","00011110","00011110","00011110","00011100","00111100","00111100","00111100","00111100","00111000","01111000","01111000"];\r
+    numbmp[8]=["0011111100","0111111110","1111111111","1111001111","1111001111","1111001111","1111001111","0111111110","0011111100","0111111110","1111001111","1111001111","1111001111","1111001111","1111001111","1111001111","1111111111","0111111110","0011111100"];\r
+    numbmp[9]=["0011111100","0111111110","1111111111","1111001111","1111001111","1111001111","1111001111","1111001111","1111001111","1111001111","1111111111","0111111111","0011101111","0000001111","1111001111","1111001111","1111111110","0111111110","0011111000"];\r
+\r
+    return numbmp;\r
+}\r
+\r
+function loadNumMask1() {\r
+    var numbmp=[];\r
+    numbmp[0] = ["000000001111000","000000111111110","000001110000110","000011000000011","000110000000011","001100000000011","011100000000011","011000000000011","111000000000110","110000000000110","110000000001110","110000000001100","110000000011000","110000000111000","011000011110000","011111111000000","000111110000000"];\r
+    numbmp[1] = ["00000111","00001111","00011110","00010110","00001100","00001100","00011000","00011000","00110000","00110000","00110000","01100000","01100000","01100000","11000000","11000000","11000000"];\r
+    numbmp[2] = ["00000011111000","00001111111110","00011100000110","00011000000011","00000000000011","00000000000011","00000000000011","00000000000110","00000000001110","00000000011100","00000001110000","00000111100000","00001110000000","00111100000000","01110000000000","11111111110000","11111111111110","00000000011110"];\r
+    numbmp[3] = ["000000111111000","000011111111110","000111100000111","000110000000011","000000000000011","000000000000011","000000000001110","000000111111000","000000111111000","000000000011100","000000000001100","000000000001100","110000000001100","111000000011100","111100000111000","001111111110000","000111111000000"];\r
+    numbmp[4] = ["00000011000001","00000110000011","00001100000010","00011000000110","00111000000110","00110000001100","01100000001100","01100000001000","11000000011000","11111111111111","11111111111111","00000000110000","00000000110000","00000000100000","00000001100000","00000001100000","00000001100000"];\r
+    numbmp[5] = ["0000001111111111","0000011111111111","0000111000000000","0000110000000000","0000110000000000","0001110000000000","0001101111100000","0001111111111000","0001110000011000","0000000000001100","0000000000001100","0000000000001100","1100000000001100","1110000000011000","1111000001111000","0111111111100000","0001111110000000"];\r
+    numbmp[6] = ["000000001111100","000000111111110","000011110000111","000111000000011","000110000000000","001100000000000","011001111100000","011111111111000","111110000011000","111000000001100","110000000001100","110000000001100","110000000001100","111000000011000","011100001110000","001111111100000","000111110000000"];\r
+    numbmp[7] = ["1111111111111","1111111111111","0000000001110","0000000011100","0000000111000","0000000110000","0000001100000","0000011100000","0000111000000","0000110000000","0001100000000","0011100000000","0011000000000","0111000000000","1110000000000","1100000000000","1100000000000"];\r
+    numbmp[8] = ["0000000111110000","0000011111111100","0000011000001110","0000110000000111","0000110000011111","0000110001111000","0000011111100000","0000011110000000","0001111111000000","0011100011100000","0111000001110000","1110000000110000","1100000000110000","1100000001110000","1110000011100000","0111111111000000","0001111100000000"];\r
+    numbmp[9] = ["0000011111000","0001111111110","0011100000110","0011000000011","0110000000011","0110000000011","0110000000011","0110000000111","0011000011110","0011111111110","0000111100110","0000000001100","0000000011000","0000000111000","0000011110000","1111111000000","1111110000000"];\r
+    return numbmp;\r
+}\r
+\r
+\r
+function captchapng(width,height,dispNumber) {\r
+    this.width   = width;\r
+    this.height  = height;\r
+    this.depth   = 8;\r
+    this.dispNumber = ""+dispNumber.toString();\r
+    this.widthAverage = parseInt(this.width/this.dispNumber.length);\r
+\r
+    var p = new pnglib(this.width,this.height,this.depth);\r
+\r
+    for (var numSection=0;numSection<this.dispNumber.length;numSection++){\r
+\r
+        var dispNum = this.dispNumber[numSection].valueOf();\r
+\r
+        var font = parseInt(Math.random()*myself.numMask.length);\r
+        font = (font>=myself.numMask.length?0:font);\r
+        //var random_x_offs = 0, random_y_offs = 0;\r
+        var random_x_offs = parseInt(Math.random()*(this.widthAverage - myself.numMask[font][dispNum][0].length));\r
+        var random_y_offs = parseInt(Math.random()*(this.height - myself.numMask[font][dispNum].length));\r
+        random_x_offs = (random_x_offs<0?0:random_x_offs);\r
+        random_y_offs = (random_y_offs<0?0:random_y_offs);\r
+\r
+        for (var i=0;(i<myself.numMask[font][dispNum].length) && ((i+random_y_offs)<this.height);i++){\r
+            var lineIndex = p.index(this.widthAverage * numSection + random_x_offs,i+random_y_offs);\r
+            for (var j=0;j<myself.numMask[font][dispNum][i].length;j++){\r
+                if ((myself.numMask[font][dispNum][i][j]=='1') && (this.widthAverage * numSection + random_x_offs+j)<this.width){\r
+                    p.buffer[lineIndex+j]='\x01';\r
+                }\r
+            }\r
+        }\r
+    }\r
+    return p;\r
+}\r
+\r
+module.exports = captchapng;\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/lib/lib.iml b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/lib/lib.iml
new file mode 100755 (executable)
index 0000000..57b6d1c
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<module type="WEB_MODULE" version="4">\r
+  <component name="NewModuleRootManager" inherit-compiler-output="true">\r
+    <exclude-output />\r
+    <content url="file://$MODULE_DIR$" />\r
+    <orderEntry type="inheritedJdk" />\r
+    <orderEntry type="sourceFolder" forTests="false" />\r
+  </component>\r
+</module>\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/README.md
new file mode 100755 (executable)
index 0000000..ec9bcf1
--- /dev/null
@@ -0,0 +1,31 @@
+#PNGLib\r
+A PNG lib for Node.js\r
+\r
+ A handy class to calculate color values.\r
+\r
+```\r
+ version 1.0\r
+ author Robert Eisele <robert@xarg.org>\r
+ copyright Copyright (c) 2010, Robert Eisele\r
+ link http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/\r
+ license http://www.opensource.org/licenses/bsd-license.php BSD License\r
+```\r
+Modified by George Chan <gchan@21cn.com>\r
+\r
+##Install\r
+```\r
+npm install pnglib\r
+```\r
+\r
+##Examples\r
+```javascript\r
+var pnglib = require('pnglib');\r
+var p = new pnglib(300,100,8);\r
+var lineIndex = p.index(10,25);\r
+p.buffer[lineIndex+j]='\x01';\r
+p.color(0, 0, 0, 0);  // First color: background (red, green, blue, alpha)\r
+p.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha)\r
+```\r
+\r
+More example see:\r
+https://github.com/GeorgeChan/captchapng
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/lib/pnglib.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/lib/pnglib.js
new file mode 100755 (executable)
index 0000000..eeac098
--- /dev/null
@@ -0,0 +1,207 @@
+/**\r
+ * A handy class to calculate color values.\r
+ *\r
+ * @version 1.0\r
+ * @author Robert Eisele <robert@xarg.org>\r
+ * @copyright Copyright (c) 2010, Robert Eisele\r
+ * @link http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/\r
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License\r
+ *\r
+ */\r
+\r
+// Modified by George Chan <gchan@21cn.com>\r
+\r
+module.exports = function(width,height,depth) {\r
+\r
+\r
+    // helper functions for that ctx\r
+    function write(buffer, offs) {\r
+        for (var i = 2; i < arguments.length; i++) {\r
+            for (var j = 0; j < arguments[i].length; j++) {\r
+                buffer[offs++] = arguments[i].charAt(j);\r
+            }\r
+        }\r
+    }\r
+\r
+    function byte2(w) {\r
+        return String.fromCharCode((w >> 8) & 255, w & 255);\r
+    }\r
+\r
+    function byte4(w) {\r
+        return String.fromCharCode((w >> 24) & 255, (w >> 16) & 255, (w >> 8) & 255, w & 255);\r
+    }\r
+\r
+    function byte2lsb(w) {\r
+        return String.fromCharCode(w & 255, (w >> 8) & 255);\r
+    }\r
+\r
+    this.width   = width;\r
+    this.height  = height;\r
+    this.depth   = depth;\r
+\r
+    // pixel data and row filter identifier size\r
+    this.pix_size = height * (width + 1);\r
+\r
+    // deflate header, pix_size, block headers, adler32 checksum\r
+    this.data_size = 2 + this.pix_size + 5 * Math.floor((0xfffe + this.pix_size) / 0xffff) + 4;\r
+\r
+    // offsets and sizes of Png chunks\r
+    this.ihdr_offs = 0;                                                                        // IHDR offset and size\r
+    this.ihdr_size = 4 + 4 + 13 + 4;\r
+    this.plte_offs = this.ihdr_offs + this.ihdr_size;  // PLTE offset and size\r
+    this.plte_size = 4 + 4 + 3 * depth + 4;\r
+    this.trns_offs = this.plte_offs + this.plte_size;  // tRNS offset and size\r
+    this.trns_size = 4 + 4 + depth + 4;\r
+    this.idat_offs = this.trns_offs + this.trns_size;  // IDAT offset and size\r
+    this.idat_size = 4 + 4 + this.data_size + 4;\r
+    this.iend_offs = this.idat_offs + this.idat_size;  // IEND offset and size\r
+    this.iend_size = 4 + 4 + 4;\r
+    this.buffer_size  = this.iend_offs + this.iend_size;       // total PNG size\r
+\r
+    this.buffer  = new Array();\r
+    this.palette = new Object();\r
+    this.pindex  = 0;\r
+\r
+    var _crc32 = new Array();\r
+\r
+    // initialize buffer with zero bytes\r
+    for (var i = 0; i < this.buffer_size; i++) {\r
+        this.buffer[i] = "\x00";\r
+    }\r
+\r
+    // initialize non-zero elements\r
+    write(this.buffer, this.ihdr_offs, byte4(this.ihdr_size - 12), 'IHDR', byte4(width), byte4(height), "\x08\x03");\r
+    write(this.buffer, this.plte_offs, byte4(this.plte_size - 12), 'PLTE');\r
+    write(this.buffer, this.trns_offs, byte4(this.trns_size - 12), 'tRNS');\r
+    write(this.buffer, this.idat_offs, byte4(this.idat_size - 12), 'IDAT');\r
+    write(this.buffer, this.iend_offs, byte4(this.iend_size - 12), 'IEND');\r
+\r
+    // initialize deflate header\r
+    var header = ((8 + (7 << 4)) << 8) | (3 << 6);\r
+    header+= 31 - (header % 31);\r
+\r
+    write(this.buffer, this.idat_offs + 8, byte2(header));\r
+\r
+    // initialize deflate block headers\r
+    for (var i = 0; (i << 16) - 1 < this.pix_size; i++) {\r
+        var size, bits;\r
+        if (i + 0xffff < this.pix_size) {\r
+            size = 0xffff;\r
+            bits = "\x00";\r
+        } else {\r
+            size = this.pix_size - (i << 16) - i;\r
+            bits = "\x01";\r
+        }\r
+        write(this.buffer, this.idat_offs + 8 + 2 + (i << 16) + (i << 2), bits, byte2lsb(size), byte2lsb(~size));\r
+    }\r
+\r
+    /* Create crc32 lookup table */\r
+    for (var i = 0; i < 256; i++) {\r
+        var c = i;\r
+        for (var j = 0; j < 8; j++) {\r
+            if (c & 1) {\r
+                c = -306674912 ^ ((c >> 1) & 0x7fffffff);\r
+            } else {\r
+                c = (c >> 1) & 0x7fffffff;\r
+            }\r
+        }\r
+        _crc32[i] = c;\r
+    }\r
+\r
+    // compute the index into a png for a given pixel\r
+    this.index = function(x,y) {\r
+        var i = y * (this.width + 1) + x + 1;\r
+        var j = this.idat_offs + 8 + 2 + 5 * Math.floor((i / 0xffff) + 1) + i;\r
+        return j;\r
+    }\r
+\r
+    // convert a color and build up the palette\r
+    this.color = function(red, green, blue, alpha) {\r
+\r
+        alpha = alpha >= 0 ? alpha : 255;\r
+        var color = (((((alpha << 8) | red) << 8) | green) << 8) | blue;\r
+\r
+        if (typeof this.palette[color] == "undefined") {\r
+            if (this.pindex == this.depth) return "\x00";\r
+\r
+            var ndx = this.plte_offs + 8 + 3 * this.pindex;\r
+\r
+            this.buffer[ndx + 0] = String.fromCharCode(red);\r
+            this.buffer[ndx + 1] = String.fromCharCode(green);\r
+            this.buffer[ndx + 2] = String.fromCharCode(blue);\r
+            this.buffer[this.trns_offs+8+this.pindex] = String.fromCharCode(alpha);\r
+\r
+            this.palette[color] = String.fromCharCode(this.pindex++);\r
+        }\r
+        return this.palette[color];\r
+    }\r
+\r
+    // output a PNG string, Base64 encoded\r
+    this.getBase64 = function() {\r
+\r
+        var s = this.getDump();\r
+\r
+        var ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";\r
+        var c1, c2, c3, e1, e2, e3, e4;\r
+        var l = s.length;\r
+        var i = 0;\r
+        var r = "";\r
+\r
+        do {\r
+            c1 = s.charCodeAt(i);\r
+            e1 = c1 >> 2;\r
+            c2 = s.charCodeAt(i+1);\r
+            e2 = ((c1 & 3) << 4) | (c2 >> 4);\r
+            c3 = s.charCodeAt(i+2);\r
+            if (l < i+2) { e3 = 64; } else { e3 = ((c2 & 0xf) << 2) | (c3 >> 6); }\r
+            if (l < i+3) { e4 = 64; } else { e4 = c3 & 0x3f; }\r
+            r+= ch.charAt(e1) + ch.charAt(e2) + ch.charAt(e3) + ch.charAt(e4);\r
+        } while ((i+= 3) < l);\r
+        return r;\r
+    }\r
+\r
+    // output a PNG string\r
+    this.getDump = function() {\r
+\r
+        // compute adler32 of output pixels + row filter bytes\r
+        var BASE = 65521; /* largest prime smaller than 65536 */\r
+        var NMAX = 5552;  /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */\r
+        var s1 = 1;\r
+        var s2 = 0;\r
+        var n = NMAX;\r
+\r
+        for (var y = 0; y < this.height; y++) {\r
+            for (var x = -1; x < this.width; x++) {\r
+                s1+= this.buffer[this.index(x, y)].charCodeAt(0);\r
+                s2+= s1;\r
+                if ((n-= 1) == 0) {\r
+                    s1%= BASE;\r
+                    s2%= BASE;\r
+                    n = NMAX;\r
+                }\r
+            }\r
+        }\r
+        s1%= BASE;\r
+        s2%= BASE;\r
+        write(this.buffer, this.idat_offs + this.idat_size - 8, byte4((s2 << 16) | s1));\r
+\r
+        // compute crc32 of the PNG chunks\r
+        function crc32(png, offs, size) {\r
+            var crc = -1;\r
+            for (var i = 4; i < size-4; i += 1) {\r
+                crc = _crc32[(crc ^ png[offs+i].charCodeAt(0)) & 0xff] ^ ((crc >> 8) & 0x00ffffff);\r
+            }\r
+            write(png, offs+size-4, byte4(crc ^ -1));\r
+        }\r
+\r
+        crc32(this.buffer, this.ihdr_offs, this.ihdr_size);\r
+        crc32(this.buffer, this.plte_offs, this.plte_size);\r
+        crc32(this.buffer, this.trns_offs, this.trns_size);\r
+        crc32(this.buffer, this.idat_offs, this.idat_size);\r
+        crc32(this.buffer, this.iend_offs, this.iend_size);\r
+\r
+        // convert PNG to string\r
+        return "\211PNG\r\n\032\n"+this.buffer.join('');\r
+    }\r
+};\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/node_modules/pnglib/package.json
new file mode 100755 (executable)
index 0000000..ccabbec
--- /dev/null
@@ -0,0 +1,43 @@
+{
+  "name": "pnglib",
+  "version": "0.0.1",
+  "description": "A PNG lib for Node.js",
+  "author": {
+    "name": "George Chan"
+  },
+  "main": "./lib/pnglib.js",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/GeorgeChan/pnglib.git"
+  },
+  "keywords": [
+    "pnglib"
+  ],
+  "license": "BSD",
+  "readmeFilename": "README.md",
+  "readme": "#PNGLib\nA PNG lib for Node.js\n\n A handy class to calculate color values.\n\n```\n version 1.0\n author Robert Eisele robert@xarg.org\n copyright Copyright (c) 2010, Robert Eisele\n link http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/\n license http://www.opensource.org/licenses/bsd-license.php BSD License\n```\nModified by George Chan gchan@21cn.com\n\n##Install\n```\nnpm install pnglib\n```\n\n##Examples\nExample see:  https://github.com/GeorgeChan/captchapng",
+  "bugs": {
+    "url": "https://github.com/GeorgeChan/pnglib/issues"
+  },
+  "_id": "pnglib@0.0.1",
+  "dist": {
+    "shasum": "f9ab6f9c688f4a9d579ad8be28878a716e30c096",
+    "tarball": "http://registry.npmjs.org/pnglib/-/pnglib-0.0.1.tgz"
+  },
+  "_from": "pnglib@",
+  "_npmVersion": "1.3.5",
+  "_npmUser": {
+    "name": "gchan",
+    "email": "gchan@21cn.com"
+  },
+  "maintainers": [
+    {
+      "name": "gchan",
+      "email": "gchan@21cn.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "f9ab6f9c688f4a9d579ad8be28878a716e30c096",
+  "_resolved": "https://registry.npmjs.org/pnglib/-/pnglib-0.0.1.tgz",
+  "homepage": "https://github.com/GeorgeChan/pnglib"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/captchapng/package.json
new file mode 100755 (executable)
index 0000000..105594c
--- /dev/null
@@ -0,0 +1,46 @@
+{
+  "name": "captchapng",
+  "version": "0.0.1",
+  "description": "A numeric captcha generator for Node.js",
+  "author": {
+    "name": "George Chan"
+  },
+  "main": "./lib/captchapng.js",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/GeorgeChan/captchapng"
+  },
+  "keywords": [
+    "captchapng"
+  ],
+  "dependencies": {
+    "pnglib": ""
+  },
+  "license": "BSD",
+  "readme": "#Captcha PNG generator\nA numeric captcha generator for Node.js\n\n##Features\n* Only generate numeric captcha PNG image\n* Build-in fonts\n* Characters up and down, left and right limits, random displacement\n* Full JavaScript\n\n##Examples\n```javascript\n/**\n * Captcha PNG img generator\n * @Author: George Chan\n * @Email: gchan@21cn.com\n * @Version: 1.0\n * @Date: 2013-08-18\n * @license http://www.opensource.org/licenses/bsd-license.php BSD License\n */\n\nvar http = require('http');\nvar captchapng = require('captchapng');\n\nhttp.createServer(function (request, response) {\n    if(request.url == '/captcha.png') {\n        var p = new captchapng(80,30,parseInt(Math.random()*9000+1000)); // width,height,numeric captcha\n        p.color(0, 0, 0, 0);  // First color: background (red, green, blue, alpha)\n        p.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha)\n\n        var img = p.getBase64();\n        var imgbase64 = new Buffer(img,'base64');\n        response.writeHead(200, {\n            'Content-Type': 'image/png'\n        });\n        response.end(imgbase64);\n    } else response.end('');\n}).listen(8181);\n\nconsole.log('Web server started.\\n http:\\\\127.0.0.1:8181\\captcha.png');\n```",
+  "readmeFilename": "README.md",
+  "bugs": {
+    "url": "https://github.com/GeorgeChan/captchapng/issues"
+  },
+  "_id": "captchapng@0.0.1",
+  "dist": {
+    "shasum": "17605d4076fec6370791061aa814399e18c893ea",
+    "tarball": "http://registry.npmjs.org/captchapng/-/captchapng-0.0.1.tgz"
+  },
+  "_from": "captchapng@0.0.1",
+  "_npmVersion": "1.3.5",
+  "_npmUser": {
+    "name": "gchan",
+    "email": "gchan@21cn.com"
+  },
+  "maintainers": [
+    {
+      "name": "gchan",
+      "email": "gchan@21cn.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "17605d4076fec6370791061aa814399e18c893ea",
+  "_resolved": "https://registry.npmjs.org/captchapng/-/captchapng-0.0.1.tgz",
+  "homepage": "https://github.com/GeorgeChan/captchapng"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/README.md
new file mode 100755 (executable)
index 0000000..e1f6edd
--- /dev/null
@@ -0,0 +1,248 @@
+[![build-status](https://www.codeship.io/projects/3ad58940-4c7d-0131-15d5-5a8cd3f550f8/status)](https://www.codeship.io/projects/11259)
+
+# SYNOPSIS
+
+EventEmitter2 is an implementation of the EventEmitter found in Node.js
+
+# DESCRIPTION
+
+### FEATURES
+ - Namespaces/Wildcards.
+ - Times To Listen (TTL), extends the `once` concept with `many`.
+ - Browser environment compatibility.
+ - Demonstrates good performance in benchmarks
+
+```
+EventEmitterHeatUp x 3,728,965 ops/sec \302\2610.68% (60 runs sampled)
+EventEmitter x 2,822,904 ops/sec \302\2610.74% (63 runs sampled)
+EventEmitter2 x 7,251,227 ops/sec \302\2610.55% (58 runs sampled)
+EventEmitter2 (wild) x 3,220,268 ops/sec \302\2610.44% (65 runs sampled)
+Fastest is EventEmitter2
+```
+
+### Differences (Non breaking, compatible with existing EventEmitter)
+
+ - The constructor takes a configuration object.
+```javascript
+    var EventEmitter2 = require('eventemitter2').EventEmitter2;
+    var server = new EventEmitter2({
+
+      //
+      // use wildcards.
+      //
+      wildcard: true,
+
+      //
+      // the delimiter used to segment namespaces, defaults to `.`.
+      //
+      delimiter: '::', 
+      
+      //
+      // if you want to emit the newListener event set to true.
+      //
+      newListener: false, 
+
+      //
+      // max listeners that can be assigned to an event, default 10.
+      //
+      maxListeners: 20
+    });
+```
+
+ - Getting the actual event that fired.
+
+```javascript
+    server.on('foo.*', function(value1, value2) {
+      console.log(this.event, value1, value2);
+    });
+```
+
+ - Fire an event N times and then remove it, an extension of the `once` concept.
+
+```javascript
+    server.many('foo', 4, function() {
+      console.log('hello');
+    });
+```
+
+ - Pass in a namespaced event as an array rather than a delimited string.
+
+```javascript
+    server.many(['foo', 'bar', 'bazz'], function() {
+      console.log('hello');
+    });
+```
+
+
+# API
+
+When an `EventEmitter` instance experiences an error, the typical action is
+to emit an `error` event. Error events are treated as a special case.
+If there is no listener for it, then the default action is to print a stack
+trace and exit the program.
+
+All EventEmitters emit the event `newListener` when new listeners are
+added.
+
+
+**Namespaces** with **Wildcards**
+To use namespaces/wildcards, pass the `wildcard` option into the EventEmitter 
+constructor. When namespaces/wildcards are enabled, events can either be 
+strings (`foo.bar`) separated by a delimiter or arrays (`['foo', 'bar']`). The 
+delimiter is also configurable as a constructor option.
+
+An event name passed to any event emitter method can contain a wild card (the 
+`*` character). If the event name is a string, a wildcard may appear as `foo.*`. 
+If the event name is an array, the wildcard may appear as `['foo', '*']`.
+
+If either of the above described events were passed to the `on` method, 
+subsequent emits such as the following would be observed...
+
+```javascript
+   emitter.emit('foo.bazz');
+   emitter.emit(['foo', 'bar']);
+```
+
+
+### emitter.addListener(event, listener)
+### emitter.on(event, listener)
+
+Adds a listener to the end of the listeners array for the specified event.
+
+```javascript
+    server.on('data', function(value1, value2, value3, ...) {
+      console.log('The event was raised!');
+    });
+```
+
+```javascript
+    server.on('data', function(value) {
+      console.log('The event was raised!');
+    });
+```
+
+### emitter.onAny(listener)
+
+Adds a listener that will be fired when any event is emitted.
+
+```javascript
+    server.onAny(function(value) {
+      console.log('All events trigger this.');
+    });
+```
+
+### emitter.offAny(listener)
+
+Removes the listener that will be fired when any event is emitted.
+
+```javascript
+    server.offAny(function(value) {
+      console.log('The event was raised!');
+    });
+```
+
+#### emitter.once(event, listener)
+
+Adds a **one time** listener for the event. The listener is invoked 
+only the first time the event is fired, after which it is removed.
+
+```javascript
+    server.once('get', function (value) {
+      console.log('Ah, we have our first value!');
+    });
+```
+
+### emitter.many(event, timesToListen, listener)
+
+Adds a listener that will execute **n times** for the event before being
+removed. The listener is invoked only the first **n times** the event is 
+fired, after which it is removed.
+
+```javascript
+    server.many('get', 4, function (value) {
+      console.log('This event will be listened to exactly four times.');
+    });
+```
+
+
+### emitter.removeListener(event, listener)
+### emitter.off(event, listener)
+
+Remove a listener from the listener array for the specified event. 
+**Caution**: changes array indices in the listener array behind the listener.
+
+```javascript
+    var callback = function(value) {
+      console.log('someone connected!');
+    };
+    server.on('get', callback);
+    // ...
+    server.removeListener('get', callback);
+```
+
+
+### emitter.removeAllListeners([event])
+
+Removes all listeners, or those of the specified event.
+
+
+### emitter.setMaxListeners(n)
+
+By default EventEmitters will print a warning if more than 10 listeners 
+are added to it. This is a useful default which helps finding memory leaks. 
+Obviously not all Emitters should be limited to 10. This function allows 
+that to be increased. Set to zero for unlimited.
+
+
+### emitter.listeners(event)
+
+Returns an array of listeners for the specified event. This array can be 
+manipulated, e.g. to remove listeners.
+
+```javascript
+    server.on('get', function(value) {
+      console.log('someone connected!');
+    });
+    console.log(server.listeners('get')); // [ [Function] ]
+```
+
+### emitter.listenersAny()
+
+Returns an array of listeners that are listening for any event that is 
+specified. This array can be manipulated, e.g. to remove listeners.
+
+```javascript
+    server.onAny(function(value) {
+      console.log('someone connected!');
+    });
+    console.log(server.listenersAny()[0]); // [ [Function] ]
+```
+
+### emitter.emit(event, [arg1], [arg2], [...])
+
+Execute each of the listeners that may be listening for the specified event 
+name in order with the list of arguments.
+
+# LICENSE
+
+(The MIT License)
+
+Copyright (c) 2011 hij1nx <http://www.twitter.com/hij1nx>
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/index.js
new file mode 100755 (executable)
index 0000000..6f583b5
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib/eventemitter2');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/lib/eventemitter2.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/lib/eventemitter2.js
new file mode 100755 (executable)
index 0000000..bde69e8
--- /dev/null
@@ -0,0 +1,573 @@
+/*!
+ * EventEmitter2
+ * https://github.com/hij1nx/EventEmitter2
+ *
+ * Copyright (c) 2013 hij1nx
+ * Licensed under the MIT license.
+ */
+;!function(undefined) {
+
+  var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
+    return Object.prototype.toString.call(obj) === "[object Array]";
+  };
+  var defaultMaxListeners = 10;
+
+  function init() {
+    this._events = {};
+    if (this._conf) {
+      configure.call(this, this._conf);
+    }
+  }
+
+  function configure(conf) {
+    if (conf) {
+
+      this._conf = conf;
+
+      conf.delimiter && (this.delimiter = conf.delimiter);
+      conf.maxListeners && (this._events.maxListeners = conf.maxListeners);
+      conf.wildcard && (this.wildcard = conf.wildcard);
+      conf.newListener && (this.newListener = conf.newListener);
+
+      if (this.wildcard) {
+        this.listenerTree = {};
+      }
+    }
+  }
+
+  function EventEmitter(conf) {
+    this._events = {};
+    this.newListener = false;
+    configure.call(this, conf);
+  }
+
+  //
+  // Attention, function return type now is array, always !
+  // It has zero elements if no any matches found and one or more
+  // elements (leafs) if there are matches
+  //
+  function searchListenerTree(handlers, type, tree, i) {
+    if (!tree) {
+      return [];
+    }
+    var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
+        typeLength = type.length, currentType = type[i], nextType = type[i+1];
+    if (i === typeLength && tree._listeners) {
+      //
+      // If at the end of the event(s) list and the tree has listeners
+      // invoke those listeners.
+      //
+      if (typeof tree._listeners === 'function') {
+        handlers && handlers.push(tree._listeners);
+        return [tree];
+      } else {
+        for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
+          handlers && handlers.push(tree._listeners[leaf]);
+        }
+        return [tree];
+      }
+    }
+
+    if ((currentType === '*' || currentType === '**') || tree[currentType]) {
+      //
+      // If the event emitted is '*' at this part
+      // or there is a concrete match at this patch
+      //
+      if (currentType === '*') {
+        for (branch in tree) {
+          if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
+            listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
+          }
+        }
+        return listeners;
+      } else if(currentType === '**') {
+        endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
+        if(endReached && tree._listeners) {
+          // The next element has a _listeners, add it to the handlers.
+          listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
+        }
+
+        for (branch in tree) {
+          if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
+            if(branch === '*' || branch === '**') {
+              if(tree[branch]._listeners && !endReached) {
+                listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
+              }
+              listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
+            } else if(branch === nextType) {
+              listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
+            } else {
+              // No match on this one, shift into the tree but not in the type array.
+              listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
+            }
+          }
+        }
+        return listeners;
+      }
+
+      listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
+    }
+
+    xTree = tree['*'];
+    if (xTree) {
+      //
+      // If the listener tree will allow any match for this part,
+      // then recursively explore all branches of the tree
+      //
+      searchListenerTree(handlers, type, xTree, i+1);
+    }
+
+    xxTree = tree['**'];
+    if(xxTree) {
+      if(i < typeLength) {
+        if(xxTree._listeners) {
+          // If we have a listener on a '**', it will catch all, so add its handler.
+          searchListenerTree(handlers, type, xxTree, typeLength);
+        }
+
+        // Build arrays of matching next branches and others.
+        for(branch in xxTree) {
+          if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
+            if(branch === nextType) {
+              // We know the next element will match, so jump twice.
+              searchListenerTree(handlers, type, xxTree[branch], i+2);
+            } else if(branch === currentType) {
+              // Current node matches, move into the tree.
+              searchListenerTree(handlers, type, xxTree[branch], i+1);
+            } else {
+              isolatedBranch = {};
+              isolatedBranch[branch] = xxTree[branch];
+              searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
+            }
+          }
+        }
+      } else if(xxTree._listeners) {
+        // We have reached the end and still on a '**'
+        searchListenerTree(handlers, type, xxTree, typeLength);
+      } else if(xxTree['*'] && xxTree['*']._listeners) {
+        searchListenerTree(handlers, type, xxTree['*'], typeLength);
+      }
+    }
+
+    return listeners;
+  }
+
+  function growListenerTree(type, listener) {
+
+    type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+
+    //
+    // Looks for two consecutive '**', if so, don't add the event at all.
+    //
+    for(var i = 0, len = type.length; i+1 < len; i++) {
+      if(type[i] === '**' && type[i+1] === '**') {
+        return;
+      }
+    }
+
+    var tree = this.listenerTree;
+    var name = type.shift();
+
+    while (name) {
+
+      if (!tree[name]) {
+        tree[name] = {};
+      }
+
+      tree = tree[name];
+
+      if (type.length === 0) {
+
+        if (!tree._listeners) {
+          tree._listeners = listener;
+        }
+        else if(typeof tree._listeners === 'function') {
+          tree._listeners = [tree._listeners, listener];
+        }
+        else if (isArray(tree._listeners)) {
+
+          tree._listeners.push(listener);
+
+          if (!tree._listeners.warned) {
+
+            var m = defaultMaxListeners;
+
+            if (typeof this._events.maxListeners !== 'undefined') {
+              m = this._events.maxListeners;
+            }
+
+            if (m > 0 && tree._listeners.length > m) {
+
+              tree._listeners.warned = true;
+              console.error('(node) warning: possible EventEmitter memory ' +
+                            'leak detected. %d listeners added. ' +
+                            'Use emitter.setMaxListeners() to increase limit.',
+                            tree._listeners.length);
+              console.trace();
+            }
+          }
+        }
+        return true;
+      }
+      name = type.shift();
+    }
+    return true;
+  }
+
+  // By default EventEmitters will print a warning if more than
+  // 10 listeners are added to it. This is a useful default which
+  // helps finding memory leaks.
+  //
+  // Obviously not all Emitters should be limited to 10. This function allows
+  // that to be increased. Set to zero for unlimited.
+
+  EventEmitter.prototype.delimiter = '.';
+
+  EventEmitter.prototype.setMaxListeners = function(n) {
+    this._events || init.call(this);
+    this._events.maxListeners = n;
+    if (!this._conf) this._conf = {};
+    this._conf.maxListeners = n;
+  };
+
+  EventEmitter.prototype.event = '';
+
+  EventEmitter.prototype.once = function(event, fn) {
+    this.many(event, 1, fn);
+    return this;
+  };
+
+  EventEmitter.prototype.many = function(event, ttl, fn) {
+    var self = this;
+
+    if (typeof fn !== 'function') {
+      throw new Error('many only accepts instances of Function');
+    }
+
+    function listener() {
+      if (--ttl === 0) {
+        self.off(event, listener);
+      }
+      fn.apply(this, arguments);
+    }
+
+    listener._origin = fn;
+
+    this.on(event, listener);
+
+    return self;
+  };
+
+  EventEmitter.prototype.emit = function() {
+
+    this._events || init.call(this);
+
+    var type = arguments[0];
+
+    if (type === 'newListener' && !this.newListener) {
+      if (!this._events.newListener) { return false; }
+    }
+
+    // Loop through the *_all* functions and invoke them.
+    if (this._all) {
+      var l = arguments.length;
+      var args = new Array(l - 1);
+      for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
+      for (i = 0, l = this._all.length; i < l; i++) {
+        this.event = type;
+        this._all[i].apply(this, args);
+      }
+    }
+
+    // If there is no 'error' event listener then throw.
+    if (type === 'error') {
+
+      if (!this._all &&
+        !this._events.error &&
+        !(this.wildcard && this.listenerTree.error)) {
+
+        if (arguments[1] instanceof Error) {
+          throw arguments[1]; // Unhandled 'error' event
+        } else {
+          throw new Error("Uncaught, unspecified 'error' event.");
+        }
+        return false;
+      }
+    }
+
+    var handler;
+
+    if(this.wildcard) {
+      handler = [];
+      var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+      searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
+    }
+    else {
+      handler = this._events[type];
+    }
+
+    if (typeof handler === 'function') {
+      this.event = type;
+      if (arguments.length === 1) {
+        handler.call(this);
+      }
+      else if (arguments.length > 1)
+        switch (arguments.length) {
+          case 2:
+            handler.call(this, arguments[1]);
+            break;
+          case 3:
+            handler.call(this, arguments[1], arguments[2]);
+            break;
+          // slower
+          default:
+            var l = arguments.length;
+            var args = new Array(l - 1);
+            for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
+            handler.apply(this, args);
+        }
+      return true;
+    }
+    else if (handler) {
+      var l = arguments.length;
+      var args = new Array(l - 1);
+      for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
+
+      var listeners = handler.slice();
+      for (var i = 0, l = listeners.length; i < l; i++) {
+        this.event = type;
+        listeners[i].apply(this, args);
+      }
+      return (listeners.length > 0) || !!this._all;
+    }
+    else {
+      return !!this._all;
+    }
+
+  };
+
+  EventEmitter.prototype.on = function(type, listener) {
+
+    if (typeof type === 'function') {
+      this.onAny(type);
+      return this;
+    }
+
+    if (typeof listener !== 'function') {
+      throw new Error('on only accepts instances of Function');
+    }
+    this._events || init.call(this);
+
+    // To avoid recursion in the case that type == "newListeners"! Before
+    // adding it to the listeners, first emit "newListeners".
+    this.emit('newListener', type, listener);
+
+    if(this.wildcard) {
+      growListenerTree.call(this, type, listener);
+      return this;
+    }
+
+    if (!this._events[type]) {
+      // Optimize the case of one listener. Don't need the extra array object.
+      this._events[type] = listener;
+    }
+    else if(typeof this._events[type] === 'function') {
+      // Adding the second element, need to change to array.
+      this._events[type] = [this._events[type], listener];
+    }
+    else if (isArray(this._events[type])) {
+      // If we've already got an array, just append.
+      this._events[type].push(listener);
+
+      // Check for listener leak
+      if (!this._events[type].warned) {
+
+        var m = defaultMaxListeners;
+
+        if (typeof this._events.maxListeners !== 'undefined') {
+          m = this._events.maxListeners;
+        }
+
+        if (m > 0 && this._events[type].length > m) {
+
+          this._events[type].warned = true;
+          console.error('(node) warning: possible EventEmitter memory ' +
+                        'leak detected. %d listeners added. ' +
+                        'Use emitter.setMaxListeners() to increase limit.',
+                        this._events[type].length);
+          console.trace();
+        }
+      }
+    }
+    return this;
+  };
+
+  EventEmitter.prototype.onAny = function(fn) {
+
+    if (typeof fn !== 'function') {
+      throw new Error('onAny only accepts instances of Function');
+    }
+
+    if(!this._all) {
+      this._all = [];
+    }
+
+    // Add the function to the event listener collection.
+    this._all.push(fn);
+    return this;
+  };
+
+  EventEmitter.prototype.addListener = EventEmitter.prototype.on;
+
+  EventEmitter.prototype.off = function(type, listener) {
+    if (typeof listener !== 'function') {
+      throw new Error('removeListener only takes instances of Function');
+    }
+
+    var handlers,leafs=[];
+
+    if(this.wildcard) {
+      var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+      leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
+    }
+    else {
+      // does not use listeners(), so no side effect of creating _events[type]
+      if (!this._events[type]) return this;
+      handlers = this._events[type];
+      leafs.push({_listeners:handlers});
+    }
+
+    for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
+      var leaf = leafs[iLeaf];
+      handlers = leaf._listeners;
+      if (isArray(handlers)) {
+
+        var position = -1;
+
+        for (var i = 0, length = handlers.length; i < length; i++) {
+          if (handlers[i] === listener ||
+            (handlers[i].listener && handlers[i].listener === listener) ||
+            (handlers[i]._origin && handlers[i]._origin === listener)) {
+            position = i;
+            break;
+          }
+        }
+
+        if (position < 0) {
+          continue;
+        }
+
+        if(this.wildcard) {
+          leaf._listeners.splice(position, 1);
+        }
+        else {
+          this._events[type].splice(position, 1);
+        }
+
+        if (handlers.length === 0) {
+          if(this.wildcard) {
+            delete leaf._listeners;
+          }
+          else {
+            delete this._events[type];
+          }
+        }
+        return this;
+      }
+      else if (handlers === listener ||
+        (handlers.listener && handlers.listener === listener) ||
+        (handlers._origin && handlers._origin === listener)) {
+        if(this.wildcard) {
+          delete leaf._listeners;
+        }
+        else {
+          delete this._events[type];
+        }
+      }
+    }
+
+    return this;
+  };
+
+  EventEmitter.prototype.offAny = function(fn) {
+    var i = 0, l = 0, fns;
+    if (fn && this._all && this._all.length > 0) {
+      fns = this._all;
+      for(i = 0, l = fns.length; i < l; i++) {
+        if(fn === fns[i]) {
+          fns.splice(i, 1);
+          return this;
+        }
+      }
+    } else {
+      this._all = [];
+    }
+    return this;
+  };
+
+  EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
+
+  EventEmitter.prototype.removeAllListeners = function(type) {
+    if (arguments.length === 0) {
+      !this._events || init.call(this);
+      return this;
+    }
+
+    if(this.wildcard) {
+      var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+      var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
+
+      for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
+        var leaf = leafs[iLeaf];
+        leaf._listeners = null;
+      }
+    }
+    else {
+      if (!this._events[type]) return this;
+      this._events[type] = null;
+    }
+    return this;
+  };
+
+  EventEmitter.prototype.listeners = function(type) {
+    if(this.wildcard) {
+      var handlers = [];
+      var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+      searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
+      return handlers;
+    }
+
+    this._events || init.call(this);
+
+    if (!this._events[type]) this._events[type] = [];
+    if (!isArray(this._events[type])) {
+      this._events[type] = [this._events[type]];
+    }
+    return this._events[type];
+  };
+
+  EventEmitter.prototype.listenersAny = function() {
+
+    if(this._all) {
+      return this._all;
+    }
+    else {
+      return [];
+    }
+
+  };
+
+  if (typeof define === 'function' && define.amd) {
+     // AMD. Register as an anonymous module.
+    define(function() {
+      return EventEmitter;
+    });
+  } else if (typeof exports === 'object') {
+    // CommonJS
+    exports.EventEmitter2 = EventEmitter;
+  }
+  else {
+    // Browser global.
+    window.EventEmitter2 = EventEmitter;
+  }
+}();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/eventemitter2/package.json
new file mode 100755 (executable)
index 0000000..3e31ab0
--- /dev/null
@@ -0,0 +1,83 @@
+{
+  "name": "eventemitter2",
+  "version": "0.4.14",
+  "description": "A Node.js event emitter implementation with namespaces, wildcards, TTL and browser support.",
+  "keywords": [
+    "event",
+    "events",
+    "emitter",
+    "eventemitter"
+  ],
+  "author": {
+    "name": "hij1nx",
+    "email": "paolo@async.ly"
+  },
+  "contributors": [
+    {
+      "name": "Eric Elliott"
+    },
+    {
+      "name": "Charlie Robbins",
+      "email": "charlie@nodejitsu.com"
+    },
+    {
+      "name": "Jameson Lee",
+      "email": "jameson@nodejitsu.com"
+    },
+    {
+      "name": "Jeroen van Duffelen",
+      "email": "jvduf@nodejitsu.com"
+    },
+    {
+      "name": "Fedor Indutny",
+      "email": "fedor.indutny@gmail.com"
+    }
+  ],
+  "license": "MIT",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/hij1nx/EventEmitter2.git"
+  },
+  "devDependencies": {
+    "nodeunit": "*",
+    "benchmark": ">= 0.2.2"
+  },
+  "main": "./lib/eventemitter2.js",
+  "scripts": {
+    "test": "nodeunit test/simple/ && nodeunit test/wildcardEvents/",
+    "benchmark": "node test/perf/benchmark.js"
+  },
+  "files": [
+    "lib/eventemitter2.js",
+    "index.js"
+  ],
+  "bugs": {
+    "url": "https://github.com/hij1nx/EventEmitter2/issues"
+  },
+  "homepage": "https://github.com/hij1nx/EventEmitter2",
+  "_id": "eventemitter2@0.4.14",
+  "_shasum": "8f61b75cde012b2e9eb284d4545583b5643b61ab",
+  "_from": "eventemitter2@^0.4.13",
+  "_npmVersion": "1.4.7",
+  "_npmUser": {
+    "name": "jasonkuhrt",
+    "email": "jasonkuhrt@me.com"
+  },
+  "maintainers": [
+    {
+      "name": "hij1nx",
+      "email": "hij1nx@me.com"
+    },
+    {
+      "name": "jasonkuhrt",
+      "email": "jasonkuhrt@me.com"
+    }
+  ],
+  "dist": {
+    "shasum": "8f61b75cde012b2e9eb284d4545583b5643b61ab",
+    "tarball": "http://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/History.md
new file mode 100755 (executable)
index 0000000..ab0ec80
--- /dev/null
@@ -0,0 +1,1133 @@
+
+3.2.3 / 2013-05-07 
+==================
+
+  * update connect / qs
+
+3.2.2 / 2013-05-03 
+==================
+
+  * update qs
+
+3.2.1 / 2013-04-29 
+==================
+
+  * add app.VERB() paths array deprecation warning
+  * update connect
+  * update qs and remove all ~ semver crap
+  * fix: accept number as value of Signed Cookie
+
+3.2.0 / 2013-04-15 
+==================
+
+  * add "view" constructor setting to override view behaviour
+  * add req.acceptsEncoding(name)
+  * add req.acceptedEncodings
+  * revert cookie signature change causing session race conditions
+  * fix sorting of Accept values of the same quality  
+
+3.1.2 / 2013-04-12 
+==================
+
+  * add support for custom Accept parameters
+  * update cookie-signature
+
+3.1.1 / 2013-04-01 
+==================
+
+  * add X-Forwarded-Host support to `req.host`
+  * fix relative redirects  
+  * update mkdirp 
+  * update buffer-crc32
+  * remove legacy app.configure() method from app template.
+
+3.1.0 / 2013-01-25
+==================
+
+  * add support for leading "." in "view engine" setting
+  * add array support to `res.set()`
+  * add node 0.8.x to travis.yml
+  * add "subdomain offset" setting for tweaking `req.subdomains`
+  * add `res.location(url)` implementing `res.redirect()`-like setting of Location
+  * use app.get() for x-powered-by setting for inheritance
+  * fix colons in passwords for `req.auth`
+
+3.0.6 / 2013-01-04
+==================
+
+  * add http verb methods to Router
+  * update connect
+  * fix mangling of the `res.cookie()` options object
+  * fix jsonp whitespace escape. Closes #1132
+
+3.0.5 / 2012-12-19
+==================
+
+  * add throwing when a non-function is passed to a route
+  * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses
+  * revert "add 'etag' option"
+
+3.0.4 / 2012-12-05
+==================
+
+  * add 'etag' option to disable `res.send()` Etags
+  * add escaping of urls in text/plain in `res.redirect()`
+    for old browsers interpreting as html
+  * change crc32 module for a more liberal license
+  * update connect
+
+3.0.3 / 2012-11-13
+==================
+
+  * update connect
+  * update cookie module
+  * fix cookie max-age
+
+3.0.2 / 2012-11-08
+==================
+
+  * add OPTIONS to cors example. Closes #1398
+  * fix route chaining regression. Closes #1397
+
+3.0.1 / 2012-11-01
+==================
+
+  * update connect
+
+3.0.0 / 2012-10-23
+==================
+
+  * add `make clean`
+  * add "Basic" check to req.auth
+  * add `req.auth` test coverage
+  * add cb && cb(payload) to `res.jsonp()`. Closes #1374
+  * add backwards compat for `res.redirect()` status. Closes #1336
+  * add support for `res.json()` to retain previously defined Content-Types. Closes #1349
+  * update connect
+  * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382
+  * remove non-primitive string support for `res.send()`
+  * fix view-locals example. Closes #1370
+  * fix route-separation example
+
+3.0.0rc5 / 2012-09-18
+==================
+
+  * update connect
+  * add redis search example
+  * add static-files example
+  * add "x-powered-by" setting (`app.disable('x-powered-by')`)
+  * add "application/octet-stream" redirect Accept test case. Closes #1317
+
+3.0.0rc4 / 2012-08-30
+==================
+
+  * add `res.jsonp()`. Closes #1307
+  * add "verbose errors" option to error-pages example
+  * add another route example to express(1) so people are not so confused
+  * add redis online user activity tracking example
+  * update connect dep
+  * fix etag quoting. Closes #1310
+  * fix error-pages 404 status
+  * fix jsonp callback char restrictions
+  * remove old OPTIONS default response
+
+3.0.0rc3 / 2012-08-13
+==================
+
+  * update connect dep
+  * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds]
+  * fix `res.render()` clobbering of "locals"
+
+3.0.0rc2 / 2012-08-03
+==================
+
+  * add CORS example
+  * update connect dep
+  * deprecate `.createServer()` & remove old stale examples
+  * fix: escape `res.redirect()` link
+  * fix vhost example
+
+3.0.0rc1 / 2012-07-24
+==================
+
+  * add more examples to view-locals
+  * add scheme-relative redirects (`res.redirect("//foo.com")`) support
+  * update cookie dep
+  * update connect dep
+  * update send dep
+  * fix `express(1)` -h flag, use -H for hogan. Closes #1245
+  * fix `res.sendfile()` socket error handling regression
+
+3.0.0beta7 / 2012-07-16
+==================
+
+  * update connect dep for `send()` root normalization regression
+
+3.0.0beta6 / 2012-07-13
+==================
+
+  * add `err.view` property for view errors. Closes #1226
+  * add "jsonp callback name" setting
+  * add support for "/foo/:bar*" non-greedy matches
+  * change `res.sendfile()` to use `send()` module
+  * change `res.send` to use "response-send" module
+  * remove `app.locals.use` and `res.locals.use`, use regular middleware
+
+3.0.0beta5 / 2012-07-03
+==================
+
+  * add "make check" support
+  * add route-map example
+  * add `res.json(obj, status)` support back for BC
+  * add "methods" dep, remove internal methods module
+  * update connect dep
+  * update auth example to utilize cores pbkdf2
+  * updated tests to use "supertest"
+
+3.0.0beta4 / 2012-06-25
+==================
+
+  * Added `req.auth`
+  * Added `req.range(size)`
+  * Added `res.links(obj)`
+  * Added `res.send(body, status)` support back for backwards compat
+  * Added `.default()` support to `res.format()`
+  * Added 2xx / 304 check to `req.fresh`
+  * Revert "Added + support to the router"
+  * Fixed `res.send()` freshness check, respect res.statusCode
+
+3.0.0beta3 / 2012-06-15
+==================
+
+  * Added hogan `--hjs` to express(1) [nullfirm]
+  * Added another example to content-negotiation
+  * Added `fresh` dep
+  * Changed: `res.send()` always checks freshness
+  * Fixed: expose connects mime module. Cloases #1165
+
+3.0.0beta2 / 2012-06-06
+==================
+
+  * Added `+` support to the router
+  * Added `req.host`
+  * Changed `req.param()` to check route first
+  * Update connect dep
+
+3.0.0beta1 / 2012-06-01
+==================
+
+  * Added `res.format()` callback to override default 406 behaviour
+  * Fixed `res.redirect()` 406. Closes #1154
+
+3.0.0alpha5 / 2012-05-30
+==================
+
+  * Added `req.ip`
+  * Added `{ signed: true }` option to `res.cookie()`
+  * Removed `res.signedCookie()`
+  * Changed: dont reverse `req.ips`
+  * Fixed "trust proxy" setting check for `req.ips`
+
+3.0.0alpha4 / 2012-05-09
+==================
+
+  * Added: allow `[]` in jsonp callback. Closes #1128
+  * Added `PORT` env var support in generated template. Closes #1118 [benatkin]
+  * Updated: connect 2.2.2
+
+3.0.0alpha3 / 2012-05-04
+==================
+
+  * Added public `app.routes`. Closes #887
+  * Added _view-locals_ example
+  * Added _mvc_ example
+  * Added `res.locals.use()`. Closes #1120
+  * Added conditional-GET support to `res.send()`
+  * Added: coerce `res.set()` values to strings
+  * Changed: moved `static()` in generated apps below router
+  * Changed: `res.send()` only set ETag when not previously set
+  * Changed connect 2.2.1 dep
+  * Changed: `make test` now runs unit / acceptance tests
+  * Fixed req/res proto inheritance
+
+3.0.0alpha2 / 2012-04-26
+==================
+
+  * Added `make benchmark` back
+  * Added `res.send()` support for `String` objects
+  * Added client-side data exposing example
+  * Added `res.header()` and `req.header()` aliases for BC
+  * Added `express.createServer()` for BC
+  * Perf: memoize parsed urls
+  * Perf: connect 2.2.0 dep
+  * Changed: make `expressInit()` middleware self-aware
+  * Fixed: use app.get() for all core settings
+  * Fixed redis session example
+  * Fixed session example. Closes #1105
+  * Fixed generated express dep. Closes #1078
+
+3.0.0alpha1 / 2012-04-15
+==================
+
+  * Added `app.locals.use(callback)`
+  * Added `app.locals` object
+  * Added `app.locals(obj)`
+  * Added `res.locals` object
+  * Added `res.locals(obj)`
+  * Added `res.format()` for content-negotiation
+  * Added `app.engine()`
+  * Added `res.cookie()` JSON cookie support
+  * Added "trust proxy" setting
+  * Added `req.subdomains`
+  * Added `req.protocol`
+  * Added `req.secure`
+  * Added `req.path`
+  * Added `req.ips`
+  * Added `req.fresh`
+  * Added `req.stale`
+  * Added comma-delmited / array support for `req.accepts()`
+  * Added debug instrumentation
+  * Added `res.set(obj)`
+  * Added `res.set(field, value)`
+  * Added `res.get(field)`
+  * Added `app.get(setting)`. Closes #842
+  * Added `req.acceptsLanguage()`
+  * Added `req.acceptsCharset()`
+  * Added `req.accepted`
+  * Added `req.acceptedLanguages`
+  * Added `req.acceptedCharsets`
+  * Added "json replacer" setting
+  * Added "json spaces" setting
+  * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92
+  * Added `--less` support to express(1)
+  * Added `express.response` prototype
+  * Added `express.request` prototype
+  * Added `express.application` prototype
+  * Added `app.path()`
+  * Added `app.render()`
+  * Added `res.type()` to replace `res.contentType()`
+  * Changed: `res.redirect()` to add relative support
+  * Changed: enable "jsonp callback" by default
+  * Changed: renamed "case sensitive routes" to "case sensitive routing"
+  * Rewrite of all tests with mocha
+  * Removed "root" setting
+  * Removed `res.redirect('home')` support
+  * Removed `req.notify()`
+  * Removed `app.register()`
+  * Removed `app.redirect()`
+  * Removed `app.is()`
+  * Removed `app.helpers()`
+  * Removed `app.dynamicHelpers()`
+  * Fixed `res.sendfile()` with non-GET. Closes #723
+  * Fixed express(1) public dir for windows. Closes #866
+
+2.5.9/ 2012-04-02
+==================
+
+  * Added support for PURGE request method [pbuyle]
+  * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki]
+
+2.5.8 / 2012-02-08
+==================
+
+  * Update mkdirp dep. Closes #991
+
+2.5.7 / 2012-02-06
+==================
+
+  * Fixed `app.all` duplicate DELETE requests [mscdex]
+
+2.5.6 / 2012-01-13
+==================
+
+  * Updated hamljs dev dep. Closes #953
+
+2.5.5 / 2012-01-08
+==================
+
+  * Fixed: set `filename` on cached templates [matthewleon]
+
+2.5.4 / 2012-01-02
+==================
+
+  * Fixed `express(1)` eol on 0.4.x. Closes #947
+
+2.5.3 / 2011-12-30
+==================
+
+  * Fixed `req.is()` when a charset is present
+
+2.5.2 / 2011-12-10
+==================
+
+  * Fixed: express(1) LF -> CRLF for windows
+
+2.5.1 / 2011-11-17
+==================
+
+  * Changed: updated connect to 1.8.x
+  * Removed sass.js support from express(1)
+
+2.5.0 / 2011-10-24
+==================
+
+  * Added ./routes dir for generated app by default
+  * Added npm install reminder to express(1) app gen
+  * Added 0.5.x support
+  * Removed `make test-cov` since it wont work with node 0.5.x
+  * Fixed express(1) public dir for windows. Closes #866
+
+2.4.7 / 2011-10-05
+==================
+
+  * Added mkdirp to express(1). Closes #795
+  * Added simple _json-config_ example
+  * Added  shorthand for the parsed request's pathname via `req.path`
+  * Changed connect dep to 1.7.x to fix npm issue...
+  * Fixed `res.redirect()` __HEAD__ support. [reported by xerox]
+  * Fixed `req.flash()`, only escape args
+  * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie]
+
+2.4.6 / 2011-08-22
+==================
+
+  * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode]
+
+2.4.5 / 2011-08-19
+==================
+
+  * Added support for routes to handle errors. Closes #809
+  * Added `app.routes.all()`. Closes #803
+  * Added "basepath" setting to work in conjunction with reverse proxies etc.
+  * Refactored `Route` to use a single array of callbacks
+  * Added support for multiple callbacks for `app.param()`. Closes #801
+Closes #805
+  * Changed: removed .call(self) for route callbacks
+  * Dependency: `qs >= 0.3.1`
+  * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808
+
+2.4.4 / 2011-08-05
+==================
+
+  * Fixed `res.header()` intention of a set, even when `undefined`
+  * Fixed `*`, value no longer required
+  * Fixed `res.send(204)` support. Closes #771
+
+2.4.3 / 2011-07-14
+==================
+
+  * Added docs for `status` option special-case. Closes #739
+  * Fixed `options.filename`, exposing the view path to template engines
+
+2.4.2. / 2011-07-06
+==================
+
+  * Revert "removed jsonp stripping" for XSS
+
+2.4.1 / 2011-07-06
+==================
+
+  * Added `res.json()` JSONP support. Closes #737
+  * Added _extending-templates_ example. Closes #730
+  * Added "strict routing" setting for trailing slashes
+  * Added support for multiple envs in `app.configure()` calls. Closes #735
+  * Changed: `res.send()` using `res.json()`
+  * Changed: when cookie `path === null` don't default it
+  * Changed; default cookie path to "home" setting. Closes #731
+  * Removed _pids/logs_ creation from express(1)
+
+2.4.0 / 2011-06-28
+==================
+
+  * Added chainable `res.status(code)`
+  * Added `res.json()`, an explicit version of `res.send(obj)`
+  * Added simple web-service example
+
+2.3.12 / 2011-06-22
+==================
+
+  * \#express is now on freenode! come join!
+  * Added `req.get(field, param)`
+  * Added links to Japanese documentation, thanks @hideyukisaito!
+  * Added; the `express(1)` generated app outputs the env
+  * Added `content-negotiation` example
+  * Dependency: connect >= 1.5.1 < 2.0.0
+  * Fixed view layout bug. Closes #720
+  * Fixed; ignore body on 304. Closes #701
+
+2.3.11 / 2011-06-04
+==================
+
+  * Added `npm test`
+  * Removed generation of dummy test file from `express(1)`
+  * Fixed; `express(1)` adds express as a dep
+  * Fixed; prune on `prepublish`
+
+2.3.10 / 2011-05-27
+==================
+
+  * Added `req.route`, exposing the current route
+  * Added _package.json_ generation support to `express(1)`
+  * Fixed call to `app.param()` function for optional params. Closes #682
+
+2.3.9 / 2011-05-25
+==================
+
+  * Fixed bug-ish with `../' in `res.partial()` calls
+
+2.3.8 / 2011-05-24
+==================
+
+  * Fixed `app.options()`
+
+2.3.7 / 2011-05-23
+==================
+
+  * Added route `Collection`, ex: `app.get('/user/:id').remove();`
+  * Added support for `app.param(fn)` to define param logic
+  * Removed `app.param()` support for callback with return value
+  * Removed module.parent check from express(1) generated app. Closes #670
+  * Refactored router. Closes #639
+
+2.3.6 / 2011-05-20
+==================
+
+  * Changed; using devDependencies instead of git submodules
+  * Fixed redis session example
+  * Fixed markdown example
+  * Fixed view caching, should not be enabled in development
+
+2.3.5 / 2011-05-20
+==================
+
+  * Added export `.view` as alias for `.View`
+
+2.3.4 / 2011-05-08
+==================
+
+  * Added `./examples/say`
+  * Fixed `res.sendfile()` bug preventing the transfer of files with spaces
+
+2.3.3 / 2011-05-03
+==================
+
+  * Added "case sensitive routes" option.
+  * Changed; split methods supported per rfc [slaskis]
+  * Fixed route-specific middleware when using the same callback function several times
+
+2.3.2 / 2011-04-27
+==================
+
+  * Fixed view hints
+
+2.3.1 / 2011-04-26
+==================
+
+  * Added `app.match()` as `app.match.all()`
+  * Added `app.lookup()` as `app.lookup.all()`
+  * Added `app.remove()` for `app.remove.all()`
+  * Added `app.remove.VERB()`
+  * Fixed template caching collision issue. Closes #644
+  * Moved router over from connect and started refactor
+
+2.3.0 / 2011-04-25
+==================
+
+  * Added options support to `res.clearCookie()`
+  * Added `res.helpers()` as alias of `res.locals()`
+  * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel   * Dependency `connect >= 1.4.0`
+  * Changed; auto set Content-Type in res.attachement [Aaron Heckmann]
+  * Renamed "cache views" to "view cache". Closes #628
+  * Fixed caching of views when using several apps. Closes #637
+  * Fixed gotcha invoking `app.param()` callbacks once per route middleware.
+Closes #638
+  * Fixed partial lookup precedence. Closes #631
+Shaw]
+
+2.2.2 / 2011-04-12
+==================
+
+  * Added second callback support for `res.download()` connection errors
+  * Fixed `filename` option passing to template engine
+
+2.2.1 / 2011-04-04
+==================
+
+  * Added `layout(path)` helper to change the layout within a view. Closes #610
+  * Fixed `partial()` collection object support.
+    Previously only anything with `.length` would work.
+    When `.length` is present one must still be aware of holes,
+    however now `{ collection: {foo: 'bar'}}` is valid, exposes
+    `keyInCollection` and `keysInCollection`.
+
+  * Performance improved with better view caching
+  * Removed `request` and `response` locals
+  * Changed; errorHandler page title is now `Express` instead of `Connect`
+
+2.2.0 / 2011-03-30
+==================
+
+  * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606
+  * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606
+  * Added `app.VERB(path)` as alias of `app.lookup.VERB()`.
+  * Dependency `connect >= 1.2.0`
+
+2.1.1 / 2011-03-29
+==================
+
+  * Added; expose `err.view` object when failing to locate a view
+  * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann]
+  * Fixed; `res.send(undefined)` responds with 204 [aheckmann]
+
+2.1.0 / 2011-03-24
+==================
+
+  * Added `<root>/_?<name>` partial lookup support. Closes #447
+  * Added `request`, `response`, and `app` local variables
+  * Added `settings` local variable, containing the app's settings
+  * Added `req.flash()` exception if `req.session` is not available
+  * Added `res.send(bool)` support (json response)
+  * Fixed stylus example for latest version
+  * Fixed; wrap try/catch around `res.render()`
+
+2.0.0 / 2011-03-17
+==================
+
+  * Fixed up index view path alternative.
+  * Changed; `res.locals()` without object returns the locals
+
+2.0.0rc3 / 2011-03-17
+==================
+
+  * Added `res.locals(obj)` to compliment `res.local(key, val)`
+  * Added `res.partial()` callback support
+  * Fixed recursive error reporting issue in `res.render()`
+
+2.0.0rc2 / 2011-03-17
+==================
+
+  * Changed; `partial()` "locals" are now optional
+  * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01]
+  * Fixed .filename view engine option [reported by drudge]
+  * Fixed blog example
+  * Fixed `{req,res}.app` reference when mounting [Ben Weaver]
+
+2.0.0rc / 2011-03-14
+==================
+
+  * Fixed; expose `HTTPSServer` constructor
+  * Fixed express(1) default test charset. Closes #579 [reported by secoif]
+  * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP]
+
+2.0.0beta3 / 2011-03-09
+==================
+
+  * Added support for `res.contentType()` literal
+    The original `res.contentType('.json')`,
+    `res.contentType('application/json')`, and `res.contentType('json')`
+    will work now.
+  * Added `res.render()` status option support back
+  * Added charset option for `res.render()`
+  * Added `.charset` support (via connect 1.0.4)
+  * Added view resolution hints when in development and a lookup fails
+  * Added layout lookup support relative to the page view.
+    For example while rendering `./views/user/index.jade` if you create
+    `./views/user/layout.jade` it will be used in favour of the root layout.
+  * Fixed `res.redirect()`. RFC states absolute url [reported by unlink]
+  * Fixed; default `res.send()` string charset to utf8
+  * Removed `Partial` constructor (not currently used)
+
+2.0.0beta2 / 2011-03-07
+==================
+
+  * Added res.render() `.locals` support back to aid in migration process
+  * Fixed flash example
+
+2.0.0beta / 2011-03-03
+==================
+
+  * Added HTTPS support
+  * Added `res.cookie()` maxAge support
+  * Added `req.header()` _Referrer_ / _Referer_ special-case, either works
+  * Added mount support for `res.redirect()`, now respects the mount-point
+  * Added `union()` util, taking place of `merge(clone())` combo
+  * Added stylus support to express(1) generated app
+  * Added secret to session middleware used in examples and generated app
+  * Added `res.local(name, val)` for progressive view locals
+  * Added default param support to `req.param(name, default)`
+  * Added `app.disabled()` and `app.enabled()`
+  * Added `app.register()` support for omitting leading ".", either works
+  * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539
+  * Added `app.param()` to map route params to async/sync logic
+  * Added; aliased `app.helpers()` as `app.locals()`. Closes #481
+  * Added extname with no leading "." support to `res.contentType()`
+  * Added `cache views` setting, defaulting to enabled in "production" env
+  * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_.
+  * Added `req.accepts()` support for extensions
+  * Changed; `res.download()` and `res.sendfile()` now utilize Connect's
+    static file server `connect.static.send()`.
+  * Changed; replaced `connect.utils.mime()` with npm _mime_ module
+  * Changed; allow `req.query` to be pre-defined (via middleware or other parent
+  * Changed view partial resolution, now relative to parent view
+  * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`.
+  * Fixed `req.param()` bug returning Array.prototype methods. Closes #552
+  * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()`
+  * Fixed; using _qs_ module instead of _querystring_
+  * Fixed; strip unsafe chars from jsonp callbacks
+  * Removed "stream threshold" setting
+
+1.0.8 / 2011-03-01
+==================
+
+  * Allow `req.query` to be pre-defined (via middleware or other parent app)
+  * "connect": ">= 0.5.0 < 1.0.0". Closes #547
+  * Removed the long deprecated __EXPRESS_ENV__ support
+
+1.0.7 / 2011-02-07
+==================
+
+  * Fixed `render()` setting inheritance.
+    Mounted apps would not inherit "view engine"
+
+1.0.6 / 2011-02-07
+==================
+
+  * Fixed `view engine` setting bug when period is in dirname
+
+1.0.5 / 2011-02-05
+==================
+
+  * Added secret to generated app `session()` call
+
+1.0.4 / 2011-02-05
+==================
+
+  * Added `qs` dependency to _package.json_
+  * Fixed namespaced `require()`s for latest connect support
+
+1.0.3 / 2011-01-13
+==================
+
+  * Remove unsafe characters from JSONP callback names [Ryan Grove]
+
+1.0.2 / 2011-01-10
+==================
+
+  * Removed nested require, using `connect.router`
+
+1.0.1 / 2010-12-29
+==================
+
+  * Fixed for middleware stacked via `createServer()`
+    previously the `foo` middleware passed to `createServer(foo)`
+    would not have access to Express methods such as `res.send()`
+    or props like `req.query` etc.
+
+1.0.0 / 2010-11-16
+==================
+
+  * Added; deduce partial object names from the last segment.
+    For example by default `partial('forum/post', postObject)` will
+    give you the _post_ object, providing a meaningful default.
+  * Added http status code string representation to `res.redirect()` body
+  * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__.
+  * Added `req.is()` to aid in content negotiation
+  * Added partial local inheritance [suggested by masylum]. Closes #102
+    providing access to parent template locals.
+  * Added _-s, --session[s]_ flag to express(1) to add session related middleware
+  * Added _--template_ flag to express(1) to specify the
+    template engine to use.
+  * Added _--css_ flag to express(1) to specify the
+    stylesheet engine to use (or just plain css by default).
+  * Added `app.all()` support [thanks aheckmann]
+  * Added partial direct object support.
+    You may now `partial('user', user)` providing the "user" local,
+    vs previously `partial('user', { object: user })`.
+  * Added _route-separation_ example since many people question ways
+    to do this with CommonJS modules. Also view the _blog_ example for
+    an alternative.
+  * Performance; caching view path derived partial object names
+  * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454
+  * Fixed jsonp support; _text/javascript_ as per mailinglist discussion
+
+1.0.0rc4 / 2010-10-14
+==================
+
+  * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0
+  * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware))
+  * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass]
+  * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass]
+  * Added `partial()` support for array-like collections. Closes #434
+  * Added support for swappable querystring parsers
+  * Added session usage docs. Closes #443
+  * Added dynamic helper caching. Closes #439 [suggested by maritz]
+  * Added authentication example
+  * Added basic Range support to `res.sendfile()` (and `res.download()` etc)
+  * Changed; `express(1)` generated app using 2 spaces instead of 4
+  * Default env to "development" again [aheckmann]
+  * Removed _context_ option is no more, use "scope"
+  * Fixed; exposing _./support_ libs to examples so they can run without installs
+  * Fixed mvc example
+
+1.0.0rc3 / 2010-09-20
+==================
+
+  * Added confirmation for `express(1)` app generation. Closes #391
+  * Added extending of flash formatters via `app.flashFormatters`
+  * Added flash formatter support. Closes #411
+  * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold"
+  * Added _stream threshold_ setting for `res.sendfile()`
+  * Added `res.send()` __HEAD__ support
+  * Added `res.clearCookie()`
+  * Added `res.cookie()`
+  * Added `res.render()` headers option
+  * Added `res.redirect()` response bodies
+  * Added `res.render()` status option support. Closes #425 [thanks aheckmann]
+  * Fixed `res.sendfile()` responding with 403 on malicious path
+  * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_
+  * Fixed; mounted apps settings now inherit from parent app [aheckmann]
+  * Fixed; stripping Content-Length / Content-Type when 204
+  * Fixed `res.send()` 204. Closes #419
+  * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402
+  * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo]
+
+
+1.0.0rc2 / 2010-08-17
+==================
+
+  * Added `app.register()` for template engine mapping. Closes #390
+  * Added `res.render()` callback support as second argument (no options)
+  * Added callback support to `res.download()`
+  * Added callback support for `res.sendfile()`
+  * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()`
+  * Added "partials" setting to docs
+  * Added default expresso tests to `express(1)` generated app. Closes #384
+  * Fixed `res.sendfile()` error handling, defer via `next()`
+  * Fixed `res.render()` callback when a layout is used [thanks guillermo]
+  * Fixed; `make install` creating ~/.node_libraries when not present
+  * Fixed issue preventing error handlers from being defined anywhere. Closes #387
+
+1.0.0rc / 2010-07-28
+==================
+
+  * Added mounted hook. Closes #369
+  * Added connect dependency to _package.json_
+
+  * Removed "reload views" setting and support code
+    development env never caches, production always caches.
+
+  * Removed _param_ in route callbacks, signature is now
+    simply (req, res, next), previously (req, res, params, next).
+    Use _req.params_ for path captures, _req.query_ for GET params.
+
+  * Fixed "home" setting
+  * Fixed middleware/router precedence issue. Closes #366
+  * Fixed; _configure()_ callbacks called immediately. Closes #368
+
+1.0.0beta2 / 2010-07-23
+==================
+
+  * Added more examples
+  * Added; exporting `Server` constructor
+  * Added `Server#helpers()` for view locals
+  * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349
+  * Added support for absolute view paths
+  * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363
+  * Added Guillermo Rauch to the contributor list
+  * Added support for "as" for non-collection partials. Closes #341
+  * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf]
+  * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo]
+  * Fixed instanceof `Array` checks, now `Array.isArray()`
+  * Fixed express(1) expansion of public dirs. Closes #348
+  * Fixed middleware precedence. Closes #345
+  * Fixed view watcher, now async [thanks aheckmann]
+
+1.0.0beta / 2010-07-15
+==================
+
+  * Re-write
+    - much faster
+    - much lighter
+    - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs
+
+0.14.0 / 2010-06-15
+==================
+
+  * Utilize relative requires
+  * Added Static bufferSize option [aheckmann]
+  * Fixed caching of view and partial subdirectories [aheckmann]
+  * Fixed mime.type() comments now that ".ext" is not supported
+  * Updated haml submodule
+  * Updated class submodule
+  * Removed bin/express
+
+0.13.0 / 2010-06-01
+==================
+
+  * Added node v0.1.97 compatibility
+  * Added support for deleting cookies via Request#cookie('key', null)
+  * Updated haml submodule
+  * Fixed not-found page, now using using charset utf-8
+  * Fixed show-exceptions page, now using using charset utf-8
+  * Fixed view support due to fs.readFile Buffers
+  * Changed; mime.type() no longer accepts ".type" due to node extname() changes
+
+0.12.0 / 2010-05-22
+==================
+
+  * Added node v0.1.96 compatibility
+  * Added view `helpers` export which act as additional local variables
+  * Updated haml submodule
+  * Changed ETag; removed inode, modified time only
+  * Fixed LF to CRLF for setting multiple cookies
+  * Fixed cookie complation; values are now urlencoded
+  * Fixed cookies parsing; accepts quoted values and url escaped cookies
+
+0.11.0 / 2010-05-06
+==================
+
+  * Added support for layouts using different engines
+    - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' })
+    - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml'
+    - this.render('page.html.haml', { layout: false }) // no layout
+  * Updated ext submodule
+  * Updated haml submodule
+  * Fixed EJS partial support by passing along the context. Issue #307
+
+0.10.1 / 2010-05-03
+==================
+
+  * Fixed binary uploads.
+
+0.10.0 / 2010-04-30
+==================
+
+  * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s
+    encoding is set to 'utf8' or 'utf-8'.
+  * Added "encoding" option to Request#render(). Closes #299
+  * Added "dump exceptions" setting, which is enabled by default.
+  * Added simple ejs template engine support
+  * Added error reponse support for text/plain, application/json. Closes #297
+  * Added callback function param to Request#error()
+  * Added Request#sendHead()
+  * Added Request#stream()
+  * Added support for Request#respond(304, null) for empty response bodies
+  * Added ETag support to Request#sendfile()
+  * Added options to Request#sendfile(), passed to fs.createReadStream()
+  * Added filename arg to Request#download()
+  * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request
+  * Performance enhanced by preventing several calls to toLowerCase() in Router#match()
+  * Changed; Request#sendfile() now streams
+  * Changed; Renamed Request#halt() to Request#respond(). Closes #289
+  * Changed; Using sys.inspect() instead of JSON.encode() for error output
+  * Changed; run() returns the http.Server instance. Closes #298
+  * Changed; Defaulting Server#host to null (INADDR_ANY)
+  * Changed; Logger "common" format scale of 0.4f
+  * Removed Logger "request" format
+  * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found
+  * Fixed several issues with http client
+  * Fixed Logger Content-Length output
+  * Fixed bug preventing Opera from retaining the generated session id. Closes #292
+
+0.9.0 / 2010-04-14
+==================
+
+  * Added DSL level error() route support
+  * Added DSL level notFound() route support
+  * Added Request#error()
+  * Added Request#notFound()
+  * Added Request#render() callback function. Closes #258
+  * Added "max upload size" setting
+  * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254
+  * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js
+  * Added callback function support to Request#halt() as 3rd/4th arg
+  * Added preprocessing of route param wildcards using param(). Closes #251
+  * Added view partial support (with collections etc)
+  * Fixed bug preventing falsey params (such as ?page=0). Closes #286
+  * Fixed setting of multiple cookies. Closes #199
+  * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml)
+  * Changed; session cookie is now httpOnly
+  * Changed; Request is no longer global
+  * Changed; Event is no longer global
+  * Changed; "sys" module is no longer global
+  * Changed; moved Request#download to Static plugin where it belongs
+  * Changed; Request instance created before body parsing. Closes #262
+  * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253
+  * Changed; Pre-caching view partials in memory when "cache view partials" is enabled
+  * Updated support to node --version 0.1.90
+  * Updated dependencies
+  * Removed set("session cookie") in favour of use(Session, { cookie: { ... }})
+  * Removed utils.mixin(); use Object#mergeDeep()
+
+0.8.0 / 2010-03-19
+==================
+
+  * Added coffeescript example app. Closes #242
+  * Changed; cache api now async friendly. Closes #240
+  * Removed deprecated 'express/static' support. Use 'express/plugins/static'
+
+0.7.6 / 2010-03-19
+==================
+
+  * Added Request#isXHR. Closes #229
+  * Added `make install` (for the executable)
+  * Added `express` executable for setting up simple app templates
+  * Added "GET /public/*" to Static plugin, defaulting to <root>/public
+  * Added Static plugin
+  * Fixed; Request#render() only calls cache.get() once
+  * Fixed; Namespacing View caches with "view:"
+  * Fixed; Namespacing Static caches with "static:"
+  * Fixed; Both example apps now use the Static plugin
+  * Fixed set("views"). Closes #239
+  * Fixed missing space for combined log format
+  * Deprecated Request#sendfile() and 'express/static'
+  * Removed Server#running
+
+0.7.5 / 2010-03-16
+==================
+
+  * Added Request#flash() support without args, now returns all flashes
+  * Updated ext submodule
+
+0.7.4 / 2010-03-16
+==================
+
+  * Fixed session reaper
+  * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft)
+
+0.7.3 / 2010-03-16
+==================
+
+  * Added package.json
+  * Fixed requiring of haml / sass due to kiwi removal
+
+0.7.2 / 2010-03-16
+==================
+
+  * Fixed GIT submodules (HAH!)
+
+0.7.1 / 2010-03-16
+==================
+
+  * Changed; Express now using submodules again until a PM is adopted
+  * Changed; chat example using millisecond conversions from ext
+
+0.7.0 / 2010-03-15
+==================
+
+  * Added Request#pass() support (finds the next matching route, or the given path)
+  * Added Logger plugin (default "common" format replaces CommonLogger)
+  * Removed Profiler plugin
+  * Removed CommonLogger plugin
+
+0.6.0 / 2010-03-11
+==================
+
+  * Added seed.yml for kiwi package management support
+  * Added HTTP client query string support when method is GET. Closes #205
+
+  * Added support for arbitrary view engines.
+    For example "foo.engine.html" will now require('engine'),
+    the exports from this module are cached after the first require().
+
+  * Added async plugin support
+
+  * Removed usage of RESTful route funcs as http client
+    get() etc, use http.get() and friends
+
+  * Removed custom exceptions
+
+0.5.0 / 2010-03-10
+==================
+
+  * Added ext dependency (library of js extensions)
+  * Removed extname() / basename() utils. Use path module
+  * Removed toArray() util. Use arguments.values
+  * Removed escapeRegexp() util. Use RegExp.escape()
+  * Removed process.mixin() dependency. Use utils.mixin()
+  * Removed Collection
+  * Removed ElementCollection
+  * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com)  ;)
+
+0.4.0 / 2010-02-11
+==================
+
+  * Added flash() example to sample upload app
+  * Added high level restful http client module (express/http)
+  * Changed; RESTful route functions double as HTTP clients. Closes #69
+  * Changed; throwing error when routes are added at runtime
+  * Changed; defaulting render() context to the current Request. Closes #197
+  * Updated haml submodule
+
+0.3.0 / 2010-02-11
+==================
+
+  * Updated haml / sass submodules. Closes #200
+  * Added flash message support. Closes #64
+  * Added accepts() now allows multiple args. fixes #117
+  * Added support for plugins to halt. Closes #189
+  * Added alternate layout support. Closes #119
+  * Removed Route#run(). Closes #188
+  * Fixed broken specs due to use(Cookie) missing
+
+0.2.1 / 2010-02-05
+==================
+
+  * Added "plot" format option for Profiler (for gnuplot processing)
+  * Added request number to Profiler plugin
+  * Fixed binary encoding for multi-part file uploads, was previously defaulting to UTF8
+  * Fixed issue with routes not firing when not files are present. Closes #184
+  * Fixed process.Promise -> events.Promise
+
+0.2.0 / 2010-02-03
+==================
+
+  * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180
+  * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174
+  * Added expiration support to cache api with reaper. Closes #133
+  * Added cache Store.Memory#reap()
+  * Added Cache; cache api now uses first class Cache instances
+  * Added abstract session Store. Closes #172
+  * Changed; cache Memory.Store#get() utilizing Collection
+  * Renamed MemoryStore -> Store.Memory
+  * Fixed use() of the same plugin several time will always use latest options. Closes #176
+
+0.1.0 / 2010-02-03
+==================
+
+  * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context
+  * Updated node support to 0.1.27 Closes #169
+  * Updated dirname(__filename) -> __dirname
+  * Updated libxmljs support to v0.2.0
+  * Added session support with memory store / reaping
+  * Added quick uid() helper
+  * Added multi-part upload support
+  * Added Sass.js support / submodule
+  * Added production env caching view contents and static files
+  * Added static file caching. Closes #136
+  * Added cache plugin with memory stores
+  * Added support to StaticFile so that it works with non-textual files.
+  * Removed dirname() helper
+  * Removed several globals (now their modules must be required)
+
+0.0.2 / 2010-01-10
+==================
+
+  * Added view benchmarks; currently haml vs ejs
+  * Added Request#attachment() specs. Closes #116
+  * Added use of node's parseQuery() util. Closes #123
+  * Added `make init` for submodules
+  * Updated Haml
+  * Updated sample chat app to show messages on load
+  * Updated libxmljs parseString -> parseHtmlString
+  * Fixed `make init` to work with older versions of git
+  * Fixed specs can now run independant specs for those who cant build deps. Closes #127
+  * Fixed issues introduced by the node url module changes. Closes 126.
+  * Fixed two assertions failing due to Collection#keys() returning strings
+  * Fixed faulty Collection#toArray() spec due to keys() returning strings
+  * Fixed `make test` now builds libxmljs.node before testing
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/LICENSE
new file mode 100755 (executable)
index 0000000..36075a3
--- /dev/null
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2009-2011 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/Makefile
new file mode 100755 (executable)
index 0000000..228f299
--- /dev/null
@@ -0,0 +1,33 @@
+
+MOCHA_OPTS= --check-leaks
+REPORTER = dot
+
+check: test
+
+test: test-unit test-acceptance
+
+test-unit:
+       @NODE_ENV=test ./node_modules/.bin/mocha \
+               --reporter $(REPORTER) \
+               $(MOCHA_OPTS)
+
+test-acceptance:
+       @NODE_ENV=test ./node_modules/.bin/mocha \
+               --reporter $(REPORTER) \
+               --bail \
+               test/acceptance/*.js
+
+test-cov: lib-cov
+       @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
+
+lib-cov:
+       @jscoverage lib lib-cov
+
+benchmark:
+       @./support/bench
+
+clean:
+       rm -f coverage.html
+       rm -fr lib-cov
+
+.PHONY: test test-unit test-acceptance benchmark clean
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/Readme.md
new file mode 100755 (executable)
index 0000000..61ee6ea
--- /dev/null
@@ -0,0 +1,180 @@
+![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)
+
+  Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express)
+
+```js
+var express = require('express');
+var app = express();
+
+app.get('/', function(req, res){
+  res.send('Hello World');
+});
+
+app.listen(3000);
+```
+
+## Installation
+
+    $ npm install -g express
+
+## Quick Start
+
+ The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:
+
+ Create the app:
+
+    $ npm install -g express
+    $ express /tmp/foo && cd /tmp/foo
+
+ Install dependencies:
+
+    $ npm install
+
+ Start the server:
+
+    $ node app
+
+## Features
+
+  * Built on [Connect](http://github.com/senchalabs/connect)
+  * Robust routing
+  * HTTP helpers (redirection, caching, etc)
+  * View system supporting 14+ template engines
+  * Content negotiation
+  * Focus on high performance
+  * Environment based configuration
+  * Executable for generating applications quickly
+  * High test coverage
+
+## Philosophy
+
+  The Express philosophy is to provide small, robust tooling for HTTP servers. Making
+  it a great solution for single page applications, web sites, hybrids, or public
+  HTTP APIs.
+
+  Built on Connect you can use _only_ what you need, and nothing more, applications
+  can be as big or as small as you like, even a single file. Express does
+  not force you to use any specific ORM or template engine. With support for over
+  14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js)
+  you can quickly craft your perfect framework.
+
+## More Information
+
+  * Join #express on freenode
+  * [Google Group](http://groups.google.com/group/express-js) for discussion
+  * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates
+  * Visit the [Wiki](http://github.com/visionmedia/express/wiki)
+  * [日本語ドキュメンテーション](http://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito)
+  * [Русскоязычная документация](http://jsman.ru/express/)
+  * Run express examples [online](https://runnable.com/express)
+
+## Viewing Examples
+
+Clone the Express repo, then install the dev dependencies to install all the example / test suite deps:
+
+    $ git clone git://github.com/visionmedia/express.git --depth 1
+    $ cd express
+    $ npm install
+
+then run whichever tests you want:
+
+    $ node examples/content-negotiation
+
+## Running Tests
+
+To run the test suite first invoke the following command within the repo, installing the development dependencies:
+
+    $ npm install
+
+then run the tests:
+
+    $ make test
+
+## Contributors
+
+```
+project: express
+commits: 3559
+active : 468 days
+files  : 237
+authors:
+ 1891  Tj Holowaychuk          53.1%
+ 1285  visionmedia             36.1%
+  182  TJ Holowaychuk          5.1%
+   54  Aaron Heckmann          1.5%
+   34  csausdev                1.0%
+   26  ciaranj                 0.7%
+   21  Robert Sköld            0.6%
+    6  Guillermo Rauch         0.2%
+    3  Dav Glass               0.1%
+    3  Nick Poulden            0.1%
+    2  Randy Merrill           0.1%
+    2  Benny Wong              0.1%
+    2  Hunter Loftis           0.1%
+    2  Jake Gordon             0.1%
+    2  Brian McKinney          0.1%
+    2  Roman Shtylman          0.1%
+    2  Ben Weaver              0.1%
+    2  Dave Hoover             0.1%
+    2  Eivind Fjeldstad        0.1%
+    2  Daniel Shaw             0.1%
+    1  Matt Colyer             0.0%
+    1  Pau Ramon               0.0%
+    1  Pero Pejovic            0.0%
+    1  Peter Rekdal Sunde      0.0%
+    1  Raynos                  0.0%
+    1  Teng Siong Ong          0.0%
+    1  Viktor Kelemen          0.0%
+    1  ctide                   0.0%
+    1  8bitDesigner            0.0%
+    1  isaacs                  0.0%
+    1  mgutz                   0.0%
+    1  pikeas                  0.0%
+    1  shuwatto                0.0%
+    1  tstrimple               0.0%
+    1  ewoudj                  0.0%
+    1  Adam Sanderson          0.0%
+    1  Andrii Kostenko         0.0%
+    1  Andy Hiew               0.0%
+    1  Arpad Borsos            0.0%
+    1  Ashwin Purohit          0.0%
+    1  Benjen                  0.0%
+    1  Darren Torpey           0.0%
+    1  Greg Ritter             0.0%
+    1  Gregory Ritter          0.0%
+    1  James Herdman           0.0%
+    1  Jim Snodgrass           0.0%
+    1  Joe McCann              0.0%
+    1  Jonathan Dumaine        0.0%
+    1  Jonathan Palardy        0.0%
+    1  Jonathan Zacsh          0.0%
+    1  Justin Lilly            0.0%
+    1  Ken Sato                0.0%
+    1  Maciej Małecki          0.0%
+    1  Masahiro Hayashi        0.0%
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2009-2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/bin/express b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/bin/express
new file mode 100755 (executable)
index 0000000..b93d0af
--- /dev/null
@@ -0,0 +1,422 @@
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var exec = require('child_process').exec
+  , program = require('commander')
+  , mkdirp = require('mkdirp')
+  , pkg = require('../package.json')
+  , version = pkg.version
+  , os = require('os')
+  , fs = require('fs');
+
+// CLI
+
+program
+  .version(version)
+  .option('-s, --sessions', 'add session support')
+  .option('-e, --ejs', 'add ejs engine support (defaults to jade)')
+  .option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')
+  .option('-H, --hogan', 'add hogan.js engine support')
+  .option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')
+  .option('-f, --force', 'force on non-empty directory')
+  .parse(process.argv);
+
+// Path
+
+var path = program.args.shift() || '.';
+
+// end-of-line code
+
+var eol = os.EOL
+
+// Template engine
+
+program.template = 'jade';
+if (program.ejs) program.template = 'ejs';
+if (program.jshtml) program.template = 'jshtml';
+if (program.hogan) program.template = 'hjs';
+
+/**
+ * Routes index template.
+ */
+
+var index = [
+    ''
+  , '/*'
+  , ' * GET home page.'
+  , ' */'
+  , ''
+  , 'exports.index = function(req, res){'
+  , '  res.render(\'index\', { title: \'Express\' });'
+  , '};'
+].join(eol);
+
+/**
+ * Routes users template.
+ */
+
+var users = [
+    ''
+  , '/*'
+  , ' * GET users listing.'
+  , ' */'
+  , ''
+  , 'exports.list = function(req, res){'
+  , '  res.send("respond with a resource");'
+  , '};'
+].join(eol);
+
+/**
+ * Jade layout template.
+ */
+
+var jadeLayout = [
+    'doctype 5'
+  , 'html'
+  , '  head'
+  , '    title= title'
+  , '    link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')'
+  , '  body'
+  , '    block content'
+].join(eol);
+
+/**
+ * Jade index template.
+ */
+
+var jadeIndex = [
+    'extends layout'
+  , ''
+  , 'block content'
+  , '  h1= title'
+  , '  p Welcome to #{title}'
+].join(eol);
+
+/**
+ * EJS index template.
+ */
+
+var ejsIndex = [
+    '<!DOCTYPE html>'
+  , '<html>'
+  , '  <head>'
+  , '    <title><%= title %></title>'
+  , '    <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+  , '  </head>'
+  , '  <body>'
+  , '    <h1><%= title %></h1>'
+  , '    <p>Welcome to <%= title %></p>'
+  , '  </body>'
+  , '</html>'
+].join(eol);
+
+/**
+ * JSHTML layout template.
+ */
+
+var jshtmlLayout = [
+    '<!DOCTYPE html>'
+  , '<html>'
+  , '  <head>'
+  , '    <title> @write(title) </title>'
+  , '    <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+  , '  </head>'
+  , '  <body>'
+  , '    @write(body)'
+  , '  </body>'
+  , '</html>'
+].join(eol);
+
+/**
+ * JSHTML index template.
+ */
+
+var jshtmlIndex = [
+    '<h1>@write(title)</h1>'
+  , '<p>Welcome to @write(title)</p>'
+].join(eol);
+
+/**
+ * Hogan.js index template.
+ */
+var hoganIndex = [
+    '<!DOCTYPE html>'
+  , '<html>'
+  , '  <head>'
+  , '    <title>{{ title }}</title>'
+  , '    <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
+  , '  </head>'
+  , '  <body>'
+  , '    <h1>{{ title }}</h1>'
+  , '    <p>Welcome to {{ title }}</p>'
+  , '  </body>'
+  , '</html>'
+].join(eol);
+
+/**
+ * Default css template.
+ */
+
+var css = [
+    'body {'
+  , '  padding: 50px;'
+  , '  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
+  , '}'
+  , ''
+  , 'a {'
+  , '  color: #00B7FF;'
+  , '}'
+].join(eol);
+
+/**
+ * Default less template.
+ */
+
+var less = [
+    'body {'
+  , '  padding: 50px;'
+  , '  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;'
+  , '}'
+  , ''
+  , 'a {'
+  , '  color: #00B7FF;'
+  , '}'
+].join(eol);
+
+/**
+ * Default stylus template.
+ */
+
+var stylus = [
+    'body'
+  , '  padding: 50px'
+  , '  font: 14px "Lucida Grande", Helvetica, Arial, sans-serif'
+  , 'a'
+  , '  color: #00B7FF'
+].join(eol);
+
+/**
+ * App template.
+ */
+
+var app = [
+    ''
+  , '/**'
+  , ' * Module dependencies.'
+  , ' */'
+  , ''
+  , 'var express = require(\'express\')'
+  , '  , routes = require(\'./routes\')'
+  , '  , user = require(\'./routes/user\')'
+  , '  , http = require(\'http\')'
+  , '  , path = require(\'path\');'
+  , ''
+  , 'var app = express();'
+  , ''
+  , '// all environments'
+  , 'app.set(\'port\', process.env.PORT || 3000);'
+  , 'app.set(\'views\', __dirname + \'/views\');'
+  , 'app.set(\'view engine\', \':TEMPLATE\');'
+  , 'app.use(express.favicon());'
+  , 'app.use(express.logger(\'dev\'));'
+  , 'app.use(express.bodyParser());'
+  , 'app.use(express.methodOverride());{sess}'
+  , 'app.use(app.router);{css}'
+  , 'app.use(express.static(path.join(__dirname, \'public\')));'
+  , ''
+  , '// development only'
+  , 'if (\'development\' == app.get(\'env\')) {'
+  , '  app.use(express.errorHandler());'
+  , '}'
+  , ''
+  , 'app.get(\'/\', routes.index);'
+  , 'app.get(\'/users\', user.list);'
+  , ''
+  , 'http.createServer(app).listen(app.get(\'port\'), function(){'
+  , '  console.log(\'Express server listening on port \' + app.get(\'port\'));'
+  , '});'
+  , ''
+].join(eol);
+
+// Generate application
+
+(function createApplication(path) {
+  emptyDirectory(path, function(empty){
+    if (empty || program.force) {
+      createApplicationAt(path);
+    } else {
+      program.confirm('destination is not empty, continue? ', function(ok){
+        if (ok) {
+          process.stdin.destroy();
+          createApplicationAt(path);
+        } else {
+          abort('aborting');
+        }
+      });
+    }
+  });
+})(path);
+
+/**
+ * Create application at the given directory `path`.
+ *
+ * @param {String} path
+ */
+
+function createApplicationAt(path) {
+  console.log();
+  process.on('exit', function(){
+    console.log();
+    console.log('   install dependencies:');
+    console.log('     $ cd %s && npm install', path);
+    console.log();
+    console.log('   run the app:');
+    console.log('     $ node app');
+    console.log();
+  });
+
+  mkdir(path, function(){
+    mkdir(path + '/public');
+    mkdir(path + '/public/javascripts');
+    mkdir(path + '/public/images');
+    mkdir(path + '/public/stylesheets', function(){
+      switch (program.css) {
+        case 'less':
+          write(path + '/public/stylesheets/style.less', less);
+          break;
+        case 'stylus':
+          write(path + '/public/stylesheets/style.styl', stylus);
+          break;
+        default:
+          write(path + '/public/stylesheets/style.css', css);
+      }
+    });
+
+    mkdir(path + '/routes', function(){
+      write(path + '/routes/index.js', index);
+      write(path + '/routes/user.js', users);
+    });
+
+    mkdir(path + '/views', function(){
+      switch (program.template) {
+        case 'ejs':
+          write(path + '/views/index.ejs', ejsIndex);
+          break;
+        case 'jade':
+          write(path + '/views/layout.jade', jadeLayout);
+          write(path + '/views/index.jade', jadeIndex);
+          break;
+        case 'jshtml':
+          write(path + '/views/layout.jshtml', jshtmlLayout);
+          write(path + '/views/index.jshtml', jshtmlIndex);
+          break;
+        case 'hjs':
+          write(path + '/views/index.hjs', hoganIndex);
+          break;
+
+      }
+    });
+
+    // CSS Engine support
+    switch (program.css) {
+      case 'less':
+        app = app.replace('{css}', eol + '  app.use(require(\'less-middleware\')({ src: __dirname + \'/public\' }));');
+        break;
+      case 'stylus':
+        app = app.replace('{css}', eol + '  app.use(require(\'stylus\').middleware(__dirname + \'/public\'));');
+        break;
+      default:
+        app = app.replace('{css}', '');
+    }
+
+    // Session support
+    app = app.replace('{sess}', program.sessions
+      ? eol + 'app.use(express.cookieParser(\'your secret here\'));' + eol + 'app.use(express.session());'
+      : '');
+
+    // Template support
+    app = app.replace(':TEMPLATE', program.template);
+
+    // package.json
+    var pkg = {
+        name: 'application-name'
+      , version: '0.0.1'
+      , private: true
+      , scripts: { start: 'node app.js' }
+      , dependencies: {
+        express: version
+      }
+    }
+
+    if (program.template) pkg.dependencies[program.template] = '*';
+
+    // CSS Engine support
+    switch (program.css) {
+      case 'less':
+        pkg.dependencies['less-middleware'] = '*';
+        break;
+      default:
+        if (program.css) {
+          pkg.dependencies[program.css] = '*';
+        }
+    }
+
+    write(path + '/package.json', JSON.stringify(pkg, null, 2));
+    write(path + '/app.js', app);
+  });
+}
+
+/**
+ * Check if the given directory `path` is empty.
+ *
+ * @param {String} path
+ * @param {Function} fn
+ */
+
+function emptyDirectory(path, fn) {
+  fs.readdir(path, function(err, files){
+    if (err && 'ENOENT' != err.code) throw err;
+    fn(!files || !files.length);
+  });
+}
+
+/**
+ * echo str > path.
+ *
+ * @param {String} path
+ * @param {String} str
+ */
+
+function write(path, str) {
+  fs.writeFile(path, str);
+  console.log('   \x1b[36mcreate\x1b[0m : ' + path);
+}
+
+/**
+ * Mkdir -p.
+ *
+ * @param {String} path
+ * @param {Function} fn
+ */
+
+function mkdir(path, fn) {
+  mkdirp(path, 0755, function(err){
+    if (err) throw err;
+    console.log('   \033[36mcreate\033[0m : ' + path);
+    fn && fn();
+  });
+}
+
+/**
+ * Exit with the given `str`.
+ *
+ * @param {String} str
+ */
+
+function abort(str) {
+  console.error(str);
+  process.exit(1);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/index.js
new file mode 100755 (executable)
index 0000000..bfe9934
--- /dev/null
@@ -0,0 +1,4 @@
+
+module.exports = process.env.EXPRESS_COV
+  ? require('./lib-cov/express')
+  : require('./lib/express');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/application.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/application.js
new file mode 100755 (executable)
index 0000000..6a3cf13
--- /dev/null
@@ -0,0 +1,536 @@
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect')
+  , Router = require('./router')
+  , methods = require('methods')
+  , middleware = require('./middleware')
+  , debug = require('debug')('express:application')
+  , locals = require('./utils').locals
+  , View = require('./view')
+  , utils = connect.utils
+  , path = require('path')
+  , http = require('http')
+  , join = path.join;
+
+/**
+ * Application prototype.
+ */
+
+var app = exports = module.exports = {};
+
+/**
+ * Initialize the server.
+ *
+ *   - setup default configuration
+ *   - setup default middleware
+ *   - setup route reflection methods
+ *
+ * @api private
+ */
+
+app.init = function(){
+  this.cache = {};
+  this.settings = {};
+  this.engines = {};
+  this.defaultConfiguration();
+};
+
+/**
+ * Initialize application configuration.
+ *
+ * @api private
+ */
+
+app.defaultConfiguration = function(){
+  // default settings
+  this.enable('x-powered-by');
+  this.set('env', process.env.NODE_ENV || 'development');
+  this.set('subdomain offset', 2);
+  debug('booting in %s mode', this.get('env'));
+
+  // implicit middleware
+  this.use(connect.query());
+  this.use(middleware.init(this));
+
+  // inherit protos
+  this.on('mount', function(parent){
+    this.request.__proto__ = parent.request;
+    this.response.__proto__ = parent.response;
+    this.engines.__proto__ = parent.engines;
+    this.settings.__proto__ = parent.settings;
+  });
+
+  // router
+  this._router = new Router(this);
+  this.routes = this._router.map;
+  this.__defineGetter__('router', function(){
+    this._usedRouter = true;
+    this._router.caseSensitive = this.enabled('case sensitive routing');
+    this._router.strict = this.enabled('strict routing');
+    return this._router.middleware;
+  });
+
+  // setup locals
+  this.locals = locals(this);
+
+  // default locals
+  this.locals.settings = this.settings;
+
+  // default configuration
+  this.set('view', View);
+  this.set('views', process.cwd() + '/views');
+  this.set('jsonp callback name', 'callback');
+
+  this.configure('development', function(){
+    this.set('json spaces', 2);
+  });
+
+  this.configure('production', function(){
+    this.enable('view cache');
+  });
+};
+
+/**
+ * Proxy `connect#use()` to apply settings to
+ * mounted applications.
+ *
+ * @param {String|Function|Server} route
+ * @param {Function|Server} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.use = function(route, fn){
+  var app;
+
+  // default route to '/'
+  if ('string' != typeof route) fn = route, route = '/';
+
+  // express app
+  if (fn.handle && fn.set) app = fn;
+
+  // restore .app property on req and res
+  if (app) {
+    app.route = route;
+    fn = function(req, res, next) {
+      var orig = req.app;
+      app.handle(req, res, function(err){
+        req.app = res.app = orig;
+        req.__proto__ = orig.request;
+        res.__proto__ = orig.response;
+        next(err);
+      });
+    };
+  }
+
+  connect.proto.use.call(this, route, fn);
+
+  // mounted an app
+  if (app) {
+    app.parent = this;
+    app.emit('mount', this);
+  }
+
+  return this;
+};
+
+/**
+ * Register the given template engine callback `fn`
+ * as `ext`.
+ *
+ * By default will `require()` the engine based on the
+ * file extension. For example if you try to render
+ * a "foo.jade" file Express will invoke the following internally:
+ *
+ *     app.engine('jade', require('jade').__express);
+ *
+ * For engines that do not provide `.__express` out of the box,
+ * or if you wish to "map" a different extension to the template engine
+ * you may use this method. For example mapping the EJS template engine to
+ * ".html" files:
+ *
+ *     app.engine('html', require('ejs').renderFile);
+ *
+ * In this case EJS provides a `.renderFile()` method with
+ * the same signature that Express expects: `(path, options, callback)`,
+ * though note that it aliases this method as `ejs.__express` internally
+ * so if you're using ".ejs" extensions you dont need to do anything.
+ *
+ * Some template engines do not follow this convention, the
+ * [Consolidate.js](https://github.com/visionmedia/consolidate.js)
+ * library was created to map all of node's popular template
+ * engines to follow this convention, thus allowing them to
+ * work seamlessly within Express.
+ *
+ * @param {String} ext
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.engine = function(ext, fn){
+  if ('function' != typeof fn) throw new Error('callback function required');
+  if ('.' != ext[0]) ext = '.' + ext;
+  this.engines[ext] = fn;
+  return this;
+};
+
+/**
+ * Map the given param placeholder `name`(s) to the given callback(s).
+ *
+ * Parameter mapping is used to provide pre-conditions to routes
+ * which use normalized placeholders. For example a _:user_id_ parameter
+ * could automatically load a user's information from the database without
+ * any additional code,
+ *
+ * The callback uses the samesignature as middleware, the only differencing
+ * being that the value of the placeholder is passed, in this case the _id_
+ * of the user. Once the `next()` function is invoked, just like middleware
+ * it will continue on to execute the route, or subsequent parameter functions.
+ *
+ *      app.param('user_id', function(req, res, next, id){
+ *        User.find(id, function(err, user){
+ *          if (err) {
+ *            next(err);
+ *          } else if (user) {
+ *            req.user = user;
+ *            next();
+ *          } else {
+ *            next(new Error('failed to load user'));
+ *          }
+ *        });
+ *      });
+ *
+ * @param {String|Array} name
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.param = function(name, fn){
+  var self = this
+    , fns = [].slice.call(arguments, 1);
+
+  // array
+  if (Array.isArray(name)) {
+    name.forEach(function(name){
+      fns.forEach(function(fn){
+        self.param(name, fn);
+      });
+    });
+  // param logic
+  } else if ('function' == typeof name) {
+    this._router.param(name);
+  // single
+  } else {
+    if (':' == name[0]) name = name.substr(1);
+    fns.forEach(function(fn){
+      self._router.param(name, fn);
+    });
+  }
+
+  return this;
+};
+
+/**
+ * Assign `setting` to `val`, or return `setting`'s value.
+ *
+ *    app.set('foo', 'bar');
+ *    app.get('foo');
+ *    // => "bar"
+ *
+ * Mounted servers inherit their parent server's settings.
+ *
+ * @param {String} setting
+ * @param {String} val
+ * @return {Server} for chaining
+ * @api public
+ */
+
+app.set = function(setting, val){
+  if (1 == arguments.length) {
+    return this.settings[setting];
+  } else {
+    this.settings[setting] = val;
+    return this;
+  }
+};
+
+/**
+ * Return the app's absolute pathname
+ * based on the parent(s) that have
+ * mounted it.
+ *
+ * For example if the application was
+ * mounted as "/admin", which itself
+ * was mounted as "/blog" then the
+ * return value would be "/blog/admin".
+ *
+ * @return {String}
+ * @api private
+ */
+
+app.path = function(){
+  return this.parent
+    ? this.parent.path() + this.route
+    : '';
+};
+
+/**
+ * Check if `setting` is enabled (truthy).
+ *
+ *    app.enabled('foo')
+ *    // => false
+ *
+ *    app.enable('foo')
+ *    app.enabled('foo')
+ *    // => true
+ *
+ * @param {String} setting
+ * @return {Boolean}
+ * @api public
+ */
+
+app.enabled = function(setting){
+  return !!this.set(setting);
+};
+
+/**
+ * Check if `setting` is disabled.
+ *
+ *    app.disabled('foo')
+ *    // => true
+ *
+ *    app.enable('foo')
+ *    app.disabled('foo')
+ *    // => false
+ *
+ * @param {String} setting
+ * @return {Boolean}
+ * @api public
+ */
+
+app.disabled = function(setting){
+  return !this.set(setting);
+};
+
+/**
+ * Enable `setting`.
+ *
+ * @param {String} setting
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.enable = function(setting){
+  return this.set(setting, true);
+};
+
+/**
+ * Disable `setting`.
+ *
+ * @param {String} setting
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.disable = function(setting){
+  return this.set(setting, false);
+};
+
+/**
+ * Configure callback for zero or more envs,
+ * when no `env` is specified that callback will
+ * be invoked for all environments. Any combination
+ * can be used multiple times, in any order desired.
+ *
+ * Examples:
+ *
+ *    app.configure(function(){
+ *      // executed for all envs
+ *    });
+ *
+ *    app.configure('stage', function(){
+ *      // executed staging env
+ *    });
+ *
+ *    app.configure('stage', 'production', function(){
+ *      // executed for stage and production
+ *    });
+ *
+ * Note:
+ *
+ *  These callbacks are invoked immediately, and
+ *  are effectively sugar for the following:
+ *
+ *     var env = process.env.NODE_ENV || 'development';
+ *
+ *      switch (env) {
+ *        case 'development':
+ *          ...
+ *          break;
+ *        case 'stage':
+ *          ...
+ *          break;
+ *        case 'production':
+ *          ...
+ *          break;
+ *      }
+ *
+ * @param {String} env...
+ * @param {Function} fn
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.configure = function(env, fn){
+  var envs = 'all'
+    , args = [].slice.call(arguments);
+  fn = args.pop();
+  if (args.length) envs = args;
+  if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);
+  return this;
+};
+
+/**
+ * Delegate `.VERB(...)` calls to `router.VERB(...)`.
+ */
+
+methods.forEach(function(method){
+  app[method] = function(path){
+    if ('get' == method && 1 == arguments.length) return this.set(path);
+
+    // deprecated
+    if (Array.isArray(path)) {
+      console.trace('passing an array to app.VERB() is deprecated and will be removed in 4.0');
+    }
+
+    // if no router attached yet, attach the router
+    if (!this._usedRouter) this.use(this.router);
+
+    // setup route
+    this._router[method].apply(this._router, arguments);
+    return this;
+  };
+});
+
+/**
+ * Special-cased "all" method, applying the given route `path`,
+ * middleware, and callback to _every_ HTTP method.
+ *
+ * @param {String} path
+ * @param {Function} ...
+ * @return {app} for chaining
+ * @api public
+ */
+
+app.all = function(path){
+  var args = arguments;
+  methods.forEach(function(method){
+    app[method].apply(this, args);
+  }, this);
+  return this;
+};
+
+// del -> delete alias
+
+app.del = app.delete;
+
+/**
+ * Render the given view `name` name with `options`
+ * and a callback accepting an error and the
+ * rendered template string.
+ *
+ * Example:
+ *
+ *    app.render('email', { name: 'Tobi' }, function(err, html){
+ *      // ...
+ *    })
+ *
+ * @param {String} name
+ * @param {String|Function} options or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+app.render = function(name, options, fn){
+  var opts = {}
+    , cache = this.cache
+    , engines = this.engines
+    , view;
+
+  // support callback function as second arg
+  if ('function' == typeof options) {
+    fn = options, options = {};
+  }
+
+  // merge app.locals
+  utils.merge(opts, this.locals);
+
+  // merge options._locals
+  if (options._locals) utils.merge(opts, options._locals);
+
+  // merge options
+  utils.merge(opts, options);
+
+  // set .cache unless explicitly provided
+  opts.cache = null == opts.cache
+    ? this.enabled('view cache')
+    : opts.cache;
+
+  // primed cache
+  if (opts.cache) view = cache[name];
+
+  // view
+  if (!view) {
+    view = new (this.get('view'))(name, {
+      defaultEngine: this.get('view engine'),
+      root: this.get('views'),
+      engines: engines
+    });
+
+    if (!view.path) {
+      var err = new Error('Failed to lookup view "' + name + '"');
+      err.view = view;
+      return fn(err);
+    }
+
+    // prime the cache
+    if (opts.cache) cache[name] = view;
+  }
+
+  // render
+  try {
+    view.render(opts, fn);
+  } catch (err) {
+    fn(err);
+  }
+};
+
+/**
+ * Listen for connections.
+ *
+ * A node `http.Server` is returned, with this
+ * application (which is a `Function`) as its
+ * callback. If you wish to create both an HTTP
+ * and HTTPS server you may do so with the "http"
+ * and "https" modules as shown here:
+ *
+ *    var http = require('http')
+ *      , https = require('https')
+ *      , express = require('express')
+ *      , app = express();
+ *
+ *    http.createServer(app).listen(80);
+ *    https.createServer({ ... }, 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/express.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/express.js
new file mode 100755 (executable)
index 0000000..d9975df
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+ * Module dependencies.
+ */
+
+var connect = require('connect')
+  , proto = require('./application')
+  , Route = require('./router/route')
+  , Router = require('./router')
+  , req = require('./request')
+  , res = require('./response')
+  , utils = connect.utils;
+
+/**
+ * Expose `createApplication()`.
+ */
+
+exports = module.exports = createApplication;
+
+/**
+ * Framework version.
+ */
+
+exports.version = '3.2.3';
+
+/**
+ * Expose mime.
+ */
+
+exports.mime = connect.mime;
+
+/**
+ * Create an express application.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createApplication() {
+  var app = connect();
+  utils.merge(app, proto);
+  app.request = { __proto__: req };
+  app.response = { __proto__: res };
+  app.init();
+  return app;
+}
+
+/**
+ * Expose connect.middleware as express.*
+ * for example `express.logger` etc.
+ */
+
+for (var key in connect.middleware) {
+  Object.defineProperty(
+      exports
+    , key
+    , Object.getOwnPropertyDescriptor(connect.middleware, key));
+}
+
+/**
+ * Error on createServer().
+ */
+
+exports.createServer = function(){
+  console.warn('Warning: express.createServer() is deprecated, express');
+  console.warn('applications no longer inherit from http.Server,');
+  console.warn('please use:');
+  console.warn('');
+  console.warn('  var express = require("express");');
+  console.warn('  var app = express();');
+  console.warn('');
+  return createApplication();
+};
+
+/**
+ * Expose the prototypes.
+ */
+
+exports.application = proto;
+exports.request = req;
+exports.response = res;
+
+/**
+ * Expose constructors.
+ */
+
+exports.Route = Route;
+exports.Router = Router;
+
+// Error handler title
+
+exports.errorHandler.title = 'Express';
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/middleware.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/middleware.js
new file mode 100755 (executable)
index 0000000..308c5bb
--- /dev/null
@@ -0,0 +1,33 @@
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./utils');
+
+/**
+ * Initialization middleware, exposing the
+ * request and response to eachother, as well
+ * as defaulting the X-Powered-By header field.
+ *
+ * @param {Function} app
+ * @return {Function}
+ * @api private
+ */
+
+exports.init = function(app){
+  return function expressInit(req, res, next){
+    req.app = res.app = app;
+    if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express');
+    req.res = res;
+    res.req = req;
+    req.next = next;
+
+    req.__proto__ = app.request;
+    res.__proto__ = app.response;
+
+    res.locals = res.locals || utils.locals(res);
+
+    next();
+  }
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/request.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/request.js
new file mode 100755 (executable)
index 0000000..fd201e3
--- /dev/null
@@ -0,0 +1,526 @@
+
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+  , utils = require('./utils')
+  , connect = require('connect')
+  , fresh = require('fresh')
+  , parseRange = require('range-parser')
+  , parse = connect.utils.parseUrl
+  , mime = connect.mime;
+
+/**
+ * Request prototype.
+ */
+
+var req = exports = module.exports = {
+  __proto__: http.IncomingMessage.prototype
+};
+
+/**
+ * Return request header.
+ *
+ * The `Referrer` header field is special-cased,
+ * both `Referrer` and `Referer` are interchangeable.
+ *
+ * Examples:
+ *
+ *     req.get('Content-Type');
+ *     // => "text/plain"
+ *
+ *     req.get('content-type');
+ *     // => "text/plain"
+ *
+ *     req.get('Something');
+ *     // => undefined
+ *
+ * Aliased as `req.header()`.
+ *
+ * @param {String} name
+ * @return {String}
+ * @api public
+ */
+
+req.get =
+req.header = function(name){
+  switch (name = name.toLowerCase()) {
+    case 'referer':
+    case 'referrer':
+      return this.headers.referrer
+        || this.headers.referer;
+    default:
+      return this.headers[name];
+  }
+};
+
+/**
+ * Check if the given `type(s)` is acceptable, returning
+ * the best match when true, otherwise `undefined`, in which
+ * case you should respond with 406 "Not Acceptable".
+ *
+ * The `type` value may be a single mime type string
+ * such as "application/json", the extension name
+ * such as "json", a comma-delimted list such as "json, html, text/plain",
+ * or an array `["json", "html", "text/plain"]`. When a list
+ * or array is given the _best_ match, if any is returned.
+ *
+ * Examples:
+ *
+ *     // Accept: text/html
+ *     req.accepts('html');
+ *     // => "html"
+ *
+ *     // Accept: text/*, application/json
+ *     req.accepts('html');
+ *     // => "html"
+ *     req.accepts('text/html');
+ *     // => "text/html"
+ *     req.accepts('json, text');
+ *     // => "json"
+ *     req.accepts('application/json');
+ *     // => "application/json"
+ *
+ *     // Accept: text/*, application/json
+ *     req.accepts('image/png');
+ *     req.accepts('png');
+ *     // => undefined
+ *
+ *     // Accept: text/*;q=.5, application/json
+ *     req.accepts(['html', 'json']);
+ *     req.accepts('html, json');
+ *     // => "json"
+ *
+ * @param {String|Array} type(s)
+ * @return {String}
+ * @api public
+ */
+
+req.accepts = function(type){
+  return utils.accepts(type, this.get('Accept'));
+};
+
+/**
+ * Check if the given `encoding` is accepted.
+ *
+ * @param {String} encoding
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsEncoding = function(encoding){
+  return ~this.acceptedEncodings.indexOf(encoding);
+};
+
+/**
+ * Check if the given `charset` is acceptable,
+ * otherwise you should respond with 406 "Not Acceptable".
+ *
+ * @param {String} charset
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsCharset = function(charset){
+  var accepted = this.acceptedCharsets;
+  return accepted.length
+    ? ~accepted.indexOf(charset)
+    : true;
+};
+
+/**
+ * Check if the given `lang` is acceptable,
+ * otherwise you should respond with 406 "Not Acceptable".
+ *
+ * @param {String} lang
+ * @return {Boolean}
+ * @api public
+ */
+
+req.acceptsLanguage = function(lang){
+  var accepted = this.acceptedLanguages;
+  return accepted.length
+    ? ~accepted.indexOf(lang)
+    : true;
+};
+
+/**
+ * Parse Range header field,
+ * capping to the given `size`.
+ *
+ * Unspecified ranges such as "0-" require
+ * knowledge of your resource length. In
+ * the case of a byte range this is of course
+ * the total number of bytes. If the Range
+ * header field is not given `null` is returned,
+ * `-1` when unsatisfiable, `-2` when syntactically invalid.
+ *
+ * NOTE: remember that ranges are inclusive, so
+ * for example "Range: users=0-3" should respond
+ * with 4 users when available, not 3.
+ *
+ * @param {Number} size
+ * @return {Array}
+ * @api public
+ */
+
+req.range = function(size){
+  var range = this.get('Range');
+  if (!range) return;
+  return parseRange(size, range);
+};
+
+/**
+ * Return an array of encodings.
+ *
+ * Examples:
+ *
+ *     ['gzip', 'deflate']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedEncodings', function(){
+  var accept = this.get('Accept-Encoding');
+  return accept
+    ? accept.trim().split(/ *, */)
+    : [];
+});
+
+/**
+ * Return an array of Accepted media types
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ *     [ { value: 'application/json',
+ *         quality: 1,
+ *         type: 'application',
+ *         subtype: 'json' },
+ *       { value: 'text/html',
+ *         quality: 0.5,
+ *         type: 'text',
+ *         subtype: 'html' } ]
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('accepted', function(){
+  var accept = this.get('Accept');
+  return accept
+    ? utils.parseAccept(accept)
+    : [];
+});
+
+/**
+ * Return an array of Accepted languages
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ *     Accept-Language: en;q=.5, en-us
+ *     ['en-us', 'en']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedLanguages', function(){
+  var accept = this.get('Accept-Language');
+  return accept
+    ? utils
+      .parseParams(accept)
+      .map(function(obj){
+        return obj.value;
+      })
+    : [];
+});
+
+/**
+ * Return an array of Accepted charsets
+ * ordered from highest quality to lowest.
+ *
+ * Examples:
+ *
+ *     Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8
+ *     ['unicode-1-1', 'iso-8859-5']
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('acceptedCharsets', function(){
+  var accept = this.get('Accept-Charset');
+  return accept
+    ? utils
+      .parseParams(accept)
+      .map(function(obj){
+        return obj.value;
+      })
+    : [];
+});
+
+/**
+ * Return the value of param `name` when present or `defaultValue`.
+ *
+ *  - Checks route placeholders, ex: _/user/:id_
+ *  - Checks body params, ex: id=12, {"id":12}
+ *  - Checks query string params, ex: ?id=12
+ *
+ * To utilize request bodies, `req.body`
+ * should be an object. This can be done by using
+ * the `connect.bodyParser()` middleware.
+ *
+ * @param {String} name
+ * @param {Mixed} [defaultValue]
+ * @return {String}
+ * @api public
+ */
+
+req.param = function(name, defaultValue){
+  var params = this.params || {};
+  var body = this.body || {};
+  var query = this.query || {};
+  if (null != params[name] && params.hasOwnProperty(name)) return params[name];
+  if (null != body[name]) return body[name];
+  if (null != query[name]) return query[name];
+  return defaultValue;
+};
+
+/**
+ * Check if the incoming request contains the "Content-Type"
+ * header field, and it contains the give mime `type`.
+ *
+ * Examples:
+ *
+ *      // With Content-Type: text/html; charset=utf-8
+ *      req.is('html');
+ *      req.is('text/html');
+ *      req.is('text/*');
+ *      // => true
+ *
+ *      // When Content-Type is application/json
+ *      req.is('json');
+ *      req.is('application/json');
+ *      req.is('application/*');
+ *      // => true
+ *
+ *      req.is('html');
+ *      // => false
+ *
+ * @param {String} type
+ * @return {Boolean}
+ * @api public
+ */
+
+req.is = function(type){
+  var ct = this.get('Content-Type');
+  if (!ct) return false;
+  ct = ct.split(';')[0];
+  if (!~type.indexOf('/')) type = mime.lookup(type);
+  if (~type.indexOf('*')) {
+    type = type.split('/');
+    ct = ct.split('/');
+    if ('*' == type[0] && type[1] == ct[1]) return true;
+    if ('*' == type[1] && type[0] == ct[0]) return true;
+    return false;
+  }
+  return !! ~ct.indexOf(type);
+};
+
+/**
+ * Return the protocol string "http" or "https"
+ * when requested with TLS. When the "trust proxy"
+ * setting is enabled the "X-Forwarded-Proto" header
+ * field will be trusted. If you're running behind
+ * a reverse proxy that supplies https for you this
+ * may be enabled.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('protocol', function(){
+  var trustProxy = this.app.get('trust proxy');
+  return this.connection.encrypted
+    ? 'https'
+    : trustProxy
+      ? (this.get('X-Forwarded-Proto') || 'http')
+      : 'http';
+});
+
+/**
+ * Short-hand for:
+ *
+ *    req.protocol == 'https'
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('secure', function(){
+  return 'https' == this.protocol;
+});
+
+/**
+ * Return the remote address, or when
+ * "trust proxy" is `true` return
+ * the upstream addr.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('ip', function(){
+  return this.ips[0] || this.connection.remoteAddress;
+});
+
+/**
+ * When "trust proxy" is `true`, parse
+ * the "X-Forwarded-For" ip address list.
+ *
+ * For example if the value were "client, proxy1, proxy2"
+ * you would receive the array `["client", "proxy1", "proxy2"]`
+ * where "proxy2" is the furthest down-stream.
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('ips', function(){
+  var trustProxy = this.app.get('trust proxy');
+  var val = this.get('X-Forwarded-For');
+  return trustProxy && val
+    ? val.split(/ *, */)
+    : [];
+});
+
+/**
+ * Return basic auth credentials.
+ *
+ * Examples:
+ *
+ *    // http://tobi:hello@example.com
+ *    req.auth
+ *    // => { username: 'tobi', password: 'hello' }
+ *
+ * @return {Object} or undefined
+ * @api public
+ */
+
+req.__defineGetter__('auth', function(){
+  // missing
+  var auth = this.get('Authorization');
+  if (!auth) return;
+
+  // malformed
+  var parts = auth.split(' ');
+  if ('basic' != parts[0].toLowerCase()) return;
+  if (!parts[1]) return;
+  auth = parts[1];
+
+  // credentials
+  auth = new Buffer(auth, 'base64').toString().match(/^([^:]*):(.*)$/);
+  if (!auth) return;
+  return { username: auth[1], password: auth[2] };
+});
+
+/**
+ * Return subdomains as an array.
+ *
+ * Subdomains are the dot-separated parts of the host before the main domain of
+ * the app. By default, the domain of the app is assumed to be the last two
+ * parts of the host. This can be changed by setting "subdomain offset".
+ *
+ * For example, if the domain is "tobi.ferrets.example.com":
+ * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
+ * If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
+ *
+ * @return {Array}
+ * @api public
+ */
+
+req.__defineGetter__('subdomains', function(){
+  var offset = this.app.get('subdomain offset');
+  return this.get('Host')
+    .split('.')
+    .reverse()
+    .slice(offset);
+});
+
+/**
+ * Short-hand for `url.parse(req.url).pathname`.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('path', function(){
+  return parse(this).pathname;
+});
+
+/**
+ * Parse the "Host" header field hostname.
+ *
+ * @return {String}
+ * @api public
+ */
+
+req.__defineGetter__('host', function(){
+  var trustProxy = this.app.get('trust proxy');
+  var host = trustProxy && this.get('X-Forwarded-Host');
+  host = host || this.get('Host');
+  return host.split(':')[0];
+});
+
+/**
+ * Check if the request is fresh, aka
+ * Last-Modified and/or the ETag
+ * still match.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('fresh', function(){
+  var method = this.method;
+  var s = this.res.statusCode;
+
+  // GET or HEAD for weak freshness validation only
+  if ('GET' != method && 'HEAD' != method) return false;
+
+  // 2xx or 304 as per rfc2616 14.26
+  if ((s >= 200 && s < 300) || 304 == s) {
+    return fresh(this.headers, this.res._headers);
+  }
+
+  return false;
+});
+
+/**
+ * Check if the request is stale, aka
+ * "Last-Modified" and / or the "ETag" for the
+ * resource has changed.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('stale', function(){
+  return !this.fresh;
+});
+
+/**
+ * Check if the request was an _XMLHttpRequest_.
+ *
+ * @return {Boolean}
+ * @api public
+ */
+
+req.__defineGetter__('xhr', function(){
+  var val = this.get('X-Requested-With') || '';
+  return 'xmlhttprequest' == val.toLowerCase();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/response.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/response.js
new file mode 100755 (executable)
index 0000000..271d605
--- /dev/null
@@ -0,0 +1,757 @@
+/**
+ * Module dependencies.
+ */
+
+var http = require('http')
+  , path = require('path')
+  , connect = require('connect')
+  , utils = connect.utils
+  , sign = require('cookie-signature').sign
+  , normalizeType = require('./utils').normalizeType
+  , normalizeTypes = require('./utils').normalizeTypes
+  , etag = require('./utils').etag
+  , statusCodes = http.STATUS_CODES
+  , cookie = require('cookie')
+  , send = require('send')
+  , mime = connect.mime
+  , basename = path.basename
+  , extname = path.extname
+  , join = path.join;
+
+/**
+ * Response prototype.
+ */
+
+var res = module.exports = {
+  __proto__: http.ServerResponse.prototype
+};
+
+/**
+ * Set status `code`.
+ *
+ * @param {Number} code
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.status = function(code){
+  this.statusCode = code;
+  return this;
+};
+
+/**
+ * Set Link header field with the given `links`.
+ *
+ * Examples:
+ *
+ *    res.links({
+ *      next: 'http://api.example.com/users?page=2',
+ *      last: 'http://api.example.com/users?page=5'
+ *    });
+ *
+ * @param {Object} links
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.links = function(links){
+  return this.set('Link', Object.keys(links).map(function(rel){
+    return '<' + links[rel] + '>; rel="' + rel + '"';
+  }).join(', '));
+};
+
+/**
+ * Send a response.
+ *
+ * Examples:
+ *
+ *     res.send(new Buffer('wahoo'));
+ *     res.send({ some: 'json' });
+ *     res.send('<p>some html</p>');
+ *     res.send(404, 'Sorry, cant find that');
+ *     res.send(404);
+ *
+ * @param {Mixed} body or status
+ * @param {Mixed} body
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.send = function(body){
+  var req = this.req
+    , head = 'HEAD' == req.method
+    , len;
+
+  // allow status / body
+  if (2 == arguments.length) {
+    // res.send(body, status) backwards compat
+    if ('number' != typeof body && 'number' == typeof arguments[1]) {
+      this.statusCode = arguments[1];
+    } else {
+      this.statusCode = body;
+      body = arguments[1];
+    }
+  }
+
+  switch (typeof body) {
+    // response status
+    case 'number':
+      this.get('Content-Type') || this.type('txt');
+      this.statusCode = body;
+      body = http.STATUS_CODES[body];
+      break;
+    // string defaulting to html
+    case 'string':
+      if (!this.get('Content-Type')) {
+        this.charset = this.charset || 'utf-8';
+        this.type('html');
+      }
+      break;
+    case 'boolean':
+    case 'object':
+      if (null == body) {
+        body = '';
+      } else if (Buffer.isBuffer(body)) {
+        this.get('Content-Type') || this.type('bin');
+      } else {
+        return this.json(body);
+      }
+      break;
+  }
+
+  // populate Content-Length
+  if (undefined !== body && !this.get('Content-Length')) {
+    this.set('Content-Length', len = Buffer.isBuffer(body)
+      ? body.length
+      : Buffer.byteLength(body));
+  }
+
+  // ETag support
+  // TODO: W/ support
+  if (len > 1024) {
+    if (!this.get('ETag')) {
+      this.set('ETag', etag(body));
+    }
+  }
+
+  // freshness
+  if (req.fresh) this.statusCode = 304;
+
+  // strip irrelevant headers
+  if (204 == this.statusCode || 304 == this.statusCode) {
+    this.removeHeader('Content-Type');
+    this.removeHeader('Content-Length');
+    this.removeHeader('Transfer-Encoding');
+    body = '';
+  }
+
+  // respond
+  this.end(head ? null : body);
+  return this;
+};
+
+/**
+ * Send JSON response.
+ *
+ * Examples:
+ *
+ *     res.json(null);
+ *     res.json({ user: 'tj' });
+ *     res.json(500, 'oh noes!');
+ *     res.json(404, 'I dont have that');
+ *
+ * @param {Mixed} obj or status
+ * @param {Mixed} obj
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.json = function(obj){
+  // allow status / body
+  if (2 == arguments.length) {
+    // res.json(body, status) backwards compat
+    if ('number' == typeof arguments[1]) {
+      this.statusCode = arguments[1];
+    } else {
+      this.statusCode = obj;
+      obj = arguments[1];
+    }
+  }
+
+  // settings
+  var app = this.app;
+  var replacer = app.get('json replacer');
+  var spaces = app.get('json spaces');
+  var body = JSON.stringify(obj, replacer, spaces);
+
+  // content-type
+  this.charset = this.charset || 'utf-8';
+  this.get('Content-Type') || this.set('Content-Type', 'application/json');
+
+  return this.send(body);
+};
+
+/**
+ * Send JSON response with JSONP callback support.
+ *
+ * Examples:
+ *
+ *     res.jsonp(null);
+ *     res.jsonp({ user: 'tj' });
+ *     res.jsonp(500, 'oh noes!');
+ *     res.jsonp(404, 'I dont have that');
+ *
+ * @param {Mixed} obj or status
+ * @param {Mixed} obj
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.jsonp = function(obj){
+  // allow status / body
+  if (2 == arguments.length) {
+    // res.json(body, status) backwards compat
+    if ('number' == typeof arguments[1]) {
+      this.statusCode = arguments[1];
+    } else {
+      this.statusCode = obj;
+      obj = arguments[1];
+    }
+  }
+
+  // settings
+  var app = this.app;
+  var replacer = app.get('json replacer');
+  var spaces = app.get('json spaces');
+  var body = JSON.stringify(obj, replacer, spaces)
+    .replace(/\u2028/g, '\\u2028')
+    .replace(/\u2029/g, '\\u2029');
+  var callback = this.req.query[app.get('jsonp callback name')];
+
+  // content-type
+  this.charset = this.charset || 'utf-8';
+  this.set('Content-Type', 'application/json');
+
+  // jsonp
+  if (callback) {
+    this.set('Content-Type', 'text/javascript');
+    var cb = callback.replace(/[^\[\]\w$.]/g, '');
+    body = cb + ' && ' + cb + '(' + body + ');';
+  }
+
+  return this.send(body);
+};
+
+/**
+ * Transfer the file at the given `path`.
+ *
+ * Automatically sets the _Content-Type_ response header field.
+ * The callback `fn(err)` is invoked when the transfer is complete
+ * or when an error occurs. Be sure to check `res.sentHeader`
+ * if you wish to attempt responding, as the header and some data
+ * may have already been transferred.
+ *
+ * Options:
+ *
+ *   - `maxAge` defaulting to 0
+ *   - `root`   root directory for relative filenames
+ *
+ * Examples:
+ *
+ *  The following example illustrates how `res.sendfile()` may
+ *  be used as an alternative for the `static()` middleware for
+ *  dynamic situations. The code backing `res.sendfile()` is actually
+ *  the same code, so HTTP cache support etc is identical.
+ *
+ *     app.get('/user/:uid/photos/:file', function(req, res){
+ *       var uid = req.params.uid
+ *         , file = req.params.file;
+ *
+ *       req.user.mayViewFilesFrom(uid, function(yes){
+ *         if (yes) {
+ *           res.sendfile('/uploads/' + uid + '/' + file);
+ *         } else {
+ *           res.send(403, 'Sorry! you cant see that.');
+ *         }
+ *       });
+ *     });
+ *
+ * @param {String} path
+ * @param {Object|Function} options or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+res.sendfile = function(path, options, fn){
+  var self = this
+    , req = self.req
+    , next = this.req.next
+    , options = options || {}
+    , done;
+
+  // support function as second arg
+  if ('function' == typeof options) {
+    fn = options;
+    options = {};
+  }
+
+  // socket errors
+  req.socket.on('error', error);
+
+  // errors
+  function error(err) {
+    if (done) return;
+    done = true;
+
+    // clean up
+    cleanup();
+    if (!self.headerSent) self.removeHeader('Content-Disposition');
+
+    // callback available
+    if (fn) return fn(err);
+
+    // list in limbo if there's no callback
+    if (self.headerSent) return;
+
+    // delegate
+    next(err);
+  }
+
+  // streaming
+  function stream() {
+    if (done) return;
+    cleanup();
+    if (fn) self.on('finish', fn);
+  }
+
+  // cleanup
+  function cleanup() {
+    req.socket.removeListener('error', error);
+  }
+
+  // transfer
+  var file = send(req, path);
+  if (options.root) file.root(options.root);
+  file.maxage(options.maxAge || 0);
+  file.on('error', error);
+  file.on('directory', next);
+  file.on('stream', stream);
+  file.pipe(this);
+  this.on('finish', cleanup);
+};
+
+/**
+ * Transfer the file at the given `path` as an attachment.
+ *
+ * Optionally providing an alternate attachment `filename`,
+ * and optional callback `fn(err)`. The callback is invoked
+ * when the data transfer is complete, or when an error has
+ * ocurred. Be sure to check `res.headerSent` if you plan to respond.
+ *
+ * This method uses `res.sendfile()`.
+ *
+ * @param {String} path
+ * @param {String|Function} filename or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+res.download = function(path, filename, fn){
+  // support function as second arg
+  if ('function' == typeof filename) {
+    fn = filename;
+    filename = null;
+  }
+
+  filename = filename || path;
+  this.set('Content-Disposition', 'attachment; filename="' + basename(filename) + '"');
+  return this.sendfile(path, fn);
+};
+
+/**
+ * Set _Content-Type_ response header with `type` through `mime.lookup()`
+ * when it does not contain "/", or set the Content-Type to `type` otherwise.
+ *
+ * Examples:
+ *
+ *     res.type('.html');
+ *     res.type('html');
+ *     res.type('json');
+ *     res.type('application/json');
+ *     res.type('png');
+ *
+ * @param {String} type
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.contentType =
+res.type = function(type){
+  return this.set('Content-Type', ~type.indexOf('/')
+    ? type
+    : mime.lookup(type));
+};
+
+/**
+ * Respond to the Acceptable formats using an `obj`
+ * of mime-type callbacks.
+ *
+ * This method uses `req.accepted`, an array of
+ * acceptable types ordered by their quality values.
+ * When "Accept" is not present the _first_ callback
+ * is invoked, otherwise the first match is used. When
+ * no match is performed the server responds with
+ * 406 "Not Acceptable".
+ *
+ * Content-Type is set for you, however if you choose
+ * you may alter this within the callback using `res.type()`
+ * or `res.set('Content-Type', ...)`.
+ *
+ *    res.format({
+ *      'text/plain': function(){
+ *        res.send('hey');
+ *      },
+ *
+ *      'text/html': function(){
+ *        res.send('<p>hey</p>');
+ *      },
+ *
+ *      'appliation/json': function(){
+ *        res.send({ message: 'hey' });
+ *      }
+ *    });
+ *
+ * In addition to canonicalized MIME types you may
+ * also use extnames mapped to these types:
+ *
+ *    res.format({
+ *      text: function(){
+ *        res.send('hey');
+ *      },
+ *
+ *      html: function(){
+ *        res.send('<p>hey</p>');
+ *      },
+ *
+ *      json: function(){
+ *        res.send({ message: 'hey' });
+ *      }
+ *    });
+ *
+ * By default Express passes an `Error`
+ * with a `.status` of 406 to `next(err)`
+ * if a match is not made. If you provide
+ * a `.default` callback it will be invoked
+ * instead.
+ *
+ * @param {Object} obj
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.format = function(obj){
+  var req = this.req
+    , next = req.next;
+
+  var fn = obj.default;
+  if (fn) delete obj.default;
+  var keys = Object.keys(obj);
+
+  var key = req.accepts(keys);
+
+  this.set('Vary', 'Accept');
+
+  if (key) {
+    this.set('Content-Type', normalizeType(key).value);
+    obj[key](req, this, next);
+  } else if (fn) {
+    fn();
+  } else {
+    var err = new Error('Not Acceptable');
+    err.status = 406;
+    err.types = normalizeTypes(keys).map(function(o){ return o.value });
+    next(err);
+  }
+
+  return this;
+};
+
+/**
+ * Set _Content-Disposition_ header to _attachment_ with optional `filename`.
+ *
+ * @param {String} filename
+ * @return {ServerResponse}
+ * @api public
+ */
+
+res.attachment = function(filename){
+  if (filename) this.type(extname(filename));
+  this.set('Content-Disposition', filename
+    ? 'attachment; filename="' + basename(filename) + '"'
+    : 'attachment');
+  return this;
+};
+
+/**
+ * Set header `field` to `val`, or pass
+ * an object of header fields.
+ *
+ * Examples:
+ *
+ *    res.set('Foo', ['bar', 'baz']);
+ *    res.set('Accept', 'application/json');
+ *    res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
+ *
+ * Aliased as `res.header()`.
+ *
+ * @param {String|Object|Array} field
+ * @param {String} val
+ * @return {ServerResponse} for chaining
+ * @api public
+ */
+
+res.set =
+res.header = function(field, val){
+  if (2 == arguments.length) {
+    if (Array.isArray(val)) val = val.map(String);
+    else val = String(val);
+    this.setHeader(field, val);
+  } else {
+    for (var key in field) {
+      this.set(key, field[key]);
+    }
+  }
+  return this;
+};
+
+/**
+ * Get value for header `field`.
+ *
+ * @param {String} field
+ * @return {String}
+ * @api public
+ */
+
+res.get = function(field){
+  return this.getHeader(field);
+};
+
+/**
+ * Clear cookie `name`.
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @param {ServerResponse} for chaining
+ * @api public
+ */
+
+res.clearCookie = function(name, options){
+  var opts = { expires: new Date(1), path: '/' };
+  return this.cookie(name, '', options
+    ? utils.merge(opts, options)
+    : opts);
+};
+
+/**
+ * Set cookie `name` to `val`, with the given `options`.
+ *
+ * Options:
+ *
+ *    - `maxAge`   max-age in milliseconds, converted to `expires`
+ *    - `signed`   sign the cookie
+ *    - `path`     defaults to "/"
+ *
+ * Examples:
+ *
+ *    // "Remember Me" for 15 minutes
+ *    res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
+ *
+ *    // save as above
+ *    res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
+ *
+ * @param {String} name
+ * @param {String|Object} val
+ * @param {Options} options
+ * @api public
+ */
+
+res.cookie = function(name, val, options){
+  options = utils.merge({}, options);
+  var secret = this.req.secret;
+  var signed = options.signed;
+  if (signed && !secret) throw new Error('connect.cookieParser("secret") required for signed cookies');
+  if ('number' == typeof val) val = val.toString();
+  if ('object' == typeof val) val = 'j:' + JSON.stringify(val);
+  if (signed) val = 's:' + sign(val, secret);
+  if ('maxAge' in options) {
+    options.expires = new Date(Date.now() + options.maxAge);
+    options.maxAge /= 1000;
+  }
+  if (null == options.path) options.path = '/';
+  this.set('Set-Cookie', cookie.serialize(name, String(val), options));
+  return this;
+};
+
+
+/**
+ * Set the location header to `url`.
+ *
+ * The given `url` can also be the name of a mapped url, for
+ * example by default express supports "back" which redirects
+ * to the _Referrer_ or _Referer_ headers or "/".
+ *
+ * Examples:
+ *
+ *    res.location('/foo/bar').;
+ *    res.location('http://example.com');
+ *    res.location('../login'); // /blog/post/1 -> /blog/login
+ *
+ * Mounting:
+ *
+ *   When an application is mounted and `res.location()`
+ *   is given a path that does _not_ lead with "/" it becomes
+ *   relative to the mount-point. For example if the application
+ *   is mounted at "/blog", the following would become "/blog/login".
+ *
+ *      res.location('login');
+ *
+ *   While the leading slash would result in a location of "/login":
+ *
+ *      res.location('/login');
+ *
+ * @param {String} url
+ * @api public
+ */
+
+res.location = function(url){
+  var app = this.app
+    , req = this.req;
+
+  // setup redirect map
+  var map = { back: req.get('Referrer') || '/' };
+
+  // perform redirect
+  url = map[url] || url;
+
+  // relative
+  if (!~url.indexOf('://') && 0 != url.indexOf('//')) {
+    var path
+
+    // relative to path
+    if ('.' == url[0]) {
+      path = req.originalUrl.split('?')[0]
+      url =  path + ('/' == path[path.length - 1] ? '' : '/') + url;
+      // relative to mount-point
+    } else if ('/' != url[0]) {
+      path = app.path();
+      url = path + '/' + url;
+    }
+  }
+
+  // Respond
+  this.set('Location', url);
+  return this;
+};
+
+/**
+ * Redirect to the given `url` with optional response `status`
+ * defaulting to 302.
+ *
+ * The resulting `url` is determined by `res.location()`, so
+ * it will play nicely with mounted apps, relative paths,
+ * `"back"` etc.
+ *
+ * Examples:
+ *
+ *    res.redirect('/foo/bar');
+ *    res.redirect('http://example.com');
+ *    res.redirect(301, 'http://example.com');
+ *    res.redirect('http://example.com', 301);
+ *    res.redirect('../login'); // /blog/post/1 -> /blog/login
+ *
+ * @param {String} url
+ * @param {Number} code
+ * @api public
+ */
+
+res.redirect = function(url){
+  var app = this.app
+    , head = 'HEAD' == this.req.method
+    , status = 302
+    , body;
+
+  // allow status / url
+  if (2 == arguments.length) {
+    if ('number' == typeof url) {
+      status = url;
+      url = arguments[1];
+    } else {
+      status = arguments[1];
+    }
+  }
+
+  // Set location header
+  this.location(url);
+  url = this.get('Location');
+
+  // Support text/{plain,html} by default
+  this.format({
+    text: function(){
+      body = statusCodes[status] + '. Redirecting to ' + encodeURI(url);
+    },
+
+    html: function(){
+      var u = utils.escape(url);
+      body = '<p>' + statusCodes[status] + '. Redirecting to <a href="' + u + '">' + u + '</a></p>';
+    },
+
+    default: function(){
+      body = '';
+    }
+  });
+
+  // Respond
+  this.statusCode = status;
+  this.set('Content-Length', Buffer.byteLength(body));
+  this.end(head ? null : body);
+};
+
+/**
+ * Render `view` with the given `options` and optional callback `fn`.
+ * When a callback function is given a response will _not_ be made
+ * automatically, otherwise a response of _200_ and _text/html_ is given.
+ *
+ * Options:
+ *
+ *  - `cache`     boolean hinting to the engine it should cache
+ *  - `filename`  filename of the view being rendered
+ *
+ * @param  {String} view
+ * @param  {Object|Function} options or callback function
+ * @param  {Function} fn
+ * @api public
+ */
+
+res.render = function(view, options, fn){
+  var self = this
+    , options = options || {}
+    , req = this.req
+    , app = req.app;
+
+  // support callback function as second arg
+  if ('function' == typeof options) {
+    fn = options, options = {};
+  }
+
+  // merge res.locals
+  options._locals = self.locals;
+
+  // default callback to respond
+  fn = fn || function(err, str){
+    if (err) return req.next(err);
+    self.send(str);
+  };
+
+  // render
+  app.render(view, options, fn);
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/router/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/router/index.js
new file mode 100755 (executable)
index 0000000..662dc29
--- /dev/null
@@ -0,0 +1,273 @@
+/**
+ * Module dependencies.
+ */
+
+var Route = require('./route')
+  , utils = require('../utils')
+  , methods = require('methods')
+  , debug = require('debug')('express:router')
+  , parse = require('connect').utils.parseUrl;
+
+/**
+ * Expose `Router` constructor.
+ */
+
+exports = module.exports = Router;
+
+/**
+ * Initialize a new `Router` with the given `options`.
+ *
+ * @param {Object} options
+ * @api private
+ */
+
+function Router(options) {
+  options = options || {};
+  var self = this;
+  this.map = {};
+  this.params = {};
+  this._params = [];
+  this.caseSensitive = options.caseSensitive;
+  this.strict = options.strict;
+  this.middleware = function router(req, res, next){
+    self._dispatch(req, res, next);
+  };
+}
+
+/**
+ * Register a param callback `fn` for the given `name`.
+ *
+ * @param {String|Function} name
+ * @param {Function} fn
+ * @return {Router} for chaining
+ * @api public
+ */
+
+Router.prototype.param = function(name, fn){
+  // param logic
+  if ('function' == typeof name) {
+    this._params.push(name);
+    return;
+  }
+
+  // apply param functions
+  var params = this._params
+    , len = params.length
+    , ret;
+
+  for (var i = 0; i < len; ++i) {
+    if (ret = params[i](name, fn)) {
+      fn = ret;
+    }
+  }
+
+  // ensure we end up with a
+  // middleware function
+  if ('function' != typeof fn) {
+    throw new Error('invalid param() call for ' + name + ', got ' + fn);
+  }
+
+  (this.params[name] = this.params[name] || []).push(fn);
+  return this;
+};
+
+/**
+ * Route dispatcher aka the route "middleware".
+ *
+ * @param {IncomingMessage} req
+ * @param {ServerResponse} res
+ * @param {Function} next
+ * @api private
+ */
+
+Router.prototype._dispatch = function(req, res, next){
+  var params = this.params
+    , self = this;
+
+  debug('dispatching %s %s (%s)', req.method, req.url, req.originalUrl);
+
+  // route dispatch
+  (function pass(i, err){
+    var paramCallbacks
+      , paramIndex = 0
+      , paramVal
+      , route
+      , keys
+      , key;
+
+    // match next route
+    function nextRoute(err) {
+      pass(req._route_index + 1, err);
+    }
+
+    // match route
+    req.route = route = self.matchRequest(req, i);
+
+    // no route
+    if (!route) return next(err);
+    debug('matched %s %s', route.method, route.path);
+
+    // we have a route
+    // start at param 0
+    req.params = route.params;
+    keys = route.keys;
+    i = 0;
+
+    // param callbacks
+    function param(err) {
+      paramIndex = 0;
+      key = keys[i++];
+      paramVal = key && req.params[key.name];
+      paramCallbacks = key && params[key.name];
+
+      try {
+        if ('route' == err) {
+          nextRoute();
+        } else if (err) {
+          i = 0;
+          callbacks(err);
+        } else if (paramCallbacks && undefined !== paramVal) {
+          paramCallback();
+        } else if (key) {
+          param();
+        } else {
+          i = 0;
+          callbacks();
+        }
+      } catch (err) {
+        param(err);
+      }
+    };
+
+    param(err);
+
+    // single param callbacks
+    function paramCallback(err) {
+      var fn = paramCallbacks[paramIndex++];
+      if (err || !fn) return param(err);
+      fn(req, res, paramCallback, paramVal, key.name);
+    }
+
+    // invoke route callbacks
+    function callbacks(err) {
+      var fn = route.callbacks[i++];
+      try {
+        if ('route' == err) {
+          nextRoute();
+        } else if (err && fn) {
+          if (fn.length < 4) return callbacks(err);
+          fn(err, req, res, callbacks);
+        } else if (fn) {
+          if (fn.length < 4) return fn(req, res, callbacks);
+          callbacks();
+        } else {
+          nextRoute(err);
+        }
+      } catch (err) {
+        callbacks(err);
+      }
+    }
+  })(0);
+};
+
+/**
+ * Attempt to match a route for `req`
+ * with optional starting index of `i`
+ * defaulting to 0.
+ *
+ * @param {IncomingMessage} req
+ * @param {Number} i
+ * @return {Route}
+ * @api private
+ */
+
+Router.prototype.matchRequest = function(req, i, head){
+  var method = req.method.toLowerCase()
+    , url = parse(req)
+    , path = url.pathname
+    , routes = this.map
+    , i = i || 0
+    , route;
+
+  // HEAD support
+  if (!head && 'head' == method) {
+    route = this.matchRequest(req, i, true);
+    if (route) return route;
+     method = 'get';
+  }
+
+  // routes for this method
+  if (routes = routes[method]) {
+
+    // matching routes
+    for (var len = routes.length; i < len; ++i) {
+      route = routes[i];
+      if (route.match(path)) {
+        req._route_index = i;
+        return route;
+      }
+    }
+  }
+};
+
+/**
+ * Attempt to match a route for `method`
+ * and `url` with optional starting
+ * index of `i` defaulting to 0.
+ *
+ * @param {String} method
+ * @param {String} url
+ * @param {Number} i
+ * @return {Route}
+ * @api private
+ */
+
+Router.prototype.match = function(method, url, i, head){
+  var req = { method: method, url: url };
+  return  this.matchRequest(req, i, head);
+};
+
+/**
+ * Route `method`, `path`, and one or more callbacks.
+ *
+ * @param {String} method
+ * @param {String} path
+ * @param {Function} callback...
+ * @return {Router} for chaining
+ * @api private
+ */
+
+Router.prototype.route = function(method, path, callbacks){
+  var method = method.toLowerCase()
+    , callbacks = utils.flatten([].slice.call(arguments, 2));
+
+  // ensure path was given
+  if (!path) throw new Error('Router#' + method + '() requires a path');
+
+  // ensure all callbacks are functions
+  callbacks.forEach(function(fn, i){
+    if ('function' == typeof fn) return;
+    var type = {}.toString.call(fn);
+    var msg = '.' + method + '() requires callback functions but got a ' + type;
+    throw new Error(msg);
+  });
+
+  // create the route
+  debug('defined %s %s', method, path);
+  var route = new Route(method, path, callbacks, {
+    sensitive: this.caseSensitive,
+    strict: this.strict
+  });
+
+  // add it
+  (this.map[method] = this.map[method] || []).push(route);
+  return this;
+};
+
+methods.forEach(function(method){
+  Router.prototype[method] = function(path){
+    var args = [method].concat([].slice.call(arguments));
+    this.route.apply(this, args);
+    return this;
+  };
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/router/route.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/router/route.js
new file mode 100755 (executable)
index 0000000..c1a0b5e
--- /dev/null
@@ -0,0 +1,72 @@
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Expose `Route`.
+ */
+
+module.exports = Route;
+
+/**
+ * Initialize `Route` with the given HTTP `method`, `path`,
+ * and an array of `callbacks` and `options`.
+ *
+ * Options:
+ *
+ *   - `sensitive`    enable case-sensitive routes
+ *   - `strict`       enable strict matching for trailing slashes
+ *
+ * @param {String} method
+ * @param {String} path
+ * @param {Array} callbacks
+ * @param {Object} options.
+ * @api private
+ */
+
+function Route(method, path, callbacks, options) {
+  options = options || {};
+  this.path = path;
+  this.method = method;
+  this.callbacks = callbacks;
+  this.regexp = utils.pathRegexp(path
+    , this.keys = []
+    , options.sensitive
+    , options.strict);
+}
+
+/**
+ * Check if this route matches `path`, if so
+ * populate `.params`.
+ *
+ * @param {String} path
+ * @return {Boolean}
+ * @api private
+ */
+
+Route.prototype.match = function(path){
+  var keys = this.keys
+    , params = this.params = []
+    , m = this.regexp.exec(path);
+
+  if (!m) return false;
+
+  for (var i = 1, len = m.length; i < len; ++i) {
+    var key = keys[i - 1];
+
+    var val = 'string' == typeof m[i]
+      ? decodeURIComponent(m[i])
+      : m[i];
+
+    if (key) {
+      params[key.name] = val;
+    } else {
+      params.push(val);
+    }
+  }
+
+  return true;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/utils.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/utils.js
new file mode 100755 (executable)
index 0000000..fd245a8
--- /dev/null
@@ -0,0 +1,313 @@
+
+/**
+ * Module dependencies.
+ */
+
+var mime = require('connect').mime
+  , crc32 = require('buffer-crc32');
+
+/**
+ * toString ref.
+ */
+
+var toString = {}.toString;
+
+/**
+ * Return ETag for `body`.
+ *
+ * @param {String|Buffer} body
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(body){
+  return '"' + crc32.signed(body) + '"';
+};
+
+/**
+ * Make `locals()` bound to the given `obj`.
+ *
+ * This is used for `app.locals` and `res.locals`.
+ *
+ * @param {Object} obj
+ * @return {Function}
+ * @api private
+ */
+
+exports.locals = function(obj){
+  function locals(obj){
+    for (var key in obj) locals[key] = obj[key];
+    return obj;
+  };
+
+  return locals;
+};
+
+/**
+ * Check if `path` looks absolute.
+ *
+ * @param {String} path
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.isAbsolute = function(path){
+  if ('/' == path[0]) return true;
+  if (':' == path[1] && '\\' == path[2]) return true;
+};
+
+/**
+ * Flatten the given `arr`.
+ *
+ * @param {Array} arr
+ * @return {Array}
+ * @api private
+ */
+
+exports.flatten = function(arr, ret){
+  var ret = ret || []
+    , len = arr.length;
+  for (var i = 0; i < len; ++i) {
+    if (Array.isArray(arr[i])) {
+      exports.flatten(arr[i], ret);
+    } else {
+      ret.push(arr[i]);
+    }
+  }
+  return ret;
+};
+
+/**
+ * Normalize the given `type`, for example "html" becomes "text/html".
+ *
+ * @param {String} type
+ * @return {Object}
+ * @api private
+ */
+
+exports.normalizeType = function(type){
+  return ~type.indexOf('/')
+    ? acceptParams(type)
+    : { value: mime.lookup(type), params: {} };
+};
+
+/**
+ * Normalize `types`, for example "html" becomes "text/html".
+ *
+ * @param {Array} types
+ * @return {Array}
+ * @api private
+ */
+
+exports.normalizeTypes = function(types){
+  var ret = [];
+
+  for (var i = 0; i < types.length; ++i) {
+    ret.push(exports.normalizeType(types[i]));
+  }
+
+  return ret;
+};
+
+/**
+ * Return the acceptable type in `types`, if any.
+ *
+ * @param {Array} types
+ * @param {String} str
+ * @return {String}
+ * @api private
+ */
+
+exports.acceptsArray = function(types, str){
+  // accept anything when Accept is not present
+  if (!str) return types[0];
+
+  // parse
+  var accepted = exports.parseAccept(str)
+    , normalized = exports.normalizeTypes(types)
+    , len = accepted.length;
+
+  for (var i = 0; i < len; ++i) {
+    for (var j = 0, jlen = types.length; j < jlen; ++j) {
+      if (exports.accept(normalized[j], accepted[i])) {
+        return types[j];
+      }
+    }
+  }
+};
+
+/**
+ * Check if `type(s)` are acceptable based on
+ * the given `str`.
+ *
+ * @param {String|Array} type(s)
+ * @param {String} str
+ * @return {Boolean|String}
+ * @api private
+ */
+
+exports.accepts = function(type, str){
+  if ('string' == typeof type) type = type.split(/ *, */);
+  return exports.acceptsArray(type, str);
+};
+
+/**
+ * Check if `type` array is acceptable for `other`.
+ *
+ * @param {Object} type
+ * @param {Object} other
+ * @return {Boolean}
+ * @api private
+ */
+
+exports.accept = function(type, other){
+  var t = type.value.split('/');
+  return (t[0] == other.type || '*' == other.type)
+    && (t[1] == other.subtype || '*' == other.subtype)
+    && paramsEqual(type.params, other.params);
+};
+
+/**
+ * Check if accept params are equal.
+ *
+ * @param {Object} a
+ * @param {Object} b
+ * @return {Boolean}
+ * @api private
+ */
+
+function paramsEqual(a, b){
+  return !Object.keys(a).some(function(k) {
+    return a[k] != b[k];
+  });
+}
+
+/**
+ * Parse accept `str`, returning
+ * an array objects containing
+ * `.type` and `.subtype` along
+ * with the values provided by
+ * `parseQuality()`.
+ *
+ * @param {Type} name
+ * @return {Type}
+ * @api private
+ */
+
+exports.parseAccept = function(str){
+  return exports
+    .parseParams(str)
+    .map(function(obj){
+      var parts = obj.value.split('/');
+      obj.type = parts[0];
+      obj.subtype = parts[1];
+      return obj;
+    });
+};
+
+/**
+ * Parse quality `str`, returning an
+ * array of objects with `.value`,
+ * `.quality` and optional `.params`
+ *
+ * @param {String} str
+ * @return {Array}
+ * @api private
+ */
+
+exports.parseParams = function(str){
+  return str
+    .split(/ *, */)
+    .map(acceptParams)
+    .filter(function(obj){
+      return obj.quality;
+    })
+    .sort(function(a, b){
+      if (a.quality === b.quality) {
+        return a.originalIndex - b.originalIndex;
+      } else {
+        return b.quality - a.quality;
+      }
+    });
+};
+
+/**
+ * Parse accept params `str` returning an
+ * object with `.value`, `.quality` and `.params`.
+ * also includes `.originalIndex` for stable sorting
+ *
+ * @param {String} str
+ * @return {Object}
+ * @api private
+ */
+
+function acceptParams(str, index) {
+  var parts = str.split(/ *; */);
+  var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index };
+
+  for (var i = 1; i < parts.length; ++i) {
+    var pms = parts[i].split(/ *= */);
+    if ('q' == pms[0]) {
+      ret.quality = parseFloat(pms[1]);
+    } else {
+      ret.params[pms[0]] = pms[1];
+    }
+  }
+
+  return ret;
+}
+
+/**
+ * Escape special characters in the given string of html.
+ *
+ * @param  {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html) {
+  return String(html)
+    .replace(/&/g, '&amp;')
+    .replace(/"/g, '&quot;')
+    .replace(/</g, '&lt;')
+    .replace(/>/g, '&gt;');
+};
+
+/**
+ * Normalize the given path string,
+ * returning a regular expression.
+ *
+ * An empty array should be passed,
+ * which will contain the placeholder
+ * key names. For example "/user/:id" will
+ * then contain ["id"].
+ *
+ * @param  {String|RegExp|Array} path
+ * @param  {Array} keys
+ * @param  {Boolean} sensitive
+ * @param  {Boolean} strict
+ * @return {RegExp}
+ * @api private
+ */
+
+exports.pathRegexp = function(path, keys, sensitive, strict) {
+  if (toString.call(path) == '[object RegExp]') return path;
+  if (Array.isArray(path)) path = '(' + path.join('|') + ')';
+  path = path
+    .concat(strict ? '' : '/?')
+    .replace(/\/\(/g, '(?:/')
+    .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)?/g, function(_, slash, format, key, capture, optional, star){
+      keys.push({ name: key, optional: !! optional });
+      slash = slash || '';
+      return ''
+        + (optional ? '' : slash)
+        + '(?:'
+        + (optional ? slash : '')
+        + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')'
+        + (optional || '')
+        + (star ? '(/*)?' : '');
+    })
+    .replace(/([\/.])/g, '\\$1')
+    .replace(/\*/g, '(.*)');
+  return new RegExp('^' + path + '$', sensitive ? '' : 'i');
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/view.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/lib/view.js
new file mode 100755 (executable)
index 0000000..ae20b17
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * Module dependencies.
+ */
+
+var path = require('path')
+  , fs = require('fs')
+  , utils = require('./utils')
+  , dirname = path.dirname
+  , basename = path.basename
+  , extname = path.extname
+  , exists = fs.existsSync || path.existsSync
+  , join = path.join;
+
+/**
+ * Expose `View`.
+ */
+
+module.exports = View;
+
+/**
+ * Initialize a new `View` with the given `name`.
+ *
+ * Options:
+ *
+ *   - `defaultEngine` the default template engine name
+ *   - `engines` template engine require() cache
+ *   - `root` root path for view lookup
+ *
+ * @param {String} name
+ * @param {Object} options
+ * @api private
+ */
+
+function View(name, options) {
+  options = options || {};
+  this.name = name;
+  this.root = options.root;
+  var engines = options.engines;
+  this.defaultEngine = options.defaultEngine;
+  var ext = this.ext = extname(name);
+  if (!ext) name += (ext = this.ext = ('.' != this.defaultEngine[0] ? '.' : '') + this.defaultEngine);
+  this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express);
+  this.path = this.lookup(name);
+}
+
+/**
+ * Lookup view by the given `path`
+ *
+ * @param {String} path
+ * @return {String}
+ * @api private
+ */
+
+View.prototype.lookup = function(path){
+  var ext = this.ext;
+
+  // <path>.<engine>
+  if (!utils.isAbsolute(path)) path = join(this.root, path);
+  if (exists(path)) return path;
+
+  // <path>/index.<engine>
+  path = join(dirname(path), basename(path, ext), 'index' + ext);
+  if (exists(path)) return path;
+};
+
+/**
+ * Render with the given `options` and callback `fn(err, str)`.
+ *
+ * @param {Object} options
+ * @param {Function} fn
+ * @api private
+ */
+
+View.prototype.render = function(options, fn){
+  this.engine(this.path, options, fn);
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/README.md
new file mode 100755 (executable)
index 0000000..0d9d8b8
--- /dev/null
@@ -0,0 +1,47 @@
+# buffer-crc32
+
+[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)
+
+crc32 that works with binary data and fancy character sets, outputs
+buffer, signed or unsigned data and has tests.
+
+Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
+
+# install
+```
+npm install buffer-crc32
+```
+
+# example
+```js
+var crc32 = require('buffer-crc32');
+// works with buffers
+var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
+crc32(buf) // -> <Buffer 94 5a ab 4a>
+
+// has convenience methods for getting signed or unsigned ints
+crc32.signed(buf) // -> -1805997238
+crc32.unsigned(buf) // -> 2488970058
+
+// will cast to buffer if given a string, so you can
+// directly use foreign characters safely
+crc32('自動販売機') // -> <Buffer cb 03 1a c5>
+
+// and works in append mode too
+var partialCrc = crc32('hey');
+var partialCrc = crc32(' ', partialCrc);
+var partialCrc = crc32('sup', partialCrc);
+var partialCrc = crc32(' ', partialCrc);
+var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
+```
+
+# tests
+This was tested against the output of zlib's crc32 method. You can run
+the tests with`npm test` (requires tap)
+
+# see also
+https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also
+supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
+
+# license
+MIT/X11
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/index.js
new file mode 100755 (executable)
index 0000000..e29ce3e
--- /dev/null
@@ -0,0 +1,88 @@
+var Buffer = require('buffer').Buffer;
+
+var CRC_TABLE = [
+  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+  0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+  0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+  0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+  0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+  0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+  0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+  0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+  0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+  0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+  0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+  0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+  0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+  0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+  0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+  0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+  0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+  0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+  0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+  0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+  0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+  0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+  0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+  0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+  0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+  0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+  0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+  0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+  0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+  0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+  0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+  0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+  0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+  0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+  0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+  0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+  0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+  0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+  0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+  0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+  0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+  0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+  0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+  0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+  0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+  0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+  0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+  0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+  0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+  0x2d02ef8d
+];
+
+function bufferizeInt(num) {
+  var tmp = Buffer(4);
+  tmp.writeInt32BE(num, 0);
+  return tmp;
+}
+
+function _crc32(buf, previous) {
+  if (!Buffer.isBuffer(buf)) {
+    buf = Buffer(buf);
+  }
+  if (Buffer.isBuffer(previous)) {
+    previous = previous.readUInt32BE(0);
+  }
+  var crc = ~~previous ^ -1;
+  for (var n = 0; n < buf.length; n++) {
+    crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
+  }
+  return (crc ^ -1);
+}
+
+function crc32() {
+  return bufferizeInt(_crc32.apply(null, arguments));
+}
+crc32.signed = function () {
+  return _crc32.apply(null, arguments);
+};
+crc32.unsigned = function () {
+  return _crc32.apply(null, arguments) >>> 0;
+};
+
+module.exports = crc32;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/package.json
new file mode 100755 (executable)
index 0000000..40a1eaa
--- /dev/null
@@ -0,0 +1,56 @@
+{
+  "author": {
+    "name": "Brian J. Brennan",
+    "email": "brianloveswords@gmail.com",
+    "url": "http://bjb.io"
+  },
+  "name": "buffer-crc32",
+  "description": "A pure javascript CRC32 algorithm that plays nice with binary data",
+  "version": "0.2.1",
+  "contributors": [
+    {
+      "name": "Vladimir Kuznetsov"
+    }
+  ],
+  "homepage": "https://github.com/brianloveswords/buffer-crc32",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/brianloveswords/buffer-crc32.git"
+  },
+  "main": "index.js",
+  "scripts": {
+    "test": "tap tests/*.test.js"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "tap": "~0.2.5"
+  },
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_id": "buffer-crc32@0.2.1",
+  "dist": {
+    "shasum": "be3e5382fc02b6d6324956ac1af98aa98b08534c",
+    "tarball": "http://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz"
+  },
+  "_npmVersion": "1.1.65",
+  "_npmUser": {
+    "name": "brianloveswords",
+    "email": "brian@nyhacker.org"
+  },
+  "maintainers": [
+    {
+      "name": "brianloveswords",
+      "email": "brian@nyhacker.org"
+    }
+  ],
+  "directories": {},
+  "_shasum": "be3e5382fc02b6d6324956ac1af98aa98b08534c",
+  "_from": "buffer-crc32@0.2.1",
+  "_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz",
+  "bugs": {
+    "url": "https://github.com/brianloveswords/buffer-crc32/issues"
+  },
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js
new file mode 100755 (executable)
index 0000000..bb0f9ef
--- /dev/null
@@ -0,0 +1,89 @@
+var crc32 = require('..');
+var test = require('tap').test;
+
+test('simple crc32 is no problem', function (t) {
+  var input = Buffer('hey sup bros');
+  var expected = Buffer([0x47, 0xfa, 0x55, 0x70]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('another simple one', function (t) {
+  var input = Buffer('IEND');
+  var expected = Buffer([0xae, 0x42, 0x60, 0x82]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('slightly more complex', function (t) {
+  var input = Buffer([0x00, 0x00, 0x00]);
+  var expected = Buffer([0xff, 0x41, 0xd9, 0x12]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('complex crc32 gets calculated like a champ', function (t) {
+  var input = Buffer('शीर्षक');
+  var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('casts to buffer if necessary', function (t) {
+  var input = 'शीर्षक';
+  var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]);
+  t.same(crc32(input), expected);
+  t.end();
+});
+
+test('can do signed', function (t) {
+  var input = 'ham sandwich';
+  var expected = -1891873021;
+  t.same(crc32.signed(input), expected);
+  t.end();
+});
+
+test('can do unsigned', function (t) {
+  var input = 'bear sandwich';
+  var expected = 3711466352;
+  t.same(crc32.unsigned(input), expected);
+  t.end();
+});
+
+
+test('simple crc32 in append mode', function (t) {
+  var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')];
+  var expected = Buffer([0x47, 0xfa, 0x55, 0x70]);
+  for (var crc = 0, i = 0; i < input.length; i++) {
+    crc = crc32(input[i], crc);
+  }
+  t.same(crc, expected);
+  t.end();
+});
+
+
+test('can do signed in append mode', function (t) {
+  var input1 = 'ham';
+  var input2 = ' ';
+  var input3 = 'sandwich';
+  var expected = -1891873021;
+
+  var crc = crc32.signed(input1);
+  crc = crc32.signed(input2, crc);
+  crc = crc32.signed(input3, crc);
+
+  t.same(crc, expected);
+  t.end();
+});
+
+test('can do unsigned in append mode', function (t) {
+  var input1 = 'bear san';
+  var input2 = 'dwich';
+  var expected = 3711466352;
+
+  var crc = crc32.unsigned(input1);
+  crc = crc32.unsigned(input2, crc);
+  t.same(crc, expected);
+  t.end();
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/History.md
new file mode 100755 (executable)
index 0000000..4961d2e
--- /dev/null
@@ -0,0 +1,107 @@
+
+0.6.1 / 2012-06-01 
+==================
+
+  * Added: append (yes or no) on confirmation
+  * Added: allow node.js v0.7.x
+
+0.6.0 / 2012-04-10 
+==================
+
+  * Added `.prompt(obj, callback)` support. Closes #49
+  * Added default support to .choose(). Closes #41
+  * Fixed the choice example
+
+0.5.1 / 2011-12-20 
+==================
+
+  * Fixed `password()` for recent nodes. Closes #36
+
+0.5.0 / 2011-12-04 
+==================
+
+  * Added sub-command option support [itay]
+
+0.4.3 / 2011-12-04 
+==================
+
+  * Fixed custom help ordering. Closes #32
+
+0.4.2 / 2011-11-24 
+==================
+
+  * Added travis support
+  * Fixed: line-buffered input automatically trimmed. Closes #31
+
+0.4.1 / 2011-11-18 
+==================
+
+  * Removed listening for "close" on --help
+
+0.4.0 / 2011-11-15 
+==================
+
+  * Added support for `--`. Closes #24
+
+0.3.3 / 2011-11-14 
+==================
+
+  * Fixed: wait for close event when writing help info [Jerry Hamlet]
+
+0.3.2 / 2011-11-01 
+==================
+
+  * Fixed long flag definitions with values [felixge]
+
+0.3.1 / 2011-10-31 
+==================
+
+  * Changed `--version` short flag to `-V` from `-v`
+  * Changed `.version()` so it's configurable [felixge]
+
+0.3.0 / 2011-10-31 
+==================
+
+  * Added support for long flags only. Closes #18
+
+0.2.1 / 2011-10-24 
+==================
+
+  * "node": ">= 0.4.x < 0.7.0". Closes #20
+
+0.2.0 / 2011-09-26 
+==================
+
+  * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
+
+0.1.0 / 2011-08-24 
+==================
+
+  * Added support for custom `--help` output
+
+0.0.5 / 2011-08-18 
+==================
+
+  * Changed: when the user enters nothing prompt for password again
+  * Fixed issue with passwords beginning with numbers [NuckChorris]
+
+0.0.4 / 2011-08-15 
+==================
+
+  * Fixed `Commander#args`
+
+0.0.3 / 2011-08-15 
+==================
+
+  * Added default option value support
+
+0.0.2 / 2011-08-15 
+==================
+
+  * Added mask support to `Command#password(str[, mask], fn)`
+  * Added `Command#password(str, fn)`
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/Makefile
new file mode 100755 (executable)
index 0000000..0074625
--- /dev/null
@@ -0,0 +1,7 @@
+
+TESTS = $(shell find test/test.*.js)
+
+test:
+       @./test/run $(TESTS)
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/Readme.md
new file mode 100755 (executable)
index 0000000..b8328c3
--- /dev/null
@@ -0,0 +1,262 @@
+# Commander.js
+
+  The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).
+
+ [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
+
+## Installation
+
+    $ npm install commander
+
+## Option parsing
+
+ Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+
+program
+  .version('0.0.1')
+  .option('-p, --peppers', 'Add peppers')
+  .option('-P, --pineapple', 'Add pineapple')
+  .option('-b, --bbq', 'Add bbq sauce')
+  .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+  .parse(process.argv);
+
+console.log('you ordered a pizza with:');
+if (program.peppers) console.log('  - peppers');
+if (program.pineapple) console.log('  - pineappe');
+if (program.bbq) console.log('  - bbq');
+console.log('  - %s cheese', program.cheese);
+```
+
+ Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
+
+## Automated --help
+
+ The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
+
+```  
+ $ ./examples/pizza --help
+
+   Usage: pizza [options]
+
+   Options:
+
+     -V, --version        output the version number
+     -p, --peppers        Add peppers
+     -P, --pineapple      Add pineappe
+     -b, --bbq            Add bbq sauce
+     -c, --cheese <type>  Add the specified type of cheese [marble]
+     -h, --help           output usage information
+
+```
+
+## Coercion
+
+```js
+function range(val) {
+  return val.split('..').map(Number);
+}
+
+function list(val) {
+  return val.split(',');
+}
+
+program
+  .version('0.0.1')
+  .usage('[options] <file ...>')
+  .option('-i, --integer <n>', 'An integer argument', parseInt)
+  .option('-f, --float <n>', 'A float argument', parseFloat)
+  .option('-r, --range <a>..<b>', 'A range', range)
+  .option('-l, --list <items>', 'A list', list)
+  .option('-o, --optional [value]', 'An optional value')
+  .parse(process.argv);
+
+console.log(' int: %j', program.integer);
+console.log(' float: %j', program.float);
+console.log(' optional: %j', program.optional);
+program.range = program.range || [];
+console.log(' range: %j..%j', program.range[0], program.range[1]);
+console.log(' list: %j', program.list);
+console.log(' args: %j', program.args);
+```
+
+## Custom help
+
+ You can display arbitrary `-h, --help` information
+ by listening for "--help". Commander will automatically
+ exit once you are done so that the remainder of your program
+ does not execute causing undesired behaviours, for example
+ in the following executable "stuff" will not output when
+ `--help` is used.
+
+```js
+#!/usr/bin/env node
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('../');
+
+function list(val) {
+  return val.split(',').map(Number);
+}
+
+program
+  .version('0.0.1')
+  .option('-f, --foo', 'enable some foo')
+  .option('-b, --bar', 'enable some bar')
+  .option('-B, --baz', 'enable some baz');
+
+// must be before .parse() since
+// node's emit() is immediate
+
+program.on('--help', function(){
+  console.log('  Examples:');
+  console.log('');
+  console.log('    $ custom-help --help');
+  console.log('    $ custom-help -h');
+  console.log('');
+});
+
+program.parse(process.argv);
+
+console.log('stuff');
+```
+
+yielding the following help output:
+
+```
+
+Usage: custom-help [options]
+
+Options:
+
+  -h, --help     output usage information
+  -V, --version  output the version number
+  -f, --foo      enable some foo
+  -b, --bar      enable some bar
+  -B, --baz      enable some baz
+
+Examples:
+
+  $ custom-help --help
+  $ custom-help -h
+
+```
+
+## .prompt(msg, fn)
+
+ Single-line prompt:
+
+```js
+program.prompt('name: ', function(name){
+  console.log('hi %s', name);
+});
+```
+
+ Multi-line prompt:
+
+```js
+program.prompt('description:', function(name){
+  console.log('hi %s', name);
+});
+```
+
+ Coercion:
+
+```js
+program.prompt('Age: ', Number, function(age){
+  console.log('age: %j', age);
+});
+```
+
+```js
+program.prompt('Birthdate: ', Date, function(date){
+  console.log('date: %s', date);
+});
+```
+
+## .password(msg[, mask], fn)
+
+Prompt for password without echoing:
+
+```js
+program.password('Password: ', function(pass){
+  console.log('got "%s"', pass);
+  process.stdin.destroy();
+});
+```
+
+Prompt for password with mask char "*":
+
+```js
+program.password('Password: ', '*', function(pass){
+  console.log('got "%s"', pass);
+  process.stdin.destroy();
+});
+```
+
+## .confirm(msg, fn)
+
+ Confirm with the given `msg`:
+
+```js
+program.confirm('continue? ', function(ok){
+  console.log(' got %j', ok);
+});
+```
+
+## .choose(list, fn)
+
+ Let the user choose from a `list`:
+
+```js
+var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+
+console.log('Choose the coolest pet:');
+program.choose(list, function(i){
+  console.log('you chose %d "%s"', i, list[i]);
+});
+```
+
+## Links
+
+ - [API documentation](http://visionmedia.github.com/commander.js/)
+ - [ascii tables](https://github.com/LearnBoost/cli-table)
+ - [progress bars](https://github.com/visionmedia/node-progress)
+ - [more progress bars](https://github.com/substack/node-multimeter)
+ - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/index.js
new file mode 100755 (executable)
index 0000000..06ec1e4
--- /dev/null
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/commander');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/lib/commander.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/lib/commander.js
new file mode 100755 (executable)
index 0000000..5ba87eb
--- /dev/null
@@ -0,0 +1,1026 @@
+
+/*!
+ * commander
+ * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+  , path = require('path')
+  , tty = require('tty')
+  , basename = path.basename;
+
+/**
+ * Expose the root command.
+ */
+
+exports = module.exports = new Command;
+
+/**
+ * Expose `Command`.
+ */
+
+exports.Command = Command;
+
+/**
+ * Expose `Option`.
+ */
+
+exports.Option = Option;
+
+/**
+ * Initialize a new `Option` with the given `flags` and `description`.
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @api public
+ */
+
+function Option(flags, description) {
+  this.flags = flags;
+  this.required = ~flags.indexOf('<');
+  this.optional = ~flags.indexOf('[');
+  this.bool = !~flags.indexOf('-no-');
+  flags = flags.split(/[ ,|]+/);
+  if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
+  this.long = flags.shift();
+  this.description = description;
+}
+
+/**
+ * Return option name.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Option.prototype.name = function(){
+  return this.long
+    .replace('--', '')
+    .replace('no-', '');
+};
+
+/**
+ * Check if `arg` matches the short or long flag.
+ *
+ * @param {String} arg
+ * @return {Boolean}
+ * @api private
+ */
+
+Option.prototype.is = function(arg){
+  return arg == this.short
+    || arg == this.long;
+};
+
+/**
+ * Initialize a new `Command`.
+ *
+ * @param {String} name
+ * @api public
+ */
+
+function Command(name) {
+  this.commands = [];
+  this.options = [];
+  this.args = [];
+  this.name = name;
+}
+
+/**
+ * Inherit from `EventEmitter.prototype`.
+ */
+
+Command.prototype.__proto__ = EventEmitter.prototype;
+
+/**
+ * Add command `name`.
+ *
+ * The `.action()` callback is invoked when the
+ * command `name` is specified via __ARGV__,
+ * and the remaining arguments are applied to the
+ * function for access.
+ *
+ * When the `name` is "*" an un-matched command
+ * will be passed as the first arg, followed by
+ * the rest of __ARGV__ remaining.
+ *
+ * Examples:
+ *
+ *      program
+ *        .version('0.0.1')
+ *        .option('-C, --chdir <path>', 'change the working directory')
+ *        .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
+ *        .option('-T, --no-tests', 'ignore test hook')
+ *     
+ *      program
+ *        .command('setup')
+ *        .description('run remote setup commands')
+ *        .action(function(){
+ *          console.log('setup');
+ *        });
+ *     
+ *      program
+ *        .command('exec <cmd>')
+ *        .description('run the given remote command')
+ *        .action(function(cmd){
+ *          console.log('exec "%s"', cmd);
+ *        });
+ *     
+ *      program
+ *        .command('*')
+ *        .description('deploy the given env')
+ *        .action(function(env){
+ *          console.log('deploying "%s"', env);
+ *        });
+ *     
+ *      program.parse(process.argv);
+  *
+ * @param {String} name
+ * @return {Command} the new command
+ * @api public
+ */
+
+Command.prototype.command = function(name){
+  var args = name.split(/ +/);
+  var cmd = new Command(args.shift());
+  this.commands.push(cmd);
+  cmd.parseExpectedArgs(args);
+  cmd.parent = this;
+  return cmd;
+};
+
+/**
+ * Parse expected `args`.
+ *
+ * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parseExpectedArgs = function(args){
+  if (!args.length) return;
+  var self = this;
+  args.forEach(function(arg){
+    switch (arg[0]) {
+      case '<':
+        self.args.push({ required: true, name: arg.slice(1, -1) });
+        break;
+      case '[':
+        self.args.push({ required: false, name: arg.slice(1, -1) });
+        break;
+    }
+  });
+  return this;
+};
+
+/**
+ * Register callback `fn` for the command.
+ *
+ * Examples:
+ *
+ *      program
+ *        .command('help')
+ *        .description('display verbose help')
+ *        .action(function(){
+ *           // output help here
+ *        });
+ *
+ * @param {Function} fn
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.action = function(fn){
+  var self = this;
+  this.parent.on(this.name, function(args, unknown){    
+    // Parse any so-far unknown options
+    unknown = unknown || [];
+    var parsed = self.parseOptions(unknown);
+    
+    // Output help if necessary
+    outputHelpIfNecessary(self, parsed.unknown);
+    
+    // If there are still any unknown options, then we simply 
+    // die, unless someone asked for help, in which case we give it
+    // to them, and then we die.
+    if (parsed.unknown.length > 0) {      
+      self.unknownOption(parsed.unknown[0]);
+    }
+    
+    self.args.forEach(function(arg, i){
+      if (arg.required && null == args[i]) {
+        self.missingArgument(arg.name);
+      }
+    });
+    
+    // Always append ourselves to the end of the arguments,
+    // to make sure we match the number of arguments the user
+    // expects
+    if (self.args.length) {
+      args[self.args.length] = self;
+    } else {
+      args.push(self);
+    }
+    
+    fn.apply(this, args);
+  });
+  return this;
+};
+
+/**
+ * Define option with `flags`, `description` and optional
+ * coercion `fn`. 
+ *
+ * The `flags` string should contain both the short and long flags,
+ * separated by comma, a pipe or space. The following are all valid
+ * all will output this way when `--help` is used.
+ *
+ *    "-p, --pepper"
+ *    "-p|--pepper"
+ *    "-p --pepper"
+ *
+ * Examples:
+ *
+ *     // simple boolean defaulting to false
+ *     program.option('-p, --pepper', 'add pepper');
+ *
+ *     --pepper
+ *     program.pepper
+ *     // => Boolean
+ *
+ *     // simple boolean defaulting to false
+ *     program.option('-C, --no-cheese', 'remove cheese');
+ *
+ *     program.cheese
+ *     // => true
+ *
+ *     --no-cheese
+ *     program.cheese
+ *     // => true
+ *
+ *     // required argument
+ *     program.option('-C, --chdir <path>', 'change the working directory');
+ *
+ *     --chdir /tmp
+ *     program.chdir
+ *     // => "/tmp"
+ *
+ *     // optional argument
+ *     program.option('-c, --cheese [type]', 'add cheese [marble]');
+ *
+ * @param {String} flags
+ * @param {String} description
+ * @param {Function|Mixed} fn or default
+ * @param {Mixed} defaultValue
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.option = function(flags, description, fn, defaultValue){
+  var self = this
+    , option = new Option(flags, description)
+    , oname = option.name()
+    , name = camelcase(oname);
+
+  // default as 3rd arg
+  if ('function' != typeof fn) defaultValue = fn, fn = null;
+
+  // preassign default value only for --no-*, [optional], or <required>
+  if (false == option.bool || option.optional || option.required) {
+    // when --no-* we make sure default is true
+    if (false == option.bool) defaultValue = true;
+    // preassign only if we have a default
+    if (undefined !== defaultValue) self[name] = defaultValue;
+  }
+
+  // register the option
+  this.options.push(option);
+
+  // when it's passed assign the value
+  // and conditionally invoke the callback
+  this.on(oname, function(val){
+    // coercion
+    if (null != val && fn) val = fn(val);
+
+    // unassigned or bool
+    if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) {
+      // if no value, bool true, and we have a default, then use it!
+      if (null == val) {
+        self[name] = option.bool
+          ? defaultValue || true
+          : false;
+      } else {
+        self[name] = val;
+      }
+    } else if (null !== val) {
+      // reassign
+      self[name] = val;
+    }
+  });
+
+  return this;
+};
+
+/**
+ * Parse `argv`, settings options and invoking commands when defined.
+ *
+ * @param {Array} argv
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.parse = function(argv){
+  // store raw args
+  this.rawArgs = argv;
+
+  // guess name
+  if (!this.name) this.name = basename(argv[1]);
+
+  // process argv
+  var parsed = this.parseOptions(this.normalize(argv.slice(2)));
+  this.args = parsed.args;
+  return this.parseArgs(this.args, parsed.unknown);
+};
+
+/**
+ * Normalize `args`, splitting joined short flags. For example
+ * the arg "-abc" is equivalent to "-a -b -c".
+ *
+ * @param {Array} args
+ * @return {Array}
+ * @api private
+ */
+
+Command.prototype.normalize = function(args){
+  var ret = []
+    , arg;
+
+  for (var i = 0, len = args.length; i < len; ++i) {
+    arg = args[i];
+    if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) {
+      arg.slice(1).split('').forEach(function(c){
+        ret.push('-' + c);
+      });
+    } else {
+      ret.push(arg);
+    }
+  }
+
+  return ret;
+};
+
+/**
+ * Parse command `args`.
+ *
+ * When listener(s) are available those
+ * callbacks are invoked, otherwise the "*"
+ * event is emitted and those actions are invoked.
+ *
+ * @param {Array} args
+ * @return {Command} for chaining
+ * @api private
+ */
+
+Command.prototype.parseArgs = function(args, unknown){
+  var cmds = this.commands
+    , len = cmds.length
+    , name;
+
+  if (args.length) {
+    name = args[0];
+    if (this.listeners(name).length) {
+      this.emit(args.shift(), args, unknown);
+    } else {
+      this.emit('*', args);
+    }
+  } else {
+    outputHelpIfNecessary(this, unknown);
+    
+    // If there were no args and we have unknown options,
+    // then they are extraneous and we need to error.
+    if (unknown.length > 0) {      
+      this.unknownOption(unknown[0]);
+    }
+  }
+
+  return this;
+};
+
+/**
+ * Return an option matching `arg` if any.
+ *
+ * @param {String} arg
+ * @return {Option}
+ * @api private
+ */
+
+Command.prototype.optionFor = function(arg){
+  for (var i = 0, len = this.options.length; i < len; ++i) {
+    if (this.options[i].is(arg)) {
+      return this.options[i];
+    }
+  }
+};
+
+/**
+ * Parse options from `argv` returning `argv`
+ * void of these options.
+ *
+ * @param {Array} argv
+ * @return {Array}
+ * @api public
+ */
+
+Command.prototype.parseOptions = function(argv){
+  var args = []
+    , len = argv.length
+    , literal
+    , option
+    , arg;
+
+  var unknownOptions = [];
+
+  // parse options
+  for (var i = 0; i < len; ++i) {
+    arg = argv[i];
+
+    // literal args after --
+    if ('--' == arg) {
+      literal = true;
+      continue;
+    }
+
+    if (literal) {
+      args.push(arg);
+      continue;
+    }
+
+    // find matching Option
+    option = this.optionFor(arg);
+
+    // option is defined
+    if (option) {
+      // requires arg
+      if (option.required) {
+        arg = argv[++i];
+        if (null == arg) return this.optionMissingArgument(option);
+        if ('-' == arg[0]) return this.optionMissingArgument(option, arg);
+        this.emit(option.name(), arg);
+      // optional arg
+      } else if (option.optional) {
+        arg = argv[i+1];
+        if (null == arg || '-' == arg[0]) {
+          arg = null;
+        } else {
+          ++i;
+        }
+        this.emit(option.name(), arg);
+      // bool
+      } else {
+        this.emit(option.name());
+      }
+      continue;
+    }
+    
+    // looks like an option
+    if (arg.length > 1 && '-' == arg[0]) {
+      unknownOptions.push(arg);
+      
+      // If the next argument looks like it might be
+      // an argument for this option, we pass it on.
+      // If it isn't, then it'll simply be ignored
+      if (argv[i+1] && '-' != argv[i+1][0]) {
+        unknownOptions.push(argv[++i]);
+      }
+      continue;
+    }
+    
+    // arg
+    args.push(arg);
+  }
+  
+  return { args: args, unknown: unknownOptions };
+};
+
+/**
+ * Argument `name` is missing.
+ *
+ * @param {String} name
+ * @api private
+ */
+
+Command.prototype.missingArgument = function(name){
+  console.error();
+  console.error("  error: missing required argument `%s'", name);
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * `Option` is missing an argument, but received `flag` or nothing.
+ *
+ * @param {String} option
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.optionMissingArgument = function(option, flag){
+  console.error();
+  if (flag) {
+    console.error("  error: option `%s' argument missing, got `%s'", option.flags, flag);
+  } else {
+    console.error("  error: option `%s' argument missing", option.flags);
+  }
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * Unknown option `flag`.
+ *
+ * @param {String} flag
+ * @api private
+ */
+
+Command.prototype.unknownOption = function(flag){
+  console.error();
+  console.error("  error: unknown option `%s'", flag);
+  console.error();
+  process.exit(1);
+};
+
+/**
+ * Set the program version to `str`.
+ *
+ * This method auto-registers the "-V, --version" flag
+ * which will print the version number when passed.
+ *
+ * @param {String} str
+ * @param {String} flags
+ * @return {Command} for chaining
+ * @api public
+ */
+
+Command.prototype.version = function(str, flags){
+  if (0 == arguments.length) return this._version;
+  this._version = str;
+  flags = flags || '-V, --version';
+  this.option(flags, 'output the version number');
+  this.on('version', function(){
+    console.log(str);
+    process.exit(0);
+  });
+  return this;
+};
+
+/**
+ * Set the description `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.description = function(str){
+  if (0 == arguments.length) return this._description;
+  this._description = str;
+  return this;
+};
+
+/**
+ * Set / get the command usage `str`.
+ *
+ * @param {String} str
+ * @return {String|Command}
+ * @api public
+ */
+
+Command.prototype.usage = function(str){
+  var args = this.args.map(function(arg){
+    return arg.required
+      ? '<' + arg.name + '>'
+      : '[' + arg.name + ']';
+  });
+
+  var usage = '[options'
+    + (this.commands.length ? '] [command' : '')
+    + ']'
+    + (this.args.length ? ' ' + args : '');
+  if (0 == arguments.length) return this._usage || usage;
+  this._usage = str;
+
+  return this;
+};
+
+/**
+ * Return the largest option length.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+Command.prototype.largestOptionLength = function(){
+  return this.options.reduce(function(max, option){
+    return Math.max(max, option.flags.length);
+  }, 0);
+};
+
+/**
+ * Return help for options.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.optionHelp = function(){
+  var width = this.largestOptionLength();
+  
+  // Prepend the help information
+  return [pad('-h, --help', width) + '  ' + 'output usage information']
+    .concat(this.options.map(function(option){
+      return pad(option.flags, width)
+        + '  ' + option.description;
+      }))
+    .join('\n');
+};
+
+/**
+ * Return command help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.commandHelp = function(){
+  if (!this.commands.length) return '';
+  return [
+      ''
+    , '  Commands:'
+    , ''
+    , this.commands.map(function(cmd){
+      var args = cmd.args.map(function(arg){
+        return arg.required
+          ? '<' + arg.name + '>'
+          : '[' + arg.name + ']';
+      }).join(' ');
+
+      return cmd.name 
+        + (cmd.options.length 
+          ? ' [options]'
+          : '') + ' ' + args
+        + (cmd.description()
+          ? '\n' + cmd.description()
+          : '');
+    }).join('\n\n').replace(/^/gm, '    ')
+    , ''
+  ].join('\n');
+};
+
+/**
+ * Return program help documentation.
+ *
+ * @return {String}
+ * @api private
+ */
+
+Command.prototype.helpInformation = function(){
+  return [
+      ''
+    , '  Usage: ' + this.name + ' ' + this.usage()
+    , '' + this.commandHelp()
+    , '  Options:'
+    , ''
+    , '' + this.optionHelp().replace(/^/gm, '    ')
+    , ''
+    , ''
+  ].join('\n');
+};
+
+/**
+ * Prompt for a `Number`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForNumber = function(str, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseNumber(val){
+    val = Number(val);
+    if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber);
+    fn(val);
+  });
+};
+
+/**
+ * Prompt for a `Date`.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptForDate = function(str, fn){
+  var self = this;
+  this.promptSingleLine(str, function parseDate(val){
+    val = new Date(val);
+    if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate);
+    fn(val);
+  });
+};
+
+/**
+ * Single-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptSingleLine = function(str, fn){
+  if ('function' == typeof arguments[2]) {
+    return this['promptFor' + (fn.name || fn)](str, arguments[2]);
+  }
+
+  process.stdout.write(str);
+  process.stdin.setEncoding('utf8');
+  process.stdin.once('data', function(val){
+    fn(val.trim());
+  }).resume();
+};
+
+/**
+ * Multi-line prompt.
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api private
+ */
+
+Command.prototype.promptMultiLine = function(str, fn){
+  var buf = [];
+  console.log(str);
+  process.stdin.setEncoding('utf8');
+  process.stdin.on('data', function(val){
+    if ('\n' == val || '\r\n' == val) {
+      process.stdin.removeAllListeners('data');
+      fn(buf.join('\n'));
+    } else {
+      buf.push(val.trimRight());
+    }
+  }).resume();
+};
+
+/**
+ * Prompt `str` and callback `fn(val)`
+ *
+ * Commander supports single-line and multi-line prompts.
+ * To issue a single-line prompt simply add white-space
+ * to the end of `str`, something like "name: ", whereas
+ * for a multi-line prompt omit this "description:".
+ *
+ *
+ * Examples:
+ *
+ *     program.prompt('Username: ', function(name){
+ *       console.log('hi %s', name);
+ *     });
+ *     
+ *     program.prompt('Description:', function(desc){
+ *       console.log('description was "%s"', desc.trim());
+ *     });
+ *
+ * @param {String|Object} str
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.prompt = function(str, fn){
+  var self = this;
+
+  if ('string' == typeof str) {
+    if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments);
+    this.promptMultiLine(str, fn);
+  } else {
+    var keys = Object.keys(str)
+      , obj = {};
+
+    function next() {
+      var key = keys.shift()
+        , label = str[key];
+
+      if (!key) return fn(obj);
+      self.prompt(label, function(val){
+        obj[key] = val;
+        next();
+      });
+    }
+
+    next();
+  }
+};
+
+/**
+ * Prompt for password with `str`, `mask` char and callback `fn(val)`.
+ *
+ * The mask string defaults to '', aka no output is
+ * written while typing, you may want to use "*" etc.
+ *
+ * Examples:
+ *
+ *     program.password('Password: ', function(pass){
+ *       console.log('got "%s"', pass);
+ *       process.stdin.destroy();
+ *     });
+ *
+ *     program.password('Password: ', '*', function(pass){
+ *       console.log('got "%s"', pass);
+ *       process.stdin.destroy();
+ *     });
+ *
+ * @param {String} str
+ * @param {String} mask
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.password = function(str, mask, fn){
+  var self = this
+    , buf = '';
+
+  // default mask
+  if ('function' == typeof mask) {
+    fn = mask;
+    mask = '';
+  }
+
+  process.stdin.resume();
+  tty.setRawMode(true);
+  process.stdout.write(str);
+
+  // keypress
+  process.stdin.on('keypress', function(c, key){
+    if (key && 'enter' == key.name) {
+      console.log();
+      process.stdin.removeAllListeners('keypress');
+      tty.setRawMode(false);
+      if (!buf.trim().length) return self.password(str, mask, fn);
+      fn(buf);
+      return;
+    }
+
+    if (key && key.ctrl && 'c' == key.name) {
+      console.log('%s', buf);
+      process.exit();
+    }
+
+    process.stdout.write(mask);
+    buf += c;
+  }).resume();
+};
+
+/**
+ * Confirmation prompt with `str` and callback `fn(bool)`
+ *
+ * Examples:
+ *
+ *      program.confirm('continue? ', function(ok){
+ *        console.log(' got %j', ok);
+ *        process.stdin.destroy();
+ *      });
+ *
+ * @param {String} str
+ * @param {Function} fn
+ * @api public
+ */
+
+
+Command.prototype.confirm = function(str, fn, verbose){
+  var self = this;
+  this.prompt(str, function(ok){
+    if (!ok.trim()) {
+      if (!verbose) str += '(yes or no) ';
+      return self.confirm(str, fn, true);
+    }
+    fn(parseBool(ok));
+  });
+};
+
+/**
+ * Choice prompt with `list` of items and callback `fn(index, item)`
+ *
+ * Examples:
+ *
+ *      var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
+ *      
+ *      console.log('Choose the coolest pet:');
+ *      program.choose(list, function(i){
+ *        console.log('you chose %d "%s"', i, list[i]);
+ *        process.stdin.destroy();
+ *      });
+ *
+ * @param {Array} list
+ * @param {Number|Function} index or fn
+ * @param {Function} fn
+ * @api public
+ */
+
+Command.prototype.choose = function(list, index, fn){
+  var self = this
+    , hasDefault = 'number' == typeof index;
+
+  if (!hasDefault) {
+    fn = index;
+    index = null;
+  }
+
+  list.forEach(function(item, i){
+    if (hasDefault && i == index) {
+      console.log('* %d) %s', i + 1, item);
+    } else {
+      console.log('  %d) %s', i + 1, item);
+    }
+  });
+
+  function again() {
+    self.prompt('  : ', function(val){
+      val = parseInt(val, 10) - 1;
+      if (hasDefault && isNaN(val)) val = index;
+
+      if (null == list[val]) {
+        again();
+      } else {
+        fn(val, list[val]);
+      }
+    });
+  }
+
+  again();
+};
+
+/**
+ * Camel-case the given `flag`
+ *
+ * @param {String} flag
+ * @return {String}
+ * @api private
+ */
+
+function camelcase(flag) {
+  return flag.split('-').reduce(function(str, word){
+    return str + word[0].toUpperCase() + word.slice(1);
+  });
+}
+
+/**
+ * Parse a boolean `str`.
+ *
+ * @param {String} str
+ * @return {Boolean}
+ * @api private
+ */
+
+function parseBool(str) {
+  return /^y|yes|ok|true$/i.test(str);
+}
+
+/**
+ * Pad `str` to `width`.
+ *
+ * @param {String} str
+ * @param {Number} width
+ * @return {String}
+ * @api private
+ */
+
+function pad(str, width) {
+  var len = Math.max(0, width - str.length);
+  return str + Array(len + 1).join(' ');
+}
+
+/**
+ * Output help information if necessary
+ *
+ * @param {Command} command to output help for
+ * @param {Array} array of options to search for -h or --help
+ * @api private
+ */
+
+function outputHelpIfNecessary(cmd, options) {
+  options = options || [];
+  for (var i = 0; i < options.length; i++) {
+    if (options[i] == '--help' || options[i] == '-h') {
+      process.stdout.write(cmd.helpInformation());
+      cmd.emit('--help');
+      process.exit(0);
+    }
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/commander/package.json
new file mode 100755 (executable)
index 0000000..cfb85d1
--- /dev/null
@@ -0,0 +1,60 @@
+{
+  "name": "commander",
+  "version": "0.6.1",
+  "description": "the complete solution for node.js command-line programs",
+  "keywords": [
+    "command",
+    "option",
+    "parser",
+    "prompt",
+    "stdin"
+  ],
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/visionmedia/commander.js.git"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "should": ">= 0.0.1"
+  },
+  "scripts": {
+    "test": "make test"
+  },
+  "main": "index",
+  "engines": {
+    "node": ">= 0.4.x"
+  },
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "_id": "commander@0.6.1",
+  "optionalDependencies": {},
+  "_engineSupported": true,
+  "_npmVersion": "1.1.0-3",
+  "_nodeVersion": "v0.6.12",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06",
+    "tarball": "http://registry.npmjs.org/commander/-/commander-0.6.1.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06",
+  "_from": "commander@0.6.1",
+  "_resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz",
+  "bugs": {
+    "url": "https://github.com/visionmedia/commander.js/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/visionmedia/commander.js"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/LICENSE
new file mode 100755 (executable)
index 0000000..0c5d22d
--- /dev/null
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2010 Sencha Inc.
+Copyright (c) 2011 LearnBoost
+Copyright (c) 2011 TJ Holowaychuk
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/Readme.md
new file mode 100755 (executable)
index 0000000..7d65f9c
--- /dev/null
@@ -0,0 +1,133 @@
+[![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect)
+# Connect
+
+  Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_.
+
+ Connect is bundled with over _20_ commonly used middleware, including
+ a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/).
+
+```js
+var connect = require('connect')
+  , http = require('http');
+
+var app = connect()
+  .use(connect.favicon())
+  .use(connect.logger('dev'))
+  .use(connect.static('public'))
+  .use(connect.directory('public'))
+  .use(connect.cookieParser())
+  .use(connect.session({ secret: 'my secret here' }))
+  .use(function(req, res){
+    res.end('Hello from Connect!\n');
+  });
+
+http.createServer(app).listen(3000);
+```
+
+## Middleware
+
+  - [csrf](http://www.senchalabs.org/connect/csrf.html)
+  - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html)
+  - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html)
+  - [json](http://www.senchalabs.org/connect/json.html)
+  - [multipart](http://www.senchalabs.org/connect/multipart.html)
+  - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html)
+  - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html)
+  - [directory](http://www.senchalabs.org/connect/directory.html)
+  - [compress](http://www.senchalabs.org/connect/compress.html)
+  - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html)
+  - [favicon](http://www.senchalabs.org/connect/favicon.html)
+  - [limit](http://www.senchalabs.org/connect/limit.html)
+  - [logger](http://www.senchalabs.org/connect/logger.html)
+  - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html)
+  - [query](http://www.senchalabs.org/connect/query.html)
+  - [responseTime](http://www.senchalabs.org/connect/responseTime.html)
+  - [session](http://www.senchalabs.org/connect/session.html)
+  - [static](http://www.senchalabs.org/connect/static.html)
+  - [staticCache](http://www.senchalabs.org/connect/staticCache.html)
+  - [vhost](http://www.senchalabs.org/connect/vhost.html)
+  - [subdomains](http://www.senchalabs.org/connect/subdomains.html)
+  - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html)
+
+## Running Tests
+
+first:
+
+    $ npm install -d
+
+then:
+
+    $ make test
+
+## Authors
+
+ Below is the output from [git-summary](http://github.com/visionmedia/git-extras).
+
+
+     project: connect
+     commits: 2033
+     active : 301 days
+     files  : 171
+     authors: 
+      1414     Tj Holowaychuk          69.6%
+       298     visionmedia             14.7%
+       191     Tim Caswell             9.4%
+        51     TJ Holowaychuk          2.5%
+        10     Ryan Olds               0.5%
+         8     Astro                   0.4%
+         5     Nathan Rajlich          0.2%
+         5     Jakub Nešetřil          0.2%
+         3     Daniel Dickison         0.1%
+         3     David Rio Deiros        0.1%
+         3     Alexander Simmerl       0.1%
+         3     Andreas Lind Petersen   0.1%
+         2     Aaron Heckmann          0.1%
+         2     Jacques Crocker         0.1%
+         2     Fabian Jakobs           0.1%
+         2     Brian J Brennan         0.1%
+         2     Adam Malcontenti-Wilson 0.1%
+         2     Glen Mailer             0.1%
+         2     James Campos            0.1%
+         1     Trent Mick              0.0%
+         1     Troy Kruthoff           0.0%
+         1     Wei Zhu                 0.0%
+         1     comerc                  0.0%
+         1     darobin                 0.0%
+         1     nateps                  0.0%
+         1     Marco Sanson            0.0%
+         1     Arthur Taylor           0.0%
+         1     Aseem Kishore           0.0%
+         1     Bart Teeuwisse          0.0%
+         1     Cameron Howey           0.0%
+         1     Chad Weider             0.0%
+         1     Craig Barnes            0.0%
+         1     Eran Hammer-Lahav       0.0%
+         1     Gregory McWhirter       0.0%
+         1     Guillermo Rauch         0.0%
+         1     Jae Kwon                0.0%
+         1     Jakub Nesetril          0.0%
+         1     Joshua Peek             0.0%
+         1     Jxck                    0.0%
+         1     AJ ONeal                0.0%
+         1     Michael Hemesath        0.0%
+         1     Morten Siebuhr          0.0%
+         1     Samori Gorse            0.0%
+         1     Tom Jensen              0.0%
+
+## Node Compatibility
+
+  Connect `< 1.x` is compatible with node 0.2.x
+
+
+  Connect `1.x` is compatible with node 0.4.x
+
+
+  Connect (_master_) `2.x` is compatible with node 0.6.x
+
+## CLA
+
+ [http://sencha.com/cla](http://sencha.com/cla)
+
+## License
+
+View the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/).
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/index.js
new file mode 100755 (executable)
index 0000000..23240ee
--- /dev/null
@@ -0,0 +1,4 @@
+
+module.exports = process.env.CONNECT_COV
+  ? require('./lib-cov/connect')
+  : require('./lib/connect');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/cache.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/cache.js
new file mode 100755 (executable)
index 0000000..052fcdb
--- /dev/null
@@ -0,0 +1,81 @@
+
+/*!
+ * Connect - Cache
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Expose `Cache`.
+ */
+
+module.exports = Cache;
+
+/**
+ * LRU cache store.
+ *
+ * @param {Number} limit
+ * @api private
+ */
+
+function Cache(limit) {
+  this.store = {};
+  this.keys = [];
+  this.limit = limit;
+}
+
+/**
+ * Touch `key`, promoting the object.
+ *
+ * @param {String} key
+ * @param {Number} i
+ * @api private
+ */
+
+Cache.prototype.touch = function(key, i){
+  this.keys.splice(i,1);
+  this.keys.push(key);
+};
+
+/**
+ * Remove `key`.
+ *
+ * @param {String} key
+ * @api private
+ */
+
+Cache.prototype.remove = function(key){
+  delete this.store[key];
+};
+
+/**
+ * Get the object stored for `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.get = function(key){
+  return this.store[key];
+};
+
+/**
+ * Add a cache `key`.
+ *
+ * @param {String} key
+ * @return {Array}
+ * @api private
+ */
+
+Cache.prototype.add = function(key){
+  // initialize store
+  var len = this.keys.push(key);
+
+  // limit reached, invalidate LRU
+  if (len > this.limit) this.remove(this.keys.shift());
+
+  var arr = this.store[key] = [];
+  arr.createdAt = new Date;
+  return arr;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/connect.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/connect.js
new file mode 100755 (executable)
index 0000000..20754e5
--- /dev/null
@@ -0,0 +1,92 @@
+/*!
+ * Connect
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var EventEmitter = require('events').EventEmitter
+  , proto = require('./proto')
+  , utils = require('./utils')
+  , path = require('path')
+  , basename = path.basename
+  , fs = require('fs');
+
+// node patches
+
+require('./patch');
+
+// expose createServer() as the module
+
+exports = module.exports = createServer;
+
+/**
+ * Framework version.
+ */
+
+exports.version = '2.7.9';
+
+/**
+ * Expose mime module.
+ */
+
+exports.mime = require('./middleware/static').mime;
+
+/**
+ * Expose the prototype.
+ */
+
+exports.proto = proto;
+
+/**
+ * Auto-load middleware getters.
+ */
+
+exports.middleware = {};
+
+/**
+ * Expose utilities.
+ */
+
+exports.utils = utils;
+
+/**
+ * Create a new connect server.
+ *
+ * @return {Function}
+ * @api public
+ */
+
+function createServer() {
+  function app(req, res, next){ app.handle(req, res, next); }
+  utils.merge(app, proto);
+  utils.merge(app, EventEmitter.prototype);
+  app.route = '/';
+  app.stack = [];
+  for (var i = 0; i < arguments.length; ++i) {
+    app.use(arguments[i]);
+  }
+  return app;
+};
+
+/**
+ * Support old `.createServer()` method.
+ */
+
+createServer.createServer = createServer;
+
+/**
+ * Auto-load bundled middleware with getters.
+ */
+
+fs.readdirSync(__dirname + '/middleware').forEach(function(filename){
+  if (!/\.js$/.test(filename)) return;
+  var name = basename(filename, '.js');
+  function load(){ return require('./middleware/' + name); }
+  exports.middleware.__defineGetter__(name, load);
+  exports.__defineGetter__(name, load);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/index.js
new file mode 100755 (executable)
index 0000000..2618ddc
--- /dev/null
@@ -0,0 +1,50 @@
+
+/**
+ * Connect is a middleware framework for node,
+ * shipping with over 18 bundled middleware and a rich selection of
+ * 3rd-party middleware.
+ *
+ *     var app = connect()
+ *       .use(connect.logger('dev'))
+ *       .use(connect.static('public'))
+ *       .use(function(req, res){
+ *         res.end('hello world\n');
+ *       })
+ *      .listen(3000);
+ *     
+ * Installation:
+ * 
+ *     $ npm install connect
+ *
+ * Middleware:
+ *
+ *  - [logger](logger.html) request logger with custom format support
+ *  - [csrf](csrf.html) Cross-site request forgery protection
+ *  - [compress](compress.html) Gzip compression middleware
+ *  - [basicAuth](basicAuth.html) basic http authentication
+ *  - [bodyParser](bodyParser.html) extensible request body parser
+ *  - [json](json.html) application/json parser
+ *  - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser
+ *  - [multipart](multipart.html) multipart/form-data parser
+ *  - [timeout](timeout.html) request timeouts
+ *  - [cookieParser](cookieParser.html) cookie parser
+ *  - [session](session.html) session management support with bundled MemoryStore
+ *  - [cookieSession](cookieSession.html) cookie-based session support
+ *  - [methodOverride](methodOverride.html) faux HTTP method support
+ *  - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time
+ *  - [staticCache](staticCache.html) memory cache layer for the static() middleware
+ *  - [static](static.html) streaming static file server supporting `Range` and more
+ *  - [directory](directory.html) directory listing middleware
+ *  - [vhost](vhost.html) virtual host sub-domain mapping middleware
+ *  - [favicon](favicon.html) efficient favicon server (with default icon)
+ *  - [limit](limit.html) limit the bytesize of request bodies
+ *  - [query](query.html) automatic querystring parser, populating `req.query`
+ *  - [errorHandler](errorHandler.html) flexible error handler
+ *
+ * Links:
+ * 
+ *   - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware
+ *   - GitHub [repository](http://github.com/senchalabs/connect)
+ *   - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md)
+ * 
+ */
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js
new file mode 100755 (executable)
index 0000000..bc7ec97
--- /dev/null
@@ -0,0 +1,103 @@
+
+/*!
+ * Connect - basicAuth
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils')
+  , unauthorized = utils.unauthorized;
+
+/**
+ * Basic Auth:
+ *
+ * Enfore basic authentication by providing a `callback(user, pass)`,
+ * which must return `true` in order to gain access. Alternatively an async
+ * method is provided as well, invoking `callback(user, pass, callback)`. Populates
+ * `req.user`. The final alternative is simply passing username / password
+ * strings.
+ *
+ *  Simple username and password
+ *
+ *     connect(connect.basicAuth('username', 'password'));
+ *
+ *  Callback verification
+ *
+ *     connect()
+ *       .use(connect.basicAuth(function(user, pass){
+ *         return 'tj' == user & 'wahoo' == pass;
+ *       }))
+ *
+ *  Async callback verification, accepting `fn(err, user)`.
+ *
+ *     connect()
+ *       .use(connect.basicAuth(function(user, pass, fn){
+ *         User.authenticate({ user: user, pass: pass }, fn);
+ *       }))
+ *
+ * @param {Function|String} callback or username
+ * @param {String} realm
+ * @api public
+ */
+
+module.exports = function basicAuth(callback, realm) {
+  var username, password;
+
+  // user / pass strings
+  if ('string' == typeof callback) {
+    username = callback;
+    password = realm;
+    if ('string' != typeof password) throw new Error('password argument required');
+    realm = arguments[2];
+    callback = function(user, pass){
+      return user == username && pass == password;
+    }
+  }
+
+  realm = realm || 'Authorization Required';
+
+  return function(req, res, next) {
+    var authorization = req.headers.authorization;
+
+    if (req.user) return next();
+    if (!authorization) return unauthorized(res, realm);
+
+    var parts = authorization.split(' ');
+
+    if (parts.length !== 2) return next(utils.error(400));
+
+    var scheme = parts[0]
+      , credentials = new Buffer(parts[1], 'base64').toString()
+      , index = credentials.indexOf(':');
+
+    if ('Basic' != scheme || index < 0) return next(utils.error(400));
+    
+    var user = credentials.slice(0, index)
+      , pass = credentials.slice(index + 1);
+
+    // async
+    if (callback.length >= 3) {
+      var pause = utils.pause(req);
+      callback(user, pass, function(err, user){
+        if (err || !user)  return unauthorized(res, realm);
+        req.user = req.remoteUser = user;
+        next();
+        pause.resume();
+      });
+    // sync
+    } else {
+      if (callback(user, pass)) {
+        req.user = req.remoteUser = user;
+        next();
+      } else {
+        unauthorized(res, realm);
+      }
+    }
+  }
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js
new file mode 100755 (executable)
index 0000000..9f692cd
--- /dev/null
@@ -0,0 +1,61 @@
+
+/*!
+ * Connect - bodyParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var multipart = require('./multipart')
+  , urlencoded = require('./urlencoded')
+  , json = require('./json');
+
+/**
+ * Body parser:
+ * 
+ *   Parse request bodies, supports _application/json_,
+ *   _application/x-www-form-urlencoded_, and _multipart/form-data_.
+ *
+ *   This is equivalent to: 
+ *
+ *     app.use(connect.json());
+ *     app.use(connect.urlencoded());
+ *     app.use(connect.multipart());
+ *
+ * Examples:
+ *
+ *      connect()
+ *        .use(connect.bodyParser())
+ *        .use(function(req, res) {
+ *          res.end('viewing user ' + req.body.user.name);
+ *        });
+ *
+ *      $ curl -d 'user[name]=tj' http://local/
+ *      $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/
+ *
+ *  View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info.
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function bodyParser(options){
+  var _urlencoded = urlencoded(options)
+    , _multipart = multipart(options)
+    , _json = json(options);
+
+  return function bodyParser(req, res, next) {
+    _json(req, res, function(err){
+      if (err) return next(err);
+      _urlencoded(req, res, function(err){
+        if (err) return next(err);
+        _multipart(req, res, next);
+      });
+    });
+  }
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/compress.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/compress.js
new file mode 100755 (executable)
index 0000000..e71ea8c
--- /dev/null
@@ -0,0 +1,152 @@
+/*!
+ * Connect - compress
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var zlib = require('zlib');
+
+/**
+ * Supported content-encoding methods.
+ */
+
+exports.methods = {
+    gzip: zlib.createGzip
+  , deflate: zlib.createDeflate
+};
+
+/**
+ * Default filter function.
+ */
+
+exports.filter = function(req, res){
+  return /json|text|javascript/.test(res.getHeader('Content-Type'));
+};
+
+/**
+ * Compress:
+ *
+ * Compress response data with gzip/deflate.
+ *
+ * Filter:
+ *
+ *  A `filter` callback function may be passed to
+ *  replace the default logic of:
+ *
+ *     exports.filter = function(req, res){
+ *       return /json|text|javascript/.test(res.getHeader('Content-Type'));
+ *     };
+ *
+ * Options:
+ *
+ *  All remaining options are passed to the gzip/deflate
+ *  creation functions. Consult node's docs for additional details.
+ *
+ *   - `chunkSize` (default: 16*1024)
+ *   - `windowBits`
+ *   - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression
+ *   - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more
+ *   - `strategy`: compression strategy
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function compress(options) {
+  options = options || {};
+  var names = Object.keys(exports.methods)
+    , filter = options.filter || exports.filter;
+
+  return function compress(req, res, next){
+    var accept = req.headers['accept-encoding']
+      , vary = res.getHeader('Vary')
+      , write = res.write
+      , end = res.end
+      , stream
+      , method;
+
+    // vary
+    if (!vary) {
+      res.setHeader('Vary', 'Accept-Encoding');
+    } else if (!~vary.indexOf('Accept-Encoding')) {
+      res.setHeader('Vary', vary + ', Accept-Encoding');
+    }
+
+    // proxy
+
+    res.write = function(chunk, encoding){
+      if (!this.headerSent) this._implicitHeader();
+      return stream
+        ? stream.write(new Buffer(chunk, encoding))
+        : write.call(res, chunk, encoding);
+    };
+
+    res.end = function(chunk, encoding){
+      if (chunk) this.write(chunk, encoding);
+      return stream
+        ? stream.end()
+        : end.call(res);
+    };
+
+    res.on('header', function(){
+      var encoding = res.getHeader('Content-Encoding') || 'identity';
+
+      // already encoded
+      if ('identity' != encoding) return;
+
+      // default request filter
+      if (!filter(req, res)) return;
+
+      // SHOULD use identity
+      if (!accept) return;
+
+      // head
+      if ('HEAD' == req.method) return;
+
+      // default to gzip
+      if ('*' == accept.trim()) method = 'gzip';
+
+      // compression method
+      if (!method) {
+        for (var i = 0, len = names.length; i < len; ++i) {
+          if (~accept.indexOf(names[i])) {
+            method = names[i];
+            break;
+          }
+        }
+      }
+
+      // compression method
+      if (!method) return;
+
+      // compression stream
+      stream = exports.methods[method](options);
+
+      // header fields
+      res.setHeader('Content-Encoding', method);
+      res.removeHeader('Content-Length');
+
+      // compression
+
+      stream.on('data', function(chunk){
+        write.call(res, chunk);
+      });
+
+      stream.on('end', function(){
+        end.call(res);
+      });
+
+      stream.on('drain', function() {
+        res.emit('drain');
+      });
+    });
+
+    next();
+  };
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js
new file mode 100755 (executable)
index 0000000..5da23f2
--- /dev/null
@@ -0,0 +1,62 @@
+
+/*!
+ * Connect - cookieParser
+ * Copyright(c) 2010 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+  , cookie = require('cookie');
+
+/**
+ * Cookie parser:
+ *
+ * Parse _Cookie_ header and populate `req.cookies`
+ * with an object keyed by the cookie names. Optionally
+ * you may enabled signed cookie support by passing
+ * a `secret` string, which assigns `req.secret` so
+ * it may be used by other middleware.
+ *
+ * Examples:
+ *
+ *     connect()
+ *       .use(connect.cookieParser('optional secret string'))
+ *       .use(function(req, res, next){
+ *         res.end(JSON.stringify(req.cookies));
+ *       })
+ *
+ * @param {String} secret
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieParser(secret){
+  return function cookieParser(req, res, next) {
+    if (req.cookies) return next();
+    var cookies = req.headers.cookie;
+
+    req.secret = secret;
+    req.cookies = {};
+    req.signedCookies = {};
+
+    if (cookies) {
+      try {
+        req.cookies = cookie.parse(cookies);
+        if (secret) {
+          req.signedCookies = utils.parseSignedCookies(req.cookies, secret);
+          req.signedCookies = utils.parseJSONCookies(req.signedCookies);
+        }
+        req.cookies = utils.parseJSONCookies(req.cookies);
+      } catch (err) {
+        err.status = 400;
+        return next(err);
+      }
+    }
+    next();
+  };
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js
new file mode 100755 (executable)
index 0000000..402fd55
--- /dev/null
@@ -0,0 +1,117 @@
+
+/*!
+ * Connect - cookieSession
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('./../utils')
+  , Cookie = require('./session/cookie')
+  , debug = require('debug')('connect:cookieSession')
+  , signature = require('cookie-signature')
+  , crc32 = require('buffer-crc32');
+
+/**
+ * Cookie Session:
+ *
+ *   Cookie session middleware.
+ *
+ *      var app = connect();
+ *      app.use(connect.cookieParser());
+ *      app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }}));
+ *
+ * Options:
+ *
+ *   - `key` cookie name defaulting to `connect.sess`
+ *   - `secret` prevents cookie 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")
+ *
+ * Clearing sessions:
+ *
+ *  To clear the session simply set its value to `null`,
+ *  `cookieSession()` will then respond with a 1970 Set-Cookie.
+ *
+ *     req.session = null;
+ *
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+module.exports = function cookieSession(options){
+  // TODO: utilize Session/Cookie to unify API
+  options = options || {};
+  var key = options.key || 'connect.sess'
+    , trustProxy = options.proxy;
+
+  return function cookieSession(req, res, next) {
+
+    // req.secret is for backwards compatibility
+    var secret = options.secret || req.secret;
+    if (!secret) throw new Error('`secret` option required for cookie sessions');
+
+    // default session
+    req.session = {};
+    var cookie = req.session.cookie = new Cookie(options.cookie);
+
+    // pathname mismatch
+    if (0 != req.originalUrl.indexOf(cookie.path)) return next();
+
+    // cookieParser secret
+    if (!options.secret && req.secret) {
+      req.session = req.signedCookies[key] || {};
+      req.session.cookie = cookie;
+    } else {
+      // TODO: refactor
+      var rawCookie = req.cookies[key];
+      if (rawCookie) {
+        var unsigned = utils.parseSignedCookie(rawCookie, secret);
+        if (unsigned) {
+          var originalHash = crc32.signed(unsigned);
+          req.session = utils.parseJSONCookie(unsigned) || {};
+          req.session.cookie = cookie;
+        }
+      }
+    }
+
+    res.on('header', function(){
+      // removed
+      if (!req.session) {
+        debug('clear session');
+        cookie.expires = new Date(0);
+        res.setHeader('Set-Cookie', cookie.serialize(key, ''));
+        return;
+      }
+
+      delete req.session.cookie;
+
+      // check security
+      var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase()
+        , tls = req.connection.encrypted || (trustProxy && 'https' == proto)
+        , secured = cookie.secure && tls;
+
+      // only send secure cookies via https
+      if (cookie.secure && !secured) return debug('not secured');
+
+      // serialize
+      debug('serializing %j', req.session);
+      var val = 'j:' + JSON.stringify(req.session);
+
+      // compare hashes, no need to set-cookie if unchanged
+      if (originalHash == crc32.signed(val)) return debug('unmodified session');
+
+      // set-cookie
+      val = 's:' + signature.sign(val, secret);
+      val = cookie.serialize(key, val);
+      debug('set-cookie %j', cookie);
+      res.setHeader('Set-Cookie', val);
+    });
+
+    next();
+  };
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/csrf.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/csrf.js
new file mode 100755 (executable)
index 0000000..e3c353e
--- /dev/null
@@ -0,0 +1,73 @@
+/*!
+ * Connect - csrf
+ * Copyright(c) 2011 Sencha Inc.
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils');
+
+/**
+ * Anti CSRF:
+ *
+ * CRSF protection middleware.
+ *
+ * By default this middleware generates a token named "_csrf"
+ * which should be added to requests which mutate
+ * state, within a hidden form field, query-string etc. This
+ * token is validated against the visitor's `req.session._csrf`
+ * property.
+ *
+ * The default `value` function checks `req.body` generated
+ * by the `bodyParser()` middleware, `req.query` generated
+ * by `query()`, and the "X-CSRF-Token" header field.
+ *
+ * This middleware requires session support, thus should be added
+ * somewhere _below_ `session()` and `cookieParser()`.
+ *
+ * Options:
+ *
+ *    - `value` a function accepting the request, returning the token 
+ *
+ * @param {Object} options
+ * @api public
+ */
+
+module.exports = function csrf(options) {
+  options = options || {};
+  var value = options.value || defaultValue;
+
+  return function(req, res, next){
+    // generate CSRF token
+    var token = req.session._csrf || (req.session._csrf = utils.uid(24));
+
+    // ignore these methods
+    if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next();
+
+    // determine value
+    var val = value(req);
+
+    // check
+    if (val != token) return next(utils.error(403));
+    
+    next();
+  }
+};
+
+/**
+ * Default value function, checking the `req.body`
+ * and `req.query` for the CSRF token.
+ *
+ * @param {IncomingMessage} req
+ * @return {String}
+ * @api private
+ */
+
+function defaultValue(req) {
+  return (req.body && req.body._csrf)
+    || (req.query && req.query._csrf)
+    || (req.headers['x-csrf-token']);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/directory.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/directory.js
new file mode 100755 (executable)
index 0000000..1c925a7
--- /dev/null
@@ -0,0 +1,229 @@
+
+/*!
+ * Connect - directory
+ * Copyright(c) 2011 Sencha Inc.
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+// TODO: icon / style for directories
+// TODO: arrow key navigation
+// TODO: make icons extensible
+
+/**
+ * Module dependencies.
+ */
+
+var fs = require('fs')
+  , parse = require('url').parse
+  , utils = require('../utils')
+  , path = require('path')
+  , normalize = path.normalize
+  , extname = path.extname
+  , join = path.join;
+
+/*!
+ * Icon cache.
+ */
+
+var cache = {};
+
+/**
+ * Directory:
+ *
+ * Serve directory listings with the given `root` path.
+ *
+ * Options:
+ *
+ *  - `hidden` display hidden (dot) files. Defaults to false.
+ *  - `icons`  display icons. Defaults to false.
+ *  - `filter` Apply this filter function to files. Defaults to false.
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function directory(root, options){
+  options = options || {};
+
+  // root required
+  if (!root) throw new Error('directory() root path required');
+  var hidden = options.hidden
+    , icons = options.icons
+    , filter = options.filter
+    , root = normalize(root);
+
+  return function directory(req, res, next) {
+    if ('GET' != req.method && 'HEAD' != req.method) return next();
+
+    var accept = req.headers.accept || 'text/plain'
+      , url = parse(req.url)
+      , dir = decodeURIComponent(url.pathname)
+      , path = normalize(join(root, dir))
+      , originalUrl = parse(req.originalUrl)
+      , originalDir = decodeURIComponent(originalUrl.pathname)
+      , showUp = path != root && path != root + '/';
+
+    // null byte(s), bad request
+    if (~path.indexOf('\0')) return next(utils.error(400));
+
+    // malicious path, forbidden
+    if (0 != path.indexOf(root)) return next(utils.error(403));
+
+    // check if we have a directory
+    fs.stat(path, function(err, stat){
+      if (err) return 'ENOENT' == err.code
+        ? next()
+        : next(err);
+
+      if (!stat.isDirectory()) return next();
+
+      // fetch files
+      fs.readdir(path, function(err, files){
+        if (err) return next(err);
+        if (!hidden) files = removeHidden(files);
+        if (filter) files = files.filter(filter);
+        files.sort();
+
+        // content-negotiation
+        for (var key in exports) {
+          if (~accept.indexOf(key) || ~accept.indexOf('*/*')) {
+            exports[key](req, res, files, next, originalDir, showUp, icons);
+            return;
+          }
+        }
+
+        // not acceptable
+        next(utils.error(406));
+      });
+    });
+  };
+};
+
+/**
+ * Respond with text/html.
+ */
+
+exports.html = function(req, res, files, next, dir, showUp, icons){
+  fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){
+    if (err) return next(err);
+    fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){
+      if (err) return next(err);
+      if (showUp) files.unshift('..');
+      str = str
+        .replace('{style}', style)
+        .replace('{files}', html(files, dir, icons))
+        .replace('{directory}', dir)
+        .replace('{linked-path}', htmlPath(dir));
+      res.setHeader('Content-Type', 'text/html');
+      res.setHeader('Content-Length', str.length);
+      res.end(str);
+    });
+  });
+};
+
+/**
+ * Respond with application/json.
+ */
+
+exports.json = function(req, res, files){
+  files = JSON.stringify(files);
+  res.setHeader('Content-Type', 'application/json');
+  res.setHeader('Content-Length', files.length);
+  res.end(files);
+};
+
+/**
+ * Respond with text/plain.
+ */
+
+exports.plain = function(req, res, files){
+  files = files.join('\n') + '\n';
+  res.setHeader('Content-Type', 'text/plain');
+  res.setHeader('Content-Length', files.length);
+  res.end(files);
+};
+
+/**
+ * Map html `dir`, returning a linked path.
+ */
+
+function htmlPath(dir) {
+  var curr = [];
+  return dir.split('/').map(function(part){
+    curr.push(part);
+    return '<a href="' + curr.join('/') + '">' + part + '</a>';
+  }).join(' / ');
+}
+
+/**
+ * Map html `files`, returning an html unordered list.
+ */
+
+function html(files, dir, useIcons) {
+  return '<ul id="files">' + files.map(function(file){
+    var icon = ''
+      , classes = [];
+
+    if (useIcons && '..' != file) {
+      icon = icons[extname(file)] || icons.default;
+      icon = '<img src="data:image/png;base64,' + load(icon) + '" />';
+      classes.push('icon');
+    }
+
+    return '<li><a href="'
+      + join(dir, file)
+      + '" class="'
+      + classes.join(' ') + '"'
+      + ' title="' + file + '">'
+      + icon + file + '</a></li>';
+
+  }).join('\n') + '</ul>';
+}
+
+/**
+ * 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js
new file mode 100755 (executable)
index 0000000..4a84edc
--- /dev/null
@@ -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 '<li>' + v + '</li>'; }).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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/favicon.js
new file mode 100755 (executable)
index 0000000..ef54354
--- /dev/null
@@ -0,0 +1,80 @@
+/*!
+ * 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/json.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/json.js
new file mode 100755 (executable)
index 0000000..17e5918
--- /dev/null
@@ -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(utils.error(400, 'invalid json, empty body'));
+        }
+        
+        if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json'));
+        try {
+          req.body = JSON.parse(buf, options.reviver);
+        } catch (err){
+          err.body = buf;
+          err.status = 400;
+          return next(err);
+        }
+        next();
+      });
+    });
+  };
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/limit.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/limit.js
new file mode 100755 (executable)
index 0000000..09bd1c4
--- /dev/null
@@ -0,0 +1,78 @@
+
+/*!
+ * Connect - limit
+ * Copyright(c) 2011 TJ Holowaychuk
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var utils = require('../utils'),
+  brokenPause = utils.brokenPause;
+
+/**
+ * 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(utils.error(413));
+
+    // limit
+    if (brokenPause) {
+      listen();
+    } else {
+      req.on('newListener', function handler(event) {
+        if (event !== 'data') return;
+
+        req.removeListener('newListener', handler);
+        // Start listening at the end of the current loop
+        // otherwise the request will be consumed too early.
+        // Sideaffect is `limit` will miss the first chunk,
+        // but that's not a big deal.
+        // Unfortunately, the tests don't have large enough
+        // request bodies to test this.
+        process.nextTick(listen);
+      });
+    };
+
+    next();
+
+    function listen() {
+      req.on('data', function(chunk) {
+        received += Buffer.isBuffer(chunk)
+          ? chunk.length :
+          Buffer.byteLength(chunk);
+
+        if (received > bytes) req.destroy();
+      });
+    };
+  };
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/logger.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/logger.js
new file mode 100755 (executable)
index 0000000..de72244
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js
new file mode 100755 (executable)
index 0000000..aaf4014
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/multipart.js
new file mode 100755 (executable)
index 0000000..7b26fae
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/query.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/query.js
new file mode 100755 (executable)
index 0000000..93fc5d3
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/responseTime.js
new file mode 100755 (executable)
index 0000000..62abc04
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session.js
new file mode 100755 (executable)
index 0000000..9be6c8b
--- /dev/null
@@ -0,0 +1,356 @@
+
+/*!
+ * 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('<p>views: ' + sess.views + '</p>');
+ *             res.write('<p>expires in: ' + (sess.cookie.maxAge / 1000) + 's</p>');
+ *             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'] || '').split(',')[0].toLowerCase().trim()
+        , 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');
+
+      // long expires, handle expiry server-side
+      if (!isNew && cookie.hasLongExpires) return debug('already set cookie');
+
+      // 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(err){
+        if (err) console.error(err.stack);
+        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 %j', err);
+        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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js
new file mode 100755 (executable)
index 0000000..cdce2a5
--- /dev/null
@@ -0,0 +1,140 @@
+
+/*!
+ * 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
+    }
+  },
+
+  /**
+   * Check if the cookie has a reasonably large max-age.
+   *
+   * @return {Boolean}
+   * @api private
+   */
+
+  get hasLongExpires() {
+    var week = 604800000;
+    return this.maxAge > (4 * week);
+  },
+
+  /**
+   * 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/memory.js
new file mode 100755 (executable)
index 0000000..fb93939
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/session.js
new file mode 100755 (executable)
index 0000000..0dd4b40
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/session/store.js
new file mode 100755 (executable)
index 0000000..54294cb
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/static.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/static.js
new file mode 100755 (executable)
index 0000000..093e73f
--- /dev/null
@@ -0,0 +1,95 @@
+/*!
+ * 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
+ *    - `index`      Default file name, defaults to 'index.html'
+ *
+ * @param {String} root
+ * @param {Object} options
+ * @return {Function}
+ * @api public
+ */
+
+exports = module.exports = function(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)
+      .index(options.index || 'index.html')
+      .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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/staticCache.js
new file mode 100755 (executable)
index 0000000..7354a8f
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/timeout.js
new file mode 100755 (executable)
index 0000000..dba4654
--- /dev/null
@@ -0,0 +1,55 @@
+/*!
+ * 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 (res.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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js
new file mode 100755 (executable)
index 0000000..cceafc0
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/middleware/vhost.js
new file mode 100755 (executable)
index 0000000..abbb050
--- /dev/null
@@ -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(/[^*\w]/g, '\\$&').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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/patch.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/patch.js
new file mode 100755 (executable)
index 0000000..7cf0012
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/proto.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/proto.js
new file mode 100755 (executable)
index 0000000..b304cf7
--- /dev/null
@@ -0,0 +1,230 @@
+
+/*!
+ * 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) {
+    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 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/directory.html b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/directory.html
new file mode 100755 (executable)
index 0000000..2d63704
--- /dev/null
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset='utf-8'> 
+    <title>listing directory {directory}</title>
+    <style>{style}</style>
+    <script>
+      function $(id){
+        var el = 'string' == typeof id
+          ? document.getElementById(id)
+          : id;
+
+        el.on = function(event, fn){
+          if ('content loaded' == event) {
+            event = window.attachEvent ? "load" : "DOMContentLoaded";
+          }
+          el.addEventListener
+            ? el.addEventListener(event, fn, false)
+            : el.attachEvent("on" + event, fn);
+        };
+
+        el.all = function(selector){
+          return $(el.querySelectorAll(selector));
+        };
+
+        el.each = function(fn){
+          for (var i = 0, len = el.length; i < len; ++i) {
+            fn($(el[i]), i);
+          }
+        };
+
+        el.getClasses = function(){
+          return this.getAttribute('class').split(/\s+/);
+        };
+
+        el.addClass = function(name){
+          var classes = this.getAttribute('class');
+          el.setAttribute('class', classes
+            ? classes + ' ' + name
+            : name);
+        };
+
+        el.removeClass = function(name){
+          var classes = this.getClasses().filter(function(curr){
+            return curr != name;
+          });
+          this.setAttribute('class', classes);
+        };
+
+        return el;
+      }
+
+      function search() {
+        var str = $('search').value
+          , links = $('files').all('a');
+
+        links.each(function(link){
+          var text = link.textContent;
+
+          if ('..' == text) return;
+          if (str.length && ~text.indexOf(str)) {
+            link.addClass('highlight');
+          } else {
+            link.removeClass('highlight');
+          }
+        });
+      }
+
+      $(window).on('content loaded', function(){
+        $('search').on('keyup', search);
+      });
+    </script>
+  </head>
+  <body class="directory">
+    <input id="search" type="text" placeholder="Search" autocomplete="off" />
+    <div id="wrapper">
+      <h1>{linked-path}</h1>
+      {files}
+    </div>
+  </body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/error.html b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/error.html
new file mode 100755 (executable)
index 0000000..a6d3faf
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+  <head>
+    <meta charset='utf-8'> 
+    <title>{error}</title>
+    <style>{style}</style>
+  </head>
+  <body>
+    <div id="wrapper">
+      <h1>{title}</h1>
+      <h2><em>{statusCode}</em> {error}</h2>
+      <ul id="stacktrace">{stack}</ul>
+    </div>
+  </body>
+</html>
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/favicon.ico b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/favicon.ico
new file mode 100755 (executable)
index 0000000..895fc96
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/favicon.ico differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page.png
new file mode 100755 (executable)
index 0000000..03ddd79
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_add.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_add.png
new file mode 100755 (executable)
index 0000000..d5bfa07
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_add.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png
new file mode 100755 (executable)
index 0000000..89ee2da
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_code.png
new file mode 100755 (executable)
index 0000000..f7ea904
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_code.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png
new file mode 100755 (executable)
index 0000000..195dc6d
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png
new file mode 100755 (executable)
index 0000000..3141467
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png
new file mode 100755 (executable)
index 0000000..046811e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_error.png
new file mode 100755 (executable)
index 0000000..f07f449
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_error.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png
new file mode 100755 (executable)
index 0000000..eb6158e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_find.png
new file mode 100755 (executable)
index 0000000..2f19388
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_find.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png
new file mode 100755 (executable)
index 0000000..8e83281
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_go.png
new file mode 100755 (executable)
index 0000000..80fe1ed
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_go.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_green.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_green.png
new file mode 100755 (executable)
index 0000000..de8e003
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_green.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_key.png
new file mode 100755 (executable)
index 0000000..d6626cb
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_key.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png
new file mode 100755 (executable)
index 0000000..7e56870
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_link.png
new file mode 100755 (executable)
index 0000000..312eab0
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_link.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png
new file mode 100755 (executable)
index 0000000..246a2f0
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png
new file mode 100755 (executable)
index 0000000..968f073
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_red.png
new file mode 100755 (executable)
index 0000000..0b18247
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_red.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png
new file mode 100755 (executable)
index 0000000..cf347c7
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_save.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_save.png
new file mode 100755 (executable)
index 0000000..caea546
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_save.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white.png
new file mode 100755 (executable)
index 0000000..8b8b1ca
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png
new file mode 100755 (executable)
index 0000000..8f8095e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png
new file mode 100755 (executable)
index 0000000..159b240
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png
new file mode 100755 (executable)
index 0000000..aa23dde
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png
new file mode 100755 (executable)
index 0000000..34a05cc
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png
new file mode 100755 (executable)
index 0000000..f501a59
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png
new file mode 100755 (executable)
index 0000000..848bdaf
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png
new file mode 100755 (executable)
index 0000000..0c76bd1
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png
new file mode 100755 (executable)
index 0000000..87a6914
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png
new file mode 100755 (executable)
index 0000000..c66011f
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png
new file mode 100755 (executable)
index 0000000..2b6b100
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png
new file mode 100755 (executable)
index 0000000..a9f31a2
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png
new file mode 100755 (executable)
index 0000000..a87cf84
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png
new file mode 100755 (executable)
index 0000000..ffb8fc9
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png
new file mode 100755 (executable)
index 0000000..0a7d6f4
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png
new file mode 100755 (executable)
index 0000000..bddba1f
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png
new file mode 100755 (executable)
index 0000000..af1ecaf
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png
new file mode 100755 (executable)
index 0000000..4cc537a
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png
new file mode 100755 (executable)
index 0000000..b93e776
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png
new file mode 100755 (executable)
index 0000000..9fc5a0a
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png
new file mode 100755 (executable)
index 0000000..b977d7e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png
new file mode 100755 (executable)
index 0000000..5818436
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png
new file mode 100755 (executable)
index 0000000..5769120
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png
new file mode 100755 (executable)
index 0000000..8d719df
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png
new file mode 100755 (executable)
index 0000000..106f5aa
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png
new file mode 100755 (executable)
index 0000000..e4a1ecb
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png
new file mode 100755 (executable)
index 0000000..7e62a92
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png
new file mode 100755 (executable)
index 0000000..e902abb
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png
new file mode 100755 (executable)
index 0000000..1d2d0a4
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png
new file mode 100755 (executable)
index 0000000..d616484
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png
new file mode 100755 (executable)
index 0000000..7215d1e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png
new file mode 100755 (executable)
index 0000000..bf7bd1c
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png
new file mode 100755 (executable)
index 0000000..f6b74cc
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png
new file mode 100755 (executable)
index 0000000..d3fffb6
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png
new file mode 100755 (executable)
index 0000000..a65bcb3
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png
new file mode 100755 (executable)
index 0000000..23a37b8
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png
new file mode 100755 (executable)
index 0000000..f907e44
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png
new file mode 100755 (executable)
index 0000000..5b2cbb3
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png
new file mode 100755 (executable)
index 0000000..7868a25
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png
new file mode 100755 (executable)
index 0000000..134b669
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png
new file mode 100755 (executable)
index 0000000..c4eff03
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png
new file mode 100755 (executable)
index 0000000..884ffd6
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png
new file mode 100755 (executable)
index 0000000..f59b7c4
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png
new file mode 100755 (executable)
index 0000000..44084ad
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png
new file mode 100755 (executable)
index 0000000..3a1441c
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png
new file mode 100755 (executable)
index 0000000..e770829
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png
new file mode 100755 (executable)
index 0000000..813f712
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png
new file mode 100755 (executable)
index 0000000..d9cf132
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png
new file mode 100755 (executable)
index 0000000..52699bf
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png
new file mode 100755 (executable)
index 0000000..4a05955
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png
new file mode 100755 (executable)
index 0000000..a0a433d
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png
new file mode 100755 (executable)
index 0000000..1eb8809
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png
new file mode 100755 (executable)
index 0000000..ae8ecbf
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png
new file mode 100755 (executable)
index 0000000..6ed2490
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png
new file mode 100755 (executable)
index 0000000..fecadd0
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png
new file mode 100755 (executable)
index 0000000..fd4bbcc
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_word.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_word.png
new file mode 100755 (executable)
index 0000000..834cdfa
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_word.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_world.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_world.png
new file mode 100755 (executable)
index 0000000..b8895dd
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/icons/page_world.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/style.css b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/public/style.css
new file mode 100755 (executable)
index 0000000..32b6507
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/utils.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/lib/utils.js
new file mode 100755 (executable)
index 0000000..35738b8
--- /dev/null
@@ -0,0 +1,404 @@
+
+/*!
+ * 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')
+  , nodeVersion = process.versions.node.split('.');
+
+// pause is broken in node < 0.10
+exports.brokenPause = parseInt(nodeVersion[0], 10) === 0
+  && parseInt(nodeVersion[1], 10) < 10;
+
+/**
+ * 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];
+};
+
+/**
+ * Generate an `Error` from the given status `code`
+ * and optional `msg`.
+ *
+ * @param {Number} code
+ * @param {String} msg
+ * @return {Error}
+ * @api private
+ */
+
+exports.error = function(code, msg){
+  var err = new Error(msg || http.STATUS_CODES[code]);
+  err.status = code;
+  return err;
+};
+
+/**
+ * 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, '&amp;')
+    .replace(/</g, '&lt;')
+    .replace(/>/g, '&gt;')
+    .replace(/"/g, '&quot;');
+};
+
+
+/**
+ * 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)
+    .replace(/\//g, '-')
+    .replace(/\+/g, '_');
+};
+
+/**
+ * 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. Pause is only required for
+ * node versions less than 10, and is replaced with
+ * noop's otherwise.
+ *
+ *      var pause = utils.pause(req);
+ *      fs.readFile(path, function(){
+ *         next();
+ *         pause.resume();
+ *      });
+ *
+ * @param {Object} obj
+ * @return {Object}
+ * @api private
+ */
+
+exports.pause = exports.brokenPause
+  ? require('pause')
+  : function () {
+    return {
+      end: noop,
+      resume: noop
+    }
+  }
+
+/**
+ * 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 `"<size>-<mtime>"`
+ * 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');
+
+function noop() {}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/History.md
new file mode 100755 (executable)
index 0000000..1332808
--- /dev/null
@@ -0,0 +1,10 @@
+
+0.2.0 / 2012-10-28 
+==================
+
+  * bytes(200).should.eql('200b')
+
+0.1.0 / 2012-07-04 
+==================
+
+  * add bytes to string conversion [yields]
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/Makefile
new file mode 100755 (executable)
index 0000000..8e8640f
--- /dev/null
@@ -0,0 +1,7 @@
+
+test:
+       @./node_modules/.bin/mocha \
+               --reporter spec \
+               --require should
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md
new file mode 100755 (executable)
index 0000000..9325d5b
--- /dev/null
@@ -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 &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/component.json
new file mode 100755 (executable)
index 0000000..76a6057
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/index.js
new file mode 100755 (executable)
index 0000000..70b2e01
--- /dev/null
@@ -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}
+ * @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 + 'b';
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/bytes/package.json
new file mode 100755 (executable)
index 0000000..fd53bfc
--- /dev/null
@@ -0,0 +1,37 @@
+{
+  "name": "bytes",
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca",
+    "url": "http://tjholowaychuk.com"
+  },
+  "description": "byte size string parser / serializer",
+  "version": "0.2.0",
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*"
+  },
+  "_id": "bytes@0.2.0",
+  "dist": {
+    "shasum": "aad33ec14e3dc2ca74e8e7d451f9ba053ad4f7a0",
+    "tarball": "http://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz"
+  },
+  "_npmVersion": "1.1.64",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "aad33ec14e3dc2ca74e8e7d451f9ba053ad4f7a0",
+  "_from": "bytes@0.2.0",
+  "_resolved": "https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/LICENSE
new file mode 100755 (executable)
index 0000000..38d3c9c
--- /dev/null
@@ -0,0 +1,7 @@
+Copyright (C) 2011 Felix Geisendörfer
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md
new file mode 100755 (executable)
index 0000000..1aecf08
--- /dev/null
@@ -0,0 +1,411 @@
+# Formidable
+
+[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](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
+
+## 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.
+```javascript
+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(
+    '<form action="/upload" enctype="multipart/form-data" method="post">'+
+    '<input type="text" name="title"><br>'+
+    '<input type="file" name="upload" multiple="multiple"><br>'+
+    '<input type="submit" value="Upload">'+
+    '</form>'
+  );
+}).listen(8080);
+```
+## API
+
+### Formidable.IncomingForm
+```javascript
+var form = new formidable.IncomingForm()
+```
+Creates a new incoming form.
+
+```javascript
+form.encoding = 'utf-8';
+```
+Sets encoding for incoming form fields.
+
+```javascript
+form.uploadDir = process.env.TMP || process.env.TMPDIR || process.env.TEMP || '/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.
+
+```javascript
+form.keepExtensions = false;
+```
+If you want the files written to `form.uploadDir` to include the extensions of the original files, set this property to `true`.
+
+```javascript
+form.type
+```
+Either 'multipart' or 'urlencoded' depending on the incoming request.
+
+```javascript
+form.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.
+
+```javascript
+form.maxFields = 0;
+```
+Limits the number of fields that the querystring parser will decode. Defaults
+to 0 (unlimited).
+
+```javascript
+form.hash = false;
+```
+If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.
+
+```javascript
+form.bytesReceived
+```
+The amount of bytes received for this form so far.
+
+```javascript
+form.bytesExpected
+```
+The expected number of bytes in this form.
+
+```javascript
+form.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:
+
+
+```javascript
+form.parse(req, function(err, fields, files) {
+  // ...
+});
+
+form.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.
+
+```javascript
+form.onPart = function(part) {
+  part.addListener('data', function() {
+    // ...
+  });
+}
+```
+If you want to use formidable to only handle certain parts for you, you can do so:
+```javascript
+form.onPart = function(part) {
+  if (!part.filename) {
+    // let formidable handle all non-file parts
+    form.handlePart(part);
+  }
+}
+```
+Check the code in this method for further inspiration.
+
+
+### Formidable.File
+```javascript
+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.
+```javascript
+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.
+```javascript
+file.name = null
+```
+The name this file had according to the uploading client.
+```javascript
+file.type = null
+```
+The mime type of this file, according to the uploading client.
+```javascript
+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/).
+```javascript
+file.hash = null
+```
+If hash calculation was set, you can read the hex digest out of this var.
+
+#### Formidable.File#toJSON()
+
+  This method returns a JSON-representation of the file, allowing you to
+  `JSON.stringify()` the file which is useful for logging and responding
+  to requests.
+
+### Events
+
+
+#### 'progress'
+```javascript
+form.on('progress', function(bytesReceived, bytesExpected) {
+});
+```
+Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.
+
+
+
+#### 'field'
+```javascript
+form.on('field', function(name, value) {
+});
+```
+
+#### 'fileBegin'
+
+Emitted whenever a field / value pair has been received.
+```javascript
+form.on('fileBegin', function(name, file) {
+});
+```
+
+#### '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.
+
+Emitted whenever a field / file pair has been received. `file` is an instance of `File`.
+```javascript
+form.on('file', function(name, file) {
+});
+```
+
+#### 'error'
+
+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.
+```javascript
+form.on('error', function(err) {
+});
+```
+
+#### '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).
+```javascript
+form.on('aborted', function() {
+});
+```
+
+##### 'end'
+```javascript
+form.on('end', function() {
+});
+```
+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.
+
+
+
+## Changelog
+
+### v1.0.13
+
+* Only update hash if update method exists (Sven Lito)
+* According to travis v0.10 needs to go quoted (Sven Lito)
+* Bumping build node versions (Sven Lito)
+* Change the default to 1000, to match the new Node behaviour. (OrangeDog)
+* Add ability to control maxKeys in the querystring parser. (OrangeDog)
+* Adjust test case to work with node 0.9.x (Eugene Girshov)
+* Update package.json (Sven Lito)
+* Path adjustment according to eb4468b (Markus Ast)
+
+### v1.0.12
+
+* Emit error on aborted connections (Eugene Girshov)
+* Add support for empty requests (Eugene Girshov)
+* Fix name/filename handling in Content-Disposition (jesperp)
+* Tolerate malformed closing boundary in multipart (Eugene Girshov)
+* Ignore preamble in multipart messages (Eugene Girshov)
+* Add support for application/json (Mike Frey, Carlos Rodriguez)
+* Add support for Base64 encoding (Elmer Bulthuis)
+* Add File#toJSON (TJ Holowaychuk)
+* Remove support for Node.js 0.4 & 0.6 (Andrew Kelley)
+* Documentation improvements (Sven Lito, Andre Azevedo)
+* Add support for application/octet-stream (Ion Lupascu, Chris Scribner)
+* Use os.tmpDir() to get tmp directory (Andrew Kelley)
+* Improve package.json (Andrew Kelley, Sven Lito)
+* Fix benchmark script (Andrew Kelley)
+* Fix scope issue in incoming_forms (Sven Lito)
+* Fix file handle leak on error (OrangeDog)
+
+### v1.0.11
+
+* Calculate checksums for incoming files (sreuter)
+* Add definition parameters to "IncomingForm" as an argument (Math-)
+
+### v1.0.10
+
+* Make parts to be proper Streams (Matt Robenolt)
+
+### 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)
+
+## 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js
new file mode 100755 (executable)
index 0000000..49abc43
--- /dev/null
@@ -0,0 +1,71 @@
+var assert = require('assert');
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/json.js
new file mode 100755 (executable)
index 0000000..eb8a724
--- /dev/null
@@ -0,0 +1,67 @@
+var common = require('../test/common'),
+    http = require('http'),
+    util = require('util'),
+    formidable = common.formidable,
+    Buffer = require('buffer').Buffer,
+    port = common.port,
+    server;
+
+server = http.createServer(function(req, res) {
+  if (req.method !== 'POST') {
+    res.writeHead(200, {'content-type': 'text/plain'})
+    res.end('Please POST a JSON payload to http://localhost:'+port+'/')
+    return;
+  }
+
+  var form = new formidable.IncomingForm(),
+      fields = {};
+
+  form
+    .on('error', function(err) {
+      res.writeHead(500, {'content-type': 'text/plain'});
+      res.end('error:\n\n'+util.inspect(err));
+      console.error(err);
+    })
+    .on('field', function(field, value) {
+      console.log(field, value);
+      fields[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);
+});
+server.listen(port);
+
+console.log('listening on http://localhost:'+port+'/');
+
+
+var request = http.request({
+  host: 'localhost',
+  path: '/',
+  port: port,
+  method: 'POST',
+  headers: { 'content-type':'application/json', 'content-length':48 }
+}, function(response) {
+  var data = '';
+  console.log('\nServer responded with:');
+  console.log('Status:', response.statusCode);
+  response.pipe(process.stdout);
+  response.on('end', function() {
+    console.log('\n')
+    process.exit();
+  });
+  // response.on('data', function(chunk) {
+  //   data += chunk.toString('utf8');
+  // });
+  // response.on('end', function() {
+  //   console.log('Response Data:')
+  //   console.log(data);
+  //   process.exit();
+  // });
+})
+
+request.write('{"numbers":[1,2,3,4,5],"nested":{"key":"value"}}');
+request.end();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js
new file mode 100755 (executable)
index 0000000..f6c15a6
--- /dev/null
@@ -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(
+      '<form action="/post" method="post">'+
+      '<input type="text" name="title"><br>'+
+      '<input type="text" name="data[foo][]"><br>'+
+      '<input type="submit" value="Submit">'+
+      '</form>'
+    );
+  } 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js
new file mode 100755 (executable)
index 0000000..050cdd9
--- /dev/null
@@ -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(
+      '<form action="/upload" enctype="multipart/form-data" method="post">'+
+      '<input type="text" name="title"><br>'+
+      '<input type="file" name="upload" multiple="multiple"><br>'+
+      '<input type="submit" value="Upload">'+
+      '</form>'
+    );
+  } 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/index.js
new file mode 100755 (executable)
index 0000000..4cc88b3
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js
new file mode 100755 (executable)
index 0000000..1e7184d
--- /dev/null
@@ -0,0 +1,72 @@
+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);
+  }
+}
+module.exports = File;
+util.inherits(File, EventEmitter);
+
+File.prototype.open = function() {
+  this._writeStream = new WriteStream(this.path);
+};
+
+File.prototype.toJSON = function() {
+  return {
+    size: this.size,
+    path: this.path,
+    name: this.name,
+    type: this.type,
+    mtime: this.lastModifiedDate,
+    length: this.length,
+    filename: this.filename,
+    mime: this.mime
+  };
+};
+
+File.prototype.write = function(buffer, cb) {
+  var self = this;
+  this._writeStream.write(buffer, function() {
+    if (self.hash) {
+      if (self.hash.hasOwnProperty('update')) {
+        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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js
new file mode 100755 (executable)
index 0000000..291236d
--- /dev/null
@@ -0,0 +1,526 @@
+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,
+    OctetParser       = require('./octet_parser').OctetParser,
+    JSONParser = require('./json_parser').JSONParser,
+    StringDecoder = require('string_decoder').StringDecoder,
+    EventEmitter = require('events').EventEmitter,
+    Stream = require('stream').Stream,
+    os = require('os');
+
+function IncomingForm(opts) {
+  if (!(this instanceof IncomingForm)) return new IncomingForm(opts);
+  EventEmitter.call(this);
+
+  opts=opts||{};
+
+  this.error = null;
+  this.ended = false;
+
+  this.maxFields = opts.maxFields || 1000;
+  this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
+  this.keepExtensions = opts.keepExtensions || false;
+  this.uploadDir = opts.uploadDir || os.tmpDir();
+  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;
+  this.openedFiles = [];
+
+  return this;
+};
+util.inherits(IncomingForm, EventEmitter);
+exports.IncomingForm = IncomingForm;
+
+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;
+  };
+
+  var self = this;
+  req
+    .on('error', function(err) {
+      self._error(err);
+    })
+    .on('aborted', function() {
+      self.emit('aborted');
+      self._error(new Error('Request 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);
+      });
+  }
+
+  this.writeHeaders(req.headers);
+
+  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();
+  this.openedFiles.push(file);
+
+  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();
+    });
+  });
+};
+
+function dummyParser(self) {
+  return {
+    end: function () {
+      self.ended = true;
+      self._maybeEnd();
+      return null;
+    }
+  };
+}
+
+IncomingForm.prototype._parseContentType = function() {
+  if (this.bytesExpected === 0) {
+    this._parser = dummyParser(this);
+    return;
+  }
+
+  if (!this.headers['content-type']) {
+    this._error(new Error('bad content-type header, no content-type'));
+    return;
+  }
+
+  if (this.headers['content-type'].match(/octet-stream/i)) {
+    this._initOctetStream();
+    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;
+  }
+
+  if (this.headers['content-type'].match(/json/i)) {
+    this._initJSONencoded();
+    return;
+  }
+
+  this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type']));
+};
+
+IncomingForm.prototype._error = function(err) {
+  if (this.error || this.ended) {
+    return;
+  }
+
+  this.error = err;
+  this.pause();
+  this.emit('error', err);
+
+  if (Array.isArray(this.openedFiles)) {
+    this.openedFiles.forEach(function(file) {
+      file._writeStream.destroy();
+      setTimeout(fs.unlink, 0, file.path);
+    });
+  }
+};
+
+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;
+
+    part.transferEncoding = 'binary';
+    part.transferBuffer = '';
+
+    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(/\bname="([^"]+)"/i)) {
+        part.name = m[1];
+      }
+
+      part.filename = self._fileName(headerValue);
+    } else if (headerField == 'content-type') {
+      part.mime = headerValue;
+    } else if (headerField == 'content-transfer-encoding') {
+      part.transferEncoding = headerValue.toLowerCase();
+    }
+
+    headerField = '';
+    headerValue = '';
+  };
+
+  parser.onHeadersEnd = function() {
+    switch(part.transferEncoding){
+      case 'binary':
+      case '7bit':
+      case '8bit':
+      parser.onPartData = function(b, start, end) {
+        part.emit('data', b.slice(start, end));
+      };
+
+      parser.onPartEnd = function() {
+        part.emit('end');
+      };
+      break;
+
+      case 'base64':
+      parser.onPartData = function(b, start, end) {
+        part.transferBuffer += b.slice(start, end).toString('ascii');
+
+        /*
+        four bytes (chars) in base64 converts to three bytes in binary
+        encoding. So we should always work with a number of bytes that
+        can be divided by 4, it will result in a number of buytes that
+        can be divided vy 3.
+        */
+        var offset = parseInt(part.transferBuffer.length / 4) * 4;
+        part.emit('data', new Buffer(part.transferBuffer.substring(0, offset), 'base64'))
+        part.transferBuffer = part.transferBuffer.substring(offset);
+      };
+
+      parser.onPartEnd = function() {
+        part.emit('data', new Buffer(part.transferBuffer, 'base64'))
+        part.emit('end');
+      };
+      break;
+
+      default:
+      return self._error(new Error('unknown transfer-encoding'));
+    }
+
+    self.onPart(part);
+  };
+
+
+  parser.onEnd = function() {
+    self.ended = true;
+    self._maybeEnd();
+  };
+
+  this._parser = parser;
+};
+
+IncomingForm.prototype._fileName = function(headerValue) {
+  var m = headerValue.match(/\bfilename="(.*?)"($|; )/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(this.maxFields)
+    , 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._initOctetStream = function() {
+  this.type = 'octet-stream';
+  var filename = this.headers['x-file-name'];
+  var mime = this.headers['content-type'];
+
+  var file = new File({
+    path: this._uploadPath(filename),
+    name: filename,
+    type: mime
+  });
+
+  file.open();
+
+  this.emit('fileBegin', filename, file);
+
+  this._flushing++;
+
+  var self = this;
+
+  self._parser = new OctetParser();
+
+  //Keep track of writes that haven't finished so we don't emit the file before it's done being written
+  var outstandingWrites = 0;
+
+  self._parser.on('data', function(buffer){
+    self.pause();
+    outstandingWrites++;
+
+    file.write(buffer, function() {
+      outstandingWrites--;
+      self.resume();
+
+      if(self.ended){
+        self._parser.emit('doneWritingFile');
+      }
+    });
+  });
+
+  self._parser.on('end', function(){
+    self._flushing--;
+    self.ended = true;
+
+    var done = function(){
+      self.emit('file', 'file', file);
+      self._maybeEnd();
+    };
+
+    if(outstandingWrites === 0){
+      done();
+    } else {
+      self._parser.once('doneWritingFile', done);
+    }
+  });
+};
+
+IncomingForm.prototype._initJSONencoded = function() {
+  this.type = 'json';
+
+  var parser = new JSONParser()
+    , self = this;
+
+  if (this.bytesExpected) {
+    parser.initWithLength(this.bytesExpected);
+  }
+
+  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 || this.error) {
+    return;
+  }
+
+  this.emit('end');
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js
new file mode 100755 (executable)
index 0000000..7a6e3e1
--- /dev/null
@@ -0,0 +1,3 @@
+var IncomingForm = require('./incoming_form').IncomingForm;
+IncomingForm.IncomingForm = IncomingForm;
+module.exports = IncomingForm;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/json_parser.js
new file mode 100755 (executable)
index 0000000..6ce966b
--- /dev/null
@@ -0,0 +1,35 @@
+if (global.GENTLY) require = GENTLY.hijack(require);
+
+var Buffer = require('buffer').Buffer
+
+function JSONParser() {
+  this.data = new Buffer('');
+  this.bytesWritten = 0;
+};
+exports.JSONParser = JSONParser;
+
+JSONParser.prototype.initWithLength = function(length) {
+  this.data = new Buffer(length);
+}
+
+JSONParser.prototype.write = function(buffer) {
+  if (this.data.length >= this.bytesWritten + buffer.length) {
+    buffer.copy(this.data, this.bytesWritten);
+  } else {
+    this.data = Buffer.concat([this.data, buffer]);
+  }
+  this.bytesWritten += buffer.length;
+  return buffer.length;
+}
+
+JSONParser.prototype.end = function() {
+  try {
+    var fields = JSON.parse(this.data.toString('utf8'))
+    for (var field in fields) {
+      this.onField(field, fields[field]);
+    }
+  } catch (e) {}
+  this.data = null;
+
+  this.onEnd();
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js
new file mode 100755 (executable)
index 0000000..98a6856
--- /dev/null
@@ -0,0 +1,324 @@
+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 (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]) {
+          index = -2;
+        }
+        if (c == boundary[index+2]) {
+          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() {
+  var callback = function(self, name) {
+    var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1);
+    if (callbackSymbol in self) {
+      self[callbackSymbol]();
+    }
+  };
+  if ((this.state == S.HEADER_FIELD_START && this.index == 0) ||
+      (this.state == S.PART_DATA && this.index == this.boundary.length)) {
+    callback(this, 'partEnd');
+    callback(this, 'end');
+  } else 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/octet_parser.js
new file mode 100755 (executable)
index 0000000..6e8b551
--- /dev/null
@@ -0,0 +1,20 @@
+var EventEmitter = require('events').EventEmitter
+       , util = require('util');
+
+function OctetParser(options){
+       if(!(this instanceof OctetParser)) return new OctetParser(options);
+       EventEmitter.call(this);
+}
+
+util.inherits(OctetParser, EventEmitter);
+
+exports.OctetParser = OctetParser;
+
+OctetParser.prototype.write = function(buffer) {
+    this.emit('data', buffer);
+       return buffer.length;
+};
+
+OctetParser.prototype.end = function() {
+       this.emit('end');
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js
new file mode 100755 (executable)
index 0000000..320ce5a
--- /dev/null
@@ -0,0 +1,27 @@
+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(maxKeys) {
+  this.maxKeys = maxKeys;
+  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, '&', '=', { maxKeys: this.maxKeys });
+  for (var field in fields) {
+    this.onField(field, fields[field]);
+  }
+  this.buffer = '';
+
+  this.onEnd();
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json
new file mode 100755 (executable)
index 0000000..c60b270
--- /dev/null
@@ -0,0 +1,62 @@
+{
+  "name": "formidable",
+  "description": "A node.js module for parsing form data, especially file uploads.",
+  "homepage": "https://github.com/felixge/node-formidable",
+  "version": "1.0.13",
+  "devDependencies": {
+    "gently": "0.8.0",
+    "findit": "0.1.1",
+    "hashish": "0.0.4",
+    "urun": "~0.0.6",
+    "utest": "0.0.3",
+    "request": "~2.11.4"
+  },
+  "directories": {
+    "lib": "./lib"
+  },
+  "main": "./lib/index",
+  "scripts": {
+    "test": "node test/run.js",
+    "clean": "rm test/tmp/*"
+  },
+  "engines": {
+    "node": "<0.9.0"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/felixge/node-formidable.git"
+  },
+  "bugs": {
+    "url": "http://github.com/felixge/node-formidable/issues"
+  },
+  "optionalDependencies": {},
+  "_id": "formidable@1.0.13",
+  "dependencies": {},
+  "dist": {
+    "shasum": "70caf0f9d69692a77e04021ddab4f46b01c82aea",
+    "tarball": "http://registry.npmjs.org/formidable/-/formidable-1.0.13.tgz"
+  },
+  "_from": "formidable@1.0.13",
+  "_npmVersion": "1.2.12",
+  "_npmUser": {
+    "name": "svnlto",
+    "email": "me@svenlito.com"
+  },
+  "maintainers": [
+    {
+      "name": "felixge",
+      "email": "felix@debuggable.com"
+    },
+    {
+      "name": "svnlto",
+      "email": "me@svenlito.com"
+    },
+    {
+      "name": "superjoe",
+      "email": "superjoe30@gmail.com"
+    }
+  ],
+  "_shasum": "70caf0f9d69692a77e04021ddab4f46b01c82aea",
+  "_resolved": "https://registry.npmjs.org/formidable/-/formidable-1.0.13.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js
new file mode 100755 (executable)
index 0000000..6a94295
--- /dev/null
@@ -0,0 +1,18 @@
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png
new file mode 100755 (executable)
index 0000000..20b1a7f
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/beta-sticker-1.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz
new file mode 100755 (executable)
index 0000000..4a85af7
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/binaryfile.tar.gz differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif
new file mode 100755 (executable)
index 0000000..75b945d
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/blank.gif differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt
new file mode 100755 (executable)
index 0000000..e7a4785
--- /dev/null
@@ -0,0 +1 @@
+I am a text file with a funky name!
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png
new file mode 100755 (executable)
index 0000000..1c16a71
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/menu_separator.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt
new file mode 100755 (executable)
index 0000000..9b6903e
--- /dev/null
@@ -0,0 +1 @@
+I am a plain text file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
new file mode 100755 (executable)
index 0000000..3c9dbe3
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/encoding.js
new file mode 100755 (executable)
index 0000000..83dfb15
--- /dev/null
@@ -0,0 +1,19 @@
+module.exports['menu_seperator.png.http'] = [
+  {type: 'file', name: 'image', filename: 'menu_separator.png', fixture: 'menu_separator.png'}
+];
+
+module.exports['beta-sticker-1.png.http'] = [
+  {type: 'file', name: 'sticker', filename: 'beta-sticker-1.png', fixture: 'beta-sticker-1.png'}
+];
+
+module.exports['blank.gif.http'] = [
+  {type: 'file', name: 'file', filename: 'blank.gif', fixture: 'blank.gif'}
+];
+
+module.exports['binaryfile.tar.gz.http'] = [
+  {type: 'file', name: 'file', filename: 'binaryfile.tar.gz', fixture: 'binaryfile.tar.gz'}
+];
+
+module.exports['plain.txt.http'] = [
+  {type: 'file', name: 'file', filename: 'plain.txt', fixture: 'plain.txt'}
+];
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/misc.js
new file mode 100755 (executable)
index 0000000..3e27472
--- /dev/null
@@ -0,0 +1,5 @@
+module.exports = {
+  'empty.http': [],
+  'empty-urlencoded.http': [],
+  'empty-multipart.http': [],
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js
new file mode 100755 (executable)
index 0000000..c36e792
--- /dev/null
@@ -0,0 +1,7 @@
+module.exports['generic.http'] = [
+  {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'},
+];
+
+module.exports['filename-name.http'] = [
+  {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt'},
+];
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/preamble.js
new file mode 100755 (executable)
index 0000000..da569b2
--- /dev/null
@@ -0,0 +1,7 @@
+module.exports['crlf.http'] = [
+  {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt'},
+];
+
+module.exports['preamble.http'] = [
+  {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt'},
+];
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
new file mode 100755 (executable)
index 0000000..eb76fdc
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/workarounds.js
new file mode 100755 (executable)
index 0000000..d336505
--- /dev/null
@@ -0,0 +1,6 @@
+module.exports['missing-hyphens1.http'] = [
+  {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt'},
+];
+module.exports['missing-hyphens2.http'] = [
+  {type: 'file', name: 'upload', filename: 'plain.txt', fixture: 'plain.txt'},
+];
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js
new file mode 100755 (executable)
index 0000000..a476169
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js
new file mode 100755 (executable)
index 0000000..eb32fd8
--- /dev/null
@@ -0,0 +1,94 @@
+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() {
+        res.end('OK');
+        callback(null, parts);
+      });
+  });
+
+  var socket = net.createConnection(common.port);
+  var file = fs.createReadStream(common.dir.fixture + '/http/' + name);
+
+  file.pipe(socket, {end: false});
+  socket.on('data', function () {
+    socket.end();
+  });
+
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-json.js
new file mode 100755 (executable)
index 0000000..28e758e
--- /dev/null
@@ -0,0 +1,38 @@
+var common = require('../common');
+var formidable = common.formidable;
+var http = require('http');
+var assert = require('assert');
+
+var testData = {
+  numbers: [1, 2, 3, 4, 5],
+  nested: { key: 'value' }
+};
+
+var server = http.createServer(function(req, res) {
+    var form = new formidable.IncomingForm();
+
+    form.parse(req, function(err, fields, files) {
+        assert.deepEqual(fields, testData);
+
+        res.end();
+        server.close();
+    });
+});
+
+var port = common.port;
+
+server.listen(port, function(err){
+    assert.equal(err, null);
+
+    var request = http.request({
+        port: port,
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        }
+    });
+
+    request.write(JSON.stringify(testData));
+    request.end();
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-octet-stream.js
new file mode 100755 (executable)
index 0000000..643d2c6
--- /dev/null
@@ -0,0 +1,45 @@
+var common = require('../common');
+var formidable = common.formidable;
+var http = require('http');
+var fs = require('fs');
+var path = require('path');
+var hashish = require('hashish');
+var assert = require('assert');
+
+var testFilePath = path.join(__dirname, '../fixture/file/binaryfile.tar.gz');
+
+var server = http.createServer(function(req, res) {
+    var form = new formidable.IncomingForm();
+
+    form.parse(req, function(err, fields, files) {
+        assert.equal(hashish(files).length, 1);
+        var file = files.file;
+
+        assert.equal(file.size, 301);
+
+        var uploaded = fs.readFileSync(file.path);
+        var original = fs.readFileSync(testFilePath);
+
+        assert.deepEqual(uploaded, original);
+
+        res.end();
+        server.close();
+    });
+});
+
+var port = common.port;
+
+server.listen(port, function(err){
+    assert.equal(err, null);
+
+    var request = http.request({
+        port: port,
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/octet-stream'
+        }
+    });
+
+    fs.createReadStream(testFilePath).pipe(request);
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js
new file mode 100755 (executable)
index 0000000..2b98598
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js
new file mode 100755 (executable)
index 0000000..75232aa
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js
new file mode 100755 (executable)
index 0000000..52ceedb
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js
new file mode 100755 (executable)
index 0000000..d79a8e2
--- /dev/null
@@ -0,0 +1,733 @@
+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);
+  // Can't assume dir === '/tmp' for portability
+  // assert.strictEqual(form.uploadDir, '/tmp');
+  // Make sure it is a directory instead
+  assert.doesNotThrow(function () {
+    assert(fs.statSync(form.uploadDir).isDirectory());
+  });
+  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 = {};
+
+  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;
+  });
+
+  gently.expect(form, 'writeHeaders', function(headers) {
+    assert.strictEqual(headers, REQ.headers);
+  });
+
+  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');
+    });
+    gently.expect(form, '_error');
+
+    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(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;
+    });
+
+    var parseCbOk = function (err, fields, files) {
+      assert.deepEqual(fields, {field1: 'bar', field2: 'nice'});
+      assert.deepEqual(files, {file1: '2', file2: '3'});
+    };
+    gently.expect(form, 'writeHeaders');
+    form.parse(REQ, parseCbOk);
+    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');
+        gently.expect(form, 'writeHeaders');
+      }
+      return this;
+    });
+
+    form.parse(REQ, 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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js
new file mode 100755 (executable)
index 0000000..bf2cd5e
--- /dev/null
@@ -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), 5);
+});
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js
new file mode 100755 (executable)
index 0000000..54d3e2d
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js
new file mode 100755 (executable)
index 0000000..a52db6a
--- /dev/null
@@ -0,0 +1,71 @@
+var common = require('../common');
+var BOUNDARY = '---------------------------10102754414578508781458777923',
+    FIXTURE = TEST_FIXTURES+'/multi_video.upload',
+    fs = require('fs'),
+    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.name] = tracker;
+      file
+        .on('progress', function(bytesReceived) {
+          tracker.progress.push(bytesReceived);
+          assert.equal(bytesReceived, file.size);
+        })
+        .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.name].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, 'da39a3ee5e6b4b0d3255bfef95601890afd80709');
+      assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.size);
+      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, 'da39a3ee5e6b4b0d3255bfef95601890afd80709');
+
+      server.close();
+      res.writeHead(200);
+      res.end('good');
+    });
+});
+
+server.listen(TEST_PORT, function() {
+  var stat, headers, request, fixture;
+
+  stat = fs.statSync(FIXTURE);
+  request = http.request({
+    port: TEST_PORT,
+    path: '/',
+    method: 'POST',
+    headers: {
+      'content-type': 'multipart/form-data; boundary='+BOUNDARY,
+      'content-length': stat.size,
+    },
+  });
+  fs.createReadStream(FIXTURE).pipe(request);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js
new file mode 100755 (executable)
index 0000000..02d6d5c
--- /dev/null
@@ -0,0 +1 @@
+require('urun')(__dirname)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-connection-aborted.js
new file mode 100755 (executable)
index 0000000..4ea4431
--- /dev/null
@@ -0,0 +1,27 @@
+var assert = require('assert');
+var http = require('http');
+var net = require('net');
+var formidable = require('../../lib/index');
+
+var server = http.createServer(function (req, res) {
+  var form = new formidable.IncomingForm();
+  var aborted_received = false;
+  form.on('aborted', function () {
+    aborted_received = true;
+  });
+  form.on('error', function () {
+    assert(aborted_received, 'Error event should follow aborted');
+    server.close();
+  });
+  form.on('end', function () {
+    throw new Error('Unexpected "end" event');
+  });
+  form.parse(req);
+}).listen(0, 'localhost', function () {
+  var client = net.connect(server.address().port);
+  client.write(
+    "POST / HTTP/1.1\r\n" +
+    "Content-Length: 70\r\n" +
+    "Content-Type: multipart/form-data; boundary=foo\r\n\r\n");
+  client.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-content-transfer-encoding.js
new file mode 100755 (executable)
index 0000000..165628a
--- /dev/null
@@ -0,0 +1,48 @@
+var assert = require('assert');
+var common = require('../common');
+var formidable = require('../../lib/index');
+var http = require('http');
+
+var server = http.createServer(function(req, res) {
+  var form = new formidable.IncomingForm();
+  form.uploadDir = common.dir.tmp;
+  form.on('end', function () {
+    throw new Error('Unexpected "end" event');
+  });
+  form.on('error', function (e) {
+    res.writeHead(500);
+    res.end(e.message);
+  });
+  form.parse(req);
+});
+
+server.listen(0, function() {
+  var body =
+    '--foo\r\n' +
+    'Content-Disposition: form-data; name="file1"; filename="file1"\r\n' +
+    'Content-Type: application/octet-stream\r\n' +
+    '\r\nThis is the first file\r\n' +
+    '--foo\r\n' +
+    'Content-Type: application/octet-stream\r\n' +
+    'Content-Disposition: form-data; name="file2"; filename="file2"\r\n' +
+    'Content-Transfer-Encoding: unknown\r\n' +
+    '\r\nThis is the second file\r\n' +
+    '--foo--\r\n';
+
+  var req = http.request({
+    method: 'POST',
+    port: server.address().port,
+    headers: {
+      'Content-Length': body.length,
+      'Content-Type': 'multipart/form-data; boundary=foo'
+    }
+  });
+  req.on('response', function (res) {
+    assert.equal(res.statusCode, 500);
+    res.on('data', function () {});
+    res.on('end', function () {
+      server.close();
+    });
+  });
+  req.end(body);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/standalone/test-issue-46.js
new file mode 100755 (executable)
index 0000000..1939328
--- /dev/null
@@ -0,0 +1,49 @@
+var http       = require('http'),
+    formidable = require('../../lib/index'),
+    request    = require('request'),
+    assert     = require('assert');
+
+var host = 'localhost';
+
+var index = [
+  '<form action="/" method="post" enctype="multipart/form-data">',
+  '  <input type="text" name="foo" />',
+  '  <input type="submit" />',
+  '</form>'
+].join("\n");
+
+var server = http.createServer(function(req, res) {
+
+  // Show a form for testing purposes.
+  if (req.method == 'GET') {
+    res.writeHead(200, {'content-type': 'text/html'});
+    res.end(index);
+    return;
+  }
+
+  // Parse form and write results to response.
+  var form = new formidable.IncomingForm();
+  form.parse(req, function(err, fields, files) {
+    res.writeHead(200, {'content-type': 'text/plain'}); 
+    res.write(JSON.stringify({err: err, fields: fields, files: files}));
+    res.end();
+  });
+
+}).listen(0, host, function() {
+
+  console.log("Server up and running...");
+
+  var server = this,
+      url    = 'http://' + host + ':' + server.address().port;
+
+  var parts  = [
+    {'Content-Disposition': 'form-data; name="foo"', 'body': 'bar'}
+  ]
+
+  var req = request({method: 'POST', url: url, multipart: parts}, function(e, res, body) {
+    var obj = JSON.parse(body);
+    assert.equal("bar", obj.fields.foo);
+    server.close();
+  });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/tools/base64.html
new file mode 100755 (executable)
index 0000000..48ad92e
--- /dev/null
@@ -0,0 +1,67 @@
+<html>
+<head>
+       <title>Convert a file to a base64 request</title>
+
+<script type="text/javascript">
+
+function form_submit(e){
+       console.log(e)
+
+       var resultOutput = document.getElementById('resultOutput');
+       var fileInput = document.getElementById('fileInput');
+       var fieldInput = document.getElementById('fieldInput');
+
+       makeRequestBase64(fileInput.files[0], fieldInput.value, function(err, result){
+               resultOutput.value = result;
+       });
+
+       return false;
+}
+
+function makeRequestBase64(file, fieldName, cb){
+       var boundary = '\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/\\/';
+       var crlf = "\r\n";
+
+       var reader = new FileReader();
+       reader.onload = function(e){
+               var body = '';
+
+               body += '--' + boundary + crlf;
+               body += 'Content-Disposition: form-data; name="' + fieldName + '"; filename="' + escape(file.name)+ '"' + crlf;
+               body += 'Content-Type: ' + file.type + '' + crlf;
+               body += 'Content-Transfer-Encoding: base64' + crlf
+               body += crlf;
+               body += e.target.result.substring(e.target.result.indexOf(',') + 1) + crlf;
+
+               body += '--' + boundary + '--';
+
+               var head = '';
+               head += 'POST /upload HTTP/1.1' + crlf;
+               head += 'Host: localhost:8080' + crlf;
+               head += 'Content-Type: multipart/form-data; boundary=' + boundary + '' + crlf;
+               head += 'Content-Length: ' + body.length + '' + crlf;
+
+               cb(null, head + crlf + body);
+       };
+
+       reader.readAsDataURL(file);
+}
+
+</script>
+
+</head>
+
+<body>
+
+<form action="" onsubmit="return form_submit();">
+       <label>File: <input id="fileInput" type="file" /></label><br />
+       <label>Field: <input id="fieldInput" type="text" value="file" /></label><br />
+       <button type="submit">Ok!</button><br />
+       <label>Request: <textarea id="resultOutput" readonly="readonly" rows="20" cols="80"></textarea></label><br />
+</form>
+<p>
+Don't forget to save the output with windows (CRLF) line endings!
+</p>
+
+</body>
+</html>
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-file.js
new file mode 100755 (executable)
index 0000000..fc8f36e
--- /dev/null
@@ -0,0 +1,33 @@
+var common       = require('../common');
+var test         = require('utest');
+var assert       = common.assert;
+var File = common.require('file');
+
+var file;
+var now = new Date;
+test('IncomingForm', {
+  before: function() {
+    file = new File({
+      size: 1024,
+      path: '/tmp/cat.png',
+      name: 'cat.png',
+      type: 'image/png',
+      lastModifiedDate: now,
+      filename: 'cat.png',
+      mime: 'image/png'
+    })
+  },
+
+  '#toJSON()': function() {
+    var obj = file.toJSON();
+    var len = Object.keys(obj).length;
+    assert.equal(1024, obj.size);
+    assert.equal('/tmp/cat.png', obj.path);
+    assert.equal('cat.png', obj.name);
+    assert.equal('image/png', obj.type);
+    assert.equal('image/png', obj.mime);
+    assert.equal('cat.png', obj.filename);
+    assert.equal(now, obj.mtime);
+    assert.equal(len, 8);
+  }
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js
new file mode 100755 (executable)
index 0000000..fe2ac1c
--- /dev/null
@@ -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&#9731;.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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js
new file mode 100755 (executable)
index 0000000..9f1cef8
--- /dev/null
@@ -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(
+      '<form action="/upload" enctype="multipart/form-data" method="post">'+
+      '<input type="text" name="title"><br>'+
+      '<input type="file" name="upload" multiple="multiple"><br>'+
+      '<input type="submit" value="Upload">'+
+      '</form>'
+    );
+  });
+});
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/History.md
new file mode 100755 (executable)
index 0000000..c8aa68f
--- /dev/null
@@ -0,0 +1,5 @@
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/Makefile
new file mode 100755 (executable)
index 0000000..4e9c8d3
--- /dev/null
@@ -0,0 +1,7 @@
+
+test:
+       @./node_modules/.bin/mocha \
+               --require should \
+               --reporter spec
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/Readme.md
new file mode 100755 (executable)
index 0000000..1cdd68a
--- /dev/null
@@ -0,0 +1,29 @@
+
+# pause
+
+  Pause streams...
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/index.js
new file mode 100755 (executable)
index 0000000..1b7b379
--- /dev/null
@@ -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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/node_modules/pause/package.json
new file mode 100755 (executable)
index 0000000..89be17d
--- /dev/null
@@ -0,0 +1,32 @@
+{
+  "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",
+  "_id": "pause@0.0.1",
+  "dist": {
+    "shasum": "1d408b3fdb76923b9543d96fb4c9dfd535d9cb5d",
+    "tarball": "http://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "1d408b3fdb76923b9543d96fb4c9dfd535d9cb5d",
+  "_from": "pause@0.0.1",
+  "_resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/package.json
new file mode 100755 (executable)
index 0000000..feb8c75
--- /dev/null
@@ -0,0 +1,75 @@
+{
+  "name": "connect",
+  "version": "2.7.9",
+  "description": "High performance middleware framework",
+  "keywords": [
+    "framework",
+    "web",
+    "middleware",
+    "connect",
+    "rack"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/senchalabs/connect.git"
+  },
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca",
+    "url": "http://tjholowaychuk.com"
+  },
+  "dependencies": {
+    "qs": "0.6.4",
+    "formidable": "1.0.13",
+    "cookie-signature": "1.0.1",
+    "buffer-crc32": "0.2.1",
+    "cookie": "0.0.5",
+    "send": "0.1.0",
+    "bytes": "0.2.0",
+    "fresh": "0.1.0",
+    "pause": "0.0.1",
+    "debug": "*"
+  },
+  "devDependencies": {
+    "should": "*",
+    "mocha": "*",
+    "jade": "*",
+    "dox": "*"
+  },
+  "main": "index",
+  "engines": {
+    "node": ">= 0.8.0"
+  },
+  "scripts": {
+    "test": "make"
+  },
+  "_id": "connect@2.7.9",
+  "dist": {
+    "shasum": "40c52b223ed2059230b225e7169bad7c70381732",
+    "tarball": "http://registry.npmjs.org/connect/-/connect-2.7.9.tgz"
+  },
+  "_from": "connect@2.7.9",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    },
+    {
+      "name": "creationix",
+      "email": "tim@creationix.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "40c52b223ed2059230b225e7169bad7c70381732",
+  "_resolved": "https://registry.npmjs.org/connect/-/connect-2.7.9.tgz",
+  "bugs": {
+    "url": "https://github.com/senchalabs/connect/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/senchalabs/connect"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/connect/test.js
new file mode 100755 (executable)
index 0000000..92b7003
--- /dev/null
@@ -0,0 +1,40 @@
+
+var connect = require('./');
+var app = connect();
+
+app.use(connect.logger('dev'));
+app.use(connect.bodyParser());
+
+app.use(function(req, res, next){
+  if (req.checkContinue) {
+    res.writeContinue();
+  }
+  res.end('hello');
+});
+
+var server = app.listen(3000);
+
+server.on('checkContinue', function(req, res){
+  req.checkContinue = true;
+  app(req, res);
+});
+
+
+// var http = require('http');
+
+// var app = http.createServer(function(req, res){
+//   console.log(req.headers);
+// });
+
+// app.on('checkContinue', function(req, res){
+//   if ('application/json' == req.headers['content-type']) {
+//     res.writeContinue();
+//     console.log('ok');
+//     res.end('thanks')
+//   } else {
+//     res.writeHead(400);
+//     res.end('bad request, json only');
+//   }
+// });
+
+// app.listen(3000);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/History.md
new file mode 100755 (executable)
index 0000000..9e30179
--- /dev/null
@@ -0,0 +1,11 @@
+
+1.0.1 / 2013-04-15 
+==================
+
+  * Revert "Changed underlying HMAC algo. to sha512."
+  * Revert "Fix for timing attacks on MAC verification."
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/Makefile
new file mode 100755 (executable)
index 0000000..4e9c8d3
--- /dev/null
@@ -0,0 +1,7 @@
+
+test:
+       @./node_modules/.bin/mocha \
+               --require should \
+               --reporter spec
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/Readme.md
new file mode 100755 (executable)
index 0000000..2559e84
--- /dev/null
@@ -0,0 +1,42 @@
+
+# cookie-signature
+
+  Sign and unsign cookies.
+
+## Example
+
+```js
+var cookie = require('cookie-signature');
+
+var val = cookie.sign('hello', 'tobiiscool');
+val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');
+
+var val = cookie.sign('hello', 'tobiiscool');
+cookie.unsign(val, 'tobiiscool').should.equal('hello');
+cookie.unsign(val, 'luna').should.be.false;
+```
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2012 LearnBoost &lt;tj@learnboost.com&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/index.js
new file mode 100755 (executable)
index 0000000..ed62814
--- /dev/null
@@ -0,0 +1,42 @@
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto');
+
+/**
+ * Sign the given `val` with `secret`.
+ *
+ * @param {String} val
+ * @param {String} secret
+ * @return {String}
+ * @api private
+ */
+
+exports.sign = function(val, secret){
+  if ('string' != typeof val) throw new TypeError('cookie required');
+  if ('string' != typeof secret) throw new TypeError('secret required');
+  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){
+  if ('string' != typeof val) throw new TypeError('cookie required');
+  if ('string' != typeof secret) throw new TypeError('secret required');
+  var str = val.slice(0, val.lastIndexOf('.'));
+  return exports.sign(str, secret) == val ? str : false;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie-signature/package.json
new file mode 100755 (executable)
index 0000000..a24232b
--- /dev/null
@@ -0,0 +1,41 @@
+{
+  "name": "cookie-signature",
+  "version": "1.0.1",
+  "description": "Sign and unsign cookies",
+  "keywords": [
+    "cookie",
+    "sign",
+    "unsign"
+  ],
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@learnboost.com"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*"
+  },
+  "main": "index",
+  "_id": "cookie-signature@1.0.1",
+  "dist": {
+    "shasum": "44e072148af01e6e8e24afbf12690d68ae698ecb",
+    "tarball": "http://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz"
+  },
+  "_from": "cookie-signature@1.0.1",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "44e072148af01e6e8e24afbf12690d68ae698ecb",
+  "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/README.md
new file mode 100755 (executable)
index 0000000..5187ed1
--- /dev/null
@@ -0,0 +1,44 @@
+# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) #
+
+cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.
+
+See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.
+
+## how?
+
+```
+npm install cookie
+```
+
+```javascript
+var cookie = require('cookie');
+
+var hdr = cookie.serialize('foo', 'bar');
+// hdr = 'foo=bar';
+
+var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');
+// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };
+```
+
+## more
+
+The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.
+
+### path
+> cookie path
+
+### expires
+> absolute expiration date for the cookie (Date object)
+
+### maxAge
+> relative max age of the cookie from when the client receives it (seconds)
+
+### domain
+> domain for the cookie
+
+### secure
+> true or false
+
+### httpOnly
+> true or false
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/index.js
new file mode 100755 (executable)
index 0000000..db04ad3
--- /dev/null
@@ -0,0 +1,61 @@
+
+/// Serialize the a name value pair into a cookie string suitable for
+/// http headers. An optional options object specified cookie parameters
+///
+/// serialize('foo', 'bar', { httpOnly: true })
+///   => "foo=bar; httpOnly"
+///
+/// @param {String} name
+/// @param {String} val
+/// @param {Object} options
+/// @return {String}
+var serialize = function(name, val, opt){
+    var pairs = [name + '=' + encode(val)];
+    opt = opt || {};
+
+    if (opt.maxAge) pairs.push('Max-Age=' + opt.maxAge);
+    if (opt.domain) pairs.push('Domain=' + opt.domain);
+    if (opt.path) pairs.push('Path=' + opt.path);
+    if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString());
+    if (opt.httpOnly) pairs.push('HttpOnly');
+    if (opt.secure) pairs.push('Secure');
+
+    return pairs.join('; ');
+};
+
+/// Parse the given cookie header string into an object
+/// The object has the various cookies as keys(names) => values
+/// @param {String} str
+/// @return {Object}
+var parse = function(str) {
+    var obj = {}
+    var pairs = str.split(/[;,] */);
+
+    pairs.forEach(function(pair) {
+        var eq_idx = pair.indexOf('=')
+        var key = pair.substr(0, eq_idx).trim()
+        var val = pair.substr(++eq_idx, pair.length).trim();
+
+        // quoted values
+        if ('"' == val[0]) {
+            val = val.slice(1, -1);
+        }
+
+        // only assign once
+        if (undefined == obj[key]) {
+            try {
+                obj[key] = decode(val);
+            } catch (e) {
+                obj[key] = val;
+            }
+        }
+    });
+
+    return obj;
+};
+
+var encode = encodeURIComponent;
+var decode = decodeURIComponent;
+
+module.exports.serialize = serialize;
+module.exports.parse = parse;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/package.json
new file mode 100755 (executable)
index 0000000..1d5581a
--- /dev/null
@@ -0,0 +1,49 @@
+{
+  "author": {
+    "name": "Roman Shtylman",
+    "email": "shtylman@gmail.com"
+  },
+  "name": "cookie",
+  "description": "cookie parsing and serialization",
+  "version": "0.0.5",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/shtylman/node-cookie.git"
+  },
+  "keywords": [
+    "cookie",
+    "cookies"
+  ],
+  "main": "index.js",
+  "scripts": {
+    "test": "mocha"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "mocha": "1.x.x"
+  },
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_id": "cookie@0.0.5",
+  "dist": {
+    "shasum": "f9acf9db57eb7568c9fcc596256b7bb22e307c81",
+    "tarball": "http://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "shtylman",
+      "email": "shtylman@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "f9acf9db57eb7568c9fcc596256b7bb22e307c81",
+  "_from": "cookie@0.0.5",
+  "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.0.5.tgz",
+  "bugs": {
+    "url": "https://github.com/shtylman/node-cookie/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/shtylman/node-cookie"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/mocha.opts b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/mocha.opts
new file mode 100755 (executable)
index 0000000..e2bfcc5
--- /dev/null
@@ -0,0 +1 @@
+--ui qunit
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/parse.js
new file mode 100755 (executable)
index 0000000..d8c03ab
--- /dev/null
@@ -0,0 +1,28 @@
+
+var assert = require('assert');
+
+var cookie = require('..');
+
+suite('parse');
+
+test('basic', function() {
+    assert.deepEqual({ foo: 'bar' }, cookie.parse('foo=bar'));
+    assert.deepEqual({ foo: '123' }, cookie.parse('foo=123'));
+});
+
+test('ignore spaces', function() {
+    assert.deepEqual({ FOO: 'bar', baz: 'raz' },
+            cookie.parse('FOO    = bar;   baz  =   raz'));
+});
+
+test('escaping', function() {
+    assert.deepEqual({ foo: 'bar=123456789&name=Magic+Mouse' },
+            cookie.parse('foo="bar=123456789&name=Magic+Mouse"'));
+
+    assert.deepEqual({ email: ' ",;/' },
+            cookie.parse('email=%20%22%2c%3b%2f'));
+});
+
+test('ignore escaping error and return original value', function() {
+    assert.deepEqual({ foo: '%1', bar: 'bar' }, cookie.parse('foo=%1;bar=bar'));
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/serialize.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/cookie/test/serialize.js
new file mode 100755 (executable)
index 0000000..d38768d
--- /dev/null
@@ -0,0 +1,59 @@
+// builtin
+var assert = require('assert');
+
+var cookie = require('..');
+
+suite('serialize');
+
+test('basic', function() {
+    assert.equal('foo=bar', cookie.serialize('foo', 'bar'));
+    assert.equal('foo=bar%20baz', cookie.serialize('foo', 'bar baz'));
+});
+
+test('path', function() {
+    assert.equal('foo=bar; Path=/', cookie.serialize('foo', 'bar', {
+        path: '/'
+    }));
+});
+
+test('secure', function() {
+    assert.equal('foo=bar; Secure', cookie.serialize('foo', 'bar', {
+        secure: true
+    }));
+
+    assert.equal('foo=bar', cookie.serialize('foo', 'bar', {
+        secure: false
+    }));
+});
+
+test('domain', function() {
+    assert.equal('foo=bar; Domain=example.com', cookie.serialize('foo', 'bar', {
+        domain: 'example.com'
+    }));
+});
+
+test('httpOnly', function() {
+    assert.equal('foo=bar; HttpOnly', cookie.serialize('foo', 'bar', {
+        httpOnly: true
+    }));
+});
+
+test('maxAge', function() {
+    assert.equal('foo=bar; Max-Age=1000', cookie.serialize('foo', 'bar', {
+        maxAge: 1000
+    }));
+});
+
+test('escaping', function() {
+    assert.deepEqual('cat=%2B%20', cookie.serialize('cat', '+ '));
+});
+
+test('parse->serialize', function() {
+
+    assert.deepEqual({ cat: 'foo=123&name=baz five' }, cookie.parse(
+      cookie.serialize('cat', 'foo=123&name=baz five')));
+
+    assert.deepEqual({ cat: ' ";/' }, cookie.parse(
+      cookie.serialize('cat', ' ";/')));
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/History.md
new file mode 100755 (executable)
index 0000000..770e483
--- /dev/null
@@ -0,0 +1,186 @@
+
+2.1.3 / 2015-03-13
+==================
+
+  * Updated stdout/stderr example (#186)
+  * Updated example/stdout.js to match debug current behaviour
+  * Renamed example/stderr.js to stdout.js
+  * Update Readme.md (#184)
+  * replace high intensity foreground color for bold (#182, #183)
+
+2.1.2 / 2015-03-01
+==================
+
+  * dist: recompile
+  * update "ms" to v0.7.0
+  * package: update "browserify" to v9.0.3
+  * component: fix "ms.js" repo location
+  * changed bower package name
+  * updated documentation about using debug in a browser
+  * fix: security error on safari (#167, #168, @yields)
+
+2.1.1 / 2014-12-29
+==================
+
+  * browser: use `typeof` to check for `console` existence
+  * browser: check for `console.log` truthiness (fix IE 8/9)
+  * browser: add support for Chrome apps
+  * Readme: added Windows usage remarks
+  * Add `bower.json` to properly support bower install
+
+2.1.0 / 2014-10-15
+==================
+
+  * node: implement `DEBUG_FD` env variable support
+  * package: update "browserify" to v6.1.0
+  * package: add "license" field to package.json (#135, @panuhorsmalahti)
+
+2.0.0 / 2014-09-01
+==================
+
+  * package: update "browserify" to v5.11.0
+  * node: use stderr rather than stdout for logging (#29, @stephenmathieson)
+
+1.0.4 / 2014-07-15
+==================
+
+  * dist: recompile
+  * example: remove `console.info()` log usage
+  * example: add "Content-Type" UTF-8 header to browser example
+  * browser: place %c marker after the space character
+  * browser: reset the "content" color via `color: inherit`
+  * browser: add colors support for Firefox >= v31
+  * debug: prefer an instance `log()` function over the global one (#119)
+  * Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
+
+1.0.3 / 2014-07-09
+==================
+
+  * Add support for multiple wildcards in namespaces (#122, @seegno)
+  * browser: fix lint
+
+1.0.2 / 2014-06-10
+==================
+
+  * browser: update color palette (#113, @gscottolson)
+  * common: make console logging function configurable (#108, @timoxley)
+  * node: fix %o colors on old node <= 0.8.x
+  * Makefile: find node path using shell/which (#109, @timoxley)
+
+1.0.1 / 2014-06-06
+==================
+
+  * browser: use `removeItem()` to clear localStorage
+  * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
+  * package: add "contributors" section
+  * node: fix comment typo
+  * README: list authors
+
+1.0.0 / 2014-06-04
+==================
+
+  * make ms diff be global, not be scope
+  * debug: ignore empty strings in enable()
+  * node: make DEBUG_COLORS able to disable coloring
+  * *: export the `colors` array
+  * npmignore: don't publish the `dist` dir
+  * Makefile: refactor to use browserify
+  * package: add "browserify" as a dev dependency
+  * Readme: add Web Inspector Colors section
+  * node: reset terminal color for the debug content
+  * node: map "%o" to `util.inspect()`
+  * browser: map "%j" to `JSON.stringify()`
+  * debug: add custom "formatters"
+  * debug: use "ms" module for humanizing the diff
+  * Readme: add "bash" syntax highlighting
+  * browser: add Firebug color support
+  * browser: add colors for WebKit browsers
+  * node: apply log to `console`
+  * rewrite: abstract common logic for Node & browsers
+  * add .jshintrc file
+
+0.8.1 / 2014-04-14
+==================
+
+  * package: re-add the "component" section
+
+0.8.0 / 2014-03-30
+==================
+
+  * add `enable()` method for nodejs. Closes #27
+  * change from stderr to stdout
+  * remove unnecessary index.js file
+
+0.7.4 / 2013-11-13
+==================
+
+  * remove "browserify" key from package.json (fixes something in browserify)
+
+0.7.3 / 2013-10-30
+==================
+
+  * fix: catch localStorage security error when cookies are blocked (Chrome)
+  * add debug(err) support. Closes #46
+  * add .browser prop to package.json. Closes #42
+
+0.7.2 / 2013-02-06
+==================
+
+  * fix package.json
+  * fix: Mobile Safari (private mode) is broken with debug
+  * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
+
+0.7.1 / 2013-02-05
+==================
+
+  * add repository URL to package.json
+  * add DEBUG_COLORED to force colored output
+  * add browserify support
+  * fix component. Closes #24
+
+0.7.0 / 2012-05-04
+==================
+
+  * Added .component to package.json
+  * Added debug.component.js build
+
+0.6.0 / 2012-03-16
+==================
+
+  * Added support for "-" prefix in DEBUG [Vinay Pulim]
+  * Added `.enabled` flag to the node version [TooTallNate]
+
+0.5.0 / 2012-02-02
+==================
+
+  * Added: humanize diffs. Closes #8
+  * Added `debug.disable()` to the CS variant
+  * Removed padding. Closes #10
+  * Fixed: persist client-side variant again. Closes #9
+
+0.4.0 / 2012-02-01
+==================
+
+  * Added browser variant support for older browsers [TooTallNate]
+  * Added `debug.enable('project:*')` to browser variant [TooTallNate]
+  * Added padding to diff (moved it to the right)
+
+0.3.0 / 2012-01-26
+==================
+
+  * Added millisecond diff when isatty, otherwise UTC string
+
+0.2.0 / 2012-01-22
+==================
+
+  * Added wildcard support
+
+0.1.0 / 2011-12-02
+==================
+
+  * Added: remove colors unless stderr isatty [TooTallNate]
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/Makefile
new file mode 100755 (executable)
index 0000000..b0bde6e
--- /dev/null
@@ -0,0 +1,33 @@
+
+# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
+THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
+
+# BIN directory
+BIN := $(THIS_DIR)/node_modules/.bin
+
+# applications
+NODE ?= $(shell which node)
+NPM ?= $(NODE) $(shell which npm)
+BROWSERIFY ?= $(NODE) $(BIN)/browserify
+
+all: dist/debug.js
+
+install: node_modules
+
+clean:
+       @rm -rf node_modules dist
+
+dist:
+       @mkdir -p $@
+
+dist/debug.js: node_modules browser.js debug.js dist
+       @$(BROWSERIFY) \
+               --standalone debug \
+               . > $@
+
+node_modules: package.json
+       @NODE_ENV= $(NPM) install
+       @touch node_modules
+
+.PHONY: all install clean
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/Readme.md
new file mode 100755 (executable)
index 0000000..14222e0
--- /dev/null
@@ -0,0 +1,178 @@
+# debug
+
+  tiny node.js debugging utility modelled after node core's debugging technique.
+
+## Installation
+
+```bash
+$ npm install debug
+```
+
+## Usage
+
+ With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
+
+Example _app.js_:
+
+```js
+var debug = require('debug')('http')
+  , http = require('http')
+  , name = 'My App';
+
+// fake app
+
+debug('booting %s', name);
+
+http.createServer(function(req, res){
+  debug(req.method + ' ' + req.url);
+  res.end('hello\n');
+}).listen(3000, function(){
+  debug('listening');
+});
+
+// fake worker of some kind
+
+require('./worker');
+```
+
+Example _worker.js_:
+
+```js
+var debug = require('debug')('worker');
+
+setInterval(function(){
+  debug('doing some work');
+}, 1000);
+```
+
+ The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
+
+  ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
+
+  ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
+
+#### Windows note
+
+ On Windows the environment variable is set using the `set` command. 
+ ```cmd
+ set DEBUG=*,-not_this
+ ```
+
+Then, run the program to be debugged as usual.
+
+## Millisecond diff
+
+  When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
+
+  ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
+
+  When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
+
+  ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
+
+## Conventions
+
+ If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
+
+## Wildcards
+
+  The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
+
+  You can also exclude specific debuggers by prefixing them with a "-" character.  For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
+
+## Browser support
+
+  Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include:
+
+```js
+window.myDebug = require("debug");
+```
+
+  ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console:
+
+```js
+myDebug.enable("worker:*")
+```
+
+  Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console.
+
+```js
+a = debug('worker:a');
+b = debug('worker:b');
+
+setInterval(function(){
+  a('doing some work');
+}, 1000);
+
+setInterval(function(){
+  b('doing some work');
+}, 1200);
+```
+
+#### Web Inspector Colors
+
+  Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
+  option. These are WebKit web inspectors, Firefox ([since version
+  31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
+  and the Firebug plugin for Firefox (any version).
+
+  Colored output looks something like:
+
+  ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
+
+### stderr vs stdout
+
+You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
+
+Example _stdout.js_:
+
+```js
+var debug = require('debug');
+var error = debug('app:error');
+
+// by default stderr is used
+error('goes to stderr!');
+
+var log = debug('app:log');
+// set this namespace to log via console.log
+log.log = console.log.bind(console); // don't forget to bind to console!
+log('goes to stdout');
+error('still goes to stderr!');
+
+// set all output to go via console.info
+// overrides all per-namespace log settings
+debug.log = console.info.bind(console);
+error('now goes to stdout via console.info');
+log('still goes to stdout, but via console.info now');
+```
+
+## Authors
+
+ - TJ Holowaychuk
+ - Nathan Rajlich
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2014 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/bower.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/bower.json
new file mode 100755 (executable)
index 0000000..f7d3f6d
--- /dev/null
@@ -0,0 +1,28 @@
+{
+  "name": "visionmedia-debug",
+  "main": "dist/debug.js",
+  "version": "2.1.3",
+  "homepage": "https://github.com/visionmedia/debug",
+  "authors": [
+    "TJ Holowaychuk <tj@vision-media.ca>"
+  ],
+  "description": "visionmedia-debug",
+  "moduleType": [
+    "amd",
+    "es6",
+    "globals",
+    "node"
+  ],
+  "keywords": [
+    "visionmedia",
+    "debug"
+  ],
+  "license": "MIT",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/browser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/browser.js
new file mode 100755 (executable)
index 0000000..55f4cf9
--- /dev/null
@@ -0,0 +1,175 @@
+
+/**
+ * This is the web browser implementation of `debug()`.
+ *
+ * Expose `debug()` as the module.
+ */
+
+exports = module.exports = require('./debug');
+exports.log = log;
+exports.formatArgs = formatArgs;
+exports.save = save;
+exports.load = load;
+exports.useColors = useColors;
+
+/**
+ * Use chrome.storage.local if we are in an app
+ */
+
+var storage;
+
+if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined')
+  storage = chrome.storage.local;
+else
+  storage = localstorage();
+
+/**
+ * Colors.
+ */
+
+exports.colors = [
+  'lightseagreen',
+  'forestgreen',
+  'goldenrod',
+  'dodgerblue',
+  'darkorchid',
+  'crimson'
+];
+
+/**
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
+ * and the Firebug extension (any Firefox version) are known
+ * to support "%c" CSS customizations.
+ *
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
+ */
+
+function useColors() {
+  // is webkit? http://stackoverflow.com/a/16459606/376773
+  return ('WebkitAppearance' in document.documentElement.style) ||
+    // is firebug? http://stackoverflow.com/a/398120/376773
+    (window.console && (console.firebug || (console.exception && console.table))) ||
+    // is firefox >= v31?
+    // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
+    (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
+}
+
+/**
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
+ */
+
+exports.formatters.j = function(v) {
+  return JSON.stringify(v);
+};
+
+
+/**
+ * Colorize log arguments if enabled.
+ *
+ * @api public
+ */
+
+function formatArgs() {
+  var args = arguments;
+  var useColors = this.useColors;
+
+  args[0] = (useColors ? '%c' : '')
+    + this.namespace
+    + (useColors ? ' %c' : ' ')
+    + args[0]
+    + (useColors ? '%c ' : ' ')
+    + '+' + exports.humanize(this.diff);
+
+  if (!useColors) return args;
+
+  var c = 'color: ' + this.color;
+  args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
+
+  // the final "%c" is somewhat tricky, because there could be other
+  // arguments passed either before or after the %c, so we need to
+  // figure out the correct index to insert the CSS into
+  var index = 0;
+  var lastC = 0;
+  args[0].replace(/%[a-z%]/g, function(match) {
+    if ('%%' === match) return;
+    index++;
+    if ('%c' === match) {
+      // we only are interested in the *last* %c
+      // (the user may have provided their own)
+      lastC = index;
+    }
+  });
+
+  args.splice(lastC, 0, c);
+  return args;
+}
+
+/**
+ * Invokes `console.log()` when available.
+ * No-op when `console.log` is not a "function".
+ *
+ * @api public
+ */
+
+function log() {
+  // this hackery is required for IE8/9, where
+  // the `console.log` function doesn't have 'apply'
+  return 'object' === typeof console
+    && console.log
+    && Function.prototype.apply.call(console.log, console, arguments);
+}
+
+/**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+
+function save(namespaces) {
+  try {
+    if (null == namespaces) {
+      storage.removeItem('debug');
+    } else {
+      storage.debug = namespaces;
+    }
+  } catch(e) {}
+}
+
+/**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+
+function load() {
+  var r;
+  try {
+    r = storage.debug;
+  } catch(e) {}
+  return r;
+}
+
+/**
+ * Enable namespaces listed in `localStorage.debug` initially.
+ */
+
+exports.enable(load());
+
+/**
+ * Localstorage attempts to return the localstorage.
+ *
+ * This is necessary because safari throws
+ * when a user disables cookies/localstorage
+ * and you attempt to access it.
+ *
+ * @return {LocalStorage}
+ * @api private
+ */
+
+function localstorage(){
+  try {
+    return window.localStorage;
+  } catch (e) {}
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/component.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/component.json
new file mode 100755 (executable)
index 0000000..52ffd42
--- /dev/null
@@ -0,0 +1,19 @@
+{
+  "name": "debug",
+  "repo": "visionmedia/debug",
+  "description": "small debugging utility",
+  "version": "2.1.3",
+  "keywords": [
+    "debug",
+    "log",
+    "debugger"
+  ],
+  "main": "browser.js",
+  "scripts": [
+    "browser.js",
+    "debug.js"
+  ],
+  "dependencies": {
+    "rauchg/ms.js": "0.7.0"
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/debug.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/debug.js
new file mode 100755 (executable)
index 0000000..7571a86
--- /dev/null
@@ -0,0 +1,197 @@
+
+/**
+ * This is the common logic for both the Node.js and web browser
+ * implementations of `debug()`.
+ *
+ * Expose `debug()` as the module.
+ */
+
+exports = module.exports = debug;
+exports.coerce = coerce;
+exports.disable = disable;
+exports.enable = enable;
+exports.enabled = enabled;
+exports.humanize = require('ms');
+
+/**
+ * The currently active debug mode names, and names to skip.
+ */
+
+exports.names = [];
+exports.skips = [];
+
+/**
+ * Map of special "%n" handling functions, for the debug "format" argument.
+ *
+ * Valid key names are a single, lowercased letter, i.e. "n".
+ */
+
+exports.formatters = {};
+
+/**
+ * Previously assigned color.
+ */
+
+var prevColor = 0;
+
+/**
+ * Previous log timestamp.
+ */
+
+var prevTime;
+
+/**
+ * Select a color.
+ *
+ * @return {Number}
+ * @api private
+ */
+
+function selectColor() {
+  return exports.colors[prevColor++ % exports.colors.length];
+}
+
+/**
+ * Create a debugger with the given `namespace`.
+ *
+ * @param {String} namespace
+ * @return {Function}
+ * @api public
+ */
+
+function debug(namespace) {
+
+  // define the `disabled` version
+  function disabled() {
+  }
+  disabled.enabled = false;
+
+  // define the `enabled` version
+  function enabled() {
+
+    var self = enabled;
+
+    // set `diff` timestamp
+    var curr = +new Date();
+    var ms = curr - (prevTime || curr);
+    self.diff = ms;
+    self.prev = prevTime;
+    self.curr = curr;
+    prevTime = curr;
+
+    // add the `color` if not set
+    if (null == self.useColors) self.useColors = exports.useColors();
+    if (null == self.color && self.useColors) self.color = selectColor();
+
+    var args = Array.prototype.slice.call(arguments);
+
+    args[0] = exports.coerce(args[0]);
+
+    if ('string' !== typeof args[0]) {
+      // anything else let's inspect with %o
+      args = ['%o'].concat(args);
+    }
+
+    // apply any `formatters` transformations
+    var index = 0;
+    args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
+      // if we encounter an escaped % then don't increase the array index
+      if (match === '%%') return match;
+      index++;
+      var formatter = exports.formatters[format];
+      if ('function' === typeof formatter) {
+        var val = args[index];
+        match = formatter.call(self, val);
+
+        // now we need to remove `args[index]` since it's inlined in the `format`
+        args.splice(index, 1);
+        index--;
+      }
+      return match;
+    });
+
+    if ('function' === typeof exports.formatArgs) {
+      args = exports.formatArgs.apply(self, args);
+    }
+    var logFn = enabled.log || exports.log || console.log.bind(console);
+    logFn.apply(self, args);
+  }
+  enabled.enabled = true;
+
+  var fn = exports.enabled(namespace) ? enabled : disabled;
+
+  fn.namespace = namespace;
+
+  return fn;
+}
+
+/**
+ * Enables a debug mode by namespaces. This can include modes
+ * separated by a colon and wildcards.
+ *
+ * @param {String} namespaces
+ * @api public
+ */
+
+function enable(namespaces) {
+  exports.save(namespaces);
+
+  var split = (namespaces || '').split(/[\s,]+/);
+  var len = split.length;
+
+  for (var i = 0; i < len; i++) {
+    if (!split[i]) continue; // ignore empty strings
+    namespaces = split[i].replace(/\*/g, '.*?');
+    if (namespaces[0] === '-') {
+      exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
+    } else {
+      exports.names.push(new RegExp('^' + namespaces + '$'));
+    }
+  }
+}
+
+/**
+ * Disable debug output.
+ *
+ * @api public
+ */
+
+function disable() {
+  exports.enable('');
+}
+
+/**
+ * Returns true if the given mode name is enabled, false otherwise.
+ *
+ * @param {String} name
+ * @return {Boolean}
+ * @api public
+ */
+
+function enabled(name) {
+  var i, len;
+  for (i = 0, len = exports.skips.length; i < len; i++) {
+    if (exports.skips[i].test(name)) {
+      return false;
+    }
+  }
+  for (i = 0, len = exports.names.length; i < len; i++) {
+    if (exports.names[i].test(name)) {
+      return true;
+    }
+  }
+  return false;
+}
+
+/**
+ * Coerce `val`.
+ *
+ * @param {Mixed} val
+ * @return {Mixed}
+ * @api private
+ */
+
+function coerce(val) {
+  if (val instanceof Error) return val.stack || val.message;
+  return val;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node.js
new file mode 100755 (executable)
index 0000000..1d392a8
--- /dev/null
@@ -0,0 +1,209 @@
+
+/**
+ * Module dependencies.
+ */
+
+var tty = require('tty');
+var util = require('util');
+
+/**
+ * This is the Node.js implementation of `debug()`.
+ *
+ * Expose `debug()` as the module.
+ */
+
+exports = module.exports = require('./debug');
+exports.log = log;
+exports.formatArgs = formatArgs;
+exports.save = save;
+exports.load = load;
+exports.useColors = useColors;
+
+/**
+ * Colors.
+ */
+
+exports.colors = [6, 2, 3, 4, 5, 1];
+
+/**
+ * The file descriptor to write the `debug()` calls to.
+ * Set the `DEBUG_FD` env variable to override with another value. i.e.:
+ *
+ *   $ DEBUG_FD=3 node script.js 3>debug.log
+ */
+
+var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
+var stream = 1 === fd ? process.stdout :
+             2 === fd ? process.stderr :
+             createWritableStdioStream(fd);
+
+/**
+ * Is stdout a TTY? Colored output is enabled when `true`.
+ */
+
+function useColors() {
+  var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
+  if (0 === debugColors.length) {
+    return tty.isatty(fd);
+  } else {
+    return '0' !== debugColors
+        && 'no' !== debugColors
+        && 'false' !== debugColors
+        && 'disabled' !== debugColors;
+  }
+}
+
+/**
+ * Map %o to `util.inspect()`, since Node doesn't do that out of the box.
+ */
+
+var inspect = (4 === util.inspect.length ?
+  // node <= 0.8.x
+  function (v, colors) {
+    return util.inspect(v, void 0, void 0, colors);
+  } :
+  // node > 0.8.x
+  function (v, colors) {
+    return util.inspect(v, { colors: colors });
+  }
+);
+
+exports.formatters.o = function(v) {
+  return inspect(v, this.useColors)
+    .replace(/\s*\n\s*/g, ' ');
+};
+
+/**
+ * Adds ANSI color escape codes if enabled.
+ *
+ * @api public
+ */
+
+function formatArgs() {
+  var args = arguments;
+  var useColors = this.useColors;
+  var name = this.namespace;
+
+  if (useColors) {
+    var c = this.color;
+
+    args[0] = '  \u001b[3' + c + ';1m' + name + ' '
+      + '\u001b[0m'
+      + args[0] + '\u001b[3' + c + 'm'
+      + ' +' + exports.humanize(this.diff) + '\u001b[0m';
+  } else {
+    args[0] = new Date().toUTCString()
+      + ' ' + name + ' ' + args[0];
+  }
+  return args;
+}
+
+/**
+ * Invokes `console.error()` with the specified arguments.
+ */
+
+function log() {
+  return stream.write(util.format.apply(this, arguments) + '\n');
+}
+
+/**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+
+function save(namespaces) {
+  if (null == namespaces) {
+    // If you set a process.env field to null or undefined, it gets cast to the
+    // string 'null' or 'undefined'. Just delete instead.
+    delete process.env.DEBUG;
+  } else {
+    process.env.DEBUG = namespaces;
+  }
+}
+
+/**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+
+function load() {
+  return process.env.DEBUG;
+}
+
+/**
+ * Copied from `node/src/node.js`.
+ *
+ * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
+ * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
+ */
+
+function createWritableStdioStream (fd) {
+  var stream;
+  var tty_wrap = process.binding('tty_wrap');
+
+  // Note stream._type is used for test-module-load-list.js
+
+  switch (tty_wrap.guessHandleType(fd)) {
+    case 'TTY':
+      stream = new tty.WriteStream(fd);
+      stream._type = 'tty';
+
+      // Hack to have stream not keep the event loop alive.
+      // See https://github.com/joyent/node/issues/1726
+      if (stream._handle && stream._handle.unref) {
+        stream._handle.unref();
+      }
+      break;
+
+    case 'FILE':
+      var fs = require('fs');
+      stream = new fs.SyncWriteStream(fd, { autoClose: false });
+      stream._type = 'fs';
+      break;
+
+    case 'PIPE':
+    case 'TCP':
+      var net = require('net');
+      stream = new net.Socket({
+        fd: fd,
+        readable: false,
+        writable: true
+      });
+
+      // FIXME Should probably have an option in net.Socket to create a
+      // stream from an existing fd which is writable only. But for now
+      // we'll just add this hack and set the `readable` member to false.
+      // Test: ./node test/fixtures/echo.js < /etc/passwd
+      stream.readable = false;
+      stream.read = null;
+      stream._type = 'pipe';
+
+      // FIXME Hack to have stream not keep the event loop alive.
+      // See https://github.com/joyent/node/issues/1726
+      if (stream._handle && stream._handle.unref) {
+        stream._handle.unref();
+      }
+      break;
+
+    default:
+      // Probably an error on in uv_guess_handle()
+      throw new Error('Implement me. Unknown stream file type!');
+  }
+
+  // For supporting legacy API we put the FD here.
+  stream.fd = fd;
+
+  stream._isStdio = true;
+
+  return stream;
+}
+
+/**
+ * Enable namespaces listed in `process.env.DEBUG` initially.
+ */
+
+exports.enable(load());
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/LICENSE
new file mode 100755 (executable)
index 0000000..6c07561
--- /dev/null
@@ -0,0 +1,20 @@
+(The MIT License)
+
+Copyright (c) 2014 Guillermo Rauch <rauchg@gmail.com>
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/README.md
new file mode 100755 (executable)
index 0000000..0fd54fd
--- /dev/null
@@ -0,0 +1,35 @@
+# ms.js: miliseconds conversion utility
+
+```js
+ms('2 days')  // 172800000
+ms('1d')      // 86400000
+ms('10h')     // 36000000
+ms('2.5 hrs') // 9000000
+ms('2h')      // 7200000
+ms('1m')      // 60000
+ms('5s')      // 5000
+ms('100')     // 100
+```
+
+```js
+ms(60000)             // "1m"
+ms(2 * 60000)         // "2m"
+ms(ms('10 hours'))    // "10h"
+```
+
+```js
+ms(60000, { long: true })             // "1 minute"
+ms(2 * 60000, { long: true })         // "2 minutes"
+ms(ms('10 hours'), { long: true })    // "10 hours"
+```
+
+- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](nodejs.org/download).
+- If a number is supplied to `ms`, a string with a unit is returned.
+- If a string that contains the number is supplied, it returns it as
+a number (e.g: it returns `100` for `'100'`).
+- If you pass a string with a number and a valid unit, the number of
+equivalent ms is returned.
+
+## License
+
+MIT
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/index.js
new file mode 100755 (executable)
index 0000000..e79bfa1
--- /dev/null
@@ -0,0 +1,123 @@
+/**
+ * Helpers.
+ */
+
+var s = 1000;
+var m = s * 60;
+var h = m * 60;
+var d = h * 24;
+var y = d * 365.25;
+
+/**
+ * Parse or format the given `val`.
+ *
+ * Options:
+ *
+ *  - `long` verbose formatting [false]
+ *
+ * @param {String|Number} val
+ * @param {Object} options
+ * @return {String|Number}
+ * @api public
+ */
+
+module.exports = function(val, options){
+  options = options || {};
+  if ('string' == typeof val) return parse(val);
+  return options.long
+    ? long(val)
+    : short(val);
+};
+
+/**
+ * Parse the given `str` and return milliseconds.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+function parse(str) {
+  var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
+  if (!match) return;
+  var n = parseFloat(match[1]);
+  var type = (match[2] || 'ms').toLowerCase();
+  switch (type) {
+    case 'years':
+    case 'year':
+    case 'yrs':
+    case 'yr':
+    case 'y':
+      return n * y;
+    case 'days':
+    case 'day':
+    case 'd':
+      return n * d;
+    case 'hours':
+    case 'hour':
+    case 'hrs':
+    case 'hr':
+    case 'h':
+      return n * h;
+    case 'minutes':
+    case 'minute':
+    case 'mins':
+    case 'min':
+    case 'm':
+      return n * m;
+    case 'seconds':
+    case 'second':
+    case 'secs':
+    case 'sec':
+    case 's':
+      return n * s;
+    case 'milliseconds':
+    case 'millisecond':
+    case 'msecs':
+    case 'msec':
+    case 'ms':
+      return n;
+  }
+}
+
+/**
+ * Short format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+function short(ms) {
+  if (ms >= d) return Math.round(ms / d) + 'd';
+  if (ms >= h) return Math.round(ms / h) + 'h';
+  if (ms >= m) return Math.round(ms / m) + 'm';
+  if (ms >= s) return Math.round(ms / s) + 's';
+  return ms + 'ms';
+}
+
+/**
+ * Long format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+function long(ms) {
+  return plural(ms, d, 'day')
+    || plural(ms, h, 'hour')
+    || plural(ms, m, 'minute')
+    || plural(ms, s, 'second')
+    || ms + ' ms';
+}
+
+/**
+ * Pluralization helper.
+ */
+
+function plural(ms, n, name) {
+  if (ms < n) return;
+  if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
+  return Math.ceil(ms / n) + ' ' + name + 's';
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/node_modules/ms/package.json
new file mode 100755 (executable)
index 0000000..ec3ea9b
--- /dev/null
@@ -0,0 +1,47 @@
+{
+  "name": "ms",
+  "version": "0.7.0",
+  "description": "Tiny ms conversion utility",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/guille/ms.js.git"
+  },
+  "main": "./index",
+  "devDependencies": {
+    "mocha": "*",
+    "expect.js": "*",
+    "serve": "*"
+  },
+  "component": {
+    "scripts": {
+      "ms/index.js": "index.js"
+    }
+  },
+  "gitHead": "1e9cd9b05ef0dc26f765434d2bfee42394376e52",
+  "bugs": {
+    "url": "https://github.com/guille/ms.js/issues"
+  },
+  "homepage": "https://github.com/guille/ms.js",
+  "_id": "ms@0.7.0",
+  "scripts": {},
+  "_shasum": "865be94c2e7397ad8a57da6a633a6e2f30798b83",
+  "_from": "ms@0.7.0",
+  "_npmVersion": "1.4.21",
+  "_npmUser": {
+    "name": "rauchg",
+    "email": "rauchg@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "rauchg",
+      "email": "rauchg@gmail.com"
+    }
+  ],
+  "dist": {
+    "shasum": "865be94c2e7397ad8a57da6a633a6e2f30798b83",
+    "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.0.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/debug/package.json
new file mode 100755 (executable)
index 0000000..a870a5b
--- /dev/null
@@ -0,0 +1,73 @@
+{
+  "name": "debug",
+  "version": "2.1.3",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/visionmedia/debug.git"
+  },
+  "description": "small debugging utility",
+  "keywords": [
+    "debug",
+    "log",
+    "debugger"
+  ],
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "contributors": [
+    {
+      "name": "Nathan Rajlich",
+      "email": "nathan@tootallnate.net",
+      "url": "http://n8.io"
+    }
+  ],
+  "license": "MIT",
+  "dependencies": {
+    "ms": "0.7.0"
+  },
+  "devDependencies": {
+    "browserify": "9.0.3",
+    "mocha": "*"
+  },
+  "main": "./node.js",
+  "browser": "./browser.js",
+  "component": {
+    "scripts": {
+      "debug/index.js": "browser.js",
+      "debug/debug.js": "debug.js"
+    }
+  },
+  "gitHead": "0a8e4b7e0d2d1b55ef4e7422498ca24c677ae63a",
+  "bugs": {
+    "url": "https://github.com/visionmedia/debug/issues"
+  },
+  "homepage": "https://github.com/visionmedia/debug",
+  "_id": "debug@2.1.3",
+  "scripts": {},
+  "_shasum": "ce8ab1b5ee8fbee2bfa3b633cab93d366b63418e",
+  "_from": "debug@*",
+  "_npmVersion": "2.5.1",
+  "_nodeVersion": "0.12.0",
+  "_npmUser": {
+    "name": "tootallnate",
+    "email": "nathan@tootallnate.net"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    },
+    {
+      "name": "tootallnate",
+      "email": "nathan@tootallnate.net"
+    }
+  ],
+  "dist": {
+    "shasum": "ce8ab1b5ee8fbee2bfa3b633cab93d366b63418e",
+    "tarball": "http://registry.npmjs.org/debug/-/debug-2.1.3.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/debug/-/debug-2.1.3.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/Makefile
new file mode 100755 (executable)
index 0000000..8e8640f
--- /dev/null
@@ -0,0 +1,7 @@
+
+test:
+       @./node_modules/.bin/mocha \
+               --reporter spec \
+               --require should
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/Readme.md
new file mode 100755 (executable)
index 0000000..273130d
--- /dev/null
@@ -0,0 +1,32 @@
+
+# node-fresh
+
+  HTTP response freshness testing
+
+## fresh(req, res)
+
+ Check freshness of `req` and `res` headers.
+
+ When the cache is "fresh" __true__ is returned,
+ otherwise __false__ is returned to indicate that
+ the cache is now stale.
+
+## Example:
+
+```js
+var req = { 'if-none-match': 'tobi' };
+var res = { 'etag': 'luna' };
+fresh(req, res);
+// => false
+
+var req = { 'if-none-match': 'tobi' };
+var res = { 'etag': 'tobi' };
+fresh(req, res);
+// => true
+```
+
+## Installation
+
+```
+$ npm install fresh
+```
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/index.js
new file mode 100755 (executable)
index 0000000..b2f4d41
--- /dev/null
@@ -0,0 +1,49 @@
+
+/**
+ * Expose `fresh()`.
+ */
+
+module.exports = fresh;
+
+/**
+ * Check freshness of `req` and `res` headers.
+ *
+ * When the cache is "fresh" __true__ is returned,
+ * otherwise __false__ is returned to indicate that
+ * the cache is now stale.
+ *
+ * @param {Object} req
+ * @param {Object} res
+ * @return {Boolean}
+ * @api public
+ */
+
+function fresh(req, res) {
+  // defaults
+  var etagMatches = true;
+  var notModified = true;
+
+  // fields
+  var modifiedSince = req['if-modified-since'];
+  var noneMatch = req['if-none-match'];
+  var lastModified = res['last-modified'];
+  var etag = res['etag'];
+
+  // unconditional request
+  if (!modifiedSince && !noneMatch) return false;
+
+  // parse if-none-match
+  if (noneMatch) noneMatch = noneMatch.split(/ *, */);
+
+  // if-none-match
+  if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0];
+
+  // if-modified-since
+  if (modifiedSince) {
+    modifiedSince = new Date(modifiedSince);
+    lastModified = new Date(lastModified);
+    notModified = lastModified <= modifiedSince;
+  }
+
+  return !! (etagMatches && notModified);
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/fresh/package.json
new file mode 100755 (executable)
index 0000000..787e19a
--- /dev/null
@@ -0,0 +1,44 @@
+{
+  "name": "fresh",
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca",
+    "url": "http://tjholowaychuk.com"
+  },
+  "description": "HTTP response freshness testing",
+  "version": "0.1.0",
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*"
+  },
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "_id": "fresh@0.1.0",
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.1.24",
+  "_nodeVersion": "v0.6.19",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "03e4b0178424e4c2d5d19a54d8814cdc97934850",
+    "tarball": "http://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "03e4b0178424e4c2d5d19a54d8814cdc97934850",
+  "_from": "fresh@0.1.0",
+  "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/methods/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/methods/index.js
new file mode 100755 (executable)
index 0000000..297d022
--- /dev/null
@@ -0,0 +1,26 @@
+
+module.exports = [
+    'get'
+  , 'post'
+  , 'put'
+  , 'head'
+  , 'delete'
+  , 'options'
+  , 'trace'
+  , 'copy'
+  , 'lock'
+  , 'mkcol'
+  , 'move'
+  , 'propfind'
+  , 'proppatch'
+  , 'unlock'
+  , 'report'
+  , 'mkactivity'
+  , 'checkout'
+  , 'merge'
+  , 'm-search'
+  , 'notify'
+  , 'subscribe'
+  , 'unsubscribe'
+  , 'patch'
+];
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/methods/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/methods/package.json
new file mode 100755 (executable)
index 0000000..1afb803
--- /dev/null
@@ -0,0 +1,33 @@
+{
+  "name": "methods",
+  "version": "0.0.1",
+  "description": "HTTP methods that node supports",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "keywords": [
+    "http",
+    "methods"
+  ],
+  "author": {
+    "name": "TJ Holowaychuk"
+  },
+  "license": "MIT",
+  "_id": "methods@0.0.1",
+  "dist": {
+    "shasum": "277c90f8bef39709645a8371c51c3b6c648e068c",
+    "tarball": "http://registry.npmjs.org/methods/-/methods-0.0.1.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "277c90f8bef39709645a8371c51c3b6c648e068c",
+  "_from": "methods@0.0.1",
+  "_resolved": "https://registry.npmjs.org/methods/-/methods-0.0.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/LICENSE
new file mode 100755 (executable)
index 0000000..432d1ae
--- /dev/null
@@ -0,0 +1,21 @@
+Copyright 2010 James Halliday (mail@substack.net)
+
+This project is free software released under the MIT/X11 license:
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/README.markdown b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/README.markdown
new file mode 100755 (executable)
index 0000000..40de04f
--- /dev/null
@@ -0,0 +1,61 @@
+mkdirp
+======
+
+Like `mkdir -p`, but in node.js!
+
+[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
+
+example
+=======
+
+pow.js
+------
+    var mkdirp = require('mkdirp');
+    
+    mkdirp('/tmp/foo/bar/baz', function (err) {
+        if (err) console.error(err)
+        else console.log('pow!')
+    });
+
+Output
+    pow!
+
+And now /tmp/foo/bar/baz exists, huzzah!
+
+methods
+=======
+
+var mkdirp = require('mkdirp');
+
+mkdirp(dir, mode, cb)
+---------------------
+
+Create a new directory and any necessary subdirectories at `dir` with octal
+permission string `mode`.
+
+If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
+
+`cb(err, made)` fires with the error or the first directory `made`
+that had to be created, if any.
+
+mkdirp.sync(dir, mode)
+----------------------
+
+Synchronously create a new directory and any necessary subdirectories at `dir`
+with octal permission string `mode`.
+
+If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
+
+Returns the first directory that had to be created, if any.
+
+install
+=======
+
+With [npm](http://npmjs.org) do:
+
+    npm install mkdirp
+
+license
+=======
+
+MIT/X11
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/examples/pow.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/examples/pow.js
new file mode 100755 (executable)
index 0000000..e692421
--- /dev/null
@@ -0,0 +1,6 @@
+var mkdirp = require('mkdirp');
+
+mkdirp('/tmp/foo/bar/baz', function (err) {
+    if (err) console.error(err)
+    else console.log('pow!')
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/index.js
new file mode 100755 (executable)
index 0000000..fda6de8
--- /dev/null
@@ -0,0 +1,82 @@
+var path = require('path');
+var fs = require('fs');
+
+module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
+
+function mkdirP (p, mode, f, made) {
+    if (typeof mode === 'function' || mode === undefined) {
+        f = mode;
+        mode = 0777 & (~process.umask());
+    }
+    if (!made) made = null;
+
+    var cb = f || function () {};
+    if (typeof mode === 'string') mode = parseInt(mode, 8);
+    p = path.resolve(p);
+
+    fs.mkdir(p, mode, function (er) {
+        if (!er) {
+            made = made || p;
+            return cb(null, made);
+        }
+        switch (er.code) {
+            case 'ENOENT':
+                mkdirP(path.dirname(p), mode, function (er, made) {
+                    if (er) cb(er, made);
+                    else mkdirP(p, mode, cb, made);
+                });
+                break;
+
+            // In the case of any other error, just see if there's a dir
+            // there already.  If so, then hooray!  If not, then something
+            // is borked.
+            default:
+                fs.stat(p, function (er2, stat) {
+                    // if the stat fails, then that's super weird.
+                    // let the original error be the failure reason.
+                    if (er2 || !stat.isDirectory()) cb(er, made)
+                    else cb(null, made);
+                });
+                break;
+        }
+    });
+}
+
+mkdirP.sync = function sync (p, mode, made) {
+    if (mode === undefined) {
+        mode = 0777 & (~process.umask());
+    }
+    if (!made) made = null;
+
+    if (typeof mode === 'string') mode = parseInt(mode, 8);
+    p = path.resolve(p);
+
+    try {
+        fs.mkdirSync(p, mode);
+        made = made || p;
+    }
+    catch (err0) {
+        switch (err0.code) {
+            case 'ENOENT' :
+                made = sync(path.dirname(p), mode, made);
+                sync(p, mode, made);
+                break;
+
+            // In the case of any other error, just see if there's a dir
+            // there already.  If so, then hooray!  If not, then something
+            // is borked.
+            default:
+                var stat;
+                try {
+                    stat = fs.statSync(p);
+                }
+                catch (err1) {
+                    throw err0;
+                }
+                if (!stat.isDirectory()) throw err0;
+                break;
+        }
+    }
+
+    return made;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/package.json
new file mode 100755 (executable)
index 0000000..3a9dcca
--- /dev/null
@@ -0,0 +1,49 @@
+{
+  "name": "mkdirp",
+  "description": "Recursively mkdir, like `mkdir -p`",
+  "version": "0.3.4",
+  "author": {
+    "name": "James Halliday",
+    "email": "mail@substack.net",
+    "url": "http://substack.net"
+  },
+  "main": "./index",
+  "keywords": [
+    "mkdir",
+    "directory"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/substack/node-mkdirp.git"
+  },
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "devDependencies": {
+    "tap": "~0.2.4"
+  },
+  "license": "MIT/X11",
+  "engines": {
+    "node": "*"
+  },
+  "_id": "mkdirp@0.3.4",
+  "dist": {
+    "shasum": "f8c81d213b7299a031f193a57d752a17d2f6c7d8",
+    "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.4.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "substack",
+      "email": "mail@substack.net"
+    }
+  ],
+  "directories": {},
+  "_shasum": "f8c81d213b7299a031f193a57d752a17d2f6c7d8",
+  "_from": "mkdirp@0.3.4",
+  "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.4.tgz",
+  "bugs": {
+    "url": "https://github.com/substack/node-mkdirp/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/substack/node-mkdirp"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/chmod.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/chmod.js
new file mode 100755 (executable)
index 0000000..520dcb8
--- /dev/null
@@ -0,0 +1,38 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    ps.push(dir);
+}
+
+var file = ps.join('/');
+
+test('chmod-pre', function (t) {
+    var mode = 0744
+    mkdirp(file, mode, function (er) {
+        t.ifError(er, 'should not error');
+        fs.stat(file, function (er, stat) {
+            t.ifError(er, 'should exist');
+            t.ok(stat && stat.isDirectory(), 'should be directory');
+            t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
+            t.end();
+        });
+    });
+});
+
+test('chmod', function (t) {
+    var mode = 0755
+    mkdirp(file, mode, function (er) {
+        t.ifError(er, 'should not error');
+        fs.stat(file, function (er, stat) {
+            t.ifError(er, 'should exist');
+            t.ok(stat && stat.isDirectory(), 'should be directory');
+            t.end();
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/clobber.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/clobber.js
new file mode 100755 (executable)
index 0000000..0eb7099
--- /dev/null
@@ -0,0 +1,37 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    ps.push(dir);
+}
+
+var file = ps.join('/');
+
+// a file in the way
+var itw = ps.slice(0, 3).join('/');
+
+
+test('clobber-pre', function (t) {
+    console.error("about to write to "+itw)
+    fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
+
+    fs.stat(itw, function (er, stat) {
+        t.ifError(er)
+        t.ok(stat && stat.isFile(), 'should be file')
+        t.end()
+    })
+})
+
+test('clobber', function (t) {
+    t.plan(2);
+    mkdirp(file, 0755, function (err) {
+        t.ok(err);
+        t.equal(err.code, 'ENOTDIR');
+        t.end();
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/mkdirp.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/mkdirp.js
new file mode 100755 (executable)
index 0000000..b07cd70
--- /dev/null
@@ -0,0 +1,28 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('woo', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/tmp/' + [x,y,z].join('/');
+    
+    mkdirp(file, 0755, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/perm.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/perm.js
new file mode 100755 (executable)
index 0000000..23a7abb
--- /dev/null
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('async perm', function (t) {
+    t.plan(2);
+    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
+    
+    mkdirp(file, 0755, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
+
+test('async root perm', function (t) {
+    mkdirp('/tmp', 0755, function (err) {
+        if (err) t.fail(err);
+        t.end();
+    });
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js
new file mode 100755 (executable)
index 0000000..f685f60
--- /dev/null
@@ -0,0 +1,39 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('sync perm', function (t) {
+    t.plan(2);
+    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
+    
+    mkdirp.sync(file, 0755);
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        })
+    });
+});
+
+test('sync root perm', function (t) {
+    t.plan(1);
+    
+    var file = '/tmp';
+    mkdirp.sync(file, 0755);
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/race.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/race.js
new file mode 100755 (executable)
index 0000000..96a0447
--- /dev/null
@@ -0,0 +1,41 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('race', function (t) {
+    t.plan(4);
+    var ps = [ '', 'tmp' ];
+    
+    for (var i = 0; i < 25; i++) {
+        var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+        ps.push(dir);
+    }
+    var file = ps.join('/');
+    
+    var res = 2;
+    mk(file, function () {
+        if (--res === 0) t.end();
+    });
+    
+    mk(file, function () {
+        if (--res === 0) t.end();
+    });
+    
+    function mk (file, cb) {
+        mkdirp(file, 0755, function (err) {
+            if (err) t.fail(err);
+            else path.exists(file, function (ex) {
+                if (!ex) t.fail('file not created')
+                else fs.stat(file, function (err, stat) {
+                    if (err) t.fail(err)
+                    else {
+                        t.equal(stat.mode & 0777, 0755);
+                        t.ok(stat.isDirectory(), 'target not a directory');
+                        if (cb) cb();
+                    }
+                })
+            })
+        });
+    }
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/rel.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/rel.js
new file mode 100755 (executable)
index 0000000..7985824
--- /dev/null
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('rel', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var cwd = process.cwd();
+    process.chdir('/tmp');
+    
+    var file = [x,y,z].join('/');
+    
+    mkdirp(file, 0755, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    process.chdir(cwd);
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/return.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/return.js
new file mode 100755 (executable)
index 0000000..bce68e5
--- /dev/null
@@ -0,0 +1,25 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('return value', function (t) {
+    t.plan(4);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    // should return the first dir created.
+    // By this point, it would be profoundly surprising if /tmp didn't
+    // already exist, since every other test makes things in there.
+    mkdirp(file, function (err, made) {
+        t.ifError(err);
+        t.equal(made, '/tmp/' + x);
+        mkdirp(file, function (err, made) {
+          t.ifError(err);
+          t.equal(made, null);
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/return_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/return_sync.js
new file mode 100755 (executable)
index 0000000..7c222d3
--- /dev/null
@@ -0,0 +1,24 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('return value', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    // should return the first dir created.
+    // By this point, it would be profoundly surprising if /tmp didn't
+    // already exist, since every other test makes things in there.
+    // Note that this will throw on failure, which will fail the test.
+    var made = mkdirp.sync(file);
+    t.equal(made, '/tmp/' + x);
+
+    // making the same file again should have no effect.
+    made = mkdirp.sync(file);
+    t.equal(made, null);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/root.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/root.js
new file mode 100755 (executable)
index 0000000..97ad7a2
--- /dev/null
@@ -0,0 +1,18 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('root', function (t) {
+    // '/' on unix, 'c:/' on windows.
+    var file = path.resolve('/');
+
+    mkdirp(file, 0755, function (err) {
+        if (err) throw err
+        fs.stat(file, function (er, stat) {
+            if (er) throw er
+            t.ok(stat.isDirectory(), 'target is a directory');
+            t.end();
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/sync.js
new file mode 100755 (executable)
index 0000000..7530cad
--- /dev/null
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('sync', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    try {
+        mkdirp.sync(file, 0755);
+    } catch (err) {
+        t.fail(err);
+        return t.end();
+    }
+
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/umask.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/umask.js
new file mode 100755 (executable)
index 0000000..64ccafe
--- /dev/null
@@ -0,0 +1,28 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('implicit mode from umask', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/tmp/' + [x,y,z].join('/');
+    
+    mkdirp(file, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    t.equal(stat.mode & 0777, 0777 & (~process.umask()));
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js
new file mode 100755 (executable)
index 0000000..35bd5cb
--- /dev/null
@@ -0,0 +1,32 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('umask sync modes', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    try {
+        mkdirp.sync(file);
+    } catch (err) {
+        t.fail(err);
+        return t.end();
+    }
+
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.equal(stat.mode & 0777, (0777 & (~process.umask())));
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/Readme.md
new file mode 100755 (executable)
index 0000000..27e54a4
--- /dev/null
@@ -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 &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/index.js
new file mode 100755 (executable)
index 0000000..8480bf6
--- /dev/null
@@ -0,0 +1,377 @@
+/**
+ * Object#toString() ref for stringify().
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Object#hasOwnProperty ref
+ */
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Array#indexOf shim.
+ */
+
+var indexOf = typeof Array.prototype.indexOf === 'function'
+  ? function(arr, el) { return arr.indexOf(el); }
+  : function(arr, el) {
+      for (var i = 0; i < arr.length; i++) {
+        if (arr[i] === el) return i;
+      }
+      return -1;
+    };
+
+/**
+ * Array.isArray shim.
+ */
+
+var isArray = Array.isArray || function(arr) {
+  return toString.call(arr) == '[object Array]';
+};
+
+/**
+ * Object.keys shim.
+ */
+
+var objectKeys = Object.keys || function(obj) {
+  var ret = [];
+  for (var key in obj) ret.push(key);
+  return ret;
+};
+
+/**
+ * Array#forEach shim.
+ */
+
+var forEach = typeof Array.prototype.forEach === 'function'
+  ? function(arr, fn) { return arr.forEach(fn); }
+  : function(arr, fn) {
+      for (var i = 0; i < arr.length; i++) fn(arr[i]);
+    };
+
+/**
+ * Array#reduce shim.
+ */
+
+var reduce = function(arr, fn, initial) {
+  if (typeof arr.reduce === 'function') return arr.reduce(fn, initial);
+  var res = initial;
+  for (var i = 0; i < arr.length; i++) res = fn(res, arr[i]);
+  return res;
+};
+
+/**
+ * Create a nullary object if possible
+ */
+
+function createObject() {
+  return Object.create
+    ? Object.create(null)
+    : {};
+}
+
+/**
+ * Cache non-integer test regexp.
+ */
+
+var isint = /^[0-9]+$/;
+
+function promote(parent, key) {
+  if (parent[key].length == 0) return parent[key] = createObject();
+  var t = createObject();
+  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 (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 (isArray(obj)) {
+        if ('' != val) obj.push(val);
+      } else if ('object' == typeof obj) {
+        obj[objectKeys(obj).length] = val;
+      } else {
+        obj = parent[key] = [parent[key], val];
+      }
+      // prop
+    } else if (~indexOf(part, ']')) {
+      part = part.substr(0, part.length - 1);
+      if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
+      parse(parts, obj, part, val);
+      // key
+    } else {
+      if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
+      parse(parts, obj, part, val);
+    }
+  }
+}
+
+/**
+ * Merge parent key/val pair.
+ */
+
+function merge(parent, key, val){
+  if (~indexOf(key, ']')) {
+    var parts = key.split('[')
+      , len = parts.length
+      , last = len - 1;
+    parse(parts, parent, 'base', val);
+    // optimize
+  } else {
+    if (!isint.test(key) && isArray(parent.base)) {
+      var t = createObject();
+      for (var k in parent.base) t[k] = parent.base[k];
+      parent.base = t;
+    }
+    set(parent.base, key, val);
+  }
+
+  return parent;
+}
+
+/**
+ * Compact sparse arrays.
+ */
+
+function compact(obj) {
+  if ('object' != typeof obj) return obj;
+
+  if (isArray(obj)) {
+    var ret = [];
+    for (var i in obj) ret.push(obj[i]);
+    return ret;
+  }
+
+  for (var key in obj) {
+    obj[key] = compact(obj[key]);
+  }
+
+  return obj;
+}
+
+/**
+ * Restore Object.prototype.
+ * see pull-request #58
+ */
+
+function restoreProto(obj) {
+  if (!Object.create) return obj;
+  if (isArray(obj)) return obj;
+  if (obj && 'object' != typeof obj) return obj;
+
+  for (var key in obj) {
+    if (hasOwnProperty.call(obj, key)) {
+      obj[key] = restoreProto(obj[key]);
+    }
+  }
+
+  obj.__proto__ = Object.prototype;
+  return obj;
+}
+
+/**
+ * Parse the given obj.
+ */
+
+function parseObject(obj){
+  var ret = { base: {} };
+
+  forEach(objectKeys(obj), function(name){
+    merge(ret, name, obj[name]);
+  });
+
+  return compact(ret.base);
+}
+
+/**
+ * Parse the given str.
+ */
+
+function parseString(str){
+  var ret = reduce(String(str).split('&'), function(ret, pair){
+    var eql = indexOf(pair, '=')
+      , brace = lastBraceInKey(pair)
+      , key = pair.substr(0, brace || eql)
+      , val = pair.substr(brace || eql, pair.length)
+      , val = val.substr(indexOf(val, '=') + 1, val.length);
+
+    // ?foo
+    if ('' == key) key = pair, val = '';
+    if ('' == key) return ret;
+
+    return merge(ret, decode(key), decode(val));
+  }, { base: createObject() }).base;
+
+  return restoreProto(compact(ret));
+}
+
+/**
+ * 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 (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 + '=' + encodeURIComponent(String(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 = objectKeys(obj)
+    , key;
+
+  for (var i = 0, len = keys.length; i < len; ++i) {
+    key = keys[i];
+    if ('' == key) continue;
+    if (null == obj[key]) {
+      ret.push(encodeURIComponent(key) + '=');
+    } else {
+      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 (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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/qs/package.json
new file mode 100755 (executable)
index 0000000..c79d02d
--- /dev/null
@@ -0,0 +1,55 @@
+{
+  "name": "qs",
+  "description": "querystring parser",
+  "version": "0.6.4",
+  "keywords": [
+    "query string",
+    "parser",
+    "component"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/visionmedia/node-querystring.git"
+  },
+  "devDependencies": {
+    "mocha": "*",
+    "expect.js": "*"
+  },
+  "scripts": {
+    "test": "make test"
+  },
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca",
+    "url": "http://tjholowaychuk.com"
+  },
+  "main": "index",
+  "engines": {
+    "node": "*"
+  },
+  "_id": "qs@0.6.4",
+  "dist": {
+    "shasum": "8d17ddcfc864ace3f03477382126740ef25b234f",
+    "tarball": "http://registry.npmjs.org/qs/-/qs-0.6.4.tgz"
+  },
+  "_from": "qs@0.6.4",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "8d17ddcfc864ace3f03477382126740ef25b234f",
+  "_resolved": "https://registry.npmjs.org/qs/-/qs-0.6.4.tgz",
+  "bugs": {
+    "url": "https://github.com/visionmedia/node-querystring/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/visionmedia/node-querystring"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/History.md
new file mode 100755 (executable)
index 0000000..82df7b1
--- /dev/null
@@ -0,0 +1,15 @@
+
+0.0.4 / 2012-06-17 
+==================
+
+  * changed: ret -1 for unsatisfiable and -2 when invalid
+
+0.0.3 / 2012-06-17 
+==================
+
+  * fix last-byte-pos default to len - 1
+
+0.0.2 / 2012-06-14 
+==================
+
+  * add `.type`
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/Makefile
new file mode 100755 (executable)
index 0000000..8e8640f
--- /dev/null
@@ -0,0 +1,7 @@
+
+test:
+       @./node_modules/.bin/mocha \
+               --reporter spec \
+               --require should
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/Readme.md
new file mode 100755 (executable)
index 0000000..b2a67fe
--- /dev/null
@@ -0,0 +1,28 @@
+
+# node-range-parser
+
+  Range header field parser.
+
+## Example:
+
+```js
+assert(-1 == parse(200, 'bytes=500-20'));
+assert(-2 == parse(200, 'bytes=malformed'));
+parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));
+parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));
+parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));
+parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));
+parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));
+parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));
+parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));
+parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));
+parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));
+parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));
+parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));
+```
+
+## Installation
+
+```
+$ npm install range-parser
+```
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/index.js
new file mode 100755 (executable)
index 0000000..9b0f7a8
--- /dev/null
@@ -0,0 +1,49 @@
+
+/**
+ * Parse "Range" header `str` relative to the given file `size`.
+ *
+ * @param {Number} size
+ * @param {String} str
+ * @return {Array}
+ * @api public
+ */
+
+module.exports = function(size, str){
+  var valid = true;
+  var i = str.indexOf('=');
+
+  if (-1 == i) return -2;
+
+  var arr = str.slice(i + 1).split(',').map(function(range){
+    var range = range.split('-')
+      , start = parseInt(range[0], 10)
+      , end = parseInt(range[1], 10);
+
+    // -nnn
+    if (isNaN(start)) {
+      start = size - end;
+      end = size - 1;
+    // nnn-
+    } else if (isNaN(end)) {
+      end = size - 1;
+    }
+
+    // limit last-byte-pos to current length
+    if (end > size - 1) end = size - 1;
+
+    // invalid
+    if (isNaN(start)
+      || isNaN(end)
+      || start > end
+      || start < 0) valid = false;
+
+    return {
+      start: start,
+      end: end
+    };
+  });
+
+  arr.type = str.slice(0, i);
+
+  return valid ? arr : -1;
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/range-parser/package.json
new file mode 100755 (executable)
index 0000000..f1aa52c
--- /dev/null
@@ -0,0 +1,44 @@
+{
+  "name": "range-parser",
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca",
+    "url": "http://tjholowaychuk.com"
+  },
+  "description": "Range header field string parser",
+  "version": "0.0.4",
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*"
+  },
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "_id": "range-parser@0.0.4",
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.1.19",
+  "_nodeVersion": "v0.6.16",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "c0427ffef51c10acba0782a46c9602e744ff620b",
+    "tarball": "http://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "c0427ffef51c10acba0782a46c9602e744ff620b",
+  "_from": "range-parser@0.0.4",
+  "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/History.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/History.md
new file mode 100755 (executable)
index 0000000..20c5319
--- /dev/null
@@ -0,0 +1,25 @@
+
+0.1.0 / 2012-08-25 
+==================
+
+  * add options parameter to send() that is passed to fs.createReadStream() [kanongil]
+
+0.0.4 / 2012-08-16 
+==================
+
+  * allow custom "Accept-Ranges" definition
+
+0.0.3 / 2012-07-16 
+==================
+
+  * fix normalization of the root directory. Closes #3
+
+0.0.2 / 2012-07-09 
+==================
+
+  * add passing of req explicitly for now (YUCK)
+
+0.0.1 / 2010-01-03
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/Makefile
new file mode 100755 (executable)
index 0000000..a9dcfd5
--- /dev/null
@@ -0,0 +1,8 @@
+
+test:
+       @./node_modules/.bin/mocha \
+               --require should \
+               --reporter spec \
+               --bail
+
+.PHONY: test
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/Readme.md
new file mode 100755 (executable)
index 0000000..85171a9
--- /dev/null
@@ -0,0 +1,123 @@
+
+# send
+
+  Send is Connect's `static()` extracted for generalized use, a streaming static file
+  server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.
+
+## Installation
+
+    $ npm install send
+
+## Examples
+
+  Small:
+
+```js
+var http = require('http');
+var send = require('send');
+
+var app = http.createServer(function(req, res){
+  send(req, req.url).pipe(res);
+});
+```
+
+  Serving from a root directory with custom error-handling:
+
+```js
+var http = require('http');
+var send = require('send');
+
+var app = http.createServer(function(req, res){
+  // your custom error-handling logic:
+  function error(err) {
+    res.statusCode = err.status || 500;
+    res.end(err.message);
+  }
+
+  // your custom directory handling logic:
+  function redirect() {
+    res.statusCode = 301;
+    res.setHeader('Location', req.url + '/');
+    res.end('Redirecting to ' + req.url + '/');
+  }
+
+  // transfer arbitrary files from within
+  // /www/example.com/public/*
+  send(req, url.parse(req.url).pathname)
+  .root('/www/example.com/public')
+  .on('error', error)
+  .on('directory', redirect)
+  .pipe(res);
+});
+```
+
+## API
+
+### Events
+
+  - `error` an error occurred `(err)`
+  - `directory` a directory was requested
+  - `stream` file streaming has started `(stream)`
+  - `end` streaming has completed
+
+### .root(dir)
+
+  Serve files relative to `path`. Aliased as `.from(dir)`.
+
+### .index(path)
+
+  By default send supports "index.html" files, to disable this
+  invoke `.index(false)` or to supply a new index pass a string.
+
+### .maxage(ms)
+
+  Provide a max-age in milliseconds for http caching, defaults to 0.
+
+## Error-handling
+
+  By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc.
+
+## Caching
+
+  It does _not_ perform internal caching, you should use a reverse proxy cache such
+  as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;).
+
+## Debugging
+
+ To enable `debug()` instrumentation output export __DEBUG__:
+
+```
+$ DEBUG=send node app
+```
+
+## Running tests
+
+```
+$ npm install
+$ make test
+```
+
+## License 
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/index.js
new file mode 100755 (executable)
index 0000000..f17158d
--- /dev/null
@@ -0,0 +1,2 @@
+
+module.exports = require('./lib/send');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/lib/send.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/lib/send.js
new file mode 100755 (executable)
index 0000000..de72146
--- /dev/null
@@ -0,0 +1,473 @@
+
+/**
+ * Module dependencies.
+ */
+
+var debug = require('debug')('send')
+  , parseRange = require('range-parser')
+  , Stream = require('stream')
+  , mime = require('mime')
+  , fresh = require('fresh')
+  , path = require('path')
+  , http = require('http')
+  , fs = require('fs')
+  , basename = path.basename
+  , normalize = path.normalize
+  , join = path.join
+  , utils = require('./utils');
+
+/**
+ * Expose `send`.
+ */
+
+exports = module.exports = send;
+
+/**
+ * Expose mime module.
+ */
+
+exports.mime = mime;
+
+/**
+ * Return a `SendStream` for `req` and `path`.
+ *
+ * @param {Request} req
+ * @param {String} path
+ * @param {Object} options
+ * @return {SendStream}
+ * @api public
+ */
+
+function send(req, path, options) {
+  return new SendStream(req, path, options);
+}
+
+/**
+ * Initialize a `SendStream` with the given `path`.
+ *
+ * Events:
+ *
+ *  - `error` an error occurred
+ *  - `stream` file streaming has started
+ *  - `end` streaming has completed
+ *  - `directory` a directory was requested
+ *
+ * @param {Request} req
+ * @param {String} path
+ * @param {Object} options
+ * @api private
+ */
+
+function SendStream(req, path, options) {
+  var self = this;
+  this.req = req;
+  this.path = path;
+  this.options = options || {};
+  this.maxage(0);
+  this.hidden(false);
+  this.index('index.html');
+}
+
+/**
+ * Inherits from `Stream.prototype`.
+ */
+
+SendStream.prototype.__proto__ = Stream.prototype;
+
+/**
+ * Enable or disable "hidden" (dot) files.
+ *
+ * @param {Boolean} path
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.hidden = function(val){
+  debug('hidden %s', val);
+  this._hidden = val;
+  return this;
+};
+
+/**
+ * Set index `path`, set to a falsy
+ * value to disable index support.
+ *
+ * @param {String|Boolean} path
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.index = function(path){
+  debug('index %s', path);
+  this._index = path;
+  return this;
+};
+
+/**
+ * Set root `path`.
+ *
+ * @param {String} path
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.root = 
+SendStream.prototype.from = function(path){
+  this._root = normalize(path);
+  return this;
+};
+
+/**
+ * Set max-age to `ms`.
+ *
+ * @param {Number} ms
+ * @return {SendStream}
+ * @api public
+ */
+
+SendStream.prototype.maxage = function(ms){
+  if (Infinity == ms) ms = 60 * 60 * 24 * 365 * 1000;
+  debug('max-age %d', ms);
+  this._maxage = ms;
+  return this;
+};
+
+/**
+ * Emit error with `status`.
+ *
+ * @param {Number} status
+ * @api private
+ */
+
+SendStream.prototype.error = function(status, err){
+  var res = this.res;
+  var msg = http.STATUS_CODES[status];
+  err = err || new Error(msg);
+  err.status = status;
+  if (this.listeners('error').length) return this.emit('error', err);
+  res.statusCode = err.status;
+  res.end(msg);
+};
+
+/**
+ * Check if the pathname is potentially malicious.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isMalicious = function(){
+  return !this._root && ~this.path.indexOf('..');
+};
+
+/**
+ * Check if the pathname ends with "/".
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.hasTrailingSlash = function(){
+  return '/' == this.path[this.path.length - 1];
+};
+
+/**
+ * Check if the basename leads with ".".
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.hasLeadingDot = function(){
+  return '.' == basename(this.path)[0];
+};
+
+/**
+ * Check if this is a conditional GET request.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isConditionalGET = function(){
+  return this.req.headers['if-none-match']
+    || this.req.headers['if-modified-since'];
+};
+
+/**
+ * Strip content-* header fields.
+ *
+ * @api private
+ */
+
+SendStream.prototype.removeContentHeaderFields = function(){
+  var res = this.res;
+  Object.keys(res._headers).forEach(function(field){
+    if (0 == field.indexOf('content')) {
+      res.removeHeader(field);
+    }
+  });
+};
+
+/**
+ * Respond with 304 not modified.
+ *
+ * @api private
+ */
+
+SendStream.prototype.notModified = function(){
+  var res = this.res;
+  debug('not modified');
+  this.removeContentHeaderFields();
+  res.statusCode = 304;
+  res.end();
+};
+
+/**
+ * Check if the request is cacheable, aka
+ * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isCachable = function(){
+  var res = this.res;
+  return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode;
+};
+
+/**
+ * Handle stat() error.
+ *
+ * @param {Error} err
+ * @api private
+ */
+
+SendStream.prototype.onStatError = function(err){
+  var notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR'];
+  if (~notfound.indexOf(err.code)) return this.error(404, err);
+  this.error(500, err);
+};
+
+/**
+ * Check if the cache is fresh.
+ *
+ * @return {Boolean}
+ * @api private
+ */
+
+SendStream.prototype.isFresh = function(){
+  return fresh(this.req.headers, this.res._headers);
+};
+
+/**
+ * Redirect to `path`.
+ *
+ * @param {String} path
+ * @api private
+ */
+
+SendStream.prototype.redirect = function(path){
+  if (this.listeners('directory').length) return this.emit('directory');
+  var res = this.res;
+  path += '/';
+  res.statusCode = 301;
+  res.setHeader('Location', path);
+  res.end('Redirecting to ' + utils.escape(path));
+};
+
+/**
+ * Pipe to `res.
+ *
+ * @param {Stream} res
+ * @return {Stream} res
+ * @api public
+ */
+
+SendStream.prototype.pipe = function(res){
+  var self = this
+    , args = arguments
+    , path = this.path
+    , root = this._root;
+
+  // references
+  this.res = res;
+
+  // invalid request uri
+  path = utils.decode(path);
+  if (-1 == path) return this.error(400);
+
+  // null byte(s)
+  if (~path.indexOf('\0')) return this.error(400);
+
+  // join / normalize from optional root dir
+  if (root) path = normalize(join(this._root, path));
+
+  // ".." is malicious without "root"
+  if (this.isMalicious()) return this.error(403);
+
+  // malicious path
+  if (root && 0 != path.indexOf(root)) return this.error(403);
+
+  // hidden file support
+  if (!this._hidden && this.hasLeadingDot()) return this.error(404);
+
+  // index file support
+  if (this._index && this.hasTrailingSlash()) path += this._index;
+
+  debug('stat "%s"', path);
+  fs.stat(path, function(err, stat){
+    if (err) return self.onStatError(err);
+    if (stat.isDirectory()) return self.redirect(self.path);
+    self.send(path, stat);
+  });
+
+  return res;
+};
+
+/**
+ * Transfer `path`.
+ *
+ * @param {String} path
+ * @api public
+ */
+
+SendStream.prototype.send = function(path, stat){
+  var options = this.options;
+  var len = stat.size;
+  var res = this.res;
+  var req = this.req;
+  var ranges = req.headers.range;
+  var offset = options.start || 0;
+
+  // set header fields
+  this.setHeader(stat);
+
+  // set content-type
+  this.type(path);
+
+  // conditional GET support
+  if (this.isConditionalGET()
+    && this.isCachable()
+    && this.isFresh()) {
+    return this.notModified();
+  }
+
+  // adjust len to start/end options
+  len = Math.max(0, len - offset);
+  if (options.end !== undefined) {
+    var bytes = options.end - offset + 1;
+    if (len > bytes) len = bytes;
+  }
+
+  // Range support
+  if (ranges) {
+    ranges = parseRange(len, ranges);
+
+    // unsatisfiable
+    if (-1 == ranges) {
+      res.setHeader('Content-Range', 'bytes */' + stat.size);
+      return this.error(416);
+    }
+
+    // valid (syntactically invalid ranges are treated as a regular response)
+    if (-2 != ranges) {
+      options.start = offset + ranges[0].start;
+      options.end = offset + ranges[0].end;
+
+      // Content-Range
+      res.statusCode = 206;
+      res.setHeader('Content-Range', 'bytes '
+        + ranges[0].start
+        + '-'
+        + ranges[0].end
+        + '/'
+        + len);
+      len = options.end - options.start + 1;
+    }
+  }
+
+  // content-length
+  res.setHeader('Content-Length', len);
+
+  // HEAD support
+  if ('HEAD' == req.method) return res.end();
+
+  this.stream(path, options);
+};
+
+/**
+ * Stream `path` to the response.
+ *
+ * @param {String} path
+ * @param {Object} options
+ * @api private
+ */
+
+SendStream.prototype.stream = function(path, options){
+  // TODO: this is all lame, refactor meeee
+  var self = this;
+  var res = this.res;
+  var req = this.req;
+
+  // pipe
+  var stream = fs.createReadStream(path, options);
+  this.emit('stream', stream);
+  stream.pipe(res);
+
+  // socket closed, done with the fd
+  req.on('close', stream.destroy.bind(stream));
+
+  // error handling code-smell
+  stream.on('error', function(err){
+    // no hope in responding
+    if (res._header) {
+      console.error(err.stack);
+      req.destroy();
+      return;
+    }
+
+    // 500
+    err.status = 500;
+    self.emit('error', err);
+  });
+
+  // end
+  stream.on('end', function(){
+    self.emit('end');
+  });
+};
+
+/**
+ * Set content-type based on `path`
+ * if it hasn't been explicitly set.
+ *
+ * @param {String} path
+ * @api private
+ */
+
+SendStream.prototype.type = function(path){
+  var res = this.res;
+  if (res.getHeader('Content-Type')) return;
+  var type = mime.lookup(path);
+  var charset = mime.charsets.lookup(type);
+  debug('content-type %s', type);
+  res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
+};
+
+/**
+ * Set reaponse header fields, most
+ * fields may be pre-defined.
+ *
+ * @param {Object} stat
+ * @api private
+ */
+
+SendStream.prototype.setHeader = function(stat){
+  var res = this.res;
+  if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes');
+  if (!res.getHeader('ETag')) res.setHeader('ETag', utils.etag(stat));
+  if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString());
+  if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (this._maxage / 1000));
+  if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString());
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/lib/utils.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/lib/utils.js
new file mode 100755 (executable)
index 0000000..950e5a2
--- /dev/null
@@ -0,0 +1,47 @@
+
+/**
+ * Return an ETag in the form of `"<size>-<mtime>"`
+ * from the given `stat`.
+ *
+ * @param {Object} stat
+ * @return {String}
+ * @api private
+ */
+
+exports.etag = function(stat) {
+  return '"' + stat.size + '-' + Number(stat.mtime) + '"';
+};
+
+/**
+ * decodeURIComponent.
+ *
+ * Allows V8 to only deoptimize this fn instead of all
+ * of send().
+ *
+ * @param {String} path
+ * @api private
+ */
+
+exports.decode = function(path){
+  try {
+    return decodeURIComponent(path);
+  } catch (err) {
+    return -1;
+  }
+};
+
+/**
+ * Escape the given string of `html`.
+ *
+ * @param {String} html
+ * @return {String}
+ * @api private
+ */
+
+exports.escape = function(html){
+  return String(html)
+    .replace(/&(?!\w+;)/g, '&amp;')
+    .replace(/</g, '&lt;')
+    .replace(/>/g, '&gt;')
+    .replace(/"/g, '&quot;');
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/LICENSE
new file mode 100755 (executable)
index 0000000..451fc45
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/README.md
new file mode 100755 (executable)
index 0000000..d8b66a8
--- /dev/null
@@ -0,0 +1,63 @@
+# mime
+
+Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.
+
+## Install
+
+Install with [npm](http://github.com/isaacs/npm):
+
+    npm install mime
+
+## API - Queries
+
+### mime.lookup(path)
+Get the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.').  E.g.
+
+    var mime = require('mime');
+
+    mime.lookup('/path/to/file.txt');         // => 'text/plain'
+    mime.lookup('file.txt');                  // => 'text/plain'
+    mime.lookup('.TXT');                      // => 'text/plain'
+    mime.lookup('htm');                       // => 'text/html'
+
+### mime.extension(type)
+Get the default extension for `type`
+
+    mime.extension('text/html');                 // => 'html'
+    mime.extension('application/octet-stream');  // => 'bin'
+
+### mime.charsets.lookup()
+
+Map mime-type to charset
+
+    mime.charsets.lookup('text/plain');        // => 'UTF-8'
+
+(The logic for charset lookups is pretty rudimentary.  Feel free to suggest improvements.)
+
+## API - Defining Custom Types
+
+The following APIs allow you to add your own type mappings within your project.  If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types).
+
+### mime.define()
+
+Add custom mime/extension mappings
+
+    mime.define({
+        'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
+        'application/x-my-type': ['x-mt', 'x-mtt'],
+        // etc ...
+    });
+
+    mime.lookup('x-sft');                 // => 'text/x-some-format'
+
+The first entry in the extensions array is returned by `mime.extension()`. E.g.
+
+    mime.extension('text/x-some-format'); // => 'x-sf'
+
+### mime.load(filepath)
+
+Load mappings from an Apache ".types" format file
+
+    mime.load('./my_project.types');
+
+The .types file format is simple -  See the `types` dir for examples.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/mime.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/mime.js
new file mode 100755 (executable)
index 0000000..1e00585
--- /dev/null
@@ -0,0 +1,104 @@
+var path = require('path');
+var fs = require('fs');
+
+function Mime() {
+  // Map of extension -> mime type
+  this.types = Object.create(null);
+
+  // Map of mime type -> extension
+  this.extensions = Object.create(null);
+}
+
+/**
+ * Define mimetype -> extension mappings.  Each key is a mime-type that maps
+ * to an array of extensions associated with the type.  The first extension is
+ * used as the default extension for the type.
+ *
+ * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
+ *
+ * @param map (Object) type definitions
+ */
+Mime.prototype.define = function (map) {
+  for (var type in map) {
+    var exts = map[type];
+
+    for (var i = 0; i < exts.length; i++) {
+      this.types[exts[i]] = type;
+    }
+
+    // Default extension is the first one we encounter
+    if (!this.extensions[type]) {
+      this.extensions[type] = exts[0];
+    }
+  }
+};
+
+/**
+ * Load an Apache2-style ".types" file
+ *
+ * This may be called multiple times (it's expected).  Where files declare
+ * overlapping types/extensions, the last file wins.
+ *
+ * @param file (String) path of file to load.
+ */
+Mime.prototype.load = function(file) {
+  // Read file and split into lines
+  var map = {},
+      content = fs.readFileSync(file, 'ascii'),
+      lines = content.split(/[\r\n]+/);
+
+  lines.forEach(function(line) {
+    // Clean up whitespace/comments, and split into fields
+    var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
+    map[fields.shift()] = fields;
+  });
+
+  this.define(map);
+};
+
+/**
+ * Lookup a mime type based on extension
+ */
+Mime.prototype.lookup = function(path, fallback) {
+  var ext = path.replace(/.*[\.\/]/, '').toLowerCase();
+
+  return this.types[ext] || fallback || this.default_type;
+};
+
+/**
+ * Return file extension associated with a mime type
+ */
+Mime.prototype.extension = function(mimeType) {
+  return this.extensions[mimeType];
+};
+
+// Default instance
+var mime = new Mime();
+
+// Load local copy of
+// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+mime.load(path.join(__dirname, 'types/mime.types'));
+
+// Load additional types from node.js community
+mime.load(path.join(__dirname, 'types/node.types'));
+
+// Default type
+mime.default_type = mime.lookup('bin');
+
+//
+// Additional API specific to the default instance
+//
+
+mime.Mime = Mime;
+
+/**
+ * Lookup a charset based on mime type.
+ */
+mime.charsets = {
+  lookup: function(mimeType, fallback) {
+    // Assume text types are utf8
+    return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
+  }
+}
+
+module.exports = mime;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/package.json
new file mode 100755 (executable)
index 0000000..67c2f2e
--- /dev/null
@@ -0,0 +1,64 @@
+{
+  "author": {
+    "name": "Robert Kieffer",
+    "email": "robert@broofa.com",
+    "url": "http://github.com/broofa"
+  },
+  "contributors": [
+    {
+      "name": "Benjamin Thomas",
+      "email": "benjamin@benjaminthomas.org",
+      "url": "http://github.com/bentomas"
+    }
+  ],
+  "dependencies": {},
+  "description": "A comprehensive library for mime-type mapping",
+  "devDependencies": {},
+  "keywords": [
+    "util",
+    "mime"
+  ],
+  "main": "mime.js",
+  "name": "mime",
+  "repository": {
+    "url": "git://github.com/broofa/node-mime.git",
+    "type": "git"
+  },
+  "version": "1.2.6",
+  "_npmUser": {
+    "name": "bentomas",
+    "email": "benjamin@benjaminthomas.org"
+  },
+  "_id": "mime@1.2.6",
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.1.12",
+  "_nodeVersion": "v0.6.14",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "b1f86c768c025fa87b48075f1709f28aeaf20365",
+    "tarball": "http://registry.npmjs.org/mime/-/mime-1.2.6.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "broofa",
+      "email": "robert@broofa.com"
+    },
+    {
+      "name": "bentomas",
+      "email": "benjamin@benjaminthomas.org"
+    }
+  ],
+  "directories": {},
+  "_shasum": "b1f86c768c025fa87b48075f1709f28aeaf20365",
+  "_from": "mime@1.2.6",
+  "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.6.tgz",
+  "bugs": {
+    "url": "https://github.com/broofa/node-mime/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/broofa/node-mime"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/test.js
new file mode 100755 (executable)
index 0000000..cbad034
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * Usage: node test.js
+ */
+
+var mime = require('./mime');
+var assert = require('assert');
+
+function eq(a, b) {
+  console.log('Test: ' + a + ' === ' + b);
+  assert.strictEqual.apply(null, arguments);
+}
+
+console.log(Object.keys(mime.extensions).length + ' types');
+console.log(Object.keys(mime.types).length + ' extensions\n');
+
+//
+// Test mime lookups
+//
+
+eq('text/plain', mime.lookup('text.txt'));
+eq('text/plain', mime.lookup('.text.txt'));
+eq('text/plain', mime.lookup('.txt'));
+eq('text/plain', mime.lookup('txt'));
+eq('application/octet-stream', mime.lookup('text.nope'));
+eq('fallback', mime.lookup('text.fallback', 'fallback'));
+eq('application/octet-stream', mime.lookup('constructor'));
+eq('text/plain', mime.lookup('TEXT.TXT'));
+eq('text/event-stream', mime.lookup('text/event-stream'));
+eq('application/x-web-app-manifest+json', mime.lookup('text.webapp'));
+
+//
+// Test extensions
+//
+
+eq('txt', mime.extension(mime.types.text));
+eq('html', mime.extension(mime.types.htm));
+eq('bin', mime.extension('application/octet-stream'));
+eq(undefined, mime.extension('constructor'));
+
+//
+// Test node types
+//
+
+eq('application/octet-stream', mime.lookup('file.buffer'));
+eq('audio/mp4', mime.lookup('file.m4a'));
+
+//
+// Test charsets
+//
+
+eq('UTF-8', mime.charsets.lookup('text/plain'));
+eq(undefined, mime.charsets.lookup(mime.types.js));
+eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
+
+console.log('\nOK');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/types/mime.types b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/types/mime.types
new file mode 100755 (executable)
index 0000000..b3cae2e
--- /dev/null
@@ -0,0 +1,1510 @@
+# This file maps Internet media types to unique file extension(s).
+# Although created for httpd, this file is used by many software systems
+# and has been placed in the public domain for unlimited redisribution.
+#
+# The table below contains both registered and (common) unregistered types.
+# A type that has no unique extension can be ignored -- they are listed
+# here to guide configurations toward known types and to make it easier to
+# identify "new" types.  File extensions are also commonly used to indicate
+# content languages and encodings, so choose them carefully.
+#
+# Internet media types should be registered as described in RFC 4288.
+# The registry is at <http://www.iana.org/assignments/media-types/>.
+#
+# MIME type (lowercased)                       Extensions
+# ============================================ ==========
+# application/1d-interleaved-parityfec
+# application/3gpp-ims+xml
+# application/activemessage
+application/andrew-inset                       ez
+# application/applefile
+application/applixware                         aw
+application/atom+xml                           atom
+application/atomcat+xml                                atomcat
+# application/atomicmail
+application/atomsvc+xml                                atomsvc
+# application/auth-policy+xml
+# application/batch-smtp
+# application/beep+xml
+# application/calendar+xml
+# application/cals-1840
+# application/ccmp+xml
+application/ccxml+xml                          ccxml
+application/cdmi-capability                    cdmia
+application/cdmi-container                     cdmic
+application/cdmi-domain                                cdmid
+application/cdmi-object                                cdmio
+application/cdmi-queue                         cdmiq
+# application/cea-2018+xml
+# application/cellml+xml
+# application/cfw
+# application/cnrp+xml
+# application/commonground
+# application/conference-info+xml
+# application/cpl+xml
+# application/csta+xml
+# application/cstadata+xml
+application/cu-seeme                           cu
+# application/cybercash
+application/davmount+xml                       davmount
+# application/dca-rft
+# application/dec-dx
+# application/dialog-info+xml
+# application/dicom
+# application/dns
+# application/dskpp+xml
+application/dssc+der                           dssc
+application/dssc+xml                           xdssc
+# application/dvcs
+application/ecmascript                         ecma
+# application/edi-consent
+# application/edi-x12
+# application/edifact
+application/emma+xml                           emma
+# application/epp+xml
+application/epub+zip                           epub
+# application/eshop
+# application/example
+application/exi                                        exi
+# application/fastinfoset
+# application/fastsoap
+# application/fits
+application/font-tdpfr                         pfr
+# application/framework-attributes+xml
+# application/h224
+# application/held+xml
+# application/http
+application/hyperstudio                                stk
+# application/ibe-key-request+xml
+# application/ibe-pkg-reply+xml
+# application/ibe-pp-data
+# application/iges
+# application/im-iscomposing+xml
+# application/index
+# application/index.cmd
+# application/index.obj
+# application/index.response
+# application/index.vnd
+application/inkml+xml                          ink inkml
+# application/iotp
+application/ipfix                              ipfix
+# application/ipp
+# application/isup
+application/java-archive                       jar
+application/java-serialized-object             ser
+application/java-vm                            class
+application/javascript                         js
+application/json                               json
+# application/kpml-request+xml
+# application/kpml-response+xml
+application/lost+xml                           lostxml
+application/mac-binhex40                       hqx
+application/mac-compactpro                     cpt
+# application/macwriteii
+application/mads+xml                           mads
+application/marc                               mrc
+application/marcxml+xml                                mrcx
+application/mathematica                                ma nb mb
+# application/mathml-content+xml
+# application/mathml-presentation+xml
+application/mathml+xml                         mathml
+# application/mbms-associated-procedure-description+xml
+# application/mbms-deregister+xml
+# application/mbms-envelope+xml
+# application/mbms-msk+xml
+# application/mbms-msk-response+xml
+# application/mbms-protection-description+xml
+# application/mbms-reception-report+xml
+# application/mbms-register+xml
+# application/mbms-register-response+xml
+# application/mbms-user-service-description+xml
+application/mbox                               mbox
+# application/media_control+xml
+application/mediaservercontrol+xml             mscml
+application/metalink4+xml                      meta4
+application/mets+xml                           mets
+# application/mikey
+application/mods+xml                           mods
+# application/moss-keys
+# application/moss-signature
+# application/mosskey-data
+# application/mosskey-request
+application/mp21                               m21 mp21
+application/mp4                                        mp4s
+# application/mpeg4-generic
+# application/mpeg4-iod
+# application/mpeg4-iod-xmt
+# application/msc-ivr+xml
+# application/msc-mixer+xml
+application/msword                             doc dot
+application/mxf                                        mxf
+# application/nasdata
+# application/news-checkgroups
+# application/news-groupinfo
+# application/news-transmission
+# application/nss
+# application/ocsp-request
+# application/ocsp-response
+application/octet-stream       bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy
+application/oda                                        oda
+application/oebps-package+xml                  opf
+application/ogg                                        ogx
+application/onenote                            onetoc onetoc2 onetmp onepkg
+application/oxps                               oxps
+# application/parityfec
+application/patch-ops-error+xml                        xer
+application/pdf                                        pdf
+application/pgp-encrypted                      pgp
+# application/pgp-keys
+application/pgp-signature                      asc sig
+application/pics-rules                         prf
+# application/pidf+xml
+# application/pidf-diff+xml
+application/pkcs10                             p10
+application/pkcs7-mime                         p7m p7c
+application/pkcs7-signature                    p7s
+application/pkcs8                              p8
+application/pkix-attr-cert                     ac
+application/pkix-cert                          cer
+application/pkix-crl                           crl
+application/pkix-pkipath                       pkipath
+application/pkixcmp                            pki
+application/pls+xml                            pls
+# application/poc-settings+xml
+application/postscript                         ai eps ps
+# application/prs.alvestrand.titrax-sheet
+application/prs.cww                            cww
+# application/prs.nprend
+# application/prs.plucker
+# application/prs.rdf-xml-crypt
+# application/prs.xsf+xml
+application/pskc+xml                           pskcxml
+# application/qsig
+application/rdf+xml                            rdf
+application/reginfo+xml                                rif
+application/relax-ng-compact-syntax            rnc
+# application/remote-printing
+application/resource-lists+xml                 rl
+application/resource-lists-diff+xml            rld
+# application/riscos
+# application/rlmi+xml
+application/rls-services+xml                   rs
+application/rpki-ghostbusters                  gbr
+application/rpki-manifest                      mft
+application/rpki-roa                           roa
+# application/rpki-updown
+application/rsd+xml                            rsd
+application/rss+xml                            rss
+application/rtf                                        rtf
+# application/rtx
+# application/samlassertion+xml
+# application/samlmetadata+xml
+application/sbml+xml                           sbml
+application/scvp-cv-request                    scq
+application/scvp-cv-response                   scs
+application/scvp-vp-request                    spq
+application/scvp-vp-response                   spp
+application/sdp                                        sdp
+# application/set-payment
+application/set-payment-initiation             setpay
+# application/set-registration
+application/set-registration-initiation                setreg
+# application/sgml
+# application/sgml-open-catalog
+application/shf+xml                            shf
+# application/sieve
+# application/simple-filter+xml
+# application/simple-message-summary
+# application/simplesymbolcontainer
+# application/slate
+# application/smil
+application/smil+xml                           smi smil
+# application/soap+fastinfoset
+# application/soap+xml
+application/sparql-query                       rq
+application/sparql-results+xml                 srx
+# application/spirits-event+xml
+application/srgs                               gram
+application/srgs+xml                           grxml
+application/sru+xml                            sru
+application/ssml+xml                           ssml
+# application/tamp-apex-update
+# application/tamp-apex-update-confirm
+# application/tamp-community-update
+# application/tamp-community-update-confirm
+# application/tamp-error
+# application/tamp-sequence-adjust
+# application/tamp-sequence-adjust-confirm
+# application/tamp-status-query
+# application/tamp-status-response
+# application/tamp-update
+# application/tamp-update-confirm
+application/tei+xml                            tei teicorpus
+application/thraud+xml                         tfi
+# application/timestamp-query
+# application/timestamp-reply
+application/timestamped-data                   tsd
+# application/tve-trigger
+# application/ulpfec
+# application/vcard+xml
+# application/vemmi
+# application/vividence.scriptfile
+# application/vnd.3gpp.bsf+xml
+application/vnd.3gpp.pic-bw-large              plb
+application/vnd.3gpp.pic-bw-small              psb
+application/vnd.3gpp.pic-bw-var                        pvb
+# application/vnd.3gpp.sms
+# application/vnd.3gpp2.bcmcsinfo+xml
+# application/vnd.3gpp2.sms
+application/vnd.3gpp2.tcap                     tcap
+application/vnd.3m.post-it-notes               pwn
+application/vnd.accpac.simply.aso              aso
+application/vnd.accpac.simply.imp              imp
+application/vnd.acucobol                       acu
+application/vnd.acucorp                                atc acutc
+application/vnd.adobe.air-application-installer-package+zip    air
+application/vnd.adobe.fxp                      fxp fxpl
+# application/vnd.adobe.partial-upload
+application/vnd.adobe.xdp+xml                  xdp
+application/vnd.adobe.xfdf                     xfdf
+# application/vnd.aether.imp
+# application/vnd.ah-barcode
+application/vnd.ahead.space                    ahead
+application/vnd.airzip.filesecure.azf          azf
+application/vnd.airzip.filesecure.azs          azs
+application/vnd.amazon.ebook                   azw
+application/vnd.americandynamics.acc           acc
+application/vnd.amiga.ami                      ami
+# application/vnd.amundsen.maze+xml
+application/vnd.android.package-archive                apk
+application/vnd.anser-web-certificate-issue-initiation cii
+application/vnd.anser-web-funds-transfer-initiation    fti
+application/vnd.antix.game-component           atx
+application/vnd.apple.installer+xml            mpkg
+application/vnd.apple.mpegurl                  m3u8
+# application/vnd.arastra.swi
+application/vnd.aristanetworks.swi             swi
+application/vnd.astraea-software.iota          iota
+application/vnd.audiograph                     aep
+# application/vnd.autopackage
+# application/vnd.avistar+xml
+application/vnd.blueice.multipass              mpm
+# application/vnd.bluetooth.ep.oob
+application/vnd.bmi                            bmi
+application/vnd.businessobjects                        rep
+# application/vnd.cab-jscript
+# application/vnd.canon-cpdl
+# application/vnd.canon-lips
+# application/vnd.cendio.thinlinc.clientconf
+application/vnd.chemdraw+xml                   cdxml
+application/vnd.chipnuts.karaoke-mmd           mmd
+application/vnd.cinderella                     cdy
+# application/vnd.cirpack.isdn-ext
+application/vnd.claymore                       cla
+application/vnd.cloanto.rp9                    rp9
+application/vnd.clonk.c4group                  c4g c4d c4f c4p c4u
+application/vnd.cluetrust.cartomobile-config           c11amc
+application/vnd.cluetrust.cartomobile-config-pkg       c11amz
+# application/vnd.collection+json
+# application/vnd.commerce-battelle
+application/vnd.commonspace                    csp
+application/vnd.contact.cmsg                   cdbcmsg
+application/vnd.cosmocaller                    cmc
+application/vnd.crick.clicker                  clkx
+application/vnd.crick.clicker.keyboard         clkk
+application/vnd.crick.clicker.palette          clkp
+application/vnd.crick.clicker.template         clkt
+application/vnd.crick.clicker.wordbank         clkw
+application/vnd.criticaltools.wbs+xml          wbs
+application/vnd.ctc-posml                      pml
+# application/vnd.ctct.ws+xml
+# application/vnd.cups-pdf
+# application/vnd.cups-postscript
+application/vnd.cups-ppd                       ppd
+# application/vnd.cups-raster
+# application/vnd.cups-raw
+# application/vnd.curl
+application/vnd.curl.car                       car
+application/vnd.curl.pcurl                     pcurl
+# application/vnd.cybank
+application/vnd.data-vision.rdz                        rdz
+application/vnd.dece.data                      uvf uvvf uvd uvvd
+application/vnd.dece.ttml+xml                  uvt uvvt
+application/vnd.dece.unspecified               uvx uvvx
+application/vnd.dece.zip                       uvz uvvz
+application/vnd.denovo.fcselayout-link         fe_launch
+# application/vnd.dir-bi.plate-dl-nosuffix
+application/vnd.dna                            dna
+application/vnd.dolby.mlp                      mlp
+# application/vnd.dolby.mobile.1
+# application/vnd.dolby.mobile.2
+application/vnd.dpgraph                                dpg
+application/vnd.dreamfactory                   dfac
+application/vnd.dvb.ait                                ait
+# application/vnd.dvb.dvbj
+# application/vnd.dvb.esgcontainer
+# application/vnd.dvb.ipdcdftnotifaccess
+# application/vnd.dvb.ipdcesgaccess
+# application/vnd.dvb.ipdcesgaccess2
+# application/vnd.dvb.ipdcesgpdd
+# application/vnd.dvb.ipdcroaming
+# application/vnd.dvb.iptv.alfec-base
+# application/vnd.dvb.iptv.alfec-enhancement
+# application/vnd.dvb.notif-aggregate-root+xml
+# application/vnd.dvb.notif-container+xml
+# application/vnd.dvb.notif-generic+xml
+# application/vnd.dvb.notif-ia-msglist+xml
+# application/vnd.dvb.notif-ia-registration-request+xml
+# application/vnd.dvb.notif-ia-registration-response+xml
+# application/vnd.dvb.notif-init+xml
+# application/vnd.dvb.pfr
+application/vnd.dvb.service                    svc
+# application/vnd.dxr
+application/vnd.dynageo                                geo
+# application/vnd.easykaraoke.cdgdownload
+# application/vnd.ecdis-update
+application/vnd.ecowin.chart                   mag
+# application/vnd.ecowin.filerequest
+# application/vnd.ecowin.fileupdate
+# application/vnd.ecowin.series
+# application/vnd.ecowin.seriesrequest
+# application/vnd.ecowin.seriesupdate
+# application/vnd.emclient.accessrequest+xml
+application/vnd.enliven                                nml
+# application/vnd.eprints.data+xml
+application/vnd.epson.esf                      esf
+application/vnd.epson.msf                      msf
+application/vnd.epson.quickanime               qam
+application/vnd.epson.salt                     slt
+application/vnd.epson.ssf                      ssf
+# application/vnd.ericsson.quickcall
+application/vnd.eszigno3+xml                   es3 et3
+# application/vnd.etsi.aoc+xml
+# application/vnd.etsi.cug+xml
+# application/vnd.etsi.iptvcommand+xml
+# application/vnd.etsi.iptvdiscovery+xml
+# application/vnd.etsi.iptvprofile+xml
+# application/vnd.etsi.iptvsad-bc+xml
+# application/vnd.etsi.iptvsad-cod+xml
+# application/vnd.etsi.iptvsad-npvr+xml
+# application/vnd.etsi.iptvservice+xml
+# application/vnd.etsi.iptvsync+xml
+# application/vnd.etsi.iptvueprofile+xml
+# application/vnd.etsi.mcid+xml
+# application/vnd.etsi.overload-control-policy-dataset+xml
+# application/vnd.etsi.sci+xml
+# application/vnd.etsi.simservs+xml
+# application/vnd.etsi.tsl+xml
+# application/vnd.etsi.tsl.der
+# application/vnd.eudora.data
+application/vnd.ezpix-album                    ez2
+application/vnd.ezpix-package                  ez3
+# application/vnd.f-secure.mobile
+application/vnd.fdf                            fdf
+application/vnd.fdsn.mseed                     mseed
+application/vnd.fdsn.seed                      seed dataless
+# application/vnd.ffsns
+# application/vnd.fints
+application/vnd.flographit                     gph
+application/vnd.fluxtime.clip                  ftc
+# application/vnd.font-fontforge-sfd
+application/vnd.framemaker                     fm frame maker book
+application/vnd.frogans.fnc                    fnc
+application/vnd.frogans.ltf                    ltf
+application/vnd.fsc.weblaunch                  fsc
+application/vnd.fujitsu.oasys                  oas
+application/vnd.fujitsu.oasys2                 oa2
+application/vnd.fujitsu.oasys3                 oa3
+application/vnd.fujitsu.oasysgp                        fg5
+application/vnd.fujitsu.oasysprs               bh2
+# application/vnd.fujixerox.art-ex
+# application/vnd.fujixerox.art4
+# application/vnd.fujixerox.hbpl
+application/vnd.fujixerox.ddd                  ddd
+application/vnd.fujixerox.docuworks            xdw
+application/vnd.fujixerox.docuworks.binder     xbd
+# application/vnd.fut-misnet
+application/vnd.fuzzysheet                     fzs
+application/vnd.genomatix.tuxedo               txd
+# application/vnd.geocube+xml
+application/vnd.geogebra.file                  ggb
+application/vnd.geogebra.tool                  ggt
+application/vnd.geometry-explorer              gex gre
+application/vnd.geonext                                gxt
+application/vnd.geoplan                                g2w
+application/vnd.geospace                       g3w
+# application/vnd.globalplatform.card-content-mgt
+# application/vnd.globalplatform.card-content-mgt-response
+application/vnd.gmx                            gmx
+application/vnd.google-earth.kml+xml           kml
+application/vnd.google-earth.kmz               kmz
+application/vnd.grafeq                         gqf gqs
+# application/vnd.gridmp
+application/vnd.groove-account                 gac
+application/vnd.groove-help                    ghf
+application/vnd.groove-identity-message                gim
+application/vnd.groove-injector                        grv
+application/vnd.groove-tool-message            gtm
+application/vnd.groove-tool-template           tpl
+application/vnd.groove-vcard                   vcg
+# application/vnd.hal+json
+application/vnd.hal+xml                                hal
+application/vnd.handheld-entertainment+xml     zmm
+application/vnd.hbci                           hbci
+# application/vnd.hcl-bireports
+application/vnd.hhe.lesson-player              les
+application/vnd.hp-hpgl                                hpgl
+application/vnd.hp-hpid                                hpid
+application/vnd.hp-hps                         hps
+application/vnd.hp-jlyt                                jlt
+application/vnd.hp-pcl                         pcl
+application/vnd.hp-pclxl                       pclxl
+# application/vnd.httphone
+application/vnd.hydrostatix.sof-data           sfd-hdstx
+application/vnd.hzn-3d-crossword               x3d
+# application/vnd.ibm.afplinedata
+# application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay                    mpy
+application/vnd.ibm.modcap                     afp listafp list3820
+application/vnd.ibm.rights-management          irm
+application/vnd.ibm.secure-container           sc
+application/vnd.iccprofile                     icc icm
+application/vnd.igloader                       igl
+application/vnd.immervision-ivp                        ivp
+application/vnd.immervision-ivu                        ivu
+# application/vnd.informedcontrol.rms+xml
+# application/vnd.informix-visionary
+# application/vnd.infotech.project
+# application/vnd.infotech.project+xml
+application/vnd.insors.igm                     igm
+application/vnd.intercon.formnet               xpw xpx
+application/vnd.intergeo                       i2g
+# application/vnd.intertrust.digibox
+# application/vnd.intertrust.nncp
+application/vnd.intu.qbo                       qbo
+application/vnd.intu.qfx                       qfx
+# application/vnd.iptc.g2.conceptitem+xml
+# application/vnd.iptc.g2.knowledgeitem+xml
+# application/vnd.iptc.g2.newsitem+xml
+# application/vnd.iptc.g2.packageitem+xml
+application/vnd.ipunplugged.rcprofile          rcprofile
+application/vnd.irepository.package+xml                irp
+application/vnd.is-xpr                         xpr
+application/vnd.isac.fcs                       fcs
+application/vnd.jam                            jam
+# application/vnd.japannet-directory-service
+# application/vnd.japannet-jpnstore-wakeup
+# application/vnd.japannet-payment-wakeup
+# application/vnd.japannet-registration
+# application/vnd.japannet-registration-wakeup
+# application/vnd.japannet-setstore-wakeup
+# application/vnd.japannet-verification
+# application/vnd.japannet-verification-wakeup
+application/vnd.jcp.javame.midlet-rms          rms
+application/vnd.jisp                           jisp
+application/vnd.joost.joda-archive             joda
+application/vnd.kahootz                                ktz ktr
+application/vnd.kde.karbon                     karbon
+application/vnd.kde.kchart                     chrt
+application/vnd.kde.kformula                   kfo
+application/vnd.kde.kivio                      flw
+application/vnd.kde.kontour                    kon
+application/vnd.kde.kpresenter                 kpr kpt
+application/vnd.kde.kspread                    ksp
+application/vnd.kde.kword                      kwd kwt
+application/vnd.kenameaapp                     htke
+application/vnd.kidspiration                   kia
+application/vnd.kinar                          kne knp
+application/vnd.koan                           skp skd skt skm
+application/vnd.kodak-descriptor               sse
+application/vnd.las.las+xml                    lasxml
+# application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop     lbd
+application/vnd.llamagraphics.life-balance.exchange+xml        lbe
+application/vnd.lotus-1-2-3                    123
+application/vnd.lotus-approach                 apr
+application/vnd.lotus-freelance                        pre
+application/vnd.lotus-notes                    nsf
+application/vnd.lotus-organizer                        org
+application/vnd.lotus-screencam                        scm
+application/vnd.lotus-wordpro                  lwp
+application/vnd.macports.portpkg               portpkg
+# application/vnd.marlin.drm.actiontoken+xml
+# application/vnd.marlin.drm.conftoken+xml
+# application/vnd.marlin.drm.license+xml
+# application/vnd.marlin.drm.mdcf
+application/vnd.mcd                            mcd
+application/vnd.medcalcdata                    mc1
+application/vnd.mediastation.cdkey             cdkey
+# application/vnd.meridian-slingshot
+application/vnd.mfer                           mwf
+application/vnd.mfmp                           mfm
+application/vnd.micrografx.flo                 flo
+application/vnd.micrografx.igx                 igx
+application/vnd.mif                            mif
+# application/vnd.minisoft-hp3000-save
+# application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf                     daf
+application/vnd.mobius.dis                     dis
+application/vnd.mobius.mbk                     mbk
+application/vnd.mobius.mqy                     mqy
+application/vnd.mobius.msl                     msl
+application/vnd.mobius.plc                     plc
+application/vnd.mobius.txf                     txf
+application/vnd.mophun.application             mpn
+application/vnd.mophun.certificate             mpc
+# application/vnd.motorola.flexsuite
+# application/vnd.motorola.flexsuite.adsi
+# application/vnd.motorola.flexsuite.fis
+# application/vnd.motorola.flexsuite.gotap
+# application/vnd.motorola.flexsuite.kmr
+# application/vnd.motorola.flexsuite.ttc
+# application/vnd.motorola.flexsuite.wem
+# application/vnd.motorola.iprm
+application/vnd.mozilla.xul+xml                        xul
+application/vnd.ms-artgalry                    cil
+# application/vnd.ms-asf
+application/vnd.ms-cab-compressed              cab
+application/vnd.ms-excel                       xls xlm xla xlc xlt xlw
+application/vnd.ms-excel.addin.macroenabled.12         xlam
+application/vnd.ms-excel.sheet.binary.macroenabled.12  xlsb
+application/vnd.ms-excel.sheet.macroenabled.12         xlsm
+application/vnd.ms-excel.template.macroenabled.12      xltm
+application/vnd.ms-fontobject                  eot
+application/vnd.ms-htmlhelp                    chm
+application/vnd.ms-ims                         ims
+application/vnd.ms-lrm                         lrm
+# application/vnd.ms-office.activex+xml
+application/vnd.ms-officetheme                 thmx
+application/vnd.ms-pki.seccat                  cat
+application/vnd.ms-pki.stl                     stl
+# application/vnd.ms-playready.initiator+xml
+application/vnd.ms-powerpoint                  ppt pps pot
+application/vnd.ms-powerpoint.addin.macroenabled.12            ppam
+application/vnd.ms-powerpoint.presentation.macroenabled.12     pptm
+application/vnd.ms-powerpoint.slide.macroenabled.12            sldm
+application/vnd.ms-powerpoint.slideshow.macroenabled.12                ppsm
+application/vnd.ms-powerpoint.template.macroenabled.12         potm
+application/vnd.ms-project                     mpp mpt
+# application/vnd.ms-tnef
+# application/vnd.ms-wmdrm.lic-chlg-req
+# application/vnd.ms-wmdrm.lic-resp
+# application/vnd.ms-wmdrm.meter-chlg-req
+# application/vnd.ms-wmdrm.meter-resp
+application/vnd.ms-word.document.macroenabled.12       docm
+application/vnd.ms-word.template.macroenabled.12       dotm
+application/vnd.ms-works                       wps wks wcm wdb
+application/vnd.ms-wpl                         wpl
+application/vnd.ms-xpsdocument                 xps
+application/vnd.mseq                           mseq
+# application/vnd.msign
+# application/vnd.multiad.creator
+# application/vnd.multiad.creator.cif
+# application/vnd.music-niff
+application/vnd.musician                       mus
+application/vnd.muvee.style                    msty
+application/vnd.mynfc                          taglet
+# application/vnd.ncd.control
+# application/vnd.ncd.reference
+# application/vnd.nervana
+# application/vnd.netfpx
+application/vnd.neurolanguage.nlu              nlu
+application/vnd.noblenet-directory             nnd
+application/vnd.noblenet-sealer                        nns
+application/vnd.noblenet-web                   nnw
+# application/vnd.nokia.catalogs
+# application/vnd.nokia.conml+wbxml
+# application/vnd.nokia.conml+xml
+# application/vnd.nokia.isds-radio-presets
+# application/vnd.nokia.iptv.config+xml
+# application/vnd.nokia.landmark+wbxml
+# application/vnd.nokia.landmark+xml
+# application/vnd.nokia.landmarkcollection+xml
+# application/vnd.nokia.n-gage.ac+xml
+application/vnd.nokia.n-gage.data              ngdat
+application/vnd.nokia.n-gage.symbian.install   n-gage
+# application/vnd.nokia.ncd
+# application/vnd.nokia.pcd+wbxml
+# application/vnd.nokia.pcd+xml
+application/vnd.nokia.radio-preset             rpst
+application/vnd.nokia.radio-presets            rpss
+application/vnd.novadigm.edm                   edm
+application/vnd.novadigm.edx                   edx
+application/vnd.novadigm.ext                   ext
+# application/vnd.ntt-local.file-transfer
+# application/vnd.ntt-local.sip-ta_remote
+# application/vnd.ntt-local.sip-ta_tcp_stream
+application/vnd.oasis.opendocument.chart               odc
+application/vnd.oasis.opendocument.chart-template      otc
+application/vnd.oasis.opendocument.database            odb
+application/vnd.oasis.opendocument.formula             odf
+application/vnd.oasis.opendocument.formula-template    odft
+application/vnd.oasis.opendocument.graphics            odg
+application/vnd.oasis.opendocument.graphics-template   otg
+application/vnd.oasis.opendocument.image               odi
+application/vnd.oasis.opendocument.image-template      oti
+application/vnd.oasis.opendocument.presentation                odp
+application/vnd.oasis.opendocument.presentation-template       otp
+application/vnd.oasis.opendocument.spreadsheet         ods
+application/vnd.oasis.opendocument.spreadsheet-template        ots
+application/vnd.oasis.opendocument.text                        odt
+application/vnd.oasis.opendocument.text-master         odm
+application/vnd.oasis.opendocument.text-template       ott
+application/vnd.oasis.opendocument.text-web            oth
+# application/vnd.obn
+# application/vnd.oftn.l10n+json
+# application/vnd.oipf.contentaccessdownload+xml
+# application/vnd.oipf.contentaccessstreaming+xml
+# application/vnd.oipf.cspg-hexbinary
+# application/vnd.oipf.dae.svg+xml
+# application/vnd.oipf.dae.xhtml+xml
+# application/vnd.oipf.mippvcontrolmessage+xml
+# application/vnd.oipf.pae.gem
+# application/vnd.oipf.spdiscovery+xml
+# application/vnd.oipf.spdlist+xml
+# application/vnd.oipf.ueprofile+xml
+# application/vnd.oipf.userprofile+xml
+application/vnd.olpc-sugar                     xo
+# application/vnd.oma-scws-config
+# application/vnd.oma-scws-http-request
+# application/vnd.oma-scws-http-response
+# application/vnd.oma.bcast.associated-procedure-parameter+xml
+# application/vnd.oma.bcast.drm-trigger+xml
+# application/vnd.oma.bcast.imd+xml
+# application/vnd.oma.bcast.ltkm
+# application/vnd.oma.bcast.notification+xml
+# application/vnd.oma.bcast.provisioningtrigger
+# application/vnd.oma.bcast.sgboot
+# application/vnd.oma.bcast.sgdd+xml
+# application/vnd.oma.bcast.sgdu
+# application/vnd.oma.bcast.simple-symbol-container
+# application/vnd.oma.bcast.smartcard-trigger+xml
+# application/vnd.oma.bcast.sprov+xml
+# application/vnd.oma.bcast.stkm
+# application/vnd.oma.cab-address-book+xml
+# application/vnd.oma.cab-feature-handler+xml
+# application/vnd.oma.cab-pcc+xml
+# application/vnd.oma.cab-user-prefs+xml
+# application/vnd.oma.dcd
+# application/vnd.oma.dcdc
+application/vnd.oma.dd2+xml                    dd2
+# application/vnd.oma.drm.risd+xml
+# application/vnd.oma.group-usage-list+xml
+# application/vnd.oma.pal+xml
+# application/vnd.oma.poc.detailed-progress-report+xml
+# application/vnd.oma.poc.final-report+xml
+# application/vnd.oma.poc.groups+xml
+# application/vnd.oma.poc.invocation-descriptor+xml
+# application/vnd.oma.poc.optimized-progress-report+xml
+# application/vnd.oma.push
+# application/vnd.oma.scidm.messages+xml
+# application/vnd.oma.xcap-directory+xml
+# application/vnd.omads-email+xml
+# application/vnd.omads-file+xml
+# application/vnd.omads-folder+xml
+# application/vnd.omaloc-supl-init
+application/vnd.openofficeorg.extension                oxt
+# application/vnd.openxmlformats-officedocument.custom-properties+xml
+# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
+# application/vnd.openxmlformats-officedocument.drawing+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
+# application/vnd.openxmlformats-officedocument.extended-properties+xml
+# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
+# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
+# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
+application/vnd.openxmlformats-officedocument.presentationml.presentation      pptx
+# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
+application/vnd.openxmlformats-officedocument.presentationml.slide     sldx
+# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
+application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
+# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
+application/vnd.openxmlformats-officedocument.presentationml.template  potx
+# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet      xlsx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.template   xltx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
+# application/vnd.openxmlformats-officedocument.theme+xml
+# application/vnd.openxmlformats-officedocument.themeoverride+xml
+# application/vnd.openxmlformats-officedocument.vmldrawing
+# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.document        docx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.template        dotx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
+# application/vnd.openxmlformats-package.core-properties+xml
+# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
+# application/vnd.openxmlformats-package.relationships+xml
+# application/vnd.quobject-quoxdocument
+# application/vnd.osa.netdeploy
+application/vnd.osgeo.mapguide.package         mgp
+# application/vnd.osgi.bundle
+application/vnd.osgi.dp                                dp
+# application/vnd.otps.ct-kip+xml
+application/vnd.palm                           pdb pqa oprc
+# application/vnd.paos.xml
+application/vnd.pawaafile                      paw
+application/vnd.pg.format                      str
+application/vnd.pg.osasli                      ei6
+# application/vnd.piaccess.application-licence
+application/vnd.picsel                         efif
+application/vnd.pmi.widget                     wg
+# application/vnd.poc.group-advertisement+xml
+application/vnd.pocketlearn                    plf
+application/vnd.powerbuilder6                  pbd
+# application/vnd.powerbuilder6-s
+# application/vnd.powerbuilder7
+# application/vnd.powerbuilder7-s
+# application/vnd.powerbuilder75
+# application/vnd.powerbuilder75-s
+# application/vnd.preminet
+application/vnd.previewsystems.box             box
+application/vnd.proteus.magazine               mgz
+application/vnd.publishare-delta-tree          qps
+application/vnd.pvi.ptid1                      ptid
+# application/vnd.pwg-multiplexed
+# application/vnd.pwg-xhtml-print+xml
+# application/vnd.qualcomm.brew-app-res
+application/vnd.quark.quarkxpress              qxd qxt qwd qwt qxl qxb
+# application/vnd.radisys.moml+xml
+# application/vnd.radisys.msml+xml
+# application/vnd.radisys.msml-audit+xml
+# application/vnd.radisys.msml-audit-conf+xml
+# application/vnd.radisys.msml-audit-conn+xml
+# application/vnd.radisys.msml-audit-dialog+xml
+# application/vnd.radisys.msml-audit-stream+xml
+# application/vnd.radisys.msml-conf+xml
+# application/vnd.radisys.msml-dialog+xml
+# application/vnd.radisys.msml-dialog-base+xml
+# application/vnd.radisys.msml-dialog-fax-detect+xml
+# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
+# application/vnd.radisys.msml-dialog-group+xml
+# application/vnd.radisys.msml-dialog-speech+xml
+# application/vnd.radisys.msml-dialog-transform+xml
+# application/vnd.rainstor.data
+# application/vnd.rapid
+application/vnd.realvnc.bed                    bed
+application/vnd.recordare.musicxml             mxl
+application/vnd.recordare.musicxml+xml         musicxml
+# application/vnd.renlearn.rlprint
+application/vnd.rig.cryptonote                 cryptonote
+application/vnd.rim.cod                                cod
+application/vnd.rn-realmedia                   rm
+application/vnd.route66.link66+xml             link66
+# application/vnd.ruckus.download
+# application/vnd.s3sms
+application/vnd.sailingtracker.track           st
+# application/vnd.sbm.cid
+# application/vnd.sbm.mid2
+# application/vnd.scribus
+# application/vnd.sealed.3df
+# application/vnd.sealed.csf
+# application/vnd.sealed.doc
+# application/vnd.sealed.eml
+# application/vnd.sealed.mht
+# application/vnd.sealed.net
+# application/vnd.sealed.ppt
+# application/vnd.sealed.tiff
+# application/vnd.sealed.xls
+# application/vnd.sealedmedia.softseal.html
+# application/vnd.sealedmedia.softseal.pdf
+application/vnd.seemail                                see
+application/vnd.sema                           sema
+application/vnd.semd                           semd
+application/vnd.semf                           semf
+application/vnd.shana.informed.formdata                ifm
+application/vnd.shana.informed.formtemplate    itp
+application/vnd.shana.informed.interchange     iif
+application/vnd.shana.informed.package         ipk
+application/vnd.simtech-mindmapper             twd twds
+application/vnd.smaf                           mmf
+# application/vnd.smart.notebook
+application/vnd.smart.teacher                  teacher
+# application/vnd.software602.filler.form+xml
+# application/vnd.software602.filler.form-xml-zip
+application/vnd.solent.sdkm+xml                        sdkm sdkd
+application/vnd.spotfire.dxp                   dxp
+application/vnd.spotfire.sfs                   sfs
+# application/vnd.sss-cod
+# application/vnd.sss-dtf
+# application/vnd.sss-ntf
+application/vnd.stardivision.calc              sdc
+application/vnd.stardivision.draw              sda
+application/vnd.stardivision.impress           sdd
+application/vnd.stardivision.math              smf
+application/vnd.stardivision.writer            sdw vor
+application/vnd.stardivision.writer-global     sgl
+application/vnd.stepmania.package              smzip
+application/vnd.stepmania.stepchart            sm
+# application/vnd.street-stream
+application/vnd.sun.xml.calc                   sxc
+application/vnd.sun.xml.calc.template          stc
+application/vnd.sun.xml.draw                   sxd
+application/vnd.sun.xml.draw.template          std
+application/vnd.sun.xml.impress                        sxi
+application/vnd.sun.xml.impress.template       sti
+application/vnd.sun.xml.math                   sxm
+application/vnd.sun.xml.writer                 sxw
+application/vnd.sun.xml.writer.global          sxg
+application/vnd.sun.xml.writer.template                stw
+# application/vnd.sun.wadl+xml
+application/vnd.sus-calendar                   sus susp
+application/vnd.svd                            svd
+# application/vnd.swiftview-ics
+application/vnd.symbian.install                        sis sisx
+application/vnd.syncml+xml                     xsm
+application/vnd.syncml.dm+wbxml                        bdm
+application/vnd.syncml.dm+xml                  xdm
+# application/vnd.syncml.dm.notification
+# application/vnd.syncml.ds.notification
+application/vnd.tao.intent-module-archive      tao
+application/vnd.tcpdump.pcap                   pcap cap dmp
+application/vnd.tmobile-livetv                 tmo
+application/vnd.trid.tpt                       tpt
+application/vnd.triscape.mxs                   mxs
+application/vnd.trueapp                                tra
+# application/vnd.truedoc
+# application/vnd.ubisoft.webplayer
+application/vnd.ufdl                           ufd ufdl
+application/vnd.uiq.theme                      utz
+application/vnd.umajin                         umj
+application/vnd.unity                          unityweb
+application/vnd.uoml+xml                       uoml
+# application/vnd.uplanet.alert
+# application/vnd.uplanet.alert-wbxml
+# application/vnd.uplanet.bearer-choice
+# application/vnd.uplanet.bearer-choice-wbxml
+# application/vnd.uplanet.cacheop
+# application/vnd.uplanet.cacheop-wbxml
+# application/vnd.uplanet.channel
+# application/vnd.uplanet.channel-wbxml
+# application/vnd.uplanet.list
+# application/vnd.uplanet.list-wbxml
+# application/vnd.uplanet.listcmd
+# application/vnd.uplanet.listcmd-wbxml
+# application/vnd.uplanet.signal
+application/vnd.vcx                            vcx
+# application/vnd.vd-study
+# application/vnd.vectorworks
+# application/vnd.verimatrix.vcas
+# application/vnd.vidsoft.vidconference
+application/vnd.visio                          vsd vst vss vsw
+application/vnd.visionary                      vis
+# application/vnd.vividence.scriptfile
+application/vnd.vsf                            vsf
+# application/vnd.wap.sic
+# application/vnd.wap.slc
+application/vnd.wap.wbxml                      wbxml
+application/vnd.wap.wmlc                       wmlc
+application/vnd.wap.wmlscriptc                 wmlsc
+application/vnd.webturbo                       wtb
+# application/vnd.wfa.wsc
+# application/vnd.wmc
+# application/vnd.wmf.bootstrap
+# application/vnd.wolfram.mathematica
+# application/vnd.wolfram.mathematica.package
+application/vnd.wolfram.player                 nbp
+application/vnd.wordperfect                    wpd
+application/vnd.wqd                            wqd
+# application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf                         stf
+# application/vnd.wv.csp+wbxml
+# application/vnd.wv.csp+xml
+# application/vnd.wv.ssp+xml
+application/vnd.xara                           xar
+application/vnd.xfdl                           xfdl
+# application/vnd.xfdl.webform
+# application/vnd.xmi+xml
+# application/vnd.xmpie.cpkg
+# application/vnd.xmpie.dpkg
+# application/vnd.xmpie.plan
+# application/vnd.xmpie.ppkg
+# application/vnd.xmpie.xlim
+application/vnd.yamaha.hv-dic                  hvd
+application/vnd.yamaha.hv-script               hvs
+application/vnd.yamaha.hv-voice                        hvp
+application/vnd.yamaha.openscoreformat                 osf
+application/vnd.yamaha.openscoreformat.osfpvg+xml      osfpvg
+# application/vnd.yamaha.remote-setup
+application/vnd.yamaha.smaf-audio              saf
+application/vnd.yamaha.smaf-phrase             spf
+# application/vnd.yamaha.through-ngn
+# application/vnd.yamaha.tunnel-udpencap
+application/vnd.yellowriver-custom-menu                cmp
+application/vnd.zul                            zir zirz
+application/vnd.zzazz.deck+xml                 zaz
+application/voicexml+xml                       vxml
+# application/vq-rtcpxr
+# application/watcherinfo+xml
+# application/whoispp-query
+# application/whoispp-response
+application/widget                             wgt
+application/winhlp                             hlp
+# application/wita
+# application/wordperfect5.1
+application/wsdl+xml                           wsdl
+application/wspolicy+xml                       wspolicy
+application/x-7z-compressed                    7z
+application/x-abiword                          abw
+application/x-ace-compressed                   ace
+application/x-authorware-bin                   aab x32 u32 vox
+application/x-authorware-map                   aam
+application/x-authorware-seg                   aas
+application/x-bcpio                            bcpio
+application/x-bittorrent                       torrent
+application/x-bzip                             bz
+application/x-bzip2                            bz2 boz
+application/x-cdlink                           vcd
+application/x-chat                             chat
+application/x-chess-pgn                                pgn
+# application/x-compress
+application/x-cpio                             cpio
+application/x-csh                              csh
+application/x-debian-package                   deb udeb
+application/x-director                 dir dcr dxr cst cct cxt w3d fgd swa
+application/x-doom                             wad
+application/x-dtbncx+xml                       ncx
+application/x-dtbook+xml                       dtb
+application/x-dtbresource+xml                  res
+application/x-dvi                              dvi
+application/x-font-bdf                         bdf
+# application/x-font-dos
+# application/x-font-framemaker
+application/x-font-ghostscript                 gsf
+# application/x-font-libgrx
+application/x-font-linux-psf                   psf
+application/x-font-otf                         otf
+application/x-font-pcf                         pcf
+application/x-font-snf                         snf
+# application/x-font-speedo
+# application/x-font-sunos-news
+application/x-font-ttf                         ttf ttc
+application/x-font-type1                       pfa pfb pfm afm
+application/x-font-woff                                woff
+# application/x-font-vfont
+application/x-futuresplash                     spl
+application/x-gnumeric                         gnumeric
+application/x-gtar                             gtar
+# application/x-gzip
+application/x-hdf                              hdf
+application/x-java-jnlp-file                   jnlp
+application/x-latex                            latex
+application/x-mobipocket-ebook                 prc mobi
+application/x-ms-application                   application
+application/x-ms-wmd                           wmd
+application/x-ms-wmz                           wmz
+application/x-ms-xbap                          xbap
+application/x-msaccess                         mdb
+application/x-msbinder                         obd
+application/x-mscardfile                       crd
+application/x-msclip                           clp
+application/x-msdownload                       exe dll com bat msi
+application/x-msmediaview                      mvb m13 m14
+application/x-msmetafile                       wmf
+application/x-msmoney                          mny
+application/x-mspublisher                      pub
+application/x-msschedule                       scd
+application/x-msterminal                       trm
+application/x-mswrite                          wri
+application/x-netcdf                           nc cdf
+application/x-pkcs12                           p12 pfx
+application/x-pkcs7-certificates               p7b spc
+application/x-pkcs7-certreqresp                        p7r
+application/x-rar-compressed                   rar
+application/x-sh                               sh
+application/x-shar                             shar
+application/x-shockwave-flash                  swf
+application/x-silverlight-app                  xap
+application/x-stuffit                          sit
+application/x-stuffitx                         sitx
+application/x-sv4cpio                          sv4cpio
+application/x-sv4crc                           sv4crc
+application/x-tar                              tar
+application/x-tcl                              tcl
+application/x-tex                              tex
+application/x-tex-tfm                          tfm
+application/x-texinfo                          texinfo texi
+application/x-ustar                            ustar
+application/x-wais-source                      src
+application/x-x509-ca-cert                     der crt
+application/x-xfig                             fig
+application/x-xpinstall                                xpi
+# application/x400-bp
+# application/xcap-att+xml
+# application/xcap-caps+xml
+application/xcap-diff+xml                      xdf
+# application/xcap-el+xml
+# application/xcap-error+xml
+# application/xcap-ns+xml
+# application/xcon-conference-info-diff+xml
+# application/xcon-conference-info+xml
+application/xenc+xml                           xenc
+application/xhtml+xml                          xhtml xht
+# application/xhtml-voice+xml
+application/xml                                        xml xsl
+application/xml-dtd                            dtd
+# application/xml-external-parsed-entity
+# application/xmpp+xml
+application/xop+xml                            xop
+application/xslt+xml                           xslt
+application/xspf+xml                           xspf
+application/xv+xml                             mxml xhvml xvml xvm
+application/yang                               yang
+application/yin+xml                            yin
+application/zip                                        zip
+# audio/1d-interleaved-parityfec
+# audio/32kadpcm
+# audio/3gpp
+# audio/3gpp2
+# audio/ac3
+audio/adpcm                                    adp
+# audio/amr
+# audio/amr-wb
+# audio/amr-wb+
+# audio/asc
+# audio/atrac-advanced-lossless
+# audio/atrac-x
+# audio/atrac3
+audio/basic                                    au snd
+# audio/bv16
+# audio/bv32
+# audio/clearmode
+# audio/cn
+# audio/dat12
+# audio/dls
+# audio/dsr-es201108
+# audio/dsr-es202050
+# audio/dsr-es202211
+# audio/dsr-es202212
+# audio/dv
+# audio/dvi4
+# audio/eac3
+# audio/evrc
+# audio/evrc-qcp
+# audio/evrc0
+# audio/evrc1
+# audio/evrcb
+# audio/evrcb0
+# audio/evrcb1
+# audio/evrcwb
+# audio/evrcwb0
+# audio/evrcwb1
+# audio/example
+# audio/fwdred
+# audio/g719
+# audio/g722
+# audio/g7221
+# audio/g723
+# audio/g726-16
+# audio/g726-24
+# audio/g726-32
+# audio/g726-40
+# audio/g728
+# audio/g729
+# audio/g7291
+# audio/g729d
+# audio/g729e
+# audio/gsm
+# audio/gsm-efr
+# audio/gsm-hr-08
+# audio/ilbc
+# audio/ip-mr_v2.5
+# audio/l16
+# audio/l20
+# audio/l24
+# audio/l8
+# audio/lpc
+audio/midi                                     mid midi kar rmi
+# audio/mobile-xmf
+audio/mp4                                      mp4a
+# audio/mp4a-latm
+# audio/mpa
+# audio/mpa-robust
+audio/mpeg                                     mpga mp2 mp2a mp3 m2a m3a
+# audio/mpeg4-generic
+audio/ogg                                      oga ogg spx
+# audio/parityfec
+# audio/pcma
+# audio/pcma-wb
+# audio/pcmu-wb
+# audio/pcmu
+# audio/prs.sid
+# audio/qcelp
+# audio/red
+# audio/rtp-enc-aescm128
+# audio/rtp-midi
+# audio/rtx
+# audio/smv
+# audio/smv0
+# audio/smv-qcp
+# audio/sp-midi
+# audio/speex
+# audio/t140c
+# audio/t38
+# audio/telephone-event
+# audio/tone
+# audio/uemclip
+# audio/ulpfec
+# audio/vdvi
+# audio/vmr-wb
+# audio/vnd.3gpp.iufp
+# audio/vnd.4sb
+# audio/vnd.audiokoz
+# audio/vnd.celp
+# audio/vnd.cisco.nse
+# audio/vnd.cmles.radio-events
+# audio/vnd.cns.anp1
+# audio/vnd.cns.inf1
+audio/vnd.dece.audio                           uva uvva
+audio/vnd.digital-winds                                eol
+# audio/vnd.dlna.adts
+# audio/vnd.dolby.heaac.1
+# audio/vnd.dolby.heaac.2
+# audio/vnd.dolby.mlp
+# audio/vnd.dolby.mps
+# audio/vnd.dolby.pl2
+# audio/vnd.dolby.pl2x
+# audio/vnd.dolby.pl2z
+# audio/vnd.dolby.pulse.1
+audio/vnd.dra                                  dra
+audio/vnd.dts                                  dts
+audio/vnd.dts.hd                               dtshd
+# audio/vnd.dvb.file                           dvb
+# audio/vnd.everad.plj
+# audio/vnd.hns.audio
+audio/vnd.lucent.voice                         lvp
+audio/vnd.ms-playready.media.pya               pya
+# audio/vnd.nokia.mobile-xmf
+# audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800                      ecelp4800
+audio/vnd.nuera.ecelp7470                      ecelp7470
+audio/vnd.nuera.ecelp9600                      ecelp9600
+# audio/vnd.octel.sbc
+# audio/vnd.qcelp
+# audio/vnd.rhetorex.32kadpcm
+audio/vnd.rip                                  rip
+# audio/vnd.sealedmedia.softseal.mpeg
+# audio/vnd.vmx.cvsd
+# audio/vorbis
+# audio/vorbis-config
+audio/webm                                     weba
+audio/x-aac                                    aac
+audio/x-aiff                                   aif aiff aifc
+audio/x-mpegurl                                        m3u
+audio/x-ms-wax                                 wax
+audio/x-ms-wma                                 wma
+audio/x-pn-realaudio                           ram ra
+audio/x-pn-realaudio-plugin                    rmp
+audio/x-wav                                    wav
+chemical/x-cdx                                 cdx
+chemical/x-cif                                 cif
+chemical/x-cmdf                                        cmdf
+chemical/x-cml                                 cml
+chemical/x-csml                                        csml
+# chemical/x-pdb
+chemical/x-xyz                                 xyz
+image/bmp                                      bmp
+image/cgm                                      cgm
+# image/example
+# image/fits
+image/g3fax                                    g3
+image/gif                                      gif
+image/ief                                      ief
+# image/jp2
+image/jpeg                                     jpeg jpg jpe
+# image/jpm
+# image/jpx
+image/ktx                                      ktx
+# image/naplps
+image/png                                      png
+image/prs.btif                                 btif
+# image/prs.pti
+image/svg+xml                                  svg svgz
+# image/t38
+image/tiff                                     tiff tif
+# image/tiff-fx
+image/vnd.adobe.photoshop                      psd
+# image/vnd.cns.inf2
+image/vnd.dece.graphic                         uvi uvvi uvg uvvg
+image/vnd.dvb.subtitle                         sub
+image/vnd.djvu                                 djvu djv
+image/vnd.dwg                                  dwg
+image/vnd.dxf                                  dxf
+image/vnd.fastbidsheet                         fbs
+image/vnd.fpx                                  fpx
+image/vnd.fst                                  fst
+image/vnd.fujixerox.edmics-mmr                 mmr
+image/vnd.fujixerox.edmics-rlc                 rlc
+# image/vnd.globalgraphics.pgb
+# image/vnd.microsoft.icon
+# image/vnd.mix
+image/vnd.ms-modi                              mdi
+image/vnd.net-fpx                              npx
+# image/vnd.radiance
+# image/vnd.sealed.png
+# image/vnd.sealedmedia.softseal.gif
+# image/vnd.sealedmedia.softseal.jpg
+# image/vnd.svf
+image/vnd.wap.wbmp                             wbmp
+image/vnd.xiff                                 xif
+image/webp                                     webp
+image/x-cmu-raster                             ras
+image/x-cmx                                    cmx
+image/x-freehand                               fh fhc fh4 fh5 fh7
+image/x-icon                                   ico
+image/x-pcx                                    pcx
+image/x-pict                                   pic pct
+image/x-portable-anymap                                pnm
+image/x-portable-bitmap                                pbm
+image/x-portable-graymap                       pgm
+image/x-portable-pixmap                                ppm
+image/x-rgb                                    rgb
+image/x-xbitmap                                        xbm
+image/x-xpixmap                                        xpm
+image/x-xwindowdump                            xwd
+# message/cpim
+# message/delivery-status
+# message/disposition-notification
+# message/example
+# message/external-body
+# message/feedback-report
+# message/global
+# message/global-delivery-status
+# message/global-disposition-notification
+# message/global-headers
+# message/http
+# message/imdn+xml
+# message/news
+# message/partial
+message/rfc822                                 eml mime
+# message/s-http
+# message/sip
+# message/sipfrag
+# message/tracking-status
+# message/vnd.si.simp
+# model/example
+model/iges                                     igs iges
+model/mesh                                     msh mesh silo
+model/vnd.collada+xml                          dae
+model/vnd.dwf                                  dwf
+# model/vnd.flatland.3dml
+model/vnd.gdl                                  gdl
+# model/vnd.gs-gdl
+# model/vnd.gs.gdl
+model/vnd.gtw                                  gtw
+# model/vnd.moml+xml
+model/vnd.mts                                  mts
+# model/vnd.parasolid.transmit.binary
+# model/vnd.parasolid.transmit.text
+model/vnd.vtu                                  vtu
+model/vrml                                     wrl vrml
+# multipart/alternative
+# multipart/appledouble
+# multipart/byteranges
+# multipart/digest
+# multipart/encrypted
+# multipart/example
+# multipart/form-data
+# multipart/header-set
+# multipart/mixed
+# multipart/parallel
+# multipart/related
+# multipart/report
+# multipart/signed
+# multipart/voice-message
+# text/1d-interleaved-parityfec
+text/calendar                                  ics ifb
+text/css                                       css
+text/csv                                       csv
+# text/directory
+# text/dns
+# text/ecmascript
+# text/enriched
+# text/example
+# text/fwdred
+text/html                                      html htm
+# text/javascript
+text/n3                                                n3
+# text/parityfec
+text/plain                                     txt text conf def list log in
+# text/prs.fallenstein.rst
+text/prs.lines.tag                             dsc
+# text/vnd.radisys.msml-basic-layout
+# text/red
+# text/rfc822-headers
+text/richtext                                  rtx
+# text/rtf
+# text/rtp-enc-aescm128
+# text/rtx
+text/sgml                                      sgml sgm
+# text/t140
+text/tab-separated-values                      tsv
+text/troff                                     t tr roff man me ms
+text/turtle                                    ttl
+# text/ulpfec
+text/uri-list                                  uri uris urls
+text/vcard                                     vcard
+# text/vnd.abc
+text/vnd.curl                                  curl
+text/vnd.curl.dcurl                            dcurl
+text/vnd.curl.scurl                            scurl
+text/vnd.curl.mcurl                            mcurl
+# text/vnd.dmclientscript
+text/vnd.dvb.subtitle                          sub
+# text/vnd.esmertec.theme-descriptor
+text/vnd.fly                                   fly
+text/vnd.fmi.flexstor                          flx
+text/vnd.graphviz                              gv
+text/vnd.in3d.3dml                             3dml
+text/vnd.in3d.spot                             spot
+# text/vnd.iptc.newsml
+# text/vnd.iptc.nitf
+# text/vnd.latex-z
+# text/vnd.motorola.reflex
+# text/vnd.ms-mediapackage
+# text/vnd.net2phone.commcenter.command
+# text/vnd.si.uricatalogue
+text/vnd.sun.j2me.app-descriptor               jad
+# text/vnd.trolltech.linguist
+# text/vnd.wap.si
+# text/vnd.wap.sl
+text/vnd.wap.wml                               wml
+text/vnd.wap.wmlscript                         wmls
+text/x-asm                                     s asm
+text/x-c                                       c cc cxx cpp h hh dic
+text/x-fortran                                 f for f77 f90
+text/x-pascal                                  p pas
+text/x-java-source                             java
+text/x-setext                                  etx
+text/x-uuencode                                        uu
+text/x-vcalendar                               vcs
+text/x-vcard                                   vcf
+# text/xml
+# text/xml-external-parsed-entity
+# video/1d-interleaved-parityfec
+video/3gpp                                     3gp
+# video/3gpp-tt
+video/3gpp2                                    3g2
+# video/bmpeg
+# video/bt656
+# video/celb
+# video/dv
+# video/example
+video/h261                                     h261
+video/h263                                     h263
+# video/h263-1998
+# video/h263-2000
+video/h264                                     h264
+# video/h264-rcdo
+# video/h264-svc
+video/jpeg                                     jpgv
+# video/jpeg2000
+video/jpm                                      jpm jpgm
+video/mj2                                      mj2 mjp2
+# video/mp1s
+# video/mp2p
+# video/mp2t
+video/mp4                                      mp4 mp4v mpg4
+# video/mp4v-es
+video/mpeg                                     mpeg mpg mpe m1v m2v
+# video/mpeg4-generic
+# video/mpv
+# video/nv
+video/ogg                                      ogv
+# video/parityfec
+# video/pointer
+video/quicktime                                        qt mov
+# video/raw
+# video/rtp-enc-aescm128
+# video/rtx
+# video/smpte292m
+# video/ulpfec
+# video/vc1
+# video/vnd.cctv
+video/vnd.dece.hd                              uvh uvvh
+video/vnd.dece.mobile                          uvm uvvm
+# video/vnd.dece.mp4
+video/vnd.dece.pd                              uvp uvvp
+video/vnd.dece.sd                              uvs uvvs
+video/vnd.dece.video                           uvv uvvv
+# video/vnd.directv.mpeg
+# video/vnd.directv.mpeg-tts
+# video/vnd.dlna.mpeg-tts
+video/vnd.dvb.file                             dvb
+video/vnd.fvt                                  fvt
+# video/vnd.hns.video
+# video/vnd.iptvforum.1dparityfec-1010
+# video/vnd.iptvforum.1dparityfec-2005
+# video/vnd.iptvforum.2dparityfec-1010
+# video/vnd.iptvforum.2dparityfec-2005
+# video/vnd.iptvforum.ttsavc
+# video/vnd.iptvforum.ttsmpeg2
+# video/vnd.motorola.video
+# video/vnd.motorola.videop
+video/vnd.mpegurl                              mxu m4u
+video/vnd.ms-playready.media.pyv               pyv
+# video/vnd.nokia.interleaved-multimedia
+# video/vnd.nokia.videovoip
+# video/vnd.objectvideo
+# video/vnd.sealed.mpeg1
+# video/vnd.sealed.mpeg4
+# video/vnd.sealed.swf
+# video/vnd.sealedmedia.softseal.mov
+video/vnd.uvvu.mp4                             uvu uvvu
+video/vnd.vivo                                 viv
+video/webm                                     webm
+video/x-f4v                                    f4v
+video/x-fli                                    fli
+video/x-flv                                    flv
+video/x-m4v                                    m4v
+video/x-ms-asf                                 asf asx
+video/x-ms-wm                                  wm
+video/x-ms-wmv                                 wmv
+video/x-ms-wmx                                 wmx
+video/x-ms-wvx                                 wvx
+video/x-msvideo                                        avi
+video/x-sgi-movie                              movie
+x-conference/x-cooltalk                                ice
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/types/node.types b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/node_modules/mime/types/node.types
new file mode 100755 (executable)
index 0000000..b7fe8c0
--- /dev/null
@@ -0,0 +1,65 @@
+# What: Google Chrome Extension
+# Why: To allow apps to (work) be served with the right content type header.
+# http://codereview.chromium.org/2830017
+# Added by: niftylettuce
+application/x-chrome-extension  crx
+
+# What: OTF Message Silencer
+# Why: To silence the "Resource interpreted as font but transferred with MIME
+# type font/otf" message that occurs in Google Chrome
+# Added by: niftylettuce
+font/opentype  otf
+
+# What: HTC support
+# Why: To properly render .htc files such as CSS3PIE
+# Added by: niftylettuce
+text/x-component  htc
+
+# What: HTML5 application cache manifest
+# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
+# per https://developer.mozilla.org/en/offline_resources_in_firefox
+# Added by: louisremi
+text/cache-manifest  appcache manifest
+
+# What: node binary buffer format
+# Why: semi-standard extension w/in the node community
+# Added by: tootallnate
+application/octet-stream  buffer
+
+# What: The "protected" MP-4 formats used by iTunes.
+# Why: Required for streaming music to browsers (?)
+# Added by: broofa
+application/mp4  m4p
+audio/mp4  m4a
+
+# What: Music playlist format (http://en.wikipedia.org/wiki/M3U)
+# Why: See https://github.com/bentomas/node-mime/pull/6
+# Added by: mjrusso
+application/x-mpegURL  m3u8
+
+# What: Video format, Part of RFC1890
+# Why: See https://github.com/bentomas/node-mime/pull/6
+# Added by: mjrusso
+video/MP2T  ts
+
+# What: The FLAC lossless codec format
+# Why: Streaming and serving FLAC audio
+# Added by: jacobrask
+audio/flac  flac
+
+# What: EventSource mime type
+# Why: mime type of Server-Sent Events stream
+# http://www.w3.org/TR/eventsource/#text-event-stream
+# Added by: francois2metz
+text/event-stream  event-stream
+
+# What: Mozilla App manifest mime type
+# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests
+# Added by: ednapiranha
+application/x-web-app-manifest+json   webapp
+
+# What: Matroska Mime Types
+# Why: http://en.wikipedia.org/wiki/Matroska
+# Added by: aduncan88
+video/x-matroska    mkv
+audio/x-matroska    mka
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/node_modules/send/package.json
new file mode 100755 (executable)
index 0000000..6e03681
--- /dev/null
@@ -0,0 +1,51 @@
+{
+  "name": "send",
+  "version": "0.1.0",
+  "description": "Better streaming static file server with Range and conditional-GET support",
+  "keywords": [
+    "static",
+    "file",
+    "server"
+  ],
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "dependencies": {
+    "debug": "*",
+    "mime": "1.2.6",
+    "fresh": "0.1.0",
+    "range-parser": "0.0.4"
+  },
+  "devDependencies": {
+    "mocha": "*",
+    "should": "*",
+    "supertest": "0.0.1",
+    "connect": "2.x"
+  },
+  "scripts": {
+    "test": "make test"
+  },
+  "main": "index",
+  "_id": "send@0.1.0",
+  "dist": {
+    "shasum": "cfb08ebd3cec9b7fc1a37d9ff9e875a971cf4640",
+    "tarball": "http://registry.npmjs.org/send/-/send-0.1.0.tgz"
+  },
+  "_npmVersion": "1.1.61",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "cfb08ebd3cec9b7fc1a37d9ff9e875a971cf4640",
+  "_from": "send@0.1.0",
+  "_resolved": "https://registry.npmjs.org/send/-/send-0.1.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/express/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/express/package.json
new file mode 100755 (executable)
index 0000000..a4daf6c
--- /dev/null
@@ -0,0 +1,103 @@
+{
+  "name": "express",
+  "description": "Sinatra inspired web development framework",
+  "version": "3.2.3",
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "contributors": [
+    {
+      "name": "TJ Holowaychuk",
+      "email": "tj@vision-media.ca"
+    },
+    {
+      "name": "Aaron Heckmann",
+      "email": "aaron.heckmann+github@gmail.com"
+    },
+    {
+      "name": "Ciaran Jessup",
+      "email": "ciaranj@gmail.com"
+    },
+    {
+      "name": "Guillermo Rauch",
+      "email": "rauchg@gmail.com"
+    }
+  ],
+  "dependencies": {
+    "connect": "2.7.9",
+    "commander": "0.6.1",
+    "range-parser": "0.0.4",
+    "mkdirp": "0.3.4",
+    "cookie": "0.0.5",
+    "buffer-crc32": "0.2.1",
+    "fresh": "0.1.0",
+    "methods": "0.0.1",
+    "send": "0.1.0",
+    "cookie-signature": "1.0.1",
+    "debug": "*",
+    "qs": "0.6.4"
+  },
+  "devDependencies": {
+    "ejs": "*",
+    "mocha": "*",
+    "jade": "*",
+    "hjs": "*",
+    "stylus": "*",
+    "should": "*",
+    "connect-redis": "*",
+    "github-flavored-markdown": "*",
+    "supertest": "0.6.0"
+  },
+  "keywords": [
+    "express",
+    "framework",
+    "sinatra",
+    "web",
+    "rest",
+    "restful",
+    "router",
+    "app",
+    "api"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/visionmedia/express"
+  },
+  "main": "index",
+  "bin": {
+    "express": "./bin/express"
+  },
+  "scripts": {
+    "prepublish": "npm prune",
+    "test": "make test"
+  },
+  "engines": {
+    "node": "*"
+  },
+  "_id": "express@3.2.3",
+  "dist": {
+    "shasum": "9952eb764953ad40e4caa1f0b8715f7ba667f477",
+    "tarball": "http://registry.npmjs.org/express/-/express-3.2.3.tgz"
+  },
+  "_from": "express@3.2.3",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "9952eb764953ad40e4caa1f0b8715f7ba667f477",
+  "_resolved": "https://registry.npmjs.org/express/-/express-3.2.3.tgz",
+  "bugs": {
+    "url": "https://github.com/visionmedia/express/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/visionmedia/express"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/HISTORY.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/HISTORY.md
new file mode 100755 (executable)
index 0000000..4c7087d
--- /dev/null
@@ -0,0 +1,76 @@
+2015-02-02 / 1.3.1
+==================
+
+  * Fix regression where status can be overwritten in `createError` `props`
+
+2015-02-01 / 1.3.0
+==================
+
+  * Construct errors using defined constructors from `createError`
+  * Fix error names that are not identifiers
+    - `createError["I'mateapot"]` is now `createError.ImATeapot`
+  * Set a meaningful `name` property on constructed errors
+
+2014-12-09 / 1.2.8
+==================
+
+  * Fix stack trace from exported function
+  * Remove `arguments.callee` usage
+
+2014-10-14 / 1.2.7
+==================
+
+  * Remove duplicate line
+
+2014-10-02 / 1.2.6
+==================
+
+  * Fix `expose` to be `true` for `ClientError` constructor
+
+2014-09-28 / 1.2.5
+==================
+
+  * deps: statuses@1
+
+2014-09-21 / 1.2.4
+==================
+
+  * Fix dependency version to work with old `npm`s
+
+2014-09-21 / 1.2.3
+==================
+
+  * deps: statuses@~1.1.0
+
+2014-09-21 / 1.2.2
+==================
+
+  * Fix publish error
+
+2014-09-21 / 1.2.1
+==================
+
+  * Support Node.js 0.6
+  * Use `inherits` instead of `util`
+
+2014-09-09 / 1.2.0
+==================
+
+  * Fix the way inheriting functions
+  * Support `expose` being provided in properties argument
+
+2014-09-08 / 1.1.0
+==================
+
+  * Default status to 500
+  * Support provided `error` to extend
+
+2014-09-08 / 1.0.1
+==================
+
+  * Fix accepting string message
+
+2014-09-08 / 1.0.0
+==================
+
+  * Initial release
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/LICENSE
new file mode 100755 (executable)
index 0000000..a7ae8ee
--- /dev/null
@@ -0,0 +1,22 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong me@jongleberry.com
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/README.md
new file mode 100755 (executable)
index 0000000..520271e
--- /dev/null
@@ -0,0 +1,63 @@
+# http-errors
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Node.js Version][node-version-image]][node-version-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+
+Create HTTP errors for Express, Koa, Connect, etc. with ease.
+
+## Example
+
+```js
+var createError = require('http-errors');
+
+app.use(function (req, res, next) {
+  if (!req.user) return next(createError(401, 'Please login to view this page.'));
+  next();
+})
+```
+
+## API
+
+This is the current API, currently extracted from Koa and subject to change.
+
+### Error Properties
+
+- `message`
+- `status` and `statusCode` - the status code of the error, defaulting to `500`
+
+### createError([status], [message], [properties])
+
+```js
+var err = createError(404, 'This video does not exist!');
+```
+
+- `status: 500` - the status code as a number
+- `message` - the message of the error, defaulting to node's text for that status code.
+- `properties` - custom properties to attach to the object
+
+### new createError\[code || name\](\[msg]\))
+
+```js
+var err = new createError.NotFound();
+```
+
+- `code` - the status code as a number
+- `name` - the name of the error as a "bumpy case", i.e. `NotFound` or `InternalServerError`.
+
+## License
+
+[MIT](LICENSE)
+
+[npm-image]: https://img.shields.io/npm/v/http-errors.svg?style=flat
+[npm-url]: https://npmjs.org/package/http-errors
+[node-version-image]: https://img.shields.io/node/v/http-errors.svg?style=flat
+[node-version-url]: http://nodejs.org/download/
+[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat
+[travis-url]: https://travis-ci.org/jshttp/http-errors
+[coveralls-image]: https://img.shields.io/coveralls/jshttp/http-errors.svg?style=flat
+[coveralls-url]: https://coveralls.io/r/jshttp/http-errors
+[downloads-image]: https://img.shields.io/npm/dm/http-errors.svg?style=flat
+[downloads-url]: https://npmjs.org/package/http-errors
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/index.js
new file mode 100755 (executable)
index 0000000..d84b114
--- /dev/null
@@ -0,0 +1,120 @@
+
+var statuses = require('statuses');
+var inherits = require('inherits');
+
+function toIdentifier(str) {
+  return str.split(' ').map(function (token) {
+    return token.slice(0, 1).toUpperCase() + token.slice(1)
+  }).join('').replace(/[^ _0-9a-z]/gi, '')
+}
+
+exports = module.exports = function httpError() {
+  // so much arity going on ~_~
+  var err;
+  var msg;
+  var status = 500;
+  var props = {};
+  for (var i = 0; i < arguments.length; i++) {
+    var arg = arguments[i];
+    if (arg instanceof Error) {
+      err = arg;
+      status = err.status || err.statusCode || status;
+      continue;
+    }
+    switch (typeof arg) {
+      case 'string':
+        msg = arg;
+        break;
+      case 'number':
+        status = arg;
+        break;
+      case 'object':
+        props = arg;
+        break;
+    }
+  }
+
+  if (typeof status !== 'number' || !statuses[status]) {
+    status = 500
+  }
+
+  // constructor
+  var HttpError = exports[status]
+
+  if (!err) {
+    // create error
+    err = HttpError
+      ? new HttpError(msg)
+      : new Error(msg || statuses[status])
+    Error.captureStackTrace(err, httpError)
+  }
+
+  if (!HttpError || !(err instanceof HttpError)) {
+    // add properties to generic error
+    err.expose = status < 500
+    err.status = err.statusCode = status
+  }
+
+  for (var key in props) {
+    if (key !== 'status' && key !== 'statusCode') {
+      err[key] = props[key]
+    }
+  }
+
+  return err;
+};
+
+// create generic error objects
+var codes = statuses.codes.filter(function (num) {
+  return num >= 400;
+});
+
+codes.forEach(function (code) {
+  var name = toIdentifier(statuses[code])
+  var className = name.match(/Error$/) ? name : name + 'Error'
+
+  if (code >= 500) {
+    var ServerError = function ServerError(msg) {
+      var self = new Error(msg != null ? msg : statuses[code])
+      Error.captureStackTrace(self, ServerError)
+      self.__proto__ = ServerError.prototype
+      Object.defineProperty(self, 'name', {
+        enumerable: false,
+        configurable: true,
+        value: className,
+        writable: true
+      })
+      return self
+    }
+    inherits(ServerError, Error);
+    ServerError.prototype.status =
+    ServerError.prototype.statusCode = code;
+    ServerError.prototype.expose = false;
+    exports[code] =
+    exports[name] = ServerError
+    return;
+  }
+
+  var ClientError = function ClientError(msg) {
+    var self = new Error(msg != null ? msg : statuses[code])
+    Error.captureStackTrace(self, ClientError)
+    self.__proto__ = ClientError.prototype
+    Object.defineProperty(self, 'name', {
+      enumerable: false,
+      configurable: true,
+      value: className,
+      writable: true
+    })
+    return self
+  }
+  inherits(ClientError, Error);
+  ClientError.prototype.status =
+  ClientError.prototype.statusCode = code;
+  ClientError.prototype.expose = true;
+  exports[code] =
+  exports[name] = ClientError
+  return;
+});
+
+// backwards-compatibility
+exports["I'mateapot"] = exports.ImATeapot
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/LICENSE
new file mode 100755 (executable)
index 0000000..dea3013
--- /dev/null
@@ -0,0 +1,16 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/README.md
new file mode 100755 (executable)
index 0000000..b1c5665
--- /dev/null
@@ -0,0 +1,42 @@
+Browser-friendly inheritance fully compatible with standard node.js
+[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
+
+This package exports standard `inherits` from node.js `util` module in
+node environment, but also provides alternative browser-friendly
+implementation through [browser
+field](https://gist.github.com/shtylman/4339901). Alternative
+implementation is a literal copy of standard one located in standalone
+module to avoid requiring of `util`. It also has a shim for old
+browsers with no `Object.create` support.
+
+While keeping you sure you are using standard `inherits`
+implementation in node.js environment, it allows bundlers such as
+[browserify](https://github.com/substack/node-browserify) to not
+include full `util` package to your client code if all you need is
+just `inherits` function. It worth, because browser shim for `util`
+package is large and `inherits` is often the single function you need
+from it.
+
+It's recommended to use this package instead of
+`require('util').inherits` for any code that has chances to be used
+not only in node.js but in browser too.
+
+## usage
+
+```js
+var inherits = require('inherits');
+// then use exactly as the standard one
+```
+
+## note on version ~1.0
+
+Version ~1.0 had completely different motivation and is not compatible
+neither with 2.0 nor with standard node.js `inherits`.
+
+If you are using version ~1.0 and planning to switch to ~2.0, be
+careful:
+
+* new version uses `super_` instead of `super` for referencing
+  superclass
+* new version overwrites current prototype while old one preserves any
+  existing fields on it
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/inherits.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/inherits.js
new file mode 100755 (executable)
index 0000000..29f5e24
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('util').inherits
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/inherits_browser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/inherits_browser.js
new file mode 100755 (executable)
index 0000000..c1e78a7
--- /dev/null
@@ -0,0 +1,23 @@
+if (typeof Object.create === 'function') {
+  // implementation from standard node.js 'util' module
+  module.exports = function inherits(ctor, superCtor) {
+    ctor.super_ = superCtor
+    ctor.prototype = Object.create(superCtor.prototype, {
+      constructor: {
+        value: ctor,
+        enumerable: false,
+        writable: true,
+        configurable: true
+      }
+    });
+  };
+} else {
+  // old school shim for old browsers
+  module.exports = function inherits(ctor, superCtor) {
+    ctor.super_ = superCtor
+    var TempCtor = function () {}
+    TempCtor.prototype = superCtor.prototype
+    ctor.prototype = new TempCtor()
+    ctor.prototype.constructor = ctor
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/package.json
new file mode 100755 (executable)
index 0000000..3d69f4f
--- /dev/null
@@ -0,0 +1,51 @@
+{
+  "name": "inherits",
+  "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
+  "version": "2.0.1",
+  "keywords": [
+    "inheritance",
+    "class",
+    "klass",
+    "oop",
+    "object-oriented",
+    "inherits",
+    "browser",
+    "browserify"
+  ],
+  "main": "./inherits.js",
+  "browser": "./inherits_browser.js",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/inherits"
+  },
+  "license": "ISC",
+  "scripts": {
+    "test": "node test"
+  },
+  "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n  superclass\n* new version overwrites current prototype while old one preserves any\n  existing fields on it\n",
+  "readmeFilename": "README.md",
+  "bugs": {
+    "url": "https://github.com/isaacs/inherits/issues"
+  },
+  "_id": "inherits@2.0.1",
+  "dist": {
+    "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
+    "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
+  },
+  "_from": "inherits@~2.0.1",
+  "_npmVersion": "1.3.8",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "directories": {},
+  "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
+  "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
+  "homepage": "https://github.com/isaacs/inherits"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/inherits/test.js
new file mode 100755 (executable)
index 0000000..fc53012
--- /dev/null
@@ -0,0 +1,25 @@
+var inherits = require('./inherits.js')
+var assert = require('assert')
+
+function test(c) {
+  assert(c.constructor === Child)
+  assert(c.constructor.super_ === Parent)
+  assert(Object.getPrototypeOf(c) === Child.prototype)
+  assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
+  assert(c instanceof Child)
+  assert(c instanceof Parent)
+}
+
+function Child() {
+  Parent.call(this)
+  test(this)
+}
+
+function Parent() {}
+
+inherits(Child, Parent)
+
+var c = new Child
+test(c)
+
+console.log('ok')
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/LICENSE
new file mode 100755 (executable)
index 0000000..a7ae8ee
--- /dev/null
@@ -0,0 +1,22 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong me@jongleberry.com
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/README.md
new file mode 100755 (executable)
index 0000000..f6ae24c
--- /dev/null
@@ -0,0 +1,114 @@
+# Statuses
+
+[![NPM Version][npm-image]][npm-url]
+[![NPM Downloads][downloads-image]][downloads-url]
+[![Node.js Version][node-version-image]][node-version-url]
+[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+
+HTTP status utility for node.
+
+## API
+
+```js
+var status = require('statuses');
+```
+
+### var code = status(Integer || String)
+
+If `Integer` or `String` is a valid HTTP code or status message, then the appropriate `code` will be returned. Otherwise, an error will be thrown.
+
+```js
+status(403) // => 'Forbidden'
+status('403') // => 'Forbidden'
+status('forbidden') // => 403
+status('Forbidden') // => 403
+status(306) // throws, as it's not supported by node.js
+```
+
+### status.codes
+
+Returns an array of all the status codes as `Integer`s.
+
+### var msg = status[code]
+
+Map of `code` to `status message`. `undefined` for invalid `code`s.
+
+```js
+status[404] // => 'Not Found'
+```
+
+### var code = status[msg]
+
+Map of `status message` to `code`. `msg` can either be title-cased or lower-cased. `undefined` for invalid `status message`s.
+
+```js
+status['not found'] // => 404
+status['Not Found'] // => 404
+```
+
+### status.redirect[code]
+
+Returns `true` if a status code is a valid redirect status.
+
+```js
+status.redirect[200] // => undefined
+status.redirect[301] // => true
+```
+
+### status.empty[code]
+
+Returns `true` if a status code expects an empty body.
+
+```js
+status.empty[200] // => undefined
+status.empty[204] // => true
+status.empty[304] // => true
+```
+
+### status.retry[code]
+
+Returns `true` if you should retry the rest.
+
+```js
+status.retry[501] // => undefined
+status.retry[503] // => true
+```
+
+### statuses/codes.json
+
+```js
+var codes = require('statuses/codes.json');
+```
+
+This is a JSON file of the status codes
+taken from `require('http').STATUS_CODES`.
+This is saved so that codes are consistent even in older node.js versions.
+For example, `308` will be added in v0.12.
+
+## Adding Status Codes
+
+The status codes are primarily sourced from http://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv.
+Additionally, custom codes are added from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes.
+These are added manually in the `lib/*.json` files.
+If you would like to add a status code, add it to the appropriate JSON file.
+
+To rebuild `codes.json`, run the following:
+
+```bash
+# update src/iana.json
+npm run update
+# build codes.json
+npm run build
+```
+
+[npm-image]: https://img.shields.io/npm/v/statuses.svg?style=flat
+[npm-url]: https://npmjs.org/package/statuses
+[node-version-image]: http://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
+[node-version-url]: http://nodejs.org/download/
+[travis-image]: https://img.shields.io/travis/jshttp/statuses.svg?style=flat
+[travis-url]: https://travis-ci.org/jshttp/statuses
+[coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg?style=flat
+[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
+[downloads-image]: http://img.shields.io/npm/dm/statuses.svg?style=flat
+[downloads-url]: https://npmjs.org/package/statuses
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/codes.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/codes.json
new file mode 100755 (executable)
index 0000000..4c45a88
--- /dev/null
@@ -0,0 +1,64 @@
+{
+  "100": "Continue",
+  "101": "Switching Protocols",
+  "102": "Processing",
+  "200": "OK",
+  "201": "Created",
+  "202": "Accepted",
+  "203": "Non-Authoritative Information",
+  "204": "No Content",
+  "205": "Reset Content",
+  "206": "Partial Content",
+  "207": "Multi-Status",
+  "208": "Already Reported",
+  "226": "IM Used",
+  "300": "Multiple Choices",
+  "301": "Moved Permanently",
+  "302": "Found",
+  "303": "See Other",
+  "304": "Not Modified",
+  "305": "Use Proxy",
+  "306": "(Unused)",
+  "307": "Temporary Redirect",
+  "308": "Permanent Redirect",
+  "400": "Bad Request",
+  "401": "Unauthorized",
+  "402": "Payment Required",
+  "403": "Forbidden",
+  "404": "Not Found",
+  "405": "Method Not Allowed",
+  "406": "Not Acceptable",
+  "407": "Proxy Authentication Required",
+  "408": "Request Timeout",
+  "409": "Conflict",
+  "410": "Gone",
+  "411": "Length Required",
+  "412": "Precondition Failed",
+  "413": "Payload Too Large",
+  "414": "URI Too Long",
+  "415": "Unsupported Media Type",
+  "416": "Range Not Satisfiable",
+  "417": "Expectation Failed",
+  "418": "I'm a teapot",
+  "422": "Unprocessable Entity",
+  "423": "Locked",
+  "424": "Failed Dependency",
+  "425": "Unordered Collection",
+  "426": "Upgrade Required",
+  "428": "Precondition Required",
+  "429": "Too Many Requests",
+  "431": "Request Header Fields Too Large",
+  "451": "Unavailable For Legal Reasons",
+  "500": "Internal Server Error",
+  "501": "Not Implemented",
+  "502": "Bad Gateway",
+  "503": "Service Unavailable",
+  "504": "Gateway Timeout",
+  "505": "HTTP Version Not Supported",
+  "506": "Variant Also Negotiates",
+  "507": "Insufficient Storage",
+  "508": "Loop Detected",
+  "509": "Bandwidth Limit Exceeded",
+  "510": "Not Extended",
+  "511": "Network Authentication Required"
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/index.js
new file mode 100755 (executable)
index 0000000..b06182d
--- /dev/null
@@ -0,0 +1,60 @@
+
+var codes = require('./codes.json');
+
+module.exports = status;
+
+// [Integer...]
+status.codes = Object.keys(codes).map(function (code) {
+  code = ~~code;
+  var msg = codes[code];
+  status[code] = msg;
+  status[msg] = status[msg.toLowerCase()] = code;
+  return code;
+});
+
+// status codes for redirects
+status.redirect = {
+  300: true,
+  301: true,
+  302: true,
+  303: true,
+  305: true,
+  307: true,
+  308: true,
+};
+
+// status codes for empty bodies
+status.empty = {
+  204: true,
+  205: true,
+  304: true,
+};
+
+// status codes for when you should retry the request
+status.retry = {
+  502: true,
+  503: true,
+  504: true,
+};
+
+function status(code) {
+  if (typeof code === 'number') {
+    if (!status[code]) throw new Error('invalid status code: ' + code);
+    return code;
+  }
+
+  if (typeof code !== 'string') {
+    throw new TypeError('code must be a number or string');
+  }
+
+  // '403'
+  var n = parseInt(code, 10)
+  if (!isNaN(n)) {
+    if (!status[n]) throw new Error('invalid status code: ' + n);
+    return n;
+  }
+
+  n = status[code.toLowerCase()];
+  if (!n) throw new Error('invalid status message: "' + code + '"');
+  return n;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/node_modules/statuses/package.json
new file mode 100755 (executable)
index 0000000..8272034
--- /dev/null
@@ -0,0 +1,84 @@
+{
+  "name": "statuses",
+  "description": "HTTP status utility",
+  "version": "1.2.1",
+  "author": {
+    "name": "Jonathan Ong",
+    "email": "me@jongleberry.com",
+    "url": "http://jongleberry.com"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/jshttp/statuses"
+  },
+  "license": "MIT",
+  "keywords": [
+    "http",
+    "status",
+    "code"
+  ],
+  "files": [
+    "index.js",
+    "codes.json",
+    "LICENSE"
+  ],
+  "devDependencies": {
+    "csv-parse": "0.0.6",
+    "istanbul": "0",
+    "mocha": "1",
+    "stream-to-array": "2"
+  },
+  "scripts": {
+    "build": "node scripts/build.js",
+    "update": "node scripts/update.js",
+    "test": "mocha --reporter spec --bail --check-leaks",
+    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks",
+    "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks"
+  },
+  "gitHead": "49e6ac7ae4c63ee8186f56cb52112a7eeda28ed7",
+  "bugs": {
+    "url": "https://github.com/jshttp/statuses/issues"
+  },
+  "homepage": "https://github.com/jshttp/statuses",
+  "_id": "statuses@1.2.1",
+  "_shasum": "dded45cc18256d51ed40aec142489d5c61026d28",
+  "_from": "statuses@1",
+  "_npmVersion": "1.4.28",
+  "_npmUser": {
+    "name": "dougwilson",
+    "email": "doug@somethingdoug.com"
+  },
+  "maintainers": [
+    {
+      "name": "jongleberry",
+      "email": "jonathanrichardong@gmail.com"
+    },
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    },
+    {
+      "name": "dougwilson",
+      "email": "doug@somethingdoug.com"
+    },
+    {
+      "name": "shtylman",
+      "email": "shtylman@gmail.com"
+    },
+    {
+      "name": "mscdex",
+      "email": "mscdex@mscdex.net"
+    },
+    {
+      "name": "fishrock123",
+      "email": "fishrock123@rocketmail.com"
+    }
+  ],
+  "dist": {
+    "shasum": "dded45cc18256d51ed40aec142489d5c61026d28",
+    "tarball": "http://registry.npmjs.org/statuses/-/statuses-1.2.1.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.2.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/http-errors/package.json
new file mode 100755 (executable)
index 0000000..f636fb2
--- /dev/null
@@ -0,0 +1,85 @@
+{
+  "name": "http-errors",
+  "description": "Create HTTP error objects",
+  "version": "1.3.1",
+  "author": {
+    "name": "Jonathan Ong",
+    "email": "me@jongleberry.com",
+    "url": "http://jongleberry.com"
+  },
+  "contributors": [
+    {
+      "name": "Alan Plum",
+      "email": "me@pluma.io"
+    },
+    {
+      "name": "Douglas Christopher Wilson",
+      "email": "doug@somethingdoug.com"
+    }
+  ],
+  "license": "MIT",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/jshttp/http-errors"
+  },
+  "dependencies": {
+    "inherits": "~2.0.1",
+    "statuses": "1"
+  },
+  "devDependencies": {
+    "istanbul": "0",
+    "mocha": "1"
+  },
+  "engines": {
+    "node": ">= 0.6"
+  },
+  "scripts": {
+    "test": "mocha --reporter spec --bail",
+    "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
+    "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
+  },
+  "keywords": [
+    "http",
+    "error"
+  ],
+  "files": [
+    "index.js",
+    "HISTORY.md",
+    "LICENSE",
+    "README.md"
+  ],
+  "gitHead": "89a8502b40d5dd42da2908f265275e2eeb8d0699",
+  "bugs": {
+    "url": "https://github.com/jshttp/http-errors/issues"
+  },
+  "homepage": "https://github.com/jshttp/http-errors",
+  "_id": "http-errors@1.3.1",
+  "_shasum": "197e22cdebd4198585e8694ef6786197b91ed942",
+  "_from": "http-errors@^1.2.5",
+  "_npmVersion": "1.4.28",
+  "_npmUser": {
+    "name": "dougwilson",
+    "email": "doug@somethingdoug.com"
+  },
+  "maintainers": [
+    {
+      "name": "egeste",
+      "email": "npm@egeste.net"
+    },
+    {
+      "name": "jongleberry",
+      "email": "jonathanrichardong@gmail.com"
+    },
+    {
+      "name": "dougwilson",
+      "email": "doug@somethingdoug.com"
+    }
+  ],
+  "dist": {
+    "shasum": "197e22cdebd4198585e8694ef6786197b91ed942",
+    "tarball": "http://registry.npmjs.org/http-errors/-/http-errors-1.3.1.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.3.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/LICENSE.txt b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/LICENSE.txt
new file mode 100755 (executable)
index 0000000..49869bb
--- /dev/null
@@ -0,0 +1,22 @@
+Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/README.md
new file mode 100755 (executable)
index 0000000..6f9598e
--- /dev/null
@@ -0,0 +1,163 @@
+# Lo-Dash v2.4.1
+A utility library delivering consistency, [customization](http://lodash.com/custom-builds), [performance](http://lodash.com/benchmarks), & [extras](http://lodash.com/#features).
+
+## Download
+
+Check out our [wiki]([https://github.com/lodash/lodash/wiki/build-differences]) for details over the differences between builds.
+
+* Modern builds perfect for newer browsers/environments:<br>
+[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.js) &
+[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.min.js)
+
+* Compatibility builds for older environment support too:<br>
+[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.compat.js) &
+[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.compat.min.js)
+
+* Underscore builds to use as a drop-in replacement:<br>
+[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.underscore.js) &
+[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.underscore.min.js)
+
+CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash). For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed.
+
+Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-es6](https://github.com/lodash/lodash-es6), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method.
+
+## Dive in
+
+There’s plenty of **[documentation](http://lodash.com/docs)**, [unit tests](http://lodash.com/tests), & [benchmarks](http://lodash.com/benchmarks).<br>
+Check out <a href="http://devdocs.io/lodash/">DevDocs</a> as a fast, organized, & searchable interface for our documentation.
+
+The full changelog for this release is available on our [wiki](https://github.com/lodash/lodash/wiki/Changelog).<br>
+A list of upcoming features is available on our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap).
+
+## Features *not* in Underscore
+
+ * AMD loader support ([curl](https://github.com/cujojs/curl), [dojo](http://dojotoolkit.org/), [requirejs](http://requirejs.org/), etc.)
+ * [_(…)](http://lodash.com/docs#_) supports intuitive chaining
+ * [_.at](http://lodash.com/docs#at) for cherry-picking collection values
+ * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
+ * [_.clone](http://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
+ * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
+ * [_.constant](http://lodash.com/docs#constant) & [_.property](http://lodash.com/docs#property) function generators for composing functions
+ * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex`
+ * [_.create](http://lodash.com/docs#create) for easier object inheritance
+ * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins
+ * [_.curry](http://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions
+ * [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept additional `options` for more control
+ * [_.findIndex](http://lodash.com/docs#findIndex) & [_.findKey](http://lodash.com/docs#findKey) for finding indexes & keys
+ * [_.forEach](http://lodash.com/docs#forEach) is chainable & supports exiting early
+ * [_.forIn](http://lodash.com/docs#forIn) for iterating own & inherited properties
+ * [_.forOwn](http://lodash.com/docs#forOwn) for iterating own properties
+ * [_.isPlainObject](http://lodash.com/docs#isPlainObject) for checking if values are created by `Object`
+ * [_.mapValues](http://lodash.com/docs#mapValues) for [mapping](http://lodash.com/docs#map) values to an object
+ * [_.memoize](http://lodash.com/docs#memoize) exposes the `cache` of memoized functions
+ * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend)
+ * [_.noop](http://lodash.com/docs#noop) for function placeholders
+ * [_.now](http://lodash.com/docs#now) as a cross-browser `Date.now` alternative
+ * [_.parseInt](http://lodash.com/docs#parseInt) for consistent behavior
+ * [_.pull](http://lodash.com/docs#pull) & [_.remove](http://lodash.com/docs#remove) for mutating arrays
+ * [_.random](http://lodash.com/docs#random) supports returning floating-point numbers
+ * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking
+ * [_.sortBy](http://lodash.com/docs#sortBy) supports sorting by multiple properties
+ * [_.support](http://lodash.com/docs#support) for flagging environment features
+ * [_.template](http://lodash.com/docs#template) supports [*“imports”*](http://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals)
+ * [_.transform](http://lodash.com/docs#transform) as a powerful alternative to [_.reduce](http://lodash.com/docs#reduce) for transforming objects
+ * [_.where](http://lodash.com/docs#where) supports deep object comparisons
+ * [_.xor](http://lodash.com/docs#xor) as a companion to [_.difference](http://lodash.com/docs#difference), [_.intersection](http://lodash.com/docs#intersection), & [_.union](http://lodash.com/docs#union)
+ * [_.zip](http://lodash.com/docs#zip) is capable of unzipping values
+ * [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick), &
+   [more](http://lodash.com/docs "_.assign, _.clone, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept callbacks
+ * [_.contains](http://lodash.com/docs#contains), [_.toArray](http://lodash.com/docs#toArray), &
+   [more](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.forEachRight, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.where") accept strings
+ * [_.filter](http://lodash.com/docs#filter), [_.map](http://lodash.com/docs#map), &
+   [more](http://lodash.com/docs "_.countBy, _.every, _.find, _.findKey, _.findLast, _.findLastIndex, _.findLastKey, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* & *“_.where”* shorthands
+ * [_.findLast](http://lodash.com/docs#findLast), [_.findLastIndex](http://lodash.com/docs#findLastIndex), &
+   [more](http://lodash.com/docs "_.findLastKey, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods
+
+## Resources
+
+ * Podcasts
+  - [JavaScript Jabber](http://javascriptjabber.com/079-jsj-lo-dash-with-john-david-dalton/)
+
+ * Posts
+  - [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/)
+  - [Custom builds in Lo-Dash 2.0](http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/)
+
+ * Videos
+  - [Introduction](https://vimeo.com/44154599)
+  - [Origins](https://vimeo.com/44154600)
+  - [Optimizations & builds](https://vimeo.com/44154601)
+  - [Native method use](https://vimeo.com/48576012)
+  - [Testing](https://vimeo.com/45865290)
+  - [CascadiaJS ’12](http://www.youtube.com/watch?v=dpPy4f_SeEk)
+
+ A list of other community created podcasts, posts, & videos is available on our [wiki](https://github.com/lodash/lodash/wiki/Resources).
+
+## Support
+
+Tested in Chrome 5~31, Firefox 2~25, IE 6-11, Opera 9.25~17, Safari 3-7, Node.js 0.6.21~0.10.22, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5.<br>
+Automated browser test results [are available](https://saucelabs.com/u/lodash) as well as [Travis CI](https://travis-ci.org/) builds for [lodash](https://travis-ci.org/lodash/lodash/), [lodash-cli](https://travis-ci.org/lodash/lodash-cli/), [lodash-amd](https://travis-ci.org/lodash/lodash-amd/), [lodash-node](https://travis-ci.org/lodash/lodash-node/), & [grunt-lodash](https://travis-ci.org/lodash/grunt-lodash).
+
+Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.<br>
+[![Sauce Labs](http://lodash.com/_img/sauce.png)](https://saucelabs.com/ "Sauce Labs: Selenium Testing & More")
+
+## Installation & usage
+
+In browsers:
+
+```html
+<script src="lodash.js"></script>
+```
+
+Using [`npm`](http://npmjs.org/):
+
+```bash
+npm i --save lodash
+
+{sudo} npm i -g lodash
+npm ln lodash
+```
+
+In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/):
+
+```js
+var _ = require('lodash');
+// or as Underscore
+var _ = require('lodash/dist/lodash.underscore');
+```
+
+**Notes:**
+ * Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL
+ * If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it
+
+In [Rhino](http://www.mozilla.org/rhino/):
+
+```js
+load('lodash.js');
+```
+
+In an AMD loader:
+
+```js
+require({
+  'packages': [
+    { 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' }
+  ]
+},
+['lodash'], function(_) {
+  console.log(_.VERSION);
+});
+```
+
+## Author
+
+| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |
+|---|
+| [John-David Dalton](http://allyoucanleet.com/) |
+
+## Contributors
+
+| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](https://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
+|---|---|---|
+| [Blaine Bublitz](http://www.iceddev.com/) | [Kit Cambridge](http://kitcambridge.be/) | [Mathias Bynens](http://mathiasbynens.be/) |
+
+[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lodash/lodash/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.compat.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.compat.js
new file mode 100755 (executable)
index 0000000..23798ba
--- /dev/null
@@ -0,0 +1,7157 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
+ * Build: `lodash -o ./dist/lodash.compat.js`
+ * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+ * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
+ * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license <http://lodash.com/license>
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre ES5 environments */
+  var undefined;
+
+  /** Used to pool arrays and objects used internally */
+  var arrayPool = [],
+      objectPool = [];
+
+  /** Used to generate unique IDs */
+  var idCounter = 0;
+
+  /** Used internally to indicate various things */
+  var indicatorObject = {};
+
+  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
+  var keyPrefix = +new Date + '';
+
+  /** Used as the size when optimizations are enabled for large arrays */
+  var largeArraySize = 75;
+
+  /** Used as the max size of the `arrayPool` and `objectPool` */
+  var maxPoolSize = 40;
+
+  /** Used to detect and test whitespace */
+  var whitespace = (
+    // whitespace
+    ' \t\x0B\f\xA0\ufeff' +
+
+    // line terminators
+    '\n\r\u2028\u2029' +
+
+    // unicode category "Zs" space separators
+    '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
+  );
+
+  /** Used to match empty string literals in compiled template source */
+  var reEmptyStringLeading = /\b__p \+= '';/g,
+      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+  /**
+   * Used to match ES6 template delimiters
+   * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals
+   */
+  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+  /** Used to match regexp flags from their coerced string values */
+  var reFlags = /\w*$/;
+
+  /** Used to detected named functions */
+  var reFuncName = /^\s*function[ \n\r\t]+\w/;
+
+  /** Used to match "interpolate" template delimiters */
+  var reInterpolate = /<%=([\s\S]+?)%>/g;
+
+  /** Used to match leading whitespace and zeros to be removed */
+  var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
+
+  /** Used to ensure capturing order of template delimiters */
+  var reNoMatch = /($^)/;
+
+  /** Used to detect functions containing a `this` reference */
+  var reThis = /\bthis\b/;
+
+  /** Used to match unescaped characters in compiled string literals */
+  var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
+
+  /** Used to assign default `context` object properties */
+  var contextProps = [
+    'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object',
+    'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',
+    'parseInt', 'setTimeout'
+  ];
+
+  /** Used to fix the JScript [[DontEnum]] bug */
+  var shadowedProps = [
+    'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
+    'toLocaleString', 'toString', 'valueOf'
+  ];
+
+  /** Used to make template sourceURLs easier to identify */
+  var templateCounter = 0;
+
+  /** `Object#toString` result shortcuts */
+  var argsClass = '[object Arguments]',
+      arrayClass = '[object Array]',
+      boolClass = '[object Boolean]',
+      dateClass = '[object Date]',
+      errorClass = '[object Error]',
+      funcClass = '[object Function]',
+      numberClass = '[object Number]',
+      objectClass = '[object Object]',
+      regexpClass = '[object RegExp]',
+      stringClass = '[object String]';
+
+  /** Used to identify object classifications that `_.clone` supports */
+  var cloneableClasses = {};
+  cloneableClasses[funcClass] = false;
+  cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
+  cloneableClasses[boolClass] = cloneableClasses[dateClass] =
+  cloneableClasses[numberClass] = cloneableClasses[objectClass] =
+  cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
+
+  /** Used as an internal `_.debounce` options object */
+  var debounceOptions = {
+    'leading': false,
+    'maxWait': 0,
+    'trailing': false
+  };
+
+  /** Used as the property descriptor for `__bindData__` */
+  var descriptor = {
+    'configurable': false,
+    'enumerable': false,
+    'value': null,
+    'writable': false
+  };
+
+  /** Used as the data object for `iteratorTemplate` */
+  var iteratorData = {
+    'args': '',
+    'array': null,
+    'bottom': '',
+    'firstArg': '',
+    'init': '',
+    'keys': null,
+    'loop': '',
+    'shadowedProps': null,
+    'support': null,
+    'top': '',
+    'useHas': false
+  };
+
+  /** Used to determine if values are of the language type Object */
+  var objectTypes = {
+    'boolean': false,
+    'function': true,
+    'object': true,
+    'number': false,
+    'string': false,
+    'undefined': false
+  };
+
+  /** Used to escape characters for inclusion in compiled string literals */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\t': 't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  /** Used as a reference to the global object */
+  var root = (objectTypes[typeof window] && window) || this;
+
+  /** Detect free variable `exports` */
+  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module` */
+  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
+
+  /** Detect the popular CommonJS extension `module.exports` */
+  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+
+  /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
+  var freeGlobal = objectTypes[typeof global] && global;
+  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
+    root = freeGlobal;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * The base implementation of `_.indexOf` without support for binary searches
+   * or `fromIndex` constraints.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {number} Returns the index of the matched value or `-1`.
+   */
+  function baseIndexOf(array, value, fromIndex) {
+    var index = (fromIndex || 0) - 1,
+        length = array ? array.length : 0;
+
+    while (++index < length) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * An implementation of `_.contains` for cache objects that mimics the return
+   * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
+   *
+   * @private
+   * @param {Object} cache The cache object to inspect.
+   * @param {*} value The value to search for.
+   * @returns {number} Returns `0` if `value` is found, else `-1`.
+   */
+  function cacheIndexOf(cache, value) {
+    var type = typeof value;
+    cache = cache.cache;
+
+    if (type == 'boolean' || value == null) {
+      return cache[value] ? 0 : -1;
+    }
+    if (type != 'number' && type != 'string') {
+      type = 'object';
+    }
+    var key = type == 'number' ? value : keyPrefix + value;
+    cache = (cache = cache[type]) && cache[key];
+
+    return type == 'object'
+      ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)
+      : (cache ? 0 : -1);
+  }
+
+  /**
+   * Adds a given value to the corresponding cache object.
+   *
+   * @private
+   * @param {*} value The value to add to the cache.
+   */
+  function cachePush(value) {
+    var cache = this.cache,
+        type = typeof value;
+
+    if (type == 'boolean' || value == null) {
+      cache[value] = true;
+    } else {
+      if (type != 'number' && type != 'string') {
+        type = 'object';
+      }
+      var key = type == 'number' ? value : keyPrefix + value,
+          typeCache = cache[type] || (cache[type] = {});
+
+      if (type == 'object') {
+        (typeCache[key] || (typeCache[key] = [])).push(value);
+      } else {
+        typeCache[key] = true;
+      }
+    }
+  }
+
+  /**
+   * Used by `_.max` and `_.min` as the default callback when a given
+   * collection is a string value.
+   *
+   * @private
+   * @param {string} value The character to inspect.
+   * @returns {number} Returns the code unit of given character.
+   */
+  function charAtCallback(value) {
+    return value.charCodeAt(0);
+  }
+
+  /**
+   * Used by `sortBy` to compare transformed `collection` elements, stable sorting
+   * them in ascending order.
+   *
+   * @private
+   * @param {Object} a The object to compare to `b`.
+   * @param {Object} b The object to compare to `a`.
+   * @returns {number} Returns the sort order indicator of `1` or `-1`.
+   */
+  function compareAscending(a, b) {
+    var ac = a.criteria,
+        bc = b.criteria,
+        index = -1,
+        length = ac.length;
+
+    while (++index < length) {
+      var value = ac[index],
+          other = bc[index];
+
+      if (value !== other) {
+        if (value > other || typeof value == 'undefined') {
+          return 1;
+        }
+        if (value < other || typeof other == 'undefined') {
+          return -1;
+        }
+      }
+    }
+    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+    // that causes it, under certain circumstances, to return the same value for
+    // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247
+    //
+    // This also ensures a stable sort in V8 and other engines.
+    // See http://code.google.com/p/v8/issues/detail?id=90
+    return a.index - b.index;
+  }
+
+  /**
+   * Creates a cache object to optimize linear searches of large arrays.
+   *
+   * @private
+   * @param {Array} [array=[]] The array to search.
+   * @returns {null|Object} Returns the cache object or `null` if caching should not be used.
+   */
+  function createCache(array) {
+    var index = -1,
+        length = array.length,
+        first = array[0],
+        mid = array[(length / 2) | 0],
+        last = array[length - 1];
+
+    if (first && typeof first == 'object' &&
+        mid && typeof mid == 'object' && last && typeof last == 'object') {
+      return false;
+    }
+    var cache = getObject();
+    cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
+
+    var result = getObject();
+    result.array = array;
+    result.cache = cache;
+    result.push = cachePush;
+
+    while (++index < length) {
+      result.push(array[index]);
+    }
+    return result;
+  }
+
+  /**
+   * Used by `template` to escape characters for inclusion in compiled
+   * string literals.
+   *
+   * @private
+   * @param {string} match The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeStringChar(match) {
+    return '\\' + stringEscapes[match];
+  }
+
+  /**
+   * Gets an array from the array pool or creates a new one if the pool is empty.
+   *
+   * @private
+   * @returns {Array} The array from the pool.
+   */
+  function getArray() {
+    return arrayPool.pop() || [];
+  }
+
+  /**
+   * Gets an object from the object pool or creates a new one if the pool is empty.
+   *
+   * @private
+   * @returns {Object} The object from the pool.
+   */
+  function getObject() {
+    return objectPool.pop() || {
+      'array': null,
+      'cache': null,
+      'criteria': null,
+      'false': false,
+      'index': 0,
+      'null': false,
+      'number': null,
+      'object': null,
+      'push': null,
+      'string': null,
+      'true': false,
+      'undefined': false,
+      'value': null
+    };
+  }
+
+  /**
+   * Checks if `value` is a DOM node in IE < 9.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a DOM node, else `false`.
+   */
+  function isNode(value) {
+    // IE < 9 presents DOM nodes as `Object` objects except they have `toString`
+    // methods that are `typeof` "string" and still can coerce nodes to strings
+    return typeof value.toString != 'function' && typeof (value + '') == 'string';
+  }
+
+  /**
+   * Releases the given array back to the array pool.
+   *
+   * @private
+   * @param {Array} [array] The array to release.
+   */
+  function releaseArray(array) {
+    array.length = 0;
+    if (arrayPool.length < maxPoolSize) {
+      arrayPool.push(array);
+    }
+  }
+
+  /**
+   * Releases the given object back to the object pool.
+   *
+   * @private
+   * @param {Object} [object] The object to release.
+   */
+  function releaseObject(object) {
+    var cache = object.cache;
+    if (cache) {
+      releaseObject(cache);
+    }
+    object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;
+    if (objectPool.length < maxPoolSize) {
+      objectPool.push(object);
+    }
+  }
+
+  /**
+   * Slices the `collection` from the `start` index up to, but not including,
+   * the `end` index.
+   *
+   * Note: This function is used instead of `Array#slice` to support node lists
+   * in IE < 9 and to ensure dense arrays are returned.
+   *
+   * @private
+   * @param {Array|Object|string} collection The collection to slice.
+   * @param {number} start The start index.
+   * @param {number} end The end index.
+   * @returns {Array} Returns the new array.
+   */
+  function slice(array, start, end) {
+    start || (start = 0);
+    if (typeof end == 'undefined') {
+      end = array ? array.length : 0;
+    }
+    var index = -1,
+        length = end - start || 0,
+        result = Array(length < 0 ? 0 : length);
+
+    while (++index < length) {
+      result[index] = array[start + index];
+    }
+    return result;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Create a new `lodash` function using the given context object.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {Object} [context=root] The context object.
+   * @returns {Function} Returns the `lodash` function.
+   */
+  function runInContext(context) {
+    // Avoid issues with some ES3 environments that attempt to use values, named
+    // after built-in constructors like `Object`, for the creation of literals.
+    // ES5 clears this up by stating that literals must use built-in constructors.
+    // See http://es5.github.io/#x11.1.5.
+    context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
+
+    /** Native constructor references */
+    var Array = context.Array,
+        Boolean = context.Boolean,
+        Date = context.Date,
+        Error = context.Error,
+        Function = context.Function,
+        Math = context.Math,
+        Number = context.Number,
+        Object = context.Object,
+        RegExp = context.RegExp,
+        String = context.String,
+        TypeError = context.TypeError;
+
+    /**
+     * Used for `Array` method references.
+     *
+     * Normally `Array.prototype` would suffice, however, using an array literal
+     * avoids issues in Narwhal.
+     */
+    var arrayRef = [];
+
+    /** Used for native method references */
+    var errorProto = Error.prototype,
+        objectProto = Object.prototype,
+        stringProto = String.prototype;
+
+    /** Used to restore the original `_` reference in `noConflict` */
+    var oldDash = context._;
+
+    /** Used to resolve the internal [[Class]] of values */
+    var toString = objectProto.toString;
+
+    /** Used to detect if a method is native */
+    var reNative = RegExp('^' +
+      String(toString)
+        .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+        .replace(/toString| for [^\]]+/g, '.*?') + '$'
+    );
+
+    /** Native method shortcuts */
+    var ceil = Math.ceil,
+        clearTimeout = context.clearTimeout,
+        floor = Math.floor,
+        fnToString = Function.prototype.toString,
+        getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
+        hasOwnProperty = objectProto.hasOwnProperty,
+        push = arrayRef.push,
+        propertyIsEnumerable = objectProto.propertyIsEnumerable,
+        setTimeout = context.setTimeout,
+        splice = arrayRef.splice,
+        unshift = arrayRef.unshift;
+
+    /** Used to set meta data on functions */
+    var defineProperty = (function() {
+      // IE 8 only accepts DOM elements
+      try {
+        var o = {},
+            func = isNative(func = Object.defineProperty) && func,
+            result = func(o, o, o) && func;
+      } catch(e) { }
+      return result;
+    }());
+
+    /* Native method shortcuts for methods with the same name as other `lodash` methods */
+    var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
+        nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
+        nativeIsFinite = context.isFinite,
+        nativeIsNaN = context.isNaN,
+        nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
+        nativeMax = Math.max,
+        nativeMin = Math.min,
+        nativeParseInt = context.parseInt,
+        nativeRandom = Math.random;
+
+    /** Used to lookup a built-in constructor by [[Class]] */
+    var ctorByClass = {};
+    ctorByClass[arrayClass] = Array;
+    ctorByClass[boolClass] = Boolean;
+    ctorByClass[dateClass] = Date;
+    ctorByClass[funcClass] = Function;
+    ctorByClass[objectClass] = Object;
+    ctorByClass[numberClass] = Number;
+    ctorByClass[regexpClass] = RegExp;
+    ctorByClass[stringClass] = String;
+
+    /** Used to avoid iterating non-enumerable properties in IE < 9 */
+    var nonEnumProps = {};
+    nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
+    nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
+    nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
+    nonEnumProps[objectClass] = { 'constructor': true };
+
+    (function() {
+      var length = shadowedProps.length;
+      while (length--) {
+        var key = shadowedProps[length];
+        for (var className in nonEnumProps) {
+          if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], key)) {
+            nonEnumProps[className][key] = false;
+          }
+        }
+      }
+    }());
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object which wraps the given value to enable intuitive
+     * method chaining.
+     *
+     * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
+     * and `unshift`
+     *
+     * Chaining is supported in custom builds as long as the `value` method is
+     * implicitly or explicitly included in the build.
+     *
+     * The chainable wrapper functions are:
+     * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
+     * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,
+     * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,
+     * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+     * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+     * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
+     * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,
+     * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+     * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,
+     * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,
+     * and `zip`
+     *
+     * The non-chainable wrapper functions are:
+     * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,
+     * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,
+     * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+     * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,
+     * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,
+     * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,
+     * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,
+     * `template`, `unescape`, `uniqueId`, and `value`
+     *
+     * The wrapper functions `first` and `last` return wrapped values when `n` is
+     * provided, otherwise they return unwrapped values.
+     *
+     * Explicit chaining can be enabled by using the `_.chain` method.
+     *
+     * @name _
+     * @constructor
+     * @category Chaining
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns a `lodash` instance.
+     * @example
+     *
+     * var wrapped = _([1, 2, 3]);
+     *
+     * // returns an unwrapped value
+     * wrapped.reduce(function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * // returns a wrapped value
+     * var squares = wrapped.map(function(num) {
+     *   return num * num;
+     * });
+     *
+     * _.isArray(squares);
+     * // => false
+     *
+     * _.isArray(squares.value());
+     * // => true
+     */
+    function lodash(value) {
+      // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
+      return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))
+       ? value
+       : new lodashWrapper(value);
+    }
+
+    /**
+     * A fast path for creating `lodash` wrapper objects.
+     *
+     * @private
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @param {boolean} chainAll A flag to enable chaining for all methods
+     * @returns {Object} Returns a `lodash` instance.
+     */
+    function lodashWrapper(value, chainAll) {
+      this.__chain__ = !!chainAll;
+      this.__wrapped__ = value;
+    }
+    // ensure `new lodashWrapper` is an instance of `lodash`
+    lodashWrapper.prototype = lodash.prototype;
+
+    /**
+     * An object used to flag environments features.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    var support = lodash.support = {};
+
+    (function() {
+      var ctor = function() { this.x = 1; },
+          object = { '0': 1, 'length': 1 },
+          props = [];
+
+      ctor.prototype = { 'valueOf': 1, 'y': 1 };
+      for (var key in new ctor) { props.push(key); }
+      for (key in arguments) { }
+
+      /**
+       * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.argsClass = toString.call(arguments) == argsClass;
+
+      /**
+       * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
+
+      /**
+       * Detect if `name` or `message` properties of `Error.prototype` are
+       * enumerable by default. (IE < 9, Safari < 5.1)
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
+
+      /**
+       * Detect if `prototype` properties are enumerable by default.
+       *
+       * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
+       * (if the prototype or a property on the prototype has been set)
+       * incorrectly sets a function's `prototype` property [[Enumerable]]
+       * value to `true`.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
+
+      /**
+       * Detect if functions can be decompiled by `Function#toString`
+       * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext);
+
+      /**
+       * Detect if `Function#name` is supported (all but IE).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.funcNames = typeof Function.name == 'string';
+
+      /**
+       * Detect if `arguments` object indexes are non-enumerable
+       * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.nonEnumArgs = key != 0;
+
+      /**
+       * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
+       *
+       * In IE < 9 an objects own properties, shadowing non-enumerable ones, are
+       * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.nonEnumShadows = !/valueOf/.test(props);
+
+      /**
+       * Detect if own properties are iterated after inherited properties (all but IE < 9).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.ownLast = props[0] != 'x';
+
+      /**
+       * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.
+       *
+       * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
+       * and `splice()` functions that fail to remove the last element, `value[0]`,
+       * of array-like objects even though the `length` property is set to `0`.
+       * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
+       * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]);
+
+      /**
+       * Detect lack of support for accessing string characters by index.
+       *
+       * IE < 8 can't access characters by index and IE 8 can only access
+       * characters by index on string literals.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
+
+      /**
+       * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9)
+       * and that the JS engine errors when attempting to coerce an object to
+       * a string without a `toString` function.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      try {
+        support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
+      } catch(e) {
+        support.nodeClass = true;
+      }
+    }(1));
+
+    /**
+     * By default, the template delimiters used by Lo-Dash are similar to those in
+     * embedded Ruby (ERB). Change the following template settings to use alternative
+     * delimiters.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    lodash.templateSettings = {
+
+      /**
+       * Used to detect `data` property values to be HTML-escaped.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'escape': /<%-([\s\S]+?)%>/g,
+
+      /**
+       * Used to detect code to be evaluated.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'evaluate': /<%([\s\S]+?)%>/g,
+
+      /**
+       * Used to detect `data` property values to inject.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'interpolate': reInterpolate,
+
+      /**
+       * Used to reference the data object in the template text.
+       *
+       * @memberOf _.templateSettings
+       * @type string
+       */
+      'variable': '',
+
+      /**
+       * Used to import variables into the compiled template.
+       *
+       * @memberOf _.templateSettings
+       * @type Object
+       */
+      'imports': {
+
+        /**
+         * A reference to the `lodash` function.
+         *
+         * @memberOf _.templateSettings.imports
+         * @type Function
+         */
+        '_': lodash
+      }
+    };
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The template used to create iterator functions.
+     *
+     * @private
+     * @param {Object} data The data object used to populate the text.
+     * @returns {string} Returns the interpolated text.
+     */
+    var iteratorTemplate = function(obj) {
+
+      var __p = 'var index, iterable = ' +
+      (obj.firstArg) +
+      ', result = ' +
+      (obj.init) +
+      ';\nif (!iterable) return result;\n' +
+      (obj.top) +
+      ';';
+       if (obj.array) {
+      __p += '\nvar length = iterable.length; index = -1;\nif (' +
+      (obj.array) +
+      ') {  ';
+       if (support.unindexedChars) {
+      __p += '\n  if (isString(iterable)) {\n    iterable = iterable.split(\'\')\n  }  ';
+       }
+      __p += '\n  while (++index < length) {\n    ' +
+      (obj.loop) +
+      ';\n  }\n}\nelse {  ';
+       } else if (support.nonEnumArgs) {
+      __p += '\n  var length = iterable.length; index = -1;\n  if (length && isArguments(iterable)) {\n    while (++index < length) {\n      index += \'\';\n      ' +
+      (obj.loop) +
+      ';\n    }\n  } else {  ';
+       }
+
+       if (support.enumPrototypes) {
+      __p += '\n  var skipProto = typeof iterable == \'function\';\n  ';
+       }
+
+       if (support.enumErrorProps) {
+      __p += '\n  var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n  ';
+       }
+
+          var conditions = [];    if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); }    if (support.enumErrorProps)  { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); }
+
+       if (obj.useHas && obj.keys) {
+      __p += '\n  var ownIndex = -1,\n      ownProps = objectTypes[typeof iterable] && keys(iterable),\n      length = ownProps ? ownProps.length : 0;\n\n  while (++ownIndex < length) {\n    index = ownProps[ownIndex];\n';
+          if (conditions.length) {
+      __p += '    if (' +
+      (conditions.join(' && ')) +
+      ') {\n  ';
+       }
+      __p +=
+      (obj.loop) +
+      ';    ';
+       if (conditions.length) {
+      __p += '\n    }';
+       }
+      __p += '\n  }  ';
+       } else {
+      __p += '\n  for (index in iterable) {\n';
+          if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); }    if (conditions.length) {
+      __p += '    if (' +
+      (conditions.join(' && ')) +
+      ') {\n  ';
+       }
+      __p +=
+      (obj.loop) +
+      ';    ';
+       if (conditions.length) {
+      __p += '\n    }';
+       }
+      __p += '\n  }    ';
+       if (support.nonEnumShadows) {
+      __p += '\n\n  if (iterable !== objectProto) {\n    var ctor = iterable.constructor,\n        isProto = iterable === (ctor && ctor.prototype),\n        className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n        nonEnum = nonEnumProps[className];\n      ';
+       for (k = 0; k < 7; k++) {
+      __p += '\n    index = \'' +
+      (obj.shadowedProps[k]) +
+      '\';\n    if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))';
+              if (!obj.useHas) {
+      __p += ' || (!nonEnum[index] && iterable[index] !== objectProto[index])';
+       }
+      __p += ') {\n      ' +
+      (obj.loop) +
+      ';\n    }      ';
+       }
+      __p += '\n  }    ';
+       }
+
+       }
+
+       if (obj.array || support.nonEnumArgs) {
+      __p += '\n}';
+       }
+      __p +=
+      (obj.bottom) +
+      ';\nreturn result';
+
+      return __p
+    };
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The base implementation of `_.bind` that creates the bound function and
+     * sets its meta data.
+     *
+     * @private
+     * @param {Array} bindData The bind data array.
+     * @returns {Function} Returns the new bound function.
+     */
+    function baseBind(bindData) {
+      var func = bindData[0],
+          partialArgs = bindData[2],
+          thisArg = bindData[4];
+
+      function bound() {
+        // `Function#bind` spec
+        // http://es5.github.io/#x15.3.4.5
+        if (partialArgs) {
+          // avoid `arguments` object deoptimizations by using `slice` instead
+          // of `Array.prototype.slice.call` and not assigning `arguments` to a
+          // variable as a ternary expression
+          var args = slice(partialArgs);
+          push.apply(args, arguments);
+        }
+        // mimic the constructor's `return` behavior
+        // http://es5.github.io/#x13.2.2
+        if (this instanceof bound) {
+          // ensure `new bound` is an instance of `func`
+          var thisBinding = baseCreate(func.prototype),
+              result = func.apply(thisBinding, args || arguments);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisArg, args || arguments);
+      }
+      setBindData(bound, bindData);
+      return bound;
+    }
+
+    /**
+     * The base implementation of `_.clone` without argument juggling or support
+     * for `thisArg` binding.
+     *
+     * @private
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep=false] Specify a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates clones with source counterparts.
+     * @returns {*} Returns the cloned value.
+     */
+    function baseClone(value, isDeep, callback, stackA, stackB) {
+      if (callback) {
+        var result = callback(value);
+        if (typeof result != 'undefined') {
+          return result;
+        }
+      }
+      // inspect [[Class]]
+      var isObj = isObject(value);
+      if (isObj) {
+        var className = toString.call(value);
+        if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) {
+          return value;
+        }
+        var ctor = ctorByClass[className];
+        switch (className) {
+          case boolClass:
+          case dateClass:
+            return new ctor(+value);
+
+          case numberClass:
+          case stringClass:
+            return new ctor(value);
+
+          case regexpClass:
+            result = ctor(value.source, reFlags.exec(value));
+            result.lastIndex = value.lastIndex;
+            return result;
+        }
+      } else {
+        return value;
+      }
+      var isArr = isArray(value);
+      if (isDeep) {
+        // check for circular references and return corresponding clone
+        var initedStack = !stackA;
+        stackA || (stackA = getArray());
+        stackB || (stackB = getArray());
+
+        var length = stackA.length;
+        while (length--) {
+          if (stackA[length] == value) {
+            return stackB[length];
+          }
+        }
+        result = isArr ? ctor(value.length) : {};
+      }
+      else {
+        result = isArr ? slice(value) : assign({}, value);
+      }
+      // add array properties assigned by `RegExp#exec`
+      if (isArr) {
+        if (hasOwnProperty.call(value, 'index')) {
+          result.index = value.index;
+        }
+        if (hasOwnProperty.call(value, 'input')) {
+          result.input = value.input;
+        }
+      }
+      // exit for shallow clone
+      if (!isDeep) {
+        return result;
+      }
+      // add the source value to the stack of traversed objects
+      // and associate it with its clone
+      stackA.push(value);
+      stackB.push(result);
+
+      // recursively populate clone (susceptible to call stack limits)
+      (isArr ? baseEach : forOwn)(value, function(objValue, key) {
+        result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
+      });
+
+      if (initedStack) {
+        releaseArray(stackA);
+        releaseArray(stackB);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.create` without support for assigning
+     * properties to the created object.
+     *
+     * @private
+     * @param {Object} prototype The object to inherit from.
+     * @returns {Object} Returns the new object.
+     */
+    function baseCreate(prototype, properties) {
+      return isObject(prototype) ? nativeCreate(prototype) : {};
+    }
+    // fallback for browsers without `Object.create`
+    if (!nativeCreate) {
+      baseCreate = (function() {
+        function Object() {}
+        return function(prototype) {
+          if (isObject(prototype)) {
+            Object.prototype = prototype;
+            var result = new Object;
+            Object.prototype = null;
+          }
+          return result || context.Object();
+        };
+      }());
+    }
+
+    /**
+     * The base implementation of `_.createCallback` without support for creating
+     * "_.pluck" or "_.where" style callbacks.
+     *
+     * @private
+     * @param {*} [func=identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of the created callback.
+     * @param {number} [argCount] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     */
+    function baseCreateCallback(func, thisArg, argCount) {
+      if (typeof func != 'function') {
+        return identity;
+      }
+      // exit early for no `thisArg` or already bound by `Function#bind`
+      if (typeof thisArg == 'undefined' || !('prototype' in func)) {
+        return func;
+      }
+      var bindData = func.__bindData__;
+      if (typeof bindData == 'undefined') {
+        if (support.funcNames) {
+          bindData = !func.name;
+        }
+        bindData = bindData || !support.funcDecomp;
+        if (!bindData) {
+          var source = fnToString.call(func);
+          if (!support.funcNames) {
+            bindData = !reFuncName.test(source);
+          }
+          if (!bindData) {
+            // checks if `func` references the `this` keyword and stores the result
+            bindData = reThis.test(source);
+            setBindData(func, bindData);
+          }
+        }
+      }
+      // exit early if there are no `this` references or `func` is bound
+      if (bindData === false || (bindData !== true && bindData[1] & 1)) {
+        return func;
+      }
+      switch (argCount) {
+        case 1: return function(value) {
+          return func.call(thisArg, value);
+        };
+        case 2: return function(a, b) {
+          return func.call(thisArg, a, b);
+        };
+        case 3: return function(value, index, collection) {
+          return func.call(thisArg, value, index, collection);
+        };
+        case 4: return function(accumulator, value, index, collection) {
+          return func.call(thisArg, accumulator, value, index, collection);
+        };
+      }
+      return bind(func, thisArg);
+    }
+
+    /**
+     * The base implementation of `createWrapper` that creates the wrapper and
+     * sets its meta data.
+     *
+     * @private
+     * @param {Array} bindData The bind data array.
+     * @returns {Function} Returns the new function.
+     */
+    function baseCreateWrapper(bindData) {
+      var func = bindData[0],
+          bitmask = bindData[1],
+          partialArgs = bindData[2],
+          partialRightArgs = bindData[3],
+          thisArg = bindData[4],
+          arity = bindData[5];
+
+      var isBind = bitmask & 1,
+          isBindKey = bitmask & 2,
+          isCurry = bitmask & 4,
+          isCurryBound = bitmask & 8,
+          key = func;
+
+      function bound() {
+        var thisBinding = isBind ? thisArg : this;
+        if (partialArgs) {
+          var args = slice(partialArgs);
+          push.apply(args, arguments);
+        }
+        if (partialRightArgs || isCurry) {
+          args || (args = slice(arguments));
+          if (partialRightArgs) {
+            push.apply(args, partialRightArgs);
+          }
+          if (isCurry && args.length < arity) {
+            bitmask |= 16 & ~32;
+            return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);
+          }
+        }
+        args || (args = arguments);
+        if (isBindKey) {
+          func = thisBinding[key];
+        }
+        if (this instanceof bound) {
+          thisBinding = baseCreate(func.prototype);
+          var result = func.apply(thisBinding, args);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisBinding, args);
+      }
+      setBindData(bound, bindData);
+      return bound;
+    }
+
+    /**
+     * The base implementation of `_.difference` that accepts a single array
+     * of values to exclude.
+     *
+     * @private
+     * @param {Array} array The array to process.
+     * @param {Array} [values] The array of values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     */
+    function baseDifference(array, values) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          isLarge = length >= largeArraySize && indexOf === baseIndexOf,
+          result = [];
+
+      if (isLarge) {
+        var cache = createCache(values);
+        if (cache) {
+          indexOf = cacheIndexOf;
+          values = cache;
+        } else {
+          isLarge = false;
+        }
+      }
+      while (++index < length) {
+        var value = array[index];
+        if (indexOf(values, value) < 0) {
+          result.push(value);
+        }
+      }
+      if (isLarge) {
+        releaseObject(values);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.flatten` without support for callback
+     * shorthands or `thisArg` binding.
+     *
+     * @private
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+     * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
+     * @param {number} [fromIndex=0] The index to start from.
+     * @returns {Array} Returns a new flattened array.
+     */
+    function baseFlatten(array, isShallow, isStrict, fromIndex) {
+      var index = (fromIndex || 0) - 1,
+          length = array ? array.length : 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+
+        if (value && typeof value == 'object' && typeof value.length == 'number'
+            && (isArray(value) || isArguments(value))) {
+          // recursively flatten arrays (susceptible to call stack limits)
+          if (!isShallow) {
+            value = baseFlatten(value, isShallow, isStrict);
+          }
+          var valIndex = -1,
+              valLength = value.length,
+              resIndex = result.length;
+
+          result.length += valLength;
+          while (++valIndex < valLength) {
+            result[resIndex++] = value[valIndex];
+          }
+        } else if (!isStrict) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.isEqual`, without support for `thisArg` binding,
+     * that allows partial "_.where" style comparisons.
+     *
+     * @private
+     * @param {*} a The value to compare.
+     * @param {*} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.
+     * @param {Array} [stackA=[]] Tracks traversed `a` objects.
+     * @param {Array} [stackB=[]] Tracks traversed `b` objects.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     */
+    function baseIsEqual(a, b, callback, isWhere, stackA, stackB) {
+      // used to indicate that when comparing objects, `a` has at least the properties of `b`
+      if (callback) {
+        var result = callback(a, b);
+        if (typeof result != 'undefined') {
+          return !!result;
+        }
+      }
+      // exit early for identical values
+      if (a === b) {
+        // treat `+0` vs. `-0` as not equal
+        return a !== 0 || (1 / a == 1 / b);
+      }
+      var type = typeof a,
+          otherType = typeof b;
+
+      // exit early for unlike primitive values
+      if (a === a &&
+          !(a && objectTypes[type]) &&
+          !(b && objectTypes[otherType])) {
+        return false;
+      }
+      // exit early for `null` and `undefined` avoiding ES3's Function#call behavior
+      // http://es5.github.io/#x15.3.4.4
+      if (a == null || b == null) {
+        return a === b;
+      }
+      // compare [[Class]] names
+      var className = toString.call(a),
+          otherClass = toString.call(b);
+
+      if (className == argsClass) {
+        className = objectClass;
+      }
+      if (otherClass == argsClass) {
+        otherClass = objectClass;
+      }
+      if (className != otherClass) {
+        return false;
+      }
+      switch (className) {
+        case boolClass:
+        case dateClass:
+          // coerce dates and booleans to numbers, dates to milliseconds and booleans
+          // to `1` or `0` treating invalid dates coerced to `NaN` as not equal
+          return +a == +b;
+
+        case numberClass:
+          // treat `NaN` vs. `NaN` as equal
+          return (a != +a)
+            ? b != +b
+            // but treat `+0` vs. `-0` as not equal
+            : (a == 0 ? (1 / a == 1 / b) : a == +b);
+
+        case regexpClass:
+        case stringClass:
+          // coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
+          // treat string primitives and their corresponding object instances as equal
+          return a == String(b);
+      }
+      var isArr = className == arrayClass;
+      if (!isArr) {
+        // unwrap any `lodash` wrapped values
+        var aWrapped = hasOwnProperty.call(a, '__wrapped__'),
+            bWrapped = hasOwnProperty.call(b, '__wrapped__');
+
+        if (aWrapped || bWrapped) {
+          return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB);
+        }
+        // exit for functions and DOM nodes
+        if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
+          return false;
+        }
+        // in older versions of Opera, `arguments` objects have `Array` constructors
+        var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
+            ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
+
+        // non `Object` object instances with different constructors are not equal
+        if (ctorA != ctorB &&
+              !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
+              ('constructor' in a && 'constructor' in b)
+            ) {
+          return false;
+        }
+      }
+      // assume cyclic structures are equal
+      // the algorithm for detecting cyclic structures is adapted from ES 5.1
+      // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
+      var initedStack = !stackA;
+      stackA || (stackA = getArray());
+      stackB || (stackB = getArray());
+
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == a) {
+          return stackB[length] == b;
+        }
+      }
+      var size = 0;
+      result = true;
+
+      // add `a` and `b` to the stack of traversed objects
+      stackA.push(a);
+      stackB.push(b);
+
+      // recursively compare objects and arrays (susceptible to call stack limits)
+      if (isArr) {
+        // compare lengths to determine if a deep comparison is necessary
+        length = a.length;
+        size = b.length;
+        result = size == length;
+
+        if (result || isWhere) {
+          // deep compare the contents, ignoring non-numeric properties
+          while (size--) {
+            var index = length,
+                value = b[size];
+
+            if (isWhere) {
+              while (index--) {
+                if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) {
+                  break;
+                }
+              }
+            } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) {
+              break;
+            }
+          }
+        }
+      }
+      else {
+        // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
+        // which, in this case, is more costly
+        forIn(b, function(value, key, b) {
+          if (hasOwnProperty.call(b, key)) {
+            // count the number of properties.
+            size++;
+            // deep compare each property value.
+            return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB));
+          }
+        });
+
+        if (result && !isWhere) {
+          // ensure both objects have the same number of properties
+          forIn(a, function(value, key, a) {
+            if (hasOwnProperty.call(a, key)) {
+              // `size` will be `-1` if `a` has more properties than `b`
+              return (result = --size > -1);
+            }
+          });
+        }
+      }
+      stackA.pop();
+      stackB.pop();
+
+      if (initedStack) {
+        releaseArray(stackA);
+        releaseArray(stackB);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.merge` without argument juggling or support
+     * for `thisArg` binding.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates values with source counterparts.
+     */
+    function baseMerge(object, source, callback, stackA, stackB) {
+      (isArray(source) ? forEach : forOwn)(source, function(source, key) {
+        var found,
+            isArr,
+            result = source,
+            value = object[key];
+
+        if (source && ((isArr = isArray(source)) || isPlainObject(source))) {
+          // avoid merging previously merged cyclic sources
+          var stackLength = stackA.length;
+          while (stackLength--) {
+            if ((found = stackA[stackLength] == source)) {
+              value = stackB[stackLength];
+              break;
+            }
+          }
+          if (!found) {
+            var isShallow;
+            if (callback) {
+              result = callback(value, source);
+              if ((isShallow = typeof result != 'undefined')) {
+                value = result;
+              }
+            }
+            if (!isShallow) {
+              value = isArr
+                ? (isArray(value) ? value : [])
+                : (isPlainObject(value) ? value : {});
+            }
+            // add `source` and associated `value` to the stack of traversed objects
+            stackA.push(source);
+            stackB.push(value);
+
+            // recursively merge objects and arrays (susceptible to call stack limits)
+            if (!isShallow) {
+              baseMerge(value, source, callback, stackA, stackB);
+            }
+          }
+        }
+        else {
+          if (callback) {
+            result = callback(value, source);
+            if (typeof result == 'undefined') {
+              result = source;
+            }
+          }
+          if (typeof result != 'undefined') {
+            value = result;
+          }
+        }
+        object[key] = value;
+      });
+    }
+
+    /**
+     * The base implementation of `_.random` without argument juggling or support
+     * for returning floating-point numbers.
+     *
+     * @private
+     * @param {number} min The minimum possible value.
+     * @param {number} max The maximum possible value.
+     * @returns {number} Returns a random number.
+     */
+    function baseRandom(min, max) {
+      return min + floor(nativeRandom() * (max - min + 1));
+    }
+
+    /**
+     * The base implementation of `_.uniq` without support for callback shorthands
+     * or `thisArg` binding.
+     *
+     * @private
+     * @param {Array} array The array to process.
+     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+     * @param {Function} [callback] The function called per iteration.
+     * @returns {Array} Returns a duplicate-value-free array.
+     */
+    function baseUniq(array, isSorted, callback) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          result = [];
+
+      var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf,
+          seen = (callback || isLarge) ? getArray() : result;
+
+      if (isLarge) {
+        var cache = createCache(seen);
+        indexOf = cacheIndexOf;
+        seen = cache;
+      }
+      while (++index < length) {
+        var value = array[index],
+            computed = callback ? callback(value, index, array) : value;
+
+        if (isSorted
+              ? !index || seen[seen.length - 1] !== computed
+              : indexOf(seen, computed) < 0
+            ) {
+          if (callback || isLarge) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      if (isLarge) {
+        releaseArray(seen.array);
+        releaseObject(seen);
+      } else if (callback) {
+        releaseArray(seen);
+      }
+      return result;
+    }
+
+    /**
+     * Creates a function that aggregates a collection, creating an object composed
+     * of keys generated from the results of running each element of the collection
+     * through a callback. The given `setter` function sets the keys and values
+     * of the composed object.
+     *
+     * @private
+     * @param {Function} setter The setter function.
+     * @returns {Function} Returns the new aggregator function.
+     */
+    function createAggregator(setter) {
+      return function(collection, callback, thisArg) {
+        var result = {};
+        callback = lodash.createCallback(callback, thisArg, 3);
+
+        if (isArray(collection)) {
+          var index = -1,
+              length = collection.length;
+
+          while (++index < length) {
+            var value = collection[index];
+            setter(result, value, callback(value, index, collection), collection);
+          }
+        } else {
+          baseEach(collection, function(value, key, collection) {
+            setter(result, value, callback(value, key, collection), collection);
+          });
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that, when called, either curries or invokes `func`
+     * with an optional `this` binding and partially applied arguments.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to reference.
+     * @param {number} bitmask The bitmask of method flags to compose.
+     *  The bitmask may be composed of the following flags:
+     *  1 - `_.bind`
+     *  2 - `_.bindKey`
+     *  4 - `_.curry`
+     *  8 - `_.curry` (bound)
+     *  16 - `_.partial`
+     *  32 - `_.partialRight`
+     * @param {Array} [partialArgs] An array of arguments to prepend to those
+     *  provided to the new function.
+     * @param {Array} [partialRightArgs] An array of arguments to append to those
+     *  provided to the new function.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new function.
+     */
+    function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
+      var isBind = bitmask & 1,
+          isBindKey = bitmask & 2,
+          isCurry = bitmask & 4,
+          isCurryBound = bitmask & 8,
+          isPartial = bitmask & 16,
+          isPartialRight = bitmask & 32;
+
+      if (!isBindKey && !isFunction(func)) {
+        throw new TypeError;
+      }
+      if (isPartial && !partialArgs.length) {
+        bitmask &= ~16;
+        isPartial = partialArgs = false;
+      }
+      if (isPartialRight && !partialRightArgs.length) {
+        bitmask &= ~32;
+        isPartialRight = partialRightArgs = false;
+      }
+      var bindData = func && func.__bindData__;
+      if (bindData && bindData !== true) {
+        // clone `bindData`
+        bindData = slice(bindData);
+        if (bindData[2]) {
+          bindData[2] = slice(bindData[2]);
+        }
+        if (bindData[3]) {
+          bindData[3] = slice(bindData[3]);
+        }
+        // set `thisBinding` is not previously bound
+        if (isBind && !(bindData[1] & 1)) {
+          bindData[4] = thisArg;
+        }
+        // set if previously bound but not currently (subsequent curried functions)
+        if (!isBind && bindData[1] & 1) {
+          bitmask |= 8;
+        }
+        // set curried arity if not yet set
+        if (isCurry && !(bindData[1] & 4)) {
+          bindData[5] = arity;
+        }
+        // append partial left arguments
+        if (isPartial) {
+          push.apply(bindData[2] || (bindData[2] = []), partialArgs);
+        }
+        // append partial right arguments
+        if (isPartialRight) {
+          unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs);
+        }
+        // merge flags
+        bindData[1] |= bitmask;
+        return createWrapper.apply(null, bindData);
+      }
+      // fast path for `_.bind`
+      var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;
+      return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);
+    }
+
+    /**
+     * Creates compiled iteration functions.
+     *
+     * @private
+     * @param {...Object} [options] The compile options object(s).
+     * @param {string} [options.array] Code to determine if the iterable is an array or array-like.
+     * @param {boolean} [options.useHas] Specify using `hasOwnProperty` checks in the object loop.
+     * @param {Function} [options.keys] A reference to `_.keys` for use in own property iteration.
+     * @param {string} [options.args] A comma separated string of iteration function arguments.
+     * @param {string} [options.top] Code to execute before the iteration branches.
+     * @param {string} [options.loop] Code to execute in the object loop.
+     * @param {string} [options.bottom] Code to execute after the iteration branches.
+     * @returns {Function} Returns the compiled function.
+     */
+    function createIterator() {
+      // data properties
+      iteratorData.shadowedProps = shadowedProps;
+
+      // iterator options
+      iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = '';
+      iteratorData.init = 'iterable';
+      iteratorData.useHas = true;
+
+      // merge options into a template data object
+      for (var object, index = 0; object = arguments[index]; index++) {
+        for (var key in object) {
+          iteratorData[key] = object[key];
+        }
+      }
+      var args = iteratorData.args;
+      iteratorData.firstArg = /^[^,]+/.exec(args)[0];
+
+      // create the function factory
+      var factory = Function(
+          'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' +
+          'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' +
+          'objectTypes, nonEnumProps, stringClass, stringProto, toString',
+        'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}'
+      );
+
+      // return the compiled function
+      return factory(
+        baseCreateCallback, errorClass, errorProto, hasOwnProperty,
+        indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto,
+        objectTypes, nonEnumProps, stringClass, stringProto, toString
+      );
+    }
+
+    /**
+     * Used by `escape` to convert characters to HTML entities.
+     *
+     * @private
+     * @param {string} match The matched character to escape.
+     * @returns {string} Returns the escaped character.
+     */
+    function escapeHtmlChar(match) {
+      return htmlEscapes[match];
+    }
+
+    /**
+     * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+     * customized, this method returns the custom method, otherwise it returns
+     * the `baseIndexOf` function.
+     *
+     * @private
+     * @returns {Function} Returns the "indexOf" function.
+     */
+    function getIndexOf() {
+      var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;
+      return result;
+    }
+
+    /**
+     * Checks if `value` is a native function.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.
+     */
+    function isNative(value) {
+      return typeof value == 'function' && reNative.test(value);
+    }
+
+    /**
+     * Sets `this` binding data on a given function.
+     *
+     * @private
+     * @param {Function} func The function to set data on.
+     * @param {Array} value The data array to set.
+     */
+    var setBindData = !defineProperty ? noop : function(func, value) {
+      descriptor.value = value;
+      defineProperty(func, '__bindData__', descriptor);
+    };
+
+    /**
+     * A fallback implementation of `isPlainObject` which checks if a given value
+     * is an object created by the `Object` constructor, assuming objects created
+     * by the `Object` constructor have no inherited enumerable properties and that
+     * there are no `Object.prototype` extensions.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     */
+    function shimIsPlainObject(value) {
+      var ctor,
+          result;
+
+      // avoid non Object objects, `arguments` objects, and DOM elements
+      if (!(value && toString.call(value) == objectClass) ||
+          (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) ||
+          (!support.argsClass && isArguments(value)) ||
+          (!support.nodeClass && isNode(value))) {
+        return false;
+      }
+      // IE < 9 iterates inherited properties before own properties. If the first
+      // iterated property is an object's own property then there are no inherited
+      // enumerable properties.
+      if (support.ownLast) {
+        forIn(value, function(value, key, object) {
+          result = hasOwnProperty.call(object, key);
+          return false;
+        });
+        return result !== false;
+      }
+      // In most environments an object's own properties are iterated before
+      // its inherited properties. If the last iterated property is an object's
+      // own property then there are no inherited enumerable properties.
+      forIn(value, function(value, key) {
+        result = key;
+      });
+      return typeof result == 'undefined' || hasOwnProperty.call(value, result);
+    }
+
+    /**
+     * Used by `unescape` to convert HTML entities to characters.
+     *
+     * @private
+     * @param {string} match The matched character to unescape.
+     * @returns {string} Returns the unescaped character.
+     */
+    function unescapeHtmlChar(match) {
+      return htmlUnescapes[match];
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Checks if `value` is an `arguments` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
+     * @example
+     *
+     * (function() { return _.isArguments(arguments); })(1, 2, 3);
+     * // => true
+     *
+     * _.isArguments([1, 2, 3]);
+     * // => false
+     */
+    function isArguments(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        toString.call(value) == argsClass || false;
+    }
+    // fallback for browsers that can't detect `arguments` objects by [[Class]]
+    if (!support.argsClass) {
+      isArguments = function(value) {
+        return value && typeof value == 'object' && typeof value.length == 'number' &&
+          hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false;
+      };
+    }
+
+    /**
+     * Checks if `value` is an array.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an array, else `false`.
+     * @example
+     *
+     * (function() { return _.isArray(arguments); })();
+     * // => false
+     *
+     * _.isArray([1, 2, 3]);
+     * // => true
+     */
+    var isArray = nativeIsArray || function(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        toString.call(value) == arrayClass || false;
+    };
+
+    /**
+     * A fallback implementation of `Object.keys` which produces an array of the
+     * given object's own enumerable property names.
+     *
+     * @private
+     * @type Function
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names.
+     */
+    var shimKeys = createIterator({
+      'args': 'object',
+      'init': '[]',
+      'top': 'if (!(objectTypes[typeof object])) return result',
+      'loop': 'result.push(index)'
+    });
+
+    /**
+     * Creates an array composed of the own enumerable property names of an object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names.
+     * @example
+     *
+     * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
+     */
+    var keys = !nativeKeys ? shimKeys : function(object) {
+      if (!isObject(object)) {
+        return [];
+      }
+      if ((support.enumPrototypes && typeof object == 'function') ||
+          (support.nonEnumArgs && object.length && isArguments(object))) {
+        return shimKeys(object);
+      }
+      return nativeKeys(object);
+    };
+
+    /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */
+    var eachIteratorOptions = {
+      'args': 'collection, callback, thisArg',
+      'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",
+      'array': "typeof length == 'number'",
+      'keys': keys,
+      'loop': 'if (callback(iterable[index], index, collection) === false) return result'
+    };
+
+    /** Reusable iterator options for `assign` and `defaults` */
+    var defaultsIteratorOptions = {
+      'args': 'object, source, guard',
+      'top':
+        'var args = arguments,\n' +
+        '    argsIndex = 0,\n' +
+        "    argsLength = typeof guard == 'number' ? 2 : args.length;\n" +
+        'while (++argsIndex < argsLength) {\n' +
+        '  iterable = args[argsIndex];\n' +
+        '  if (iterable && objectTypes[typeof iterable]) {',
+      'keys': keys,
+      'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
+      'bottom': '  }\n}'
+    };
+
+    /** Reusable iterator options for `forIn` and `forOwn` */
+    var forOwnIteratorOptions = {
+      'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top,
+      'array': false
+    };
+
+    /**
+     * Used to convert characters to HTML entities:
+     *
+     * Though the `>` character is escaped for symmetry, characters like `>` and `/`
+     * don't require escaping in HTML and have no special meaning unless they're part
+     * of a tag or an unquoted attribute value.
+     * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
+     */
+    var htmlEscapes = {
+      '&': '&amp;',
+      '<': '&lt;',
+      '>': '&gt;',
+      '"': '&quot;',
+      "'": '&#39;'
+    };
+
+    /** Used to convert HTML entities to characters */
+    var htmlUnescapes = invert(htmlEscapes);
+
+    /** Used to match HTML entities and HTML characters */
+    var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),
+        reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');
+
+    /**
+     * A function compiled to iterate `arguments` objects, arrays, objects, and
+     * strings consistenly across environments, executing the callback for each
+     * element in the collection. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index|key, collection). Callbacks may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @private
+     * @type Function
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     */
+    var baseEach = createIterator(eachIteratorOptions);
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object. Subsequent sources will overwrite property assignments of previous
+     * sources. If a callback is provided it will be executed to produce the
+     * assigned values. The callback is bound to `thisArg` and invoked with two
+     * arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @alias extend
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param {Function} [callback] The function to customize assigning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });
+     * // => { 'name': 'fred', 'employer': 'slate' }
+     *
+     * var defaults = _.partialRight(_.assign, function(a, b) {
+     *   return typeof a == 'undefined' ? b : a;
+     * });
+     *
+     * var object = { 'name': 'barney' };
+     * defaults(object, { 'name': 'fred', 'employer': 'slate' });
+     * // => { 'name': 'barney', 'employer': 'slate' }
+     */
+    var assign = createIterator(defaultsIteratorOptions, {
+      'top':
+        defaultsIteratorOptions.top.replace(';',
+          ';\n' +
+          "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
+          '  var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
+          "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
+          '  callback = args[--argsLength];\n' +
+          '}'
+        ),
+      'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
+    });
+
+    /**
+     * Creates a clone of `value`. If `isDeep` is `true` nested objects will also
+     * be cloned, otherwise they will be assigned by reference. If a callback
+     * is provided it will be executed to produce the cloned values. If the
+     * callback returns `undefined` cloning will be handled by the method instead.
+     * The callback is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep=false] Specify a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the cloned value.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * var shallow = _.clone(characters);
+     * shallow[0] === characters[0];
+     * // => true
+     *
+     * var deep = _.clone(characters, true);
+     * deep[0] === characters[0];
+     * // => false
+     *
+     * _.mixin({
+     *   'clone': _.partialRight(_.clone, function(value) {
+     *     return _.isElement(value) ? value.cloneNode(false) : undefined;
+     *   })
+     * });
+     *
+     * var clone = _.clone(document.body);
+     * clone.childNodes.length;
+     * // => 0
+     */
+    function clone(value, isDeep, callback, thisArg) {
+      // allows working with "Collections" methods without using their `index`
+      // and `collection` arguments for `isDeep` and `callback`
+      if (typeof isDeep != 'boolean' && isDeep != null) {
+        thisArg = callback;
+        callback = isDeep;
+        isDeep = false;
+      }
+      return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+    }
+
+    /**
+     * Creates a deep clone of `value`. If a callback is provided it will be
+     * executed to produce the cloned values. If the callback returns `undefined`
+     * cloning will be handled by the method instead. The callback is bound to
+     * `thisArg` and invoked with one argument; (value).
+     *
+     * Note: This method is loosely based on the structured clone algorithm. Functions
+     * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
+     * objects created by constructors other than `Object` are cloned to plain `Object` objects.
+     * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the deep cloned value.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * var deep = _.cloneDeep(characters);
+     * deep[0] === characters[0];
+     * // => false
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'node': element
+     * };
+     *
+     * var clone = _.cloneDeep(view, function(value) {
+     *   return _.isElement(value) ? value.cloneNode(true) : undefined;
+     * });
+     *
+     * clone.node == view.node;
+     * // => false
+     */
+    function cloneDeep(value, callback, thisArg) {
+      return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+    }
+
+    /**
+     * Creates an object that inherits from the given `prototype` object. If a
+     * `properties` object is provided its own enumerable properties are assigned
+     * to the created object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} prototype The object to inherit from.
+     * @param {Object} [properties] The properties to assign to the object.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * function Circle() {
+     *   Shape.call(this);
+     * }
+     *
+     * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });
+     *
+     * var circle = new Circle;
+     * circle instanceof Circle;
+     * // => true
+     *
+     * circle instanceof Shape;
+     * // => true
+     */
+    function create(prototype, properties) {
+      var result = baseCreate(prototype);
+      return properties ? assign(result, properties) : result;
+    }
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object for all destination properties that resolve to `undefined`. Once a
+     * property is set, additional defaults of the same property will be ignored.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param- {Object} [guard] Allows working with `_.reduce` without using its
+     *  `key` and `object` arguments as sources.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var object = { 'name': 'barney' };
+     * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
+     * // => { 'name': 'barney', 'employer': 'slate' }
+     */
+    var defaults = createIterator(defaultsIteratorOptions);
+
+    /**
+     * This method is like `_.findIndex` except that it returns the key of the
+     * first element that passes the callback check, instead of the element itself.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [callback=identity] The function called per
+     *  iteration. If a property name or object is provided it will be used to
+     *  create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {string|undefined} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * var characters = {
+     *   'barney': {  'age': 36, 'blocked': false },
+     *   'fred': {    'age': 40, 'blocked': true },
+     *   'pebbles': { 'age': 1,  'blocked': false }
+     * };
+     *
+     * _.findKey(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => 'barney' (property order is not guaranteed across environments)
+     *
+     * // using "_.where" callback shorthand
+     * _.findKey(characters, { 'age': 1 });
+     * // => 'pebbles'
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findKey(characters, 'blocked');
+     * // => 'fred'
+     */
+    function findKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forOwn(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * This method is like `_.findKey` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [callback=identity] The function called per
+     *  iteration. If a property name or object is provided it will be used to
+     *  create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {string|undefined} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * var characters = {
+     *   'barney': {  'age': 36, 'blocked': true },
+     *   'fred': {    'age': 40, 'blocked': false },
+     *   'pebbles': { 'age': 1,  'blocked': true }
+     * };
+     *
+     * _.findLastKey(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => returns `pebbles`, assuming `_.findKey` returns `barney`
+     *
+     * // using "_.where" callback shorthand
+     * _.findLastKey(characters, { 'age': 40 });
+     * // => 'fred'
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findLastKey(characters, 'blocked');
+     * // => 'pebbles'
+     */
+    function findLastKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forOwnRight(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Iterates over own and inherited enumerable properties of an object,
+     * executing the callback for each property. The callback is bound to `thisArg`
+     * and invoked with three arguments; (value, key, object). Callbacks may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * Shape.prototype.move = function(x, y) {
+     *   this.x += x;
+     *   this.y += y;
+     * };
+     *
+     * _.forIn(new Shape, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)
+     */
+    var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, {
+      'useHas': false
+    });
+
+    /**
+     * This method is like `_.forIn` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * Shape.prototype.move = function(x, y) {
+     *   this.x += x;
+     *   this.y += y;
+     * };
+     *
+     * _.forInRight(new Shape, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move'
+     */
+    function forInRight(object, callback, thisArg) {
+      var pairs = [];
+
+      forIn(object, function(value, key) {
+        pairs.push(key, value);
+      });
+
+      var length = pairs.length;
+      callback = baseCreateCallback(callback, thisArg, 3);
+      while (length--) {
+        if (callback(pairs[length--], pairs[length], object) === false) {
+          break;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Iterates over own enumerable properties of an object, executing the callback
+     * for each property. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, key, object). Callbacks may exit iteration early by
+     * explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   console.log(key);
+     * });
+     * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
+     */
+    var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions);
+
+    /**
+     * This method is like `_.forOwn` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length'
+     */
+    function forOwnRight(object, callback, thisArg) {
+      var props = keys(object),
+          length = props.length;
+
+      callback = baseCreateCallback(callback, thisArg, 3);
+      while (length--) {
+        var key = props[length];
+        if (callback(object[key], key, object) === false) {
+          break;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Creates a sorted array of property names of all enumerable properties,
+     * own and inherited, of `object` that have function values.
+     *
+     * @static
+     * @memberOf _
+     * @alias methods
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names that have function values.
+     * @example
+     *
+     * _.functions(_);
+     * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]
+     */
+    function functions(object) {
+      var result = [];
+      forIn(object, function(value, key) {
+        if (isFunction(value)) {
+          result.push(key);
+        }
+      });
+      return result.sort();
+    }
+
+    /**
+     * Checks if the specified property name exists as a direct property of `object`,
+     * instead of an inherited property.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @param {string} key The name of the property to check.
+     * @returns {boolean} Returns `true` if key is a direct property, else `false`.
+     * @example
+     *
+     * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
+     * // => true
+     */
+    function has(object, key) {
+      return object ? hasOwnProperty.call(object, key) : false;
+    }
+
+    /**
+     * Creates an object composed of the inverted keys and values of the given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to invert.
+     * @returns {Object} Returns the created inverted object.
+     * @example
+     *
+     * _.invert({ 'first': 'fred', 'second': 'barney' });
+     * // => { 'fred': 'first', 'barney': 'second' }
+     */
+    function invert(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = {};
+
+      while (++index < length) {
+        var key = props[index];
+        result[object[key]] = key;
+      }
+      return result;
+    }
+
+    /**
+     * Checks if `value` is a boolean value.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.
+     * @example
+     *
+     * _.isBoolean(null);
+     * // => false
+     */
+    function isBoolean(value) {
+      return value === true || value === false ||
+        value && typeof value == 'object' && toString.call(value) == boolClass || false;
+    }
+
+    /**
+     * Checks if `value` is a date.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a date, else `false`.
+     * @example
+     *
+     * _.isDate(new Date);
+     * // => true
+     */
+    function isDate(value) {
+      return value && typeof value == 'object' && toString.call(value) == dateClass || false;
+    }
+
+    /**
+     * Checks if `value` is a DOM element.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.
+     * @example
+     *
+     * _.isElement(document.body);
+     * // => true
+     */
+    function isElement(value) {
+      return value && value.nodeType === 1 || false;
+    }
+
+    /**
+     * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
+     * length of `0` and objects with no own enumerable properties are considered
+     * "empty".
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object|string} value The value to inspect.
+     * @returns {boolean} Returns `true` if the `value` is empty, else `false`.
+     * @example
+     *
+     * _.isEmpty([1, 2, 3]);
+     * // => false
+     *
+     * _.isEmpty({});
+     * // => true
+     *
+     * _.isEmpty('');
+     * // => true
+     */
+    function isEmpty(value) {
+      var result = true;
+      if (!value) {
+        return result;
+      }
+      var className = toString.call(value),
+          length = value.length;
+
+      if ((className == arrayClass || className == stringClass ||
+          (support.argsClass ? className == argsClass : isArguments(value))) ||
+          (className == objectClass && typeof length == 'number' && isFunction(value.splice))) {
+        return !length;
+      }
+      forOwn(value, function() {
+        return (result = false);
+      });
+      return result;
+    }
+
+    /**
+     * Performs a deep comparison between two values to determine if they are
+     * equivalent to each other. If a callback is provided it will be executed
+     * to compare values. If the callback returns `undefined` comparisons will
+     * be handled by the method instead. The callback is bound to `thisArg` and
+     * invoked with two arguments; (a, b).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} a The value to compare.
+     * @param {*} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * var copy = { 'name': 'fred' };
+     *
+     * object == copy;
+     * // => false
+     *
+     * _.isEqual(object, copy);
+     * // => true
+     *
+     * var words = ['hello', 'goodbye'];
+     * var otherWords = ['hi', 'goodbye'];
+     *
+     * _.isEqual(words, otherWords, function(a, b) {
+     *   var reGreet = /^(?:hello|hi)$/i,
+     *       aGreet = _.isString(a) && reGreet.test(a),
+     *       bGreet = _.isString(b) && reGreet.test(b);
+     *
+     *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
+     * });
+     * // => true
+     */
+    function isEqual(a, b, callback, thisArg) {
+      return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2));
+    }
+
+    /**
+     * Checks if `value` is, or can be coerced to, a finite number.
+     *
+     * Note: This is not the same as native `isFinite` which will return true for
+     * booleans and empty strings. See http://es5.github.io/#x15.1.2.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is finite, else `false`.
+     * @example
+     *
+     * _.isFinite(-101);
+     * // => true
+     *
+     * _.isFinite('10');
+     * // => true
+     *
+     * _.isFinite(true);
+     * // => false
+     *
+     * _.isFinite('');
+     * // => false
+     *
+     * _.isFinite(Infinity);
+     * // => false
+     */
+    function isFinite(value) {
+      return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
+    }
+
+    /**
+     * Checks if `value` is a function.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a function, else `false`.
+     * @example
+     *
+     * _.isFunction(_);
+     * // => true
+     */
+    function isFunction(value) {
+      return typeof value == 'function';
+    }
+    // fallback for older versions of Chrome and Safari
+    if (isFunction(/x/)) {
+      isFunction = function(value) {
+        return typeof value == 'function' && toString.call(value) == funcClass;
+      };
+    }
+
+    /**
+     * Checks if `value` is the language type of Object.
+     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
+     * @example
+     *
+     * _.isObject({});
+     * // => true
+     *
+     * _.isObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isObject(1);
+     * // => false
+     */
+    function isObject(value) {
+      // check if the value is the ECMAScript language type of Object
+      // http://es5.github.io/#x8
+      // and avoid a V8 bug
+      // http://code.google.com/p/v8/issues/detail?id=2291
+      return !!(value && objectTypes[typeof value]);
+    }
+
+    /**
+     * Checks if `value` is `NaN`.
+     *
+     * Note: This is not the same as native `isNaN` which will return `true` for
+     * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.
+     * @example
+     *
+     * _.isNaN(NaN);
+     * // => true
+     *
+     * _.isNaN(new Number(NaN));
+     * // => true
+     *
+     * isNaN(undefined);
+     * // => true
+     *
+     * _.isNaN(undefined);
+     * // => false
+     */
+    function isNaN(value) {
+      // `NaN` as a primitive is the only value that is not equal to itself
+      // (perform the [[Class]] check first to avoid errors with some host objects in IE)
+      return isNumber(value) && value != +value;
+    }
+
+    /**
+     * Checks if `value` is `null`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `null`, else `false`.
+     * @example
+     *
+     * _.isNull(null);
+     * // => true
+     *
+     * _.isNull(undefined);
+     * // => false
+     */
+    function isNull(value) {
+      return value === null;
+    }
+
+    /**
+     * Checks if `value` is a number.
+     *
+     * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a number, else `false`.
+     * @example
+     *
+     * _.isNumber(8.4 * 5);
+     * // => true
+     */
+    function isNumber(value) {
+      return typeof value == 'number' ||
+        value && typeof value == 'object' && toString.call(value) == numberClass || false;
+    }
+
+    /**
+     * Checks if `value` is an object created by the `Object` constructor.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * _.isPlainObject(new Shape);
+     * // => false
+     *
+     * _.isPlainObject([1, 2, 3]);
+     * // => false
+     *
+     * _.isPlainObject({ 'x': 0, 'y': 0 });
+     * // => true
+     */
+    var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
+      if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) {
+        return false;
+      }
+      var valueOf = value.valueOf,
+          objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
+
+      return objProto
+        ? (value == objProto || getPrototypeOf(value) == objProto)
+        : shimIsPlainObject(value);
+    };
+
+    /**
+     * Checks if `value` is a regular expression.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.
+     * @example
+     *
+     * _.isRegExp(/fred/);
+     * // => true
+     */
+    function isRegExp(value) {
+      return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false;
+    }
+
+    /**
+     * Checks if `value` is a string.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a string, else `false`.
+     * @example
+     *
+     * _.isString('fred');
+     * // => true
+     */
+    function isString(value) {
+      return typeof value == 'string' ||
+        value && typeof value == 'object' && toString.call(value) == stringClass || false;
+    }
+
+    /**
+     * Checks if `value` is `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.
+     * @example
+     *
+     * _.isUndefined(void 0);
+     * // => true
+     */
+    function isUndefined(value) {
+      return typeof value == 'undefined';
+    }
+
+    /**
+     * Creates an object with the same keys as `object` and values generated by
+     * running each own enumerable property of `object` through the callback.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new object with values of the results of each `callback` execution.
+     * @example
+     *
+     * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     *
+     * var characters = {
+     *   'fred': { 'name': 'fred', 'age': 40 },
+     *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.mapValues(characters, 'age');
+     * // => { 'fred': 40, 'pebbles': 1 }
+     */
+    function mapValues(object, callback, thisArg) {
+      var result = {};
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      forOwn(object, function(value, key, object) {
+        result[key] = callback(value, key, object);
+      });
+      return result;
+    }
+
+    /**
+     * Recursively merges own enumerable properties of the source object(s), that
+     * don't resolve to `undefined` into the destination object. Subsequent sources
+     * will overwrite property assignments of previous sources. If a callback is
+     * provided it will be executed to produce the merged values of the destination
+     * and source properties. If the callback returns `undefined` merging will
+     * be handled by the method instead. The callback is bound to `thisArg` and
+     * invoked with two arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var names = {
+     *   'characters': [
+     *     { 'name': 'barney' },
+     *     { 'name': 'fred' }
+     *   ]
+     * };
+     *
+     * var ages = {
+     *   'characters': [
+     *     { 'age': 36 },
+     *     { 'age': 40 }
+     *   ]
+     * };
+     *
+     * _.merge(names, ages);
+     * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] }
+     *
+     * var food = {
+     *   'fruits': ['apple'],
+     *   'vegetables': ['beet']
+     * };
+     *
+     * var otherFood = {
+     *   'fruits': ['banana'],
+     *   'vegetables': ['carrot']
+     * };
+     *
+     * _.merge(food, otherFood, function(a, b) {
+     *   return _.isArray(a) ? a.concat(b) : undefined;
+     * });
+     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
+     */
+    function merge(object) {
+      var args = arguments,
+          length = 2;
+
+      if (!isObject(object)) {
+        return object;
+      }
+      // allows working with `_.reduce` and `_.reduceRight` without using
+      // their `index` and `collection` arguments
+      if (typeof args[2] != 'number') {
+        length = args.length;
+      }
+      if (length > 3 && typeof args[length - 2] == 'function') {
+        var callback = baseCreateCallback(args[--length - 1], args[length--], 2);
+      } else if (length > 2 && typeof args[length - 1] == 'function') {
+        callback = args[--length];
+      }
+      var sources = slice(arguments, 1, length),
+          index = -1,
+          stackA = getArray(),
+          stackB = getArray();
+
+      while (++index < length) {
+        baseMerge(object, sources[index], callback, stackA, stackB);
+      }
+      releaseArray(stackA);
+      releaseArray(stackB);
+      return object;
+    }
+
+    /**
+     * Creates a shallow clone of `object` excluding the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a callback is provided it will be executed for each
+     * property of `object` omitting the properties the callback returns truey
+     * for. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|...string|string[]} [callback] The properties to omit or the
+     *  function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object without the omitted properties.
+     * @example
+     *
+     * _.omit({ 'name': 'fred', 'age': 40 }, 'age');
+     * // => { 'name': 'fred' }
+     *
+     * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {
+     *   return typeof value == 'number';
+     * });
+     * // => { 'name': 'fred' }
+     */
+    function omit(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var props = [];
+        forIn(object, function(value, key) {
+          props.push(key);
+        });
+        props = baseDifference(props, baseFlatten(arguments, true, false, 1));
+
+        var index = -1,
+            length = props.length;
+
+        while (++index < length) {
+          var key = props[index];
+          result[key] = object[key];
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg, 3);
+        forIn(object, function(value, key, object) {
+          if (!callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Creates a two dimensional array of an object's key-value pairs,
+     * i.e. `[[key1, value1], [key2, value2]]`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns new array of key-value pairs.
+     * @example
+     *
+     * _.pairs({ 'barney': 36, 'fred': 40 });
+     * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments)
+     */
+    function pairs(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        var key = props[index];
+        result[index] = [key, object[key]];
+      }
+      return result;
+    }
+
+    /**
+     * Creates a shallow clone of `object` composed of the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a callback is provided it will be executed for each
+     * property of `object` picking the properties the callback returns truey
+     * for. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|...string|string[]} [callback] The function called per
+     *  iteration or property names to pick, specified as individual property
+     *  names or arrays of property names.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object composed of the picked properties.
+     * @example
+     *
+     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name');
+     * // => { 'name': 'fred' }
+     *
+     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) {
+     *   return key.charAt(0) != '_';
+     * });
+     * // => { 'name': 'fred' }
+     */
+    function pick(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var index = -1,
+            props = baseFlatten(arguments, true, false, 1),
+            length = isObject(object) ? props.length : 0;
+
+        while (++index < length) {
+          var key = props[index];
+          if (key in object) {
+            result[key] = object[key];
+          }
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg, 3);
+        forIn(object, function(value, key, object) {
+          if (callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * An alternative to `_.reduce` this method transforms `object` to a new
+     * `accumulator` object which is the result of running each of its own
+     * enumerable properties through a callback, with each callback execution
+     * potentially mutating the `accumulator` object. The callback is bound to
+     * `thisArg` and invoked with four arguments; (accumulator, value, key, object).
+     * Callbacks may exit iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] The custom accumulator value.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {
+     *   num *= num;
+     *   if (num % 2) {
+     *     return result.push(num) < 3;
+     *   }
+     * });
+     * // => [1, 9, 25]
+     *
+     * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     * });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function transform(object, callback, accumulator, thisArg) {
+      var isArr = isArray(object);
+      if (accumulator == null) {
+        if (isArr) {
+          accumulator = [];
+        } else {
+          var ctor = object && object.constructor,
+              proto = ctor && ctor.prototype;
+
+          accumulator = baseCreate(proto);
+        }
+      }
+      if (callback) {
+        callback = lodash.createCallback(callback, thisArg, 4);
+        (isArr ? baseEach : forOwn)(object, function(value, index, object) {
+          return callback(accumulator, value, index, object);
+        });
+      }
+      return accumulator;
+    }
+
+    /**
+     * Creates an array composed of the own enumerable property values of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property values.
+     * @example
+     *
+     * _.values({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => [1, 2, 3] (property order is not guaranteed across environments)
+     */
+    function values(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = object[props[index]];
+      }
+      return result;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of elements from the specified indexes, or keys, of the
+     * `collection`. Indexes may be specified as individual arguments or as arrays
+     * of indexes.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {...(number|number[]|string|string[])} [index] The indexes of `collection`
+     *   to retrieve, specified as individual indexes or arrays of indexes.
+     * @returns {Array} Returns a new array of elements corresponding to the
+     *  provided indexes.
+     * @example
+     *
+     * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
+     * // => ['a', 'c', 'e']
+     *
+     * _.at(['fred', 'barney', 'pebbles'], 0, 2);
+     * // => ['fred', 'pebbles']
+     */
+    function at(collection) {
+      var args = arguments,
+          index = -1,
+          props = baseFlatten(args, true, false, 1),
+          length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length,
+          result = Array(length);
+
+      if (support.unindexedChars && isString(collection)) {
+        collection = collection.split('');
+      }
+      while(++index < length) {
+        result[index] = collection[props[index]];
+      }
+      return result;
+    }
+
+    /**
+     * Checks if a given value is present in a collection using strict equality
+     * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
+     * offset from the end of the collection.
+     *
+     * @static
+     * @memberOf _
+     * @alias include
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {*} target The value to check for.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @returns {boolean} Returns `true` if the `target` element is found, else `false`.
+     * @example
+     *
+     * _.contains([1, 2, 3], 1);
+     * // => true
+     *
+     * _.contains([1, 2, 3], 1, 2);
+     * // => false
+     *
+     * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
+     * // => true
+     *
+     * _.contains('pebbles', 'eb');
+     * // => true
+     */
+    function contains(collection, target, fromIndex) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = collection ? collection.length : 0,
+          result = false;
+
+      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
+      if (isArray(collection)) {
+        result = indexOf(collection, target, fromIndex) > -1;
+      } else if (typeof length == 'number') {
+        result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1;
+      } else {
+        baseEach(collection, function(value) {
+          if (++index >= fromIndex) {
+            return !(result = value === target);
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` through the callback. The corresponding value
+     * of each key is the number of times the key was returned by the callback.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy(['one', 'two', 'three'], 'length');
+     * // => { '3': 2, '5': 1 }
+     */
+    var countBy = createAggregator(function(result, value, key) {
+      (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);
+    });
+
+    /**
+     * Checks if the given callback returns truey value for **all** elements of
+     * a collection. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias all
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if all elements passed the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.every([true, 1, null, 'yes']);
+     * // => false
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.every(characters, 'age');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.every(characters, { 'age': 36 });
+     * // => false
+     */
+    function every(collection, callback, thisArg) {
+      var result = true;
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          if (!(result = !!callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          return (result = !!callback(value, index, collection));
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, returning an array of all elements
+     * the callback returns truey for. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias select
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that passed the callback check.
+     * @example
+     *
+     * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [2, 4, 6]
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.filter(characters, 'blocked');
+     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+     *
+     * // using "_.where" callback shorthand
+     * _.filter(characters, { 'age': 36 });
+     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+     */
+    function filter(collection, callback, thisArg) {
+      var result = [];
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, returning the first element that
+     * the callback returns truey for. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias detect, findWhere
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the found element, else `undefined`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': false },
+     *   { 'name': 'fred',    'age': 40, 'blocked': true },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+     * ];
+     *
+     * _.find(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => { 'name': 'barney', 'age': 36, 'blocked': false }
+     *
+     * // using "_.where" callback shorthand
+     * _.find(characters, { 'age': 1 });
+     * // =>  { 'name': 'pebbles', 'age': 1, 'blocked': false }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.find(characters, 'blocked');
+     * // => { 'name': 'fred', 'age': 40, 'blocked': true }
+     */
+    function find(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            return value;
+          }
+        }
+      } else {
+        var result;
+        baseEach(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result = value;
+            return false;
+          }
+        });
+        return result;
+      }
+    }
+
+    /**
+     * This method is like `_.find` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the found element, else `undefined`.
+     * @example
+     *
+     * _.findLast([1, 2, 3, 4], function(num) {
+     *   return num % 2 == 1;
+     * });
+     * // => 3
+     */
+    function findLast(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forEachRight(collection, function(value, index, collection) {
+        if (callback(value, index, collection)) {
+          result = value;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, executing the callback for each
+     * element. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection). Callbacks may exit iteration early by
+     * explicitly returning `false`.
+     *
+     * Note: As with other "Collections" methods, objects with a `length` property
+     * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+     * may be used for object iteration.
+     *
+     * @static
+     * @memberOf _
+     * @alias each
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');
+     * // => logs each number and returns '1,2,3'
+     *
+     * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
+     * // => logs each number and returns the object (property order is not guaranteed across environments)
+     */
+    function forEach(collection, callback, thisArg) {
+      if (callback && typeof thisArg == 'undefined' && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          if (callback(collection[index], index, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        baseEach(collection, callback, thisArg);
+      }
+      return collection;
+    }
+
+    /**
+     * This method is like `_.forEach` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias eachRight
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');
+     * // => logs each number from right to left and returns '3,2,1'
+     */
+    function forEachRight(collection, callback, thisArg) {
+      var iterable = collection,
+          length = collection ? collection.length : 0;
+
+      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+      if (isArray(collection)) {
+        while (length--) {
+          if (callback(collection[length], length, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        if (typeof length != 'number') {
+          var props = keys(collection);
+          length = props.length;
+        } else if (support.unindexedChars && isString(collection)) {
+          iterable = collection.split('');
+        }
+        baseEach(collection, function(value, key, collection) {
+          key = props ? props[--length] : --length;
+          return callback(iterable[key], key, collection);
+        });
+      }
+      return collection;
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of a collection through the callback. The corresponding value
+     * of each key is an array of the elements responsible for generating the key.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.groupBy(['one', 'two', 'three'], 'length');
+     * // => { '3': ['one', 'two'], '5': ['three'] }
+     */
+    var groupBy = createAggregator(function(result, value, key) {
+      (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
+    });
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of the collection through the given callback. The corresponding
+     * value of each key is the last element responsible for generating the key.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * var keys = [
+     *   { 'dir': 'left', 'code': 97 },
+     *   { 'dir': 'right', 'code': 100 }
+     * ];
+     *
+     * _.indexBy(keys, 'dir');
+     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String);
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     */
+    var indexBy = createAggregator(function(result, value, key) {
+      result[key] = value;
+    });
+
+    /**
+     * Invokes the method named by `methodName` on each element in the `collection`
+     * returning an array of the results of each invoked method. Additional arguments
+     * will be provided to each invoked method. If `methodName` is a function it
+     * will be invoked for, and `this` bound to, each element in the `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|string} methodName The name of the method to invoke or
+     *  the function invoked per iteration.
+     * @param {...*} [arg] Arguments to invoke the method with.
+     * @returns {Array} Returns a new array of the results of each invoked method.
+     * @example
+     *
+     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+     * // => [[1, 5, 7], [1, 2, 3]]
+     *
+     * _.invoke([123, 456], String.prototype.split, '');
+     * // => [['1', '2', '3'], ['4', '5', '6']]
+     */
+    function invoke(collection, methodName) {
+      var args = slice(arguments, 2),
+          index = -1,
+          isFunc = typeof methodName == 'function',
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      forEach(collection, function(value) {
+        result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
+      });
+      return result;
+    }
+
+    /**
+     * Creates an array of values by running each element in the collection
+     * through the callback. The callback is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias collect
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of the results of each `callback` execution.
+     * @example
+     *
+     * _.map([1, 2, 3], function(num) { return num * 3; });
+     * // => [3, 6, 9]
+     *
+     * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
+     * // => [3, 6, 9] (property order is not guaranteed across environments)
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(characters, 'name');
+     * // => ['barney', 'fred']
+     */
+    function map(collection, callback, thisArg) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      if (isArray(collection)) {
+        while (++index < length) {
+          result[index] = callback(collection[index], index, collection);
+        }
+      } else {
+        baseEach(collection, function(value, key, collection) {
+          result[++index] = callback(value, key, collection);
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the maximum value of a collection. If the collection is empty or
+     * falsey `-Infinity` is returned. If a callback is provided it will be executed
+     * for each value in the collection to generate the criterion by which the value
+     * is ranked. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the maximum value.
+     * @example
+     *
+     * _.max([4, 2, 8, 6]);
+     * // => 8
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.max(characters, function(chr) { return chr.age; });
+     * // => { 'name': 'fred', 'age': 40 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.max(characters, 'age');
+     * // => { 'name': 'fred', 'age': 40 };
+     */
+    function max(collection, callback, thisArg) {
+      var computed = -Infinity,
+          result = computed;
+
+      // allows working with functions like `_.map` without using
+      // their `index` argument as a callback
+      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+        callback = null;
+      }
+      if (callback == null && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (value > result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (callback == null && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg, 3);
+
+        baseEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current > computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the minimum value of a collection. If the collection is empty or
+     * falsey `Infinity` is returned. If a callback is provided it will be executed
+     * for each value in the collection to generate the criterion by which the value
+     * is ranked. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the minimum value.
+     * @example
+     *
+     * _.min([4, 2, 8, 6]);
+     * // => 2
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.min(characters, function(chr) { return chr.age; });
+     * // => { 'name': 'barney', 'age': 36 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.min(characters, 'age');
+     * // => { 'name': 'barney', 'age': 36 };
+     */
+    function min(collection, callback, thisArg) {
+      var computed = Infinity,
+          result = computed;
+
+      // allows working with functions like `_.map` without using
+      // their `index` argument as a callback
+      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+        callback = null;
+      }
+      if (callback == null && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (value < result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (callback == null && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg, 3);
+
+        baseEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current < computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the value of a specified property from all elements in the collection.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {string} property The name of the property to pluck.
+     * @returns {Array} Returns a new array of property values.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.pluck(characters, 'name');
+     * // => ['barney', 'fred']
+     */
+    var pluck = map;
+
+    /**
+     * Reduces a collection to a value which is the accumulated result of running
+     * each element in the collection through the callback, where each successive
+     * callback execution consumes the return value of the previous execution. If
+     * `accumulator` is not provided the first element of the collection will be
+     * used as the initial `accumulator` value. The callback is bound to `thisArg`
+     * and invoked with four arguments; (accumulator, value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @alias foldl, inject
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] Initial value of the accumulator.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var sum = _.reduce([1, 2, 3], function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     *   return result;
+     * }, {});
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function reduce(collection, callback, accumulator, thisArg) {
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        if (noaccum) {
+          accumulator = collection[++index];
+        }
+        while (++index < length) {
+          accumulator = callback(accumulator, collection[index], index, collection);
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          accumulator = noaccum
+            ? (noaccum = false, value)
+            : callback(accumulator, value, index, collection)
+        });
+      }
+      return accumulator;
+    }
+
+    /**
+     * This method is like `_.reduce` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias foldr
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] Initial value of the accumulator.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var list = [[0, 1], [2, 3], [4, 5]];
+     * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
+     * // => [4, 5, 2, 3, 0, 1]
+     */
+    function reduceRight(collection, callback, accumulator, thisArg) {
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+      forEachRight(collection, function(value, index, collection) {
+        accumulator = noaccum
+          ? (noaccum = false, value)
+          : callback(accumulator, value, index, collection);
+      });
+      return accumulator;
+    }
+
+    /**
+     * The opposite of `_.filter` this method returns the elements of a
+     * collection that the callback does **not** return truey for.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that failed the callback check.
+     * @example
+     *
+     * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [1, 3, 5]
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.reject(characters, 'blocked');
+     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+     *
+     * // using "_.where" callback shorthand
+     * _.reject(characters, { 'age': 36 });
+     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+     */
+    function reject(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg, 3);
+      return filter(collection, function(value, index, collection) {
+        return !callback(value, index, collection);
+      });
+    }
+
+    /**
+     * Retrieves a random element or `n` random elements from a collection.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to sample.
+     * @param {number} [n] The number of elements to sample.
+     * @param- {Object} [guard] Allows working with functions like `_.map`
+     *  without using their `index` arguments as `n`.
+     * @returns {Array} Returns the random sample(s) of `collection`.
+     * @example
+     *
+     * _.sample([1, 2, 3, 4]);
+     * // => 2
+     *
+     * _.sample([1, 2, 3, 4], 2);
+     * // => [3, 1]
+     */
+    function sample(collection, n, guard) {
+      if (collection && typeof collection.length != 'number') {
+        collection = values(collection);
+      } else if (support.unindexedChars && isString(collection)) {
+        collection = collection.split('');
+      }
+      if (n == null || guard) {
+        return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
+      }
+      var result = shuffle(collection);
+      result.length = nativeMin(nativeMax(0, n), result.length);
+      return result;
+    }
+
+    /**
+     * Creates an array of shuffled values, using a version of the Fisher-Yates
+     * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to shuffle.
+     * @returns {Array} Returns a new shuffled collection.
+     * @example
+     *
+     * _.shuffle([1, 2, 3, 4, 5, 6]);
+     * // => [4, 1, 6, 3, 5, 2]
+     */
+    function shuffle(collection) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      forEach(collection, function(value) {
+        var rand = baseRandom(0, ++index);
+        result[index] = result[rand];
+        result[rand] = value;
+      });
+      return result;
+    }
+
+    /**
+     * Gets the size of the `collection` by returning `collection.length` for arrays
+     * and array-like objects or the number of own enumerable properties for objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to inspect.
+     * @returns {number} Returns `collection.length` or number of own enumerable properties.
+     * @example
+     *
+     * _.size([1, 2]);
+     * // => 2
+     *
+     * _.size({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => 3
+     *
+     * _.size('pebbles');
+     * // => 7
+     */
+    function size(collection) {
+      var length = collection ? collection.length : 0;
+      return typeof length == 'number' ? length : keys(collection).length;
+    }
+
+    /**
+     * Checks if the callback returns a truey value for **any** element of a
+     * collection. The function returns as soon as it finds a passing value and
+     * does not iterate over the entire collection. The callback is bound to
+     * `thisArg` and invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias any
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if any element passed the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.some([null, 0, 'yes', false], Boolean);
+     * // => true
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.some(characters, 'blocked');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.some(characters, { 'age': 1 });
+     * // => false
+     */
+    function some(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          if ((result = callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          return !(result = callback(value, index, collection));
+        });
+      }
+      return !!result;
+    }
+
+    /**
+     * Creates an array of elements, sorted in ascending order by the results of
+     * running each element in a collection through the callback. This method
+     * performs a stable sort, that is, it will preserve the original sort order
+     * of equal elements. The callback is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an array of property names is provided for `callback` the collection
+     * will be sorted by each property value.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Array|Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of sorted elements.
+     * @example
+     *
+     * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
+     * // => [3, 1, 2]
+     *
+     * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
+     * // => [3, 1, 2]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36 },
+     *   { 'name': 'fred',    'age': 40 },
+     *   { 'name': 'barney',  'age': 26 },
+     *   { 'name': 'fred',    'age': 30 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(_.sortBy(characters, 'age'), _.values);
+     * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]]
+     *
+     * // sorting by multiple properties
+     * _.map(_.sortBy(characters, ['name', 'age']), _.values);
+     * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]
+     */
+    function sortBy(collection, callback, thisArg) {
+      var index = -1,
+          isArr = isArray(callback),
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      if (!isArr) {
+        callback = lodash.createCallback(callback, thisArg, 3);
+      }
+      forEach(collection, function(value, key, collection) {
+        var object = result[++index] = getObject();
+        if (isArr) {
+          object.criteria = map(callback, function(key) { return value[key]; });
+        } else {
+          (object.criteria = getArray())[0] = callback(value, key, collection);
+        }
+        object.index = index;
+        object.value = value;
+      });
+
+      length = result.length;
+      result.sort(compareAscending);
+      while (length--) {
+        var object = result[length];
+        result[length] = object.value;
+        if (!isArr) {
+          releaseArray(object.criteria);
+        }
+        releaseObject(object);
+      }
+      return result;
+    }
+
+    /**
+     * Converts the `collection` to an array.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to convert.
+     * @returns {Array} Returns the new converted array.
+     * @example
+     *
+     * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
+     * // => [2, 3, 4]
+     */
+    function toArray(collection) {
+      if (collection && typeof collection.length == 'number') {
+        return (support.unindexedChars && isString(collection))
+          ? collection.split('')
+          : slice(collection);
+      }
+      return values(collection);
+    }
+
+    /**
+     * Performs a deep comparison of each element in a `collection` to the given
+     * `properties` object, returning an array of all elements that have equivalent
+     * property values.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Object} props The object of property values to filter by.
+     * @returns {Array} Returns a new array of elements that have the given properties.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] },
+     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * _.where(characters, { 'age': 36 });
+     * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }]
+     *
+     * _.where(characters, { 'pets': ['dino'] });
+     * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }]
+     */
+    var where = filter;
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array with all falsey values removed. The values `false`, `null`,
+     * `0`, `""`, `undefined`, and `NaN` are all falsey.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to compact.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.compact([0, 1, false, 2, '', 3]);
+     * // => [1, 2, 3]
+     */
+    function compact(array) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+        if (value) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array excluding all values of the provided arrays using strict
+     * equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {...Array} [values] The arrays of values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
+     * // => [1, 3, 4]
+     */
+    function difference(array) {
+      return baseDifference(array, baseFlatten(arguments, true, true, 1));
+    }
+
+    /**
+     * This method is like `_.find` except that it returns the index of the first
+     * element that passes the callback check, instead of the element itself.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': false },
+     *   { 'name': 'fred',    'age': 40, 'blocked': true },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+     * ];
+     *
+     * _.findIndex(characters, function(chr) {
+     *   return chr.age < 20;
+     * });
+     * // => 2
+     *
+     * // using "_.where" callback shorthand
+     * _.findIndex(characters, { 'age': 36 });
+     * // => 0
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findIndex(characters, 'blocked');
+     * // => 1
+     */
+    function findIndex(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0;
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (++index < length) {
+        if (callback(array[index], index, array)) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * This method is like `_.findIndex` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': true },
+     *   { 'name': 'fred',    'age': 40, 'blocked': false },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': true }
+     * ];
+     *
+     * _.findLastIndex(characters, function(chr) {
+     *   return chr.age > 30;
+     * });
+     * // => 1
+     *
+     * // using "_.where" callback shorthand
+     * _.findLastIndex(characters, { 'age': 36 });
+     * // => 0
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findLastIndex(characters, 'blocked');
+     * // => 2
+     */
+    function findLastIndex(array, callback, thisArg) {
+      var length = array ? array.length : 0;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (length--) {
+        if (callback(array[length], length, array)) {
+          return length;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Gets the first element or first `n` elements of an array. If a callback
+     * is provided elements at the beginning of the array are returned as long
+     * as the callback returns truey. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias head, take
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the first element(s) of `array`.
+     * @example
+     *
+     * _.first([1, 2, 3]);
+     * // => 1
+     *
+     * _.first([1, 2, 3], 2);
+     * // => [1, 2]
+     *
+     * _.first([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [1, 2]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.first(characters, 'blocked');
+     * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name');
+     * // => ['barney', 'fred']
+     */
+    function first(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = -1;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = callback;
+        if (n == null || thisArg) {
+          return array ? array[0] : undefined;
+        }
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, n), length));
+    }
+
+    /**
+     * Flattens a nested array (the nesting can be to any depth). If `isShallow`
+     * is truey, the array will only be flattened a single level. If a callback
+     * is provided each element of the array is passed through the callback before
+     * flattening. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new flattened array.
+     * @example
+     *
+     * _.flatten([1, [2], [3, [[4]]]]);
+     * // => [1, 2, 3, 4];
+     *
+     * _.flatten([1, [2], [3, [[4]]]], true);
+     * // => [1, 2, 3, [[4]]];
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },
+     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.flatten(characters, 'pets');
+     * // => ['hoppy', 'baby puss', 'dino']
+     */
+    function flatten(array, isShallow, callback, thisArg) {
+      // juggle arguments
+      if (typeof isShallow != 'boolean' && isShallow != null) {
+        thisArg = callback;
+        callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow;
+        isShallow = false;
+      }
+      if (callback != null) {
+        array = map(array, callback, thisArg);
+      }
+      return baseFlatten(array, isShallow);
+    }
+
+    /**
+     * Gets the index at which the first occurrence of `value` is found using
+     * strict equality for comparisons, i.e. `===`. If the array is already sorted
+     * providing `true` for `fromIndex` will run a faster binary search.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+     *  to perform a binary search on a sorted array.
+     * @returns {number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 1
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 4
+     *
+     * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
+     * // => 2
+     */
+    function indexOf(array, value, fromIndex) {
+      if (typeof fromIndex == 'number') {
+        var length = array ? array.length : 0;
+        fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
+      } else if (fromIndex) {
+        var index = sortedIndex(array, value);
+        return array[index] === value ? index : -1;
+      }
+      return baseIndexOf(array, value, fromIndex);
+    }
+
+    /**
+     * Gets all but the last element or last `n` elements of an array. If a
+     * callback is provided elements at the end of the array are excluded from
+     * the result as long as the callback returns truey. The callback is bound
+     * to `thisArg` and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.initial([1, 2, 3]);
+     * // => [1, 2]
+     *
+     * _.initial([1, 2, 3], 2);
+     * // => [1]
+     *
+     * _.initial([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [1]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.initial(characters, 'blocked');
+     * // => [{ 'name': 'barney',  'blocked': false, 'employer': 'slate' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name');
+     * // => ['barney', 'fred']
+     */
+    function initial(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : callback || n;
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
+    }
+
+    /**
+     * Creates an array of unique values present in all provided arrays using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of shared values.
+     * @example
+     *
+     * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+     * // => [1, 2]
+     */
+    function intersection() {
+      var args = [],
+          argsIndex = -1,
+          argsLength = arguments.length,
+          caches = getArray(),
+          indexOf = getIndexOf(),
+          trustIndexOf = indexOf === baseIndexOf,
+          seen = getArray();
+
+      while (++argsIndex < argsLength) {
+        var value = arguments[argsIndex];
+        if (isArray(value) || isArguments(value)) {
+          args.push(value);
+          caches.push(trustIndexOf && value.length >= largeArraySize &&
+            createCache(argsIndex ? args[argsIndex] : seen));
+        }
+      }
+      var array = args[0],
+          index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      outer:
+      while (++index < length) {
+        var cache = caches[0];
+        value = array[index];
+
+        if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
+          argsIndex = argsLength;
+          (cache || seen).push(value);
+          while (--argsIndex) {
+            cache = caches[argsIndex];
+            if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
+              continue outer;
+            }
+          }
+          result.push(value);
+        }
+      }
+      while (argsLength--) {
+        cache = caches[argsLength];
+        if (cache) {
+          releaseObject(cache);
+        }
+      }
+      releaseArray(caches);
+      releaseArray(seen);
+      return result;
+    }
+
+    /**
+     * Gets the last element or last `n` elements of an array. If a callback is
+     * provided elements at the end of the array are returned as long as the
+     * callback returns truey. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the last element(s) of `array`.
+     * @example
+     *
+     * _.last([1, 2, 3]);
+     * // => 3
+     *
+     * _.last([1, 2, 3], 2);
+     * // => [2, 3]
+     *
+     * _.last([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [2, 3]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.pluck(_.last(characters, 'blocked'), 'name');
+     * // => ['fred', 'pebbles']
+     *
+     * // using "_.where" callback shorthand
+     * _.last(characters, { 'employer': 'na' });
+     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+     */
+    function last(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = callback;
+        if (n == null || thisArg) {
+          return array ? array[length - 1] : undefined;
+        }
+      }
+      return slice(array, nativeMax(0, length - n));
+    }
+
+    /**
+     * Gets the index at which the last occurrence of `value` is found using strict
+     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
+     * as the offset from the end of the collection.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {number} [fromIndex=array.length-1] The index to search from.
+     * @returns {number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 4
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 1
+     */
+    function lastIndexOf(array, value, fromIndex) {
+      var index = array ? array.length : 0;
+      if (typeof fromIndex == 'number') {
+        index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
+      }
+      while (index--) {
+        if (array[index] === value) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Removes all provided values from the given array using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to modify.
+     * @param {...*} [value] The values to remove.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3, 1, 2, 3];
+     * _.pull(array, 2, 3);
+     * console.log(array);
+     * // => [1, 1]
+     */
+    function pull(array) {
+      var args = arguments,
+          argsIndex = 0,
+          argsLength = args.length,
+          length = array ? array.length : 0;
+
+      while (++argsIndex < argsLength) {
+        var index = -1,
+            value = args[argsIndex];
+        while (++index < length) {
+          if (array[index] === value) {
+            splice.call(array, index--, 1);
+            length--;
+          }
+        }
+      }
+      return array;
+    }
+
+    /**
+     * Creates an array of numbers (positive and/or negative) progressing from
+     * `start` up to but not including `end`. If `start` is less than `stop` a
+     * zero-length range is created unless a negative `step` is specified.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns a new range array.
+     * @example
+     *
+     * _.range(4);
+     * // => [0, 1, 2, 3]
+     *
+     * _.range(1, 5);
+     * // => [1, 2, 3, 4]
+     *
+     * _.range(0, 20, 5);
+     * // => [0, 5, 10, 15]
+     *
+     * _.range(0, -4, -1);
+     * // => [0, -1, -2, -3]
+     *
+     * _.range(1, 4, 0);
+     * // => [1, 1, 1]
+     *
+     * _.range(0);
+     * // => []
+     */
+    function range(start, end, step) {
+      start = +start || 0;
+      step = typeof step == 'number' ? step : (+step || 1);
+
+      if (end == null) {
+        end = start;
+        start = 0;
+      }
+      // use `Array(length)` so engines like Chakra and V8 avoid slower modes
+      // http://youtu.be/XAqIpGU8ZZk#t=17m25s
+      var index = -1,
+          length = nativeMax(0, ceil((end - start) / (step || 1))),
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = start;
+        start += step;
+      }
+      return result;
+    }
+
+    /**
+     * Removes all elements from an array that the callback returns truey for
+     * and returns an array of removed elements. The callback is bound to `thisArg`
+     * and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to modify.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of removed elements.
+     * @example
+     *
+     * var array = [1, 2, 3, 4, 5, 6];
+     * var evens = _.remove(array, function(num) { return num % 2 == 0; });
+     *
+     * console.log(array);
+     * // => [1, 3, 5]
+     *
+     * console.log(evens);
+     * // => [2, 4, 6]
+     */
+    function remove(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (++index < length) {
+        var value = array[index];
+        if (callback(value, index, array)) {
+          result.push(value);
+          splice.call(array, index--, 1);
+          length--;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The opposite of `_.initial` this method gets all but the first element or
+     * first `n` elements of an array. If a callback function is provided elements
+     * at the beginning of the array are excluded from the result as long as the
+     * callback returns truey. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias drop, tail
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.rest([1, 2, 3]);
+     * // => [2, 3]
+     *
+     * _.rest([1, 2, 3], 2);
+     * // => [3]
+     *
+     * _.rest([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [3]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': false,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.pluck(_.rest(characters, 'blocked'), 'name');
+     * // => ['fred', 'pebbles']
+     *
+     * // using "_.where" callback shorthand
+     * _.rest(characters, { 'employer': 'slate' });
+     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+     */
+    function rest(array, callback, thisArg) {
+      if (typeof callback != 'number' && callback != null) {
+        var n = 0,
+            index = -1,
+            length = array ? array.length : 0;
+
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
+      }
+      return slice(array, n);
+    }
+
+    /**
+     * Uses a binary search to determine the smallest index at which a value
+     * should be inserted into a given sorted array in order to maintain the sort
+     * order of the array. If a callback is provided it will be executed for
+     * `value` and each element of `array` to compute their sort ranking. The
+     * callback is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedIndex([20, 30, 50], 40);
+     * // => 2
+     *
+     * // using "_.pluck" callback shorthand
+     * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+     * // => 2
+     *
+     * var dict = {
+     *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
+     * };
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return dict.wordToNumber[word];
+     * });
+     * // => 2
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return this.wordToNumber[word];
+     * }, dict);
+     * // => 2
+     */
+    function sortedIndex(array, value, callback, thisArg) {
+      var low = 0,
+          high = array ? array.length : low;
+
+      // explicitly reference `identity` for better inlining in Firefox
+      callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
+      value = callback(value);
+
+      while (low < high) {
+        var mid = (low + high) >>> 1;
+        (callback(array[mid]) < value)
+          ? low = mid + 1
+          : high = mid;
+      }
+      return low;
+    }
+
+    /**
+     * Creates an array of unique values, in order, of the provided arrays using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of combined values.
+     * @example
+     *
+     * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+     * // => [1, 2, 3, 5, 4]
+     */
+    function union() {
+      return baseUniq(baseFlatten(arguments, true, true));
+    }
+
+    /**
+     * Creates a duplicate-value-free version of an array using strict equality
+     * for comparisons, i.e. `===`. If the array is sorted, providing
+     * `true` for `isSorted` will use a faster algorithm. If a callback is provided
+     * each element of `array` is passed through the callback before uniqueness
+     * is computed. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias unique
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a duplicate-value-free array.
+     * @example
+     *
+     * _.uniq([1, 2, 1, 3, 1]);
+     * // => [1, 2, 3]
+     *
+     * _.uniq([1, 1, 2, 2, 3], true);
+     * // => [1, 2, 3]
+     *
+     * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
+     * // => ['A', 'b', 'C']
+     *
+     * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
+     * // => [1, 2.5, 3]
+     *
+     * // using "_.pluck" callback shorthand
+     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    function uniq(array, isSorted, callback, thisArg) {
+      // juggle arguments
+      if (typeof isSorted != 'boolean' && isSorted != null) {
+        thisArg = callback;
+        callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;
+        isSorted = false;
+      }
+      if (callback != null) {
+        callback = lodash.createCallback(callback, thisArg, 3);
+      }
+      return baseUniq(array, isSorted, callback);
+    }
+
+    /**
+     * Creates an array excluding all provided values using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to filter.
+     * @param {...*} [value] The values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
+     * // => [2, 3, 4]
+     */
+    function without(array) {
+      return baseDifference(array, slice(arguments, 1));
+    }
+
+    /**
+     * Creates an array that is the symmetric difference of the provided arrays.
+     * See http://en.wikipedia.org/wiki/Symmetric_difference.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of values.
+     * @example
+     *
+     * _.xor([1, 2, 3], [5, 2, 1, 4]);
+     * // => [3, 5, 4]
+     *
+     * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);
+     * // => [1, 4, 5]
+     */
+    function xor() {
+      var index = -1,
+          length = arguments.length;
+
+      while (++index < length) {
+        var array = arguments[index];
+        if (isArray(array) || isArguments(array)) {
+          var result = result
+            ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result)))
+            : array;
+        }
+      }
+      return result || [];
+    }
+
+    /**
+     * Creates an array of grouped elements, the first of which contains the first
+     * elements of the given arrays, the second of which contains the second
+     * elements of the given arrays, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @alias unzip
+     * @category Arrays
+     * @param {...Array} [array] Arrays to process.
+     * @returns {Array} Returns a new array of grouped elements.
+     * @example
+     *
+     * _.zip(['fred', 'barney'], [30, 40], [true, false]);
+     * // => [['fred', 30, true], ['barney', 40, false]]
+     */
+    function zip() {
+      var array = arguments.length > 1 ? arguments : arguments[0],
+          index = -1,
+          length = array ? max(pluck(array, 'length')) : 0,
+          result = Array(length < 0 ? 0 : length);
+
+      while (++index < length) {
+        result[index] = pluck(array, index);
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed from arrays of `keys` and `values`. Provide
+     * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+     * or two arrays, one of `keys` and one of corresponding `values`.
+     *
+     * @static
+     * @memberOf _
+     * @alias object
+     * @category Arrays
+     * @param {Array} keys The array of keys.
+     * @param {Array} [values=[]] The array of values.
+     * @returns {Object} Returns an object composed of the given keys and
+     *  corresponding values.
+     * @example
+     *
+     * _.zipObject(['fred', 'barney'], [30, 40]);
+     * // => { 'fred': 30, 'barney': 40 }
+     */
+    function zipObject(keys, values) {
+      var index = -1,
+          length = keys ? keys.length : 0,
+          result = {};
+
+      if (!values && length && !isArray(keys[0])) {
+        values = [];
+      }
+      while (++index < length) {
+        var key = keys[index];
+        if (values) {
+          result[key] = values[index];
+        } else if (key) {
+          result[key[0]] = key[1];
+        }
+      }
+      return result;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a function that executes `func`, with  the `this` binding and
+     * arguments of the created function, only after being called `n` times.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {number} n The number of times the function must be called before
+     *  `func` is executed.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var saves = ['profile', 'settings'];
+     *
+     * var done = _.after(saves.length, function() {
+     *   console.log('Done saving!');
+     * });
+     *
+     * _.forEach(saves, function(type) {
+     *   asyncSave({ 'type': type, 'complete': done });
+     * });
+     * // => logs 'Done saving!', after all saves have completed
+     */
+    function after(n, func) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      return function() {
+        if (--n < 1) {
+          return func.apply(this, arguments);
+        }
+      };
+    }
+
+    /**
+     * Creates a function that, when called, invokes `func` with the `this`
+     * binding of `thisArg` and prepends any additional `bind` arguments to those
+     * provided to the bound function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to bind.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var func = function(greeting) {
+     *   return greeting + ' ' + this.name;
+     * };
+     *
+     * func = _.bind(func, { 'name': 'fred' }, 'hi');
+     * func();
+     * // => 'hi fred'
+     */
+    function bind(func, thisArg) {
+      return arguments.length > 2
+        ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
+        : createWrapper(func, 1, null, null, thisArg);
+    }
+
+    /**
+     * Binds methods of an object to the object itself, overwriting the existing
+     * method. Method names may be specified as individual arguments or as arrays
+     * of method names. If no method names are provided all the function properties
+     * of `object` will be bound.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object to bind and assign the bound methods to.
+     * @param {...string} [methodName] The object method names to
+     *  bind, specified as individual method names or arrays of method names.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'onClick': function() { console.log('clicked ' + this.label); }
+     * };
+     *
+     * _.bindAll(view);
+     * jQuery('#docs').on('click', view.onClick);
+     * // => logs 'clicked docs', when the button is clicked
+     */
+    function bindAll(object) {
+      var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),
+          index = -1,
+          length = funcs.length;
+
+      while (++index < length) {
+        var key = funcs[index];
+        object[key] = createWrapper(object[key], 1, null, null, object);
+      }
+      return object;
+    }
+
+    /**
+     * Creates a function that, when called, invokes the method at `object[key]`
+     * and prepends any additional `bindKey` arguments to those provided to the bound
+     * function. This method differs from `_.bind` by allowing bound functions to
+     * reference methods that will be redefined or don't yet exist.
+     * See http://michaux.ca/articles/lazy-function-definition-pattern.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object the method belongs to.
+     * @param {string} key The key of the method.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var object = {
+     *   'name': 'fred',
+     *   'greet': function(greeting) {
+     *     return greeting + ' ' + this.name;
+     *   }
+     * };
+     *
+     * var func = _.bindKey(object, 'greet', 'hi');
+     * func();
+     * // => 'hi fred'
+     *
+     * object.greet = function(greeting) {
+     *   return greeting + 'ya ' + this.name + '!';
+     * };
+     *
+     * func();
+     * // => 'hiya fred!'
+     */
+    function bindKey(object, key) {
+      return arguments.length > 2
+        ? createWrapper(key, 19, slice(arguments, 2), null, object)
+        : createWrapper(key, 3, null, null, object);
+    }
+
+    /**
+     * Creates a function that is the composition of the provided functions,
+     * where each function consumes the return value of the function that follows.
+     * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
+     * Each function is executed with the `this` binding of the composed function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {...Function} [func] Functions to compose.
+     * @returns {Function} Returns the new composed function.
+     * @example
+     *
+     * var realNameMap = {
+     *   'pebbles': 'penelope'
+     * };
+     *
+     * var format = function(name) {
+     *   name = realNameMap[name.toLowerCase()] || name;
+     *   return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
+     * };
+     *
+     * var greet = function(formatted) {
+     *   return 'Hiya ' + formatted + '!';
+     * };
+     *
+     * var welcome = _.compose(greet, format);
+     * welcome('pebbles');
+     * // => 'Hiya Penelope!'
+     */
+    function compose() {
+      var funcs = arguments,
+          length = funcs.length;
+
+      while (length--) {
+        if (!isFunction(funcs[length])) {
+          throw new TypeError;
+        }
+      }
+      return function() {
+        var args = arguments,
+            length = funcs.length;
+
+        while (length--) {
+          args = [funcs[length].apply(this, args)];
+        }
+        return args[0];
+      };
+    }
+
+    /**
+     * Creates a function which accepts one or more arguments of `func` that when
+     * invoked either executes `func` returning its result, if all `func` arguments
+     * have been provided, or returns a function that accepts one or more of the
+     * remaining `func` arguments, and so on. The arity of `func` can be specified
+     * if `func.length` is not sufficient.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var curried = _.curry(function(a, b, c) {
+     *   console.log(a + b + c);
+     * });
+     *
+     * curried(1)(2)(3);
+     * // => 6
+     *
+     * curried(1, 2)(3);
+     * // => 6
+     *
+     * curried(1, 2, 3);
+     * // => 6
+     */
+    function curry(func, arity) {
+      arity = typeof arity == 'number' ? arity : (+arity || func.length);
+      return createWrapper(func, 4, null, null, null, arity);
+    }
+
+    /**
+     * Creates a function that will delay the execution of `func` until after
+     * `wait` milliseconds have elapsed since the last time it was invoked.
+     * Provide an options object to indicate that `func` should be invoked on
+     * the leading and/or trailing edge of the `wait` timeout. Subsequent calls
+     * to the debounced function will return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true` `func` will be called
+     * on the trailing edge of the timeout only if the the debounced function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to debounce.
+     * @param {number} wait The number of milliseconds to delay.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout.
+     * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called.
+     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new debounced function.
+     * @example
+     *
+     * // avoid costly calculations while the window size is in flux
+     * var lazyLayout = _.debounce(calculateLayout, 150);
+     * jQuery(window).on('resize', lazyLayout);
+     *
+     * // execute `sendMail` when the click event is fired, debouncing subsequent calls
+     * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+     *   'leading': true,
+     *   'trailing': false
+     * });
+     *
+     * // ensure `batchLog` is executed once after 1 second of debounced calls
+     * var source = new EventSource('/stream');
+     * source.addEventListener('message', _.debounce(batchLog, 250, {
+     *   'maxWait': 1000
+     * }, false);
+     */
+    function debounce(func, wait, options) {
+      var args,
+          maxTimeoutId,
+          result,
+          stamp,
+          thisArg,
+          timeoutId,
+          trailingCall,
+          lastCalled = 0,
+          maxWait = false,
+          trailing = true;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      wait = nativeMax(0, wait) || 0;
+      if (options === true) {
+        var leading = true;
+        trailing = false;
+      } else if (isObject(options)) {
+        leading = options.leading;
+        maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      var delayed = function() {
+        var remaining = wait - (now() - stamp);
+        if (remaining <= 0) {
+          if (maxTimeoutId) {
+            clearTimeout(maxTimeoutId);
+          }
+          var isCalled = trailingCall;
+          maxTimeoutId = timeoutId = trailingCall = undefined;
+          if (isCalled) {
+            lastCalled = now();
+            result = func.apply(thisArg, args);
+            if (!timeoutId && !maxTimeoutId) {
+              args = thisArg = null;
+            }
+          }
+        } else {
+          timeoutId = setTimeout(delayed, remaining);
+        }
+      };
+
+      var maxDelayed = function() {
+        if (timeoutId) {
+          clearTimeout(timeoutId);
+        }
+        maxTimeoutId = timeoutId = trailingCall = undefined;
+        if (trailing || (maxWait !== wait)) {
+          lastCalled = now();
+          result = func.apply(thisArg, args);
+          if (!timeoutId && !maxTimeoutId) {
+            args = thisArg = null;
+          }
+        }
+      };
+
+      return function() {
+        args = arguments;
+        stamp = now();
+        thisArg = this;
+        trailingCall = trailing && (timeoutId || !leading);
+
+        if (maxWait === false) {
+          var leadingCall = leading && !timeoutId;
+        } else {
+          if (!maxTimeoutId && !leading) {
+            lastCalled = stamp;
+          }
+          var remaining = maxWait - (stamp - lastCalled),
+              isCalled = remaining <= 0;
+
+          if (isCalled) {
+            if (maxTimeoutId) {
+              maxTimeoutId = clearTimeout(maxTimeoutId);
+            }
+            lastCalled = stamp;
+            result = func.apply(thisArg, args);
+          }
+          else if (!maxTimeoutId) {
+            maxTimeoutId = setTimeout(maxDelayed, remaining);
+          }
+        }
+        if (isCalled && timeoutId) {
+          timeoutId = clearTimeout(timeoutId);
+        }
+        else if (!timeoutId && wait !== maxWait) {
+          timeoutId = setTimeout(delayed, wait);
+        }
+        if (leadingCall) {
+          isCalled = true;
+          result = func.apply(thisArg, args);
+        }
+        if (isCalled && !timeoutId && !maxTimeoutId) {
+          args = thisArg = null;
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Defers executing the `func` function until the current call stack has cleared.
+     * Additional arguments will be provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to defer.
+     * @param {...*} [arg] Arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.defer(function(text) { console.log(text); }, 'deferred');
+     * // logs 'deferred' after one or more milliseconds
+     */
+    function defer(func) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var args = slice(arguments, 1);
+      return setTimeout(function() { func.apply(undefined, args); }, 1);
+    }
+
+    /**
+     * Executes the `func` function after `wait` milliseconds. Additional arguments
+     * will be provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay execution.
+     * @param {...*} [arg] Arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.delay(function(text) { console.log(text); }, 1000, 'later');
+     * // => logs 'later' after one second
+     */
+    function delay(func, wait) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var args = slice(arguments, 2);
+      return setTimeout(function() { func.apply(undefined, args); }, wait);
+    }
+
+    /**
+     * Creates a function that memoizes the result of `func`. If `resolver` is
+     * provided it will be used to determine the cache key for storing the result
+     * based on the arguments provided to the memoized function. By default, the
+     * first argument provided to the memoized function is used as the cache key.
+     * The `func` is executed with the `this` binding of the memoized function.
+     * The result cache is exposed as the `cache` property on the memoized function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to have its output memoized.
+     * @param {Function} [resolver] A function used to resolve the cache key.
+     * @returns {Function} Returns the new memoizing function.
+     * @example
+     *
+     * var fibonacci = _.memoize(function(n) {
+     *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
+     * });
+     *
+     * fibonacci(9)
+     * // => 34
+     *
+     * var data = {
+     *   'fred': { 'name': 'fred', 'age': 40 },
+     *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // modifying the result cache
+     * var get = _.memoize(function(name) { return data[name]; }, _.identity);
+     * get('pebbles');
+     * // => { 'name': 'pebbles', 'age': 1 }
+     *
+     * get.cache.pebbles.name = 'penelope';
+     * get('pebbles');
+     * // => { 'name': 'penelope', 'age': 1 }
+     */
+    function memoize(func, resolver) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var memoized = function() {
+        var cache = memoized.cache,
+            key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];
+
+        return hasOwnProperty.call(cache, key)
+          ? cache[key]
+          : (cache[key] = func.apply(this, arguments));
+      }
+      memoized.cache = {};
+      return memoized;
+    }
+
+    /**
+     * Creates a function that is restricted to execute `func` once. Repeat calls to
+     * the function will return the value of the first call. The `func` is executed
+     * with the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var initialize = _.once(createApplication);
+     * initialize();
+     * initialize();
+     * // `initialize` executes `createApplication` once
+     */
+    function once(func) {
+      var ran,
+          result;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      return function() {
+        if (ran) {
+          return result;
+        }
+        ran = true;
+        result = func.apply(this, arguments);
+
+        // clear the `func` variable so the function may be garbage collected
+        func = null;
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that, when called, invokes `func` with any additional
+     * `partial` arguments prepended to those provided to the new function. This
+     * method is similar to `_.bind` except it does **not** alter the `this` binding.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var greet = function(greeting, name) { return greeting + ' ' + name; };
+     * var hi = _.partial(greet, 'hi');
+     * hi('fred');
+     * // => 'hi fred'
+     */
+    function partial(func) {
+      return createWrapper(func, 16, slice(arguments, 1));
+    }
+
+    /**
+     * This method is like `_.partial` except that `partial` arguments are
+     * appended to those provided to the new function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var defaultsDeep = _.partialRight(_.merge, _.defaults);
+     *
+     * var options = {
+     *   'variable': 'data',
+     *   'imports': { 'jq': $ }
+     * };
+     *
+     * defaultsDeep(options, _.templateSettings);
+     *
+     * options.variable
+     * // => 'data'
+     *
+     * options.imports
+     * // => { '_': _, 'jq': $ }
+     */
+    function partialRight(func) {
+      return createWrapper(func, 32, null, slice(arguments, 1));
+    }
+
+    /**
+     * Creates a function that, when executed, will only call the `func` function
+     * at most once per every `wait` milliseconds. Provide an options object to
+     * indicate that `func` should be invoked on the leading and/or trailing edge
+     * of the `wait` timeout. Subsequent calls to the throttled function will
+     * return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true` `func` will be called
+     * on the trailing edge of the timeout only if the the throttled function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to throttle.
+     * @param {number} wait The number of milliseconds to throttle executions to.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout.
+     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new throttled function.
+     * @example
+     *
+     * // avoid excessively updating the position while scrolling
+     * var throttled = _.throttle(updatePosition, 100);
+     * jQuery(window).on('scroll', throttled);
+     *
+     * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes
+     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+     *   'trailing': false
+     * }));
+     */
+    function throttle(func, wait, options) {
+      var leading = true,
+          trailing = true;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      if (options === false) {
+        leading = false;
+      } else if (isObject(options)) {
+        leading = 'leading' in options ? options.leading : leading;
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      debounceOptions.leading = leading;
+      debounceOptions.maxWait = wait;
+      debounceOptions.trailing = trailing;
+
+      return debounce(func, wait, debounceOptions);
+    }
+
+    /**
+     * Creates a function that provides `value` to the wrapper function as its
+     * first argument. Additional arguments provided to the function are appended
+     * to those provided to the wrapper function. The wrapper is executed with
+     * the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {*} value The value to wrap.
+     * @param {Function} wrapper The wrapper function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var p = _.wrap(_.escape, function(func, text) {
+     *   return '<p>' + func(text) + '</p>';
+     * });
+     *
+     * p('Fred, Wilma, & Pebbles');
+     * // => '<p>Fred, Wilma, &amp; Pebbles</p>'
+     */
+    function wrap(value, wrapper) {
+      return createWrapper(wrapper, 16, [value]);
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a function that returns `value`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} value The value to return from the new function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * var getter = _.constant(object);
+     * getter() === object;
+     * // => true
+     */
+    function constant(value) {
+      return function() {
+        return value;
+      };
+    }
+
+    /**
+     * Produces a callback bound to an optional `thisArg`. If `func` is a property
+     * name the created callback will return the property value for a given element.
+     * If `func` is an object the created callback will return `true` for elements
+     * that contain the equivalent object properties, otherwise it will return `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} [func=identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of the created callback.
+     * @param {number} [argCount] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // wrap to create custom callback shorthands
+     * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
+     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
+     *   return !match ? func(callback, thisArg) : function(object) {
+     *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
+     *   };
+     * });
+     *
+     * _.filter(characters, 'age__gt38');
+     * // => [{ 'name': 'fred', 'age': 40 }]
+     */
+    function createCallback(func, thisArg, argCount) {
+      var type = typeof func;
+      if (func == null || type == 'function') {
+        return baseCreateCallback(func, thisArg, argCount);
+      }
+      // handle "_.pluck" style callback shorthands
+      if (type != 'object') {
+        return property(func);
+      }
+      var props = keys(func),
+          key = props[0],
+          a = func[key];
+
+      // handle "_.where" style callback shorthands
+      if (props.length == 1 && a === a && !isObject(a)) {
+        // fast path the common case of providing an object with a single
+        // property containing a primitive value
+        return function(object) {
+          var b = object[key];
+          return a === b && (a !== 0 || (1 / a == 1 / b));
+        };
+      }
+      return function(object) {
+        var length = props.length,
+            result = false;
+
+        while (length--) {
+          if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) {
+            break;
+          }
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
+     * corresponding HTML entities.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} string The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escape('Fred, Wilma, & Pebbles');
+     * // => 'Fred, Wilma, &amp; Pebbles'
+     */
+    function escape(string) {
+      return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+    }
+
+    /**
+     * This method returns the first argument provided to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} value Any value.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * _.identity(object) === object;
+     * // => true
+     */
+    function identity(value) {
+      return value;
+    }
+
+    /**
+     * Adds function properties of a source object to the destination object.
+     * If `object` is a function methods will be added to its prototype as well.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Function|Object} [object=lodash] object The destination object.
+     * @param {Object} source The object of functions to add.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.chain=true] Specify whether the functions added are chainable.
+     * @example
+     *
+     * function capitalize(string) {
+     *   return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
+     * }
+     *
+     * _.mixin({ 'capitalize': capitalize });
+     * _.capitalize('fred');
+     * // => 'Fred'
+     *
+     * _('fred').capitalize().value();
+     * // => 'Fred'
+     *
+     * _.mixin({ 'capitalize': capitalize }, { 'chain': false });
+     * _('fred').capitalize();
+     * // => 'Fred'
+     */
+    function mixin(object, source, options) {
+      var chain = true,
+          methodNames = source && functions(source);
+
+      if (!source || (!options && !methodNames.length)) {
+        if (options == null) {
+          options = source;
+        }
+        ctor = lodashWrapper;
+        source = object;
+        object = lodash;
+        methodNames = functions(source);
+      }
+      if (options === false) {
+        chain = false;
+      } else if (isObject(options) && 'chain' in options) {
+        chain = options.chain;
+      }
+      var ctor = object,
+          isFunc = isFunction(ctor);
+
+      forEach(methodNames, function(methodName) {
+        var func = object[methodName] = source[methodName];
+        if (isFunc) {
+          ctor.prototype[methodName] = function() {
+            var chainAll = this.__chain__,
+                value = this.__wrapped__,
+                args = [value];
+
+            push.apply(args, arguments);
+            var result = func.apply(object, args);
+            if (chain || chainAll) {
+              if (value === result && isObject(result)) {
+                return this;
+              }
+              result = new ctor(result);
+              result.__chain__ = chainAll;
+            }
+            return result;
+          };
+        }
+      });
+    }
+
+    /**
+     * Reverts the '_' variable to its previous value and returns a reference to
+     * the `lodash` function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @returns {Function} Returns the `lodash` function.
+     * @example
+     *
+     * var lodash = _.noConflict();
+     */
+    function noConflict() {
+      context._ = oldDash;
+      return this;
+    }
+
+    /**
+     * A no-operation function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * _.noop(object) === undefined;
+     * // => true
+     */
+    function noop() {
+      // no operation performed
+    }
+
+    /**
+     * Gets the number of milliseconds that have elapsed since the Unix epoch
+     * (1 January 1970 00:00:00 UTC).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @example
+     *
+     * var stamp = _.now();
+     * _.defer(function() { console.log(_.now() - stamp); });
+     * // => logs the number of milliseconds it took for the deferred function to be called
+     */
+    var now = isNative(now = Date.now) && now || function() {
+      return new Date().getTime();
+    };
+
+    /**
+     * Converts the given value into an integer of the specified radix.
+     * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the
+     * `value` is a hexadecimal, in which case a `radix` of `16` is used.
+     *
+     * Note: This method avoids differences in native ES3 and ES5 `parseInt`
+     * implementations. See http://es5.github.io/#E.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} value The value to parse.
+     * @param {number} [radix] The radix used to interpret the value to parse.
+     * @returns {number} Returns the new integer value.
+     * @example
+     *
+     * _.parseInt('08');
+     * // => 8
+     */
+    var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
+      // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`
+      return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
+    };
+
+    /**
+     * Creates a "_.pluck" style function, which returns the `key` value of a
+     * given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} key The name of the property to retrieve.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'fred',   'age': 40 },
+     *   { 'name': 'barney', 'age': 36 }
+     * ];
+     *
+     * var getName = _.property('name');
+     *
+     * _.map(characters, getName);
+     * // => ['barney', 'fred']
+     *
+     * _.sortBy(characters, getName);
+     * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred',   'age': 40 }]
+     */
+    function property(key) {
+      return function(object) {
+        return object[key];
+      };
+    }
+
+    /**
+     * Produces a random number between `min` and `max` (inclusive). If only one
+     * argument is provided a number between `0` and the given number will be
+     * returned. If `floating` is truey or either `min` or `max` are floats a
+     * floating-point number will be returned instead of an integer.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {number} [min=0] The minimum possible value.
+     * @param {number} [max=1] The maximum possible value.
+     * @param {boolean} [floating=false] Specify returning a floating-point number.
+     * @returns {number} Returns a random number.
+     * @example
+     *
+     * _.random(0, 5);
+     * // => an integer between 0 and 5
+     *
+     * _.random(5);
+     * // => also an integer between 0 and 5
+     *
+     * _.random(5, true);
+     * // => a floating-point number between 0 and 5
+     *
+     * _.random(1.2, 5.2);
+     * // => a floating-point number between 1.2 and 5.2
+     */
+    function random(min, max, floating) {
+      var noMin = min == null,
+          noMax = max == null;
+
+      if (floating == null) {
+        if (typeof min == 'boolean' && noMax) {
+          floating = min;
+          min = 1;
+        }
+        else if (!noMax && typeof max == 'boolean') {
+          floating = max;
+          noMax = true;
+        }
+      }
+      if (noMin && noMax) {
+        max = 1;
+      }
+      min = +min || 0;
+      if (noMax) {
+        max = min;
+        min = 0;
+      } else {
+        max = +max || 0;
+      }
+      if (floating || min % 1 || max % 1) {
+        var rand = nativeRandom();
+        return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max);
+      }
+      return baseRandom(min, max);
+    }
+
+    /**
+     * Resolves the value of property `key` on `object`. If `key` is a function
+     * it will be invoked with the `this` binding of `object` and its result returned,
+     * else the property value is returned. If `object` is falsey then `undefined`
+     * is returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Object} object The object to inspect.
+     * @param {string} key The name of the property to resolve.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = {
+     *   'cheese': 'crumpets',
+     *   'stuff': function() {
+     *     return 'nonsense';
+     *   }
+     * };
+     *
+     * _.result(object, 'cheese');
+     * // => 'crumpets'
+     *
+     * _.result(object, 'stuff');
+     * // => 'nonsense'
+     */
+    function result(object, key) {
+      if (object) {
+        var value = object[key];
+        return isFunction(value) ? object[key]() : value;
+      }
+    }
+
+    /**
+     * A micro-templating method that handles arbitrary delimiters, preserves
+     * whitespace, and correctly escapes quotes within interpolated code.
+     *
+     * Note: In the development build, `_.template` utilizes sourceURLs for easier
+     * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+     *
+     * For more information on precompiling templates see:
+     * http://lodash.com/custom-builds
+     *
+     * For more information on Chrome extension sandboxes see:
+     * http://developer.chrome.com/stable/extensions/sandboxingEval.html
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} text The template text.
+     * @param {Object} data The data object used to populate the text.
+     * @param {Object} [options] The options object.
+     * @param {RegExp} [options.escape] The "escape" delimiter.
+     * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
+     * @param {Object} [options.imports] An object to import into the template as local variables.
+     * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
+     * @param {string} [sourceURL] The sourceURL of the template's compiled source.
+     * @param {string} [variable] The data object variable name.
+     * @returns {Function|string} Returns a compiled function when no `data` object
+     *  is given, else it returns the interpolated text.
+     * @example
+     *
+     * // using the "interpolate" delimiter to create a compiled template
+     * var compiled = _.template('hello <%= name %>');
+     * compiled({ 'name': 'fred' });
+     * // => 'hello fred'
+     *
+     * // using the "escape" delimiter to escape HTML in data property values
+     * _.template('<b><%- value %></b>', { 'value': '<script>' });
+     * // => '<b>&lt;script&gt;</b>'
+     *
+     * // using the "evaluate" delimiter to generate HTML
+     * var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';
+     * _.template(list, { 'people': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+     * _.template('hello ${ name }', { 'name': 'pebbles' });
+     * // => 'hello pebbles'
+     *
+     * // using the internal `print` function in "evaluate" delimiters
+     * _.template('<% print("hello " + name); %>!', { 'name': 'barney' });
+     * // => 'hello barney!'
+     *
+     * // using a custom template delimiters
+     * _.templateSettings = {
+     *   'interpolate': /{{([\s\S]+?)}}/g
+     * };
+     *
+     * _.template('hello {{ name }}!', { 'name': 'mustache' });
+     * // => 'hello mustache!'
+     *
+     * // using the `imports` option to import jQuery
+     * var list = '<% jq.each(people, function(name) { %><li><%- name %></li><% }); %>';
+     * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the `sourceURL` option to specify a custom sourceURL for the template
+     * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
+     * compiled(data);
+     * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+     *
+     * // using the `variable` option to ensure a with-statement isn't used in the compiled template
+     * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });
+     * compiled.source;
+     * // => function(data) {
+     *   var __t, __p = '', __e = _.escape;
+     *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
+     *   return __p;
+     * }
+     *
+     * // using the `source` property to inline compiled templates for meaningful
+     * // line numbers in error messages and a stack trace
+     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+     *   var JST = {\
+     *     "main": ' + _.template(mainText).source + '\
+     *   };\
+     * ');
+     */
+    function template(text, data, options) {
+      // based on John Resig's `tmpl` implementation
+      // http://ejohn.org/blog/javascript-micro-templating/
+      // and Laura Doktorova's doT.js
+      // https://github.com/olado/doT
+      var settings = lodash.templateSettings;
+      text = String(text || '');
+
+      // avoid missing dependencies when `iteratorTemplate` is not defined
+      options = defaults({}, options, settings);
+
+      var imports = defaults({}, options.imports, settings.imports),
+          importsKeys = keys(imports),
+          importsValues = values(imports);
+
+      var isEvaluating,
+          index = 0,
+          interpolate = options.interpolate || reNoMatch,
+          source = "__p += '";
+
+      // compile the regexp to match each delimiter
+      var reDelimiters = RegExp(
+        (options.escape || reNoMatch).source + '|' +
+        interpolate.source + '|' +
+        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
+        (options.evaluate || reNoMatch).source + '|$'
+      , 'g');
+
+      text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
+        interpolateValue || (interpolateValue = esTemplateValue);
+
+        // escape characters that cannot be included in string literals
+        source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+
+        // replace delimiters with snippets
+        if (escapeValue) {
+          source += "' +\n__e(" + escapeValue + ") +\n'";
+        }
+        if (evaluateValue) {
+          isEvaluating = true;
+          source += "';\n" + evaluateValue + ";\n__p += '";
+        }
+        if (interpolateValue) {
+          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+        }
+        index = offset + match.length;
+
+        // the JS engine embedded in Adobe products requires returning the `match`
+        // string in order to produce the correct `offset` value
+        return match;
+      });
+
+      source += "';\n";
+
+      // if `variable` is not specified, wrap a with-statement around the generated
+      // code to add the data object to the top of the scope chain
+      var variable = options.variable,
+          hasVariable = variable;
+
+      if (!hasVariable) {
+        variable = 'obj';
+        source = 'with (' + variable + ') {\n' + source + '\n}\n';
+      }
+      // cleanup code by stripping empty strings
+      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
+        .replace(reEmptyStringMiddle, '$1')
+        .replace(reEmptyStringTrailing, '$1;');
+
+      // frame code as the function body
+      source = 'function(' + variable + ') {\n' +
+        (hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') +
+        "var __t, __p = '', __e = _.escape" +
+        (isEvaluating
+          ? ', __j = Array.prototype.join;\n' +
+            "function print() { __p += __j.call(arguments, '') }\n"
+          : ';\n'
+        ) +
+        source +
+        'return __p\n}';
+
+      // Use a sourceURL for easier debugging.
+      // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+      var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
+
+      try {
+        var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues);
+      } catch(e) {
+        e.source = source;
+        throw e;
+      }
+      if (data) {
+        return result(data);
+      }
+      // provide the compiled function's source by its `toString` method, in
+      // supported environments, or the `source` property as a convenience for
+      // inlining compiled templates during the build process
+      result.source = source;
+      return result;
+    }
+
+    /**
+     * Executes the callback `n` times, returning an array of the results
+     * of each callback execution. The callback is bound to `thisArg` and invoked
+     * with one argument; (index).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {number} n The number of times to execute the callback.
+     * @param {Function} callback The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns an array of the results of each `callback` execution.
+     * @example
+     *
+     * var diceRolls = _.times(3, _.partial(_.random, 1, 6));
+     * // => [3, 6, 4]
+     *
+     * _.times(3, function(n) { mage.castSpell(n); });
+     * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+     *
+     * _.times(3, function(n) { this.cast(n); }, mage);
+     * // => also calls `mage.castSpell(n)` three times
+     */
+    function times(n, callback, thisArg) {
+      n = (n = +n) > -1 ? n : 0;
+      var index = -1,
+          result = Array(n);
+
+      callback = baseCreateCallback(callback, thisArg, 1);
+      while (++index < n) {
+        result[index] = callback(index);
+      }
+      return result;
+    }
+
+    /**
+     * The inverse of `_.escape` this method converts the HTML entities
+     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
+     * corresponding characters.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} string The string to unescape.
+     * @returns {string} Returns the unescaped string.
+     * @example
+     *
+     * _.unescape('Fred, Barney &amp; Pebbles');
+     * // => 'Fred, Barney & Pebbles'
+     */
+    function unescape(string) {
+      return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
+    }
+
+    /**
+     * Generates a unique ID. If `prefix` is provided the ID will be appended to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} [prefix] The value to prefix the ID with.
+     * @returns {string} Returns the unique ID.
+     * @example
+     *
+     * _.uniqueId('contact_');
+     * // => 'contact_104'
+     *
+     * _.uniqueId();
+     * // => '105'
+     */
+    function uniqueId(prefix) {
+      var id = ++idCounter;
+      return String(prefix == null ? '' : prefix) + id;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object that wraps the given value with explicit
+     * method chaining enabled.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {*} value The value to wrap.
+     * @returns {Object} Returns the wrapper object.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36 },
+     *   { 'name': 'fred',    'age': 40 },
+     *   { 'name': 'pebbles', 'age': 1 }
+     * ];
+     *
+     * var youngest = _.chain(characters)
+     *     .sortBy('age')
+     *     .map(function(chr) { return chr.name + ' is ' + chr.age; })
+     *     .first()
+     *     .value();
+     * // => 'pebbles is 1'
+     */
+    function chain(value) {
+      value = new lodashWrapper(value);
+      value.__chain__ = true;
+      return value;
+    }
+
+    /**
+     * Invokes `interceptor` with the `value` as the first argument and then
+     * returns `value`. The purpose of this method is to "tap into" a method
+     * chain in order to perform operations on intermediate results within
+     * the chain.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * _([1, 2, 3, 4])
+     *  .tap(function(array) { array.pop(); })
+     *  .reverse()
+     *  .value();
+     * // => [3, 2, 1]
+     */
+    function tap(value, interceptor) {
+      interceptor(value);
+      return value;
+    }
+
+    /**
+     * Enables explicit method chaining on the wrapper object.
+     *
+     * @name chain
+     * @memberOf _
+     * @category Chaining
+     * @returns {*} Returns the wrapper object.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // without explicit chaining
+     * _(characters).first();
+     * // => { 'name': 'barney', 'age': 36 }
+     *
+     * // with explicit chaining
+     * _(characters).chain()
+     *   .first()
+     *   .pick('age')
+     *   .value();
+     * // => { 'age': 36 }
+     */
+    function wrapperChain() {
+      this.__chain__ = true;
+      return this;
+    }
+
+    /**
+     * Produces the `toString` result of the wrapped value.
+     *
+     * @name toString
+     * @memberOf _
+     * @category Chaining
+     * @returns {string} Returns the string result.
+     * @example
+     *
+     * _([1, 2, 3]).toString();
+     * // => '1,2,3'
+     */
+    function wrapperToString() {
+      return String(this.__wrapped__);
+    }
+
+    /**
+     * Extracts the wrapped value.
+     *
+     * @name valueOf
+     * @memberOf _
+     * @alias value
+     * @category Chaining
+     * @returns {*} Returns the wrapped value.
+     * @example
+     *
+     * _([1, 2, 3]).valueOf();
+     * // => [1, 2, 3]
+     */
+    function wrapperValueOf() {
+      return this.__wrapped__;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions that return wrapped values when chaining
+    lodash.after = after;
+    lodash.assign = assign;
+    lodash.at = at;
+    lodash.bind = bind;
+    lodash.bindAll = bindAll;
+    lodash.bindKey = bindKey;
+    lodash.chain = chain;
+    lodash.compact = compact;
+    lodash.compose = compose;
+    lodash.constant = constant;
+    lodash.countBy = countBy;
+    lodash.create = create;
+    lodash.createCallback = createCallback;
+    lodash.curry = curry;
+    lodash.debounce = debounce;
+    lodash.defaults = defaults;
+    lodash.defer = defer;
+    lodash.delay = delay;
+    lodash.difference = difference;
+    lodash.filter = filter;
+    lodash.flatten = flatten;
+    lodash.forEach = forEach;
+    lodash.forEachRight = forEachRight;
+    lodash.forIn = forIn;
+    lodash.forInRight = forInRight;
+    lodash.forOwn = forOwn;
+    lodash.forOwnRight = forOwnRight;
+    lodash.functions = functions;
+    lodash.groupBy = groupBy;
+    lodash.indexBy = indexBy;
+    lodash.initial = initial;
+    lodash.intersection = intersection;
+    lodash.invert = invert;
+    lodash.invoke = invoke;
+    lodash.keys = keys;
+    lodash.map = map;
+    lodash.mapValues = mapValues;
+    lodash.max = max;
+    lodash.memoize = memoize;
+    lodash.merge = merge;
+    lodash.min = min;
+    lodash.omit = omit;
+    lodash.once = once;
+    lodash.pairs = pairs;
+    lodash.partial = partial;
+    lodash.partialRight = partialRight;
+    lodash.pick = pick;
+    lodash.pluck = pluck;
+    lodash.property = property;
+    lodash.pull = pull;
+    lodash.range = range;
+    lodash.reject = reject;
+    lodash.remove = remove;
+    lodash.rest = rest;
+    lodash.shuffle = shuffle;
+    lodash.sortBy = sortBy;
+    lodash.tap = tap;
+    lodash.throttle = throttle;
+    lodash.times = times;
+    lodash.toArray = toArray;
+    lodash.transform = transform;
+    lodash.union = union;
+    lodash.uniq = uniq;
+    lodash.values = values;
+    lodash.where = where;
+    lodash.without = without;
+    lodash.wrap = wrap;
+    lodash.xor = xor;
+    lodash.zip = zip;
+    lodash.zipObject = zipObject;
+
+    // add aliases
+    lodash.collect = map;
+    lodash.drop = rest;
+    lodash.each = forEach;
+    lodash.eachRight = forEachRight;
+    lodash.extend = assign;
+    lodash.methods = functions;
+    lodash.object = zipObject;
+    lodash.select = filter;
+    lodash.tail = rest;
+    lodash.unique = uniq;
+    lodash.unzip = zip;
+
+    // add functions to `lodash.prototype`
+    mixin(lodash);
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions that return unwrapped values when chaining
+    lodash.clone = clone;
+    lodash.cloneDeep = cloneDeep;
+    lodash.contains = contains;
+    lodash.escape = escape;
+    lodash.every = every;
+    lodash.find = find;
+    lodash.findIndex = findIndex;
+    lodash.findKey = findKey;
+    lodash.findLast = findLast;
+    lodash.findLastIndex = findLastIndex;
+    lodash.findLastKey = findLastKey;
+    lodash.has = has;
+    lodash.identity = identity;
+    lodash.indexOf = indexOf;
+    lodash.isArguments = isArguments;
+    lodash.isArray = isArray;
+    lodash.isBoolean = isBoolean;
+    lodash.isDate = isDate;
+    lodash.isElement = isElement;
+    lodash.isEmpty = isEmpty;
+    lodash.isEqual = isEqual;
+    lodash.isFinite = isFinite;
+    lodash.isFunction = isFunction;
+    lodash.isNaN = isNaN;
+    lodash.isNull = isNull;
+    lodash.isNumber = isNumber;
+    lodash.isObject = isObject;
+    lodash.isPlainObject = isPlainObject;
+    lodash.isRegExp = isRegExp;
+    lodash.isString = isString;
+    lodash.isUndefined = isUndefined;
+    lodash.lastIndexOf = lastIndexOf;
+    lodash.mixin = mixin;
+    lodash.noConflict = noConflict;
+    lodash.noop = noop;
+    lodash.now = now;
+    lodash.parseInt = parseInt;
+    lodash.random = random;
+    lodash.reduce = reduce;
+    lodash.reduceRight = reduceRight;
+    lodash.result = result;
+    lodash.runInContext = runInContext;
+    lodash.size = size;
+    lodash.some = some;
+    lodash.sortedIndex = sortedIndex;
+    lodash.template = template;
+    lodash.unescape = unescape;
+    lodash.uniqueId = uniqueId;
+
+    // add aliases
+    lodash.all = every;
+    lodash.any = some;
+    lodash.detect = find;
+    lodash.findWhere = find;
+    lodash.foldl = reduce;
+    lodash.foldr = reduceRight;
+    lodash.include = contains;
+    lodash.inject = reduce;
+
+    mixin(function() {
+      var source = {}
+      forOwn(lodash, function(func, methodName) {
+        if (!lodash.prototype[methodName]) {
+          source[methodName] = func;
+        }
+      });
+      return source;
+    }(), false);
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions capable of returning wrapped and unwrapped values when chaining
+    lodash.first = first;
+    lodash.last = last;
+    lodash.sample = sample;
+
+    // add aliases
+    lodash.take = first;
+    lodash.head = first;
+
+    forOwn(lodash, function(func, methodName) {
+      var callbackable = methodName !== 'sample';
+      if (!lodash.prototype[methodName]) {
+        lodash.prototype[methodName]= function(n, guard) {
+          var chainAll = this.__chain__,
+              result = func(this.__wrapped__, n, guard);
+
+          return !chainAll && (n == null || (guard && !(callbackable && typeof n == 'function')))
+            ? result
+            : new lodashWrapper(result, chainAll);
+        };
+      }
+    });
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The semantic version number.
+     *
+     * @static
+     * @memberOf _
+     * @type string
+     */
+    lodash.VERSION = '2.4.1';
+
+    // add "Chaining" functions to the wrapper
+    lodash.prototype.chain = wrapperChain;
+    lodash.prototype.toString = wrapperToString;
+    lodash.prototype.value = wrapperValueOf;
+    lodash.prototype.valueOf = wrapperValueOf;
+
+    // add `Array` functions that return unwrapped values
+    baseEach(['join', 'pop', 'shift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        var chainAll = this.__chain__,
+            result = func.apply(this.__wrapped__, arguments);
+
+        return chainAll
+          ? new lodashWrapper(result, chainAll)
+          : result;
+      };
+    });
+
+    // add `Array` functions that return the existing wrapped value
+    baseEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        func.apply(this.__wrapped__, arguments);
+        return this;
+      };
+    });
+
+    // add `Array` functions that return new wrapped values
+    baseEach(['concat', 'slice', 'splice'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__);
+      };
+    });
+
+    // avoid array-like object bugs with `Array#shift` and `Array#splice`
+    // in IE < 9, Firefox < 10, Narwhal, and RingoJS
+    if (!support.spliceObjects) {
+      baseEach(['pop', 'shift', 'splice'], function(methodName) {
+        var func = arrayRef[methodName],
+            isSplice = methodName == 'splice';
+
+        lodash.prototype[methodName] = function() {
+          var chainAll = this.__chain__,
+              value = this.__wrapped__,
+              result = func.apply(value, arguments);
+
+          if (value.length === 0) {
+            delete value[0];
+          }
+          return (chainAll || isSplice)
+            ? new lodashWrapper(result, chainAll)
+            : result;
+        };
+      });
+    }
+
+    return lodash;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  // expose Lo-Dash
+  var _ = runInContext();
+
+  // some AMD build optimizers like r.js check for condition patterns like the following:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lo-Dash to the global object even when an AMD loader is present in
+    // case Lo-Dash is loaded with a RequireJS shim config.
+    // See http://requirejs.org/docs/api.html#config-shim
+    root._ = _;
+
+    // define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module
+    define(function() {
+      return _;
+    });
+  }
+  // check for `exports` after `define` in case a build optimizer adds an `exports` object
+  else if (freeExports && freeModule) {
+    // in Node.js or RingoJS
+    if (moduleExports) {
+      (freeModule.exports = _)._ = _;
+    }
+    // in Narwhal or Rhino -require
+    else {
+      freeExports._ = _;
+    }
+  }
+  else {
+    // in a browser or Rhino
+    root._ = _;
+  }
+}.call(this));
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.compat.min.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.compat.min.js
new file mode 100755 (executable)
index 0000000..d03b6ba
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
+ * Build: `lodash -o ./dist/lodash.compat.js`
+ */
+;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:b+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=true;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:b+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=true
+}}function r(n){return n.charCodeAt(0)}function u(n,t){for(var e=n.m,r=t.m,u=-1,o=e.length;++u<o;){var a=e[u],i=r[u];if(a!==i){if(a>i||typeof a=="undefined")return 1;if(a<i||typeof i=="undefined")return-1}}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[r/2|0],a=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&a&&typeof a=="object")return false;for(u=l(),u["false"]=u["null"]=u["true"]=u.undefined=false,o=l(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function a(n){return"\\"+Y[n]
+}function i(){return v.pop()||[]}function l(){return y.pop()||{k:null,l:null,m:null,"false":false,n:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,o:null}}function f(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function c(n){n.length=0,v.length<w&&v.push(n)}function p(n){var t=n.l;t&&p(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,y.length<w&&y.push(n)}function s(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r];
+return u}function g(e){function v(n){return n&&typeof n=="object"&&!qe(n)&&we.call(n,"__wrapped__")?n:new y(n)}function y(n,t){this.__chain__=!!t,this.__wrapped__=n}function w(n){function t(){if(r){var n=s(r);je.apply(n,arguments)}if(this instanceof t){var o=nt(e.prototype),n=e.apply(o,n||arguments);return xt(n)?n:o}return e.apply(u,n||arguments)}var e=n[0],r=n[2],u=n[4];return ze(t,n),t}function Y(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!xt(n))return n;var a=he.call(n);if(!V[a]||!Le.nodeClass&&f(n))return n;
+var l=Te[a];switch(a){case L:case z:return new l(+n);case W:case M:return new l(n);case J:return o=l(n.source,S.exec(n)),o.lastIndex=n.lastIndex,o}if(a=qe(n),t){var p=!r;r||(r=i()),u||(u=i());for(var g=r.length;g--;)if(r[g]==n)return u[g];o=a?l(n.length):{}}else o=a?s(n):Ye({},n);return a&&(we.call(n,"index")&&(o.index=n.index),we.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(a?Xe:tr)(n,function(n,a){o[a]=Y(n,t,e,r,u)}),p&&(c(r),c(u)),o):o}function nt(n){return xt(n)?Se(n):{}}function tt(n,t,e){if(typeof n!="function")return Ht;
+if(typeof t=="undefined"||!("prototype"in n))return n;var r=n.__bindData__;if(typeof r=="undefined"&&(Le.funcNames&&(r=!n.name),r=r||!Le.funcDecomp,!r)){var u=be.call(n);Le.funcNames||(r=!A.test(u)),r||(r=B.test(u),ze(n,r))}if(false===r||true!==r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)}}return Mt(n,t)}function et(n){function t(){var n=l?a:this;
+if(u){var h=s(u);je.apply(h,arguments)}return(o||c)&&(h||(h=s(arguments)),o&&je.apply(h,o),c&&h.length<i)?(r|=16,et([e,p?r:-4&r,h,null,a,i])):(h||(h=arguments),f&&(e=n[g]),this instanceof t?(n=nt(e.prototype),h=e.apply(n,h),xt(h)?h:n):e.apply(n,h))}var e=n[0],r=n[1],u=n[2],o=n[3],a=n[4],i=n[5],l=1&r,f=2&r,c=4&r,p=8&r,g=e;return ze(t,n),t}function rt(e,r){var u=-1,a=ht(),i=e?e.length:0,l=i>=_&&a===n,f=[];if(l){var c=o(r);c?(a=t,r=c):l=false}for(;++u<i;)c=e[u],0>a(r,c)&&f.push(c);return l&&p(r),f}function ot(n,t,e,r){r=(r||0)-1;
+for(var u=n?n.length:0,o=[];++r<u;){var a=n[r];if(a&&typeof a=="object"&&typeof a.length=="number"&&(qe(a)||dt(a))){t||(a=ot(a,t,e));var i=-1,l=a.length,f=o.length;for(o.length+=l;++i<l;)o[f++]=a[i]}else e||o.push(a)}return o}function at(n,t,e,r,u,o){if(e){var a=e(n,t);if(typeof a!="undefined")return!!a}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&X[typeof n]||t&&X[typeof t]))return false;if(null==n||null==t)return n===t;var l=he.call(n),p=he.call(t);if(l==T&&(l=G),p==T&&(p=G),l!=p)return false;switch(l){case L:case z:return+n==+t;
+case W:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case J:case M:return n==ie(t)}if(p=l==$,!p){var s=we.call(n,"__wrapped__"),g=we.call(t,"__wrapped__");if(s||g)return at(s?n.__wrapped__:n,g?t.__wrapped__:t,e,r,u,o);if(l!=G||!Le.nodeClass&&(f(n)||f(t)))return false;if(l=!Le.argsObject&&dt(n)?oe:n.constructor,s=!Le.argsObject&&dt(t)?oe:t.constructor,l!=s&&!(jt(l)&&l instanceof l&&jt(s)&&s instanceof s)&&"constructor"in n&&"constructor"in t)return false}for(l=!u,u||(u=i()),o||(o=i()),s=u.length;s--;)if(u[s]==n)return o[s]==t;
+var h=0,a=true;if(u.push(n),o.push(t),p){if(s=n.length,h=t.length,(a=h==s)||r)for(;h--;)if(p=s,g=t[h],r)for(;p--&&!(a=at(n[p],g,e,r,u,o)););else if(!(a=at(n[h],g,e,r,u,o)))break}else nr(t,function(t,i,l){return we.call(l,i)?(h++,a=we.call(n,i)&&at(n[i],t,e,r,u,o)):void 0}),a&&!r&&nr(n,function(n,t,e){return we.call(e,t)?a=-1<--h:void 0});return u.pop(),o.pop(),l&&(c(u),c(o)),a}function it(n,t,e,r,u){(qe(t)?Dt:tr)(t,function(t,o){var a,i,l=t,f=n[o];if(t&&((i=qe(t))||er(t))){for(l=r.length;l--;)if(a=r[l]==t){f=u[l];
+break}if(!a){var c;e&&(l=e(f,t),c=typeof l!="undefined")&&(f=l),c||(f=i?qe(f)?f:[]:er(f)?f:{}),r.push(t),u.push(f),c||it(f,t,e,r,u)}}else e&&(l=e(f,t),typeof l=="undefined"&&(l=t)),typeof l!="undefined"&&(f=l);n[o]=f})}function lt(n,t){return n+de(Fe()*(t-n+1))}function ft(e,r,u){var a=-1,l=ht(),f=e?e.length:0,s=[],g=!r&&f>=_&&l===n,h=u||g?i():s;for(g&&(h=o(h),l=t);++a<f;){var v=e[a],y=u?u(v,a,e):v;(r?!a||h[h.length-1]!==y:0>l(h,y))&&((u||g)&&h.push(y),s.push(v))}return g?(c(h.k),p(h)):u&&c(h),s}function ct(n){return function(t,e,r){var u={};
+if(e=v.createCallback(e,r,3),qe(t)){r=-1;for(var o=t.length;++r<o;){var a=t[r];n(u,a,e(a,r,t),t)}}else Xe(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function pt(n,t,e,r,u,o){var a=1&t,i=4&t,l=16&t,f=32&t;if(!(2&t||jt(n)))throw new le;l&&!e.length&&(t&=-17,l=e=false),f&&!r.length&&(t&=-33,f=r=false);var c=n&&n.__bindData__;return c&&true!==c?(c=s(c),c[2]&&(c[2]=s(c[2])),c[3]&&(c[3]=s(c[3])),!a||1&c[1]||(c[4]=u),!a&&1&c[1]&&(t|=8),!i||4&c[1]||(c[5]=o),l&&je.apply(c[2]||(c[2]=[]),e),f&&Ee.apply(c[3]||(c[3]=[]),r),c[1]|=t,pt.apply(null,c)):(1==t||17===t?w:et)([n,t,e,r,u,o])
+}function st(){Q.h=F,Q.b=Q.c=Q.g=Q.i="",Q.e="t",Q.j=true;for(var n,t=0;n=arguments[t];t++)for(var e in n)Q[e]=n[e];t=Q.a,Q.d=/^[^,]+/.exec(t)[0],n=ee,t="return function("+t+"){",e=Q;var r="var n,t="+e.d+",E="+e.e+";if(!t)return E;"+e.i+";";e.b?(r+="var u=t.length;n=-1;if("+e.b+"){",Le.unindexedChars&&(r+="if(s(t)){t=t.split('')}"),r+="while(++n<u){"+e.g+";}}else{"):Le.nonEnumArgs&&(r+="var u=t.length;n=-1;if(u&&p(t)){while(++n<u){n+='';"+e.g+";}}else{"),Le.enumPrototypes&&(r+="var G=typeof t=='function';"),Le.enumErrorProps&&(r+="var F=t===k||t instanceof Error;");
+var u=[];if(Le.enumPrototypes&&u.push('!(G&&n=="prototype")'),Le.enumErrorProps&&u.push('!(F&&(n=="message"||n=="name"))'),e.j&&e.f)r+="var C=-1,D=B[typeof t]&&v(t),u=D?D.length:0;while(++C<u){n=D[C];",u.length&&(r+="if("+u.join("&&")+"){"),r+=e.g+";",u.length&&(r+="}"),r+="}";else if(r+="for(n in t){",e.j&&u.push("m.call(t, n)"),u.length&&(r+="if("+u.join("&&")+"){"),r+=e.g+";",u.length&&(r+="}"),r+="}",Le.nonEnumShadows){for(r+="if(t!==A){var i=t.constructor,r=t===(i&&i.prototype),f=t===J?I:t===k?j:L.call(t),x=y[f];",k=0;7>k;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";
+r+="}"}return(e.b||Le.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(tt,q,ce,we,d,dt,qe,kt,Q.f,pe,X,$e,M,se,he)}function gt(n){return Ve[n]}function ht(){var t=(t=v.indexOf)===zt?n:t;return t}function vt(n){return typeof n=="function"&&ve.test(n)}function yt(n){var t,e;return!n||he.call(n)!=G||(t=n.constructor,jt(t)&&!(t instanceof t))||!Le.argsClass&&dt(n)||!Le.nodeClass&&f(n)?false:Le.ownLast?(nr(n,function(n,t,r){return e=we.call(r,t),false}),false!==e):(nr(n,function(n,t){e=t
+}),typeof e=="undefined"||we.call(n,e))}function mt(n){return He[n]}function dt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&he.call(n)==T||false}function bt(n,t,e){var r=We(n),u=r.length;for(t=tt(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function _t(n){var t=[];return nr(n,function(n,e){jt(n)&&t.push(e)}),t.sort()}function wt(n){for(var t=-1,e=We(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function jt(n){return typeof n=="function"}function xt(n){return!(!n||!X[typeof n])
+}function Ct(n){return typeof n=="number"||n&&typeof n=="object"&&he.call(n)==W||false}function kt(n){return typeof n=="string"||n&&typeof n=="object"&&he.call(n)==M||false}function Et(n){for(var t=-1,e=We(n),r=e.length,u=Zt(r);++t<r;)u[t]=n[e[t]];return u}function Ot(n,t,e){var r=-1,u=ht(),o=n?n.length:0,a=false;return e=(0>e?Be(0,o+e):e)||0,qe(n)?a=-1<u(n,t,e):typeof o=="number"?a=-1<(kt(n)?n.indexOf(t,e):u(n,t,e)):Xe(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function St(n,t,e){var r=true;if(t=v.createCallback(t,e,3),qe(n)){e=-1;
+for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else Xe(n,function(n,e,u){return r=!!t(n,e,u)});return r}function At(n,t,e){var r=[];if(t=v.createCallback(t,e,3),qe(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else Xe(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function It(n,t,e){if(t=v.createCallback(t,e,3),!qe(n)){var r;return Xe(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0}),r}e=-1;for(var u=n.length;++e<u;){var o=n[e];if(t(o,e,n))return o}}function Dt(n,t,e){if(t&&typeof e=="undefined"&&qe(n)){e=-1;
+for(var r=n.length;++e<r&&false!==t(n[e],e,n););}else Xe(n,t,e);return n}function Nt(n,t,e){var r=n,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),qe(n))for(;u--&&false!==t(n[u],u,n););else{if(typeof u!="number")var o=We(n),u=o.length;else Le.unindexedChars&&kt(n)&&(r=n.split(""));Xe(n,function(n,e,a){return e=o?o[--u]:--u,t(r[e],e,a)})}return n}function Bt(n,t,e){var r=-1,u=n?n.length:0,o=Zt(typeof u=="number"?u:0);if(t=v.createCallback(t,e,3),qe(n))for(;++r<u;)o[r]=t(n[r],r,n);else Xe(n,function(n,e,u){o[++r]=t(n,e,u)
+});return o}function Pt(n,t,e){var u=-1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&qe(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i>o&&(o=i)}}else t=null==t&&kt(n)?r:v.createCallback(t,e,3),Xe(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Rt(n,t,e,r){var u=3>arguments.length;if(t=v.createCallback(t,r,4),qe(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++o<a;)e=t(e,n[o],o,n)}else Xe(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)});return e}function Ft(n,t,e,r){var u=3>arguments.length;
+return t=v.createCallback(t,r,4),Nt(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function Tt(n){var t=-1,e=n?n.length:0,r=Zt(typeof e=="number"?e:0);return Dt(n,function(n){var e=lt(0,++t);r[t]=r[e],r[e]=n}),r}function $t(n,t,e){var r;if(t=v.createCallback(t,e,3),qe(n)){e=-1;for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else Xe(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function Lt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=v.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++
+}else if(r=t,null==r||e)return n?n[0]:h;return s(n,0,Pe(Be(0,r),u))}function zt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Be(0,u+r):r||0}else if(r)return r=Kt(t,e),t[r]===e?r:-1;return n(t,e,r)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=v.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Be(0,t);return s(n,r)}function Kt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?v.createCallback(e,r,1):Ht,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;
+return u}function Wt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(e=v.createCallback(e,r,3)),ft(n,t,e)}function Gt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?Pt(ar(n,"length")):0,r=Zt(0>e?0:e);++t<e;)r[t]=ar(n,t);return r}function Jt(n,t){var e=-1,r=n?n.length:0,u={};for(t||!r||qe(n[0])||(t=[]);++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Mt(n,t){return 2<arguments.length?pt(n,17,s(arguments,2),null,t):pt(n,1,null,null,t)
+}function Vt(n,t,e){var r,u,o,a,i,l,f,c=0,p=false,s=true;if(!jt(n))throw new le;if(t=Be(0,t)||0,true===e)var g=true,s=false;else xt(e)&&(g=e.leading,p="maxWait"in e&&(Be(t,e.maxWait)||0),s="trailing"in e?e.trailing:s);var v=function(){var e=t-(ir()-a);0<e?l=Ce(v,e):(u&&me(u),e=f,u=l=f=h,e&&(c=ir(),o=n.apply(i,r),l||u||(r=i=null)))},y=function(){l&&me(l),u=l=f=h,(s||p!==t)&&(c=ir(),o=n.apply(i,r),l||u||(r=i=null))};return function(){if(r=arguments,a=ir(),i=this,f=s&&(l||!g),false===p)var e=g&&!l;else{u||g||(c=a);
+var h=p-(a-c),m=0>=h;m?(u&&(u=me(u)),c=a,o=n.apply(i,r)):u||(u=Ce(y,h))}return m&&l?l=me(l):l||t===p||(l=Ce(v,t)),e&&(m=true,o=n.apply(i,r)),!m||l||u||(r=i=null),o}}function Ht(n){return n}function Ut(n,t,e){var r=true,u=t&&_t(t);t&&(e||u.length)||(null==e&&(e=t),o=y,t=n,n=v,u=_t(t)),false===e?r=false:xt(e)&&"chain"in e&&(r=e.chain);var o=n,a=jt(o);Dt(u,function(e){var u=n[e]=t[e];a&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,a=[e];if(je.apply(a,arguments),a=u.apply(n,a),r||t){if(e===a&&xt(a))return this;
+a=new o(a),a.__chain__=t}return a})})}function Qt(){}function Xt(n){return function(t){return t[n]}}function Yt(){return this.__wrapped__}e=e?ut.defaults(Z.Object(),e,ut.pick(Z,R)):Z;var Zt=e.Array,ne=e.Boolean,te=e.Date,ee=e.Function,re=e.Math,ue=e.Number,oe=e.Object,ae=e.RegExp,ie=e.String,le=e.TypeError,fe=[],ce=e.Error.prototype,pe=oe.prototype,se=ie.prototype,ge=e._,he=pe.toString,ve=ae("^"+ie(he).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ye=re.ceil,me=e.clearTimeout,de=re.floor,be=ee.prototype.toString,_e=vt(_e=oe.getPrototypeOf)&&_e,we=pe.hasOwnProperty,je=fe.push,xe=pe.propertyIsEnumerable,Ce=e.setTimeout,ke=fe.splice,Ee=fe.unshift,Oe=function(){try{var n={},t=vt(t=oe.defineProperty)&&t,e=t(n,n,n)&&t
+}catch(r){}return e}(),Se=vt(Se=oe.create)&&Se,Ae=vt(Ae=Zt.isArray)&&Ae,Ie=e.isFinite,De=e.isNaN,Ne=vt(Ne=oe.keys)&&Ne,Be=re.max,Pe=re.min,Re=e.parseInt,Fe=re.random,Te={};Te[$]=Zt,Te[L]=ne,Te[z]=te,Te[K]=ee,Te[G]=oe,Te[W]=ue,Te[J]=ae,Te[M]=ie;var $e={};$e[$]=$e[z]=$e[W]={constructor:true,toLocaleString:true,toString:true,valueOf:true},$e[L]=$e[M]={constructor:true,toString:true,valueOf:true},$e[q]=$e[K]=$e[J]={constructor:true,toString:true},$e[G]={constructor:true},function(){for(var n=F.length;n--;){var t,e=F[n];
+for(t in $e)we.call($e,t)&&!we.call($e[t],e)&&($e[t][e]=false)}}(),y.prototype=v.prototype;var Le=v.support={};!function(){var n=function(){this.x=1},t={0:1,length:1},r=[];n.prototype={valueOf:1,y:1};for(var u in new n)r.push(u);for(u in arguments);Le.argsClass=he.call(arguments)==T,Le.argsObject=arguments.constructor==oe&&!(arguments instanceof Zt),Le.enumErrorProps=xe.call(ce,"message")||xe.call(ce,"name"),Le.enumPrototypes=xe.call(n,"prototype"),Le.funcDecomp=!vt(e.WinRTError)&&B.test(g),Le.funcNames=typeof ee.name=="string",Le.nonEnumArgs=0!=u,Le.nonEnumShadows=!/valueOf/.test(r),Le.ownLast="x"!=r[0],Le.spliceObjects=(fe.splice.call(t,0,1),!t[0]),Le.unindexedChars="xx"!="x"[0]+oe("x")[0];
+try{Le.nodeClass=!(he.call(document)==G&&!({toString:0}+""))}catch(o){Le.nodeClass=true}}(1),v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:v}},Se||(nt=function(){function n(){}return function(t){if(xt(t)){n.prototype=t;var r=new n;n.prototype=null}return r||e.Object()}}());var ze=Oe?function(n,t){U.value=t,Oe(n,"__bindData__",U)}:Qt;Le.argsClass||(dt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n,"callee")&&!xe.call(n,"callee")||false
+});var qe=Ae||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&he.call(n)==$||false},Ke=st({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),We=Ne?function(n){return xt(n)?Le.enumPrototypes&&typeof n=="function"||Le.nonEnumArgs&&n.length&&dt(n)?Ke(n):Ne(n):[]}:Ke,Ge={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:We,g:"if(e(t[n],n,g)===false)return E"},Je={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b<c){t=a[b];if(t&&B[typeof t]){",v:We,g:"if(typeof E[n]=='undefined')E[n]=t[n]",c:"}}"},Me={i:"if(!B[typeof t])return E;"+Ge.i,b:false},Ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},He=wt(Ve),Ue=ae("("+We(He).join("|")+")","g"),Qe=ae("["+We(Ve).join("")+"]","g"),Xe=st(Ge),Ye=st(Je,{i:Je.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),Ze=st(Je),nr=st(Ge,Me,{j:false}),tr=st(Ge,Me);
+jt(/x/)&&(jt=function(n){return typeof n=="function"&&he.call(n)==K});var er=_e?function(n){if(!n||he.call(n)!=G||!Le.argsClass&&dt(n))return false;var t=n.valueOf,e=vt(t)&&(e=_e(t))&&_e(e);return e?n==e||_e(n)==e:yt(n)}:yt,rr=ct(function(n,t,e){we.call(n,e)?n[e]++:n[e]=1}),ur=ct(function(n,t,e){(we.call(n,e)?n[e]:n[e]=[]).push(t)}),or=ct(function(n,t,e){n[e]=t}),ar=Bt,ir=vt(ir=te.now)&&ir||function(){return(new te).getTime()},lr=8==Re(j+"08")?Re:function(n,t){return Re(kt(n)?n.replace(D,""):n,t||0)};
+return v.after=function(n,t){if(!jt(t))throw new le;return function(){return 1>--n?t.apply(this,arguments):void 0}},v.assign=Ye,v.at=function(n){var t=arguments,e=-1,r=ot(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Zt(t);for(Le.unindexedChars&&kt(n)&&(n=n.split(""));++e<t;)u[e]=n[r[e]];return u},v.bind=Mt,v.bindAll=function(n){for(var t=1<arguments.length?ot(arguments,true,false,1):_t(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=pt(n[u],1,null,null,n)}return n},v.bindKey=function(n,t){return 2<arguments.length?pt(t,19,s(arguments,2),null,n):pt(t,3,null,null,n)
+},v.chain=function(n){return n=new y(n),n.__chain__=true,n},v.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},v.compose=function(){for(var n=arguments,t=n.length;t--;)if(!jt(n[t]))throw new le;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},v.constant=function(n){return function(){return n}},v.countBy=rr,v.create=function(n,t){var e=nt(n);return t?Ye(e,t):e},v.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return tt(n,t,e);
+if("object"!=r)return Xt(n);var u=We(n),o=u[0],a=n[o];return 1!=u.length||a!==a||xt(a)?function(t){for(var e=u.length,r=false;e--&&(r=at(t[u[e]],n[u[e]],null,true)););return r}:function(n){return n=n[o],a===n&&(0!==a||1/a==1/n)}},v.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,pt(n,4,null,null,null,t)},v.debounce=Vt,v.defaults=Ze,v.defer=function(n){if(!jt(n))throw new le;var t=s(arguments,1);return Ce(function(){n.apply(h,t)},1)},v.delay=function(n,t){if(!jt(n))throw new le;var e=s(arguments,2);
+return Ce(function(){n.apply(h,e)},t)},v.difference=function(n){return rt(n,ot(arguments,true,true,1))},v.filter=At,v.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(n=Bt(n,e,r)),ot(n,t)},v.forEach=Dt,v.forEachRight=Nt,v.forIn=nr,v.forInRight=function(n,t,e){var r=[];nr(n,function(n,t){r.push(t,n)});var u=r.length;for(t=tt(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},v.forOwn=tr,v.forOwnRight=bt,v.functions=_t,v.groupBy=ur,v.indexBy=or,v.initial=function(n,t,e){var r=0,u=n?n.length:0;
+if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return s(n,0,Pe(Be(0,u-r),u))},v.intersection=function(){for(var e=[],r=-1,u=arguments.length,a=i(),l=ht(),f=l===n,s=i();++r<u;){var g=arguments[r];(qe(g)||dt(g))&&(e.push(g),a.push(f&&g.length>=_&&o(r?e[r]:s)))}var f=e[0],h=-1,v=f?f.length:0,y=[];n:for(;++h<v;){var m=a[0],g=f[h];if(0>(m?t(m,g):l(s,g))){for(r=u,(m||s).push(g);--r;)if(m=a[r],0>(m?t(m,g):l(e[r],g)))continue n;y.push(g)
+}}for(;u--;)(m=a[u])&&p(m);return c(a),c(s),y},v.invert=wt,v.invoke=function(n,t){var e=s(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Zt(typeof o=="number"?o:0);return Dt(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},v.keys=We,v.map=Bt,v.mapValues=function(n,t,e){var r={};return t=v.createCallback(t,e,3),tr(n,function(n,e,u){r[e]=t(n,e,u)}),r},v.max=Pt,v.memoize=function(n,t){if(!jt(n))throw new le;var e=function(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0];return we.call(r,u)?r[u]:r[u]=n.apply(this,arguments)
+};return e.cache={},e},v.merge=function(n){var t=arguments,e=2;if(!xt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=tt(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=s(arguments,1,e),u=-1,o=i(),a=i();++u<e;)it(n,t[u],r,o,a);return c(o),c(a),n},v.min=function(n,t,e){var u=1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&qe(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i<o&&(o=i)}}else t=null==t&&kt(n)?r:v.createCallback(t,e,3),Xe(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n)
+});return o},v.omit=function(n,t,e){var r={};if(typeof t!="function"){var u=[];nr(n,function(n,t){u.push(t)});for(var u=rt(u,ot(arguments,true,false,1)),o=-1,a=u.length;++o<a;){var i=u[o];r[i]=n[i]}}else t=v.createCallback(t,e,3),nr(n,function(n,e,u){t(n,e,u)||(r[e]=n)});return r},v.once=function(n){var t,e;if(!jt(n))throw new le;return function(){return t?e:(t=true,e=n.apply(this,arguments),n=null,e)}},v.pairs=function(n){for(var t=-1,e=We(n),r=e.length,u=Zt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u
+},v.partial=function(n){return pt(n,16,s(arguments,1))},v.partialRight=function(n){return pt(n,32,null,s(arguments,1))},v.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=ot(arguments,true,false,1),a=xt(n)?o.length:0;++u<a;){var i=o[u];i in n&&(r[i]=n[i])}else t=v.createCallback(t,e,3),nr(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},v.pluck=ar,v.property=Xt,v.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,a=t[e];++o<u;)n[o]===a&&(ke.call(n,o--,1),u--);
+return n},v.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Be(0,ye((t-n)/(e||1)));for(var u=Zt(t);++r<t;)u[r]=n,n+=e;return u},v.reject=function(n,t,e){return t=v.createCallback(t,e,3),At(n,function(n,e,r){return!t(n,e,r)})},v.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=v.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),ke.call(n,r--,1),u--);return o},v.rest=qt,v.shuffle=Tt,v.sortBy=function(n,t,e){var r=-1,o=qe(t),a=n?n.length:0,f=Zt(typeof a=="number"?a:0);
+for(o||(t=v.createCallback(t,e,3)),Dt(n,function(n,e,u){var a=f[++r]=l();o?a.m=Bt(t,function(t){return n[t]}):(a.m=i())[0]=t(n,e,u),a.n=r,a.o=n}),a=f.length,f.sort(u);a--;)n=f[a],f[a]=n.o,o||c(n.m),p(n);return f},v.tap=function(n,t){return t(n),n},v.throttle=function(n,t,e){var r=true,u=true;if(!jt(n))throw new le;return false===e?r=false:xt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),H.leading=r,H.maxWait=t,H.trailing=u,Vt(n,t,H)},v.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Zt(n);
+for(t=tt(t,e,1);++r<n;)u[r]=t(r);return u},v.toArray=function(n){return n&&typeof n.length=="number"?Le.unindexedChars&&kt(n)?n.split(""):s(n):Et(n)},v.transform=function(n,t,e,r){var u=qe(n);if(null==e)if(u)e=[];else{var o=n&&n.constructor;e=nt(o&&o.prototype)}return t&&(t=v.createCallback(t,r,4),(u?Xe:tr)(n,function(n,r,u){return t(e,n,r,u)})),e},v.union=function(){return ft(ot(arguments,true,true))},v.uniq=Wt,v.values=Et,v.where=At,v.without=function(n){return rt(n,s(arguments,1))},v.wrap=function(n,t){return pt(t,16,[n])
+},v.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var e=arguments[n];if(qe(e)||dt(e))var r=r?ft(rt(r,e).concat(rt(e,r))):e}return r||[]},v.zip=Gt,v.zipObject=Jt,v.collect=Bt,v.drop=qt,v.each=Dt,v.eachRight=Nt,v.extend=Ye,v.methods=_t,v.object=Jt,v.select=At,v.tail=qt,v.unique=Wt,v.unzip=Gt,Ut(v),v.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=false),Y(n,t,typeof e=="function"&&tt(e,r,1))},v.cloneDeep=function(n,t,e){return Y(n,true,typeof t=="function"&&tt(t,e,1))},v.contains=Ot,v.escape=function(n){return null==n?"":ie(n).replace(Qe,gt)
+},v.every=St,v.find=It,v.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=v.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},v.findKey=function(n,t,e){var r;return t=v.createCallback(t,e,3),tr(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},v.findLast=function(n,t,e){var r;return t=v.createCallback(t,e,3),Nt(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0}),r},v.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=v.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;
+return-1},v.findLastKey=function(n,t,e){var r;return t=v.createCallback(t,e,3),bt(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},v.has=function(n,t){return n?we.call(n,t):false},v.identity=Ht,v.indexOf=zt,v.isArguments=dt,v.isArray=qe,v.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&he.call(n)==L||false},v.isDate=function(n){return n&&typeof n=="object"&&he.call(n)==z||false},v.isElement=function(n){return n&&1===n.nodeType||false},v.isEmpty=function(n){var t=true;if(!n)return t;var e=he.call(n),r=n.length;
+return e==$||e==M||(Le.argsClass?e==T:dt(n))||e==G&&typeof r=="number"&&jt(n.splice)?!r:(tr(n,function(){return t=false}),t)},v.isEqual=function(n,t,e,r){return at(n,t,typeof e=="function"&&tt(e,r,2))},v.isFinite=function(n){return Ie(n)&&!De(parseFloat(n))},v.isFunction=jt,v.isNaN=function(n){return Ct(n)&&n!=+n},v.isNull=function(n){return null===n},v.isNumber=Ct,v.isObject=xt,v.isPlainObject=er,v.isRegExp=function(n){return n&&X[typeof n]&&he.call(n)==J||false},v.isString=kt,v.isUndefined=function(n){return typeof n=="undefined"
+},v.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Be(0,r+e):Pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},v.mixin=Ut,v.noConflict=function(){return e._=ge,this},v.noop=Qt,v.now=ir,v.parseInt=lr,v.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Fe(),Pe(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):lt(n,t)},v.reduce=Rt,v.reduceRight=Ft,v.result=function(n,t){if(n){var e=n[t];
+return jt(e)?n[t]():e}},v.runInContext=g,v.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:We(n).length},v.some=$t,v.sortedIndex=Kt,v.template=function(n,t,e){var r=v.templateSettings;n=ie(n||""),e=Ze({},e,r);var u,o=Ze({},e.imports,r.imports),r=We(o),o=Et(o),i=0,l=e.interpolate||N,f="__p+='",l=ae((e.escape||N).source+"|"+l.source+"|"+(l===I?O:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(P,a),e&&(f+="'+__e("+e+")+'"),l&&(u=true,f+="';"+l+";\n__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t
+}),f+="';",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(x,""):f).replace(C,"$1").replace(E,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=ee(r,"return "+f).apply(h,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},v.unescape=function(n){return null==n?"":ie(n).replace(Ue,mt)},v.uniqueId=function(n){var t=++m;return ie(null==n?"":n)+t
+},v.all=St,v.any=$t,v.detect=It,v.findWhere=It,v.foldl=Rt,v.foldr=Ft,v.include=Ot,v.inject=Rt,Ut(function(){var n={};return tr(v,function(t,e){v.prototype[e]||(n[e]=t)}),n}(),false),v.first=Lt,v.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Be(0,u-r))},v.sample=function(n,t,e){return n&&typeof n.length!="number"?n=Et(n):Le.unindexedChars&&kt(n)&&(n=n.split("")),null==t||e?n?n[lt(0,n.length-1)]:h:(n=Tt(n),n.length=Pe(Be(0,t),n.length),n)
+},v.take=Lt,v.head=Lt,tr(v,function(n,t){var e="sample"!==t;v.prototype[t]||(v.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new y(o,u):o})}),v.VERSION="2.4.1",v.prototype.chain=function(){return this.__chain__=true,this},v.prototype.toString=function(){return ie(this.__wrapped__)},v.prototype.value=Yt,v.prototype.valueOf=Yt,Xe(["join","pop","shift"],function(n){var t=fe[n];v.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);
+return n?new y(e,n):e}}),Xe(["push","reverse","sort","unshift"],function(n){var t=fe[n];v.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Xe(["concat","slice","splice"],function(n){var t=fe[n];v.prototype[n]=function(){return new y(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Le.spliceObjects||Xe(["pop","shift","splice"],function(n){var t=fe[n],e="splice"==n;v.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new y(u,n):u
+}}),v}var h,v=[],y=[],m=0,d={},b=+new Date+"",_=75,w=40,j=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",x=/\b__p\+='';/g,C=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,O=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,S=/\w*$/,A=/^\s*function[ \n\r\t]+\w/,I=/<%=([\s\S]+?)%>/g,D=RegExp("^["+j+"]*0+(?=.$)"),N=/($^)/,B=/\bthis\b/,P=/['\n\r\t\u2028\u2029\\]/g,R="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setTimeout".split(" "),F="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),T="[object Arguments]",$="[object Array]",L="[object Boolean]",z="[object Date]",q="[object Error]",K="[object Function]",W="[object Number]",G="[object Object]",J="[object RegExp]",M="[object String]",V={};
+V[K]=false,V[T]=V[$]=V[L]=V[z]=V[W]=V[G]=V[J]=V[M]=true;var H={leading:false,maxWait:0,trailing:false},U={configurable:false,enumerable:false,value:null,writable:false},Q={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:false},X={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},Y={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Z=X[typeof window]&&window||this,nt=X[typeof exports]&&exports&&!exports.nodeType&&exports,tt=X[typeof module]&&module&&!module.nodeType&&module,et=tt&&tt.exports===nt&&nt,rt=X[typeof global]&&global;
+!rt||rt.global!==rt&&rt.window!==rt||(Z=rt);var ut=g();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Z._=ut, define(function(){return ut})):nt&&tt?et?(tt.exports=ut)._=ut:nt._=ut:Z._=ut}).call(this);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.js
new file mode 100755 (executable)
index 0000000..d653e5a
--- /dev/null
@@ -0,0 +1,6785 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
+ * Build: `lodash modern -o ./dist/lodash.js`
+ * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+ * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
+ * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license <http://lodash.com/license>
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre ES5 environments */
+  var undefined;
+
+  /** Used to pool arrays and objects used internally */
+  var arrayPool = [],
+      objectPool = [];
+
+  /** Used to generate unique IDs */
+  var idCounter = 0;
+
+  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
+  var keyPrefix = +new Date + '';
+
+  /** Used as the size when optimizations are enabled for large arrays */
+  var largeArraySize = 75;
+
+  /** Used as the max size of the `arrayPool` and `objectPool` */
+  var maxPoolSize = 40;
+
+  /** Used to detect and test whitespace */
+  var whitespace = (
+    // whitespace
+    ' \t\x0B\f\xA0\ufeff' +
+
+    // line terminators
+    '\n\r\u2028\u2029' +
+
+    // unicode category "Zs" space separators
+    '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
+  );
+
+  /** Used to match empty string literals in compiled template source */
+  var reEmptyStringLeading = /\b__p \+= '';/g,
+      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+  /**
+   * Used to match ES6 template delimiters
+   * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals
+   */
+  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+  /** Used to match regexp flags from their coerced string values */
+  var reFlags = /\w*$/;
+
+  /** Used to detected named functions */
+  var reFuncName = /^\s*function[ \n\r\t]+\w/;
+
+  /** Used to match "interpolate" template delimiters */
+  var reInterpolate = /<%=([\s\S]+?)%>/g;
+
+  /** Used to match leading whitespace and zeros to be removed */
+  var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
+
+  /** Used to ensure capturing order of template delimiters */
+  var reNoMatch = /($^)/;
+
+  /** Used to detect functions containing a `this` reference */
+  var reThis = /\bthis\b/;
+
+  /** Used to match unescaped characters in compiled string literals */
+  var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
+
+  /** Used to assign default `context` object properties */
+  var contextProps = [
+    'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object',
+    'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',
+    'parseInt', 'setTimeout'
+  ];
+
+  /** Used to make template sourceURLs easier to identify */
+  var templateCounter = 0;
+
+  /** `Object#toString` result shortcuts */
+  var argsClass = '[object Arguments]',
+      arrayClass = '[object Array]',
+      boolClass = '[object Boolean]',
+      dateClass = '[object Date]',
+      funcClass = '[object Function]',
+      numberClass = '[object Number]',
+      objectClass = '[object Object]',
+      regexpClass = '[object RegExp]',
+      stringClass = '[object String]';
+
+  /** Used to identify object classifications that `_.clone` supports */
+  var cloneableClasses = {};
+  cloneableClasses[funcClass] = false;
+  cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
+  cloneableClasses[boolClass] = cloneableClasses[dateClass] =
+  cloneableClasses[numberClass] = cloneableClasses[objectClass] =
+  cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
+
+  /** Used as an internal `_.debounce` options object */
+  var debounceOptions = {
+    'leading': false,
+    'maxWait': 0,
+    'trailing': false
+  };
+
+  /** Used as the property descriptor for `__bindData__` */
+  var descriptor = {
+    'configurable': false,
+    'enumerable': false,
+    'value': null,
+    'writable': false
+  };
+
+  /** Used to determine if values are of the language type Object */
+  var objectTypes = {
+    'boolean': false,
+    'function': true,
+    'object': true,
+    'number': false,
+    'string': false,
+    'undefined': false
+  };
+
+  /** Used to escape characters for inclusion in compiled string literals */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\t': 't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  /** Used as a reference to the global object */
+  var root = (objectTypes[typeof window] && window) || this;
+
+  /** Detect free variable `exports` */
+  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module` */
+  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
+
+  /** Detect the popular CommonJS extension `module.exports` */
+  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+
+  /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
+  var freeGlobal = objectTypes[typeof global] && global;
+  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
+    root = freeGlobal;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * The base implementation of `_.indexOf` without support for binary searches
+   * or `fromIndex` constraints.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {number} Returns the index of the matched value or `-1`.
+   */
+  function baseIndexOf(array, value, fromIndex) {
+    var index = (fromIndex || 0) - 1,
+        length = array ? array.length : 0;
+
+    while (++index < length) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * An implementation of `_.contains` for cache objects that mimics the return
+   * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
+   *
+   * @private
+   * @param {Object} cache The cache object to inspect.
+   * @param {*} value The value to search for.
+   * @returns {number} Returns `0` if `value` is found, else `-1`.
+   */
+  function cacheIndexOf(cache, value) {
+    var type = typeof value;
+    cache = cache.cache;
+
+    if (type == 'boolean' || value == null) {
+      return cache[value] ? 0 : -1;
+    }
+    if (type != 'number' && type != 'string') {
+      type = 'object';
+    }
+    var key = type == 'number' ? value : keyPrefix + value;
+    cache = (cache = cache[type]) && cache[key];
+
+    return type == 'object'
+      ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)
+      : (cache ? 0 : -1);
+  }
+
+  /**
+   * Adds a given value to the corresponding cache object.
+   *
+   * @private
+   * @param {*} value The value to add to the cache.
+   */
+  function cachePush(value) {
+    var cache = this.cache,
+        type = typeof value;
+
+    if (type == 'boolean' || value == null) {
+      cache[value] = true;
+    } else {
+      if (type != 'number' && type != 'string') {
+        type = 'object';
+      }
+      var key = type == 'number' ? value : keyPrefix + value,
+          typeCache = cache[type] || (cache[type] = {});
+
+      if (type == 'object') {
+        (typeCache[key] || (typeCache[key] = [])).push(value);
+      } else {
+        typeCache[key] = true;
+      }
+    }
+  }
+
+  /**
+   * Used by `_.max` and `_.min` as the default callback when a given
+   * collection is a string value.
+   *
+   * @private
+   * @param {string} value The character to inspect.
+   * @returns {number} Returns the code unit of given character.
+   */
+  function charAtCallback(value) {
+    return value.charCodeAt(0);
+  }
+
+  /**
+   * Used by `sortBy` to compare transformed `collection` elements, stable sorting
+   * them in ascending order.
+   *
+   * @private
+   * @param {Object} a The object to compare to `b`.
+   * @param {Object} b The object to compare to `a`.
+   * @returns {number} Returns the sort order indicator of `1` or `-1`.
+   */
+  function compareAscending(a, b) {
+    var ac = a.criteria,
+        bc = b.criteria,
+        index = -1,
+        length = ac.length;
+
+    while (++index < length) {
+      var value = ac[index],
+          other = bc[index];
+
+      if (value !== other) {
+        if (value > other || typeof value == 'undefined') {
+          return 1;
+        }
+        if (value < other || typeof other == 'undefined') {
+          return -1;
+        }
+      }
+    }
+    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+    // that causes it, under certain circumstances, to return the same value for
+    // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247
+    //
+    // This also ensures a stable sort in V8 and other engines.
+    // See http://code.google.com/p/v8/issues/detail?id=90
+    return a.index - b.index;
+  }
+
+  /**
+   * Creates a cache object to optimize linear searches of large arrays.
+   *
+   * @private
+   * @param {Array} [array=[]] The array to search.
+   * @returns {null|Object} Returns the cache object or `null` if caching should not be used.
+   */
+  function createCache(array) {
+    var index = -1,
+        length = array.length,
+        first = array[0],
+        mid = array[(length / 2) | 0],
+        last = array[length - 1];
+
+    if (first && typeof first == 'object' &&
+        mid && typeof mid == 'object' && last && typeof last == 'object') {
+      return false;
+    }
+    var cache = getObject();
+    cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
+
+    var result = getObject();
+    result.array = array;
+    result.cache = cache;
+    result.push = cachePush;
+
+    while (++index < length) {
+      result.push(array[index]);
+    }
+    return result;
+  }
+
+  /**
+   * Used by `template` to escape characters for inclusion in compiled
+   * string literals.
+   *
+   * @private
+   * @param {string} match The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeStringChar(match) {
+    return '\\' + stringEscapes[match];
+  }
+
+  /**
+   * Gets an array from the array pool or creates a new one if the pool is empty.
+   *
+   * @private
+   * @returns {Array} The array from the pool.
+   */
+  function getArray() {
+    return arrayPool.pop() || [];
+  }
+
+  /**
+   * Gets an object from the object pool or creates a new one if the pool is empty.
+   *
+   * @private
+   * @returns {Object} The object from the pool.
+   */
+  function getObject() {
+    return objectPool.pop() || {
+      'array': null,
+      'cache': null,
+      'criteria': null,
+      'false': false,
+      'index': 0,
+      'null': false,
+      'number': null,
+      'object': null,
+      'push': null,
+      'string': null,
+      'true': false,
+      'undefined': false,
+      'value': null
+    };
+  }
+
+  /**
+   * Releases the given array back to the array pool.
+   *
+   * @private
+   * @param {Array} [array] The array to release.
+   */
+  function releaseArray(array) {
+    array.length = 0;
+    if (arrayPool.length < maxPoolSize) {
+      arrayPool.push(array);
+    }
+  }
+
+  /**
+   * Releases the given object back to the object pool.
+   *
+   * @private
+   * @param {Object} [object] The object to release.
+   */
+  function releaseObject(object) {
+    var cache = object.cache;
+    if (cache) {
+      releaseObject(cache);
+    }
+    object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;
+    if (objectPool.length < maxPoolSize) {
+      objectPool.push(object);
+    }
+  }
+
+  /**
+   * Slices the `collection` from the `start` index up to, but not including,
+   * the `end` index.
+   *
+   * Note: This function is used instead of `Array#slice` to support node lists
+   * in IE < 9 and to ensure dense arrays are returned.
+   *
+   * @private
+   * @param {Array|Object|string} collection The collection to slice.
+   * @param {number} start The start index.
+   * @param {number} end The end index.
+   * @returns {Array} Returns the new array.
+   */
+  function slice(array, start, end) {
+    start || (start = 0);
+    if (typeof end == 'undefined') {
+      end = array ? array.length : 0;
+    }
+    var index = -1,
+        length = end - start || 0,
+        result = Array(length < 0 ? 0 : length);
+
+    while (++index < length) {
+      result[index] = array[start + index];
+    }
+    return result;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Create a new `lodash` function using the given context object.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {Object} [context=root] The context object.
+   * @returns {Function} Returns the `lodash` function.
+   */
+  function runInContext(context) {
+    // Avoid issues with some ES3 environments that attempt to use values, named
+    // after built-in constructors like `Object`, for the creation of literals.
+    // ES5 clears this up by stating that literals must use built-in constructors.
+    // See http://es5.github.io/#x11.1.5.
+    context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
+
+    /** Native constructor references */
+    var Array = context.Array,
+        Boolean = context.Boolean,
+        Date = context.Date,
+        Function = context.Function,
+        Math = context.Math,
+        Number = context.Number,
+        Object = context.Object,
+        RegExp = context.RegExp,
+        String = context.String,
+        TypeError = context.TypeError;
+
+    /**
+     * Used for `Array` method references.
+     *
+     * Normally `Array.prototype` would suffice, however, using an array literal
+     * avoids issues in Narwhal.
+     */
+    var arrayRef = [];
+
+    /** Used for native method references */
+    var objectProto = Object.prototype;
+
+    /** Used to restore the original `_` reference in `noConflict` */
+    var oldDash = context._;
+
+    /** Used to resolve the internal [[Class]] of values */
+    var toString = objectProto.toString;
+
+    /** Used to detect if a method is native */
+    var reNative = RegExp('^' +
+      String(toString)
+        .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+        .replace(/toString| for [^\]]+/g, '.*?') + '$'
+    );
+
+    /** Native method shortcuts */
+    var ceil = Math.ceil,
+        clearTimeout = context.clearTimeout,
+        floor = Math.floor,
+        fnToString = Function.prototype.toString,
+        getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
+        hasOwnProperty = objectProto.hasOwnProperty,
+        push = arrayRef.push,
+        setTimeout = context.setTimeout,
+        splice = arrayRef.splice,
+        unshift = arrayRef.unshift;
+
+    /** Used to set meta data on functions */
+    var defineProperty = (function() {
+      // IE 8 only accepts DOM elements
+      try {
+        var o = {},
+            func = isNative(func = Object.defineProperty) && func,
+            result = func(o, o, o) && func;
+      } catch(e) { }
+      return result;
+    }());
+
+    /* Native method shortcuts for methods with the same name as other `lodash` methods */
+    var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
+        nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
+        nativeIsFinite = context.isFinite,
+        nativeIsNaN = context.isNaN,
+        nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
+        nativeMax = Math.max,
+        nativeMin = Math.min,
+        nativeParseInt = context.parseInt,
+        nativeRandom = Math.random;
+
+    /** Used to lookup a built-in constructor by [[Class]] */
+    var ctorByClass = {};
+    ctorByClass[arrayClass] = Array;
+    ctorByClass[boolClass] = Boolean;
+    ctorByClass[dateClass] = Date;
+    ctorByClass[funcClass] = Function;
+    ctorByClass[objectClass] = Object;
+    ctorByClass[numberClass] = Number;
+    ctorByClass[regexpClass] = RegExp;
+    ctorByClass[stringClass] = String;
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object which wraps the given value to enable intuitive
+     * method chaining.
+     *
+     * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
+     * and `unshift`
+     *
+     * Chaining is supported in custom builds as long as the `value` method is
+     * implicitly or explicitly included in the build.
+     *
+     * The chainable wrapper functions are:
+     * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
+     * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,
+     * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,
+     * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+     * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+     * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
+     * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,
+     * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+     * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,
+     * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,
+     * and `zip`
+     *
+     * The non-chainable wrapper functions are:
+     * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,
+     * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,
+     * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+     * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,
+     * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,
+     * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,
+     * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,
+     * `template`, `unescape`, `uniqueId`, and `value`
+     *
+     * The wrapper functions `first` and `last` return wrapped values when `n` is
+     * provided, otherwise they return unwrapped values.
+     *
+     * Explicit chaining can be enabled by using the `_.chain` method.
+     *
+     * @name _
+     * @constructor
+     * @category Chaining
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns a `lodash` instance.
+     * @example
+     *
+     * var wrapped = _([1, 2, 3]);
+     *
+     * // returns an unwrapped value
+     * wrapped.reduce(function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * // returns a wrapped value
+     * var squares = wrapped.map(function(num) {
+     *   return num * num;
+     * });
+     *
+     * _.isArray(squares);
+     * // => false
+     *
+     * _.isArray(squares.value());
+     * // => true
+     */
+    function lodash(value) {
+      // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
+      return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))
+       ? value
+       : new lodashWrapper(value);
+    }
+
+    /**
+     * A fast path for creating `lodash` wrapper objects.
+     *
+     * @private
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @param {boolean} chainAll A flag to enable chaining for all methods
+     * @returns {Object} Returns a `lodash` instance.
+     */
+    function lodashWrapper(value, chainAll) {
+      this.__chain__ = !!chainAll;
+      this.__wrapped__ = value;
+    }
+    // ensure `new lodashWrapper` is an instance of `lodash`
+    lodashWrapper.prototype = lodash.prototype;
+
+    /**
+     * An object used to flag environments features.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    var support = lodash.support = {};
+
+    /**
+     * Detect if functions can be decompiled by `Function#toString`
+     * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
+     *
+     * @memberOf _.support
+     * @type boolean
+     */
+    support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext);
+
+    /**
+     * Detect if `Function#name` is supported (all but IE).
+     *
+     * @memberOf _.support
+     * @type boolean
+     */
+    support.funcNames = typeof Function.name == 'string';
+
+    /**
+     * By default, the template delimiters used by Lo-Dash are similar to those in
+     * embedded Ruby (ERB). Change the following template settings to use alternative
+     * delimiters.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    lodash.templateSettings = {
+
+      /**
+       * Used to detect `data` property values to be HTML-escaped.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'escape': /<%-([\s\S]+?)%>/g,
+
+      /**
+       * Used to detect code to be evaluated.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'evaluate': /<%([\s\S]+?)%>/g,
+
+      /**
+       * Used to detect `data` property values to inject.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'interpolate': reInterpolate,
+
+      /**
+       * Used to reference the data object in the template text.
+       *
+       * @memberOf _.templateSettings
+       * @type string
+       */
+      'variable': '',
+
+      /**
+       * Used to import variables into the compiled template.
+       *
+       * @memberOf _.templateSettings
+       * @type Object
+       */
+      'imports': {
+
+        /**
+         * A reference to the `lodash` function.
+         *
+         * @memberOf _.templateSettings.imports
+         * @type Function
+         */
+        '_': lodash
+      }
+    };
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The base implementation of `_.bind` that creates the bound function and
+     * sets its meta data.
+     *
+     * @private
+     * @param {Array} bindData The bind data array.
+     * @returns {Function} Returns the new bound function.
+     */
+    function baseBind(bindData) {
+      var func = bindData[0],
+          partialArgs = bindData[2],
+          thisArg = bindData[4];
+
+      function bound() {
+        // `Function#bind` spec
+        // http://es5.github.io/#x15.3.4.5
+        if (partialArgs) {
+          // avoid `arguments` object deoptimizations by using `slice` instead
+          // of `Array.prototype.slice.call` and not assigning `arguments` to a
+          // variable as a ternary expression
+          var args = slice(partialArgs);
+          push.apply(args, arguments);
+        }
+        // mimic the constructor's `return` behavior
+        // http://es5.github.io/#x13.2.2
+        if (this instanceof bound) {
+          // ensure `new bound` is an instance of `func`
+          var thisBinding = baseCreate(func.prototype),
+              result = func.apply(thisBinding, args || arguments);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisArg, args || arguments);
+      }
+      setBindData(bound, bindData);
+      return bound;
+    }
+
+    /**
+     * The base implementation of `_.clone` without argument juggling or support
+     * for `thisArg` binding.
+     *
+     * @private
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep=false] Specify a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates clones with source counterparts.
+     * @returns {*} Returns the cloned value.
+     */
+    function baseClone(value, isDeep, callback, stackA, stackB) {
+      if (callback) {
+        var result = callback(value);
+        if (typeof result != 'undefined') {
+          return result;
+        }
+      }
+      // inspect [[Class]]
+      var isObj = isObject(value);
+      if (isObj) {
+        var className = toString.call(value);
+        if (!cloneableClasses[className]) {
+          return value;
+        }
+        var ctor = ctorByClass[className];
+        switch (className) {
+          case boolClass:
+          case dateClass:
+            return new ctor(+value);
+
+          case numberClass:
+          case stringClass:
+            return new ctor(value);
+
+          case regexpClass:
+            result = ctor(value.source, reFlags.exec(value));
+            result.lastIndex = value.lastIndex;
+            return result;
+        }
+      } else {
+        return value;
+      }
+      var isArr = isArray(value);
+      if (isDeep) {
+        // check for circular references and return corresponding clone
+        var initedStack = !stackA;
+        stackA || (stackA = getArray());
+        stackB || (stackB = getArray());
+
+        var length = stackA.length;
+        while (length--) {
+          if (stackA[length] == value) {
+            return stackB[length];
+          }
+        }
+        result = isArr ? ctor(value.length) : {};
+      }
+      else {
+        result = isArr ? slice(value) : assign({}, value);
+      }
+      // add array properties assigned by `RegExp#exec`
+      if (isArr) {
+        if (hasOwnProperty.call(value, 'index')) {
+          result.index = value.index;
+        }
+        if (hasOwnProperty.call(value, 'input')) {
+          result.input = value.input;
+        }
+      }
+      // exit for shallow clone
+      if (!isDeep) {
+        return result;
+      }
+      // add the source value to the stack of traversed objects
+      // and associate it with its clone
+      stackA.push(value);
+      stackB.push(result);
+
+      // recursively populate clone (susceptible to call stack limits)
+      (isArr ? forEach : forOwn)(value, function(objValue, key) {
+        result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
+      });
+
+      if (initedStack) {
+        releaseArray(stackA);
+        releaseArray(stackB);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.create` without support for assigning
+     * properties to the created object.
+     *
+     * @private
+     * @param {Object} prototype The object to inherit from.
+     * @returns {Object} Returns the new object.
+     */
+    function baseCreate(prototype, properties) {
+      return isObject(prototype) ? nativeCreate(prototype) : {};
+    }
+    // fallback for browsers without `Object.create`
+    if (!nativeCreate) {
+      baseCreate = (function() {
+        function Object() {}
+        return function(prototype) {
+          if (isObject(prototype)) {
+            Object.prototype = prototype;
+            var result = new Object;
+            Object.prototype = null;
+          }
+          return result || context.Object();
+        };
+      }());
+    }
+
+    /**
+     * The base implementation of `_.createCallback` without support for creating
+     * "_.pluck" or "_.where" style callbacks.
+     *
+     * @private
+     * @param {*} [func=identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of the created callback.
+     * @param {number} [argCount] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     */
+    function baseCreateCallback(func, thisArg, argCount) {
+      if (typeof func != 'function') {
+        return identity;
+      }
+      // exit early for no `thisArg` or already bound by `Function#bind`
+      if (typeof thisArg == 'undefined' || !('prototype' in func)) {
+        return func;
+      }
+      var bindData = func.__bindData__;
+      if (typeof bindData == 'undefined') {
+        if (support.funcNames) {
+          bindData = !func.name;
+        }
+        bindData = bindData || !support.funcDecomp;
+        if (!bindData) {
+          var source = fnToString.call(func);
+          if (!support.funcNames) {
+            bindData = !reFuncName.test(source);
+          }
+          if (!bindData) {
+            // checks if `func` references the `this` keyword and stores the result
+            bindData = reThis.test(source);
+            setBindData(func, bindData);
+          }
+        }
+      }
+      // exit early if there are no `this` references or `func` is bound
+      if (bindData === false || (bindData !== true && bindData[1] & 1)) {
+        return func;
+      }
+      switch (argCount) {
+        case 1: return function(value) {
+          return func.call(thisArg, value);
+        };
+        case 2: return function(a, b) {
+          return func.call(thisArg, a, b);
+        };
+        case 3: return function(value, index, collection) {
+          return func.call(thisArg, value, index, collection);
+        };
+        case 4: return function(accumulator, value, index, collection) {
+          return func.call(thisArg, accumulator, value, index, collection);
+        };
+      }
+      return bind(func, thisArg);
+    }
+
+    /**
+     * The base implementation of `createWrapper` that creates the wrapper and
+     * sets its meta data.
+     *
+     * @private
+     * @param {Array} bindData The bind data array.
+     * @returns {Function} Returns the new function.
+     */
+    function baseCreateWrapper(bindData) {
+      var func = bindData[0],
+          bitmask = bindData[1],
+          partialArgs = bindData[2],
+          partialRightArgs = bindData[3],
+          thisArg = bindData[4],
+          arity = bindData[5];
+
+      var isBind = bitmask & 1,
+          isBindKey = bitmask & 2,
+          isCurry = bitmask & 4,
+          isCurryBound = bitmask & 8,
+          key = func;
+
+      function bound() {
+        var thisBinding = isBind ? thisArg : this;
+        if (partialArgs) {
+          var args = slice(partialArgs);
+          push.apply(args, arguments);
+        }
+        if (partialRightArgs || isCurry) {
+          args || (args = slice(arguments));
+          if (partialRightArgs) {
+            push.apply(args, partialRightArgs);
+          }
+          if (isCurry && args.length < arity) {
+            bitmask |= 16 & ~32;
+            return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);
+          }
+        }
+        args || (args = arguments);
+        if (isBindKey) {
+          func = thisBinding[key];
+        }
+        if (this instanceof bound) {
+          thisBinding = baseCreate(func.prototype);
+          var result = func.apply(thisBinding, args);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisBinding, args);
+      }
+      setBindData(bound, bindData);
+      return bound;
+    }
+
+    /**
+     * The base implementation of `_.difference` that accepts a single array
+     * of values to exclude.
+     *
+     * @private
+     * @param {Array} array The array to process.
+     * @param {Array} [values] The array of values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     */
+    function baseDifference(array, values) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          isLarge = length >= largeArraySize && indexOf === baseIndexOf,
+          result = [];
+
+      if (isLarge) {
+        var cache = createCache(values);
+        if (cache) {
+          indexOf = cacheIndexOf;
+          values = cache;
+        } else {
+          isLarge = false;
+        }
+      }
+      while (++index < length) {
+        var value = array[index];
+        if (indexOf(values, value) < 0) {
+          result.push(value);
+        }
+      }
+      if (isLarge) {
+        releaseObject(values);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.flatten` without support for callback
+     * shorthands or `thisArg` binding.
+     *
+     * @private
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+     * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
+     * @param {number} [fromIndex=0] The index to start from.
+     * @returns {Array} Returns a new flattened array.
+     */
+    function baseFlatten(array, isShallow, isStrict, fromIndex) {
+      var index = (fromIndex || 0) - 1,
+          length = array ? array.length : 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+
+        if (value && typeof value == 'object' && typeof value.length == 'number'
+            && (isArray(value) || isArguments(value))) {
+          // recursively flatten arrays (susceptible to call stack limits)
+          if (!isShallow) {
+            value = baseFlatten(value, isShallow, isStrict);
+          }
+          var valIndex = -1,
+              valLength = value.length,
+              resIndex = result.length;
+
+          result.length += valLength;
+          while (++valIndex < valLength) {
+            result[resIndex++] = value[valIndex];
+          }
+        } else if (!isStrict) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.isEqual`, without support for `thisArg` binding,
+     * that allows partial "_.where" style comparisons.
+     *
+     * @private
+     * @param {*} a The value to compare.
+     * @param {*} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.
+     * @param {Array} [stackA=[]] Tracks traversed `a` objects.
+     * @param {Array} [stackB=[]] Tracks traversed `b` objects.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     */
+    function baseIsEqual(a, b, callback, isWhere, stackA, stackB) {
+      // used to indicate that when comparing objects, `a` has at least the properties of `b`
+      if (callback) {
+        var result = callback(a, b);
+        if (typeof result != 'undefined') {
+          return !!result;
+        }
+      }
+      // exit early for identical values
+      if (a === b) {
+        // treat `+0` vs. `-0` as not equal
+        return a !== 0 || (1 / a == 1 / b);
+      }
+      var type = typeof a,
+          otherType = typeof b;
+
+      // exit early for unlike primitive values
+      if (a === a &&
+          !(a && objectTypes[type]) &&
+          !(b && objectTypes[otherType])) {
+        return false;
+      }
+      // exit early for `null` and `undefined` avoiding ES3's Function#call behavior
+      // http://es5.github.io/#x15.3.4.4
+      if (a == null || b == null) {
+        return a === b;
+      }
+      // compare [[Class]] names
+      var className = toString.call(a),
+          otherClass = toString.call(b);
+
+      if (className == argsClass) {
+        className = objectClass;
+      }
+      if (otherClass == argsClass) {
+        otherClass = objectClass;
+      }
+      if (className != otherClass) {
+        return false;
+      }
+      switch (className) {
+        case boolClass:
+        case dateClass:
+          // coerce dates and booleans to numbers, dates to milliseconds and booleans
+          // to `1` or `0` treating invalid dates coerced to `NaN` as not equal
+          return +a == +b;
+
+        case numberClass:
+          // treat `NaN` vs. `NaN` as equal
+          return (a != +a)
+            ? b != +b
+            // but treat `+0` vs. `-0` as not equal
+            : (a == 0 ? (1 / a == 1 / b) : a == +b);
+
+        case regexpClass:
+        case stringClass:
+          // coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
+          // treat string primitives and their corresponding object instances as equal
+          return a == String(b);
+      }
+      var isArr = className == arrayClass;
+      if (!isArr) {
+        // unwrap any `lodash` wrapped values
+        var aWrapped = hasOwnProperty.call(a, '__wrapped__'),
+            bWrapped = hasOwnProperty.call(b, '__wrapped__');
+
+        if (aWrapped || bWrapped) {
+          return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB);
+        }
+        // exit for functions and DOM nodes
+        if (className != objectClass) {
+          return false;
+        }
+        // in older versions of Opera, `arguments` objects have `Array` constructors
+        var ctorA = a.constructor,
+            ctorB = b.constructor;
+
+        // non `Object` object instances with different constructors are not equal
+        if (ctorA != ctorB &&
+              !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
+              ('constructor' in a && 'constructor' in b)
+            ) {
+          return false;
+        }
+      }
+      // assume cyclic structures are equal
+      // the algorithm for detecting cyclic structures is adapted from ES 5.1
+      // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
+      var initedStack = !stackA;
+      stackA || (stackA = getArray());
+      stackB || (stackB = getArray());
+
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == a) {
+          return stackB[length] == b;
+        }
+      }
+      var size = 0;
+      result = true;
+
+      // add `a` and `b` to the stack of traversed objects
+      stackA.push(a);
+      stackB.push(b);
+
+      // recursively compare objects and arrays (susceptible to call stack limits)
+      if (isArr) {
+        // compare lengths to determine if a deep comparison is necessary
+        length = a.length;
+        size = b.length;
+        result = size == length;
+
+        if (result || isWhere) {
+          // deep compare the contents, ignoring non-numeric properties
+          while (size--) {
+            var index = length,
+                value = b[size];
+
+            if (isWhere) {
+              while (index--) {
+                if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) {
+                  break;
+                }
+              }
+            } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) {
+              break;
+            }
+          }
+        }
+      }
+      else {
+        // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
+        // which, in this case, is more costly
+        forIn(b, function(value, key, b) {
+          if (hasOwnProperty.call(b, key)) {
+            // count the number of properties.
+            size++;
+            // deep compare each property value.
+            return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB));
+          }
+        });
+
+        if (result && !isWhere) {
+          // ensure both objects have the same number of properties
+          forIn(a, function(value, key, a) {
+            if (hasOwnProperty.call(a, key)) {
+              // `size` will be `-1` if `a` has more properties than `b`
+              return (result = --size > -1);
+            }
+          });
+        }
+      }
+      stackA.pop();
+      stackB.pop();
+
+      if (initedStack) {
+        releaseArray(stackA);
+        releaseArray(stackB);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.merge` without argument juggling or support
+     * for `thisArg` binding.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates values with source counterparts.
+     */
+    function baseMerge(object, source, callback, stackA, stackB) {
+      (isArray(source) ? forEach : forOwn)(source, function(source, key) {
+        var found,
+            isArr,
+            result = source,
+            value = object[key];
+
+        if (source && ((isArr = isArray(source)) || isPlainObject(source))) {
+          // avoid merging previously merged cyclic sources
+          var stackLength = stackA.length;
+          while (stackLength--) {
+            if ((found = stackA[stackLength] == source)) {
+              value = stackB[stackLength];
+              break;
+            }
+          }
+          if (!found) {
+            var isShallow;
+            if (callback) {
+              result = callback(value, source);
+              if ((isShallow = typeof result != 'undefined')) {
+                value = result;
+              }
+            }
+            if (!isShallow) {
+              value = isArr
+                ? (isArray(value) ? value : [])
+                : (isPlainObject(value) ? value : {});
+            }
+            // add `source` and associated `value` to the stack of traversed objects
+            stackA.push(source);
+            stackB.push(value);
+
+            // recursively merge objects and arrays (susceptible to call stack limits)
+            if (!isShallow) {
+              baseMerge(value, source, callback, stackA, stackB);
+            }
+          }
+        }
+        else {
+          if (callback) {
+            result = callback(value, source);
+            if (typeof result == 'undefined') {
+              result = source;
+            }
+          }
+          if (typeof result != 'undefined') {
+            value = result;
+          }
+        }
+        object[key] = value;
+      });
+    }
+
+    /**
+     * The base implementation of `_.random` without argument juggling or support
+     * for returning floating-point numbers.
+     *
+     * @private
+     * @param {number} min The minimum possible value.
+     * @param {number} max The maximum possible value.
+     * @returns {number} Returns a random number.
+     */
+    function baseRandom(min, max) {
+      return min + floor(nativeRandom() * (max - min + 1));
+    }
+
+    /**
+     * The base implementation of `_.uniq` without support for callback shorthands
+     * or `thisArg` binding.
+     *
+     * @private
+     * @param {Array} array The array to process.
+     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+     * @param {Function} [callback] The function called per iteration.
+     * @returns {Array} Returns a duplicate-value-free array.
+     */
+    function baseUniq(array, isSorted, callback) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          result = [];
+
+      var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf,
+          seen = (callback || isLarge) ? getArray() : result;
+
+      if (isLarge) {
+        var cache = createCache(seen);
+        indexOf = cacheIndexOf;
+        seen = cache;
+      }
+      while (++index < length) {
+        var value = array[index],
+            computed = callback ? callback(value, index, array) : value;
+
+        if (isSorted
+              ? !index || seen[seen.length - 1] !== computed
+              : indexOf(seen, computed) < 0
+            ) {
+          if (callback || isLarge) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      if (isLarge) {
+        releaseArray(seen.array);
+        releaseObject(seen);
+      } else if (callback) {
+        releaseArray(seen);
+      }
+      return result;
+    }
+
+    /**
+     * Creates a function that aggregates a collection, creating an object composed
+     * of keys generated from the results of running each element of the collection
+     * through a callback. The given `setter` function sets the keys and values
+     * of the composed object.
+     *
+     * @private
+     * @param {Function} setter The setter function.
+     * @returns {Function} Returns the new aggregator function.
+     */
+    function createAggregator(setter) {
+      return function(collection, callback, thisArg) {
+        var result = {};
+        callback = lodash.createCallback(callback, thisArg, 3);
+
+        var index = -1,
+            length = collection ? collection.length : 0;
+
+        if (typeof length == 'number') {
+          while (++index < length) {
+            var value = collection[index];
+            setter(result, value, callback(value, index, collection), collection);
+          }
+        } else {
+          forOwn(collection, function(value, key, collection) {
+            setter(result, value, callback(value, key, collection), collection);
+          });
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that, when called, either curries or invokes `func`
+     * with an optional `this` binding and partially applied arguments.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to reference.
+     * @param {number} bitmask The bitmask of method flags to compose.
+     *  The bitmask may be composed of the following flags:
+     *  1 - `_.bind`
+     *  2 - `_.bindKey`
+     *  4 - `_.curry`
+     *  8 - `_.curry` (bound)
+     *  16 - `_.partial`
+     *  32 - `_.partialRight`
+     * @param {Array} [partialArgs] An array of arguments to prepend to those
+     *  provided to the new function.
+     * @param {Array} [partialRightArgs] An array of arguments to append to those
+     *  provided to the new function.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new function.
+     */
+    function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
+      var isBind = bitmask & 1,
+          isBindKey = bitmask & 2,
+          isCurry = bitmask & 4,
+          isCurryBound = bitmask & 8,
+          isPartial = bitmask & 16,
+          isPartialRight = bitmask & 32;
+
+      if (!isBindKey && !isFunction(func)) {
+        throw new TypeError;
+      }
+      if (isPartial && !partialArgs.length) {
+        bitmask &= ~16;
+        isPartial = partialArgs = false;
+      }
+      if (isPartialRight && !partialRightArgs.length) {
+        bitmask &= ~32;
+        isPartialRight = partialRightArgs = false;
+      }
+      var bindData = func && func.__bindData__;
+      if (bindData && bindData !== true) {
+        // clone `bindData`
+        bindData = slice(bindData);
+        if (bindData[2]) {
+          bindData[2] = slice(bindData[2]);
+        }
+        if (bindData[3]) {
+          bindData[3] = slice(bindData[3]);
+        }
+        // set `thisBinding` is not previously bound
+        if (isBind && !(bindData[1] & 1)) {
+          bindData[4] = thisArg;
+        }
+        // set if previously bound but not currently (subsequent curried functions)
+        if (!isBind && bindData[1] & 1) {
+          bitmask |= 8;
+        }
+        // set curried arity if not yet set
+        if (isCurry && !(bindData[1] & 4)) {
+          bindData[5] = arity;
+        }
+        // append partial left arguments
+        if (isPartial) {
+          push.apply(bindData[2] || (bindData[2] = []), partialArgs);
+        }
+        // append partial right arguments
+        if (isPartialRight) {
+          unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs);
+        }
+        // merge flags
+        bindData[1] |= bitmask;
+        return createWrapper.apply(null, bindData);
+      }
+      // fast path for `_.bind`
+      var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;
+      return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);
+    }
+
+    /**
+     * Used by `escape` to convert characters to HTML entities.
+     *
+     * @private
+     * @param {string} match The matched character to escape.
+     * @returns {string} Returns the escaped character.
+     */
+    function escapeHtmlChar(match) {
+      return htmlEscapes[match];
+    }
+
+    /**
+     * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+     * customized, this method returns the custom method, otherwise it returns
+     * the `baseIndexOf` function.
+     *
+     * @private
+     * @returns {Function} Returns the "indexOf" function.
+     */
+    function getIndexOf() {
+      var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;
+      return result;
+    }
+
+    /**
+     * Checks if `value` is a native function.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.
+     */
+    function isNative(value) {
+      return typeof value == 'function' && reNative.test(value);
+    }
+
+    /**
+     * Sets `this` binding data on a given function.
+     *
+     * @private
+     * @param {Function} func The function to set data on.
+     * @param {Array} value The data array to set.
+     */
+    var setBindData = !defineProperty ? noop : function(func, value) {
+      descriptor.value = value;
+      defineProperty(func, '__bindData__', descriptor);
+    };
+
+    /**
+     * A fallback implementation of `isPlainObject` which checks if a given value
+     * is an object created by the `Object` constructor, assuming objects created
+     * by the `Object` constructor have no inherited enumerable properties and that
+     * there are no `Object.prototype` extensions.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     */
+    function shimIsPlainObject(value) {
+      var ctor,
+          result;
+
+      // avoid non Object objects, `arguments` objects, and DOM elements
+      if (!(value && toString.call(value) == objectClass) ||
+          (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor))) {
+        return false;
+      }
+      // In most environments an object's own properties are iterated before
+      // its inherited properties. If the last iterated property is an object's
+      // own property then there are no inherited enumerable properties.
+      forIn(value, function(value, key) {
+        result = key;
+      });
+      return typeof result == 'undefined' || hasOwnProperty.call(value, result);
+    }
+
+    /**
+     * Used by `unescape` to convert HTML entities to characters.
+     *
+     * @private
+     * @param {string} match The matched character to unescape.
+     * @returns {string} Returns the unescaped character.
+     */
+    function unescapeHtmlChar(match) {
+      return htmlUnescapes[match];
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Checks if `value` is an `arguments` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
+     * @example
+     *
+     * (function() { return _.isArguments(arguments); })(1, 2, 3);
+     * // => true
+     *
+     * _.isArguments([1, 2, 3]);
+     * // => false
+     */
+    function isArguments(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        toString.call(value) == argsClass || false;
+    }
+
+    /**
+     * Checks if `value` is an array.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an array, else `false`.
+     * @example
+     *
+     * (function() { return _.isArray(arguments); })();
+     * // => false
+     *
+     * _.isArray([1, 2, 3]);
+     * // => true
+     */
+    var isArray = nativeIsArray || function(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        toString.call(value) == arrayClass || false;
+    };
+
+    /**
+     * A fallback implementation of `Object.keys` which produces an array of the
+     * given object's own enumerable property names.
+     *
+     * @private
+     * @type Function
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names.
+     */
+    var shimKeys = function(object) {
+      var index, iterable = object, result = [];
+      if (!iterable) return result;
+      if (!(objectTypes[typeof object])) return result;
+        for (index in iterable) {
+          if (hasOwnProperty.call(iterable, index)) {
+            result.push(index);
+          }
+        }
+      return result
+    };
+
+    /**
+     * Creates an array composed of the own enumerable property names of an object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names.
+     * @example
+     *
+     * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
+     */
+    var keys = !nativeKeys ? shimKeys : function(object) {
+      if (!isObject(object)) {
+        return [];
+      }
+      return nativeKeys(object);
+    };
+
+    /**
+     * Used to convert characters to HTML entities:
+     *
+     * Though the `>` character is escaped for symmetry, characters like `>` and `/`
+     * don't require escaping in HTML and have no special meaning unless they're part
+     * of a tag or an unquoted attribute value.
+     * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
+     */
+    var htmlEscapes = {
+      '&': '&amp;',
+      '<': '&lt;',
+      '>': '&gt;',
+      '"': '&quot;',
+      "'": '&#39;'
+    };
+
+    /** Used to convert HTML entities to characters */
+    var htmlUnescapes = invert(htmlEscapes);
+
+    /** Used to match HTML entities and HTML characters */
+    var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),
+        reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object. Subsequent sources will overwrite property assignments of previous
+     * sources. If a callback is provided it will be executed to produce the
+     * assigned values. The callback is bound to `thisArg` and invoked with two
+     * arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @alias extend
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param {Function} [callback] The function to customize assigning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });
+     * // => { 'name': 'fred', 'employer': 'slate' }
+     *
+     * var defaults = _.partialRight(_.assign, function(a, b) {
+     *   return typeof a == 'undefined' ? b : a;
+     * });
+     *
+     * var object = { 'name': 'barney' };
+     * defaults(object, { 'name': 'fred', 'employer': 'slate' });
+     * // => { 'name': 'barney', 'employer': 'slate' }
+     */
+    var assign = function(object, source, guard) {
+      var index, iterable = object, result = iterable;
+      if (!iterable) return result;
+      var args = arguments,
+          argsIndex = 0,
+          argsLength = typeof guard == 'number' ? 2 : args.length;
+      if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {
+        var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);
+      } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {
+        callback = args[--argsLength];
+      }
+      while (++argsIndex < argsLength) {
+        iterable = args[argsIndex];
+        if (iterable && objectTypes[typeof iterable]) {
+        var ownIndex = -1,
+            ownProps = objectTypes[typeof iterable] && keys(iterable),
+            length = ownProps ? ownProps.length : 0;
+
+        while (++ownIndex < length) {
+          index = ownProps[ownIndex];
+          result[index] = callback ? callback(result[index], iterable[index]) : iterable[index];
+        }
+        }
+      }
+      return result
+    };
+
+    /**
+     * Creates a clone of `value`. If `isDeep` is `true` nested objects will also
+     * be cloned, otherwise they will be assigned by reference. If a callback
+     * is provided it will be executed to produce the cloned values. If the
+     * callback returns `undefined` cloning will be handled by the method instead.
+     * The callback is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep=false] Specify a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the cloned value.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * var shallow = _.clone(characters);
+     * shallow[0] === characters[0];
+     * // => true
+     *
+     * var deep = _.clone(characters, true);
+     * deep[0] === characters[0];
+     * // => false
+     *
+     * _.mixin({
+     *   'clone': _.partialRight(_.clone, function(value) {
+     *     return _.isElement(value) ? value.cloneNode(false) : undefined;
+     *   })
+     * });
+     *
+     * var clone = _.clone(document.body);
+     * clone.childNodes.length;
+     * // => 0
+     */
+    function clone(value, isDeep, callback, thisArg) {
+      // allows working with "Collections" methods without using their `index`
+      // and `collection` arguments for `isDeep` and `callback`
+      if (typeof isDeep != 'boolean' && isDeep != null) {
+        thisArg = callback;
+        callback = isDeep;
+        isDeep = false;
+      }
+      return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+    }
+
+    /**
+     * Creates a deep clone of `value`. If a callback is provided it will be
+     * executed to produce the cloned values. If the callback returns `undefined`
+     * cloning will be handled by the method instead. The callback is bound to
+     * `thisArg` and invoked with one argument; (value).
+     *
+     * Note: This method is loosely based on the structured clone algorithm. Functions
+     * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
+     * objects created by constructors other than `Object` are cloned to plain `Object` objects.
+     * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the deep cloned value.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * var deep = _.cloneDeep(characters);
+     * deep[0] === characters[0];
+     * // => false
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'node': element
+     * };
+     *
+     * var clone = _.cloneDeep(view, function(value) {
+     *   return _.isElement(value) ? value.cloneNode(true) : undefined;
+     * });
+     *
+     * clone.node == view.node;
+     * // => false
+     */
+    function cloneDeep(value, callback, thisArg) {
+      return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+    }
+
+    /**
+     * Creates an object that inherits from the given `prototype` object. If a
+     * `properties` object is provided its own enumerable properties are assigned
+     * to the created object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} prototype The object to inherit from.
+     * @param {Object} [properties] The properties to assign to the object.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * function Circle() {
+     *   Shape.call(this);
+     * }
+     *
+     * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });
+     *
+     * var circle = new Circle;
+     * circle instanceof Circle;
+     * // => true
+     *
+     * circle instanceof Shape;
+     * // => true
+     */
+    function create(prototype, properties) {
+      var result = baseCreate(prototype);
+      return properties ? assign(result, properties) : result;
+    }
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object for all destination properties that resolve to `undefined`. Once a
+     * property is set, additional defaults of the same property will be ignored.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param- {Object} [guard] Allows working with `_.reduce` without using its
+     *  `key` and `object` arguments as sources.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var object = { 'name': 'barney' };
+     * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
+     * // => { 'name': 'barney', 'employer': 'slate' }
+     */
+    var defaults = function(object, source, guard) {
+      var index, iterable = object, result = iterable;
+      if (!iterable) return result;
+      var args = arguments,
+          argsIndex = 0,
+          argsLength = typeof guard == 'number' ? 2 : args.length;
+      while (++argsIndex < argsLength) {
+        iterable = args[argsIndex];
+        if (iterable && objectTypes[typeof iterable]) {
+        var ownIndex = -1,
+            ownProps = objectTypes[typeof iterable] && keys(iterable),
+            length = ownProps ? ownProps.length : 0;
+
+        while (++ownIndex < length) {
+          index = ownProps[ownIndex];
+          if (typeof result[index] == 'undefined') result[index] = iterable[index];
+        }
+        }
+      }
+      return result
+    };
+
+    /**
+     * This method is like `_.findIndex` except that it returns the key of the
+     * first element that passes the callback check, instead of the element itself.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [callback=identity] The function called per
+     *  iteration. If a property name or object is provided it will be used to
+     *  create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {string|undefined} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * var characters = {
+     *   'barney': {  'age': 36, 'blocked': false },
+     *   'fred': {    'age': 40, 'blocked': true },
+     *   'pebbles': { 'age': 1,  'blocked': false }
+     * };
+     *
+     * _.findKey(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => 'barney' (property order is not guaranteed across environments)
+     *
+     * // using "_.where" callback shorthand
+     * _.findKey(characters, { 'age': 1 });
+     * // => 'pebbles'
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findKey(characters, 'blocked');
+     * // => 'fred'
+     */
+    function findKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forOwn(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * This method is like `_.findKey` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [callback=identity] The function called per
+     *  iteration. If a property name or object is provided it will be used to
+     *  create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {string|undefined} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * var characters = {
+     *   'barney': {  'age': 36, 'blocked': true },
+     *   'fred': {    'age': 40, 'blocked': false },
+     *   'pebbles': { 'age': 1,  'blocked': true }
+     * };
+     *
+     * _.findLastKey(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => returns `pebbles`, assuming `_.findKey` returns `barney`
+     *
+     * // using "_.where" callback shorthand
+     * _.findLastKey(characters, { 'age': 40 });
+     * // => 'fred'
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findLastKey(characters, 'blocked');
+     * // => 'pebbles'
+     */
+    function findLastKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forOwnRight(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Iterates over own and inherited enumerable properties of an object,
+     * executing the callback for each property. The callback is bound to `thisArg`
+     * and invoked with three arguments; (value, key, object). Callbacks may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * Shape.prototype.move = function(x, y) {
+     *   this.x += x;
+     *   this.y += y;
+     * };
+     *
+     * _.forIn(new Shape, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)
+     */
+    var forIn = function(collection, callback, thisArg) {
+      var index, iterable = collection, result = iterable;
+      if (!iterable) return result;
+      if (!objectTypes[typeof iterable]) return result;
+      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+        for (index in iterable) {
+          if (callback(iterable[index], index, collection) === false) return result;
+        }
+      return result
+    };
+
+    /**
+     * This method is like `_.forIn` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * Shape.prototype.move = function(x, y) {
+     *   this.x += x;
+     *   this.y += y;
+     * };
+     *
+     * _.forInRight(new Shape, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move'
+     */
+    function forInRight(object, callback, thisArg) {
+      var pairs = [];
+
+      forIn(object, function(value, key) {
+        pairs.push(key, value);
+      });
+
+      var length = pairs.length;
+      callback = baseCreateCallback(callback, thisArg, 3);
+      while (length--) {
+        if (callback(pairs[length--], pairs[length], object) === false) {
+          break;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Iterates over own enumerable properties of an object, executing the callback
+     * for each property. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, key, object). Callbacks may exit iteration early by
+     * explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   console.log(key);
+     * });
+     * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
+     */
+    var forOwn = function(collection, callback, thisArg) {
+      var index, iterable = collection, result = iterable;
+      if (!iterable) return result;
+      if (!objectTypes[typeof iterable]) return result;
+      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+        var ownIndex = -1,
+            ownProps = objectTypes[typeof iterable] && keys(iterable),
+            length = ownProps ? ownProps.length : 0;
+
+        while (++ownIndex < length) {
+          index = ownProps[ownIndex];
+          if (callback(iterable[index], index, collection) === false) return result;
+        }
+      return result
+    };
+
+    /**
+     * This method is like `_.forOwn` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length'
+     */
+    function forOwnRight(object, callback, thisArg) {
+      var props = keys(object),
+          length = props.length;
+
+      callback = baseCreateCallback(callback, thisArg, 3);
+      while (length--) {
+        var key = props[length];
+        if (callback(object[key], key, object) === false) {
+          break;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Creates a sorted array of property names of all enumerable properties,
+     * own and inherited, of `object` that have function values.
+     *
+     * @static
+     * @memberOf _
+     * @alias methods
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names that have function values.
+     * @example
+     *
+     * _.functions(_);
+     * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]
+     */
+    function functions(object) {
+      var result = [];
+      forIn(object, function(value, key) {
+        if (isFunction(value)) {
+          result.push(key);
+        }
+      });
+      return result.sort();
+    }
+
+    /**
+     * Checks if the specified property name exists as a direct property of `object`,
+     * instead of an inherited property.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @param {string} key The name of the property to check.
+     * @returns {boolean} Returns `true` if key is a direct property, else `false`.
+     * @example
+     *
+     * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
+     * // => true
+     */
+    function has(object, key) {
+      return object ? hasOwnProperty.call(object, key) : false;
+    }
+
+    /**
+     * Creates an object composed of the inverted keys and values of the given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to invert.
+     * @returns {Object} Returns the created inverted object.
+     * @example
+     *
+     * _.invert({ 'first': 'fred', 'second': 'barney' });
+     * // => { 'fred': 'first', 'barney': 'second' }
+     */
+    function invert(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = {};
+
+      while (++index < length) {
+        var key = props[index];
+        result[object[key]] = key;
+      }
+      return result;
+    }
+
+    /**
+     * Checks if `value` is a boolean value.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.
+     * @example
+     *
+     * _.isBoolean(null);
+     * // => false
+     */
+    function isBoolean(value) {
+      return value === true || value === false ||
+        value && typeof value == 'object' && toString.call(value) == boolClass || false;
+    }
+
+    /**
+     * Checks if `value` is a date.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a date, else `false`.
+     * @example
+     *
+     * _.isDate(new Date);
+     * // => true
+     */
+    function isDate(value) {
+      return value && typeof value == 'object' && toString.call(value) == dateClass || false;
+    }
+
+    /**
+     * Checks if `value` is a DOM element.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.
+     * @example
+     *
+     * _.isElement(document.body);
+     * // => true
+     */
+    function isElement(value) {
+      return value && value.nodeType === 1 || false;
+    }
+
+    /**
+     * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
+     * length of `0` and objects with no own enumerable properties are considered
+     * "empty".
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object|string} value The value to inspect.
+     * @returns {boolean} Returns `true` if the `value` is empty, else `false`.
+     * @example
+     *
+     * _.isEmpty([1, 2, 3]);
+     * // => false
+     *
+     * _.isEmpty({});
+     * // => true
+     *
+     * _.isEmpty('');
+     * // => true
+     */
+    function isEmpty(value) {
+      var result = true;
+      if (!value) {
+        return result;
+      }
+      var className = toString.call(value),
+          length = value.length;
+
+      if ((className == arrayClass || className == stringClass || className == argsClass ) ||
+          (className == objectClass && typeof length == 'number' && isFunction(value.splice))) {
+        return !length;
+      }
+      forOwn(value, function() {
+        return (result = false);
+      });
+      return result;
+    }
+
+    /**
+     * Performs a deep comparison between two values to determine if they are
+     * equivalent to each other. If a callback is provided it will be executed
+     * to compare values. If the callback returns `undefined` comparisons will
+     * be handled by the method instead. The callback is bound to `thisArg` and
+     * invoked with two arguments; (a, b).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} a The value to compare.
+     * @param {*} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * var copy = { 'name': 'fred' };
+     *
+     * object == copy;
+     * // => false
+     *
+     * _.isEqual(object, copy);
+     * // => true
+     *
+     * var words = ['hello', 'goodbye'];
+     * var otherWords = ['hi', 'goodbye'];
+     *
+     * _.isEqual(words, otherWords, function(a, b) {
+     *   var reGreet = /^(?:hello|hi)$/i,
+     *       aGreet = _.isString(a) && reGreet.test(a),
+     *       bGreet = _.isString(b) && reGreet.test(b);
+     *
+     *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
+     * });
+     * // => true
+     */
+    function isEqual(a, b, callback, thisArg) {
+      return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2));
+    }
+
+    /**
+     * Checks if `value` is, or can be coerced to, a finite number.
+     *
+     * Note: This is not the same as native `isFinite` which will return true for
+     * booleans and empty strings. See http://es5.github.io/#x15.1.2.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is finite, else `false`.
+     * @example
+     *
+     * _.isFinite(-101);
+     * // => true
+     *
+     * _.isFinite('10');
+     * // => true
+     *
+     * _.isFinite(true);
+     * // => false
+     *
+     * _.isFinite('');
+     * // => false
+     *
+     * _.isFinite(Infinity);
+     * // => false
+     */
+    function isFinite(value) {
+      return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
+    }
+
+    /**
+     * Checks if `value` is a function.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a function, else `false`.
+     * @example
+     *
+     * _.isFunction(_);
+     * // => true
+     */
+    function isFunction(value) {
+      return typeof value == 'function';
+    }
+
+    /**
+     * Checks if `value` is the language type of Object.
+     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
+     * @example
+     *
+     * _.isObject({});
+     * // => true
+     *
+     * _.isObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isObject(1);
+     * // => false
+     */
+    function isObject(value) {
+      // check if the value is the ECMAScript language type of Object
+      // http://es5.github.io/#x8
+      // and avoid a V8 bug
+      // http://code.google.com/p/v8/issues/detail?id=2291
+      return !!(value && objectTypes[typeof value]);
+    }
+
+    /**
+     * Checks if `value` is `NaN`.
+     *
+     * Note: This is not the same as native `isNaN` which will return `true` for
+     * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.
+     * @example
+     *
+     * _.isNaN(NaN);
+     * // => true
+     *
+     * _.isNaN(new Number(NaN));
+     * // => true
+     *
+     * isNaN(undefined);
+     * // => true
+     *
+     * _.isNaN(undefined);
+     * // => false
+     */
+    function isNaN(value) {
+      // `NaN` as a primitive is the only value that is not equal to itself
+      // (perform the [[Class]] check first to avoid errors with some host objects in IE)
+      return isNumber(value) && value != +value;
+    }
+
+    /**
+     * Checks if `value` is `null`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `null`, else `false`.
+     * @example
+     *
+     * _.isNull(null);
+     * // => true
+     *
+     * _.isNull(undefined);
+     * // => false
+     */
+    function isNull(value) {
+      return value === null;
+    }
+
+    /**
+     * Checks if `value` is a number.
+     *
+     * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a number, else `false`.
+     * @example
+     *
+     * _.isNumber(8.4 * 5);
+     * // => true
+     */
+    function isNumber(value) {
+      return typeof value == 'number' ||
+        value && typeof value == 'object' && toString.call(value) == numberClass || false;
+    }
+
+    /**
+     * Checks if `value` is an object created by the `Object` constructor.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * _.isPlainObject(new Shape);
+     * // => false
+     *
+     * _.isPlainObject([1, 2, 3]);
+     * // => false
+     *
+     * _.isPlainObject({ 'x': 0, 'y': 0 });
+     * // => true
+     */
+    var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
+      if (!(value && toString.call(value) == objectClass)) {
+        return false;
+      }
+      var valueOf = value.valueOf,
+          objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
+
+      return objProto
+        ? (value == objProto || getPrototypeOf(value) == objProto)
+        : shimIsPlainObject(value);
+    };
+
+    /**
+     * Checks if `value` is a regular expression.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.
+     * @example
+     *
+     * _.isRegExp(/fred/);
+     * // => true
+     */
+    function isRegExp(value) {
+      return value && typeof value == 'object' && toString.call(value) == regexpClass || false;
+    }
+
+    /**
+     * Checks if `value` is a string.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a string, else `false`.
+     * @example
+     *
+     * _.isString('fred');
+     * // => true
+     */
+    function isString(value) {
+      return typeof value == 'string' ||
+        value && typeof value == 'object' && toString.call(value) == stringClass || false;
+    }
+
+    /**
+     * Checks if `value` is `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.
+     * @example
+     *
+     * _.isUndefined(void 0);
+     * // => true
+     */
+    function isUndefined(value) {
+      return typeof value == 'undefined';
+    }
+
+    /**
+     * Creates an object with the same keys as `object` and values generated by
+     * running each own enumerable property of `object` through the callback.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new object with values of the results of each `callback` execution.
+     * @example
+     *
+     * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     *
+     * var characters = {
+     *   'fred': { 'name': 'fred', 'age': 40 },
+     *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.mapValues(characters, 'age');
+     * // => { 'fred': 40, 'pebbles': 1 }
+     */
+    function mapValues(object, callback, thisArg) {
+      var result = {};
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      forOwn(object, function(value, key, object) {
+        result[key] = callback(value, key, object);
+      });
+      return result;
+    }
+
+    /**
+     * Recursively merges own enumerable properties of the source object(s), that
+     * don't resolve to `undefined` into the destination object. Subsequent sources
+     * will overwrite property assignments of previous sources. If a callback is
+     * provided it will be executed to produce the merged values of the destination
+     * and source properties. If the callback returns `undefined` merging will
+     * be handled by the method instead. The callback is bound to `thisArg` and
+     * invoked with two arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var names = {
+     *   'characters': [
+     *     { 'name': 'barney' },
+     *     { 'name': 'fred' }
+     *   ]
+     * };
+     *
+     * var ages = {
+     *   'characters': [
+     *     { 'age': 36 },
+     *     { 'age': 40 }
+     *   ]
+     * };
+     *
+     * _.merge(names, ages);
+     * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] }
+     *
+     * var food = {
+     *   'fruits': ['apple'],
+     *   'vegetables': ['beet']
+     * };
+     *
+     * var otherFood = {
+     *   'fruits': ['banana'],
+     *   'vegetables': ['carrot']
+     * };
+     *
+     * _.merge(food, otherFood, function(a, b) {
+     *   return _.isArray(a) ? a.concat(b) : undefined;
+     * });
+     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
+     */
+    function merge(object) {
+      var args = arguments,
+          length = 2;
+
+      if (!isObject(object)) {
+        return object;
+      }
+      // allows working with `_.reduce` and `_.reduceRight` without using
+      // their `index` and `collection` arguments
+      if (typeof args[2] != 'number') {
+        length = args.length;
+      }
+      if (length > 3 && typeof args[length - 2] == 'function') {
+        var callback = baseCreateCallback(args[--length - 1], args[length--], 2);
+      } else if (length > 2 && typeof args[length - 1] == 'function') {
+        callback = args[--length];
+      }
+      var sources = slice(arguments, 1, length),
+          index = -1,
+          stackA = getArray(),
+          stackB = getArray();
+
+      while (++index < length) {
+        baseMerge(object, sources[index], callback, stackA, stackB);
+      }
+      releaseArray(stackA);
+      releaseArray(stackB);
+      return object;
+    }
+
+    /**
+     * Creates a shallow clone of `object` excluding the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a callback is provided it will be executed for each
+     * property of `object` omitting the properties the callback returns truey
+     * for. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|...string|string[]} [callback] The properties to omit or the
+     *  function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object without the omitted properties.
+     * @example
+     *
+     * _.omit({ 'name': 'fred', 'age': 40 }, 'age');
+     * // => { 'name': 'fred' }
+     *
+     * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {
+     *   return typeof value == 'number';
+     * });
+     * // => { 'name': 'fred' }
+     */
+    function omit(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var props = [];
+        forIn(object, function(value, key) {
+          props.push(key);
+        });
+        props = baseDifference(props, baseFlatten(arguments, true, false, 1));
+
+        var index = -1,
+            length = props.length;
+
+        while (++index < length) {
+          var key = props[index];
+          result[key] = object[key];
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg, 3);
+        forIn(object, function(value, key, object) {
+          if (!callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Creates a two dimensional array of an object's key-value pairs,
+     * i.e. `[[key1, value1], [key2, value2]]`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns new array of key-value pairs.
+     * @example
+     *
+     * _.pairs({ 'barney': 36, 'fred': 40 });
+     * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments)
+     */
+    function pairs(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        var key = props[index];
+        result[index] = [key, object[key]];
+      }
+      return result;
+    }
+
+    /**
+     * Creates a shallow clone of `object` composed of the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a callback is provided it will be executed for each
+     * property of `object` picking the properties the callback returns truey
+     * for. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|...string|string[]} [callback] The function called per
+     *  iteration or property names to pick, specified as individual property
+     *  names or arrays of property names.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object composed of the picked properties.
+     * @example
+     *
+     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name');
+     * // => { 'name': 'fred' }
+     *
+     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) {
+     *   return key.charAt(0) != '_';
+     * });
+     * // => { 'name': 'fred' }
+     */
+    function pick(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var index = -1,
+            props = baseFlatten(arguments, true, false, 1),
+            length = isObject(object) ? props.length : 0;
+
+        while (++index < length) {
+          var key = props[index];
+          if (key in object) {
+            result[key] = object[key];
+          }
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg, 3);
+        forIn(object, function(value, key, object) {
+          if (callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * An alternative to `_.reduce` this method transforms `object` to a new
+     * `accumulator` object which is the result of running each of its own
+     * enumerable properties through a callback, with each callback execution
+     * potentially mutating the `accumulator` object. The callback is bound to
+     * `thisArg` and invoked with four arguments; (accumulator, value, key, object).
+     * Callbacks may exit iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] The custom accumulator value.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {
+     *   num *= num;
+     *   if (num % 2) {
+     *     return result.push(num) < 3;
+     *   }
+     * });
+     * // => [1, 9, 25]
+     *
+     * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     * });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function transform(object, callback, accumulator, thisArg) {
+      var isArr = isArray(object);
+      if (accumulator == null) {
+        if (isArr) {
+          accumulator = [];
+        } else {
+          var ctor = object && object.constructor,
+              proto = ctor && ctor.prototype;
+
+          accumulator = baseCreate(proto);
+        }
+      }
+      if (callback) {
+        callback = lodash.createCallback(callback, thisArg, 4);
+        (isArr ? forEach : forOwn)(object, function(value, index, object) {
+          return callback(accumulator, value, index, object);
+        });
+      }
+      return accumulator;
+    }
+
+    /**
+     * Creates an array composed of the own enumerable property values of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property values.
+     * @example
+     *
+     * _.values({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => [1, 2, 3] (property order is not guaranteed across environments)
+     */
+    function values(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = object[props[index]];
+      }
+      return result;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of elements from the specified indexes, or keys, of the
+     * `collection`. Indexes may be specified as individual arguments or as arrays
+     * of indexes.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {...(number|number[]|string|string[])} [index] The indexes of `collection`
+     *   to retrieve, specified as individual indexes or arrays of indexes.
+     * @returns {Array} Returns a new array of elements corresponding to the
+     *  provided indexes.
+     * @example
+     *
+     * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
+     * // => ['a', 'c', 'e']
+     *
+     * _.at(['fred', 'barney', 'pebbles'], 0, 2);
+     * // => ['fred', 'pebbles']
+     */
+    function at(collection) {
+      var args = arguments,
+          index = -1,
+          props = baseFlatten(args, true, false, 1),
+          length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length,
+          result = Array(length);
+
+      while(++index < length) {
+        result[index] = collection[props[index]];
+      }
+      return result;
+    }
+
+    /**
+     * Checks if a given value is present in a collection using strict equality
+     * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
+     * offset from the end of the collection.
+     *
+     * @static
+     * @memberOf _
+     * @alias include
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {*} target The value to check for.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @returns {boolean} Returns `true` if the `target` element is found, else `false`.
+     * @example
+     *
+     * _.contains([1, 2, 3], 1);
+     * // => true
+     *
+     * _.contains([1, 2, 3], 1, 2);
+     * // => false
+     *
+     * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
+     * // => true
+     *
+     * _.contains('pebbles', 'eb');
+     * // => true
+     */
+    function contains(collection, target, fromIndex) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = collection ? collection.length : 0,
+          result = false;
+
+      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
+      if (isArray(collection)) {
+        result = indexOf(collection, target, fromIndex) > -1;
+      } else if (typeof length == 'number') {
+        result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1;
+      } else {
+        forOwn(collection, function(value) {
+          if (++index >= fromIndex) {
+            return !(result = value === target);
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` through the callback. The corresponding value
+     * of each key is the number of times the key was returned by the callback.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy(['one', 'two', 'three'], 'length');
+     * // => { '3': 2, '5': 1 }
+     */
+    var countBy = createAggregator(function(result, value, key) {
+      (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);
+    });
+
+    /**
+     * Checks if the given callback returns truey value for **all** elements of
+     * a collection. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias all
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if all elements passed the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.every([true, 1, null, 'yes']);
+     * // => false
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.every(characters, 'age');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.every(characters, { 'age': 36 });
+     * // => false
+     */
+    function every(collection, callback, thisArg) {
+      var result = true;
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      if (typeof length == 'number') {
+        while (++index < length) {
+          if (!(result = !!callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        forOwn(collection, function(value, index, collection) {
+          return (result = !!callback(value, index, collection));
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, returning an array of all elements
+     * the callback returns truey for. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias select
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that passed the callback check.
+     * @example
+     *
+     * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [2, 4, 6]
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.filter(characters, 'blocked');
+     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+     *
+     * // using "_.where" callback shorthand
+     * _.filter(characters, { 'age': 36 });
+     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+     */
+    function filter(collection, callback, thisArg) {
+      var result = [];
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      if (typeof length == 'number') {
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        }
+      } else {
+        forOwn(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, returning the first element that
+     * the callback returns truey for. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias detect, findWhere
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the found element, else `undefined`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': false },
+     *   { 'name': 'fred',    'age': 40, 'blocked': true },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+     * ];
+     *
+     * _.find(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => { 'name': 'barney', 'age': 36, 'blocked': false }
+     *
+     * // using "_.where" callback shorthand
+     * _.find(characters, { 'age': 1 });
+     * // =>  { 'name': 'pebbles', 'age': 1, 'blocked': false }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.find(characters, 'blocked');
+     * // => { 'name': 'fred', 'age': 40, 'blocked': true }
+     */
+    function find(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      if (typeof length == 'number') {
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            return value;
+          }
+        }
+      } else {
+        var result;
+        forOwn(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result = value;
+            return false;
+          }
+        });
+        return result;
+      }
+    }
+
+    /**
+     * This method is like `_.find` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the found element, else `undefined`.
+     * @example
+     *
+     * _.findLast([1, 2, 3, 4], function(num) {
+     *   return num % 2 == 1;
+     * });
+     * // => 3
+     */
+    function findLast(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forEachRight(collection, function(value, index, collection) {
+        if (callback(value, index, collection)) {
+          result = value;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, executing the callback for each
+     * element. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection). Callbacks may exit iteration early by
+     * explicitly returning `false`.
+     *
+     * Note: As with other "Collections" methods, objects with a `length` property
+     * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+     * may be used for object iteration.
+     *
+     * @static
+     * @memberOf _
+     * @alias each
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');
+     * // => logs each number and returns '1,2,3'
+     *
+     * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
+     * // => logs each number and returns the object (property order is not guaranteed across environments)
+     */
+    function forEach(collection, callback, thisArg) {
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+      if (typeof length == 'number') {
+        while (++index < length) {
+          if (callback(collection[index], index, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        forOwn(collection, callback);
+      }
+      return collection;
+    }
+
+    /**
+     * This method is like `_.forEach` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias eachRight
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');
+     * // => logs each number from right to left and returns '3,2,1'
+     */
+    function forEachRight(collection, callback, thisArg) {
+      var length = collection ? collection.length : 0;
+      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+      if (typeof length == 'number') {
+        while (length--) {
+          if (callback(collection[length], length, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        var props = keys(collection);
+        length = props.length;
+        forOwn(collection, function(value, key, collection) {
+          key = props ? props[--length] : --length;
+          return callback(collection[key], key, collection);
+        });
+      }
+      return collection;
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of a collection through the callback. The corresponding value
+     * of each key is an array of the elements responsible for generating the key.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.groupBy(['one', 'two', 'three'], 'length');
+     * // => { '3': ['one', 'two'], '5': ['three'] }
+     */
+    var groupBy = createAggregator(function(result, value, key) {
+      (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
+    });
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of the collection through the given callback. The corresponding
+     * value of each key is the last element responsible for generating the key.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * var keys = [
+     *   { 'dir': 'left', 'code': 97 },
+     *   { 'dir': 'right', 'code': 100 }
+     * ];
+     *
+     * _.indexBy(keys, 'dir');
+     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String);
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     */
+    var indexBy = createAggregator(function(result, value, key) {
+      result[key] = value;
+    });
+
+    /**
+     * Invokes the method named by `methodName` on each element in the `collection`
+     * returning an array of the results of each invoked method. Additional arguments
+     * will be provided to each invoked method. If `methodName` is a function it
+     * will be invoked for, and `this` bound to, each element in the `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|string} methodName The name of the method to invoke or
+     *  the function invoked per iteration.
+     * @param {...*} [arg] Arguments to invoke the method with.
+     * @returns {Array} Returns a new array of the results of each invoked method.
+     * @example
+     *
+     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+     * // => [[1, 5, 7], [1, 2, 3]]
+     *
+     * _.invoke([123, 456], String.prototype.split, '');
+     * // => [['1', '2', '3'], ['4', '5', '6']]
+     */
+    function invoke(collection, methodName) {
+      var args = slice(arguments, 2),
+          index = -1,
+          isFunc = typeof methodName == 'function',
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      forEach(collection, function(value) {
+        result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
+      });
+      return result;
+    }
+
+    /**
+     * Creates an array of values by running each element in the collection
+     * through the callback. The callback is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias collect
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of the results of each `callback` execution.
+     * @example
+     *
+     * _.map([1, 2, 3], function(num) { return num * 3; });
+     * // => [3, 6, 9]
+     *
+     * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
+     * // => [3, 6, 9] (property order is not guaranteed across environments)
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(characters, 'name');
+     * // => ['barney', 'fred']
+     */
+    function map(collection, callback, thisArg) {
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      if (typeof length == 'number') {
+        var result = Array(length);
+        while (++index < length) {
+          result[index] = callback(collection[index], index, collection);
+        }
+      } else {
+        result = [];
+        forOwn(collection, function(value, key, collection) {
+          result[++index] = callback(value, key, collection);
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the maximum value of a collection. If the collection is empty or
+     * falsey `-Infinity` is returned. If a callback is provided it will be executed
+     * for each value in the collection to generate the criterion by which the value
+     * is ranked. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the maximum value.
+     * @example
+     *
+     * _.max([4, 2, 8, 6]);
+     * // => 8
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.max(characters, function(chr) { return chr.age; });
+     * // => { 'name': 'fred', 'age': 40 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.max(characters, 'age');
+     * // => { 'name': 'fred', 'age': 40 };
+     */
+    function max(collection, callback, thisArg) {
+      var computed = -Infinity,
+          result = computed;
+
+      // allows working with functions like `_.map` without using
+      // their `index` argument as a callback
+      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+        callback = null;
+      }
+      if (callback == null && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (value > result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (callback == null && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg, 3);
+
+        forEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current > computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the minimum value of a collection. If the collection is empty or
+     * falsey `Infinity` is returned. If a callback is provided it will be executed
+     * for each value in the collection to generate the criterion by which the value
+     * is ranked. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the minimum value.
+     * @example
+     *
+     * _.min([4, 2, 8, 6]);
+     * // => 2
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.min(characters, function(chr) { return chr.age; });
+     * // => { 'name': 'barney', 'age': 36 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.min(characters, 'age');
+     * // => { 'name': 'barney', 'age': 36 };
+     */
+    function min(collection, callback, thisArg) {
+      var computed = Infinity,
+          result = computed;
+
+      // allows working with functions like `_.map` without using
+      // their `index` argument as a callback
+      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+        callback = null;
+      }
+      if (callback == null && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (value < result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (callback == null && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg, 3);
+
+        forEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current < computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the value of a specified property from all elements in the collection.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {string} property The name of the property to pluck.
+     * @returns {Array} Returns a new array of property values.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.pluck(characters, 'name');
+     * // => ['barney', 'fred']
+     */
+    var pluck = map;
+
+    /**
+     * Reduces a collection to a value which is the accumulated result of running
+     * each element in the collection through the callback, where each successive
+     * callback execution consumes the return value of the previous execution. If
+     * `accumulator` is not provided the first element of the collection will be
+     * used as the initial `accumulator` value. The callback is bound to `thisArg`
+     * and invoked with four arguments; (accumulator, value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @alias foldl, inject
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] Initial value of the accumulator.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var sum = _.reduce([1, 2, 3], function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     *   return result;
+     * }, {});
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function reduce(collection, callback, accumulator, thisArg) {
+      if (!collection) return accumulator;
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+
+      var index = -1,
+          length = collection.length;
+
+      if (typeof length == 'number') {
+        if (noaccum) {
+          accumulator = collection[++index];
+        }
+        while (++index < length) {
+          accumulator = callback(accumulator, collection[index], index, collection);
+        }
+      } else {
+        forOwn(collection, function(value, index, collection) {
+          accumulator = noaccum
+            ? (noaccum = false, value)
+            : callback(accumulator, value, index, collection)
+        });
+      }
+      return accumulator;
+    }
+
+    /**
+     * This method is like `_.reduce` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias foldr
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] Initial value of the accumulator.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var list = [[0, 1], [2, 3], [4, 5]];
+     * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
+     * // => [4, 5, 2, 3, 0, 1]
+     */
+    function reduceRight(collection, callback, accumulator, thisArg) {
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+      forEachRight(collection, function(value, index, collection) {
+        accumulator = noaccum
+          ? (noaccum = false, value)
+          : callback(accumulator, value, index, collection);
+      });
+      return accumulator;
+    }
+
+    /**
+     * The opposite of `_.filter` this method returns the elements of a
+     * collection that the callback does **not** return truey for.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that failed the callback check.
+     * @example
+     *
+     * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [1, 3, 5]
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.reject(characters, 'blocked');
+     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+     *
+     * // using "_.where" callback shorthand
+     * _.reject(characters, { 'age': 36 });
+     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+     */
+    function reject(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg, 3);
+      return filter(collection, function(value, index, collection) {
+        return !callback(value, index, collection);
+      });
+    }
+
+    /**
+     * Retrieves a random element or `n` random elements from a collection.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to sample.
+     * @param {number} [n] The number of elements to sample.
+     * @param- {Object} [guard] Allows working with functions like `_.map`
+     *  without using their `index` arguments as `n`.
+     * @returns {Array} Returns the random sample(s) of `collection`.
+     * @example
+     *
+     * _.sample([1, 2, 3, 4]);
+     * // => 2
+     *
+     * _.sample([1, 2, 3, 4], 2);
+     * // => [3, 1]
+     */
+    function sample(collection, n, guard) {
+      if (collection && typeof collection.length != 'number') {
+        collection = values(collection);
+      }
+      if (n == null || guard) {
+        return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
+      }
+      var result = shuffle(collection);
+      result.length = nativeMin(nativeMax(0, n), result.length);
+      return result;
+    }
+
+    /**
+     * Creates an array of shuffled values, using a version of the Fisher-Yates
+     * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to shuffle.
+     * @returns {Array} Returns a new shuffled collection.
+     * @example
+     *
+     * _.shuffle([1, 2, 3, 4, 5, 6]);
+     * // => [4, 1, 6, 3, 5, 2]
+     */
+    function shuffle(collection) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      forEach(collection, function(value) {
+        var rand = baseRandom(0, ++index);
+        result[index] = result[rand];
+        result[rand] = value;
+      });
+      return result;
+    }
+
+    /**
+     * Gets the size of the `collection` by returning `collection.length` for arrays
+     * and array-like objects or the number of own enumerable properties for objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to inspect.
+     * @returns {number} Returns `collection.length` or number of own enumerable properties.
+     * @example
+     *
+     * _.size([1, 2]);
+     * // => 2
+     *
+     * _.size({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => 3
+     *
+     * _.size('pebbles');
+     * // => 7
+     */
+    function size(collection) {
+      var length = collection ? collection.length : 0;
+      return typeof length == 'number' ? length : keys(collection).length;
+    }
+
+    /**
+     * Checks if the callback returns a truey value for **any** element of a
+     * collection. The function returns as soon as it finds a passing value and
+     * does not iterate over the entire collection. The callback is bound to
+     * `thisArg` and invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias any
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if any element passed the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.some([null, 0, 'yes', false], Boolean);
+     * // => true
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.some(characters, 'blocked');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.some(characters, { 'age': 1 });
+     * // => false
+     */
+    function some(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      if (typeof length == 'number') {
+        while (++index < length) {
+          if ((result = callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        forOwn(collection, function(value, index, collection) {
+          return !(result = callback(value, index, collection));
+        });
+      }
+      return !!result;
+    }
+
+    /**
+     * Creates an array of elements, sorted in ascending order by the results of
+     * running each element in a collection through the callback. This method
+     * performs a stable sort, that is, it will preserve the original sort order
+     * of equal elements. The callback is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an array of property names is provided for `callback` the collection
+     * will be sorted by each property value.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Array|Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of sorted elements.
+     * @example
+     *
+     * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
+     * // => [3, 1, 2]
+     *
+     * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
+     * // => [3, 1, 2]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36 },
+     *   { 'name': 'fred',    'age': 40 },
+     *   { 'name': 'barney',  'age': 26 },
+     *   { 'name': 'fred',    'age': 30 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(_.sortBy(characters, 'age'), _.values);
+     * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]]
+     *
+     * // sorting by multiple properties
+     * _.map(_.sortBy(characters, ['name', 'age']), _.values);
+     * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]
+     */
+    function sortBy(collection, callback, thisArg) {
+      var index = -1,
+          isArr = isArray(callback),
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      if (!isArr) {
+        callback = lodash.createCallback(callback, thisArg, 3);
+      }
+      forEach(collection, function(value, key, collection) {
+        var object = result[++index] = getObject();
+        if (isArr) {
+          object.criteria = map(callback, function(key) { return value[key]; });
+        } else {
+          (object.criteria = getArray())[0] = callback(value, key, collection);
+        }
+        object.index = index;
+        object.value = value;
+      });
+
+      length = result.length;
+      result.sort(compareAscending);
+      while (length--) {
+        var object = result[length];
+        result[length] = object.value;
+        if (!isArr) {
+          releaseArray(object.criteria);
+        }
+        releaseObject(object);
+      }
+      return result;
+    }
+
+    /**
+     * Converts the `collection` to an array.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to convert.
+     * @returns {Array} Returns the new converted array.
+     * @example
+     *
+     * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
+     * // => [2, 3, 4]
+     */
+    function toArray(collection) {
+      if (collection && typeof collection.length == 'number') {
+        return slice(collection);
+      }
+      return values(collection);
+    }
+
+    /**
+     * Performs a deep comparison of each element in a `collection` to the given
+     * `properties` object, returning an array of all elements that have equivalent
+     * property values.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Object} props The object of property values to filter by.
+     * @returns {Array} Returns a new array of elements that have the given properties.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] },
+     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * _.where(characters, { 'age': 36 });
+     * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }]
+     *
+     * _.where(characters, { 'pets': ['dino'] });
+     * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }]
+     */
+    var where = filter;
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array with all falsey values removed. The values `false`, `null`,
+     * `0`, `""`, `undefined`, and `NaN` are all falsey.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to compact.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.compact([0, 1, false, 2, '', 3]);
+     * // => [1, 2, 3]
+     */
+    function compact(array) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+        if (value) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array excluding all values of the provided arrays using strict
+     * equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {...Array} [values] The arrays of values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
+     * // => [1, 3, 4]
+     */
+    function difference(array) {
+      return baseDifference(array, baseFlatten(arguments, true, true, 1));
+    }
+
+    /**
+     * This method is like `_.find` except that it returns the index of the first
+     * element that passes the callback check, instead of the element itself.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': false },
+     *   { 'name': 'fred',    'age': 40, 'blocked': true },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+     * ];
+     *
+     * _.findIndex(characters, function(chr) {
+     *   return chr.age < 20;
+     * });
+     * // => 2
+     *
+     * // using "_.where" callback shorthand
+     * _.findIndex(characters, { 'age': 36 });
+     * // => 0
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findIndex(characters, 'blocked');
+     * // => 1
+     */
+    function findIndex(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0;
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (++index < length) {
+        if (callback(array[index], index, array)) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * This method is like `_.findIndex` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': true },
+     *   { 'name': 'fred',    'age': 40, 'blocked': false },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': true }
+     * ];
+     *
+     * _.findLastIndex(characters, function(chr) {
+     *   return chr.age > 30;
+     * });
+     * // => 1
+     *
+     * // using "_.where" callback shorthand
+     * _.findLastIndex(characters, { 'age': 36 });
+     * // => 0
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findLastIndex(characters, 'blocked');
+     * // => 2
+     */
+    function findLastIndex(array, callback, thisArg) {
+      var length = array ? array.length : 0;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (length--) {
+        if (callback(array[length], length, array)) {
+          return length;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Gets the first element or first `n` elements of an array. If a callback
+     * is provided elements at the beginning of the array are returned as long
+     * as the callback returns truey. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias head, take
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the first element(s) of `array`.
+     * @example
+     *
+     * _.first([1, 2, 3]);
+     * // => 1
+     *
+     * _.first([1, 2, 3], 2);
+     * // => [1, 2]
+     *
+     * _.first([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [1, 2]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.first(characters, 'blocked');
+     * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name');
+     * // => ['barney', 'fred']
+     */
+    function first(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = -1;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = callback;
+        if (n == null || thisArg) {
+          return array ? array[0] : undefined;
+        }
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, n), length));
+    }
+
+    /**
+     * Flattens a nested array (the nesting can be to any depth). If `isShallow`
+     * is truey, the array will only be flattened a single level. If a callback
+     * is provided each element of the array is passed through the callback before
+     * flattening. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new flattened array.
+     * @example
+     *
+     * _.flatten([1, [2], [3, [[4]]]]);
+     * // => [1, 2, 3, 4];
+     *
+     * _.flatten([1, [2], [3, [[4]]]], true);
+     * // => [1, 2, 3, [[4]]];
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },
+     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.flatten(characters, 'pets');
+     * // => ['hoppy', 'baby puss', 'dino']
+     */
+    function flatten(array, isShallow, callback, thisArg) {
+      // juggle arguments
+      if (typeof isShallow != 'boolean' && isShallow != null) {
+        thisArg = callback;
+        callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow;
+        isShallow = false;
+      }
+      if (callback != null) {
+        array = map(array, callback, thisArg);
+      }
+      return baseFlatten(array, isShallow);
+    }
+
+    /**
+     * Gets the index at which the first occurrence of `value` is found using
+     * strict equality for comparisons, i.e. `===`. If the array is already sorted
+     * providing `true` for `fromIndex` will run a faster binary search.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+     *  to perform a binary search on a sorted array.
+     * @returns {number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 1
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 4
+     *
+     * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
+     * // => 2
+     */
+    function indexOf(array, value, fromIndex) {
+      if (typeof fromIndex == 'number') {
+        var length = array ? array.length : 0;
+        fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
+      } else if (fromIndex) {
+        var index = sortedIndex(array, value);
+        return array[index] === value ? index : -1;
+      }
+      return baseIndexOf(array, value, fromIndex);
+    }
+
+    /**
+     * Gets all but the last element or last `n` elements of an array. If a
+     * callback is provided elements at the end of the array are excluded from
+     * the result as long as the callback returns truey. The callback is bound
+     * to `thisArg` and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.initial([1, 2, 3]);
+     * // => [1, 2]
+     *
+     * _.initial([1, 2, 3], 2);
+     * // => [1]
+     *
+     * _.initial([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [1]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.initial(characters, 'blocked');
+     * // => [{ 'name': 'barney',  'blocked': false, 'employer': 'slate' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name');
+     * // => ['barney', 'fred']
+     */
+    function initial(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : callback || n;
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
+    }
+
+    /**
+     * Creates an array of unique values present in all provided arrays using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of shared values.
+     * @example
+     *
+     * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+     * // => [1, 2]
+     */
+    function intersection() {
+      var args = [],
+          argsIndex = -1,
+          argsLength = arguments.length,
+          caches = getArray(),
+          indexOf = getIndexOf(),
+          trustIndexOf = indexOf === baseIndexOf,
+          seen = getArray();
+
+      while (++argsIndex < argsLength) {
+        var value = arguments[argsIndex];
+        if (isArray(value) || isArguments(value)) {
+          args.push(value);
+          caches.push(trustIndexOf && value.length >= largeArraySize &&
+            createCache(argsIndex ? args[argsIndex] : seen));
+        }
+      }
+      var array = args[0],
+          index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      outer:
+      while (++index < length) {
+        var cache = caches[0];
+        value = array[index];
+
+        if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
+          argsIndex = argsLength;
+          (cache || seen).push(value);
+          while (--argsIndex) {
+            cache = caches[argsIndex];
+            if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
+              continue outer;
+            }
+          }
+          result.push(value);
+        }
+      }
+      while (argsLength--) {
+        cache = caches[argsLength];
+        if (cache) {
+          releaseObject(cache);
+        }
+      }
+      releaseArray(caches);
+      releaseArray(seen);
+      return result;
+    }
+
+    /**
+     * Gets the last element or last `n` elements of an array. If a callback is
+     * provided elements at the end of the array are returned as long as the
+     * callback returns truey. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the last element(s) of `array`.
+     * @example
+     *
+     * _.last([1, 2, 3]);
+     * // => 3
+     *
+     * _.last([1, 2, 3], 2);
+     * // => [2, 3]
+     *
+     * _.last([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [2, 3]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.pluck(_.last(characters, 'blocked'), 'name');
+     * // => ['fred', 'pebbles']
+     *
+     * // using "_.where" callback shorthand
+     * _.last(characters, { 'employer': 'na' });
+     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+     */
+    function last(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = callback;
+        if (n == null || thisArg) {
+          return array ? array[length - 1] : undefined;
+        }
+      }
+      return slice(array, nativeMax(0, length - n));
+    }
+
+    /**
+     * Gets the index at which the last occurrence of `value` is found using strict
+     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
+     * as the offset from the end of the collection.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {number} [fromIndex=array.length-1] The index to search from.
+     * @returns {number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 4
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 1
+     */
+    function lastIndexOf(array, value, fromIndex) {
+      var index = array ? array.length : 0;
+      if (typeof fromIndex == 'number') {
+        index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
+      }
+      while (index--) {
+        if (array[index] === value) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Removes all provided values from the given array using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to modify.
+     * @param {...*} [value] The values to remove.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3, 1, 2, 3];
+     * _.pull(array, 2, 3);
+     * console.log(array);
+     * // => [1, 1]
+     */
+    function pull(array) {
+      var args = arguments,
+          argsIndex = 0,
+          argsLength = args.length,
+          length = array ? array.length : 0;
+
+      while (++argsIndex < argsLength) {
+        var index = -1,
+            value = args[argsIndex];
+        while (++index < length) {
+          if (array[index] === value) {
+            splice.call(array, index--, 1);
+            length--;
+          }
+        }
+      }
+      return array;
+    }
+
+    /**
+     * Creates an array of numbers (positive and/or negative) progressing from
+     * `start` up to but not including `end`. If `start` is less than `stop` a
+     * zero-length range is created unless a negative `step` is specified.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns a new range array.
+     * @example
+     *
+     * _.range(4);
+     * // => [0, 1, 2, 3]
+     *
+     * _.range(1, 5);
+     * // => [1, 2, 3, 4]
+     *
+     * _.range(0, 20, 5);
+     * // => [0, 5, 10, 15]
+     *
+     * _.range(0, -4, -1);
+     * // => [0, -1, -2, -3]
+     *
+     * _.range(1, 4, 0);
+     * // => [1, 1, 1]
+     *
+     * _.range(0);
+     * // => []
+     */
+    function range(start, end, step) {
+      start = +start || 0;
+      step = typeof step == 'number' ? step : (+step || 1);
+
+      if (end == null) {
+        end = start;
+        start = 0;
+      }
+      // use `Array(length)` so engines like Chakra and V8 avoid slower modes
+      // http://youtu.be/XAqIpGU8ZZk#t=17m25s
+      var index = -1,
+          length = nativeMax(0, ceil((end - start) / (step || 1))),
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = start;
+        start += step;
+      }
+      return result;
+    }
+
+    /**
+     * Removes all elements from an array that the callback returns truey for
+     * and returns an array of removed elements. The callback is bound to `thisArg`
+     * and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to modify.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of removed elements.
+     * @example
+     *
+     * var array = [1, 2, 3, 4, 5, 6];
+     * var evens = _.remove(array, function(num) { return num % 2 == 0; });
+     *
+     * console.log(array);
+     * // => [1, 3, 5]
+     *
+     * console.log(evens);
+     * // => [2, 4, 6]
+     */
+    function remove(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (++index < length) {
+        var value = array[index];
+        if (callback(value, index, array)) {
+          result.push(value);
+          splice.call(array, index--, 1);
+          length--;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The opposite of `_.initial` this method gets all but the first element or
+     * first `n` elements of an array. If a callback function is provided elements
+     * at the beginning of the array are excluded from the result as long as the
+     * callback returns truey. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias drop, tail
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.rest([1, 2, 3]);
+     * // => [2, 3]
+     *
+     * _.rest([1, 2, 3], 2);
+     * // => [3]
+     *
+     * _.rest([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [3]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': false,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.pluck(_.rest(characters, 'blocked'), 'name');
+     * // => ['fred', 'pebbles']
+     *
+     * // using "_.where" callback shorthand
+     * _.rest(characters, { 'employer': 'slate' });
+     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+     */
+    function rest(array, callback, thisArg) {
+      if (typeof callback != 'number' && callback != null) {
+        var n = 0,
+            index = -1,
+            length = array ? array.length : 0;
+
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
+      }
+      return slice(array, n);
+    }
+
+    /**
+     * Uses a binary search to determine the smallest index at which a value
+     * should be inserted into a given sorted array in order to maintain the sort
+     * order of the array. If a callback is provided it will be executed for
+     * `value` and each element of `array` to compute their sort ranking. The
+     * callback is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedIndex([20, 30, 50], 40);
+     * // => 2
+     *
+     * // using "_.pluck" callback shorthand
+     * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+     * // => 2
+     *
+     * var dict = {
+     *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
+     * };
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return dict.wordToNumber[word];
+     * });
+     * // => 2
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return this.wordToNumber[word];
+     * }, dict);
+     * // => 2
+     */
+    function sortedIndex(array, value, callback, thisArg) {
+      var low = 0,
+          high = array ? array.length : low;
+
+      // explicitly reference `identity` for better inlining in Firefox
+      callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
+      value = callback(value);
+
+      while (low < high) {
+        var mid = (low + high) >>> 1;
+        (callback(array[mid]) < value)
+          ? low = mid + 1
+          : high = mid;
+      }
+      return low;
+    }
+
+    /**
+     * Creates an array of unique values, in order, of the provided arrays using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of combined values.
+     * @example
+     *
+     * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+     * // => [1, 2, 3, 5, 4]
+     */
+    function union() {
+      return baseUniq(baseFlatten(arguments, true, true));
+    }
+
+    /**
+     * Creates a duplicate-value-free version of an array using strict equality
+     * for comparisons, i.e. `===`. If the array is sorted, providing
+     * `true` for `isSorted` will use a faster algorithm. If a callback is provided
+     * each element of `array` is passed through the callback before uniqueness
+     * is computed. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias unique
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a duplicate-value-free array.
+     * @example
+     *
+     * _.uniq([1, 2, 1, 3, 1]);
+     * // => [1, 2, 3]
+     *
+     * _.uniq([1, 1, 2, 2, 3], true);
+     * // => [1, 2, 3]
+     *
+     * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
+     * // => ['A', 'b', 'C']
+     *
+     * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
+     * // => [1, 2.5, 3]
+     *
+     * // using "_.pluck" callback shorthand
+     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    function uniq(array, isSorted, callback, thisArg) {
+      // juggle arguments
+      if (typeof isSorted != 'boolean' && isSorted != null) {
+        thisArg = callback;
+        callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;
+        isSorted = false;
+      }
+      if (callback != null) {
+        callback = lodash.createCallback(callback, thisArg, 3);
+      }
+      return baseUniq(array, isSorted, callback);
+    }
+
+    /**
+     * Creates an array excluding all provided values using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to filter.
+     * @param {...*} [value] The values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
+     * // => [2, 3, 4]
+     */
+    function without(array) {
+      return baseDifference(array, slice(arguments, 1));
+    }
+
+    /**
+     * Creates an array that is the symmetric difference of the provided arrays.
+     * See http://en.wikipedia.org/wiki/Symmetric_difference.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of values.
+     * @example
+     *
+     * _.xor([1, 2, 3], [5, 2, 1, 4]);
+     * // => [3, 5, 4]
+     *
+     * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);
+     * // => [1, 4, 5]
+     */
+    function xor() {
+      var index = -1,
+          length = arguments.length;
+
+      while (++index < length) {
+        var array = arguments[index];
+        if (isArray(array) || isArguments(array)) {
+          var result = result
+            ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result)))
+            : array;
+        }
+      }
+      return result || [];
+    }
+
+    /**
+     * Creates an array of grouped elements, the first of which contains the first
+     * elements of the given arrays, the second of which contains the second
+     * elements of the given arrays, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @alias unzip
+     * @category Arrays
+     * @param {...Array} [array] Arrays to process.
+     * @returns {Array} Returns a new array of grouped elements.
+     * @example
+     *
+     * _.zip(['fred', 'barney'], [30, 40], [true, false]);
+     * // => [['fred', 30, true], ['barney', 40, false]]
+     */
+    function zip() {
+      var array = arguments.length > 1 ? arguments : arguments[0],
+          index = -1,
+          length = array ? max(pluck(array, 'length')) : 0,
+          result = Array(length < 0 ? 0 : length);
+
+      while (++index < length) {
+        result[index] = pluck(array, index);
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed from arrays of `keys` and `values`. Provide
+     * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+     * or two arrays, one of `keys` and one of corresponding `values`.
+     *
+     * @static
+     * @memberOf _
+     * @alias object
+     * @category Arrays
+     * @param {Array} keys The array of keys.
+     * @param {Array} [values=[]] The array of values.
+     * @returns {Object} Returns an object composed of the given keys and
+     *  corresponding values.
+     * @example
+     *
+     * _.zipObject(['fred', 'barney'], [30, 40]);
+     * // => { 'fred': 30, 'barney': 40 }
+     */
+    function zipObject(keys, values) {
+      var index = -1,
+          length = keys ? keys.length : 0,
+          result = {};
+
+      if (!values && length && !isArray(keys[0])) {
+        values = [];
+      }
+      while (++index < length) {
+        var key = keys[index];
+        if (values) {
+          result[key] = values[index];
+        } else if (key) {
+          result[key[0]] = key[1];
+        }
+      }
+      return result;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a function that executes `func`, with  the `this` binding and
+     * arguments of the created function, only after being called `n` times.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {number} n The number of times the function must be called before
+     *  `func` is executed.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var saves = ['profile', 'settings'];
+     *
+     * var done = _.after(saves.length, function() {
+     *   console.log('Done saving!');
+     * });
+     *
+     * _.forEach(saves, function(type) {
+     *   asyncSave({ 'type': type, 'complete': done });
+     * });
+     * // => logs 'Done saving!', after all saves have completed
+     */
+    function after(n, func) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      return function() {
+        if (--n < 1) {
+          return func.apply(this, arguments);
+        }
+      };
+    }
+
+    /**
+     * Creates a function that, when called, invokes `func` with the `this`
+     * binding of `thisArg` and prepends any additional `bind` arguments to those
+     * provided to the bound function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to bind.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var func = function(greeting) {
+     *   return greeting + ' ' + this.name;
+     * };
+     *
+     * func = _.bind(func, { 'name': 'fred' }, 'hi');
+     * func();
+     * // => 'hi fred'
+     */
+    function bind(func, thisArg) {
+      return arguments.length > 2
+        ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
+        : createWrapper(func, 1, null, null, thisArg);
+    }
+
+    /**
+     * Binds methods of an object to the object itself, overwriting the existing
+     * method. Method names may be specified as individual arguments or as arrays
+     * of method names. If no method names are provided all the function properties
+     * of `object` will be bound.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object to bind and assign the bound methods to.
+     * @param {...string} [methodName] The object method names to
+     *  bind, specified as individual method names or arrays of method names.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'onClick': function() { console.log('clicked ' + this.label); }
+     * };
+     *
+     * _.bindAll(view);
+     * jQuery('#docs').on('click', view.onClick);
+     * // => logs 'clicked docs', when the button is clicked
+     */
+    function bindAll(object) {
+      var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),
+          index = -1,
+          length = funcs.length;
+
+      while (++index < length) {
+        var key = funcs[index];
+        object[key] = createWrapper(object[key], 1, null, null, object);
+      }
+      return object;
+    }
+
+    /**
+     * Creates a function that, when called, invokes the method at `object[key]`
+     * and prepends any additional `bindKey` arguments to those provided to the bound
+     * function. This method differs from `_.bind` by allowing bound functions to
+     * reference methods that will be redefined or don't yet exist.
+     * See http://michaux.ca/articles/lazy-function-definition-pattern.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object the method belongs to.
+     * @param {string} key The key of the method.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var object = {
+     *   'name': 'fred',
+     *   'greet': function(greeting) {
+     *     return greeting + ' ' + this.name;
+     *   }
+     * };
+     *
+     * var func = _.bindKey(object, 'greet', 'hi');
+     * func();
+     * // => 'hi fred'
+     *
+     * object.greet = function(greeting) {
+     *   return greeting + 'ya ' + this.name + '!';
+     * };
+     *
+     * func();
+     * // => 'hiya fred!'
+     */
+    function bindKey(object, key) {
+      return arguments.length > 2
+        ? createWrapper(key, 19, slice(arguments, 2), null, object)
+        : createWrapper(key, 3, null, null, object);
+    }
+
+    /**
+     * Creates a function that is the composition of the provided functions,
+     * where each function consumes the return value of the function that follows.
+     * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
+     * Each function is executed with the `this` binding of the composed function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {...Function} [func] Functions to compose.
+     * @returns {Function} Returns the new composed function.
+     * @example
+     *
+     * var realNameMap = {
+     *   'pebbles': 'penelope'
+     * };
+     *
+     * var format = function(name) {
+     *   name = realNameMap[name.toLowerCase()] || name;
+     *   return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
+     * };
+     *
+     * var greet = function(formatted) {
+     *   return 'Hiya ' + formatted + '!';
+     * };
+     *
+     * var welcome = _.compose(greet, format);
+     * welcome('pebbles');
+     * // => 'Hiya Penelope!'
+     */
+    function compose() {
+      var funcs = arguments,
+          length = funcs.length;
+
+      while (length--) {
+        if (!isFunction(funcs[length])) {
+          throw new TypeError;
+        }
+      }
+      return function() {
+        var args = arguments,
+            length = funcs.length;
+
+        while (length--) {
+          args = [funcs[length].apply(this, args)];
+        }
+        return args[0];
+      };
+    }
+
+    /**
+     * Creates a function which accepts one or more arguments of `func` that when
+     * invoked either executes `func` returning its result, if all `func` arguments
+     * have been provided, or returns a function that accepts one or more of the
+     * remaining `func` arguments, and so on. The arity of `func` can be specified
+     * if `func.length` is not sufficient.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var curried = _.curry(function(a, b, c) {
+     *   console.log(a + b + c);
+     * });
+     *
+     * curried(1)(2)(3);
+     * // => 6
+     *
+     * curried(1, 2)(3);
+     * // => 6
+     *
+     * curried(1, 2, 3);
+     * // => 6
+     */
+    function curry(func, arity) {
+      arity = typeof arity == 'number' ? arity : (+arity || func.length);
+      return createWrapper(func, 4, null, null, null, arity);
+    }
+
+    /**
+     * Creates a function that will delay the execution of `func` until after
+     * `wait` milliseconds have elapsed since the last time it was invoked.
+     * Provide an options object to indicate that `func` should be invoked on
+     * the leading and/or trailing edge of the `wait` timeout. Subsequent calls
+     * to the debounced function will return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true` `func` will be called
+     * on the trailing edge of the timeout only if the the debounced function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to debounce.
+     * @param {number} wait The number of milliseconds to delay.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout.
+     * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called.
+     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new debounced function.
+     * @example
+     *
+     * // avoid costly calculations while the window size is in flux
+     * var lazyLayout = _.debounce(calculateLayout, 150);
+     * jQuery(window).on('resize', lazyLayout);
+     *
+     * // execute `sendMail` when the click event is fired, debouncing subsequent calls
+     * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+     *   'leading': true,
+     *   'trailing': false
+     * });
+     *
+     * // ensure `batchLog` is executed once after 1 second of debounced calls
+     * var source = new EventSource('/stream');
+     * source.addEventListener('message', _.debounce(batchLog, 250, {
+     *   'maxWait': 1000
+     * }, false);
+     */
+    function debounce(func, wait, options) {
+      var args,
+          maxTimeoutId,
+          result,
+          stamp,
+          thisArg,
+          timeoutId,
+          trailingCall,
+          lastCalled = 0,
+          maxWait = false,
+          trailing = true;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      wait = nativeMax(0, wait) || 0;
+      if (options === true) {
+        var leading = true;
+        trailing = false;
+      } else if (isObject(options)) {
+        leading = options.leading;
+        maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      var delayed = function() {
+        var remaining = wait - (now() - stamp);
+        if (remaining <= 0) {
+          if (maxTimeoutId) {
+            clearTimeout(maxTimeoutId);
+          }
+          var isCalled = trailingCall;
+          maxTimeoutId = timeoutId = trailingCall = undefined;
+          if (isCalled) {
+            lastCalled = now();
+            result = func.apply(thisArg, args);
+            if (!timeoutId && !maxTimeoutId) {
+              args = thisArg = null;
+            }
+          }
+        } else {
+          timeoutId = setTimeout(delayed, remaining);
+        }
+      };
+
+      var maxDelayed = function() {
+        if (timeoutId) {
+          clearTimeout(timeoutId);
+        }
+        maxTimeoutId = timeoutId = trailingCall = undefined;
+        if (trailing || (maxWait !== wait)) {
+          lastCalled = now();
+          result = func.apply(thisArg, args);
+          if (!timeoutId && !maxTimeoutId) {
+            args = thisArg = null;
+          }
+        }
+      };
+
+      return function() {
+        args = arguments;
+        stamp = now();
+        thisArg = this;
+        trailingCall = trailing && (timeoutId || !leading);
+
+        if (maxWait === false) {
+          var leadingCall = leading && !timeoutId;
+        } else {
+          if (!maxTimeoutId && !leading) {
+            lastCalled = stamp;
+          }
+          var remaining = maxWait - (stamp - lastCalled),
+              isCalled = remaining <= 0;
+
+          if (isCalled) {
+            if (maxTimeoutId) {
+              maxTimeoutId = clearTimeout(maxTimeoutId);
+            }
+            lastCalled = stamp;
+            result = func.apply(thisArg, args);
+          }
+          else if (!maxTimeoutId) {
+            maxTimeoutId = setTimeout(maxDelayed, remaining);
+          }
+        }
+        if (isCalled && timeoutId) {
+          timeoutId = clearTimeout(timeoutId);
+        }
+        else if (!timeoutId && wait !== maxWait) {
+          timeoutId = setTimeout(delayed, wait);
+        }
+        if (leadingCall) {
+          isCalled = true;
+          result = func.apply(thisArg, args);
+        }
+        if (isCalled && !timeoutId && !maxTimeoutId) {
+          args = thisArg = null;
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Defers executing the `func` function until the current call stack has cleared.
+     * Additional arguments will be provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to defer.
+     * @param {...*} [arg] Arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.defer(function(text) { console.log(text); }, 'deferred');
+     * // logs 'deferred' after one or more milliseconds
+     */
+    function defer(func) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var args = slice(arguments, 1);
+      return setTimeout(function() { func.apply(undefined, args); }, 1);
+    }
+
+    /**
+     * Executes the `func` function after `wait` milliseconds. Additional arguments
+     * will be provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay execution.
+     * @param {...*} [arg] Arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.delay(function(text) { console.log(text); }, 1000, 'later');
+     * // => logs 'later' after one second
+     */
+    function delay(func, wait) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var args = slice(arguments, 2);
+      return setTimeout(function() { func.apply(undefined, args); }, wait);
+    }
+
+    /**
+     * Creates a function that memoizes the result of `func`. If `resolver` is
+     * provided it will be used to determine the cache key for storing the result
+     * based on the arguments provided to the memoized function. By default, the
+     * first argument provided to the memoized function is used as the cache key.
+     * The `func` is executed with the `this` binding of the memoized function.
+     * The result cache is exposed as the `cache` property on the memoized function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to have its output memoized.
+     * @param {Function} [resolver] A function used to resolve the cache key.
+     * @returns {Function} Returns the new memoizing function.
+     * @example
+     *
+     * var fibonacci = _.memoize(function(n) {
+     *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
+     * });
+     *
+     * fibonacci(9)
+     * // => 34
+     *
+     * var data = {
+     *   'fred': { 'name': 'fred', 'age': 40 },
+     *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // modifying the result cache
+     * var get = _.memoize(function(name) { return data[name]; }, _.identity);
+     * get('pebbles');
+     * // => { 'name': 'pebbles', 'age': 1 }
+     *
+     * get.cache.pebbles.name = 'penelope';
+     * get('pebbles');
+     * // => { 'name': 'penelope', 'age': 1 }
+     */
+    function memoize(func, resolver) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var memoized = function() {
+        var cache = memoized.cache,
+            key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];
+
+        return hasOwnProperty.call(cache, key)
+          ? cache[key]
+          : (cache[key] = func.apply(this, arguments));
+      }
+      memoized.cache = {};
+      return memoized;
+    }
+
+    /**
+     * Creates a function that is restricted to execute `func` once. Repeat calls to
+     * the function will return the value of the first call. The `func` is executed
+     * with the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var initialize = _.once(createApplication);
+     * initialize();
+     * initialize();
+     * // `initialize` executes `createApplication` once
+     */
+    function once(func) {
+      var ran,
+          result;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      return function() {
+        if (ran) {
+          return result;
+        }
+        ran = true;
+        result = func.apply(this, arguments);
+
+        // clear the `func` variable so the function may be garbage collected
+        func = null;
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that, when called, invokes `func` with any additional
+     * `partial` arguments prepended to those provided to the new function. This
+     * method is similar to `_.bind` except it does **not** alter the `this` binding.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var greet = function(greeting, name) { return greeting + ' ' + name; };
+     * var hi = _.partial(greet, 'hi');
+     * hi('fred');
+     * // => 'hi fred'
+     */
+    function partial(func) {
+      return createWrapper(func, 16, slice(arguments, 1));
+    }
+
+    /**
+     * This method is like `_.partial` except that `partial` arguments are
+     * appended to those provided to the new function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var defaultsDeep = _.partialRight(_.merge, _.defaults);
+     *
+     * var options = {
+     *   'variable': 'data',
+     *   'imports': { 'jq': $ }
+     * };
+     *
+     * defaultsDeep(options, _.templateSettings);
+     *
+     * options.variable
+     * // => 'data'
+     *
+     * options.imports
+     * // => { '_': _, 'jq': $ }
+     */
+    function partialRight(func) {
+      return createWrapper(func, 32, null, slice(arguments, 1));
+    }
+
+    /**
+     * Creates a function that, when executed, will only call the `func` function
+     * at most once per every `wait` milliseconds. Provide an options object to
+     * indicate that `func` should be invoked on the leading and/or trailing edge
+     * of the `wait` timeout. Subsequent calls to the throttled function will
+     * return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true` `func` will be called
+     * on the trailing edge of the timeout only if the the throttled function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to throttle.
+     * @param {number} wait The number of milliseconds to throttle executions to.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout.
+     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new throttled function.
+     * @example
+     *
+     * // avoid excessively updating the position while scrolling
+     * var throttled = _.throttle(updatePosition, 100);
+     * jQuery(window).on('scroll', throttled);
+     *
+     * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes
+     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+     *   'trailing': false
+     * }));
+     */
+    function throttle(func, wait, options) {
+      var leading = true,
+          trailing = true;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      if (options === false) {
+        leading = false;
+      } else if (isObject(options)) {
+        leading = 'leading' in options ? options.leading : leading;
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      debounceOptions.leading = leading;
+      debounceOptions.maxWait = wait;
+      debounceOptions.trailing = trailing;
+
+      return debounce(func, wait, debounceOptions);
+    }
+
+    /**
+     * Creates a function that provides `value` to the wrapper function as its
+     * first argument. Additional arguments provided to the function are appended
+     * to those provided to the wrapper function. The wrapper is executed with
+     * the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {*} value The value to wrap.
+     * @param {Function} wrapper The wrapper function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var p = _.wrap(_.escape, function(func, text) {
+     *   return '<p>' + func(text) + '</p>';
+     * });
+     *
+     * p('Fred, Wilma, & Pebbles');
+     * // => '<p>Fred, Wilma, &amp; Pebbles</p>'
+     */
+    function wrap(value, wrapper) {
+      return createWrapper(wrapper, 16, [value]);
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a function that returns `value`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} value The value to return from the new function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * var getter = _.constant(object);
+     * getter() === object;
+     * // => true
+     */
+    function constant(value) {
+      return function() {
+        return value;
+      };
+    }
+
+    /**
+     * Produces a callback bound to an optional `thisArg`. If `func` is a property
+     * name the created callback will return the property value for a given element.
+     * If `func` is an object the created callback will return `true` for elements
+     * that contain the equivalent object properties, otherwise it will return `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} [func=identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of the created callback.
+     * @param {number} [argCount] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // wrap to create custom callback shorthands
+     * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
+     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
+     *   return !match ? func(callback, thisArg) : function(object) {
+     *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
+     *   };
+     * });
+     *
+     * _.filter(characters, 'age__gt38');
+     * // => [{ 'name': 'fred', 'age': 40 }]
+     */
+    function createCallback(func, thisArg, argCount) {
+      var type = typeof func;
+      if (func == null || type == 'function') {
+        return baseCreateCallback(func, thisArg, argCount);
+      }
+      // handle "_.pluck" style callback shorthands
+      if (type != 'object') {
+        return property(func);
+      }
+      var props = keys(func),
+          key = props[0],
+          a = func[key];
+
+      // handle "_.where" style callback shorthands
+      if (props.length == 1 && a === a && !isObject(a)) {
+        // fast path the common case of providing an object with a single
+        // property containing a primitive value
+        return function(object) {
+          var b = object[key];
+          return a === b && (a !== 0 || (1 / a == 1 / b));
+        };
+      }
+      return function(object) {
+        var length = props.length,
+            result = false;
+
+        while (length--) {
+          if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) {
+            break;
+          }
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
+     * corresponding HTML entities.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} string The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escape('Fred, Wilma, & Pebbles');
+     * // => 'Fred, Wilma, &amp; Pebbles'
+     */
+    function escape(string) {
+      return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+    }
+
+    /**
+     * This method returns the first argument provided to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} value Any value.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * _.identity(object) === object;
+     * // => true
+     */
+    function identity(value) {
+      return value;
+    }
+
+    /**
+     * Adds function properties of a source object to the destination object.
+     * If `object` is a function methods will be added to its prototype as well.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Function|Object} [object=lodash] object The destination object.
+     * @param {Object} source The object of functions to add.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.chain=true] Specify whether the functions added are chainable.
+     * @example
+     *
+     * function capitalize(string) {
+     *   return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
+     * }
+     *
+     * _.mixin({ 'capitalize': capitalize });
+     * _.capitalize('fred');
+     * // => 'Fred'
+     *
+     * _('fred').capitalize().value();
+     * // => 'Fred'
+     *
+     * _.mixin({ 'capitalize': capitalize }, { 'chain': false });
+     * _('fred').capitalize();
+     * // => 'Fred'
+     */
+    function mixin(object, source, options) {
+      var chain = true,
+          methodNames = source && functions(source);
+
+      if (!source || (!options && !methodNames.length)) {
+        if (options == null) {
+          options = source;
+        }
+        ctor = lodashWrapper;
+        source = object;
+        object = lodash;
+        methodNames = functions(source);
+      }
+      if (options === false) {
+        chain = false;
+      } else if (isObject(options) && 'chain' in options) {
+        chain = options.chain;
+      }
+      var ctor = object,
+          isFunc = isFunction(ctor);
+
+      forEach(methodNames, function(methodName) {
+        var func = object[methodName] = source[methodName];
+        if (isFunc) {
+          ctor.prototype[methodName] = function() {
+            var chainAll = this.__chain__,
+                value = this.__wrapped__,
+                args = [value];
+
+            push.apply(args, arguments);
+            var result = func.apply(object, args);
+            if (chain || chainAll) {
+              if (value === result && isObject(result)) {
+                return this;
+              }
+              result = new ctor(result);
+              result.__chain__ = chainAll;
+            }
+            return result;
+          };
+        }
+      });
+    }
+
+    /**
+     * Reverts the '_' variable to its previous value and returns a reference to
+     * the `lodash` function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @returns {Function} Returns the `lodash` function.
+     * @example
+     *
+     * var lodash = _.noConflict();
+     */
+    function noConflict() {
+      context._ = oldDash;
+      return this;
+    }
+
+    /**
+     * A no-operation function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * _.noop(object) === undefined;
+     * // => true
+     */
+    function noop() {
+      // no operation performed
+    }
+
+    /**
+     * Gets the number of milliseconds that have elapsed since the Unix epoch
+     * (1 January 1970 00:00:00 UTC).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @example
+     *
+     * var stamp = _.now();
+     * _.defer(function() { console.log(_.now() - stamp); });
+     * // => logs the number of milliseconds it took for the deferred function to be called
+     */
+    var now = isNative(now = Date.now) && now || function() {
+      return new Date().getTime();
+    };
+
+    /**
+     * Converts the given value into an integer of the specified radix.
+     * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the
+     * `value` is a hexadecimal, in which case a `radix` of `16` is used.
+     *
+     * Note: This method avoids differences in native ES3 and ES5 `parseInt`
+     * implementations. See http://es5.github.io/#E.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} value The value to parse.
+     * @param {number} [radix] The radix used to interpret the value to parse.
+     * @returns {number} Returns the new integer value.
+     * @example
+     *
+     * _.parseInt('08');
+     * // => 8
+     */
+    var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
+      // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`
+      return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
+    };
+
+    /**
+     * Creates a "_.pluck" style function, which returns the `key` value of a
+     * given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} key The name of the property to retrieve.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'fred',   'age': 40 },
+     *   { 'name': 'barney', 'age': 36 }
+     * ];
+     *
+     * var getName = _.property('name');
+     *
+     * _.map(characters, getName);
+     * // => ['barney', 'fred']
+     *
+     * _.sortBy(characters, getName);
+     * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred',   'age': 40 }]
+     */
+    function property(key) {
+      return function(object) {
+        return object[key];
+      };
+    }
+
+    /**
+     * Produces a random number between `min` and `max` (inclusive). If only one
+     * argument is provided a number between `0` and the given number will be
+     * returned. If `floating` is truey or either `min` or `max` are floats a
+     * floating-point number will be returned instead of an integer.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {number} [min=0] The minimum possible value.
+     * @param {number} [max=1] The maximum possible value.
+     * @param {boolean} [floating=false] Specify returning a floating-point number.
+     * @returns {number} Returns a random number.
+     * @example
+     *
+     * _.random(0, 5);
+     * // => an integer between 0 and 5
+     *
+     * _.random(5);
+     * // => also an integer between 0 and 5
+     *
+     * _.random(5, true);
+     * // => a floating-point number between 0 and 5
+     *
+     * _.random(1.2, 5.2);
+     * // => a floating-point number between 1.2 and 5.2
+     */
+    function random(min, max, floating) {
+      var noMin = min == null,
+          noMax = max == null;
+
+      if (floating == null) {
+        if (typeof min == 'boolean' && noMax) {
+          floating = min;
+          min = 1;
+        }
+        else if (!noMax && typeof max == 'boolean') {
+          floating = max;
+          noMax = true;
+        }
+      }
+      if (noMin && noMax) {
+        max = 1;
+      }
+      min = +min || 0;
+      if (noMax) {
+        max = min;
+        min = 0;
+      } else {
+        max = +max || 0;
+      }
+      if (floating || min % 1 || max % 1) {
+        var rand = nativeRandom();
+        return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max);
+      }
+      return baseRandom(min, max);
+    }
+
+    /**
+     * Resolves the value of property `key` on `object`. If `key` is a function
+     * it will be invoked with the `this` binding of `object` and its result returned,
+     * else the property value is returned. If `object` is falsey then `undefined`
+     * is returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Object} object The object to inspect.
+     * @param {string} key The name of the property to resolve.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = {
+     *   'cheese': 'crumpets',
+     *   'stuff': function() {
+     *     return 'nonsense';
+     *   }
+     * };
+     *
+     * _.result(object, 'cheese');
+     * // => 'crumpets'
+     *
+     * _.result(object, 'stuff');
+     * // => 'nonsense'
+     */
+    function result(object, key) {
+      if (object) {
+        var value = object[key];
+        return isFunction(value) ? object[key]() : value;
+      }
+    }
+
+    /**
+     * A micro-templating method that handles arbitrary delimiters, preserves
+     * whitespace, and correctly escapes quotes within interpolated code.
+     *
+     * Note: In the development build, `_.template` utilizes sourceURLs for easier
+     * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+     *
+     * For more information on precompiling templates see:
+     * http://lodash.com/custom-builds
+     *
+     * For more information on Chrome extension sandboxes see:
+     * http://developer.chrome.com/stable/extensions/sandboxingEval.html
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} text The template text.
+     * @param {Object} data The data object used to populate the text.
+     * @param {Object} [options] The options object.
+     * @param {RegExp} [options.escape] The "escape" delimiter.
+     * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
+     * @param {Object} [options.imports] An object to import into the template as local variables.
+     * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
+     * @param {string} [sourceURL] The sourceURL of the template's compiled source.
+     * @param {string} [variable] The data object variable name.
+     * @returns {Function|string} Returns a compiled function when no `data` object
+     *  is given, else it returns the interpolated text.
+     * @example
+     *
+     * // using the "interpolate" delimiter to create a compiled template
+     * var compiled = _.template('hello <%= name %>');
+     * compiled({ 'name': 'fred' });
+     * // => 'hello fred'
+     *
+     * // using the "escape" delimiter to escape HTML in data property values
+     * _.template('<b><%- value %></b>', { 'value': '<script>' });
+     * // => '<b>&lt;script&gt;</b>'
+     *
+     * // using the "evaluate" delimiter to generate HTML
+     * var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';
+     * _.template(list, { 'people': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+     * _.template('hello ${ name }', { 'name': 'pebbles' });
+     * // => 'hello pebbles'
+     *
+     * // using the internal `print` function in "evaluate" delimiters
+     * _.template('<% print("hello " + name); %>!', { 'name': 'barney' });
+     * // => 'hello barney!'
+     *
+     * // using a custom template delimiters
+     * _.templateSettings = {
+     *   'interpolate': /{{([\s\S]+?)}}/g
+     * };
+     *
+     * _.template('hello {{ name }}!', { 'name': 'mustache' });
+     * // => 'hello mustache!'
+     *
+     * // using the `imports` option to import jQuery
+     * var list = '<% jq.each(people, function(name) { %><li><%- name %></li><% }); %>';
+     * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the `sourceURL` option to specify a custom sourceURL for the template
+     * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
+     * compiled(data);
+     * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+     *
+     * // using the `variable` option to ensure a with-statement isn't used in the compiled template
+     * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });
+     * compiled.source;
+     * // => function(data) {
+     *   var __t, __p = '', __e = _.escape;
+     *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
+     *   return __p;
+     * }
+     *
+     * // using the `source` property to inline compiled templates for meaningful
+     * // line numbers in error messages and a stack trace
+     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+     *   var JST = {\
+     *     "main": ' + _.template(mainText).source + '\
+     *   };\
+     * ');
+     */
+    function template(text, data, options) {
+      // based on John Resig's `tmpl` implementation
+      // http://ejohn.org/blog/javascript-micro-templating/
+      // and Laura Doktorova's doT.js
+      // https://github.com/olado/doT
+      var settings = lodash.templateSettings;
+      text = String(text || '');
+
+      // avoid missing dependencies when `iteratorTemplate` is not defined
+      options = defaults({}, options, settings);
+
+      var imports = defaults({}, options.imports, settings.imports),
+          importsKeys = keys(imports),
+          importsValues = values(imports);
+
+      var isEvaluating,
+          index = 0,
+          interpolate = options.interpolate || reNoMatch,
+          source = "__p += '";
+
+      // compile the regexp to match each delimiter
+      var reDelimiters = RegExp(
+        (options.escape || reNoMatch).source + '|' +
+        interpolate.source + '|' +
+        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
+        (options.evaluate || reNoMatch).source + '|$'
+      , 'g');
+
+      text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
+        interpolateValue || (interpolateValue = esTemplateValue);
+
+        // escape characters that cannot be included in string literals
+        source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+
+        // replace delimiters with snippets
+        if (escapeValue) {
+          source += "' +\n__e(" + escapeValue + ") +\n'";
+        }
+        if (evaluateValue) {
+          isEvaluating = true;
+          source += "';\n" + evaluateValue + ";\n__p += '";
+        }
+        if (interpolateValue) {
+          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+        }
+        index = offset + match.length;
+
+        // the JS engine embedded in Adobe products requires returning the `match`
+        // string in order to produce the correct `offset` value
+        return match;
+      });
+
+      source += "';\n";
+
+      // if `variable` is not specified, wrap a with-statement around the generated
+      // code to add the data object to the top of the scope chain
+      var variable = options.variable,
+          hasVariable = variable;
+
+      if (!hasVariable) {
+        variable = 'obj';
+        source = 'with (' + variable + ') {\n' + source + '\n}\n';
+      }
+      // cleanup code by stripping empty strings
+      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
+        .replace(reEmptyStringMiddle, '$1')
+        .replace(reEmptyStringTrailing, '$1;');
+
+      // frame code as the function body
+      source = 'function(' + variable + ') {\n' +
+        (hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') +
+        "var __t, __p = '', __e = _.escape" +
+        (isEvaluating
+          ? ', __j = Array.prototype.join;\n' +
+            "function print() { __p += __j.call(arguments, '') }\n"
+          : ';\n'
+        ) +
+        source +
+        'return __p\n}';
+
+      // Use a sourceURL for easier debugging.
+      // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+      var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
+
+      try {
+        var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues);
+      } catch(e) {
+        e.source = source;
+        throw e;
+      }
+      if (data) {
+        return result(data);
+      }
+      // provide the compiled function's source by its `toString` method, in
+      // supported environments, or the `source` property as a convenience for
+      // inlining compiled templates during the build process
+      result.source = source;
+      return result;
+    }
+
+    /**
+     * Executes the callback `n` times, returning an array of the results
+     * of each callback execution. The callback is bound to `thisArg` and invoked
+     * with one argument; (index).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {number} n The number of times to execute the callback.
+     * @param {Function} callback The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns an array of the results of each `callback` execution.
+     * @example
+     *
+     * var diceRolls = _.times(3, _.partial(_.random, 1, 6));
+     * // => [3, 6, 4]
+     *
+     * _.times(3, function(n) { mage.castSpell(n); });
+     * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+     *
+     * _.times(3, function(n) { this.cast(n); }, mage);
+     * // => also calls `mage.castSpell(n)` three times
+     */
+    function times(n, callback, thisArg) {
+      n = (n = +n) > -1 ? n : 0;
+      var index = -1,
+          result = Array(n);
+
+      callback = baseCreateCallback(callback, thisArg, 1);
+      while (++index < n) {
+        result[index] = callback(index);
+      }
+      return result;
+    }
+
+    /**
+     * The inverse of `_.escape` this method converts the HTML entities
+     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
+     * corresponding characters.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} string The string to unescape.
+     * @returns {string} Returns the unescaped string.
+     * @example
+     *
+     * _.unescape('Fred, Barney &amp; Pebbles');
+     * // => 'Fred, Barney & Pebbles'
+     */
+    function unescape(string) {
+      return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
+    }
+
+    /**
+     * Generates a unique ID. If `prefix` is provided the ID will be appended to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} [prefix] The value to prefix the ID with.
+     * @returns {string} Returns the unique ID.
+     * @example
+     *
+     * _.uniqueId('contact_');
+     * // => 'contact_104'
+     *
+     * _.uniqueId();
+     * // => '105'
+     */
+    function uniqueId(prefix) {
+      var id = ++idCounter;
+      return String(prefix == null ? '' : prefix) + id;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object that wraps the given value with explicit
+     * method chaining enabled.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {*} value The value to wrap.
+     * @returns {Object} Returns the wrapper object.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36 },
+     *   { 'name': 'fred',    'age': 40 },
+     *   { 'name': 'pebbles', 'age': 1 }
+     * ];
+     *
+     * var youngest = _.chain(characters)
+     *     .sortBy('age')
+     *     .map(function(chr) { return chr.name + ' is ' + chr.age; })
+     *     .first()
+     *     .value();
+     * // => 'pebbles is 1'
+     */
+    function chain(value) {
+      value = new lodashWrapper(value);
+      value.__chain__ = true;
+      return value;
+    }
+
+    /**
+     * Invokes `interceptor` with the `value` as the first argument and then
+     * returns `value`. The purpose of this method is to "tap into" a method
+     * chain in order to perform operations on intermediate results within
+     * the chain.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * _([1, 2, 3, 4])
+     *  .tap(function(array) { array.pop(); })
+     *  .reverse()
+     *  .value();
+     * // => [3, 2, 1]
+     */
+    function tap(value, interceptor) {
+      interceptor(value);
+      return value;
+    }
+
+    /**
+     * Enables explicit method chaining on the wrapper object.
+     *
+     * @name chain
+     * @memberOf _
+     * @category Chaining
+     * @returns {*} Returns the wrapper object.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // without explicit chaining
+     * _(characters).first();
+     * // => { 'name': 'barney', 'age': 36 }
+     *
+     * // with explicit chaining
+     * _(characters).chain()
+     *   .first()
+     *   .pick('age')
+     *   .value();
+     * // => { 'age': 36 }
+     */
+    function wrapperChain() {
+      this.__chain__ = true;
+      return this;
+    }
+
+    /**
+     * Produces the `toString` result of the wrapped value.
+     *
+     * @name toString
+     * @memberOf _
+     * @category Chaining
+     * @returns {string} Returns the string result.
+     * @example
+     *
+     * _([1, 2, 3]).toString();
+     * // => '1,2,3'
+     */
+    function wrapperToString() {
+      return String(this.__wrapped__);
+    }
+
+    /**
+     * Extracts the wrapped value.
+     *
+     * @name valueOf
+     * @memberOf _
+     * @alias value
+     * @category Chaining
+     * @returns {*} Returns the wrapped value.
+     * @example
+     *
+     * _([1, 2, 3]).valueOf();
+     * // => [1, 2, 3]
+     */
+    function wrapperValueOf() {
+      return this.__wrapped__;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions that return wrapped values when chaining
+    lodash.after = after;
+    lodash.assign = assign;
+    lodash.at = at;
+    lodash.bind = bind;
+    lodash.bindAll = bindAll;
+    lodash.bindKey = bindKey;
+    lodash.chain = chain;
+    lodash.compact = compact;
+    lodash.compose = compose;
+    lodash.constant = constant;
+    lodash.countBy = countBy;
+    lodash.create = create;
+    lodash.createCallback = createCallback;
+    lodash.curry = curry;
+    lodash.debounce = debounce;
+    lodash.defaults = defaults;
+    lodash.defer = defer;
+    lodash.delay = delay;
+    lodash.difference = difference;
+    lodash.filter = filter;
+    lodash.flatten = flatten;
+    lodash.forEach = forEach;
+    lodash.forEachRight = forEachRight;
+    lodash.forIn = forIn;
+    lodash.forInRight = forInRight;
+    lodash.forOwn = forOwn;
+    lodash.forOwnRight = forOwnRight;
+    lodash.functions = functions;
+    lodash.groupBy = groupBy;
+    lodash.indexBy = indexBy;
+    lodash.initial = initial;
+    lodash.intersection = intersection;
+    lodash.invert = invert;
+    lodash.invoke = invoke;
+    lodash.keys = keys;
+    lodash.map = map;
+    lodash.mapValues = mapValues;
+    lodash.max = max;
+    lodash.memoize = memoize;
+    lodash.merge = merge;
+    lodash.min = min;
+    lodash.omit = omit;
+    lodash.once = once;
+    lodash.pairs = pairs;
+    lodash.partial = partial;
+    lodash.partialRight = partialRight;
+    lodash.pick = pick;
+    lodash.pluck = pluck;
+    lodash.property = property;
+    lodash.pull = pull;
+    lodash.range = range;
+    lodash.reject = reject;
+    lodash.remove = remove;
+    lodash.rest = rest;
+    lodash.shuffle = shuffle;
+    lodash.sortBy = sortBy;
+    lodash.tap = tap;
+    lodash.throttle = throttle;
+    lodash.times = times;
+    lodash.toArray = toArray;
+    lodash.transform = transform;
+    lodash.union = union;
+    lodash.uniq = uniq;
+    lodash.values = values;
+    lodash.where = where;
+    lodash.without = without;
+    lodash.wrap = wrap;
+    lodash.xor = xor;
+    lodash.zip = zip;
+    lodash.zipObject = zipObject;
+
+    // add aliases
+    lodash.collect = map;
+    lodash.drop = rest;
+    lodash.each = forEach;
+    lodash.eachRight = forEachRight;
+    lodash.extend = assign;
+    lodash.methods = functions;
+    lodash.object = zipObject;
+    lodash.select = filter;
+    lodash.tail = rest;
+    lodash.unique = uniq;
+    lodash.unzip = zip;
+
+    // add functions to `lodash.prototype`
+    mixin(lodash);
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions that return unwrapped values when chaining
+    lodash.clone = clone;
+    lodash.cloneDeep = cloneDeep;
+    lodash.contains = contains;
+    lodash.escape = escape;
+    lodash.every = every;
+    lodash.find = find;
+    lodash.findIndex = findIndex;
+    lodash.findKey = findKey;
+    lodash.findLast = findLast;
+    lodash.findLastIndex = findLastIndex;
+    lodash.findLastKey = findLastKey;
+    lodash.has = has;
+    lodash.identity = identity;
+    lodash.indexOf = indexOf;
+    lodash.isArguments = isArguments;
+    lodash.isArray = isArray;
+    lodash.isBoolean = isBoolean;
+    lodash.isDate = isDate;
+    lodash.isElement = isElement;
+    lodash.isEmpty = isEmpty;
+    lodash.isEqual = isEqual;
+    lodash.isFinite = isFinite;
+    lodash.isFunction = isFunction;
+    lodash.isNaN = isNaN;
+    lodash.isNull = isNull;
+    lodash.isNumber = isNumber;
+    lodash.isObject = isObject;
+    lodash.isPlainObject = isPlainObject;
+    lodash.isRegExp = isRegExp;
+    lodash.isString = isString;
+    lodash.isUndefined = isUndefined;
+    lodash.lastIndexOf = lastIndexOf;
+    lodash.mixin = mixin;
+    lodash.noConflict = noConflict;
+    lodash.noop = noop;
+    lodash.now = now;
+    lodash.parseInt = parseInt;
+    lodash.random = random;
+    lodash.reduce = reduce;
+    lodash.reduceRight = reduceRight;
+    lodash.result = result;
+    lodash.runInContext = runInContext;
+    lodash.size = size;
+    lodash.some = some;
+    lodash.sortedIndex = sortedIndex;
+    lodash.template = template;
+    lodash.unescape = unescape;
+    lodash.uniqueId = uniqueId;
+
+    // add aliases
+    lodash.all = every;
+    lodash.any = some;
+    lodash.detect = find;
+    lodash.findWhere = find;
+    lodash.foldl = reduce;
+    lodash.foldr = reduceRight;
+    lodash.include = contains;
+    lodash.inject = reduce;
+
+    mixin(function() {
+      var source = {}
+      forOwn(lodash, function(func, methodName) {
+        if (!lodash.prototype[methodName]) {
+          source[methodName] = func;
+        }
+      });
+      return source;
+    }(), false);
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions capable of returning wrapped and unwrapped values when chaining
+    lodash.first = first;
+    lodash.last = last;
+    lodash.sample = sample;
+
+    // add aliases
+    lodash.take = first;
+    lodash.head = first;
+
+    forOwn(lodash, function(func, methodName) {
+      var callbackable = methodName !== 'sample';
+      if (!lodash.prototype[methodName]) {
+        lodash.prototype[methodName]= function(n, guard) {
+          var chainAll = this.__chain__,
+              result = func(this.__wrapped__, n, guard);
+
+          return !chainAll && (n == null || (guard && !(callbackable && typeof n == 'function')))
+            ? result
+            : new lodashWrapper(result, chainAll);
+        };
+      }
+    });
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The semantic version number.
+     *
+     * @static
+     * @memberOf _
+     * @type string
+     */
+    lodash.VERSION = '2.4.1';
+
+    // add "Chaining" functions to the wrapper
+    lodash.prototype.chain = wrapperChain;
+    lodash.prototype.toString = wrapperToString;
+    lodash.prototype.value = wrapperValueOf;
+    lodash.prototype.valueOf = wrapperValueOf;
+
+    // add `Array` functions that return unwrapped values
+    forEach(['join', 'pop', 'shift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        var chainAll = this.__chain__,
+            result = func.apply(this.__wrapped__, arguments);
+
+        return chainAll
+          ? new lodashWrapper(result, chainAll)
+          : result;
+      };
+    });
+
+    // add `Array` functions that return the existing wrapped value
+    forEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        func.apply(this.__wrapped__, arguments);
+        return this;
+      };
+    });
+
+    // add `Array` functions that return new wrapped values
+    forEach(['concat', 'slice', 'splice'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__);
+      };
+    });
+
+    return lodash;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  // expose Lo-Dash
+  var _ = runInContext();
+
+  // some AMD build optimizers like r.js check for condition patterns like the following:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lo-Dash to the global object even when an AMD loader is present in
+    // case Lo-Dash is loaded with a RequireJS shim config.
+    // See http://requirejs.org/docs/api.html#config-shim
+    root._ = _;
+
+    // define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module
+    define(function() {
+      return _;
+    });
+  }
+  // check for `exports` after `define` in case a build optimizer adds an `exports` object
+  else if (freeExports && freeModule) {
+    // in Node.js or RingoJS
+    if (moduleExports) {
+      (freeModule.exports = _)._ = _;
+    }
+    // in Narwhal or Rhino -require
+    else {
+      freeExports._ = _;
+    }
+  }
+  else {
+    // in a browser or Rhino
+    root._ = _;
+  }
+}.call(this));
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.min.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.min.js
new file mode 100755 (executable)
index 0000000..85a9626
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
+ * Build: `lodash modern -o ./dist/lodash.js`
+ */
+;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:m+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=true;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:m+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=true
+}}function r(n){return n.charCodeAt(0)}function u(n,t){for(var e=n.m,r=t.m,u=-1,o=e.length;++u<o;){var i=e[u],a=r[u];if(i!==a){if(i>a||typeof i=="undefined")return 1;if(i<a||typeof a=="undefined")return-1}}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[r/2|0],i=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&i&&typeof i=="object")return false;for(u=f(),u["false"]=u["null"]=u["true"]=u.undefined=false,o=f(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function i(n){return"\\"+U[n]
+}function a(){return h.pop()||[]}function f(){return g.pop()||{k:null,l:null,m:null,"false":false,n:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,o:null}}function l(n){n.length=0,h.length<_&&h.push(n)}function c(n){var t=n.l;t&&c(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,g.length<_&&g.push(n)}function p(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function s(e){function h(n,t,e){if(!n||!V[typeof n])return n;
+t=t&&typeof e=="undefined"?t:tt(t,e,3);for(var r=-1,u=V[typeof n]&&Fe(n),o=u?u.length:0;++r<o&&(e=u[r],false!==t(n[e],e,n)););return n}function g(n,t,e){var r;if(!n||!V[typeof n])return n;t=t&&typeof e=="undefined"?t:tt(t,e,3);for(r in n)if(false===t(n[r],r,n))break;return n}function _(n,t,e){var r,u=n,o=u;if(!u)return o;for(var i=arguments,a=0,f=typeof e=="number"?2:i.length;++a<f;)if((u=i[a])&&V[typeof u])for(var l=-1,c=V[typeof u]&&Fe(u),p=c?c.length:0;++l<p;)r=c[l],"undefined"==typeof o[r]&&(o[r]=u[r]);
+return o}function U(n,t,e){var r,u=n,o=u;if(!u)return o;var i=arguments,a=0,f=typeof e=="number"?2:i.length;if(3<f&&"function"==typeof i[f-2])var l=tt(i[--f-1],i[f--],2);else 2<f&&"function"==typeof i[f-1]&&(l=i[--f]);for(;++a<f;)if((u=i[a])&&V[typeof u])for(var c=-1,p=V[typeof u]&&Fe(u),s=p?p.length:0;++c<s;)r=p[c],o[r]=l?l(o[r],u[r]):u[r];return o}function H(n){var t,e=[];if(!n||!V[typeof n])return e;for(t in n)me.call(n,t)&&e.push(t);return e}function J(n){return n&&typeof n=="object"&&!Te(n)&&me.call(n,"__wrapped__")?n:new Q(n)
+}function Q(n,t){this.__chain__=!!t,this.__wrapped__=n}function X(n){function t(){if(r){var n=p(r);be.apply(n,arguments)}if(this instanceof t){var o=nt(e.prototype),n=e.apply(o,n||arguments);return wt(n)?n:o}return e.apply(u,n||arguments)}var e=n[0],r=n[2],u=n[4];return $e(t,n),t}function Z(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!wt(n))return n;var i=ce.call(n);if(!K[i])return n;var f=Ae[i];switch(i){case T:case F:return new f(+n);case W:case P:return new f(n);case z:return o=f(n.source,C.exec(n)),o.lastIndex=n.lastIndex,o
+}if(i=Te(n),t){var c=!r;r||(r=a()),u||(u=a());for(var s=r.length;s--;)if(r[s]==n)return u[s];o=i?f(n.length):{}}else o=i?p(n):U({},n);return i&&(me.call(n,"index")&&(o.index=n.index),me.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(i?St:h)(n,function(n,i){o[i]=Z(n,t,e,r,u)}),c&&(l(r),l(u)),o):o}function nt(n){return wt(n)?ke(n):{}}function tt(n,t,e){if(typeof n!="function")return Ut;if(typeof t=="undefined"||!("prototype"in n))return n;var r=n.__bindData__;if(typeof r=="undefined"&&(De.funcNames&&(r=!n.name),r=r||!De.funcDecomp,!r)){var u=ge.call(n);
+De.funcNames||(r=!O.test(u)),r||(r=E.test(u),$e(n,r))}if(false===r||true!==r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)}}return Mt(n,t)}function et(n){function t(){var n=f?i:this;if(u){var h=p(u);be.apply(h,arguments)}return(o||c)&&(h||(h=p(arguments)),o&&be.apply(h,o),c&&h.length<a)?(r|=16,et([e,s?r:-4&r,h,null,i,a])):(h||(h=arguments),l&&(e=n[v]),this instanceof t?(n=nt(e.prototype),h=e.apply(n,h),wt(h)?h:n):e.apply(n,h))
+}var e=n[0],r=n[1],u=n[2],o=n[3],i=n[4],a=n[5],f=1&r,l=2&r,c=4&r,s=8&r,v=e;return $e(t,n),t}function rt(e,r){var u=-1,i=st(),a=e?e.length:0,f=a>=b&&i===n,l=[];if(f){var p=o(r);p?(i=t,r=p):f=false}for(;++u<a;)p=e[u],0>i(r,p)&&l.push(p);return f&&c(r),l}function ut(n,t,e,r){r=(r||0)-1;for(var u=n?n.length:0,o=[];++r<u;){var i=n[r];if(i&&typeof i=="object"&&typeof i.length=="number"&&(Te(i)||yt(i))){t||(i=ut(i,t,e));var a=-1,f=i.length,l=o.length;for(o.length+=f;++a<f;)o[l++]=i[a]}else e||o.push(i)}return o
+}function ot(n,t,e,r,u,o){if(e){var i=e(n,t);if(typeof i!="undefined")return!!i}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&V[typeof n]||t&&V[typeof t]))return false;if(null==n||null==t)return n===t;var f=ce.call(n),c=ce.call(t);if(f==D&&(f=q),c==D&&(c=q),f!=c)return false;switch(f){case T:case F:return+n==+t;case W:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case z:case P:return n==oe(t)}if(c=f==$,!c){var p=me.call(n,"__wrapped__"),s=me.call(t,"__wrapped__");if(p||s)return ot(p?n.__wrapped__:n,s?t.__wrapped__:t,e,r,u,o);
+if(f!=q)return false;if(f=n.constructor,p=t.constructor,f!=p&&!(dt(f)&&f instanceof f&&dt(p)&&p instanceof p)&&"constructor"in n&&"constructor"in t)return false}for(f=!u,u||(u=a()),o||(o=a()),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,i=true;if(u.push(n),o.push(t),c){if(p=n.length,v=t.length,(i=v==p)||r)for(;v--;)if(c=p,s=t[v],r)for(;c--&&!(i=ot(n[c],s,e,r,u,o)););else if(!(i=ot(n[v],s,e,r,u,o)))break}else g(t,function(t,a,f){return me.call(f,a)?(v++,i=me.call(n,a)&&ot(n[a],t,e,r,u,o)):void 0}),i&&!r&&g(n,function(n,t,e){return me.call(e,t)?i=-1<--v:void 0
+});return u.pop(),o.pop(),f&&(l(u),l(o)),i}function it(n,t,e,r,u){(Te(t)?St:h)(t,function(t,o){var i,a,f=t,l=n[o];if(t&&((a=Te(t))||Pe(t))){for(f=r.length;f--;)if(i=r[f]==t){l=u[f];break}if(!i){var c;e&&(f=e(l,t),c=typeof f!="undefined")&&(l=f),c||(l=a?Te(l)?l:[]:Pe(l)?l:{}),r.push(t),u.push(l),c||it(l,t,e,r,u)}}else e&&(f=e(l,t),typeof f=="undefined"&&(f=t)),typeof f!="undefined"&&(l=f);n[o]=l})}function at(n,t){return n+he(Re()*(t-n+1))}function ft(e,r,u){var i=-1,f=st(),p=e?e.length:0,s=[],v=!r&&p>=b&&f===n,h=u||v?a():s;
+for(v&&(h=o(h),f=t);++i<p;){var g=e[i],y=u?u(g,i,e):g;(r?!i||h[h.length-1]!==y:0>f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function lt(n){return function(t,e,r){var u={};e=J.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r<o;){var i=t[r];n(u,i,e(i,r,t),t)}else h(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function ct(n,t,e,r,u,o){var i=1&t,a=4&t,f=16&t,l=32&t;if(!(2&t||dt(n)))throw new ie;f&&!e.length&&(t&=-17,f=e=false),l&&!r.length&&(t&=-33,l=r=false);
+var c=n&&n.__bindData__;return c&&true!==c?(c=p(c),c[2]&&(c[2]=p(c[2])),c[3]&&(c[3]=p(c[3])),!i||1&c[1]||(c[4]=u),!i&&1&c[1]&&(t|=8),!a||4&c[1]||(c[5]=o),f&&be.apply(c[2]||(c[2]=[]),e),l&&we.apply(c[3]||(c[3]=[]),r),c[1]|=t,ct.apply(null,c)):(1==t||17===t?X:et)([n,t,e,r,u,o])}function pt(n){return Be[n]}function st(){var t=(t=J.indexOf)===Wt?n:t;return t}function vt(n){return typeof n=="function"&&pe.test(n)}function ht(n){var t,e;return n&&ce.call(n)==q&&(t=n.constructor,!dt(t)||t instanceof t)?(g(n,function(n,t){e=t
+}),typeof e=="undefined"||me.call(n,e)):false}function gt(n){return We[n]}function yt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ce.call(n)==D||false}function mt(n,t,e){var r=Fe(n),u=r.length;for(t=tt(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function bt(n){var t=[];return g(n,function(n,e){dt(n)&&t.push(e)}),t.sort()}function _t(n){for(var t=-1,e=Fe(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function dt(n){return typeof n=="function"}function wt(n){return!(!n||!V[typeof n])
+}function jt(n){return typeof n=="number"||n&&typeof n=="object"&&ce.call(n)==W||false}function kt(n){return typeof n=="string"||n&&typeof n=="object"&&ce.call(n)==P||false}function xt(n){for(var t=-1,e=Fe(n),r=e.length,u=Xt(r);++t<r;)u[t]=n[e[t]];return u}function Ct(n,t,e){var r=-1,u=st(),o=n?n.length:0,i=false;return e=(0>e?Ie(0,o+e):e)||0,Te(n)?i=-1<u(n,t,e):typeof o=="number"?i=-1<(kt(n)?n.indexOf(t,e):u(n,t,e)):h(n,function(n){return++r<e?void 0:!(i=n===t)}),i}function Ot(n,t,e){var r=true;t=J.createCallback(t,e,3),e=-1;
+var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&(r=!!t(n[e],e,n)););else h(n,function(n,e,u){return r=!!t(n,e,u)});return r}function Nt(n,t,e){var r=[];t=J.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}else h(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function It(n,t,e){t=J.createCallback(t,e,3),e=-1;var r=n?n.length:0;if(typeof r!="number"){var u;return h(n,function(n,e,r){return t(n,e,r)?(u=n,false):void 0}),u}for(;++e<r;){var o=n[e];
+if(t(o,e,n))return o}}function St(n,t,e){var r=-1,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),typeof u=="number")for(;++r<u&&false!==t(n[r],r,n););else h(n,t);return n}function Et(n,t,e){var r=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),typeof r=="number")for(;r--&&false!==t(n[r],r,n););else{var u=Fe(n),r=u.length;h(n,function(n,e,o){return e=u?u[--r]:--r,t(o[e],e,o)})}return n}function Rt(n,t,e){var r=-1,u=n?n.length:0;if(t=J.createCallback(t,e,3),typeof u=="number")for(var o=Xt(u);++r<u;)o[r]=t(n[r],r,n);
+else o=[],h(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function At(n,t,e){var u=-1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&Te(n)){e=-1;for(var i=n.length;++e<i;){var a=n[e];a>o&&(o=a)}}else t=null==t&&kt(n)?r:J.createCallback(t,e,3),St(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Dt(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=J.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n);else h(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)
+});return e}function $t(n,t,e,r){var u=3>arguments.length;return t=J.createCallback(t,r,4),Et(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function Tt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=at(0,++t);r[t]=r[e],r[e]=n}),r}function Ft(n,t,e){var r;t=J.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e<u&&!(r=t(n[e],e,n)););else h(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function Bt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;
+for(t=J.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[0]:v;return p(n,0,Se(Ie(0,r),u))}function Wt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Ie(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1;return n(t,e,r)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=J.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Ie(0,t);return p(n,r)}function zt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?J.createCallback(e,r,1):Ut,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;
+return u}function Pt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(e=J.createCallback(e,r,3)),ft(n,t,e)}function Kt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?At(Ve(n,"length")):0,r=Xt(0>e?0:e);++t<e;)r[t]=Ve(n,t);return r}function Lt(n,t){var e=-1,r=n?n.length:0,u={};for(t||!r||Te(n[0])||(t=[]);++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Mt(n,t){return 2<arguments.length?ct(n,17,p(arguments,2),null,t):ct(n,1,null,null,t)
+}function Vt(n,t,e){function r(){c&&ve(c),i=c=p=v,(g||h!==t)&&(s=Ue(),a=n.apply(l,o),c||i||(o=l=null))}function u(){var e=t-(Ue()-f);0<e?c=_e(u,e):(i&&ve(i),e=p,i=c=p=v,e&&(s=Ue(),a=n.apply(l,o),c||i||(o=l=null)))}var o,i,a,f,l,c,p,s=0,h=false,g=true;if(!dt(n))throw new ie;if(t=Ie(0,t)||0,true===e)var y=true,g=false;else wt(e)&&(y=e.leading,h="maxWait"in e&&(Ie(t,e.maxWait)||0),g="trailing"in e?e.trailing:g);return function(){if(o=arguments,f=Ue(),l=this,p=g&&(c||!y),false===h)var e=y&&!c;else{i||y||(s=f);var v=h-(f-s),m=0>=v;
+m?(i&&(i=ve(i)),s=f,a=n.apply(l,o)):i||(i=_e(r,v))}return m&&c?c=ve(c):c||t===h||(c=_e(u,t)),e&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Ut(n){return n}function Gt(n,t,e){var r=true,u=t&&bt(t);t&&(e||u.length)||(null==e&&(e=t),o=Q,t=n,n=J,u=bt(t)),false===e?r=false:wt(e)&&"chain"in e&&(r=e.chain);var o=n,i=dt(o);St(u,function(e){var u=n[e]=t[e];i&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,i=[e];if(be.apply(i,arguments),i=u.apply(n,i),r||t){if(e===i&&wt(i))return this;
+i=new o(i),i.__chain__=t}return i})})}function Ht(){}function Jt(n){return function(t){return t[n]}}function Qt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,A)):G;var Xt=e.Array,Yt=e.Boolean,Zt=e.Date,ne=e.Function,te=e.Math,ee=e.Number,re=e.Object,ue=e.RegExp,oe=e.String,ie=e.TypeError,ae=[],fe=re.prototype,le=e._,ce=fe.toString,pe=ue("^"+oe(ce).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),se=te.ceil,ve=e.clearTimeout,he=te.floor,ge=ne.prototype.toString,ye=vt(ye=re.getPrototypeOf)&&ye,me=fe.hasOwnProperty,be=ae.push,_e=e.setTimeout,de=ae.splice,we=ae.unshift,je=function(){try{var n={},t=vt(t=re.defineProperty)&&t,e=t(n,n,n)&&t
+}catch(r){}return e}(),ke=vt(ke=re.create)&&ke,xe=vt(xe=Xt.isArray)&&xe,Ce=e.isFinite,Oe=e.isNaN,Ne=vt(Ne=re.keys)&&Ne,Ie=te.max,Se=te.min,Ee=e.parseInt,Re=te.random,Ae={};Ae[$]=Xt,Ae[T]=Yt,Ae[F]=Zt,Ae[B]=ne,Ae[q]=re,Ae[W]=ee,Ae[z]=ue,Ae[P]=oe,Q.prototype=J.prototype;var De=J.support={};De.funcDecomp=!vt(e.a)&&E.test(s),De.funcNames=typeof ne.name=="string",J.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:J}},ke||(nt=function(){function n(){}return function(t){if(wt(t)){n.prototype=t;
+var r=new n;n.prototype=null}return r||e.Object()}}());var $e=je?function(n,t){M.value=t,je(n,"__bindData__",M)}:Ht,Te=xe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ce.call(n)==$||false},Fe=Ne?function(n){return wt(n)?Ne(n):[]}:H,Be={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},We=_t(Be),qe=ue("("+Fe(We).join("|")+")","g"),ze=ue("["+Fe(Be).join("")+"]","g"),Pe=ye?function(n){if(!n||ce.call(n)!=q)return false;var t=n.valueOf,e=vt(t)&&(e=ye(t))&&ye(e);return e?n==e||ye(n)==e:ht(n)
+}:ht,Ke=lt(function(n,t,e){me.call(n,e)?n[e]++:n[e]=1}),Le=lt(function(n,t,e){(me.call(n,e)?n[e]:n[e]=[]).push(t)}),Me=lt(function(n,t,e){n[e]=t}),Ve=Rt,Ue=vt(Ue=Zt.now)&&Ue||function(){return(new Zt).getTime()},Ge=8==Ee(d+"08")?Ee:function(n,t){return Ee(kt(n)?n.replace(I,""):n,t||0)};return J.after=function(n,t){if(!dt(t))throw new ie;return function(){return 1>--n?t.apply(this,arguments):void 0}},J.assign=U,J.at=function(n){for(var t=arguments,e=-1,r=ut(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);++e<t;)u[e]=n[r[e]];
+return u},J.bind=Mt,J.bindAll=function(n){for(var t=1<arguments.length?ut(arguments,true,false,1):bt(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=ct(n[u],1,null,null,n)}return n},J.bindKey=function(n,t){return 2<arguments.length?ct(t,19,p(arguments,2),null,n):ct(t,3,null,null,n)},J.chain=function(n){return n=new Q(n),n.__chain__=true,n},J.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},J.compose=function(){for(var n=arguments,t=n.length;t--;)if(!dt(n[t]))throw new ie;
+return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},J.constant=function(n){return function(){return n}},J.countBy=Ke,J.create=function(n,t){var e=nt(n);return t?U(e,t):e},J.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return tt(n,t,e);if("object"!=r)return Jt(n);var u=Fe(n),o=u[0],i=n[o];return 1!=u.length||i!==i||wt(i)?function(t){for(var e=u.length,r=false;e--&&(r=ot(t[u[e]],n[u[e]],null,true)););return r}:function(n){return n=n[o],i===n&&(0!==i||1/i==1/n)
+}},J.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,ct(n,4,null,null,null,t)},J.debounce=Vt,J.defaults=_,J.defer=function(n){if(!dt(n))throw new ie;var t=p(arguments,1);return _e(function(){n.apply(v,t)},1)},J.delay=function(n,t){if(!dt(n))throw new ie;var e=p(arguments,2);return _e(function(){n.apply(v,e)},t)},J.difference=function(n){return rt(n,ut(arguments,true,true,1))},J.filter=Nt,J.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(n=Rt(n,e,r)),ut(n,t)
+},J.forEach=St,J.forEachRight=Et,J.forIn=g,J.forInRight=function(n,t,e){var r=[];g(n,function(n,t){r.push(t,n)});var u=r.length;for(t=tt(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},J.forOwn=h,J.forOwnRight=mt,J.functions=bt,J.groupBy=Le,J.indexBy=Me,J.initial=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=J.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return p(n,0,Se(Ie(0,u-r),u))},J.intersection=function(){for(var e=[],r=-1,u=arguments.length,i=a(),f=st(),p=f===n,s=a();++r<u;){var v=arguments[r];
+(Te(v)||yt(v))&&(e.push(v),i.push(p&&v.length>=b&&o(r?e[r]:s)))}var p=e[0],h=-1,g=p?p.length:0,y=[];n:for(;++h<g;){var m=i[0],v=p[h];if(0>(m?t(m,v):f(s,v))){for(r=u,(m||s).push(v);--r;)if(m=i[r],0>(m?t(m,v):f(e[r],v)))continue n;y.push(v)}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},J.invert=_t,J.invoke=function(n,t){var e=p(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=Xt(typeof o=="number"?o:0);return St(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},J.keys=Fe,J.map=Rt,J.mapValues=function(n,t,e){var r={};
+return t=J.createCallback(t,e,3),h(n,function(n,e,u){r[e]=t(n,e,u)}),r},J.max=At,J.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):m+arguments[0];return me.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!dt(n))throw new ie;return e.cache={},e},J.merge=function(n){var t=arguments,e=2;if(!wt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=tt(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=p(arguments,1,e),u=-1,o=a(),i=a();++u<e;)it(n,t[u],r,o,i);
+return l(o),l(i),n},J.min=function(n,t,e){var u=1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&Te(n)){e=-1;for(var i=n.length;++e<i;){var a=n[e];a<o&&(o=a)}}else t=null==t&&kt(n)?r:J.createCallback(t,e,3),St(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n)});return o},J.omit=function(n,t,e){var r={};if(typeof t!="function"){var u=[];g(n,function(n,t){u.push(t)});for(var u=rt(u,ut(arguments,true,false,1)),o=-1,i=u.length;++o<i;){var a=u[o];r[a]=n[a]}}else t=J.createCallback(t,e,3),g(n,function(n,e,u){t(n,e,u)||(r[e]=n)
+});return r},J.once=function(n){var t,e;if(!dt(n))throw new ie;return function(){return t?e:(t=true,e=n.apply(this,arguments),n=null,e)}},J.pairs=function(n){for(var t=-1,e=Fe(n),r=e.length,u=Xt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u},J.partial=function(n){return ct(n,16,p(arguments,1))},J.partialRight=function(n){return ct(n,32,null,p(arguments,1))},J.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=ut(arguments,true,false,1),i=wt(n)?o.length:0;++u<i;){var a=o[u];a in n&&(r[a]=n[a])
+}else t=J.createCallback(t,e,3),g(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},J.pluck=Ve,J.property=Jt,J.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,i=t[e];++o<u;)n[o]===i&&(de.call(n,o--,1),u--);return n},J.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Ie(0,se((t-n)/(e||1)));for(var u=Xt(t);++r<t;)u[r]=n,n+=e;return u},J.reject=function(n,t,e){return t=J.createCallback(t,e,3),Nt(n,function(n,e,r){return!t(n,e,r)
+})},J.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=J.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),de.call(n,r--,1),u--);return o},J.rest=qt,J.shuffle=Tt,J.sortBy=function(n,t,e){var r=-1,o=Te(t),i=n?n.length:0,p=Xt(typeof i=="number"?i:0);for(o||(t=J.createCallback(t,e,3)),St(n,function(n,e,u){var i=p[++r]=f();o?i.m=Rt(t,function(t){return n[t]}):(i.m=a())[0]=t(n,e,u),i.n=r,i.o=n}),i=p.length,p.sort(u);i--;)n=p[i],p[i]=n.o,o||l(n.m),c(n);return p},J.tap=function(n,t){return t(n),n
+},J.throttle=function(n,t,e){var r=true,u=true;if(!dt(n))throw new ie;return false===e?r=false:wt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),L.leading=r,L.maxWait=t,L.trailing=u,Vt(n,t,L)},J.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Xt(n);for(t=tt(t,e,1);++r<n;)u[r]=t(r);return u},J.toArray=function(n){return n&&typeof n.length=="number"?p(n):xt(n)},J.transform=function(n,t,e,r){var u=Te(n);if(null==e)if(u)e=[];else{var o=n&&n.constructor;e=nt(o&&o.prototype)}return t&&(t=J.createCallback(t,r,4),(u?St:h)(n,function(n,r,u){return t(e,n,r,u)
+})),e},J.union=function(){return ft(ut(arguments,true,true))},J.uniq=Pt,J.values=xt,J.where=Nt,J.without=function(n){return rt(n,p(arguments,1))},J.wrap=function(n,t){return ct(t,16,[n])},J.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var e=arguments[n];if(Te(e)||yt(e))var r=r?ft(rt(r,e).concat(rt(e,r))):e}return r||[]},J.zip=Kt,J.zipObject=Lt,J.collect=Rt,J.drop=qt,J.each=St,J.eachRight=Et,J.extend=U,J.methods=bt,J.object=Lt,J.select=Nt,J.tail=qt,J.unique=Pt,J.unzip=Kt,Gt(J),J.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=false),Z(n,t,typeof e=="function"&&tt(e,r,1))
+},J.cloneDeep=function(n,t,e){return Z(n,true,typeof t=="function"&&tt(t,e,1))},J.contains=Ct,J.escape=function(n){return null==n?"":oe(n).replace(ze,pt)},J.every=Ot,J.find=It,J.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=J.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},J.findKey=function(n,t,e){var r;return t=J.createCallback(t,e,3),h(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},J.findLast=function(n,t,e){var r;return t=J.createCallback(t,e,3),Et(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0
+}),r},J.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=J.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r;return-1},J.findLastKey=function(n,t,e){var r;return t=J.createCallback(t,e,3),mt(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},J.has=function(n,t){return n?me.call(n,t):false},J.identity=Ut,J.indexOf=Wt,J.isArguments=yt,J.isArray=Te,J.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&ce.call(n)==T||false},J.isDate=function(n){return n&&typeof n=="object"&&ce.call(n)==F||false
+},J.isElement=function(n){return n&&1===n.nodeType||false},J.isEmpty=function(n){var t=true;if(!n)return t;var e=ce.call(n),r=n.length;return e==$||e==P||e==D||e==q&&typeof r=="number"&&dt(n.splice)?!r:(h(n,function(){return t=false}),t)},J.isEqual=function(n,t,e,r){return ot(n,t,typeof e=="function"&&tt(e,r,2))},J.isFinite=function(n){return Ce(n)&&!Oe(parseFloat(n))},J.isFunction=dt,J.isNaN=function(n){return jt(n)&&n!=+n},J.isNull=function(n){return null===n},J.isNumber=jt,J.isObject=wt,J.isPlainObject=Pe,J.isRegExp=function(n){return n&&typeof n=="object"&&ce.call(n)==z||false
+},J.isString=kt,J.isUndefined=function(n){return typeof n=="undefined"},J.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Ie(0,r+e):Se(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},J.mixin=Gt,J.noConflict=function(){return e._=le,this},J.noop=Ht,J.now=Ue,J.parseInt=Ge,J.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Re(),Se(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):at(n,t)
+},J.reduce=Dt,J.reduceRight=$t,J.result=function(n,t){if(n){var e=n[t];return dt(e)?n[t]():e}},J.runInContext=s,J.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Fe(n).length},J.some=Ft,J.sortedIndex=zt,J.template=function(n,t,e){var r=J.templateSettings;n=oe(n||""),e=_({},e,r);var u,o=_({},e.imports,r.imports),r=Fe(o),o=xt(o),a=0,f=e.interpolate||S,l="__p+='",f=ue((e.escape||S).source+"|"+f.source+"|"+(f===N?x:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace(R,i),e&&(l+="'+__e("+e+")+'"),f&&(u=true,l+="';"+f+";\n__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t
+}),l+="';",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(w,""):l).replace(j,"$1").replace(k,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=ne(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},J.unescape=function(n){return null==n?"":oe(n).replace(qe,gt)},J.uniqueId=function(n){var t=++y;return oe(null==n?"":n)+t
+},J.all=Ot,J.any=Ft,J.detect=It,J.findWhere=It,J.foldl=Dt,J.foldr=$t,J.include=Ct,J.inject=Dt,Gt(function(){var n={};return h(J,function(t,e){J.prototype[e]||(n[e]=t)}),n}(),false),J.first=Bt,J.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=J.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return p(n,Ie(0,u-r))},J.sample=function(n,t,e){return n&&typeof n.length!="number"&&(n=xt(n)),null==t||e?n?n[at(0,n.length-1)]:v:(n=Tt(n),n.length=Se(Ie(0,t),n.length),n)
+},J.take=Bt,J.head=Bt,h(J,function(n,t){var e="sample"!==t;J.prototype[t]||(J.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new Q(o,u):o})}),J.VERSION="2.4.1",J.prototype.chain=function(){return this.__chain__=true,this},J.prototype.toString=function(){return oe(this.__wrapped__)},J.prototype.value=Qt,J.prototype.valueOf=Qt,St(["join","pop","shift"],function(n){var t=ae[n];J.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);
+return n?new Q(e,n):e}}),St(["push","reverse","sort","unshift"],function(n){var t=ae[n];J.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),St(["concat","slice","splice"],function(n){var t=ae[n];J.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments),this.__chain__)}}),J}var v,h=[],g=[],y=0,m=+new Date+"",b=75,_=40,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",w=/\b__p\+='';/g,j=/\b(__p\+=)''\+/g,k=/(__e\(.*?\)|\b__t\))\+'';/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,C=/\w*$/,O=/^\s*function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,I=RegExp("^["+d+"]*0+(?=.$)"),S=/($^)/,E=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,A="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setTimeout".split(" "),D="[object Arguments]",$="[object Array]",T="[object Boolean]",F="[object Date]",B="[object Function]",W="[object Number]",q="[object Object]",z="[object RegExp]",P="[object String]",K={};
+K[B]=false,K[D]=K[$]=K[T]=K[F]=K[W]=K[q]=K[z]=K[P]=true;var L={leading:false,maxWait:0,trailing:false},M={configurable:false,enumerable:false,value:null,writable:false},V={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},U={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},G=V[typeof window]&&window||this,H=V[typeof exports]&&exports&&!exports.nodeType&&exports,J=V[typeof module]&&module&&!module.nodeType&&module,Q=J&&J.exports===H&&H,X=V[typeof global]&&global;!X||X.global!==X&&X.window!==X||(G=X);
+var Y=s();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(G._=Y, define(function(){return Y})):H&&J?Q?(J.exports=Y)._=Y:H._=Y:G._=Y}).call(this);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.underscore.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.underscore.js
new file mode 100755 (executable)
index 0000000..0c84471
--- /dev/null
@@ -0,0 +1,4979 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
+ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
+ * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+ * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
+ * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license <http://lodash.com/license>
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre ES5 environments */
+  var undefined;
+
+  /** Used to generate unique IDs */
+  var idCounter = 0;
+
+  /** Used internally to indicate various things */
+  var indicatorObject = {};
+
+  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
+  var keyPrefix = +new Date + '';
+
+  /** Used to match "interpolate" template delimiters */
+  var reInterpolate = /<%=([\s\S]+?)%>/g;
+
+  /** Used to ensure capturing order of template delimiters */
+  var reNoMatch = /($^)/;
+
+  /** Used to match unescaped characters in compiled string literals */
+  var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
+
+  /** `Object#toString` result shortcuts */
+  var argsClass = '[object Arguments]',
+      arrayClass = '[object Array]',
+      boolClass = '[object Boolean]',
+      dateClass = '[object Date]',
+      funcClass = '[object Function]',
+      numberClass = '[object Number]',
+      objectClass = '[object Object]',
+      regexpClass = '[object RegExp]',
+      stringClass = '[object String]';
+
+  /** Used to determine if values are of the language type Object */
+  var objectTypes = {
+    'boolean': false,
+    'function': true,
+    'object': true,
+    'number': false,
+    'string': false,
+    'undefined': false
+  };
+
+  /** Used to escape characters for inclusion in compiled string literals */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\t': 't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  /** Used as a reference to the global object */
+  var root = (objectTypes[typeof window] && window) || this;
+
+  /** Detect free variable `exports` */
+  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module` */
+  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
+
+  /** Detect the popular CommonJS extension `module.exports` */
+  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+
+  /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
+  var freeGlobal = objectTypes[typeof global] && global;
+  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
+    root = freeGlobal;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * The base implementation of `_.indexOf` without support for binary searches
+   * or `fromIndex` constraints.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {number} Returns the index of the matched value or `-1`.
+   */
+  function baseIndexOf(array, value, fromIndex) {
+    var index = (fromIndex || 0) - 1,
+        length = array ? array.length : 0;
+
+    while (++index < length) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * Used by `sortBy` to compare transformed `collection` elements, stable sorting
+   * them in ascending order.
+   *
+   * @private
+   * @param {Object} a The object to compare to `b`.
+   * @param {Object} b The object to compare to `a`.
+   * @returns {number} Returns the sort order indicator of `1` or `-1`.
+   */
+  function compareAscending(a, b) {
+    var ac = a.criteria,
+        bc = b.criteria,
+        index = -1,
+        length = ac.length;
+
+    while (++index < length) {
+      var value = ac[index],
+          other = bc[index];
+
+      if (value !== other) {
+        if (value > other || typeof value == 'undefined') {
+          return 1;
+        }
+        if (value < other || typeof other == 'undefined') {
+          return -1;
+        }
+      }
+    }
+    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+    // that causes it, under certain circumstances, to return the same value for
+    // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247
+    //
+    // This also ensures a stable sort in V8 and other engines.
+    // See http://code.google.com/p/v8/issues/detail?id=90
+    return a.index - b.index;
+  }
+
+  /**
+   * Used by `template` to escape characters for inclusion in compiled
+   * string literals.
+   *
+   * @private
+   * @param {string} match The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeStringChar(match) {
+    return '\\' + stringEscapes[match];
+  }
+
+  /**
+   * Slices the `collection` from the `start` index up to, but not including,
+   * the `end` index.
+   *
+   * Note: This function is used instead of `Array#slice` to support node lists
+   * in IE < 9 and to ensure dense arrays are returned.
+   *
+   * @private
+   * @param {Array|Object|string} collection The collection to slice.
+   * @param {number} start The start index.
+   * @param {number} end The end index.
+   * @returns {Array} Returns the new array.
+   */
+  function slice(array, start, end) {
+    start || (start = 0);
+    if (typeof end == 'undefined') {
+      end = array ? array.length : 0;
+    }
+    var index = -1,
+        length = end - start || 0,
+        result = Array(length < 0 ? 0 : length);
+
+    while (++index < length) {
+      result[index] = array[start + index];
+    }
+    return result;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Used for `Array` method references.
+   *
+   * Normally `Array.prototype` would suffice, however, using an array literal
+   * avoids issues in Narwhal.
+   */
+  var arrayRef = [];
+
+  /** Used for native method references */
+  var objectProto = Object.prototype;
+
+  /** Used to restore the original `_` reference in `noConflict` */
+  var oldDash = root._;
+
+  /** Used to resolve the internal [[Class]] of values */
+  var toString = objectProto.toString;
+
+  /** Used to detect if a method is native */
+  var reNative = RegExp('^' +
+    String(toString)
+      .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+      .replace(/toString| for [^\]]+/g, '.*?') + '$'
+  );
+
+  /** Native method shortcuts */
+  var ceil = Math.ceil,
+      floor = Math.floor,
+      hasOwnProperty = objectProto.hasOwnProperty,
+      push = arrayRef.push,
+      propertyIsEnumerable = objectProto.propertyIsEnumerable;
+
+  /* Native method shortcuts for methods with the same name as other `lodash` methods */
+  var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
+      nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
+      nativeIsFinite = root.isFinite,
+      nativeIsNaN = root.isNaN,
+      nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
+      nativeMax = Math.max,
+      nativeMin = Math.min,
+      nativeRandom = Math.random;
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Creates a `lodash` object which wraps the given value to enable intuitive
+   * method chaining.
+   *
+   * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+   * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
+   * and `unshift`
+   *
+   * Chaining is supported in custom builds as long as the `value` method is
+   * implicitly or explicitly included in the build.
+   *
+   * The chainable wrapper functions are:
+   * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
+   * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,
+   * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,
+   * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+   * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+   * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
+   * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,
+   * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+   * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,
+   * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,
+   * and `zip`
+   *
+   * The non-chainable wrapper functions are:
+   * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,
+   * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,
+   * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+   * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,
+   * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,
+   * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,
+   * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,
+   * `template`, `unescape`, `uniqueId`, and `value`
+   *
+   * The wrapper functions `first` and `last` return wrapped values when `n` is
+   * provided, otherwise they return unwrapped values.
+   *
+   * Explicit chaining can be enabled by using the `_.chain` method.
+   *
+   * @name _
+   * @constructor
+   * @category Chaining
+   * @param {*} value The value to wrap in a `lodash` instance.
+   * @returns {Object} Returns a `lodash` instance.
+   * @example
+   *
+   * var wrapped = _([1, 2, 3]);
+   *
+   * // returns an unwrapped value
+   * wrapped.reduce(function(sum, num) {
+   *   return sum + num;
+   * });
+   * // => 6
+   *
+   * // returns a wrapped value
+   * var squares = wrapped.map(function(num) {
+   *   return num * num;
+   * });
+   *
+   * _.isArray(squares);
+   * // => false
+   *
+   * _.isArray(squares.value());
+   * // => true
+   */
+  function lodash(value) {
+    return (value instanceof lodash)
+      ? value
+      : new lodashWrapper(value);
+  }
+
+  /**
+   * A fast path for creating `lodash` wrapper objects.
+   *
+   * @private
+   * @param {*} value The value to wrap in a `lodash` instance.
+   * @param {boolean} chainAll A flag to enable chaining for all methods
+   * @returns {Object} Returns a `lodash` instance.
+   */
+  function lodashWrapper(value, chainAll) {
+    this.__chain__ = !!chainAll;
+    this.__wrapped__ = value;
+  }
+  // ensure `new lodashWrapper` is an instance of `lodash`
+  lodashWrapper.prototype = lodash.prototype;
+
+  /**
+   * An object used to flag environments features.
+   *
+   * @static
+   * @memberOf _
+   * @type Object
+   */
+  var support = {};
+
+  (function() {
+    var object = { '0': 1, 'length': 1 };
+
+    /**
+     * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.
+     *
+     * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
+     * and `splice()` functions that fail to remove the last element, `value[0]`,
+     * of array-like objects even though the `length` property is set to `0`.
+     * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
+     * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
+     *
+     * @memberOf _.support
+     * @type boolean
+     */
+    support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]);
+  }(1));
+
+  /**
+   * By default, the template delimiters used by Lo-Dash are similar to those in
+   * embedded Ruby (ERB). Change the following template settings to use alternative
+   * delimiters.
+   *
+   * @static
+   * @memberOf _
+   * @type Object
+   */
+  lodash.templateSettings = {
+
+    /**
+     * Used to detect `data` property values to be HTML-escaped.
+     *
+     * @memberOf _.templateSettings
+     * @type RegExp
+     */
+    'escape': /<%-([\s\S]+?)%>/g,
+
+    /**
+     * Used to detect code to be evaluated.
+     *
+     * @memberOf _.templateSettings
+     * @type RegExp
+     */
+    'evaluate': /<%([\s\S]+?)%>/g,
+
+    /**
+     * Used to detect `data` property values to inject.
+     *
+     * @memberOf _.templateSettings
+     * @type RegExp
+     */
+    'interpolate': reInterpolate,
+
+    /**
+     * Used to reference the data object in the template text.
+     *
+     * @memberOf _.templateSettings
+     * @type string
+     */
+    'variable': ''
+  };
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * The base implementation of `_.bind` that creates the bound function and
+   * sets its meta data.
+   *
+   * @private
+   * @param {Array} bindData The bind data array.
+   * @returns {Function} Returns the new bound function.
+   */
+  function baseBind(bindData) {
+    var func = bindData[0],
+        partialArgs = bindData[2],
+        thisArg = bindData[4];
+
+    function bound() {
+      // `Function#bind` spec
+      // http://es5.github.io/#x15.3.4.5
+      if (partialArgs) {
+        // avoid `arguments` object deoptimizations by using `slice` instead
+        // of `Array.prototype.slice.call` and not assigning `arguments` to a
+        // variable as a ternary expression
+        var args = slice(partialArgs);
+        push.apply(args, arguments);
+      }
+      // mimic the constructor's `return` behavior
+      // http://es5.github.io/#x13.2.2
+      if (this instanceof bound) {
+        // ensure `new bound` is an instance of `func`
+        var thisBinding = baseCreate(func.prototype),
+            result = func.apply(thisBinding, args || arguments);
+        return isObject(result) ? result : thisBinding;
+      }
+      return func.apply(thisArg, args || arguments);
+    }
+    return bound;
+  }
+
+  /**
+   * The base implementation of `_.create` without support for assigning
+   * properties to the created object.
+   *
+   * @private
+   * @param {Object} prototype The object to inherit from.
+   * @returns {Object} Returns the new object.
+   */
+  function baseCreate(prototype, properties) {
+    return isObject(prototype) ? nativeCreate(prototype) : {};
+  }
+  // fallback for browsers without `Object.create`
+  if (!nativeCreate) {
+    baseCreate = (function() {
+      function Object() {}
+      return function(prototype) {
+        if (isObject(prototype)) {
+          Object.prototype = prototype;
+          var result = new Object;
+          Object.prototype = null;
+        }
+        return result || root.Object();
+      };
+    }());
+  }
+
+  /**
+   * The base implementation of `_.createCallback` without support for creating
+   * "_.pluck" or "_.where" style callbacks.
+   *
+   * @private
+   * @param {*} [func=identity] The value to convert to a callback.
+   * @param {*} [thisArg] The `this` binding of the created callback.
+   * @param {number} [argCount] The number of arguments the callback accepts.
+   * @returns {Function} Returns a callback function.
+   */
+  function baseCreateCallback(func, thisArg, argCount) {
+    if (typeof func != 'function') {
+      return identity;
+    }
+    // exit early for no `thisArg` or already bound by `Function#bind`
+    if (typeof thisArg == 'undefined' || !('prototype' in func)) {
+      return func;
+    }
+    switch (argCount) {
+      case 1: return function(value) {
+        return func.call(thisArg, value);
+      };
+      case 2: return function(a, b) {
+        return func.call(thisArg, a, b);
+      };
+      case 3: return function(value, index, collection) {
+        return func.call(thisArg, value, index, collection);
+      };
+      case 4: return function(accumulator, value, index, collection) {
+        return func.call(thisArg, accumulator, value, index, collection);
+      };
+    }
+    return bind(func, thisArg);
+  }
+
+  /**
+   * The base implementation of `createWrapper` that creates the wrapper and
+   * sets its meta data.
+   *
+   * @private
+   * @param {Array} bindData The bind data array.
+   * @returns {Function} Returns the new function.
+   */
+  function baseCreateWrapper(bindData) {
+    var func = bindData[0],
+        bitmask = bindData[1],
+        partialArgs = bindData[2],
+        partialRightArgs = bindData[3],
+        thisArg = bindData[4],
+        arity = bindData[5];
+
+    var isBind = bitmask & 1,
+        isBindKey = bitmask & 2,
+        isCurry = bitmask & 4,
+        isCurryBound = bitmask & 8,
+        key = func;
+
+    function bound() {
+      var thisBinding = isBind ? thisArg : this;
+      if (partialArgs) {
+        var args = slice(partialArgs);
+        push.apply(args, arguments);
+      }
+      if (partialRightArgs || isCurry) {
+        args || (args = slice(arguments));
+        if (partialRightArgs) {
+          push.apply(args, partialRightArgs);
+        }
+        if (isCurry && args.length < arity) {
+          bitmask |= 16 & ~32;
+          return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);
+        }
+      }
+      args || (args = arguments);
+      if (isBindKey) {
+        func = thisBinding[key];
+      }
+      if (this instanceof bound) {
+        thisBinding = baseCreate(func.prototype);
+        var result = func.apply(thisBinding, args);
+        return isObject(result) ? result : thisBinding;
+      }
+      return func.apply(thisBinding, args);
+    }
+    return bound;
+  }
+
+  /**
+   * The base implementation of `_.difference` that accepts a single array
+   * of values to exclude.
+   *
+   * @private
+   * @param {Array} array The array to process.
+   * @param {Array} [values] The array of values to exclude.
+   * @returns {Array} Returns a new array of filtered values.
+   */
+  function baseDifference(array, values) {
+    var index = -1,
+        indexOf = getIndexOf(),
+        length = array ? array.length : 0,
+        result = [];
+
+    while (++index < length) {
+      var value = array[index];
+      if (indexOf(values, value) < 0) {
+        result.push(value);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.flatten` without support for callback
+   * shorthands or `thisArg` binding.
+   *
+   * @private
+   * @param {Array} array The array to flatten.
+   * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+   * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
+   * @param {number} [fromIndex=0] The index to start from.
+   * @returns {Array} Returns a new flattened array.
+   */
+  function baseFlatten(array, isShallow, isStrict, fromIndex) {
+    var index = (fromIndex || 0) - 1,
+        length = array ? array.length : 0,
+        result = [];
+
+    while (++index < length) {
+      var value = array[index];
+
+      if (value && typeof value == 'object' && typeof value.length == 'number'
+          && (isArray(value) || isArguments(value))) {
+        // recursively flatten arrays (susceptible to call stack limits)
+        if (!isShallow) {
+          value = baseFlatten(value, isShallow, isStrict);
+        }
+        var valIndex = -1,
+            valLength = value.length,
+            resIndex = result.length;
+
+        result.length += valLength;
+        while (++valIndex < valLength) {
+          result[resIndex++] = value[valIndex];
+        }
+      } else if (!isStrict) {
+        result.push(value);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.isEqual`, without support for `thisArg` binding,
+   * that allows partial "_.where" style comparisons.
+   *
+   * @private
+   * @param {*} a The value to compare.
+   * @param {*} b The other value to compare.
+   * @param {Function} [callback] The function to customize comparing values.
+   * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.
+   * @param {Array} [stackA=[]] Tracks traversed `a` objects.
+   * @param {Array} [stackB=[]] Tracks traversed `b` objects.
+   * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+   */
+  function baseIsEqual(a, b, stackA, stackB) {
+    if (a === b) {
+      return a !== 0 || (1 / a == 1 / b);
+    }
+    var type = typeof a,
+        otherType = typeof b;
+
+    if (a === a &&
+        !(a && objectTypes[type]) &&
+        !(b && objectTypes[otherType])) {
+      return false;
+    }
+    if (a == null || b == null) {
+      return a === b;
+    }
+    var className = toString.call(a),
+        otherClass = toString.call(b);
+
+    if (className != otherClass) {
+      return false;
+    }
+    switch (className) {
+      case boolClass:
+      case dateClass:
+        return +a == +b;
+
+      case numberClass:
+        return a != +a
+          ? b != +b
+          : (a == 0 ? (1 / a == 1 / b) : a == +b);
+
+      case regexpClass:
+      case stringClass:
+        return a == String(b);
+    }
+    var isArr = className == arrayClass;
+    if (!isArr) {
+      var aWrapped = a instanceof lodash,
+          bWrapped = b instanceof lodash;
+
+      if (aWrapped || bWrapped) {
+        return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, stackA, stackB);
+      }
+      if (className != objectClass) {
+        return false;
+      }
+      var ctorA = a.constructor,
+          ctorB = b.constructor;
+
+      if (ctorA != ctorB &&
+            !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
+            ('constructor' in a && 'constructor' in b)
+          ) {
+        return false;
+      }
+    }
+    stackA || (stackA = []);
+    stackB || (stackB = []);
+
+    var length = stackA.length;
+    while (length--) {
+      if (stackA[length] == a) {
+        return stackB[length] == b;
+      }
+    }
+    var result = true,
+        size = 0;
+
+    stackA.push(a);
+    stackB.push(b);
+
+    if (isArr) {
+      size = b.length;
+      result = size == a.length;
+
+      if (result) {
+        while (size--) {
+          if (!(result = baseIsEqual(a[size], b[size], stackA, stackB))) {
+            break;
+          }
+        }
+      }
+    }
+    else {
+      forIn(b, function(value, key, b) {
+        if (hasOwnProperty.call(b, key)) {
+          size++;
+          return !(result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, stackA, stackB)) && indicatorObject;
+        }
+      });
+
+      if (result) {
+        forIn(a, function(value, key, a) {
+          if (hasOwnProperty.call(a, key)) {
+            return !(result = --size > -1) && indicatorObject;
+          }
+        });
+      }
+    }
+    stackA.pop();
+    stackB.pop();
+    return result;
+  }
+
+  /**
+   * The base implementation of `_.random` without argument juggling or support
+   * for returning floating-point numbers.
+   *
+   * @private
+   * @param {number} min The minimum possible value.
+   * @param {number} max The maximum possible value.
+   * @returns {number} Returns a random number.
+   */
+  function baseRandom(min, max) {
+    return min + floor(nativeRandom() * (max - min + 1));
+  }
+
+  /**
+   * The base implementation of `_.uniq` without support for callback shorthands
+   * or `thisArg` binding.
+   *
+   * @private
+   * @param {Array} array The array to process.
+   * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+   * @param {Function} [callback] The function called per iteration.
+   * @returns {Array} Returns a duplicate-value-free array.
+   */
+  function baseUniq(array, isSorted, callback) {
+    var index = -1,
+        indexOf = getIndexOf(),
+        length = array ? array.length : 0,
+        result = [],
+        seen = callback ? [] : result;
+
+    while (++index < length) {
+      var value = array[index],
+          computed = callback ? callback(value, index, array) : value;
+
+      if (isSorted
+            ? !index || seen[seen.length - 1] !== computed
+            : indexOf(seen, computed) < 0
+          ) {
+        if (callback) {
+          seen.push(computed);
+        }
+        result.push(value);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Creates a function that aggregates a collection, creating an object composed
+   * of keys generated from the results of running each element of the collection
+   * through a callback. The given `setter` function sets the keys and values
+   * of the composed object.
+   *
+   * @private
+   * @param {Function} setter The setter function.
+   * @returns {Function} Returns the new aggregator function.
+   */
+  function createAggregator(setter) {
+    return function(collection, callback, thisArg) {
+      var result = {};
+      callback = createCallback(callback, thisArg, 3);
+
+      var index = -1,
+          length = collection ? collection.length : 0;
+
+      if (typeof length == 'number') {
+        while (++index < length) {
+          var value = collection[index];
+          setter(result, value, callback(value, index, collection), collection);
+        }
+      } else {
+        forOwn(collection, function(value, key, collection) {
+          setter(result, value, callback(value, key, collection), collection);
+        });
+      }
+      return result;
+    };
+  }
+
+  /**
+   * Creates a function that, when called, either curries or invokes `func`
+   * with an optional `this` binding and partially applied arguments.
+   *
+   * @private
+   * @param {Function|string} func The function or method name to reference.
+   * @param {number} bitmask The bitmask of method flags to compose.
+   *  The bitmask may be composed of the following flags:
+   *  1 - `_.bind`
+   *  2 - `_.bindKey`
+   *  4 - `_.curry`
+   *  8 - `_.curry` (bound)
+   *  16 - `_.partial`
+   *  32 - `_.partialRight`
+   * @param {Array} [partialArgs] An array of arguments to prepend to those
+   *  provided to the new function.
+   * @param {Array} [partialRightArgs] An array of arguments to append to those
+   *  provided to the new function.
+   * @param {*} [thisArg] The `this` binding of `func`.
+   * @param {number} [arity] The arity of `func`.
+   * @returns {Function} Returns the new function.
+   */
+  function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
+    var isBind = bitmask & 1,
+        isBindKey = bitmask & 2,
+        isCurry = bitmask & 4,
+        isCurryBound = bitmask & 8,
+        isPartial = bitmask & 16,
+        isPartialRight = bitmask & 32;
+
+    if (!isBindKey && !isFunction(func)) {
+      throw new TypeError;
+    }
+    if (isPartial && !partialArgs.length) {
+      bitmask &= ~16;
+      isPartial = partialArgs = false;
+    }
+    if (isPartialRight && !partialRightArgs.length) {
+      bitmask &= ~32;
+      isPartialRight = partialRightArgs = false;
+    }
+    // fast path for `_.bind`
+    var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;
+    return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);
+  }
+
+  /**
+   * Used by `escape` to convert characters to HTML entities.
+   *
+   * @private
+   * @param {string} match The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeHtmlChar(match) {
+    return htmlEscapes[match];
+  }
+
+  /**
+   * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+   * customized, this method returns the custom method, otherwise it returns
+   * the `baseIndexOf` function.
+   *
+   * @private
+   * @returns {Function} Returns the "indexOf" function.
+   */
+  function getIndexOf() {
+    var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;
+    return result;
+  }
+
+  /**
+   * Checks if `value` is a native function.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.
+   */
+  function isNative(value) {
+    return typeof value == 'function' && reNative.test(value);
+  }
+
+  /**
+   * Used by `unescape` to convert HTML entities to characters.
+   *
+   * @private
+   * @param {string} match The matched character to unescape.
+   * @returns {string} Returns the unescaped character.
+   */
+  function unescapeHtmlChar(match) {
+    return htmlUnescapes[match];
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Checks if `value` is an `arguments` object.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
+   * @example
+   *
+   * (function() { return _.isArguments(arguments); })(1, 2, 3);
+   * // => true
+   *
+   * _.isArguments([1, 2, 3]);
+   * // => false
+   */
+  function isArguments(value) {
+    return value && typeof value == 'object' && typeof value.length == 'number' &&
+      toString.call(value) == argsClass || false;
+  }
+  // fallback for browsers that can't detect `arguments` objects by [[Class]]
+  if (!isArguments(arguments)) {
+    isArguments = function(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false;
+    };
+  }
+
+  /**
+   * Checks if `value` is an array.
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is an array, else `false`.
+   * @example
+   *
+   * (function() { return _.isArray(arguments); })();
+   * // => false
+   *
+   * _.isArray([1, 2, 3]);
+   * // => true
+   */
+  var isArray = nativeIsArray || function(value) {
+    return value && typeof value == 'object' && typeof value.length == 'number' &&
+      toString.call(value) == arrayClass || false;
+  };
+
+  /**
+   * A fallback implementation of `Object.keys` which produces an array of the
+   * given object's own enumerable property names.
+   *
+   * @private
+   * @type Function
+   * @param {Object} object The object to inspect.
+   * @returns {Array} Returns an array of property names.
+   */
+  var shimKeys = function(object) {
+    var index, iterable = object, result = [];
+    if (!iterable) return result;
+    if (!(objectTypes[typeof object])) return result;
+      for (index in iterable) {
+        if (hasOwnProperty.call(iterable, index)) {
+          result.push(index);
+        }
+      }
+    return result
+  };
+
+  /**
+   * Creates an array composed of the own enumerable property names of an object.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The object to inspect.
+   * @returns {Array} Returns an array of property names.
+   * @example
+   *
+   * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
+   * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
+   */
+  var keys = !nativeKeys ? shimKeys : function(object) {
+    if (!isObject(object)) {
+      return [];
+    }
+    return nativeKeys(object);
+  };
+
+  /**
+   * Used to convert characters to HTML entities:
+   *
+   * Though the `>` character is escaped for symmetry, characters like `>` and `/`
+   * don't require escaping in HTML and have no special meaning unless they're part
+   * of a tag or an unquoted attribute value.
+   * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
+   */
+  var htmlEscapes = {
+    '&': '&amp;',
+    '<': '&lt;',
+    '>': '&gt;',
+    '"': '&quot;',
+    "'": '&#x27;'
+  };
+
+  /** Used to convert HTML entities to characters */
+  var htmlUnescapes = invert(htmlEscapes);
+
+  /** Used to match HTML entities and HTML characters */
+  var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),
+      reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Assigns own enumerable properties of source object(s) to the destination
+   * object. Subsequent sources will overwrite property assignments of previous
+   * sources. If a callback is provided it will be executed to produce the
+   * assigned values. The callback is bound to `thisArg` and invoked with two
+   * arguments; (objectValue, sourceValue).
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @alias extend
+   * @category Objects
+   * @param {Object} object The destination object.
+   * @param {...Object} [source] The source objects.
+   * @param {Function} [callback] The function to customize assigning values.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns the destination object.
+   * @example
+   *
+   * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });
+   * // => { 'name': 'fred', 'employer': 'slate' }
+   *
+   * var defaults = _.partialRight(_.assign, function(a, b) {
+   *   return typeof a == 'undefined' ? b : a;
+   * });
+   *
+   * var object = { 'name': 'barney' };
+   * defaults(object, { 'name': 'fred', 'employer': 'slate' });
+   * // => { 'name': 'barney', 'employer': 'slate' }
+   */
+  function assign(object) {
+    if (!object) {
+      return object;
+    }
+    for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {
+      var iterable = arguments[argsIndex];
+      if (iterable) {
+        for (var key in iterable) {
+          object[key] = iterable[key];
+        }
+      }
+    }
+    return object;
+  }
+
+  /**
+   * Creates a clone of `value`. If `isDeep` is `true` nested objects will also
+   * be cloned, otherwise they will be assigned by reference. If a callback
+   * is provided it will be executed to produce the cloned values. If the
+   * callback returns `undefined` cloning will be handled by the method instead.
+   * The callback is bound to `thisArg` and invoked with one argument; (value).
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to clone.
+   * @param {boolean} [isDeep=false] Specify a deep clone.
+   * @param {Function} [callback] The function to customize cloning values.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the cloned value.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * var shallow = _.clone(characters);
+   * shallow[0] === characters[0];
+   * // => true
+   *
+   * var deep = _.clone(characters, true);
+   * deep[0] === characters[0];
+   * // => false
+   *
+   * _.mixin({
+   *   'clone': _.partialRight(_.clone, function(value) {
+   *     return _.isElement(value) ? value.cloneNode(false) : undefined;
+   *   })
+   * });
+   *
+   * var clone = _.clone(document.body);
+   * clone.childNodes.length;
+   * // => 0
+   */
+  function clone(value) {
+    return isObject(value)
+      ? (isArray(value) ? slice(value) : assign({}, value))
+      : value;
+  }
+
+  /**
+   * Assigns own enumerable properties of source object(s) to the destination
+   * object for all destination properties that resolve to `undefined`. Once a
+   * property is set, additional defaults of the same property will be ignored.
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @category Objects
+   * @param {Object} object The destination object.
+   * @param {...Object} [source] The source objects.
+   * @param- {Object} [guard] Allows working with `_.reduce` without using its
+   *  `key` and `object` arguments as sources.
+   * @returns {Object} Returns the destination object.
+   * @example
+   *
+   * var object = { 'name': 'barney' };
+   * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
+   * // => { 'name': 'barney', 'employer': 'slate' }
+   */
+  function defaults(object) {
+    if (!object) {
+      return object;
+    }
+    for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {
+      var iterable = arguments[argsIndex];
+      if (iterable) {
+        for (var key in iterable) {
+          if (typeof object[key] == 'undefined') {
+            object[key] = iterable[key];
+          }
+        }
+      }
+    }
+    return object;
+  }
+
+  /**
+   * Iterates over own and inherited enumerable properties of an object,
+   * executing the callback for each property. The callback is bound to `thisArg`
+   * and invoked with three arguments; (value, key, object). Callbacks may exit
+   * iteration early by explicitly returning `false`.
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @category Objects
+   * @param {Object} object The object to iterate over.
+   * @param {Function} [callback=identity] The function called per iteration.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns `object`.
+   * @example
+   *
+   * function Shape() {
+   *   this.x = 0;
+   *   this.y = 0;
+   * }
+   *
+   * Shape.prototype.move = function(x, y) {
+   *   this.x += x;
+   *   this.y += y;
+   * };
+   *
+   * _.forIn(new Shape, function(value, key) {
+   *   console.log(key);
+   * });
+   * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)
+   */
+  var forIn = function(collection, callback) {
+    var index, iterable = collection, result = iterable;
+    if (!iterable) return result;
+    if (!objectTypes[typeof iterable]) return result;
+      for (index in iterable) {
+        if (callback(iterable[index], index, collection) === indicatorObject) return result;
+      }
+    return result
+  };
+
+  /**
+   * Iterates over own enumerable properties of an object, executing the callback
+   * for each property. The callback is bound to `thisArg` and invoked with three
+   * arguments; (value, key, object). Callbacks may exit iteration early by
+   * explicitly returning `false`.
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @category Objects
+   * @param {Object} object The object to iterate over.
+   * @param {Function} [callback=identity] The function called per iteration.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns `object`.
+   * @example
+   *
+   * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+   *   console.log(key);
+   * });
+   * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
+   */
+  var forOwn = function(collection, callback) {
+    var index, iterable = collection, result = iterable;
+    if (!iterable) return result;
+    if (!objectTypes[typeof iterable]) return result;
+      for (index in iterable) {
+        if (hasOwnProperty.call(iterable, index)) {
+          if (callback(iterable[index], index, collection) === indicatorObject) return result;
+        }
+      }
+    return result
+  };
+
+  /**
+   * Creates a sorted array of property names of all enumerable properties,
+   * own and inherited, of `object` that have function values.
+   *
+   * @static
+   * @memberOf _
+   * @alias methods
+   * @category Objects
+   * @param {Object} object The object to inspect.
+   * @returns {Array} Returns an array of property names that have function values.
+   * @example
+   *
+   * _.functions(_);
+   * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]
+   */
+  function functions(object) {
+    var result = [];
+    forIn(object, function(value, key) {
+      if (isFunction(value)) {
+        result.push(key);
+      }
+    });
+    return result.sort();
+  }
+
+  /**
+   * Checks if the specified property name exists as a direct property of `object`,
+   * instead of an inherited property.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The object to inspect.
+   * @param {string} key The name of the property to check.
+   * @returns {boolean} Returns `true` if key is a direct property, else `false`.
+   * @example
+   *
+   * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
+   * // => true
+   */
+  function has(object, key) {
+    return object ? hasOwnProperty.call(object, key) : false;
+  }
+
+  /**
+   * Creates an object composed of the inverted keys and values of the given object.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The object to invert.
+   * @returns {Object} Returns the created inverted object.
+   * @example
+   *
+   * _.invert({ 'first': 'fred', 'second': 'barney' });
+   * // => { 'fred': 'first', 'barney': 'second' }
+   */
+  function invert(object) {
+    var index = -1,
+        props = keys(object),
+        length = props.length,
+        result = {};
+
+    while (++index < length) {
+      var key = props[index];
+      result[object[key]] = key;
+    }
+    return result;
+  }
+
+  /**
+   * Checks if `value` is a boolean value.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.
+   * @example
+   *
+   * _.isBoolean(null);
+   * // => false
+   */
+  function isBoolean(value) {
+    return value === true || value === false ||
+      value && typeof value == 'object' && toString.call(value) == boolClass || false;
+  }
+
+  /**
+   * Checks if `value` is a date.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a date, else `false`.
+   * @example
+   *
+   * _.isDate(new Date);
+   * // => true
+   */
+  function isDate(value) {
+    return value && typeof value == 'object' && toString.call(value) == dateClass || false;
+  }
+
+  /**
+   * Checks if `value` is a DOM element.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.
+   * @example
+   *
+   * _.isElement(document.body);
+   * // => true
+   */
+  function isElement(value) {
+    return value && value.nodeType === 1 || false;
+  }
+
+  /**
+   * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
+   * length of `0` and objects with no own enumerable properties are considered
+   * "empty".
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Array|Object|string} value The value to inspect.
+   * @returns {boolean} Returns `true` if the `value` is empty, else `false`.
+   * @example
+   *
+   * _.isEmpty([1, 2, 3]);
+   * // => false
+   *
+   * _.isEmpty({});
+   * // => true
+   *
+   * _.isEmpty('');
+   * // => true
+   */
+  function isEmpty(value) {
+    if (!value) {
+      return true;
+    }
+    if (isArray(value) || isString(value)) {
+      return !value.length;
+    }
+    for (var key in value) {
+      if (hasOwnProperty.call(value, key)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  /**
+   * Performs a deep comparison between two values to determine if they are
+   * equivalent to each other. If a callback is provided it will be executed
+   * to compare values. If the callback returns `undefined` comparisons will
+   * be handled by the method instead. The callback is bound to `thisArg` and
+   * invoked with two arguments; (a, b).
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} a The value to compare.
+   * @param {*} b The other value to compare.
+   * @param {Function} [callback] The function to customize comparing values.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+   * @example
+   *
+   * var object = { 'name': 'fred' };
+   * var copy = { 'name': 'fred' };
+   *
+   * object == copy;
+   * // => false
+   *
+   * _.isEqual(object, copy);
+   * // => true
+   *
+   * var words = ['hello', 'goodbye'];
+   * var otherWords = ['hi', 'goodbye'];
+   *
+   * _.isEqual(words, otherWords, function(a, b) {
+   *   var reGreet = /^(?:hello|hi)$/i,
+   *       aGreet = _.isString(a) && reGreet.test(a),
+   *       bGreet = _.isString(b) && reGreet.test(b);
+   *
+   *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
+   * });
+   * // => true
+   */
+  function isEqual(a, b) {
+    return baseIsEqual(a, b);
+  }
+
+  /**
+   * Checks if `value` is, or can be coerced to, a finite number.
+   *
+   * Note: This is not the same as native `isFinite` which will return true for
+   * booleans and empty strings. See http://es5.github.io/#x15.1.2.5.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is finite, else `false`.
+   * @example
+   *
+   * _.isFinite(-101);
+   * // => true
+   *
+   * _.isFinite('10');
+   * // => true
+   *
+   * _.isFinite(true);
+   * // => false
+   *
+   * _.isFinite('');
+   * // => false
+   *
+   * _.isFinite(Infinity);
+   * // => false
+   */
+  function isFinite(value) {
+    return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
+  }
+
+  /**
+   * Checks if `value` is a function.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a function, else `false`.
+   * @example
+   *
+   * _.isFunction(_);
+   * // => true
+   */
+  function isFunction(value) {
+    return typeof value == 'function';
+  }
+  // fallback for older versions of Chrome and Safari
+  if (isFunction(/x/)) {
+    isFunction = function(value) {
+      return typeof value == 'function' && toString.call(value) == funcClass;
+    };
+  }
+
+  /**
+   * Checks if `value` is the language type of Object.
+   * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
+   * @example
+   *
+   * _.isObject({});
+   * // => true
+   *
+   * _.isObject([1, 2, 3]);
+   * // => true
+   *
+   * _.isObject(1);
+   * // => false
+   */
+  function isObject(value) {
+    // check if the value is the ECMAScript language type of Object
+    // http://es5.github.io/#x8
+    // and avoid a V8 bug
+    // http://code.google.com/p/v8/issues/detail?id=2291
+    return !!(value && objectTypes[typeof value]);
+  }
+
+  /**
+   * Checks if `value` is `NaN`.
+   *
+   * Note: This is not the same as native `isNaN` which will return `true` for
+   * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.
+   * @example
+   *
+   * _.isNaN(NaN);
+   * // => true
+   *
+   * _.isNaN(new Number(NaN));
+   * // => true
+   *
+   * isNaN(undefined);
+   * // => true
+   *
+   * _.isNaN(undefined);
+   * // => false
+   */
+  function isNaN(value) {
+    // `NaN` as a primitive is the only value that is not equal to itself
+    // (perform the [[Class]] check first to avoid errors with some host objects in IE)
+    return isNumber(value) && value != +value;
+  }
+
+  /**
+   * Checks if `value` is `null`.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is `null`, else `false`.
+   * @example
+   *
+   * _.isNull(null);
+   * // => true
+   *
+   * _.isNull(undefined);
+   * // => false
+   */
+  function isNull(value) {
+    return value === null;
+  }
+
+  /**
+   * Checks if `value` is a number.
+   *
+   * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a number, else `false`.
+   * @example
+   *
+   * _.isNumber(8.4 * 5);
+   * // => true
+   */
+  function isNumber(value) {
+    return typeof value == 'number' ||
+      value && typeof value == 'object' && toString.call(value) == numberClass || false;
+  }
+
+  /**
+   * Checks if `value` is a regular expression.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.
+   * @example
+   *
+   * _.isRegExp(/fred/);
+   * // => true
+   */
+  function isRegExp(value) {
+    return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false;
+  }
+
+  /**
+   * Checks if `value` is a string.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a string, else `false`.
+   * @example
+   *
+   * _.isString('fred');
+   * // => true
+   */
+  function isString(value) {
+    return typeof value == 'string' ||
+      value && typeof value == 'object' && toString.call(value) == stringClass || false;
+  }
+
+  /**
+   * Checks if `value` is `undefined`.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.
+   * @example
+   *
+   * _.isUndefined(void 0);
+   * // => true
+   */
+  function isUndefined(value) {
+    return typeof value == 'undefined';
+  }
+
+  /**
+   * Creates a shallow clone of `object` excluding the specified properties.
+   * Property names may be specified as individual arguments or as arrays of
+   * property names. If a callback is provided it will be executed for each
+   * property of `object` omitting the properties the callback returns truey
+   * for. The callback is bound to `thisArg` and invoked with three arguments;
+   * (value, key, object).
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The source object.
+   * @param {Function|...string|string[]} [callback] The properties to omit or the
+   *  function called per iteration.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns an object without the omitted properties.
+   * @example
+   *
+   * _.omit({ 'name': 'fred', 'age': 40 }, 'age');
+   * // => { 'name': 'fred' }
+   *
+   * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {
+   *   return typeof value == 'number';
+   * });
+   * // => { 'name': 'fred' }
+   */
+  function omit(object) {
+    var props = [];
+    forIn(object, function(value, key) {
+      props.push(key);
+    });
+    props = baseDifference(props, baseFlatten(arguments, true, false, 1));
+
+    var index = -1,
+        length = props.length,
+        result = {};
+
+    while (++index < length) {
+      var key = props[index];
+      result[key] = object[key];
+    }
+    return result;
+  }
+
+  /**
+   * Creates a two dimensional array of an object's key-value pairs,
+   * i.e. `[[key1, value1], [key2, value2]]`.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The object to inspect.
+   * @returns {Array} Returns new array of key-value pairs.
+   * @example
+   *
+   * _.pairs({ 'barney': 36, 'fred': 40 });
+   * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments)
+   */
+  function pairs(object) {
+    var index = -1,
+        props = keys(object),
+        length = props.length,
+        result = Array(length);
+
+    while (++index < length) {
+      var key = props[index];
+      result[index] = [key, object[key]];
+    }
+    return result;
+  }
+
+  /**
+   * Creates a shallow clone of `object` composed of the specified properties.
+   * Property names may be specified as individual arguments or as arrays of
+   * property names. If a callback is provided it will be executed for each
+   * property of `object` picking the properties the callback returns truey
+   * for. The callback is bound to `thisArg` and invoked with three arguments;
+   * (value, key, object).
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The source object.
+   * @param {Function|...string|string[]} [callback] The function called per
+   *  iteration or property names to pick, specified as individual property
+   *  names or arrays of property names.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns an object composed of the picked properties.
+   * @example
+   *
+   * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name');
+   * // => { 'name': 'fred' }
+   *
+   * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) {
+   *   return key.charAt(0) != '_';
+   * });
+   * // => { 'name': 'fred' }
+   */
+  function pick(object) {
+    var index = -1,
+        props = baseFlatten(arguments, true, false, 1),
+        length = props.length,
+        result = {};
+
+    while (++index < length) {
+      var key = props[index];
+      if (key in object) {
+        result[key] = object[key];
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Creates an array composed of the own enumerable property values of `object`.
+   *
+   * @static
+   * @memberOf _
+   * @category Objects
+   * @param {Object} object The object to inspect.
+   * @returns {Array} Returns an array of property values.
+   * @example
+   *
+   * _.values({ 'one': 1, 'two': 2, 'three': 3 });
+   * // => [1, 2, 3] (property order is not guaranteed across environments)
+   */
+  function values(object) {
+    var index = -1,
+        props = keys(object),
+        length = props.length,
+        result = Array(length);
+
+    while (++index < length) {
+      result[index] = object[props[index]];
+    }
+    return result;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Checks if a given value is present in a collection using strict equality
+   * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
+   * offset from the end of the collection.
+   *
+   * @static
+   * @memberOf _
+   * @alias include
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {*} target The value to check for.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {boolean} Returns `true` if the `target` element is found, else `false`.
+   * @example
+   *
+   * _.contains([1, 2, 3], 1);
+   * // => true
+   *
+   * _.contains([1, 2, 3], 1, 2);
+   * // => false
+   *
+   * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
+   * // => true
+   *
+   * _.contains('pebbles', 'eb');
+   * // => true
+   */
+  function contains(collection, target) {
+    var indexOf = getIndexOf(),
+        length = collection ? collection.length : 0,
+        result = false;
+    if (length && typeof length == 'number') {
+      result = indexOf(collection, target) > -1;
+    } else {
+      forOwn(collection, function(value) {
+        return (result = value === target) && indicatorObject;
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Creates an object composed of keys generated from the results of running
+   * each element of `collection` through the callback. The corresponding value
+   * of each key is the number of times the key was returned by the callback.
+   * The callback is bound to `thisArg` and invoked with three arguments;
+   * (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns the composed aggregate object.
+   * @example
+   *
+   * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
+   * // => { '4': 1, '6': 2 }
+   *
+   * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+   * // => { '4': 1, '6': 2 }
+   *
+   * _.countBy(['one', 'two', 'three'], 'length');
+   * // => { '3': 2, '5': 1 }
+   */
+  var countBy = createAggregator(function(result, value, key) {
+    (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);
+  });
+
+  /**
+   * Checks if the given callback returns truey value for **all** elements of
+   * a collection. The callback is bound to `thisArg` and invoked with three
+   * arguments; (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias all
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {boolean} Returns `true` if all elements passed the callback check,
+   *  else `false`.
+   * @example
+   *
+   * _.every([true, 1, null, 'yes']);
+   * // => false
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.every(characters, 'age');
+   * // => true
+   *
+   * // using "_.where" callback shorthand
+   * _.every(characters, { 'age': 36 });
+   * // => false
+   */
+  function every(collection, callback, thisArg) {
+    var result = true;
+    callback = createCallback(callback, thisArg, 3);
+
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    if (typeof length == 'number') {
+      while (++index < length) {
+        if (!(result = !!callback(collection[index], index, collection))) {
+          break;
+        }
+      }
+    } else {
+      forOwn(collection, function(value, index, collection) {
+        return !(result = !!callback(value, index, collection)) && indicatorObject;
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Iterates over elements of a collection, returning an array of all elements
+   * the callback returns truey for. The callback is bound to `thisArg` and
+   * invoked with three arguments; (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias select
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a new array of elements that passed the callback check.
+   * @example
+   *
+   * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+   * // => [2, 4, 6]
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36, 'blocked': false },
+   *   { 'name': 'fred',   'age': 40, 'blocked': true }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.filter(characters, 'blocked');
+   * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+   *
+   * // using "_.where" callback shorthand
+   * _.filter(characters, { 'age': 36 });
+   * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+   */
+  function filter(collection, callback, thisArg) {
+    var result = [];
+    callback = createCallback(callback, thisArg, 3);
+
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    if (typeof length == 'number') {
+      while (++index < length) {
+        var value = collection[index];
+        if (callback(value, index, collection)) {
+          result.push(value);
+        }
+      }
+    } else {
+      forOwn(collection, function(value, index, collection) {
+        if (callback(value, index, collection)) {
+          result.push(value);
+        }
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Iterates over elements of a collection, returning the first element that
+   * the callback returns truey for. The callback is bound to `thisArg` and
+   * invoked with three arguments; (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias detect, findWhere
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the found element, else `undefined`.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'age': 36, 'blocked': false },
+   *   { 'name': 'fred',    'age': 40, 'blocked': true },
+   *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+   * ];
+   *
+   * _.find(characters, function(chr) {
+   *   return chr.age < 40;
+   * });
+   * // => { 'name': 'barney', 'age': 36, 'blocked': false }
+   *
+   * // using "_.where" callback shorthand
+   * _.find(characters, { 'age': 1 });
+   * // =>  { 'name': 'pebbles', 'age': 1, 'blocked': false }
+   *
+   * // using "_.pluck" callback shorthand
+   * _.find(characters, 'blocked');
+   * // => { 'name': 'fred', 'age': 40, 'blocked': true }
+   */
+  function find(collection, callback, thisArg) {
+    callback = createCallback(callback, thisArg, 3);
+
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    if (typeof length == 'number') {
+      while (++index < length) {
+        var value = collection[index];
+        if (callback(value, index, collection)) {
+          return value;
+        }
+      }
+    } else {
+      var result;
+      forOwn(collection, function(value, index, collection) {
+        if (callback(value, index, collection)) {
+          result = value;
+          return indicatorObject;
+        }
+      });
+      return result;
+    }
+  }
+
+  /**
+   * Examines each element in a `collection`, returning the first that
+   * has the given properties. When checking `properties`, this method
+   * performs a deep comparison between values to determine if they are
+   * equivalent to each other.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Object} properties The object of property values to filter by.
+   * @returns {*} Returns the found element, else `undefined`.
+   * @example
+   *
+   * var food = [
+   *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
+   *   { 'name': 'banana', 'organic': true,  'type': 'fruit' },
+   *   { 'name': 'beet',   'organic': false, 'type': 'vegetable' }
+   * ];
+   *
+   * _.findWhere(food, { 'type': 'vegetable' });
+   * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }
+   */
+  function findWhere(object, properties) {
+    return where(object, properties, true);
+  }
+
+  /**
+   * Iterates over elements of a collection, executing the callback for each
+   * element. The callback is bound to `thisArg` and invoked with three arguments;
+   * (value, index|key, collection). Callbacks may exit iteration early by
+   * explicitly returning `false`.
+   *
+   * Note: As with other "Collections" methods, objects with a `length` property
+   * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+   * may be used for object iteration.
+   *
+   * @static
+   * @memberOf _
+   * @alias each
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function} [callback=identity] The function called per iteration.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array|Object|string} Returns `collection`.
+   * @example
+   *
+   * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');
+   * // => logs each number and returns '1,2,3'
+   *
+   * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
+   * // => logs each number and returns the object (property order is not guaranteed across environments)
+   */
+  function forEach(collection, callback, thisArg) {
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+    if (typeof length == 'number') {
+      while (++index < length) {
+        if (callback(collection[index], index, collection) === indicatorObject) {
+          break;
+        }
+      }
+    } else {
+      forOwn(collection, callback);
+    }
+  }
+
+  /**
+   * This method is like `_.forEach` except that it iterates over elements
+   * of a `collection` from right to left.
+   *
+   * @static
+   * @memberOf _
+   * @alias eachRight
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function} [callback=identity] The function called per iteration.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array|Object|string} Returns `collection`.
+   * @example
+   *
+   * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');
+   * // => logs each number from right to left and returns '3,2,1'
+   */
+  function forEachRight(collection, callback) {
+    var length = collection ? collection.length : 0;
+    if (typeof length == 'number') {
+      while (length--) {
+        if (callback(collection[length], length, collection) === false) {
+          break;
+        }
+      }
+    } else {
+      var props = keys(collection);
+      length = props.length;
+      forOwn(collection, function(value, key, collection) {
+        key = props ? props[--length] : --length;
+        return callback(collection[key], key, collection) === false && indicatorObject;
+      });
+    }
+  }
+
+  /**
+   * Creates an object composed of keys generated from the results of running
+   * each element of a collection through the callback. The corresponding value
+   * of each key is an array of the elements responsible for generating the key.
+   * The callback is bound to `thisArg` and invoked with three arguments;
+   * (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns the composed aggregate object.
+   * @example
+   *
+   * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
+   * // => { '4': [4.2], '6': [6.1, 6.4] }
+   *
+   * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+   * // => { '4': [4.2], '6': [6.1, 6.4] }
+   *
+   * // using "_.pluck" callback shorthand
+   * _.groupBy(['one', 'two', 'three'], 'length');
+   * // => { '3': ['one', 'two'], '5': ['three'] }
+   */
+  var groupBy = createAggregator(function(result, value, key) {
+    (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
+  });
+
+  /**
+   * Creates an object composed of keys generated from the results of running
+   * each element of the collection through the given callback. The corresponding
+   * value of each key is the last element responsible for generating the key.
+   * The callback is bound to `thisArg` and invoked with three arguments;
+   * (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Object} Returns the composed aggregate object.
+   * @example
+   *
+   * var keys = [
+   *   { 'dir': 'left', 'code': 97 },
+   *   { 'dir': 'right', 'code': 100 }
+   * ];
+   *
+   * _.indexBy(keys, 'dir');
+   * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+   *
+   * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
+   * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+   *
+   * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String);
+   * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+   */
+  var indexBy = createAggregator(function(result, value, key) {
+    result[key] = value;
+  });
+
+  /**
+   * Invokes the method named by `methodName` on each element in the `collection`
+   * returning an array of the results of each invoked method. Additional arguments
+   * will be provided to each invoked method. If `methodName` is a function it
+   * will be invoked for, and `this` bound to, each element in the `collection`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|string} methodName The name of the method to invoke or
+   *  the function invoked per iteration.
+   * @param {...*} [arg] Arguments to invoke the method with.
+   * @returns {Array} Returns a new array of the results of each invoked method.
+   * @example
+   *
+   * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+   * // => [[1, 5, 7], [1, 2, 3]]
+   *
+   * _.invoke([123, 456], String.prototype.split, '');
+   * // => [['1', '2', '3'], ['4', '5', '6']]
+   */
+  function invoke(collection, methodName) {
+    var args = slice(arguments, 2),
+        index = -1,
+        isFunc = typeof methodName == 'function',
+        length = collection ? collection.length : 0,
+        result = Array(typeof length == 'number' ? length : 0);
+
+    forEach(collection, function(value) {
+      result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
+    });
+    return result;
+  }
+
+  /**
+   * Creates an array of values by running each element in the collection
+   * through the callback. The callback is bound to `thisArg` and invoked with
+   * three arguments; (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias collect
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a new array of the results of each `callback` execution.
+   * @example
+   *
+   * _.map([1, 2, 3], function(num) { return num * 3; });
+   * // => [3, 6, 9]
+   *
+   * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
+   * // => [3, 6, 9] (property order is not guaranteed across environments)
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.map(characters, 'name');
+   * // => ['barney', 'fred']
+   */
+  function map(collection, callback, thisArg) {
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    callback = createCallback(callback, thisArg, 3);
+    if (typeof length == 'number') {
+      var result = Array(length);
+      while (++index < length) {
+        result[index] = callback(collection[index], index, collection);
+      }
+    } else {
+      result = [];
+      forOwn(collection, function(value, key, collection) {
+        result[++index] = callback(value, key, collection);
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Retrieves the maximum value of a collection. If the collection is empty or
+   * falsey `-Infinity` is returned. If a callback is provided it will be executed
+   * for each value in the collection to generate the criterion by which the value
+   * is ranked. The callback is bound to `thisArg` and invoked with three
+   * arguments; (value, index, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the maximum value.
+   * @example
+   *
+   * _.max([4, 2, 8, 6]);
+   * // => 8
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * _.max(characters, function(chr) { return chr.age; });
+   * // => { 'name': 'fred', 'age': 40 };
+   *
+   * // using "_.pluck" callback shorthand
+   * _.max(characters, 'age');
+   * // => { 'name': 'fred', 'age': 40 };
+   */
+  function max(collection, callback, thisArg) {
+    var computed = -Infinity,
+        result = computed;
+
+    // allows working with functions like `_.map` without using
+    // their `index` argument as a callback
+    if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+      callback = null;
+    }
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    if (callback == null && typeof length == 'number') {
+      while (++index < length) {
+        var value = collection[index];
+        if (value > result) {
+          result = value;
+        }
+      }
+    } else {
+      callback = createCallback(callback, thisArg, 3);
+
+      forEach(collection, function(value, index, collection) {
+        var current = callback(value, index, collection);
+        if (current > computed) {
+          computed = current;
+          result = value;
+        }
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Retrieves the minimum value of a collection. If the collection is empty or
+   * falsey `Infinity` is returned. If a callback is provided it will be executed
+   * for each value in the collection to generate the criterion by which the value
+   * is ranked. The callback is bound to `thisArg` and invoked with three
+   * arguments; (value, index, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the minimum value.
+   * @example
+   *
+   * _.min([4, 2, 8, 6]);
+   * // => 2
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * _.min(characters, function(chr) { return chr.age; });
+   * // => { 'name': 'barney', 'age': 36 };
+   *
+   * // using "_.pluck" callback shorthand
+   * _.min(characters, 'age');
+   * // => { 'name': 'barney', 'age': 36 };
+   */
+  function min(collection, callback, thisArg) {
+    var computed = Infinity,
+        result = computed;
+
+    // allows working with functions like `_.map` without using
+    // their `index` argument as a callback
+    if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+      callback = null;
+    }
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    if (callback == null && typeof length == 'number') {
+      while (++index < length) {
+        var value = collection[index];
+        if (value < result) {
+          result = value;
+        }
+      }
+    } else {
+      callback = createCallback(callback, thisArg, 3);
+
+      forEach(collection, function(value, index, collection) {
+        var current = callback(value, index, collection);
+        if (current < computed) {
+          computed = current;
+          result = value;
+        }
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Retrieves the value of a specified property from all elements in the collection.
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {string} property The name of the property to pluck.
+   * @returns {Array} Returns a new array of property values.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * _.pluck(characters, 'name');
+   * // => ['barney', 'fred']
+   */
+  var pluck = map;
+
+  /**
+   * Reduces a collection to a value which is the accumulated result of running
+   * each element in the collection through the callback, where each successive
+   * callback execution consumes the return value of the previous execution. If
+   * `accumulator` is not provided the first element of the collection will be
+   * used as the initial `accumulator` value. The callback is bound to `thisArg`
+   * and invoked with four arguments; (accumulator, value, index|key, collection).
+   *
+   * @static
+   * @memberOf _
+   * @alias foldl, inject
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function} [callback=identity] The function called per iteration.
+   * @param {*} [accumulator] Initial value of the accumulator.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the accumulated value.
+   * @example
+   *
+   * var sum = _.reduce([1, 2, 3], function(sum, num) {
+   *   return sum + num;
+   * });
+   * // => 6
+   *
+   * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+   *   result[key] = num * 3;
+   *   return result;
+   * }, {});
+   * // => { 'a': 3, 'b': 6, 'c': 9 }
+   */
+  function reduce(collection, callback, accumulator, thisArg) {
+    if (!collection) return accumulator;
+    var noaccum = arguments.length < 3;
+    callback = createCallback(callback, thisArg, 4);
+
+    var index = -1,
+        length = collection.length;
+
+    if (typeof length == 'number') {
+      if (noaccum) {
+        accumulator = collection[++index];
+      }
+      while (++index < length) {
+        accumulator = callback(accumulator, collection[index], index, collection);
+      }
+    } else {
+      forOwn(collection, function(value, index, collection) {
+        accumulator = noaccum
+          ? (noaccum = false, value)
+          : callback(accumulator, value, index, collection)
+      });
+    }
+    return accumulator;
+  }
+
+  /**
+   * This method is like `_.reduce` except that it iterates over elements
+   * of a `collection` from right to left.
+   *
+   * @static
+   * @memberOf _
+   * @alias foldr
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function} [callback=identity] The function called per iteration.
+   * @param {*} [accumulator] Initial value of the accumulator.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the accumulated value.
+   * @example
+   *
+   * var list = [[0, 1], [2, 3], [4, 5]];
+   * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
+   * // => [4, 5, 2, 3, 0, 1]
+   */
+  function reduceRight(collection, callback, accumulator, thisArg) {
+    var noaccum = arguments.length < 3;
+    callback = createCallback(callback, thisArg, 4);
+    forEachRight(collection, function(value, index, collection) {
+      accumulator = noaccum
+        ? (noaccum = false, value)
+        : callback(accumulator, value, index, collection);
+    });
+    return accumulator;
+  }
+
+  /**
+   * The opposite of `_.filter` this method returns the elements of a
+   * collection that the callback does **not** return truey for.
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a new array of elements that failed the callback check.
+   * @example
+   *
+   * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+   * // => [1, 3, 5]
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36, 'blocked': false },
+   *   { 'name': 'fred',   'age': 40, 'blocked': true }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.reject(characters, 'blocked');
+   * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+   *
+   * // using "_.where" callback shorthand
+   * _.reject(characters, { 'age': 36 });
+   * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+   */
+  function reject(collection, callback, thisArg) {
+    callback = createCallback(callback, thisArg, 3);
+    return filter(collection, function(value, index, collection) {
+      return !callback(value, index, collection);
+    });
+  }
+
+  /**
+   * Retrieves a random element or `n` random elements from a collection.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to sample.
+   * @param {number} [n] The number of elements to sample.
+   * @param- {Object} [guard] Allows working with functions like `_.map`
+   *  without using their `index` arguments as `n`.
+   * @returns {Array} Returns the random sample(s) of `collection`.
+   * @example
+   *
+   * _.sample([1, 2, 3, 4]);
+   * // => 2
+   *
+   * _.sample([1, 2, 3, 4], 2);
+   * // => [3, 1]
+   */
+  function sample(collection, n, guard) {
+    if (collection && typeof collection.length != 'number') {
+      collection = values(collection);
+    }
+    if (n == null || guard) {
+      return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
+    }
+    var result = shuffle(collection);
+    result.length = nativeMin(nativeMax(0, n), result.length);
+    return result;
+  }
+
+  /**
+   * Creates an array of shuffled values, using a version of the Fisher-Yates
+   * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to shuffle.
+   * @returns {Array} Returns a new shuffled collection.
+   * @example
+   *
+   * _.shuffle([1, 2, 3, 4, 5, 6]);
+   * // => [4, 1, 6, 3, 5, 2]
+   */
+  function shuffle(collection) {
+    var index = -1,
+        length = collection ? collection.length : 0,
+        result = Array(typeof length == 'number' ? length : 0);
+
+    forEach(collection, function(value) {
+      var rand = baseRandom(0, ++index);
+      result[index] = result[rand];
+      result[rand] = value;
+    });
+    return result;
+  }
+
+  /**
+   * Gets the size of the `collection` by returning `collection.length` for arrays
+   * and array-like objects or the number of own enumerable properties for objects.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to inspect.
+   * @returns {number} Returns `collection.length` or number of own enumerable properties.
+   * @example
+   *
+   * _.size([1, 2]);
+   * // => 2
+   *
+   * _.size({ 'one': 1, 'two': 2, 'three': 3 });
+   * // => 3
+   *
+   * _.size('pebbles');
+   * // => 7
+   */
+  function size(collection) {
+    var length = collection ? collection.length : 0;
+    return typeof length == 'number' ? length : keys(collection).length;
+  }
+
+  /**
+   * Checks if the callback returns a truey value for **any** element of a
+   * collection. The function returns as soon as it finds a passing value and
+   * does not iterate over the entire collection. The callback is bound to
+   * `thisArg` and invoked with three arguments; (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias any
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {boolean} Returns `true` if any element passed the callback check,
+   *  else `false`.
+   * @example
+   *
+   * _.some([null, 0, 'yes', false], Boolean);
+   * // => true
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36, 'blocked': false },
+   *   { 'name': 'fred',   'age': 40, 'blocked': true }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.some(characters, 'blocked');
+   * // => true
+   *
+   * // using "_.where" callback shorthand
+   * _.some(characters, { 'age': 1 });
+   * // => false
+   */
+  function some(collection, callback, thisArg) {
+    var result;
+    callback = createCallback(callback, thisArg, 3);
+
+    var index = -1,
+        length = collection ? collection.length : 0;
+
+    if (typeof length == 'number') {
+      while (++index < length) {
+        if ((result = callback(collection[index], index, collection))) {
+          break;
+        }
+      }
+    } else {
+      forOwn(collection, function(value, index, collection) {
+        return (result = callback(value, index, collection)) && indicatorObject;
+      });
+    }
+    return !!result;
+  }
+
+  /**
+   * Creates an array of elements, sorted in ascending order by the results of
+   * running each element in a collection through the callback. This method
+   * performs a stable sort, that is, it will preserve the original sort order
+   * of equal elements. The callback is bound to `thisArg` and invoked with
+   * three arguments; (value, index|key, collection).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an array of property names is provided for `callback` the collection
+   * will be sorted by each property value.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Array|Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a new array of sorted elements.
+   * @example
+   *
+   * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
+   * // => [3, 1, 2]
+   *
+   * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
+   * // => [3, 1, 2]
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'age': 36 },
+   *   { 'name': 'fred',    'age': 40 },
+   *   { 'name': 'barney',  'age': 26 },
+   *   { 'name': 'fred',    'age': 30 }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.map(_.sortBy(characters, 'age'), _.values);
+   * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]]
+   *
+   * // sorting by multiple properties
+   * _.map(_.sortBy(characters, ['name', 'age']), _.values);
+   * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]
+   */
+  function sortBy(collection, callback, thisArg) {
+    var index = -1,
+        length = collection ? collection.length : 0,
+        result = Array(typeof length == 'number' ? length : 0);
+
+    callback = createCallback(callback, thisArg, 3);
+    forEach(collection, function(value, key, collection) {
+      result[++index] = {
+        'criteria': [callback(value, key, collection)],
+        'index': index,
+        'value': value
+      };
+    });
+
+    length = result.length;
+    result.sort(compareAscending);
+    while (length--) {
+      result[length] = result[length].value;
+    }
+    return result;
+  }
+
+  /**
+   * Converts the `collection` to an array.
+   *
+   * @static
+   * @memberOf _
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to convert.
+   * @returns {Array} Returns the new converted array.
+   * @example
+   *
+   * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
+   * // => [2, 3, 4]
+   */
+  function toArray(collection) {
+    if (isArray(collection)) {
+      return slice(collection);
+    }
+    if (collection && typeof collection.length == 'number') {
+      return map(collection);
+    }
+    return values(collection);
+  }
+
+  /**
+   * Performs a deep comparison of each element in a `collection` to the given
+   * `properties` object, returning an array of all elements that have equivalent
+   * property values.
+   *
+   * @static
+   * @memberOf _
+   * @type Function
+   * @category Collections
+   * @param {Array|Object|string} collection The collection to iterate over.
+   * @param {Object} props The object of property values to filter by.
+   * @returns {Array} Returns a new array of elements that have the given properties.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] },
+   *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+   * ];
+   *
+   * _.where(characters, { 'age': 36 });
+   * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }]
+   *
+   * _.where(characters, { 'pets': ['dino'] });
+   * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }]
+   */
+  function where(collection, properties, first) {
+    return (first && isEmpty(properties))
+      ? undefined
+      : (first ? find : filter)(collection, properties);
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Creates an array with all falsey values removed. The values `false`, `null`,
+   * `0`, `""`, `undefined`, and `NaN` are all falsey.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to compact.
+   * @returns {Array} Returns a new array of filtered values.
+   * @example
+   *
+   * _.compact([0, 1, false, 2, '', 3]);
+   * // => [1, 2, 3]
+   */
+  function compact(array) {
+    var index = -1,
+        length = array ? array.length : 0,
+        result = [];
+
+    while (++index < length) {
+      var value = array[index];
+      if (value) {
+        result.push(value);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Creates an array excluding all values of the provided arrays using strict
+   * equality for comparisons, i.e. `===`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to process.
+   * @param {...Array} [values] The arrays of values to exclude.
+   * @returns {Array} Returns a new array of filtered values.
+   * @example
+   *
+   * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
+   * // => [1, 3, 4]
+   */
+  function difference(array) {
+    return baseDifference(array, baseFlatten(arguments, true, true, 1));
+  }
+
+  /**
+   * Gets the first element or first `n` elements of an array. If a callback
+   * is provided elements at the beginning of the array are returned as long
+   * as the callback returns truey. The callback is bound to `thisArg` and
+   * invoked with three arguments; (value, index, array).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias head, take
+   * @category Arrays
+   * @param {Array} array The array to query.
+   * @param {Function|Object|number|string} [callback] The function called
+   *  per element or the number of elements to return. If a property name or
+   *  object is provided it will be used to create a "_.pluck" or "_.where"
+   *  style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the first element(s) of `array`.
+   * @example
+   *
+   * _.first([1, 2, 3]);
+   * // => 1
+   *
+   * _.first([1, 2, 3], 2);
+   * // => [1, 2]
+   *
+   * _.first([1, 2, 3], function(num) {
+   *   return num < 3;
+   * });
+   * // => [1, 2]
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+   *   { 'name': 'fred',    'blocked': false, 'employer': 'slate' },
+   *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.first(characters, 'blocked');
+   * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }]
+   *
+   * // using "_.where" callback shorthand
+   * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name');
+   * // => ['barney', 'fred']
+   */
+  function first(array, callback, thisArg) {
+    var n = 0,
+        length = array ? array.length : 0;
+
+    if (typeof callback != 'number' && callback != null) {
+      var index = -1;
+      callback = createCallback(callback, thisArg, 3);
+      while (++index < length && callback(array[index], index, array)) {
+        n++;
+      }
+    } else {
+      n = callback;
+      if (n == null || thisArg) {
+        return array ? array[0] : undefined;
+      }
+    }
+    return slice(array, 0, nativeMin(nativeMax(0, n), length));
+  }
+
+  /**
+   * Flattens a nested array (the nesting can be to any depth). If `isShallow`
+   * is truey, the array will only be flattened a single level. If a callback
+   * is provided each element of the array is passed through the callback before
+   * flattening. The callback is bound to `thisArg` and invoked with three
+   * arguments; (value, index, array).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to flatten.
+   * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a new flattened array.
+   * @example
+   *
+   * _.flatten([1, [2], [3, [[4]]]]);
+   * // => [1, 2, 3, 4];
+   *
+   * _.flatten([1, [2], [3, [[4]]]], true);
+   * // => [1, 2, 3, [[4]]];
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },
+   *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.flatten(characters, 'pets');
+   * // => ['hoppy', 'baby puss', 'dino']
+   */
+  function flatten(array, isShallow) {
+    return baseFlatten(array, isShallow);
+  }
+
+  /**
+   * Gets the index at which the first occurrence of `value` is found using
+   * strict equality for comparisons, i.e. `===`. If the array is already sorted
+   * providing `true` for `fromIndex` will run a faster binary search.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+   *  to perform a binary search on a sorted array.
+   * @returns {number} Returns the index of the matched value or `-1`.
+   * @example
+   *
+   * _.indexOf([1, 2, 3, 1, 2, 3], 2);
+   * // => 1
+   *
+   * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
+   * // => 4
+   *
+   * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
+   * // => 2
+   */
+  function indexOf(array, value, fromIndex) {
+    if (typeof fromIndex == 'number') {
+      var length = array ? array.length : 0;
+      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
+    } else if (fromIndex) {
+      var index = sortedIndex(array, value);
+      return array[index] === value ? index : -1;
+    }
+    return baseIndexOf(array, value, fromIndex);
+  }
+
+  /**
+   * Gets all but the last element or last `n` elements of an array. If a
+   * callback is provided elements at the end of the array are excluded from
+   * the result as long as the callback returns truey. The callback is bound
+   * to `thisArg` and invoked with three arguments; (value, index, array).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to query.
+   * @param {Function|Object|number|string} [callback=1] The function called
+   *  per element or the number of elements to exclude. If a property name or
+   *  object is provided it will be used to create a "_.pluck" or "_.where"
+   *  style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a slice of `array`.
+   * @example
+   *
+   * _.initial([1, 2, 3]);
+   * // => [1, 2]
+   *
+   * _.initial([1, 2, 3], 2);
+   * // => [1]
+   *
+   * _.initial([1, 2, 3], function(num) {
+   *   return num > 1;
+   * });
+   * // => [1]
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+   *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+   *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.initial(characters, 'blocked');
+   * // => [{ 'name': 'barney',  'blocked': false, 'employer': 'slate' }]
+   *
+   * // using "_.where" callback shorthand
+   * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name');
+   * // => ['barney', 'fred']
+   */
+  function initial(array, callback, thisArg) {
+    var n = 0,
+        length = array ? array.length : 0;
+
+    if (typeof callback != 'number' && callback != null) {
+      var index = length;
+      callback = createCallback(callback, thisArg, 3);
+      while (index-- && callback(array[index], index, array)) {
+        n++;
+      }
+    } else {
+      n = (callback == null || thisArg) ? 1 : callback || n;
+    }
+    return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
+  }
+
+  /**
+   * Creates an array of unique values present in all provided arrays using
+   * strict equality for comparisons, i.e. `===`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {...Array} [array] The arrays to inspect.
+   * @returns {Array} Returns an array of shared values.
+   * @example
+   *
+   * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+   * // => [1, 2]
+   */
+  function intersection() {
+    var args = [],
+        argsIndex = -1,
+        argsLength = arguments.length;
+
+    while (++argsIndex < argsLength) {
+      var value = arguments[argsIndex];
+       if (isArray(value) || isArguments(value)) {
+         args.push(value);
+       }
+    }
+    var array = args[0],
+        index = -1,
+        indexOf = getIndexOf(),
+        length = array ? array.length : 0,
+        result = [];
+
+    outer:
+    while (++index < length) {
+      value = array[index];
+      if (indexOf(result, value) < 0) {
+        var argsIndex = argsLength;
+        while (--argsIndex) {
+          if (indexOf(args[argsIndex], value) < 0) {
+            continue outer;
+          }
+        }
+        result.push(value);
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Gets the last element or last `n` elements of an array. If a callback is
+   * provided elements at the end of the array are returned as long as the
+   * callback returns truey. The callback is bound to `thisArg` and invoked
+   * with three arguments; (value, index, array).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to query.
+   * @param {Function|Object|number|string} [callback] The function called
+   *  per element or the number of elements to return. If a property name or
+   *  object is provided it will be used to create a "_.pluck" or "_.where"
+   *  style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {*} Returns the last element(s) of `array`.
+   * @example
+   *
+   * _.last([1, 2, 3]);
+   * // => 3
+   *
+   * _.last([1, 2, 3], 2);
+   * // => [2, 3]
+   *
+   * _.last([1, 2, 3], function(num) {
+   *   return num > 1;
+   * });
+   * // => [2, 3]
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+   *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+   *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.pluck(_.last(characters, 'blocked'), 'name');
+   * // => ['fred', 'pebbles']
+   *
+   * // using "_.where" callback shorthand
+   * _.last(characters, { 'employer': 'na' });
+   * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+   */
+  function last(array, callback, thisArg) {
+    var n = 0,
+        length = array ? array.length : 0;
+
+    if (typeof callback != 'number' && callback != null) {
+      var index = length;
+      callback = createCallback(callback, thisArg, 3);
+      while (index-- && callback(array[index], index, array)) {
+        n++;
+      }
+    } else {
+      n = callback;
+      if (n == null || thisArg) {
+        return array ? array[length - 1] : undefined;
+      }
+    }
+    return slice(array, nativeMax(0, length - n));
+  }
+
+  /**
+   * Gets the index at which the last occurrence of `value` is found using strict
+   * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
+   * as the offset from the end of the collection.
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {number} [fromIndex=array.length-1] The index to search from.
+   * @returns {number} Returns the index of the matched value or `-1`.
+   * @example
+   *
+   * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
+   * // => 4
+   *
+   * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
+   * // => 1
+   */
+  function lastIndexOf(array, value, fromIndex) {
+    var index = array ? array.length : 0;
+    if (typeof fromIndex == 'number') {
+      index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
+    }
+    while (index--) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * Creates an array of numbers (positive and/or negative) progressing from
+   * `start` up to but not including `end`. If `start` is less than `stop` a
+   * zero-length range is created unless a negative `step` is specified.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {number} [start=0] The start of the range.
+   * @param {number} end The end of the range.
+   * @param {number} [step=1] The value to increment or decrement by.
+   * @returns {Array} Returns a new range array.
+   * @example
+   *
+   * _.range(4);
+   * // => [0, 1, 2, 3]
+   *
+   * _.range(1, 5);
+   * // => [1, 2, 3, 4]
+   *
+   * _.range(0, 20, 5);
+   * // => [0, 5, 10, 15]
+   *
+   * _.range(0, -4, -1);
+   * // => [0, -1, -2, -3]
+   *
+   * _.range(1, 4, 0);
+   * // => [1, 1, 1]
+   *
+   * _.range(0);
+   * // => []
+   */
+  function range(start, end, step) {
+    start = +start || 0;
+    step =  (+step || 1);
+
+    if (end == null) {
+      end = start;
+      start = 0;
+    }
+    // use `Array(length)` so engines like Chakra and V8 avoid slower modes
+    // http://youtu.be/XAqIpGU8ZZk#t=17m25s
+    var index = -1,
+        length = nativeMax(0, ceil((end - start) / step)),
+        result = Array(length);
+
+    while (++index < length) {
+      result[index] = start;
+      start += step;
+    }
+    return result;
+  }
+
+  /**
+   * The opposite of `_.initial` this method gets all but the first element or
+   * first `n` elements of an array. If a callback function is provided elements
+   * at the beginning of the array are excluded from the result as long as the
+   * callback returns truey. The callback is bound to `thisArg` and invoked
+   * with three arguments; (value, index, array).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias drop, tail
+   * @category Arrays
+   * @param {Array} array The array to query.
+   * @param {Function|Object|number|string} [callback=1] The function called
+   *  per element or the number of elements to exclude. If a property name or
+   *  object is provided it will be used to create a "_.pluck" or "_.where"
+   *  style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a slice of `array`.
+   * @example
+   *
+   * _.rest([1, 2, 3]);
+   * // => [2, 3]
+   *
+   * _.rest([1, 2, 3], 2);
+   * // => [3]
+   *
+   * _.rest([1, 2, 3], function(num) {
+   *   return num < 3;
+   * });
+   * // => [3]
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+   *   { 'name': 'fred',    'blocked': false,  'employer': 'slate' },
+   *   { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }
+   * ];
+   *
+   * // using "_.pluck" callback shorthand
+   * _.pluck(_.rest(characters, 'blocked'), 'name');
+   * // => ['fred', 'pebbles']
+   *
+   * // using "_.where" callback shorthand
+   * _.rest(characters, { 'employer': 'slate' });
+   * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+   */
+  function rest(array, callback, thisArg) {
+    if (typeof callback != 'number' && callback != null) {
+      var n = 0,
+          index = -1,
+          length = array ? array.length : 0;
+
+      callback = createCallback(callback, thisArg, 3);
+      while (++index < length && callback(array[index], index, array)) {
+        n++;
+      }
+    } else {
+      n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
+    }
+    return slice(array, n);
+  }
+
+  /**
+   * Uses a binary search to determine the smallest index at which a value
+   * should be inserted into a given sorted array in order to maintain the sort
+   * order of the array. If a callback is provided it will be executed for
+   * `value` and each element of `array` to compute their sort ranking. The
+   * callback is bound to `thisArg` and invoked with one argument; (value).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to inspect.
+   * @param {*} value The value to evaluate.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {number} Returns the index at which `value` should be inserted
+   *  into `array`.
+   * @example
+   *
+   * _.sortedIndex([20, 30, 50], 40);
+   * // => 2
+   *
+   * // using "_.pluck" callback shorthand
+   * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+   * // => 2
+   *
+   * var dict = {
+   *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
+   * };
+   *
+   * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+   *   return dict.wordToNumber[word];
+   * });
+   * // => 2
+   *
+   * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+   *   return this.wordToNumber[word];
+   * }, dict);
+   * // => 2
+   */
+  function sortedIndex(array, value, callback, thisArg) {
+    var low = 0,
+        high = array ? array.length : low;
+
+    // explicitly reference `identity` for better inlining in Firefox
+    callback = callback ? createCallback(callback, thisArg, 1) : identity;
+    value = callback(value);
+
+    while (low < high) {
+      var mid = (low + high) >>> 1;
+      (callback(array[mid]) < value)
+        ? low = mid + 1
+        : high = mid;
+    }
+    return low;
+  }
+
+  /**
+   * Creates an array of unique values, in order, of the provided arrays using
+   * strict equality for comparisons, i.e. `===`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {...Array} [array] The arrays to inspect.
+   * @returns {Array} Returns an array of combined values.
+   * @example
+   *
+   * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+   * // => [1, 2, 3, 5, 4]
+   */
+  function union() {
+    return baseUniq(baseFlatten(arguments, true, true));
+  }
+
+  /**
+   * Creates a duplicate-value-free version of an array using strict equality
+   * for comparisons, i.e. `===`. If the array is sorted, providing
+   * `true` for `isSorted` will use a faster algorithm. If a callback is provided
+   * each element of `array` is passed through the callback before uniqueness
+   * is computed. The callback is bound to `thisArg` and invoked with three
+   * arguments; (value, index, array).
+   *
+   * If a property name is provided for `callback` the created "_.pluck" style
+   * callback will return the property value of the given element.
+   *
+   * If an object is provided for `callback` the created "_.where" style callback
+   * will return `true` for elements that have the properties of the given object,
+   * else `false`.
+   *
+   * @static
+   * @memberOf _
+   * @alias unique
+   * @category Arrays
+   * @param {Array} array The array to process.
+   * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+   * @param {Function|Object|string} [callback=identity] The function called
+   *  per iteration. If a property name or object is provided it will be used
+   *  to create a "_.pluck" or "_.where" style callback, respectively.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns a duplicate-value-free array.
+   * @example
+   *
+   * _.uniq([1, 2, 1, 3, 1]);
+   * // => [1, 2, 3]
+   *
+   * _.uniq([1, 1, 2, 2, 3], true);
+   * // => [1, 2, 3]
+   *
+   * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
+   * // => ['A', 'b', 'C']
+   *
+   * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
+   * // => [1, 2.5, 3]
+   *
+   * // using "_.pluck" callback shorthand
+   * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+   * // => [{ 'x': 1 }, { 'x': 2 }]
+   */
+  function uniq(array, isSorted, callback, thisArg) {
+    // juggle arguments
+    if (typeof isSorted != 'boolean' && isSorted != null) {
+      thisArg = callback;
+      callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;
+      isSorted = false;
+    }
+    if (callback != null) {
+      callback = createCallback(callback, thisArg, 3);
+    }
+    return baseUniq(array, isSorted, callback);
+  }
+
+  /**
+   * Creates an array excluding all provided values using strict equality for
+   * comparisons, i.e. `===`.
+   *
+   * @static
+   * @memberOf _
+   * @category Arrays
+   * @param {Array} array The array to filter.
+   * @param {...*} [value] The values to exclude.
+   * @returns {Array} Returns a new array of filtered values.
+   * @example
+   *
+   * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
+   * // => [2, 3, 4]
+   */
+  function without(array) {
+    return baseDifference(array, slice(arguments, 1));
+  }
+
+  /**
+   * Creates an array of grouped elements, the first of which contains the first
+   * elements of the given arrays, the second of which contains the second
+   * elements of the given arrays, and so on.
+   *
+   * @static
+   * @memberOf _
+   * @alias unzip
+   * @category Arrays
+   * @param {...Array} [array] Arrays to process.
+   * @returns {Array} Returns a new array of grouped elements.
+   * @example
+   *
+   * _.zip(['fred', 'barney'], [30, 40], [true, false]);
+   * // => [['fred', 30, true], ['barney', 40, false]]
+   */
+  function zip() {
+    var index = -1,
+        length = max(pluck(arguments, 'length')),
+        result = Array(length < 0 ? 0 : length);
+
+    while (++index < length) {
+      result[index] = pluck(arguments, index);
+    }
+    return result;
+  }
+
+  /**
+   * Creates an object composed from arrays of `keys` and `values`. Provide
+   * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+   * or two arrays, one of `keys` and one of corresponding `values`.
+   *
+   * @static
+   * @memberOf _
+   * @alias object
+   * @category Arrays
+   * @param {Array} keys The array of keys.
+   * @param {Array} [values=[]] The array of values.
+   * @returns {Object} Returns an object composed of the given keys and
+   *  corresponding values.
+   * @example
+   *
+   * _.zipObject(['fred', 'barney'], [30, 40]);
+   * // => { 'fred': 30, 'barney': 40 }
+   */
+  function zipObject(keys, values) {
+    var index = -1,
+        length = keys ? keys.length : 0,
+        result = {};
+
+    if (!values && length && !isArray(keys[0])) {
+      values = [];
+    }
+    while (++index < length) {
+      var key = keys[index];
+      if (values) {
+        result[key] = values[index];
+      } else if (key) {
+        result[key[0]] = key[1];
+      }
+    }
+    return result;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Creates a function that executes `func`, with  the `this` binding and
+   * arguments of the created function, only after being called `n` times.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {number} n The number of times the function must be called before
+   *  `func` is executed.
+   * @param {Function} func The function to restrict.
+   * @returns {Function} Returns the new restricted function.
+   * @example
+   *
+   * var saves = ['profile', 'settings'];
+   *
+   * var done = _.after(saves.length, function() {
+   *   console.log('Done saving!');
+   * });
+   *
+   * _.forEach(saves, function(type) {
+   *   asyncSave({ 'type': type, 'complete': done });
+   * });
+   * // => logs 'Done saving!', after all saves have completed
+   */
+  function after(n, func) {
+    if (!isFunction(func)) {
+      throw new TypeError;
+    }
+    return function() {
+      if (--n < 1) {
+        return func.apply(this, arguments);
+      }
+    };
+  }
+
+  /**
+   * Creates a function that, when called, invokes `func` with the `this`
+   * binding of `thisArg` and prepends any additional `bind` arguments to those
+   * provided to the bound function.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to bind.
+   * @param {*} [thisArg] The `this` binding of `func`.
+   * @param {...*} [arg] Arguments to be partially applied.
+   * @returns {Function} Returns the new bound function.
+   * @example
+   *
+   * var func = function(greeting) {
+   *   return greeting + ' ' + this.name;
+   * };
+   *
+   * func = _.bind(func, { 'name': 'fred' }, 'hi');
+   * func();
+   * // => 'hi fred'
+   */
+  function bind(func, thisArg) {
+    return arguments.length > 2
+      ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
+      : createWrapper(func, 1, null, null, thisArg);
+  }
+
+  /**
+   * Binds methods of an object to the object itself, overwriting the existing
+   * method. Method names may be specified as individual arguments or as arrays
+   * of method names. If no method names are provided all the function properties
+   * of `object` will be bound.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Object} object The object to bind and assign the bound methods to.
+   * @param {...string} [methodName] The object method names to
+   *  bind, specified as individual method names or arrays of method names.
+   * @returns {Object} Returns `object`.
+   * @example
+   *
+   * var view = {
+   *   'label': 'docs',
+   *   'onClick': function() { console.log('clicked ' + this.label); }
+   * };
+   *
+   * _.bindAll(view);
+   * jQuery('#docs').on('click', view.onClick);
+   * // => logs 'clicked docs', when the button is clicked
+   */
+  function bindAll(object) {
+    var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),
+        index = -1,
+        length = funcs.length;
+
+    while (++index < length) {
+      var key = funcs[index];
+      object[key] = createWrapper(object[key], 1, null, null, object);
+    }
+    return object;
+  }
+
+  /**
+   * Creates a function that is the composition of the provided functions,
+   * where each function consumes the return value of the function that follows.
+   * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
+   * Each function is executed with the `this` binding of the composed function.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {...Function} [func] Functions to compose.
+   * @returns {Function} Returns the new composed function.
+   * @example
+   *
+   * var realNameMap = {
+   *   'pebbles': 'penelope'
+   * };
+   *
+   * var format = function(name) {
+   *   name = realNameMap[name.toLowerCase()] || name;
+   *   return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
+   * };
+   *
+   * var greet = function(formatted) {
+   *   return 'Hiya ' + formatted + '!';
+   * };
+   *
+   * var welcome = _.compose(greet, format);
+   * welcome('pebbles');
+   * // => 'Hiya Penelope!'
+   */
+  function compose() {
+    var funcs = arguments,
+        length = funcs.length;
+
+    while (length--) {
+      if (!isFunction(funcs[length])) {
+        throw new TypeError;
+      }
+    }
+    return function() {
+      var args = arguments,
+          length = funcs.length;
+
+      while (length--) {
+        args = [funcs[length].apply(this, args)];
+      }
+      return args[0];
+    };
+  }
+
+  /**
+   * Creates a function that will delay the execution of `func` until after
+   * `wait` milliseconds have elapsed since the last time it was invoked.
+   * Provide an options object to indicate that `func` should be invoked on
+   * the leading and/or trailing edge of the `wait` timeout. Subsequent calls
+   * to the debounced function will return the result of the last `func` call.
+   *
+   * Note: If `leading` and `trailing` options are `true` `func` will be called
+   * on the trailing edge of the timeout only if the the debounced function is
+   * invoked more than once during the `wait` timeout.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to debounce.
+   * @param {number} wait The number of milliseconds to delay.
+   * @param {Object} [options] The options object.
+   * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout.
+   * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called.
+   * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+   * @returns {Function} Returns the new debounced function.
+   * @example
+   *
+   * // avoid costly calculations while the window size is in flux
+   * var lazyLayout = _.debounce(calculateLayout, 150);
+   * jQuery(window).on('resize', lazyLayout);
+   *
+   * // execute `sendMail` when the click event is fired, debouncing subsequent calls
+   * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+   *   'leading': true,
+   *   'trailing': false
+   * });
+   *
+   * // ensure `batchLog` is executed once after 1 second of debounced calls
+   * var source = new EventSource('/stream');
+   * source.addEventListener('message', _.debounce(batchLog, 250, {
+   *   'maxWait': 1000
+   * }, false);
+   */
+  function debounce(func, wait, options) {
+    var args,
+        maxTimeoutId,
+        result,
+        stamp,
+        thisArg,
+        timeoutId,
+        trailingCall,
+        lastCalled = 0,
+        maxWait = false,
+        trailing = true;
+
+    if (!isFunction(func)) {
+      throw new TypeError;
+    }
+    wait = nativeMax(0, wait) || 0;
+    if (options === true) {
+      var leading = true;
+      trailing = false;
+    } else if (isObject(options)) {
+      leading = options.leading;
+      maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);
+      trailing = 'trailing' in options ? options.trailing : trailing;
+    }
+    var delayed = function() {
+      var remaining = wait - (now() - stamp);
+      if (remaining <= 0) {
+        if (maxTimeoutId) {
+          clearTimeout(maxTimeoutId);
+        }
+        var isCalled = trailingCall;
+        maxTimeoutId = timeoutId = trailingCall = undefined;
+        if (isCalled) {
+          lastCalled = now();
+          result = func.apply(thisArg, args);
+          if (!timeoutId && !maxTimeoutId) {
+            args = thisArg = null;
+          }
+        }
+      } else {
+        timeoutId = setTimeout(delayed, remaining);
+      }
+    };
+
+    var maxDelayed = function() {
+      if (timeoutId) {
+        clearTimeout(timeoutId);
+      }
+      maxTimeoutId = timeoutId = trailingCall = undefined;
+      if (trailing || (maxWait !== wait)) {
+        lastCalled = now();
+        result = func.apply(thisArg, args);
+        if (!timeoutId && !maxTimeoutId) {
+          args = thisArg = null;
+        }
+      }
+    };
+
+    return function() {
+      args = arguments;
+      stamp = now();
+      thisArg = this;
+      trailingCall = trailing && (timeoutId || !leading);
+
+      if (maxWait === false) {
+        var leadingCall = leading && !timeoutId;
+      } else {
+        if (!maxTimeoutId && !leading) {
+          lastCalled = stamp;
+        }
+        var remaining = maxWait - (stamp - lastCalled),
+            isCalled = remaining <= 0;
+
+        if (isCalled) {
+          if (maxTimeoutId) {
+            maxTimeoutId = clearTimeout(maxTimeoutId);
+          }
+          lastCalled = stamp;
+          result = func.apply(thisArg, args);
+        }
+        else if (!maxTimeoutId) {
+          maxTimeoutId = setTimeout(maxDelayed, remaining);
+        }
+      }
+      if (isCalled && timeoutId) {
+        timeoutId = clearTimeout(timeoutId);
+      }
+      else if (!timeoutId && wait !== maxWait) {
+        timeoutId = setTimeout(delayed, wait);
+      }
+      if (leadingCall) {
+        isCalled = true;
+        result = func.apply(thisArg, args);
+      }
+      if (isCalled && !timeoutId && !maxTimeoutId) {
+        args = thisArg = null;
+      }
+      return result;
+    };
+  }
+
+  /**
+   * Defers executing the `func` function until the current call stack has cleared.
+   * Additional arguments will be provided to `func` when it is invoked.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to defer.
+   * @param {...*} [arg] Arguments to invoke the function with.
+   * @returns {number} Returns the timer id.
+   * @example
+   *
+   * _.defer(function(text) { console.log(text); }, 'deferred');
+   * // logs 'deferred' after one or more milliseconds
+   */
+  function defer(func) {
+    if (!isFunction(func)) {
+      throw new TypeError;
+    }
+    var args = slice(arguments, 1);
+    return setTimeout(function() { func.apply(undefined, args); }, 1);
+  }
+
+  /**
+   * Executes the `func` function after `wait` milliseconds. Additional arguments
+   * will be provided to `func` when it is invoked.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to delay.
+   * @param {number} wait The number of milliseconds to delay execution.
+   * @param {...*} [arg] Arguments to invoke the function with.
+   * @returns {number} Returns the timer id.
+   * @example
+   *
+   * _.delay(function(text) { console.log(text); }, 1000, 'later');
+   * // => logs 'later' after one second
+   */
+  function delay(func, wait) {
+    if (!isFunction(func)) {
+      throw new TypeError;
+    }
+    var args = slice(arguments, 2);
+    return setTimeout(function() { func.apply(undefined, args); }, wait);
+  }
+
+  /**
+   * Creates a function that memoizes the result of `func`. If `resolver` is
+   * provided it will be used to determine the cache key for storing the result
+   * based on the arguments provided to the memoized function. By default, the
+   * first argument provided to the memoized function is used as the cache key.
+   * The `func` is executed with the `this` binding of the memoized function.
+   * The result cache is exposed as the `cache` property on the memoized function.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to have its output memoized.
+   * @param {Function} [resolver] A function used to resolve the cache key.
+   * @returns {Function} Returns the new memoizing function.
+   * @example
+   *
+   * var fibonacci = _.memoize(function(n) {
+   *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
+   * });
+   *
+   * fibonacci(9)
+   * // => 34
+   *
+   * var data = {
+   *   'fred': { 'name': 'fred', 'age': 40 },
+   *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+   * };
+   *
+   * // modifying the result cache
+   * var get = _.memoize(function(name) { return data[name]; }, _.identity);
+   * get('pebbles');
+   * // => { 'name': 'pebbles', 'age': 1 }
+   *
+   * get.cache.pebbles.name = 'penelope';
+   * get('pebbles');
+   * // => { 'name': 'penelope', 'age': 1 }
+   */
+  function memoize(func, resolver) {
+    var cache = {};
+    return function() {
+      var key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];
+      return hasOwnProperty.call(cache, key)
+        ? cache[key]
+        : (cache[key] = func.apply(this, arguments));
+    };
+  }
+
+  /**
+   * Creates a function that is restricted to execute `func` once. Repeat calls to
+   * the function will return the value of the first call. The `func` is executed
+   * with the `this` binding of the created function.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to restrict.
+   * @returns {Function} Returns the new restricted function.
+   * @example
+   *
+   * var initialize = _.once(createApplication);
+   * initialize();
+   * initialize();
+   * // `initialize` executes `createApplication` once
+   */
+  function once(func) {
+    var ran,
+        result;
+
+    if (!isFunction(func)) {
+      throw new TypeError;
+    }
+    return function() {
+      if (ran) {
+        return result;
+      }
+      ran = true;
+      result = func.apply(this, arguments);
+
+      // clear the `func` variable so the function may be garbage collected
+      func = null;
+      return result;
+    };
+  }
+
+  /**
+   * Creates a function that, when called, invokes `func` with any additional
+   * `partial` arguments prepended to those provided to the new function. This
+   * method is similar to `_.bind` except it does **not** alter the `this` binding.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to partially apply arguments to.
+   * @param {...*} [arg] Arguments to be partially applied.
+   * @returns {Function} Returns the new partially applied function.
+   * @example
+   *
+   * var greet = function(greeting, name) { return greeting + ' ' + name; };
+   * var hi = _.partial(greet, 'hi');
+   * hi('fred');
+   * // => 'hi fred'
+   */
+  function partial(func) {
+    return createWrapper(func, 16, slice(arguments, 1));
+  }
+
+  /**
+   * Creates a function that, when executed, will only call the `func` function
+   * at most once per every `wait` milliseconds. Provide an options object to
+   * indicate that `func` should be invoked on the leading and/or trailing edge
+   * of the `wait` timeout. Subsequent calls to the throttled function will
+   * return the result of the last `func` call.
+   *
+   * Note: If `leading` and `trailing` options are `true` `func` will be called
+   * on the trailing edge of the timeout only if the the throttled function is
+   * invoked more than once during the `wait` timeout.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {Function} func The function to throttle.
+   * @param {number} wait The number of milliseconds to throttle executions to.
+   * @param {Object} [options] The options object.
+   * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout.
+   * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+   * @returns {Function} Returns the new throttled function.
+   * @example
+   *
+   * // avoid excessively updating the position while scrolling
+   * var throttled = _.throttle(updatePosition, 100);
+   * jQuery(window).on('scroll', throttled);
+   *
+   * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes
+   * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+   *   'trailing': false
+   * }));
+   */
+  function throttle(func, wait, options) {
+    var leading = true,
+        trailing = true;
+
+    if (!isFunction(func)) {
+      throw new TypeError;
+    }
+    if (options === false) {
+      leading = false;
+    } else if (isObject(options)) {
+      leading = 'leading' in options ? options.leading : leading;
+      trailing = 'trailing' in options ? options.trailing : trailing;
+    }
+    options = {};
+    options.leading = leading;
+    options.maxWait = wait;
+    options.trailing = trailing;
+
+    return debounce(func, wait, options);
+  }
+
+  /**
+   * Creates a function that provides `value` to the wrapper function as its
+   * first argument. Additional arguments provided to the function are appended
+   * to those provided to the wrapper function. The wrapper is executed with
+   * the `this` binding of the created function.
+   *
+   * @static
+   * @memberOf _
+   * @category Functions
+   * @param {*} value The value to wrap.
+   * @param {Function} wrapper The wrapper function.
+   * @returns {Function} Returns the new function.
+   * @example
+   *
+   * var p = _.wrap(_.escape, function(func, text) {
+   *   return '<p>' + func(text) + '</p>';
+   * });
+   *
+   * p('Fred, Wilma, & Pebbles');
+   * // => '<p>Fred, Wilma, &amp; Pebbles</p>'
+   */
+  function wrap(value, wrapper) {
+    return createWrapper(wrapper, 16, [value]);
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Produces a callback bound to an optional `thisArg`. If `func` is a property
+   * name the created callback will return the property value for a given element.
+   * If `func` is an object the created callback will return `true` for elements
+   * that contain the equivalent object properties, otherwise it will return `false`.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {*} [func=identity] The value to convert to a callback.
+   * @param {*} [thisArg] The `this` binding of the created callback.
+   * @param {number} [argCount] The number of arguments the callback accepts.
+   * @returns {Function} Returns a callback function.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * // wrap to create custom callback shorthands
+   * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
+   *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
+   *   return !match ? func(callback, thisArg) : function(object) {
+   *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
+   *   };
+   * });
+   *
+   * _.filter(characters, 'age__gt38');
+   * // => [{ 'name': 'fred', 'age': 40 }]
+   */
+  function createCallback(func, thisArg, argCount) {
+    var type = typeof func;
+    if (func == null || type == 'function') {
+      return baseCreateCallback(func, thisArg, argCount);
+    }
+    // handle "_.pluck" style callback shorthands
+    if (type != 'object') {
+      return property(func);
+    }
+    var props = keys(func);
+    return function(object) {
+      var length = props.length,
+          result = false;
+
+      while (length--) {
+        if (!(result = object[props[length]] === func[props[length]])) {
+          break;
+        }
+      }
+      return result;
+    };
+  }
+
+  /**
+   * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
+   * corresponding HTML entities.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {string} string The string to escape.
+   * @returns {string} Returns the escaped string.
+   * @example
+   *
+   * _.escape('Fred, Wilma, & Pebbles');
+   * // => 'Fred, Wilma, &amp; Pebbles'
+   */
+  function escape(string) {
+    return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+  }
+
+  /**
+   * This method returns the first argument provided to it.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {*} value Any value.
+   * @returns {*} Returns `value`.
+   * @example
+   *
+   * var object = { 'name': 'fred' };
+   * _.identity(object) === object;
+   * // => true
+   */
+  function identity(value) {
+    return value;
+  }
+
+  /**
+   * Adds function properties of a source object to the destination object.
+   * If `object` is a function methods will be added to its prototype as well.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {Function|Object} [object=lodash] object The destination object.
+   * @param {Object} source The object of functions to add.
+   * @param {Object} [options] The options object.
+   * @param {boolean} [options.chain=true] Specify whether the functions added are chainable.
+   * @example
+   *
+   * function capitalize(string) {
+   *   return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
+   * }
+   *
+   * _.mixin({ 'capitalize': capitalize });
+   * _.capitalize('fred');
+   * // => 'Fred'
+   *
+   * _('fred').capitalize().value();
+   * // => 'Fred'
+   *
+   * _.mixin({ 'capitalize': capitalize }, { 'chain': false });
+   * _('fred').capitalize();
+   * // => 'Fred'
+   */
+  function mixin(object) {
+    forEach(functions(object), function(methodName) {
+      var func = lodash[methodName] = object[methodName];
+
+      lodash.prototype[methodName] = function() {
+        var args = [this.__wrapped__];
+        push.apply(args, arguments);
+
+        var result = func.apply(lodash, args);
+        return this.__chain__
+          ? new lodashWrapper(result, true)
+          : result;
+      };
+    });
+  }
+
+  /**
+   * Reverts the '_' variable to its previous value and returns a reference to
+   * the `lodash` function.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @returns {Function} Returns the `lodash` function.
+   * @example
+   *
+   * var lodash = _.noConflict();
+   */
+  function noConflict() {
+    root._ = oldDash;
+    return this;
+  }
+
+  /**
+   * A no-operation function.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @example
+   *
+   * var object = { 'name': 'fred' };
+   * _.noop(object) === undefined;
+   * // => true
+   */
+  function noop() {
+    // no operation performed
+  }
+
+  /**
+   * Gets the number of milliseconds that have elapsed since the Unix epoch
+   * (1 January 1970 00:00:00 UTC).
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @example
+   *
+   * var stamp = _.now();
+   * _.defer(function() { console.log(_.now() - stamp); });
+   * // => logs the number of milliseconds it took for the deferred function to be called
+   */
+  var now = isNative(now = Date.now) && now || function() {
+    return new Date().getTime();
+  };
+
+  /**
+   * Creates a "_.pluck" style function, which returns the `key` value of a
+   * given object.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {string} key The name of the property to retrieve.
+   * @returns {Function} Returns the new function.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'fred',   'age': 40 },
+   *   { 'name': 'barney', 'age': 36 }
+   * ];
+   *
+   * var getName = _.property('name');
+   *
+   * _.map(characters, getName);
+   * // => ['barney', 'fred']
+   *
+   * _.sortBy(characters, getName);
+   * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred',   'age': 40 }]
+   */
+  function property(key) {
+    return function(object) {
+      return object[key];
+    };
+  }
+
+  /**
+   * Produces a random number between `min` and `max` (inclusive). If only one
+   * argument is provided a number between `0` and the given number will be
+   * returned. If `floating` is truey or either `min` or `max` are floats a
+   * floating-point number will be returned instead of an integer.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {number} [min=0] The minimum possible value.
+   * @param {number} [max=1] The maximum possible value.
+   * @param {boolean} [floating=false] Specify returning a floating-point number.
+   * @returns {number} Returns a random number.
+   * @example
+   *
+   * _.random(0, 5);
+   * // => an integer between 0 and 5
+   *
+   * _.random(5);
+   * // => also an integer between 0 and 5
+   *
+   * _.random(5, true);
+   * // => a floating-point number between 0 and 5
+   *
+   * _.random(1.2, 5.2);
+   * // => a floating-point number between 1.2 and 5.2
+   */
+  function random(min, max) {
+    if (min == null && max == null) {
+      max = 1;
+    }
+    min = +min || 0;
+    if (max == null) {
+      max = min;
+      min = 0;
+    } else {
+      max = +max || 0;
+    }
+    return min + floor(nativeRandom() * (max - min + 1));
+  }
+
+  /**
+   * Resolves the value of property `key` on `object`. If `key` is a function
+   * it will be invoked with the `this` binding of `object` and its result returned,
+   * else the property value is returned. If `object` is falsey then `undefined`
+   * is returned.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {Object} object The object to inspect.
+   * @param {string} key The name of the property to resolve.
+   * @returns {*} Returns the resolved value.
+   * @example
+   *
+   * var object = {
+   *   'cheese': 'crumpets',
+   *   'stuff': function() {
+   *     return 'nonsense';
+   *   }
+   * };
+   *
+   * _.result(object, 'cheese');
+   * // => 'crumpets'
+   *
+   * _.result(object, 'stuff');
+   * // => 'nonsense'
+   */
+  function result(object, key) {
+    if (object) {
+      var value = object[key];
+      return isFunction(value) ? object[key]() : value;
+    }
+  }
+
+  /**
+   * A micro-templating method that handles arbitrary delimiters, preserves
+   * whitespace, and correctly escapes quotes within interpolated code.
+   *
+   * Note: In the development build, `_.template` utilizes sourceURLs for easier
+   * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+   *
+   * For more information on precompiling templates see:
+   * http://lodash.com/custom-builds
+   *
+   * For more information on Chrome extension sandboxes see:
+   * http://developer.chrome.com/stable/extensions/sandboxingEval.html
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {string} text The template text.
+   * @param {Object} data The data object used to populate the text.
+   * @param {Object} [options] The options object.
+   * @param {RegExp} [options.escape] The "escape" delimiter.
+   * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
+   * @param {Object} [options.imports] An object to import into the template as local variables.
+   * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
+   * @param {string} [sourceURL] The sourceURL of the template's compiled source.
+   * @param {string} [variable] The data object variable name.
+   * @returns {Function|string} Returns a compiled function when no `data` object
+   *  is given, else it returns the interpolated text.
+   * @example
+   *
+   * // using the "interpolate" delimiter to create a compiled template
+   * var compiled = _.template('hello <%= name %>');
+   * compiled({ 'name': 'fred' });
+   * // => 'hello fred'
+   *
+   * // using the "escape" delimiter to escape HTML in data property values
+   * _.template('<b><%- value %></b>', { 'value': '<script>' });
+   * // => '<b>&lt;script&gt;</b>'
+   *
+   * // using the "evaluate" delimiter to generate HTML
+   * var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';
+   * _.template(list, { 'people': ['fred', 'barney'] });
+   * // => '<li>fred</li><li>barney</li>'
+   *
+   * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+   * _.template('hello ${ name }', { 'name': 'pebbles' });
+   * // => 'hello pebbles'
+   *
+   * // using the internal `print` function in "evaluate" delimiters
+   * _.template('<% print("hello " + name); %>!', { 'name': 'barney' });
+   * // => 'hello barney!'
+   *
+   * // using a custom template delimiters
+   * _.templateSettings = {
+   *   'interpolate': /{{([\s\S]+?)}}/g
+   * };
+   *
+   * _.template('hello {{ name }}!', { 'name': 'mustache' });
+   * // => 'hello mustache!'
+   *
+   * // using the `imports` option to import jQuery
+   * var list = '<% jq.each(people, function(name) { %><li><%- name %></li><% }); %>';
+   * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });
+   * // => '<li>fred</li><li>barney</li>'
+   *
+   * // using the `sourceURL` option to specify a custom sourceURL for the template
+   * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
+   * compiled(data);
+   * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+   *
+   * // using the `variable` option to ensure a with-statement isn't used in the compiled template
+   * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });
+   * compiled.source;
+   * // => function(data) {
+   *   var __t, __p = '', __e = _.escape;
+   *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
+   *   return __p;
+   * }
+   *
+   * // using the `source` property to inline compiled templates for meaningful
+   * // line numbers in error messages and a stack trace
+   * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+   *   var JST = {\
+   *     "main": ' + _.template(mainText).source + '\
+   *   };\
+   * ');
+   */
+  function template(text, data, options) {
+    var _ = lodash,
+        settings = _.templateSettings;
+
+    text = String(text || '');
+    options = defaults({}, options, settings);
+
+    var index = 0,
+        source = "__p += '",
+        variable = options.variable;
+
+    var reDelimiters = RegExp(
+      (options.escape || reNoMatch).source + '|' +
+      (options.interpolate || reNoMatch).source + '|' +
+      (options.evaluate || reNoMatch).source + '|$'
+    , 'g');
+
+    text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {
+      source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+      if (escapeValue) {
+        source += "' +\n_.escape(" + escapeValue + ") +\n'";
+      }
+      if (evaluateValue) {
+        source += "';\n" + evaluateValue + ";\n__p += '";
+      }
+      if (interpolateValue) {
+        source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+      }
+      index = offset + match.length;
+      return match;
+    });
+
+    source += "';\n";
+    if (!variable) {
+      variable = 'obj';
+      source = 'with (' + variable + ' || {}) {\n' + source + '\n}\n';
+    }
+    source = 'function(' + variable + ') {\n' +
+      "var __t, __p = '', __j = Array.prototype.join;\n" +
+      "function print() { __p += __j.call(arguments, '') }\n" +
+      source +
+      'return __p\n}';
+
+    try {
+      var result = Function('_', 'return ' + source)(_);
+    } catch(e) {
+      e.source = source;
+      throw e;
+    }
+    if (data) {
+      return result(data);
+    }
+    result.source = source;
+    return result;
+  }
+
+  /**
+   * Executes the callback `n` times, returning an array of the results
+   * of each callback execution. The callback is bound to `thisArg` and invoked
+   * with one argument; (index).
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {number} n The number of times to execute the callback.
+   * @param {Function} callback The function called per iteration.
+   * @param {*} [thisArg] The `this` binding of `callback`.
+   * @returns {Array} Returns an array of the results of each `callback` execution.
+   * @example
+   *
+   * var diceRolls = _.times(3, _.partial(_.random, 1, 6));
+   * // => [3, 6, 4]
+   *
+   * _.times(3, function(n) { mage.castSpell(n); });
+   * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+   *
+   * _.times(3, function(n) { this.cast(n); }, mage);
+   * // => also calls `mage.castSpell(n)` three times
+   */
+  function times(n, callback, thisArg) {
+    n = (n = +n) > -1 ? n : 0;
+    var index = -1,
+        result = Array(n);
+
+    callback = baseCreateCallback(callback, thisArg, 1);
+    while (++index < n) {
+      result[index] = callback(index);
+    }
+    return result;
+  }
+
+  /**
+   * The inverse of `_.escape` this method converts the HTML entities
+   * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
+   * corresponding characters.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {string} string The string to unescape.
+   * @returns {string} Returns the unescaped string.
+   * @example
+   *
+   * _.unescape('Fred, Barney &amp; Pebbles');
+   * // => 'Fred, Barney & Pebbles'
+   */
+  function unescape(string) {
+    return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
+  }
+
+  /**
+   * Generates a unique ID. If `prefix` is provided the ID will be appended to it.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {string} [prefix] The value to prefix the ID with.
+   * @returns {string} Returns the unique ID.
+   * @example
+   *
+   * _.uniqueId('contact_');
+   * // => 'contact_104'
+   *
+   * _.uniqueId();
+   * // => '105'
+   */
+  function uniqueId(prefix) {
+    var id = ++idCounter + '';
+    return prefix ? prefix + id : id;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Creates a `lodash` object that wraps the given value with explicit
+   * method chaining enabled.
+   *
+   * @static
+   * @memberOf _
+   * @category Chaining
+   * @param {*} value The value to wrap.
+   * @returns {Object} Returns the wrapper object.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney',  'age': 36 },
+   *   { 'name': 'fred',    'age': 40 },
+   *   { 'name': 'pebbles', 'age': 1 }
+   * ];
+   *
+   * var youngest = _.chain(characters)
+   *     .sortBy('age')
+   *     .map(function(chr) { return chr.name + ' is ' + chr.age; })
+   *     .first()
+   *     .value();
+   * // => 'pebbles is 1'
+   */
+  function chain(value) {
+    value = new lodashWrapper(value);
+    value.__chain__ = true;
+    return value;
+  }
+
+  /**
+   * Invokes `interceptor` with the `value` as the first argument and then
+   * returns `value`. The purpose of this method is to "tap into" a method
+   * chain in order to perform operations on intermediate results within
+   * the chain.
+   *
+   * @static
+   * @memberOf _
+   * @category Chaining
+   * @param {*} value The value to provide to `interceptor`.
+   * @param {Function} interceptor The function to invoke.
+   * @returns {*} Returns `value`.
+   * @example
+   *
+   * _([1, 2, 3, 4])
+   *  .tap(function(array) { array.pop(); })
+   *  .reverse()
+   *  .value();
+   * // => [3, 2, 1]
+   */
+  function tap(value, interceptor) {
+    interceptor(value);
+    return value;
+  }
+
+  /**
+   * Enables explicit method chaining on the wrapper object.
+   *
+   * @name chain
+   * @memberOf _
+   * @category Chaining
+   * @returns {*} Returns the wrapper object.
+   * @example
+   *
+   * var characters = [
+   *   { 'name': 'barney', 'age': 36 },
+   *   { 'name': 'fred',   'age': 40 }
+   * ];
+   *
+   * // without explicit chaining
+   * _(characters).first();
+   * // => { 'name': 'barney', 'age': 36 }
+   *
+   * // with explicit chaining
+   * _(characters).chain()
+   *   .first()
+   *   .pick('age')
+   *   .value();
+   * // => { 'age': 36 }
+   */
+  function wrapperChain() {
+    this.__chain__ = true;
+    return this;
+  }
+
+  /**
+   * Extracts the wrapped value.
+   *
+   * @name valueOf
+   * @memberOf _
+   * @alias value
+   * @category Chaining
+   * @returns {*} Returns the wrapped value.
+   * @example
+   *
+   * _([1, 2, 3]).valueOf();
+   * // => [1, 2, 3]
+   */
+  function wrapperValueOf() {
+    return this.__wrapped__;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  // add functions that return wrapped values when chaining
+  lodash.after = after;
+  lodash.bind = bind;
+  lodash.bindAll = bindAll;
+  lodash.chain = chain;
+  lodash.compact = compact;
+  lodash.compose = compose;
+  lodash.countBy = countBy;
+  lodash.debounce = debounce;
+  lodash.defaults = defaults;
+  lodash.defer = defer;
+  lodash.delay = delay;
+  lodash.difference = difference;
+  lodash.filter = filter;
+  lodash.flatten = flatten;
+  lodash.forEach = forEach;
+  lodash.functions = functions;
+  lodash.groupBy = groupBy;
+  lodash.indexBy = indexBy;
+  lodash.initial = initial;
+  lodash.intersection = intersection;
+  lodash.invert = invert;
+  lodash.invoke = invoke;
+  lodash.keys = keys;
+  lodash.map = map;
+  lodash.max = max;
+  lodash.memoize = memoize;
+  lodash.min = min;
+  lodash.omit = omit;
+  lodash.once = once;
+  lodash.pairs = pairs;
+  lodash.partial = partial;
+  lodash.pick = pick;
+  lodash.pluck = pluck;
+  lodash.range = range;
+  lodash.reject = reject;
+  lodash.rest = rest;
+  lodash.shuffle = shuffle;
+  lodash.sortBy = sortBy;
+  lodash.tap = tap;
+  lodash.throttle = throttle;
+  lodash.times = times;
+  lodash.toArray = toArray;
+  lodash.union = union;
+  lodash.uniq = uniq;
+  lodash.values = values;
+  lodash.where = where;
+  lodash.without = without;
+  lodash.wrap = wrap;
+  lodash.zip = zip;
+
+  // add aliases
+  lodash.collect = map;
+  lodash.drop = rest;
+  lodash.each = forEach;
+  lodash.extend = assign;
+  lodash.methods = functions;
+  lodash.object = zipObject;
+  lodash.select = filter;
+  lodash.tail = rest;
+  lodash.unique = uniq;
+
+  /*--------------------------------------------------------------------------*/
+
+  // add functions that return unwrapped values when chaining
+  lodash.clone = clone;
+  lodash.contains = contains;
+  lodash.escape = escape;
+  lodash.every = every;
+  lodash.find = find;
+  lodash.has = has;
+  lodash.identity = identity;
+  lodash.indexOf = indexOf;
+  lodash.isArguments = isArguments;
+  lodash.isArray = isArray;
+  lodash.isBoolean = isBoolean;
+  lodash.isDate = isDate;
+  lodash.isElement = isElement;
+  lodash.isEmpty = isEmpty;
+  lodash.isEqual = isEqual;
+  lodash.isFinite = isFinite;
+  lodash.isFunction = isFunction;
+  lodash.isNaN = isNaN;
+  lodash.isNull = isNull;
+  lodash.isNumber = isNumber;
+  lodash.isObject = isObject;
+  lodash.isRegExp = isRegExp;
+  lodash.isString = isString;
+  lodash.isUndefined = isUndefined;
+  lodash.lastIndexOf = lastIndexOf;
+  lodash.mixin = mixin;
+  lodash.noConflict = noConflict;
+  lodash.random = random;
+  lodash.reduce = reduce;
+  lodash.reduceRight = reduceRight;
+  lodash.result = result;
+  lodash.size = size;
+  lodash.some = some;
+  lodash.sortedIndex = sortedIndex;
+  lodash.template = template;
+  lodash.unescape = unescape;
+  lodash.uniqueId = uniqueId;
+
+  // add aliases
+  lodash.all = every;
+  lodash.any = some;
+  lodash.detect = find;
+  lodash.findWhere = findWhere;
+  lodash.foldl = reduce;
+  lodash.foldr = reduceRight;
+  lodash.include = contains;
+  lodash.inject = reduce;
+
+  /*--------------------------------------------------------------------------*/
+
+  // add functions capable of returning wrapped and unwrapped values when chaining
+  lodash.first = first;
+  lodash.last = last;
+  lodash.sample = sample;
+
+  // add aliases
+  lodash.take = first;
+  lodash.head = first;
+
+  /*--------------------------------------------------------------------------*/
+
+  // add functions to `lodash.prototype`
+  mixin(lodash);
+
+  /**
+   * The semantic version number.
+   *
+   * @static
+   * @memberOf _
+   * @type string
+   */
+  lodash.VERSION = '2.4.1';
+
+  // add "Chaining" functions to the wrapper
+  lodash.prototype.chain = wrapperChain;
+  lodash.prototype.value = wrapperValueOf;
+
+    // add `Array` mutator functions to the wrapper
+    forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        var value = this.__wrapped__;
+        func.apply(value, arguments);
+
+        // avoid array-like object bugs with `Array#shift` and `Array#splice`
+        // in Firefox < 10 and IE < 9
+        if (!support.spliceObjects && value.length === 0) {
+          delete value[0];
+        }
+        return this;
+      };
+    });
+
+    // add `Array` accessor functions to the wrapper
+    forEach(['concat', 'join', 'slice'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        var value = this.__wrapped__,
+            result = func.apply(value, arguments);
+
+        if (this.__chain__) {
+          result = new lodashWrapper(result);
+          result.__chain__ = true;
+        }
+        return result;
+      };
+    });
+
+  /*--------------------------------------------------------------------------*/
+
+  // some AMD build optimizers like r.js check for condition patterns like the following:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lo-Dash to the global object even when an AMD loader is present in
+    // case Lo-Dash is loaded with a RequireJS shim config.
+    // See http://requirejs.org/docs/api.html#config-shim
+    root._ = lodash;
+
+    // define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module
+    define(function() {
+      return lodash;
+    });
+  }
+  // check for `exports` after `define` in case a build optimizer adds an `exports` object
+  else if (freeExports && freeModule) {
+    // in Node.js or RingoJS
+    if (moduleExports) {
+      (freeModule.exports = lodash)._ = lodash;
+    }
+    // in Narwhal or Rhino -require
+    else {
+      freeExports._ = lodash;
+    }
+  }
+  else {
+    // in a browser or Rhino
+    root._ = lodash;
+  }
+}.call(this));
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.underscore.min.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/dist/lodash.underscore.min.js
new file mode 100755 (executable)
index 0000000..e659124
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE
+ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js`
+ */
+;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++t<e;)if(n[t]===r)return t;return-1}function r(n,r){for(var t=n.m,e=r.m,u=-1,o=t.length;++u<o;){var i=t[u],f=e[u];if(i!==f){if(i>f||typeof i=="undefined")return 1;if(i<f||typeof f=="undefined")return-1}}return n.n-r.n}function t(n){return"\\"+yr[n]}function e(n,r,t){r||(r=0),typeof t=="undefined"&&(t=n?n.length:0);var e=-1;t=t-r||0;for(var u=Array(0>t?0:t);++e<t;)u[e]=n[r+e];return u}function u(n){return n instanceof u?n:new o(n)}function o(n,r){this.__chain__=!!r,this.__wrapped__=n
+}function i(n){function r(){if(u){var n=e(u);Rr.apply(n,arguments)}if(this instanceof r){var i=f(t.prototype),n=t.apply(i,n||arguments);return O(n)?n:i}return t.apply(o,n||arguments)}var t=n[0],u=n[2],o=n[4];return r}function f(n){return O(n)?Br(n):{}}function a(n,r,t){if(typeof n!="function")return Y;if(typeof r=="undefined"||!("prototype"in n))return n;switch(t){case 1:return function(t){return n.call(r,t)};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,u){return n.call(r,t,e,u)
+};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return L(n,r)}function l(n){function r(){var n=p?a:this;if(o){var y=e(o);Rr.apply(y,arguments)}return(i||g)&&(y||(y=e(arguments)),i&&Rr.apply(y,i),g&&y.length<c)?(u|=16,l([t,h?u:-4&u,y,null,a,c])):(y||(y=arguments),s&&(t=n[v]),this instanceof r?(n=f(t.prototype),y=t.apply(n,y),O(y)?y:n):t.apply(n,y))}var t=n[0],u=n[1],o=n[2],i=n[3],a=n[4],c=n[5],p=1&u,s=2&u,g=4&u,h=8&u,v=t;return r}function c(n,r){for(var t=-1,e=m(),u=n?n.length:0,o=[];++t<u;){var i=n[t];
+0>e(r,i)&&o.push(i)}return o}function p(n,r,t,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e<u;){var i=n[e];if(i&&typeof i=="object"&&typeof i.length=="number"&&(Cr(i)||b(i))){r||(i=p(i,r,t));var f=-1,a=i.length,l=o.length;for(o.length+=a;++f<a;)o[l++]=i[f]}else t||o.push(i)}return o}function s(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(n===n&&!(n&&vr[typeof n]||r&&vr[typeof r]))return false;if(null==n||null==r)return n===r;var o=Er.call(n),i=Er.call(r);if(o!=i)return false;switch(o){case lr:case cr:return+n==+r;
+case pr:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;case gr:case hr:return n==r+""}if(i=o==ar,!i){var f=n instanceof u,a=r instanceof u;if(f||a)return s(f?n.__wrapped__:n,a?r.__wrapped__:r,t,e);if(o!=sr)return false;if(o=n.constructor,f=r.constructor,o!=f&&!(A(o)&&o instanceof o&&A(f)&&f instanceof f)&&"constructor"in n&&"constructor"in r)return false}for(t||(t=[]),e||(e=[]),o=t.length;o--;)if(t[o]==n)return e[o]==r;var l=true,c=0;if(t.push(n),e.push(r),i){if(c=r.length,l=c==n.length)for(;c--&&(l=s(n[c],r[c],t,e)););}else Kr(r,function(r,u,o){return Nr.call(o,u)?(c++,!(l=Nr.call(n,u)&&s(n[u],r,t,e))&&er):void 0
+}),l&&Kr(n,function(n,r,t){return Nr.call(t,r)?!(l=-1<--c)&&er:void 0});return t.pop(),e.pop(),l}function g(n,r,t){for(var e=-1,u=m(),o=n?n.length:0,i=[],f=t?[]:i;++e<o;){var a=n[e],l=t?t(a,e,n):a;(r?!e||f[f.length-1]!==l:0>u(f,l))&&(t&&f.push(l),i.push(a))}return i}function h(n){return function(r,t,e){var u={};t=X(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++e<o;){var i=r[e];n(u,i,t(i,e,r),r)}else Lr(r,function(r,e,o){n(u,r,t(r,e,o),o)});return u}}function v(n,r,t,e,u,o){var f=16&r,a=32&r;
+if(!(2&r||A(n)))throw new TypeError;return f&&!t.length&&(r&=-17,t=false),a&&!e.length&&(r&=-33,e=false),(1==r||17===r?i:l)([n,r,t,e,u,o])}function y(n){return Vr[n]}function m(){var r=(r=u.indexOf)===G?n:r;return r}function _(n){return typeof n=="function"&&Ar.test(n)}function d(n){return Gr[n]}function b(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Er.call(n)==fr||false}function w(n){if(!n)return n;for(var r=1,t=arguments.length;r<t;r++){var e=arguments[r];if(e)for(var u in e)n[u]=e[u]}return n
+}function j(n){if(!n)return n;for(var r=1,t=arguments.length;r<t;r++){var e=arguments[r];if(e)for(var u in e)"undefined"==typeof n[u]&&(n[u]=e[u])}return n}function x(n){var r=[];return Kr(n,function(n,t){A(n)&&r.push(t)}),r.sort()}function T(n){for(var r=-1,t=Ur(n),e=t.length,u={};++r<e;){var o=t[r];u[n[o]]=o}return u}function E(n){if(!n)return true;if(Cr(n)||N(n))return!n.length;for(var r in n)if(Nr.call(n,r))return false;return true}function A(n){return typeof n=="function"}function O(n){return!(!n||!vr[typeof n])
+}function S(n){return typeof n=="number"||n&&typeof n=="object"&&Er.call(n)==pr||false}function N(n){return typeof n=="string"||n&&typeof n=="object"&&Er.call(n)==hr||false}function R(n){for(var r=-1,t=Ur(n),e=t.length,u=Array(e);++r<e;)u[r]=n[t[r]];return u}function k(n,r){var t=m(),e=n?n.length:0,u=false;return e&&typeof e=="number"?u=-1<t(n,r):Lr(n,function(n){return(u=n===r)&&er}),u}function B(n,r,t){var e=true;r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&(e=!!r(n[t],t,n)););else Lr(n,function(n,t,u){return!(e=!!r(n,t,u))&&er
+});return e}function F(n,r,t){var e=[];r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u;){var o=n[t];r(o,t,n)&&e.push(o)}else Lr(n,function(n,t,u){r(n,t,u)&&e.push(n)});return e}function q(n,r,t){r=X(r,t,3),t=-1;var e=n?n.length:0;if(typeof e!="number"){var u;return Lr(n,function(n,t,e){return r(n,t,e)?(u=n,er):void 0}),u}for(;++t<e;){var o=n[t];if(r(o,t,n))return o}}function D(n,r,t){var e=-1,u=n?n.length:0;if(r=r&&typeof t=="undefined"?r:a(r,t,3),typeof u=="number")for(;++e<u&&r(n[e],e,n)!==er;);else Lr(n,r)
+}function I(n,r){var t=n?n.length:0;if(typeof t=="number")for(;t--&&false!==r(n[t],t,n););else{var e=Ur(n),t=e.length;Lr(n,function(n,u,o){return u=e?e[--t]:--t,false===r(o[u],u,o)&&er})}}function M(n,r,t){var e=-1,u=n?n.length:0;if(r=X(r,t,3),typeof u=="number")for(var o=Array(u);++e<u;)o[e]=r(n[e],e,n);else o=[],Lr(n,function(n,t,u){o[++e]=r(n,t,u)});return o}function $(n,r,t){var e=-1/0,u=e;typeof r!="function"&&t&&t[r]===n&&(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++o<i;)t=n[o],t>u&&(u=t);
+else r=X(r,t,3),D(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function W(n,r,t,e){if(!n)return t;var u=3>arguments.length;r=X(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++o<i;)t=r(t,n[o],o,n);else Lr(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)});return t}function z(n,r,t,e){var u=3>arguments.length;return r=X(r,e,4),I(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function C(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return D(n,function(n){var t;t=++r,t=0+Sr(Wr()*(t-0+1)),e[r]=e[t],e[t]=n
+}),e}function P(n,r,t){var e;r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t<u&&!(e=r(n[t],t,n)););else Lr(n,function(n,t,u){return(e=r(n,t,u))&&er});return!!e}function U(n,r,t){return t&&E(r)?rr:(t?q:F)(n,r)}function V(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=-1;for(r=X(r,t,3);++i<o&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[0]:rr;return e(n,0,$r(Mr(0,u),o))}function G(r,t,e){if(typeof e=="number"){var u=r?r.length:0;e=0>e?Mr(0,u+e):e||0}else if(e)return e=J(r,t),r[e]===t?e:-1;
+return n(r,t,e)}function H(n,r,t){if(typeof r!="number"&&null!=r){var u=0,o=-1,i=n?n.length:0;for(r=X(r,t,3);++o<i&&r(n[o],o,n);)u++}else u=null==r||t?1:Mr(0,r);return e(n,u)}function J(n,r,t,e){var u=0,o=n?n.length:u;for(t=t?X(t,e,1):Y,r=t(r);u<o;)e=u+o>>>1,t(n[e])<r?u=e+1:o=e;return u}function K(n,r,t,e){return typeof r!="boolean"&&null!=r&&(e=t,t=typeof r!="function"&&e&&e[r]===n?null:r,r=false),null!=t&&(t=X(t,e,3)),g(n,r,t)}function L(n,r){return 2<arguments.length?v(n,17,e(arguments,2),null,r):v(n,1,null,null,r)
+}function Q(n,r,t){var e,u,o,i,f,a,l,c=0,p=false,s=true;if(!A(n))throw new TypeError;if(r=Mr(0,r)||0,true===t)var g=true,s=false;else O(t)&&(g=t.leading,p="maxWait"in t&&(Mr(r,t.maxWait)||0),s="trailing"in t?t.trailing:s);var h=function(){var t=r-(nt()-i);0<t?a=setTimeout(h,t):(u&&clearTimeout(u),t=l,u=a=l=rr,t&&(c=nt(),o=n.apply(f,e),a||u||(e=f=null)))},v=function(){a&&clearTimeout(a),u=a=l=rr,(s||p!==r)&&(c=nt(),o=n.apply(f,e),a||u||(e=f=null))};return function(){if(e=arguments,i=nt(),f=this,l=s&&(a||!g),false===p)var t=g&&!a;
+else{u||g||(c=i);var y=p-(i-c),m=0>=y;m?(u&&(u=clearTimeout(u)),c=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o}}function X(n,r,t){var e=typeof n;if(null==n||"function"==e)return a(n,r,t);if("object"!=e)return nr(n);var u=Ur(n);return function(r){for(var t=u.length,e=false;t--&&(e=r[u[t]]===n[u[t]]););return e}}function Y(n){return n}function Z(n){D(x(n),function(r){var t=u[r]=n[r];u.prototype[r]=function(){var n=[this.__wrapped__];
+return Rr.apply(n,arguments),n=t.apply(u,n),this.__chain__?new o(n,true):n}})}function nr(n){return function(r){return r[n]}}var rr,tr=0,er={},ur=+new Date+"",or=/($^)/,ir=/['\n\r\t\u2028\u2029\\]/g,fr="[object Arguments]",ar="[object Array]",lr="[object Boolean]",cr="[object Date]",pr="[object Number]",sr="[object Object]",gr="[object RegExp]",hr="[object String]",vr={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},yr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},mr=vr[typeof window]&&window||this,_r=vr[typeof exports]&&exports&&!exports.nodeType&&exports,dr=vr[typeof module]&&module&&!module.nodeType&&module,br=dr&&dr.exports===_r&&_r,wr=vr[typeof global]&&global;
+!wr||wr.global!==wr&&wr.window!==wr||(mr=wr);var jr=[],xr=Object.prototype,Tr=mr._,Er=xr.toString,Ar=RegExp("^"+(Er+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Or=Math.ceil,Sr=Math.floor,Nr=xr.hasOwnProperty,Rr=jr.push,kr=xr.propertyIsEnumerable,Br=_(Br=Object.create)&&Br,Fr=_(Fr=Array.isArray)&&Fr,qr=mr.isFinite,Dr=mr.isNaN,Ir=_(Ir=Object.keys)&&Ir,Mr=Math.max,$r=Math.min,Wr=Math.random;o.prototype=u.prototype;var zr={};!function(){var n={0:1,length:1};zr.spliceObjects=(jr.splice.call(n,0,1),!n[0])
+}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Br||(f=function(){function n(){}return function(r){if(O(r)){n.prototype=r;var t=new n;n.prototype=null}return t||mr.Object()}}()),b(arguments)||(b=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Nr.call(n,"callee")&&!kr.call(n,"callee")||false});var Cr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Er.call(n)==ar||false},Pr=function(n){var r,t=[];
+if(!n||!vr[typeof n])return t;for(r in n)Nr.call(n,r)&&t.push(r);return t},Ur=Ir?function(n){return O(n)?Ir(n):[]}:Pr,Vr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},Gr=T(Vr),Hr=RegExp("("+Ur(Gr).join("|")+")","g"),Jr=RegExp("["+Ur(Vr).join("")+"]","g"),Kr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(r(n[t],t,n)===er)break;return n},Lr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(Nr.call(n,t)&&r(n[t],t,n)===er)break;return n};A(/x/)&&(A=function(n){return typeof n=="function"&&"[object Function]"==Er.call(n)
+});var Qr=h(function(n,r,t){Nr.call(n,t)?n[t]++:n[t]=1}),Xr=h(function(n,r,t){(Nr.call(n,t)?n[t]:n[t]=[]).push(r)}),Yr=h(function(n,r,t){n[t]=r}),Zr=M,nt=_(nt=Date.now)&&nt||function(){return(new Date).getTime()};u.after=function(n,r){if(!A(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=L,u.bindAll=function(n){for(var r=1<arguments.length?p(arguments,true,false,1):x(n),t=-1,e=r.length;++t<e;){var u=r[t];n[u]=v(n[u],1,null,null,n)}return n},u.chain=function(n){return n=new o(n),n.__chain__=true,n
+},u.compact=function(n){for(var r=-1,t=n?n.length:0,e=[];++r<t;){var u=n[r];u&&e.push(u)}return e},u.compose=function(){for(var n=arguments,r=n.length;r--;)if(!A(n[r]))throw new TypeError;return function(){for(var r=arguments,t=n.length;t--;)r=[n[t].apply(this,r)];return r[0]}},u.countBy=Qr,u.debounce=Q,u.defaults=j,u.defer=function(n){if(!A(n))throw new TypeError;var r=e(arguments,1);return setTimeout(function(){n.apply(rr,r)},1)},u.delay=function(n,r){if(!A(n))throw new TypeError;var t=e(arguments,2);
+return setTimeout(function(){n.apply(rr,t)},r)},u.difference=function(n){return c(n,p(arguments,true,true,1))},u.filter=F,u.flatten=function(n,r){return p(n,r)},u.forEach=D,u.functions=x,u.groupBy=Xr,u.indexBy=Yr,u.initial=function(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=o;for(r=X(r,t,3);i--&&r(n[i],i,n);)u++}else u=null==r||t?1:r||u;return e(n,0,$r(Mr(0,o-u),o))},u.intersection=function(){for(var n=[],r=-1,t=arguments.length;++r<t;){var e=arguments[r];(Cr(e)||b(e))&&n.push(e)
+}var u=n[0],o=-1,i=m(),f=u?u.length:0,a=[];n:for(;++o<f;)if(e=u[o],0>i(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},u.invert=T,u.invoke=function(n,r){var t=e(arguments,2),u=-1,o=typeof r=="function",i=n?n.length:0,f=Array(typeof i=="number"?i:0);return D(n,function(n){f[++u]=(o?r:n[r]).apply(n,t)}),f},u.keys=Ur,u.map=M,u.max=$,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):ur+arguments[0];return Nr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)
+}},u.min=function(n,r,t){var e=1/0,u=e;typeof r!="function"&&t&&t[r]===n&&(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++o<i;)t=n[o],t<u&&(u=t);else r=X(r,t,3),D(n,function(n,t,o){t=r(n,t,o),t<e&&(e=t,u=n)});return u},u.omit=function(n){var r=[];Kr(n,function(n,t){r.push(t)});for(var r=c(r,p(arguments,true,false,1)),t=-1,e=r.length,u={};++t<e;){var o=r[t];u[o]=n[o]}return u},u.once=function(n){var r,t;if(!A(n))throw new TypeError;return function(){return r?t:(r=true,t=n.apply(this,arguments),n=null,t)
+}},u.pairs=function(n){for(var r=-1,t=Ur(n),e=t.length,u=Array(e);++r<e;){var o=t[r];u[r]=[o,n[o]]}return u},u.partial=function(n){return v(n,16,e(arguments,1))},u.pick=function(n){for(var r=-1,t=p(arguments,true,false,1),e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u},u.pluck=Zr,u.range=function(n,r,t){n=+n||0,t=+t||1,null==r&&(r=n,n=0);var e=-1;r=Mr(0,Or((r-n)/t));for(var u=Array(r);++e<r;)u[e]=n,n+=t;return u},u.reject=function(n,r,t){return r=X(r,t,3),F(n,function(n,t,e){return!r(n,t,e)
+})},u.rest=H,u.shuffle=C,u.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=X(t,e,3),D(n,function(n,r,e){i[++u]={m:[t(n,r,e)],n:u,o:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].o;return i},u.tap=function(n,r){return r(n),n},u.throttle=function(n,r,t){var e=true,u=true;if(!A(n))throw new TypeError;return false===t?e=false:O(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),t={},t.leading=e,t.maxWait=r,t.trailing=u,Q(n,r,t)},u.times=function(n,r,t){n=-1<(n=+n)?n:0;
+var e=-1,u=Array(n);for(r=a(r,t,1);++e<n;)u[e]=r(e);return u},u.toArray=function(n){return Cr(n)?e(n):n&&typeof n.length=="number"?M(n):R(n)},u.union=function(){return g(p(arguments,true,true))},u.uniq=K,u.values=R,u.where=U,u.without=function(n){return c(n,e(arguments,1))},u.wrap=function(n,r){return v(r,16,[n])},u.zip=function(){for(var n=-1,r=$(Zr(arguments,"length")),t=Array(0>r?0:r);++n<r;)t[n]=Zr(arguments,n);return t},u.collect=M,u.drop=H,u.each=D,u.extend=w,u.methods=x,u.object=function(n,r){var t=-1,e=n?n.length:0,u={};
+for(r||!e||Cr(n[0])||(r=[]);++t<e;){var o=n[t];r?u[o]=r[t]:o&&(u[o[0]]=o[1])}return u},u.select=F,u.tail=H,u.unique=K,u.clone=function(n){return O(n)?Cr(n)?e(n):w({},n):n},u.contains=k,u.escape=function(n){return null==n?"":(n+"").replace(Jr,y)},u.every=B,u.find=q,u.has=function(n,r){return n?Nr.call(n,r):false},u.identity=Y,u.indexOf=G,u.isArguments=b,u.isArray=Cr,u.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Er.call(n)==lr||false},u.isDate=function(n){return n&&typeof n=="object"&&Er.call(n)==cr||false
+},u.isElement=function(n){return n&&1===n.nodeType||false},u.isEmpty=E,u.isEqual=function(n,r){return s(n,r)},u.isFinite=function(n){return qr(n)&&!Dr(parseFloat(n))},u.isFunction=A,u.isNaN=function(n){return S(n)&&n!=+n},u.isNull=function(n){return null===n},u.isNumber=S,u.isObject=O,u.isRegExp=function(n){return n&&vr[typeof n]&&Er.call(n)==gr||false},u.isString=N,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,r,t){var e=n?n.length:0;for(typeof t=="number"&&(e=(0>t?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;
+return-1},u.mixin=Z,u.noConflict=function(){return mr._=Tr,this},u.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Sr(Wr()*(r-n+1))},u.reduce=W,u.reduceRight=z,u.result=function(n,r){if(n){var t=n[r];return A(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Ur(n).length},u.some=P,u.sortedIndex=J,u.template=function(n,r,e){var o=u,i=o.templateSettings;n=(n||"")+"",e=j({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||or).source+"|"+(e.interpolate||or).source+"|"+(e.evaluate||or).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ir,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r
+}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Hr,d)},u.uniqueId=function(n){var r=++tr+"";return n?n+r:r},u.all=B,u.any=P,u.detect=q,u.findWhere=function(n,r){return U(n,r,true)},u.foldl=W,u.foldr=z,u.include=k,u.inject=W,u.first=V,u.last=function(n,r,t){var u=0,o=n?n.length:0;
+if(typeof r!="number"&&null!=r){var i=o;for(r=X(r,t,3);i--&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[o-1]:rr;return e(n,Mr(0,o-u))},u.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=R(n)),null==r||t?n?n[0+Sr(Wr()*(n.length-1-0+1))]:rr:(n=C(n),n.length=$r(Mr(0,r),n.length),n)},u.take=V,u.head=V,Z(u),u.VERSION="2.4.1",u.prototype.chain=function(){return this.__chain__=true,this},u.prototype.value=function(){return this.__wrapped__},D("pop push reverse shift sort splice unshift".split(" "),function(n){var r=jr[n];
+u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),zr.spliceObjects||0!==n.length||delete n[0],this}}),D(["concat","join","slice"],function(n){var r=jr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=true),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(mr._=u, define(function(){return u})):_r&&dr?br?(dr.exports=u)._=u:_r._=u:mr._=u}).call(this);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/lodash.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/lodash.js
new file mode 100755 (executable)
index 0000000..5b37903
--- /dev/null
@@ -0,0 +1,7179 @@
+/**
+ * @license
+ * Lo-Dash 2.4.1 <http://lodash.com/>
+ * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+ * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
+ * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license <http://lodash.com/license>
+ */
+;(function() {
+
+  /** Used as a safe reference for `undefined` in pre ES5 environments */
+  var undefined;
+
+  /** Used to pool arrays and objects used internally */
+  var arrayPool = [],
+      objectPool = [];
+
+  /** Used to generate unique IDs */
+  var idCounter = 0;
+
+  /** Used internally to indicate various things */
+  var indicatorObject = {};
+
+  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
+  var keyPrefix = +new Date + '';
+
+  /** Used as the size when optimizations are enabled for large arrays */
+  var largeArraySize = 75;
+
+  /** Used as the max size of the `arrayPool` and `objectPool` */
+  var maxPoolSize = 40;
+
+  /** Used to detect and test whitespace */
+  var whitespace = (
+    // whitespace
+    ' \t\x0B\f\xA0\ufeff' +
+
+    // line terminators
+    '\n\r\u2028\u2029' +
+
+    // unicode category "Zs" space separators
+    '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
+  );
+
+  /** Used to match empty string literals in compiled template source */
+  var reEmptyStringLeading = /\b__p \+= '';/g,
+      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+
+  /**
+   * Used to match ES6 template delimiters
+   * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals
+   */
+  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+
+  /** Used to match regexp flags from their coerced string values */
+  var reFlags = /\w*$/;
+
+  /** Used to detected named functions */
+  var reFuncName = /^\s*function[ \n\r\t]+\w/;
+
+  /** Used to match "interpolate" template delimiters */
+  var reInterpolate = /<%=([\s\S]+?)%>/g;
+
+  /** Used to match leading whitespace and zeros to be removed */
+  var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
+
+  /** Used to ensure capturing order of template delimiters */
+  var reNoMatch = /($^)/;
+
+  /** Used to detect functions containing a `this` reference */
+  var reThis = /\bthis\b/;
+
+  /** Used to match unescaped characters in compiled string literals */
+  var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
+
+  /** Used to assign default `context` object properties */
+  var contextProps = [
+    'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object',
+    'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',
+    'parseInt', 'setTimeout'
+  ];
+
+  /** Used to fix the JScript [[DontEnum]] bug */
+  var shadowedProps = [
+    'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
+    'toLocaleString', 'toString', 'valueOf'
+  ];
+
+  /** Used to make template sourceURLs easier to identify */
+  var templateCounter = 0;
+
+  /** `Object#toString` result shortcuts */
+  var argsClass = '[object Arguments]',
+      arrayClass = '[object Array]',
+      boolClass = '[object Boolean]',
+      dateClass = '[object Date]',
+      errorClass = '[object Error]',
+      funcClass = '[object Function]',
+      numberClass = '[object Number]',
+      objectClass = '[object Object]',
+      regexpClass = '[object RegExp]',
+      stringClass = '[object String]';
+
+  /** Used to identify object classifications that `_.clone` supports */
+  var cloneableClasses = {};
+  cloneableClasses[funcClass] = false;
+  cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
+  cloneableClasses[boolClass] = cloneableClasses[dateClass] =
+  cloneableClasses[numberClass] = cloneableClasses[objectClass] =
+  cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
+
+  /** Used as an internal `_.debounce` options object */
+  var debounceOptions = {
+    'leading': false,
+    'maxWait': 0,
+    'trailing': false
+  };
+
+  /** Used as the property descriptor for `__bindData__` */
+  var descriptor = {
+    'configurable': false,
+    'enumerable': false,
+    'value': null,
+    'writable': false
+  };
+
+  /** Used as the data object for `iteratorTemplate` */
+  var iteratorData = {
+    'args': '',
+    'array': null,
+    'bottom': '',
+    'firstArg': '',
+    'init': '',
+    'keys': null,
+    'loop': '',
+    'shadowedProps': null,
+    'support': null,
+    'top': '',
+    'useHas': false
+  };
+
+  /** Used to determine if values are of the language type Object */
+  var objectTypes = {
+    'boolean': false,
+    'function': true,
+    'object': true,
+    'number': false,
+    'string': false,
+    'undefined': false
+  };
+
+  /** Used to escape characters for inclusion in compiled string literals */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\t': 't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  /** Used as a reference to the global object */
+  var root = (objectTypes[typeof window] && window) || this;
+
+  /** Detect free variable `exports` */
+  var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+
+  /** Detect free variable `module` */
+  var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
+
+  /** Detect the popular CommonJS extension `module.exports` */
+  var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+
+  /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
+  var freeGlobal = objectTypes[typeof global] && global;
+  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
+    root = freeGlobal;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * The base implementation of `_.indexOf` without support for binary searches
+   * or `fromIndex` constraints.
+   *
+   * @private
+   * @param {Array} array The array to search.
+   * @param {*} value The value to search for.
+   * @param {number} [fromIndex=0] The index to search from.
+   * @returns {number} Returns the index of the matched value or `-1`.
+   */
+  function baseIndexOf(array, value, fromIndex) {
+    var index = (fromIndex || 0) - 1,
+        length = array ? array.length : 0;
+
+    while (++index < length) {
+      if (array[index] === value) {
+        return index;
+      }
+    }
+    return -1;
+  }
+
+  /**
+   * An implementation of `_.contains` for cache objects that mimics the return
+   * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
+   *
+   * @private
+   * @param {Object} cache The cache object to inspect.
+   * @param {*} value The value to search for.
+   * @returns {number} Returns `0` if `value` is found, else `-1`.
+   */
+  function cacheIndexOf(cache, value) {
+    var type = typeof value;
+    cache = cache.cache;
+
+    if (type == 'boolean' || value == null) {
+      return cache[value] ? 0 : -1;
+    }
+    if (type != 'number' && type != 'string') {
+      type = 'object';
+    }
+    var key = type == 'number' ? value : keyPrefix + value;
+    cache = (cache = cache[type]) && cache[key];
+
+    return type == 'object'
+      ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)
+      : (cache ? 0 : -1);
+  }
+
+  /**
+   * Adds a given value to the corresponding cache object.
+   *
+   * @private
+   * @param {*} value The value to add to the cache.
+   */
+  function cachePush(value) {
+    var cache = this.cache,
+        type = typeof value;
+
+    if (type == 'boolean' || value == null) {
+      cache[value] = true;
+    } else {
+      if (type != 'number' && type != 'string') {
+        type = 'object';
+      }
+      var key = type == 'number' ? value : keyPrefix + value,
+          typeCache = cache[type] || (cache[type] = {});
+
+      if (type == 'object') {
+        (typeCache[key] || (typeCache[key] = [])).push(value);
+      } else {
+        typeCache[key] = true;
+      }
+    }
+  }
+
+  /**
+   * Used by `_.max` and `_.min` as the default callback when a given
+   * collection is a string value.
+   *
+   * @private
+   * @param {string} value The character to inspect.
+   * @returns {number} Returns the code unit of given character.
+   */
+  function charAtCallback(value) {
+    return value.charCodeAt(0);
+  }
+
+  /**
+   * Used by `sortBy` to compare transformed `collection` elements, stable sorting
+   * them in ascending order.
+   *
+   * @private
+   * @param {Object} a The object to compare to `b`.
+   * @param {Object} b The object to compare to `a`.
+   * @returns {number} Returns the sort order indicator of `1` or `-1`.
+   */
+  function compareAscending(a, b) {
+    var ac = a.criteria,
+        bc = b.criteria,
+        index = -1,
+        length = ac.length;
+
+    while (++index < length) {
+      var value = ac[index],
+          other = bc[index];
+
+      if (value !== other) {
+        if (value > other || typeof value == 'undefined') {
+          return 1;
+        }
+        if (value < other || typeof other == 'undefined') {
+          return -1;
+        }
+      }
+    }
+    // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
+    // that causes it, under certain circumstances, to return the same value for
+    // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247
+    //
+    // This also ensures a stable sort in V8 and other engines.
+    // See http://code.google.com/p/v8/issues/detail?id=90
+    return a.index - b.index;
+  }
+
+  /**
+   * Creates a cache object to optimize linear searches of large arrays.
+   *
+   * @private
+   * @param {Array} [array=[]] The array to search.
+   * @returns {null|Object} Returns the cache object or `null` if caching should not be used.
+   */
+  function createCache(array) {
+    var index = -1,
+        length = array.length,
+        first = array[0],
+        mid = array[(length / 2) | 0],
+        last = array[length - 1];
+
+    if (first && typeof first == 'object' &&
+        mid && typeof mid == 'object' && last && typeof last == 'object') {
+      return false;
+    }
+    var cache = getObject();
+    cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
+
+    var result = getObject();
+    result.array = array;
+    result.cache = cache;
+    result.push = cachePush;
+
+    while (++index < length) {
+      result.push(array[index]);
+    }
+    return result;
+  }
+
+  /**
+   * Used by `template` to escape characters for inclusion in compiled
+   * string literals.
+   *
+   * @private
+   * @param {string} match The matched character to escape.
+   * @returns {string} Returns the escaped character.
+   */
+  function escapeStringChar(match) {
+    return '\\' + stringEscapes[match];
+  }
+
+  /**
+   * Gets an array from the array pool or creates a new one if the pool is empty.
+   *
+   * @private
+   * @returns {Array} The array from the pool.
+   */
+  function getArray() {
+    return arrayPool.pop() || [];
+  }
+
+  /**
+   * Gets an object from the object pool or creates a new one if the pool is empty.
+   *
+   * @private
+   * @returns {Object} The object from the pool.
+   */
+  function getObject() {
+    return objectPool.pop() || {
+      'array': null,
+      'cache': null,
+      'criteria': null,
+      'false': false,
+      'index': 0,
+      'null': false,
+      'number': null,
+      'object': null,
+      'push': null,
+      'string': null,
+      'true': false,
+      'undefined': false,
+      'value': null
+    };
+  }
+
+  /**
+   * Checks if `value` is a DOM node in IE < 9.
+   *
+   * @private
+   * @param {*} value The value to check.
+   * @returns {boolean} Returns `true` if the `value` is a DOM node, else `false`.
+   */
+  function isNode(value) {
+    // IE < 9 presents DOM nodes as `Object` objects except they have `toString`
+    // methods that are `typeof` "string" and still can coerce nodes to strings
+    return typeof value.toString != 'function' && typeof (value + '') == 'string';
+  }
+
+  /**
+   * Releases the given array back to the array pool.
+   *
+   * @private
+   * @param {Array} [array] The array to release.
+   */
+  function releaseArray(array) {
+    array.length = 0;
+    if (arrayPool.length < maxPoolSize) {
+      arrayPool.push(array);
+    }
+  }
+
+  /**
+   * Releases the given object back to the object pool.
+   *
+   * @private
+   * @param {Object} [object] The object to release.
+   */
+  function releaseObject(object) {
+    var cache = object.cache;
+    if (cache) {
+      releaseObject(cache);
+    }
+    object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null;
+    if (objectPool.length < maxPoolSize) {
+      objectPool.push(object);
+    }
+  }
+
+  /**
+   * Slices the `collection` from the `start` index up to, but not including,
+   * the `end` index.
+   *
+   * Note: This function is used instead of `Array#slice` to support node lists
+   * in IE < 9 and to ensure dense arrays are returned.
+   *
+   * @private
+   * @param {Array|Object|string} collection The collection to slice.
+   * @param {number} start The start index.
+   * @param {number} end The end index.
+   * @returns {Array} Returns the new array.
+   */
+  function slice(array, start, end) {
+    start || (start = 0);
+    if (typeof end == 'undefined') {
+      end = array ? array.length : 0;
+    }
+    var index = -1,
+        length = end - start || 0,
+        result = Array(length < 0 ? 0 : length);
+
+    while (++index < length) {
+      result[index] = array[start + index];
+    }
+    return result;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  /**
+   * Create a new `lodash` function using the given context object.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {Object} [context=root] The context object.
+   * @returns {Function} Returns the `lodash` function.
+   */
+  function runInContext(context) {
+    // Avoid issues with some ES3 environments that attempt to use values, named
+    // after built-in constructors like `Object`, for the creation of literals.
+    // ES5 clears this up by stating that literals must use built-in constructors.
+    // See http://es5.github.io/#x11.1.5.
+    context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
+
+    /** Native constructor references */
+    var Array = context.Array,
+        Boolean = context.Boolean,
+        Date = context.Date,
+        Error = context.Error,
+        Function = context.Function,
+        Math = context.Math,
+        Number = context.Number,
+        Object = context.Object,
+        RegExp = context.RegExp,
+        String = context.String,
+        TypeError = context.TypeError;
+
+    /**
+     * Used for `Array` method references.
+     *
+     * Normally `Array.prototype` would suffice, however, using an array literal
+     * avoids issues in Narwhal.
+     */
+    var arrayRef = [];
+
+    /** Used for native method references */
+    var errorProto = Error.prototype,
+        objectProto = Object.prototype,
+        stringProto = String.prototype;
+
+    /** Used to restore the original `_` reference in `noConflict` */
+    var oldDash = context._;
+
+    /** Used to resolve the internal [[Class]] of values */
+    var toString = objectProto.toString;
+
+    /** Used to detect if a method is native */
+    var reNative = RegExp('^' +
+      String(toString)
+        .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+        .replace(/toString| for [^\]]+/g, '.*?') + '$'
+    );
+
+    /** Native method shortcuts */
+    var ceil = Math.ceil,
+        clearTimeout = context.clearTimeout,
+        floor = Math.floor,
+        fnToString = Function.prototype.toString,
+        getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
+        hasOwnProperty = objectProto.hasOwnProperty,
+        push = arrayRef.push,
+        propertyIsEnumerable = objectProto.propertyIsEnumerable,
+        setTimeout = context.setTimeout,
+        splice = arrayRef.splice,
+        unshift = arrayRef.unshift;
+
+    /** Used to set meta data on functions */
+    var defineProperty = (function() {
+      // IE 8 only accepts DOM elements
+      try {
+        var o = {},
+            func = isNative(func = Object.defineProperty) && func,
+            result = func(o, o, o) && func;
+      } catch(e) { }
+      return result;
+    }());
+
+    /* Native method shortcuts for methods with the same name as other `lodash` methods */
+    var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
+        nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
+        nativeIsFinite = context.isFinite,
+        nativeIsNaN = context.isNaN,
+        nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
+        nativeMax = Math.max,
+        nativeMin = Math.min,
+        nativeParseInt = context.parseInt,
+        nativeRandom = Math.random;
+
+    /** Used to lookup a built-in constructor by [[Class]] */
+    var ctorByClass = {};
+    ctorByClass[arrayClass] = Array;
+    ctorByClass[boolClass] = Boolean;
+    ctorByClass[dateClass] = Date;
+    ctorByClass[funcClass] = Function;
+    ctorByClass[objectClass] = Object;
+    ctorByClass[numberClass] = Number;
+    ctorByClass[regexpClass] = RegExp;
+    ctorByClass[stringClass] = String;
+
+    /** Used to avoid iterating non-enumerable properties in IE < 9 */
+    var nonEnumProps = {};
+    nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
+    nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
+    nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
+    nonEnumProps[objectClass] = { 'constructor': true };
+
+    (function() {
+      var length = shadowedProps.length;
+      while (length--) {
+        var key = shadowedProps[length];
+        for (var className in nonEnumProps) {
+          if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], key)) {
+            nonEnumProps[className][key] = false;
+          }
+        }
+      }
+    }());
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object which wraps the given value to enable intuitive
+     * method chaining.
+     *
+     * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
+     * and `unshift`
+     *
+     * Chaining is supported in custom builds as long as the `value` method is
+     * implicitly or explicitly included in the build.
+     *
+     * The chainable wrapper functions are:
+     * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
+     * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,
+     * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,
+     * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+     * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+     * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
+     * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,
+     * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+     * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,
+     * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,
+     * and `zip`
+     *
+     * The non-chainable wrapper functions are:
+     * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,
+     * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,
+     * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+     * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,
+     * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,
+     * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,
+     * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,
+     * `template`, `unescape`, `uniqueId`, and `value`
+     *
+     * The wrapper functions `first` and `last` return wrapped values when `n` is
+     * provided, otherwise they return unwrapped values.
+     *
+     * Explicit chaining can be enabled by using the `_.chain` method.
+     *
+     * @name _
+     * @constructor
+     * @category Chaining
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns a `lodash` instance.
+     * @example
+     *
+     * var wrapped = _([1, 2, 3]);
+     *
+     * // returns an unwrapped value
+     * wrapped.reduce(function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * // returns a wrapped value
+     * var squares = wrapped.map(function(num) {
+     *   return num * num;
+     * });
+     *
+     * _.isArray(squares);
+     * // => false
+     *
+     * _.isArray(squares.value());
+     * // => true
+     */
+    function lodash(value) {
+      // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
+      return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))
+       ? value
+       : new lodashWrapper(value);
+    }
+
+    /**
+     * A fast path for creating `lodash` wrapper objects.
+     *
+     * @private
+     * @param {*} value The value to wrap in a `lodash` instance.
+     * @param {boolean} chainAll A flag to enable chaining for all methods
+     * @returns {Object} Returns a `lodash` instance.
+     */
+    function lodashWrapper(value, chainAll) {
+      this.__chain__ = !!chainAll;
+      this.__wrapped__ = value;
+    }
+    // ensure `new lodashWrapper` is an instance of `lodash`
+    lodashWrapper.prototype = lodash.prototype;
+
+    /**
+     * An object used to flag environments features.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    var support = lodash.support = {};
+
+    (function() {
+      var ctor = function() { this.x = 1; },
+          object = { '0': 1, 'length': 1 },
+          props = [];
+
+      ctor.prototype = { 'valueOf': 1, 'y': 1 };
+      for (var key in new ctor) { props.push(key); }
+      for (key in arguments) { }
+
+      /**
+       * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.argsClass = toString.call(arguments) == argsClass;
+
+      /**
+       * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
+
+      /**
+       * Detect if `name` or `message` properties of `Error.prototype` are
+       * enumerable by default. (IE < 9, Safari < 5.1)
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
+
+      /**
+       * Detect if `prototype` properties are enumerable by default.
+       *
+       * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
+       * (if the prototype or a property on the prototype has been set)
+       * incorrectly sets a function's `prototype` property [[Enumerable]]
+       * value to `true`.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
+
+      /**
+       * Detect if functions can be decompiled by `Function#toString`
+       * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext);
+
+      /**
+       * Detect if `Function#name` is supported (all but IE).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.funcNames = typeof Function.name == 'string';
+
+      /**
+       * Detect if `arguments` object indexes are non-enumerable
+       * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.nonEnumArgs = key != 0;
+
+      /**
+       * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
+       *
+       * In IE < 9 an objects own properties, shadowing non-enumerable ones, are
+       * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.nonEnumShadows = !/valueOf/.test(props);
+
+      /**
+       * Detect if own properties are iterated after inherited properties (all but IE < 9).
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.ownLast = props[0] != 'x';
+
+      /**
+       * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.
+       *
+       * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
+       * and `splice()` functions that fail to remove the last element, `value[0]`,
+       * of array-like objects even though the `length` property is set to `0`.
+       * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
+       * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]);
+
+      /**
+       * Detect lack of support for accessing string characters by index.
+       *
+       * IE < 8 can't access characters by index and IE 8 can only access
+       * characters by index on string literals.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
+
+      /**
+       * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9)
+       * and that the JS engine errors when attempting to coerce an object to
+       * a string without a `toString` function.
+       *
+       * @memberOf _.support
+       * @type boolean
+       */
+      try {
+        support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
+      } catch(e) {
+        support.nodeClass = true;
+      }
+    }(1));
+
+    /**
+     * By default, the template delimiters used by Lo-Dash are similar to those in
+     * embedded Ruby (ERB). Change the following template settings to use alternative
+     * delimiters.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    lodash.templateSettings = {
+
+      /**
+       * Used to detect `data` property values to be HTML-escaped.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'escape': /<%-([\s\S]+?)%>/g,
+
+      /**
+       * Used to detect code to be evaluated.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'evaluate': /<%([\s\S]+?)%>/g,
+
+      /**
+       * Used to detect `data` property values to inject.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'interpolate': reInterpolate,
+
+      /**
+       * Used to reference the data object in the template text.
+       *
+       * @memberOf _.templateSettings
+       * @type string
+       */
+      'variable': '',
+
+      /**
+       * Used to import variables into the compiled template.
+       *
+       * @memberOf _.templateSettings
+       * @type Object
+       */
+      'imports': {
+
+        /**
+         * A reference to the `lodash` function.
+         *
+         * @memberOf _.templateSettings.imports
+         * @type Function
+         */
+        '_': lodash
+      }
+    };
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The template used to create iterator functions.
+     *
+     * @private
+     * @param {Object} data The data object used to populate the text.
+     * @returns {string} Returns the interpolated text.
+     */
+    var iteratorTemplate = template(
+      // the `iterable` may be reassigned by the `top` snippet
+      'var index, iterable = <%= firstArg %>, ' +
+      // assign the `result` variable an initial value
+      'result = <%= init %>;\n' +
+      // exit early if the first argument is falsey
+      'if (!iterable) return result;\n' +
+      // add code before the iteration branches
+      '<%= top %>;' +
+
+      // array-like iteration:
+      '<% if (array) { %>\n' +
+      'var length = iterable.length; index = -1;\n' +
+      'if (<%= array %>) {' +
+
+      // add support for accessing string characters by index if needed
+      '  <% if (support.unindexedChars) { %>\n' +
+      '  if (isString(iterable)) {\n' +
+      "    iterable = iterable.split('')\n" +
+      '  }' +
+      '  <% } %>\n' +
+
+      // iterate over the array-like value
+      '  while (++index < length) {\n' +
+      '    <%= loop %>;\n' +
+      '  }\n' +
+      '}\n' +
+      'else {' +
+
+      // object iteration:
+      // add support for iterating over `arguments` objects if needed
+      '  <% } else if (support.nonEnumArgs) { %>\n' +
+      '  var length = iterable.length; index = -1;\n' +
+      '  if (length && isArguments(iterable)) {\n' +
+      '    while (++index < length) {\n' +
+      "      index += '';\n" +
+      '      <%= loop %>;\n' +
+      '    }\n' +
+      '  } else {' +
+      '  <% } %>' +
+
+      // avoid iterating over `prototype` properties in older Firefox, Opera, and Safari
+      '  <% if (support.enumPrototypes) { %>\n' +
+      "  var skipProto = typeof iterable == 'function';\n" +
+      '  <% } %>' +
+
+      // avoid iterating over `Error.prototype` properties in older IE and Safari
+      '  <% if (support.enumErrorProps) { %>\n' +
+      '  var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' +
+      '  <% } %>' +
+
+      // define conditions used in the loop
+      '  <%' +
+      '    var conditions = [];' +
+      '    if (support.enumPrototypes) { conditions.push(\'!(skipProto && index == "prototype")\'); }' +
+      '    if (support.enumErrorProps)  { conditions.push(\'!(skipErrorProps && (index == "message" || index == "name"))\'); }' +
+      '  %>' +
+
+      // iterate own properties using `Object.keys`
+      '  <% if (useHas && keys) { %>\n' +
+      '  var ownIndex = -1,\n' +
+      '      ownProps = objectTypes[typeof iterable] && keys(iterable),\n' +
+      '      length = ownProps ? ownProps.length : 0;\n\n' +
+      '  while (++ownIndex < length) {\n' +
+      '    index = ownProps[ownIndex];\n<%' +
+      "    if (conditions.length) { %>    if (<%= conditions.join(' && ') %>) {\n  <% } %>" +
+      '    <%= loop %>;' +
+      '    <% if (conditions.length) { %>\n    }<% } %>\n' +
+      '  }' +
+
+      // else using a for-in loop
+      '  <% } else { %>\n' +
+      '  for (index in iterable) {\n<%' +
+      '    if (useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); }' +
+      "    if (conditions.length) { %>    if (<%= conditions.join(' && ') %>) {\n  <% } %>" +
+      '    <%= loop %>;' +
+      '    <% if (conditions.length) { %>\n    }<% } %>\n' +
+      '  }' +
+
+      // Because IE < 9 can't set the `[[Enumerable]]` attribute of an
+      // existing property and the `constructor` property of a prototype
+      // defaults to non-enumerable, Lo-Dash skips the `constructor`
+      // property when it infers it's iterating over a `prototype` object.
+      '    <% if (support.nonEnumShadows) { %>\n\n' +
+      '  if (iterable !== objectProto) {\n' +
+      "    var ctor = iterable.constructor,\n" +
+      '        isProto = iterable === (ctor && ctor.prototype),\n' +
+      '        className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n' +
+      '        nonEnum = nonEnumProps[className];\n' +
+      '      <% for (k = 0; k < 7; k++) { %>\n' +
+      "    index = '<%= shadowedProps[k] %>';\n" +
+      '    if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' +
+      '        if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectProto[index])<% }' +
+      '      %>) {\n' +
+      '      <%= loop %>;\n' +
+      '    }' +
+      '      <% } %>\n' +
+      '  }' +
+      '    <% } %>' +
+      '  <% } %>' +
+      '  <% if (array || support.nonEnumArgs) { %>\n}<% } %>\n' +
+
+      // add code to the bottom of the iteration function
+      '<%= bottom %>;\n' +
+      // finally, return the `result`
+      'return result'
+    );
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The base implementation of `_.bind` that creates the bound function and
+     * sets its meta data.
+     *
+     * @private
+     * @param {Array} bindData The bind data array.
+     * @returns {Function} Returns the new bound function.
+     */
+    function baseBind(bindData) {
+      var func = bindData[0],
+          partialArgs = bindData[2],
+          thisArg = bindData[4];
+
+      function bound() {
+        // `Function#bind` spec
+        // http://es5.github.io/#x15.3.4.5
+        if (partialArgs) {
+          // avoid `arguments` object deoptimizations by using `slice` instead
+          // of `Array.prototype.slice.call` and not assigning `arguments` to a
+          // variable as a ternary expression
+          var args = slice(partialArgs);
+          push.apply(args, arguments);
+        }
+        // mimic the constructor's `return` behavior
+        // http://es5.github.io/#x13.2.2
+        if (this instanceof bound) {
+          // ensure `new bound` is an instance of `func`
+          var thisBinding = baseCreate(func.prototype),
+              result = func.apply(thisBinding, args || arguments);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisArg, args || arguments);
+      }
+      setBindData(bound, bindData);
+      return bound;
+    }
+
+    /**
+     * The base implementation of `_.clone` without argument juggling or support
+     * for `thisArg` binding.
+     *
+     * @private
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep=false] Specify a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates clones with source counterparts.
+     * @returns {*} Returns the cloned value.
+     */
+    function baseClone(value, isDeep, callback, stackA, stackB) {
+      if (callback) {
+        var result = callback(value);
+        if (typeof result != 'undefined') {
+          return result;
+        }
+      }
+      // inspect [[Class]]
+      var isObj = isObject(value);
+      if (isObj) {
+        var className = toString.call(value);
+        if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) {
+          return value;
+        }
+        var ctor = ctorByClass[className];
+        switch (className) {
+          case boolClass:
+          case dateClass:
+            return new ctor(+value);
+
+          case numberClass:
+          case stringClass:
+            return new ctor(value);
+
+          case regexpClass:
+            result = ctor(value.source, reFlags.exec(value));
+            result.lastIndex = value.lastIndex;
+            return result;
+        }
+      } else {
+        return value;
+      }
+      var isArr = isArray(value);
+      if (isDeep) {
+        // check for circular references and return corresponding clone
+        var initedStack = !stackA;
+        stackA || (stackA = getArray());
+        stackB || (stackB = getArray());
+
+        var length = stackA.length;
+        while (length--) {
+          if (stackA[length] == value) {
+            return stackB[length];
+          }
+        }
+        result = isArr ? ctor(value.length) : {};
+      }
+      else {
+        result = isArr ? slice(value) : assign({}, value);
+      }
+      // add array properties assigned by `RegExp#exec`
+      if (isArr) {
+        if (hasOwnProperty.call(value, 'index')) {
+          result.index = value.index;
+        }
+        if (hasOwnProperty.call(value, 'input')) {
+          result.input = value.input;
+        }
+      }
+      // exit for shallow clone
+      if (!isDeep) {
+        return result;
+      }
+      // add the source value to the stack of traversed objects
+      // and associate it with its clone
+      stackA.push(value);
+      stackB.push(result);
+
+      // recursively populate clone (susceptible to call stack limits)
+      (isArr ? baseEach : forOwn)(value, function(objValue, key) {
+        result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
+      });
+
+      if (initedStack) {
+        releaseArray(stackA);
+        releaseArray(stackB);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.create` without support for assigning
+     * properties to the created object.
+     *
+     * @private
+     * @param {Object} prototype The object to inherit from.
+     * @returns {Object} Returns the new object.
+     */
+    function baseCreate(prototype, properties) {
+      return isObject(prototype) ? nativeCreate(prototype) : {};
+    }
+    // fallback for browsers without `Object.create`
+    if (!nativeCreate) {
+      baseCreate = (function() {
+        function Object() {}
+        return function(prototype) {
+          if (isObject(prototype)) {
+            Object.prototype = prototype;
+            var result = new Object;
+            Object.prototype = null;
+          }
+          return result || context.Object();
+        };
+      }());
+    }
+
+    /**
+     * The base implementation of `_.createCallback` without support for creating
+     * "_.pluck" or "_.where" style callbacks.
+     *
+     * @private
+     * @param {*} [func=identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of the created callback.
+     * @param {number} [argCount] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     */
+    function baseCreateCallback(func, thisArg, argCount) {
+      if (typeof func != 'function') {
+        return identity;
+      }
+      // exit early for no `thisArg` or already bound by `Function#bind`
+      if (typeof thisArg == 'undefined' || !('prototype' in func)) {
+        return func;
+      }
+      var bindData = func.__bindData__;
+      if (typeof bindData == 'undefined') {
+        if (support.funcNames) {
+          bindData = !func.name;
+        }
+        bindData = bindData || !support.funcDecomp;
+        if (!bindData) {
+          var source = fnToString.call(func);
+          if (!support.funcNames) {
+            bindData = !reFuncName.test(source);
+          }
+          if (!bindData) {
+            // checks if `func` references the `this` keyword and stores the result
+            bindData = reThis.test(source);
+            setBindData(func, bindData);
+          }
+        }
+      }
+      // exit early if there are no `this` references or `func` is bound
+      if (bindData === false || (bindData !== true && bindData[1] & 1)) {
+        return func;
+      }
+      switch (argCount) {
+        case 1: return function(value) {
+          return func.call(thisArg, value);
+        };
+        case 2: return function(a, b) {
+          return func.call(thisArg, a, b);
+        };
+        case 3: return function(value, index, collection) {
+          return func.call(thisArg, value, index, collection);
+        };
+        case 4: return function(accumulator, value, index, collection) {
+          return func.call(thisArg, accumulator, value, index, collection);
+        };
+      }
+      return bind(func, thisArg);
+    }
+
+    /**
+     * The base implementation of `createWrapper` that creates the wrapper and
+     * sets its meta data.
+     *
+     * @private
+     * @param {Array} bindData The bind data array.
+     * @returns {Function} Returns the new function.
+     */
+    function baseCreateWrapper(bindData) {
+      var func = bindData[0],
+          bitmask = bindData[1],
+          partialArgs = bindData[2],
+          partialRightArgs = bindData[3],
+          thisArg = bindData[4],
+          arity = bindData[5];
+
+      var isBind = bitmask & 1,
+          isBindKey = bitmask & 2,
+          isCurry = bitmask & 4,
+          isCurryBound = bitmask & 8,
+          key = func;
+
+      function bound() {
+        var thisBinding = isBind ? thisArg : this;
+        if (partialArgs) {
+          var args = slice(partialArgs);
+          push.apply(args, arguments);
+        }
+        if (partialRightArgs || isCurry) {
+          args || (args = slice(arguments));
+          if (partialRightArgs) {
+            push.apply(args, partialRightArgs);
+          }
+          if (isCurry && args.length < arity) {
+            bitmask |= 16 & ~32;
+            return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);
+          }
+        }
+        args || (args = arguments);
+        if (isBindKey) {
+          func = thisBinding[key];
+        }
+        if (this instanceof bound) {
+          thisBinding = baseCreate(func.prototype);
+          var result = func.apply(thisBinding, args);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisBinding, args);
+      }
+      setBindData(bound, bindData);
+      return bound;
+    }
+
+    /**
+     * The base implementation of `_.difference` that accepts a single array
+     * of values to exclude.
+     *
+     * @private
+     * @param {Array} array The array to process.
+     * @param {Array} [values] The array of values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     */
+    function baseDifference(array, values) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          isLarge = length >= largeArraySize && indexOf === baseIndexOf,
+          result = [];
+
+      if (isLarge) {
+        var cache = createCache(values);
+        if (cache) {
+          indexOf = cacheIndexOf;
+          values = cache;
+        } else {
+          isLarge = false;
+        }
+      }
+      while (++index < length) {
+        var value = array[index];
+        if (indexOf(values, value) < 0) {
+          result.push(value);
+        }
+      }
+      if (isLarge) {
+        releaseObject(values);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.flatten` without support for callback
+     * shorthands or `thisArg` binding.
+     *
+     * @private
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+     * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
+     * @param {number} [fromIndex=0] The index to start from.
+     * @returns {Array} Returns a new flattened array.
+     */
+    function baseFlatten(array, isShallow, isStrict, fromIndex) {
+      var index = (fromIndex || 0) - 1,
+          length = array ? array.length : 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+
+        if (value && typeof value == 'object' && typeof value.length == 'number'
+            && (isArray(value) || isArguments(value))) {
+          // recursively flatten arrays (susceptible to call stack limits)
+          if (!isShallow) {
+            value = baseFlatten(value, isShallow, isStrict);
+          }
+          var valIndex = -1,
+              valLength = value.length,
+              resIndex = result.length;
+
+          result.length += valLength;
+          while (++valIndex < valLength) {
+            result[resIndex++] = value[valIndex];
+          }
+        } else if (!isStrict) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.isEqual`, without support for `thisArg` binding,
+     * that allows partial "_.where" style comparisons.
+     *
+     * @private
+     * @param {*} a The value to compare.
+     * @param {*} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.
+     * @param {Array} [stackA=[]] Tracks traversed `a` objects.
+     * @param {Array} [stackB=[]] Tracks traversed `b` objects.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     */
+    function baseIsEqual(a, b, callback, isWhere, stackA, stackB) {
+      // used to indicate that when comparing objects, `a` has at least the properties of `b`
+      if (callback) {
+        var result = callback(a, b);
+        if (typeof result != 'undefined') {
+          return !!result;
+        }
+      }
+      // exit early for identical values
+      if (a === b) {
+        // treat `+0` vs. `-0` as not equal
+        return a !== 0 || (1 / a == 1 / b);
+      }
+      var type = typeof a,
+          otherType = typeof b;
+
+      // exit early for unlike primitive values
+      if (a === a &&
+          !(a && objectTypes[type]) &&
+          !(b && objectTypes[otherType])) {
+        return false;
+      }
+      // exit early for `null` and `undefined` avoiding ES3's Function#call behavior
+      // http://es5.github.io/#x15.3.4.4
+      if (a == null || b == null) {
+        return a === b;
+      }
+      // compare [[Class]] names
+      var className = toString.call(a),
+          otherClass = toString.call(b);
+
+      if (className == argsClass) {
+        className = objectClass;
+      }
+      if (otherClass == argsClass) {
+        otherClass = objectClass;
+      }
+      if (className != otherClass) {
+        return false;
+      }
+      switch (className) {
+        case boolClass:
+        case dateClass:
+          // coerce dates and booleans to numbers, dates to milliseconds and booleans
+          // to `1` or `0` treating invalid dates coerced to `NaN` as not equal
+          return +a == +b;
+
+        case numberClass:
+          // treat `NaN` vs. `NaN` as equal
+          return (a != +a)
+            ? b != +b
+            // but treat `+0` vs. `-0` as not equal
+            : (a == 0 ? (1 / a == 1 / b) : a == +b);
+
+        case regexpClass:
+        case stringClass:
+          // coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
+          // treat string primitives and their corresponding object instances as equal
+          return a == String(b);
+      }
+      var isArr = className == arrayClass;
+      if (!isArr) {
+        // unwrap any `lodash` wrapped values
+        var aWrapped = hasOwnProperty.call(a, '__wrapped__'),
+            bWrapped = hasOwnProperty.call(b, '__wrapped__');
+
+        if (aWrapped || bWrapped) {
+          return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB);
+        }
+        // exit for functions and DOM nodes
+        if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
+          return false;
+        }
+        // in older versions of Opera, `arguments` objects have `Array` constructors
+        var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
+            ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
+
+        // non `Object` object instances with different constructors are not equal
+        if (ctorA != ctorB &&
+              !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
+              ('constructor' in a && 'constructor' in b)
+            ) {
+          return false;
+        }
+      }
+      // assume cyclic structures are equal
+      // the algorithm for detecting cyclic structures is adapted from ES 5.1
+      // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
+      var initedStack = !stackA;
+      stackA || (stackA = getArray());
+      stackB || (stackB = getArray());
+
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == a) {
+          return stackB[length] == b;
+        }
+      }
+      var size = 0;
+      result = true;
+
+      // add `a` and `b` to the stack of traversed objects
+      stackA.push(a);
+      stackB.push(b);
+
+      // recursively compare objects and arrays (susceptible to call stack limits)
+      if (isArr) {
+        // compare lengths to determine if a deep comparison is necessary
+        length = a.length;
+        size = b.length;
+        result = size == length;
+
+        if (result || isWhere) {
+          // deep compare the contents, ignoring non-numeric properties
+          while (size--) {
+            var index = length,
+                value = b[size];
+
+            if (isWhere) {
+              while (index--) {
+                if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) {
+                  break;
+                }
+              }
+            } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) {
+              break;
+            }
+          }
+        }
+      }
+      else {
+        // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
+        // which, in this case, is more costly
+        forIn(b, function(value, key, b) {
+          if (hasOwnProperty.call(b, key)) {
+            // count the number of properties.
+            size++;
+            // deep compare each property value.
+            return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB));
+          }
+        });
+
+        if (result && !isWhere) {
+          // ensure both objects have the same number of properties
+          forIn(a, function(value, key, a) {
+            if (hasOwnProperty.call(a, key)) {
+              // `size` will be `-1` if `a` has more properties than `b`
+              return (result = --size > -1);
+            }
+          });
+        }
+      }
+      stackA.pop();
+      stackB.pop();
+
+      if (initedStack) {
+        releaseArray(stackA);
+        releaseArray(stackB);
+      }
+      return result;
+    }
+
+    /**
+     * The base implementation of `_.merge` without argument juggling or support
+     * for `thisArg` binding.
+     *
+     * @private
+     * @param {Object} object The destination object.
+     * @param {Object} source The source object.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {Array} [stackA=[]] Tracks traversed source objects.
+     * @param {Array} [stackB=[]] Associates values with source counterparts.
+     */
+    function baseMerge(object, source, callback, stackA, stackB) {
+      (isArray(source) ? forEach : forOwn)(source, function(source, key) {
+        var found,
+            isArr,
+            result = source,
+            value = object[key];
+
+        if (source && ((isArr = isArray(source)) || isPlainObject(source))) {
+          // avoid merging previously merged cyclic sources
+          var stackLength = stackA.length;
+          while (stackLength--) {
+            if ((found = stackA[stackLength] == source)) {
+              value = stackB[stackLength];
+              break;
+            }
+          }
+          if (!found) {
+            var isShallow;
+            if (callback) {
+              result = callback(value, source);
+              if ((isShallow = typeof result != 'undefined')) {
+                value = result;
+              }
+            }
+            if (!isShallow) {
+              value = isArr
+                ? (isArray(value) ? value : [])
+                : (isPlainObject(value) ? value : {});
+            }
+            // add `source` and associated `value` to the stack of traversed objects
+            stackA.push(source);
+            stackB.push(value);
+
+            // recursively merge objects and arrays (susceptible to call stack limits)
+            if (!isShallow) {
+              baseMerge(value, source, callback, stackA, stackB);
+            }
+          }
+        }
+        else {
+          if (callback) {
+            result = callback(value, source);
+            if (typeof result == 'undefined') {
+              result = source;
+            }
+          }
+          if (typeof result != 'undefined') {
+            value = result;
+          }
+        }
+        object[key] = value;
+      });
+    }
+
+    /**
+     * The base implementation of `_.random` without argument juggling or support
+     * for returning floating-point numbers.
+     *
+     * @private
+     * @param {number} min The minimum possible value.
+     * @param {number} max The maximum possible value.
+     * @returns {number} Returns a random number.
+     */
+    function baseRandom(min, max) {
+      return min + floor(nativeRandom() * (max - min + 1));
+    }
+
+    /**
+     * The base implementation of `_.uniq` without support for callback shorthands
+     * or `thisArg` binding.
+     *
+     * @private
+     * @param {Array} array The array to process.
+     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+     * @param {Function} [callback] The function called per iteration.
+     * @returns {Array} Returns a duplicate-value-free array.
+     */
+    function baseUniq(array, isSorted, callback) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          result = [];
+
+      var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf,
+          seen = (callback || isLarge) ? getArray() : result;
+
+      if (isLarge) {
+        var cache = createCache(seen);
+        indexOf = cacheIndexOf;
+        seen = cache;
+      }
+      while (++index < length) {
+        var value = array[index],
+            computed = callback ? callback(value, index, array) : value;
+
+        if (isSorted
+              ? !index || seen[seen.length - 1] !== computed
+              : indexOf(seen, computed) < 0
+            ) {
+          if (callback || isLarge) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      if (isLarge) {
+        releaseArray(seen.array);
+        releaseObject(seen);
+      } else if (callback) {
+        releaseArray(seen);
+      }
+      return result;
+    }
+
+    /**
+     * Creates a function that aggregates a collection, creating an object composed
+     * of keys generated from the results of running each element of the collection
+     * through a callback. The given `setter` function sets the keys and values
+     * of the composed object.
+     *
+     * @private
+     * @param {Function} setter The setter function.
+     * @returns {Function} Returns the new aggregator function.
+     */
+    function createAggregator(setter) {
+      return function(collection, callback, thisArg) {
+        var result = {};
+        callback = lodash.createCallback(callback, thisArg, 3);
+
+        if (isArray(collection)) {
+          var index = -1,
+              length = collection.length;
+
+          while (++index < length) {
+            var value = collection[index];
+            setter(result, value, callback(value, index, collection), collection);
+          }
+        } else {
+          baseEach(collection, function(value, key, collection) {
+            setter(result, value, callback(value, key, collection), collection);
+          });
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that, when called, either curries or invokes `func`
+     * with an optional `this` binding and partially applied arguments.
+     *
+     * @private
+     * @param {Function|string} func The function or method name to reference.
+     * @param {number} bitmask The bitmask of method flags to compose.
+     *  The bitmask may be composed of the following flags:
+     *  1 - `_.bind`
+     *  2 - `_.bindKey`
+     *  4 - `_.curry`
+     *  8 - `_.curry` (bound)
+     *  16 - `_.partial`
+     *  32 - `_.partialRight`
+     * @param {Array} [partialArgs] An array of arguments to prepend to those
+     *  provided to the new function.
+     * @param {Array} [partialRightArgs] An array of arguments to append to those
+     *  provided to the new function.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {number} [arity] The arity of `func`.
+     * @returns {Function} Returns the new function.
+     */
+    function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
+      var isBind = bitmask & 1,
+          isBindKey = bitmask & 2,
+          isCurry = bitmask & 4,
+          isCurryBound = bitmask & 8,
+          isPartial = bitmask & 16,
+          isPartialRight = bitmask & 32;
+
+      if (!isBindKey && !isFunction(func)) {
+        throw new TypeError;
+      }
+      if (isPartial && !partialArgs.length) {
+        bitmask &= ~16;
+        isPartial = partialArgs = false;
+      }
+      if (isPartialRight && !partialRightArgs.length) {
+        bitmask &= ~32;
+        isPartialRight = partialRightArgs = false;
+      }
+      var bindData = func && func.__bindData__;
+      if (bindData && bindData !== true) {
+        // clone `bindData`
+        bindData = slice(bindData);
+        if (bindData[2]) {
+          bindData[2] = slice(bindData[2]);
+        }
+        if (bindData[3]) {
+          bindData[3] = slice(bindData[3]);
+        }
+        // set `thisBinding` is not previously bound
+        if (isBind && !(bindData[1] & 1)) {
+          bindData[4] = thisArg;
+        }
+        // set if previously bound but not currently (subsequent curried functions)
+        if (!isBind && bindData[1] & 1) {
+          bitmask |= 8;
+        }
+        // set curried arity if not yet set
+        if (isCurry && !(bindData[1] & 4)) {
+          bindData[5] = arity;
+        }
+        // append partial left arguments
+        if (isPartial) {
+          push.apply(bindData[2] || (bindData[2] = []), partialArgs);
+        }
+        // append partial right arguments
+        if (isPartialRight) {
+          unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs);
+        }
+        // merge flags
+        bindData[1] |= bitmask;
+        return createWrapper.apply(null, bindData);
+      }
+      // fast path for `_.bind`
+      var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;
+      return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);
+    }
+
+    /**
+     * Creates compiled iteration functions.
+     *
+     * @private
+     * @param {...Object} [options] The compile options object(s).
+     * @param {string} [options.array] Code to determine if the iterable is an array or array-like.
+     * @param {boolean} [options.useHas] Specify using `hasOwnProperty` checks in the object loop.
+     * @param {Function} [options.keys] A reference to `_.keys` for use in own property iteration.
+     * @param {string} [options.args] A comma separated string of iteration function arguments.
+     * @param {string} [options.top] Code to execute before the iteration branches.
+     * @param {string} [options.loop] Code to execute in the object loop.
+     * @param {string} [options.bottom] Code to execute after the iteration branches.
+     * @returns {Function} Returns the compiled function.
+     */
+    function createIterator() {
+      // data properties
+      iteratorData.shadowedProps = shadowedProps;
+      iteratorData.support = support;
+
+      // iterator options
+      iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = '';
+      iteratorData.init = 'iterable';
+      iteratorData.useHas = true;
+
+      // merge options into a template data object
+      for (var object, index = 0; object = arguments[index]; index++) {
+        for (var key in object) {
+          iteratorData[key] = object[key];
+        }
+      }
+      var args = iteratorData.args;
+      iteratorData.firstArg = /^[^,]+/.exec(args)[0];
+
+      // create the function factory
+      var factory = Function(
+          'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' +
+          'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' +
+          'objectTypes, nonEnumProps, stringClass, stringProto, toString',
+        'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}'
+      );
+
+      // return the compiled function
+      return factory(
+        baseCreateCallback, errorClass, errorProto, hasOwnProperty,
+        indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto,
+        objectTypes, nonEnumProps, stringClass, stringProto, toString
+      );
+    }
+
+    /**
+     * Used by `escape` to convert characters to HTML entities.
+     *
+     * @private
+     * @param {string} match The matched character to escape.
+     * @returns {string} Returns the escaped character.
+     */
+    function escapeHtmlChar(match) {
+      return htmlEscapes[match];
+    }
+
+    /**
+     * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+     * customized, this method returns the custom method, otherwise it returns
+     * the `baseIndexOf` function.
+     *
+     * @private
+     * @returns {Function} Returns the "indexOf" function.
+     */
+    function getIndexOf() {
+      var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;
+      return result;
+    }
+
+    /**
+     * Checks if `value` is a native function.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.
+     */
+    function isNative(value) {
+      return typeof value == 'function' && reNative.test(value);
+    }
+
+    /**
+     * Sets `this` binding data on a given function.
+     *
+     * @private
+     * @param {Function} func The function to set data on.
+     * @param {Array} value The data array to set.
+     */
+    var setBindData = !defineProperty ? noop : function(func, value) {
+      descriptor.value = value;
+      defineProperty(func, '__bindData__', descriptor);
+    };
+
+    /**
+     * A fallback implementation of `isPlainObject` which checks if a given value
+     * is an object created by the `Object` constructor, assuming objects created
+     * by the `Object` constructor have no inherited enumerable properties and that
+     * there are no `Object.prototype` extensions.
+     *
+     * @private
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     */
+    function shimIsPlainObject(value) {
+      var ctor,
+          result;
+
+      // avoid non Object objects, `arguments` objects, and DOM elements
+      if (!(value && toString.call(value) == objectClass) ||
+          (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) ||
+          (!support.argsClass && isArguments(value)) ||
+          (!support.nodeClass && isNode(value))) {
+        return false;
+      }
+      // IE < 9 iterates inherited properties before own properties. If the first
+      // iterated property is an object's own property then there are no inherited
+      // enumerable properties.
+      if (support.ownLast) {
+        forIn(value, function(value, key, object) {
+          result = hasOwnProperty.call(object, key);
+          return false;
+        });
+        return result !== false;
+      }
+      // In most environments an object's own properties are iterated before
+      // its inherited properties. If the last iterated property is an object's
+      // own property then there are no inherited enumerable properties.
+      forIn(value, function(value, key) {
+        result = key;
+      });
+      return typeof result == 'undefined' || hasOwnProperty.call(value, result);
+    }
+
+    /**
+     * Used by `unescape` to convert HTML entities to characters.
+     *
+     * @private
+     * @param {string} match The matched character to unescape.
+     * @returns {string} Returns the unescaped character.
+     */
+    function unescapeHtmlChar(match) {
+      return htmlUnescapes[match];
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Checks if `value` is an `arguments` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
+     * @example
+     *
+     * (function() { return _.isArguments(arguments); })(1, 2, 3);
+     * // => true
+     *
+     * _.isArguments([1, 2, 3]);
+     * // => false
+     */
+    function isArguments(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        toString.call(value) == argsClass || false;
+    }
+    // fallback for browsers that can't detect `arguments` objects by [[Class]]
+    if (!support.argsClass) {
+      isArguments = function(value) {
+        return value && typeof value == 'object' && typeof value.length == 'number' &&
+          hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false;
+      };
+    }
+
+    /**
+     * Checks if `value` is an array.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an array, else `false`.
+     * @example
+     *
+     * (function() { return _.isArray(arguments); })();
+     * // => false
+     *
+     * _.isArray([1, 2, 3]);
+     * // => true
+     */
+    var isArray = nativeIsArray || function(value) {
+      return value && typeof value == 'object' && typeof value.length == 'number' &&
+        toString.call(value) == arrayClass || false;
+    };
+
+    /**
+     * A fallback implementation of `Object.keys` which produces an array of the
+     * given object's own enumerable property names.
+     *
+     * @private
+     * @type Function
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names.
+     */
+    var shimKeys = createIterator({
+      'args': 'object',
+      'init': '[]',
+      'top': 'if (!(objectTypes[typeof object])) return result',
+      'loop': 'result.push(index)'
+    });
+
+    /**
+     * Creates an array composed of the own enumerable property names of an object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names.
+     * @example
+     *
+     * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
+     */
+    var keys = !nativeKeys ? shimKeys : function(object) {
+      if (!isObject(object)) {
+        return [];
+      }
+      if ((support.enumPrototypes && typeof object == 'function') ||
+          (support.nonEnumArgs && object.length && isArguments(object))) {
+        return shimKeys(object);
+      }
+      return nativeKeys(object);
+    };
+
+    /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */
+    var eachIteratorOptions = {
+      'args': 'collection, callback, thisArg',
+      'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)",
+      'array': "typeof length == 'number'",
+      'keys': keys,
+      'loop': 'if (callback(iterable[index], index, collection) === false) return result'
+    };
+
+    /** Reusable iterator options for `assign` and `defaults` */
+    var defaultsIteratorOptions = {
+      'args': 'object, source, guard',
+      'top':
+        'var args = arguments,\n' +
+        '    argsIndex = 0,\n' +
+        "    argsLength = typeof guard == 'number' ? 2 : args.length;\n" +
+        'while (++argsIndex < argsLength) {\n' +
+        '  iterable = args[argsIndex];\n' +
+        '  if (iterable && objectTypes[typeof iterable]) {',
+      'keys': keys,
+      'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
+      'bottom': '  }\n}'
+    };
+
+    /** Reusable iterator options for `forIn` and `forOwn` */
+    var forOwnIteratorOptions = {
+      'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top,
+      'array': false
+    };
+
+    /**
+     * Used to convert characters to HTML entities:
+     *
+     * Though the `>` character is escaped for symmetry, characters like `>` and `/`
+     * don't require escaping in HTML and have no special meaning unless they're part
+     * of a tag or an unquoted attribute value.
+     * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
+     */
+    var htmlEscapes = {
+      '&': '&amp;',
+      '<': '&lt;',
+      '>': '&gt;',
+      '"': '&quot;',
+      "'": '&#39;'
+    };
+
+    /** Used to convert HTML entities to characters */
+    var htmlUnescapes = invert(htmlEscapes);
+
+    /** Used to match HTML entities and HTML characters */
+    var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),
+        reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');
+
+    /**
+     * A function compiled to iterate `arguments` objects, arrays, objects, and
+     * strings consistenly across environments, executing the callback for each
+     * element in the collection. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index|key, collection). Callbacks may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @private
+     * @type Function
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     */
+    var baseEach = createIterator(eachIteratorOptions);
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object. Subsequent sources will overwrite property assignments of previous
+     * sources. If a callback is provided it will be executed to produce the
+     * assigned values. The callback is bound to `thisArg` and invoked with two
+     * arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @alias extend
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param {Function} [callback] The function to customize assigning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });
+     * // => { 'name': 'fred', 'employer': 'slate' }
+     *
+     * var defaults = _.partialRight(_.assign, function(a, b) {
+     *   return typeof a == 'undefined' ? b : a;
+     * });
+     *
+     * var object = { 'name': 'barney' };
+     * defaults(object, { 'name': 'fred', 'employer': 'slate' });
+     * // => { 'name': 'barney', 'employer': 'slate' }
+     */
+    var assign = createIterator(defaultsIteratorOptions, {
+      'top':
+        defaultsIteratorOptions.top.replace(';',
+          ';\n' +
+          "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
+          '  var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
+          "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
+          '  callback = args[--argsLength];\n' +
+          '}'
+        ),
+      'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
+    });
+
+    /**
+     * Creates a clone of `value`. If `isDeep` is `true` nested objects will also
+     * be cloned, otherwise they will be assigned by reference. If a callback
+     * is provided it will be executed to produce the cloned values. If the
+     * callback returns `undefined` cloning will be handled by the method instead.
+     * The callback is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to clone.
+     * @param {boolean} [isDeep=false] Specify a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the cloned value.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * var shallow = _.clone(characters);
+     * shallow[0] === characters[0];
+     * // => true
+     *
+     * var deep = _.clone(characters, true);
+     * deep[0] === characters[0];
+     * // => false
+     *
+     * _.mixin({
+     *   'clone': _.partialRight(_.clone, function(value) {
+     *     return _.isElement(value) ? value.cloneNode(false) : undefined;
+     *   })
+     * });
+     *
+     * var clone = _.clone(document.body);
+     * clone.childNodes.length;
+     * // => 0
+     */
+    function clone(value, isDeep, callback, thisArg) {
+      // allows working with "Collections" methods without using their `index`
+      // and `collection` arguments for `isDeep` and `callback`
+      if (typeof isDeep != 'boolean' && isDeep != null) {
+        thisArg = callback;
+        callback = isDeep;
+        isDeep = false;
+      }
+      return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+    }
+
+    /**
+     * Creates a deep clone of `value`. If a callback is provided it will be
+     * executed to produce the cloned values. If the callback returns `undefined`
+     * cloning will be handled by the method instead. The callback is bound to
+     * `thisArg` and invoked with one argument; (value).
+     *
+     * Note: This method is loosely based on the structured clone algorithm. Functions
+     * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
+     * objects created by constructors other than `Object` are cloned to plain `Object` objects.
+     * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the deep cloned value.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * var deep = _.cloneDeep(characters);
+     * deep[0] === characters[0];
+     * // => false
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'node': element
+     * };
+     *
+     * var clone = _.cloneDeep(view, function(value) {
+     *   return _.isElement(value) ? value.cloneNode(true) : undefined;
+     * });
+     *
+     * clone.node == view.node;
+     * // => false
+     */
+    function cloneDeep(value, callback, thisArg) {
+      return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+    }
+
+    /**
+     * Creates an object that inherits from the given `prototype` object. If a
+     * `properties` object is provided its own enumerable properties are assigned
+     * to the created object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} prototype The object to inherit from.
+     * @param {Object} [properties] The properties to assign to the object.
+     * @returns {Object} Returns the new object.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * function Circle() {
+     *   Shape.call(this);
+     * }
+     *
+     * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle });
+     *
+     * var circle = new Circle;
+     * circle instanceof Circle;
+     * // => true
+     *
+     * circle instanceof Shape;
+     * // => true
+     */
+    function create(prototype, properties) {
+      var result = baseCreate(prototype);
+      return properties ? assign(result, properties) : result;
+    }
+
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object for all destination properties that resolve to `undefined`. Once a
+     * property is set, additional defaults of the same property will be ignored.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param- {Object} [guard] Allows working with `_.reduce` without using its
+     *  `key` and `object` arguments as sources.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var object = { 'name': 'barney' };
+     * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
+     * // => { 'name': 'barney', 'employer': 'slate' }
+     */
+    var defaults = createIterator(defaultsIteratorOptions);
+
+    /**
+     * This method is like `_.findIndex` except that it returns the key of the
+     * first element that passes the callback check, instead of the element itself.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [callback=identity] The function called per
+     *  iteration. If a property name or object is provided it will be used to
+     *  create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {string|undefined} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * var characters = {
+     *   'barney': {  'age': 36, 'blocked': false },
+     *   'fred': {    'age': 40, 'blocked': true },
+     *   'pebbles': { 'age': 1,  'blocked': false }
+     * };
+     *
+     * _.findKey(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => 'barney' (property order is not guaranteed across environments)
+     *
+     * // using "_.where" callback shorthand
+     * _.findKey(characters, { 'age': 1 });
+     * // => 'pebbles'
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findKey(characters, 'blocked');
+     * // => 'fred'
+     */
+    function findKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forOwn(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * This method is like `_.findKey` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|string} [callback=identity] The function called per
+     *  iteration. If a property name or object is provided it will be used to
+     *  create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {string|undefined} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * var characters = {
+     *   'barney': {  'age': 36, 'blocked': true },
+     *   'fred': {    'age': 40, 'blocked': false },
+     *   'pebbles': { 'age': 1,  'blocked': true }
+     * };
+     *
+     * _.findLastKey(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => returns `pebbles`, assuming `_.findKey` returns `barney`
+     *
+     * // using "_.where" callback shorthand
+     * _.findLastKey(characters, { 'age': 40 });
+     * // => 'fred'
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findLastKey(characters, 'blocked');
+     * // => 'pebbles'
+     */
+    function findLastKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forOwnRight(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Iterates over own and inherited enumerable properties of an object,
+     * executing the callback for each property. The callback is bound to `thisArg`
+     * and invoked with three arguments; (value, key, object). Callbacks may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * Shape.prototype.move = function(x, y) {
+     *   this.x += x;
+     *   this.y += y;
+     * };
+     *
+     * _.forIn(new Shape, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)
+     */
+    var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, {
+      'useHas': false
+    });
+
+    /**
+     * This method is like `_.forIn` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * Shape.prototype.move = function(x, y) {
+     *   this.x += x;
+     *   this.y += y;
+     * };
+     *
+     * _.forInRight(new Shape, function(value, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move'
+     */
+    function forInRight(object, callback, thisArg) {
+      var pairs = [];
+
+      forIn(object, function(value, key) {
+        pairs.push(key, value);
+      });
+
+      var length = pairs.length;
+      callback = baseCreateCallback(callback, thisArg, 3);
+      while (length--) {
+        if (callback(pairs[length--], pairs[length], object) === false) {
+          break;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Iterates over own enumerable properties of an object, executing the callback
+     * for each property. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, key, object). Callbacks may exit iteration early by
+     * explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   console.log(key);
+     * });
+     * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
+     */
+    var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions);
+
+    /**
+     * This method is like `_.forOwn` except that it iterates over elements
+     * of a `collection` in the opposite order.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   console.log(key);
+     * });
+     * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length'
+     */
+    function forOwnRight(object, callback, thisArg) {
+      var props = keys(object),
+          length = props.length;
+
+      callback = baseCreateCallback(callback, thisArg, 3);
+      while (length--) {
+        var key = props[length];
+        if (callback(object[key], key, object) === false) {
+          break;
+        }
+      }
+      return object;
+    }
+
+    /**
+     * Creates a sorted array of property names of all enumerable properties,
+     * own and inherited, of `object` that have function values.
+     *
+     * @static
+     * @memberOf _
+     * @alias methods
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property names that have function values.
+     * @example
+     *
+     * _.functions(_);
+     * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]
+     */
+    function functions(object) {
+      var result = [];
+      forIn(object, function(value, key) {
+        if (isFunction(value)) {
+          result.push(key);
+        }
+      });
+      return result.sort();
+    }
+
+    /**
+     * Checks if the specified property name exists as a direct property of `object`,
+     * instead of an inherited property.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @param {string} key The name of the property to check.
+     * @returns {boolean} Returns `true` if key is a direct property, else `false`.
+     * @example
+     *
+     * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
+     * // => true
+     */
+    function has(object, key) {
+      return object ? hasOwnProperty.call(object, key) : false;
+    }
+
+    /**
+     * Creates an object composed of the inverted keys and values of the given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to invert.
+     * @returns {Object} Returns the created inverted object.
+     * @example
+     *
+     * _.invert({ 'first': 'fred', 'second': 'barney' });
+     * // => { 'fred': 'first', 'barney': 'second' }
+     */
+    function invert(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = {};
+
+      while (++index < length) {
+        var key = props[index];
+        result[object[key]] = key;
+      }
+      return result;
+    }
+
+    /**
+     * Checks if `value` is a boolean value.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`.
+     * @example
+     *
+     * _.isBoolean(null);
+     * // => false
+     */
+    function isBoolean(value) {
+      return value === true || value === false ||
+        value && typeof value == 'object' && toString.call(value) == boolClass || false;
+    }
+
+    /**
+     * Checks if `value` is a date.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a date, else `false`.
+     * @example
+     *
+     * _.isDate(new Date);
+     * // => true
+     */
+    function isDate(value) {
+      return value && typeof value == 'object' && toString.call(value) == dateClass || false;
+    }
+
+    /**
+     * Checks if `value` is a DOM element.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.
+     * @example
+     *
+     * _.isElement(document.body);
+     * // => true
+     */
+    function isElement(value) {
+      return value && value.nodeType === 1 || false;
+    }
+
+    /**
+     * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
+     * length of `0` and objects with no own enumerable properties are considered
+     * "empty".
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object|string} value The value to inspect.
+     * @returns {boolean} Returns `true` if the `value` is empty, else `false`.
+     * @example
+     *
+     * _.isEmpty([1, 2, 3]);
+     * // => false
+     *
+     * _.isEmpty({});
+     * // => true
+     *
+     * _.isEmpty('');
+     * // => true
+     */
+    function isEmpty(value) {
+      var result = true;
+      if (!value) {
+        return result;
+      }
+      var className = toString.call(value),
+          length = value.length;
+
+      if ((className == arrayClass || className == stringClass ||
+          (support.argsClass ? className == argsClass : isArguments(value))) ||
+          (className == objectClass && typeof length == 'number' && isFunction(value.splice))) {
+        return !length;
+      }
+      forOwn(value, function() {
+        return (result = false);
+      });
+      return result;
+    }
+
+    /**
+     * Performs a deep comparison between two values to determine if they are
+     * equivalent to each other. If a callback is provided it will be executed
+     * to compare values. If the callback returns `undefined` comparisons will
+     * be handled by the method instead. The callback is bound to `thisArg` and
+     * invoked with two arguments; (a, b).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} a The value to compare.
+     * @param {*} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * var copy = { 'name': 'fred' };
+     *
+     * object == copy;
+     * // => false
+     *
+     * _.isEqual(object, copy);
+     * // => true
+     *
+     * var words = ['hello', 'goodbye'];
+     * var otherWords = ['hi', 'goodbye'];
+     *
+     * _.isEqual(words, otherWords, function(a, b) {
+     *   var reGreet = /^(?:hello|hi)$/i,
+     *       aGreet = _.isString(a) && reGreet.test(a),
+     *       bGreet = _.isString(b) && reGreet.test(b);
+     *
+     *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
+     * });
+     * // => true
+     */
+    function isEqual(a, b, callback, thisArg) {
+      return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2));
+    }
+
+    /**
+     * Checks if `value` is, or can be coerced to, a finite number.
+     *
+     * Note: This is not the same as native `isFinite` which will return true for
+     * booleans and empty strings. See http://es5.github.io/#x15.1.2.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is finite, else `false`.
+     * @example
+     *
+     * _.isFinite(-101);
+     * // => true
+     *
+     * _.isFinite('10');
+     * // => true
+     *
+     * _.isFinite(true);
+     * // => false
+     *
+     * _.isFinite('');
+     * // => false
+     *
+     * _.isFinite(Infinity);
+     * // => false
+     */
+    function isFinite(value) {
+      return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
+    }
+
+    /**
+     * Checks if `value` is a function.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a function, else `false`.
+     * @example
+     *
+     * _.isFunction(_);
+     * // => true
+     */
+    function isFunction(value) {
+      return typeof value == 'function';
+    }
+    // fallback for older versions of Chrome and Safari
+    if (isFunction(/x/)) {
+      isFunction = function(value) {
+        return typeof value == 'function' && toString.call(value) == funcClass;
+      };
+    }
+
+    /**
+     * Checks if `value` is the language type of Object.
+     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
+     * @example
+     *
+     * _.isObject({});
+     * // => true
+     *
+     * _.isObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isObject(1);
+     * // => false
+     */
+    function isObject(value) {
+      // check if the value is the ECMAScript language type of Object
+      // http://es5.github.io/#x8
+      // and avoid a V8 bug
+      // http://code.google.com/p/v8/issues/detail?id=2291
+      return !!(value && objectTypes[typeof value]);
+    }
+
+    /**
+     * Checks if `value` is `NaN`.
+     *
+     * Note: This is not the same as native `isNaN` which will return `true` for
+     * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.
+     * @example
+     *
+     * _.isNaN(NaN);
+     * // => true
+     *
+     * _.isNaN(new Number(NaN));
+     * // => true
+     *
+     * isNaN(undefined);
+     * // => true
+     *
+     * _.isNaN(undefined);
+     * // => false
+     */
+    function isNaN(value) {
+      // `NaN` as a primitive is the only value that is not equal to itself
+      // (perform the [[Class]] check first to avoid errors with some host objects in IE)
+      return isNumber(value) && value != +value;
+    }
+
+    /**
+     * Checks if `value` is `null`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `null`, else `false`.
+     * @example
+     *
+     * _.isNull(null);
+     * // => true
+     *
+     * _.isNull(undefined);
+     * // => false
+     */
+    function isNull(value) {
+      return value === null;
+    }
+
+    /**
+     * Checks if `value` is a number.
+     *
+     * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a number, else `false`.
+     * @example
+     *
+     * _.isNumber(8.4 * 5);
+     * // => true
+     */
+    function isNumber(value) {
+      return typeof value == 'number' ||
+        value && typeof value == 'object' && toString.call(value) == numberClass || false;
+    }
+
+    /**
+     * Checks if `value` is an object created by the `Object` constructor.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+     * @example
+     *
+     * function Shape() {
+     *   this.x = 0;
+     *   this.y = 0;
+     * }
+     *
+     * _.isPlainObject(new Shape);
+     * // => false
+     *
+     * _.isPlainObject([1, 2, 3]);
+     * // => false
+     *
+     * _.isPlainObject({ 'x': 0, 'y': 0 });
+     * // => true
+     */
+    var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
+      if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) {
+        return false;
+      }
+      var valueOf = value.valueOf,
+          objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
+
+      return objProto
+        ? (value == objProto || getPrototypeOf(value) == objProto)
+        : shimIsPlainObject(value);
+    };
+
+    /**
+     * Checks if `value` is a regular expression.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`.
+     * @example
+     *
+     * _.isRegExp(/fred/);
+     * // => true
+     */
+    function isRegExp(value) {
+      return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false;
+    }
+
+    /**
+     * Checks if `value` is a string.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is a string, else `false`.
+     * @example
+     *
+     * _.isString('fred');
+     * // => true
+     */
+    function isString(value) {
+      return typeof value == 'string' ||
+        value && typeof value == 'object' && toString.call(value) == stringClass || false;
+    }
+
+    /**
+     * Checks if `value` is `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {*} value The value to check.
+     * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`.
+     * @example
+     *
+     * _.isUndefined(void 0);
+     * // => true
+     */
+    function isUndefined(value) {
+      return typeof value == 'undefined';
+    }
+
+    /**
+     * Creates an object with the same keys as `object` and values generated by
+     * running each own enumerable property of `object` through the callback.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new object with values of the results of each `callback` execution.
+     * @example
+     *
+     * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     *
+     * var characters = {
+     *   'fred': { 'name': 'fred', 'age': 40 },
+     *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.mapValues(characters, 'age');
+     * // => { 'fred': 40, 'pebbles': 1 }
+     */
+    function mapValues(object, callback, thisArg) {
+      var result = {};
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      forOwn(object, function(value, key, object) {
+        result[key] = callback(value, key, object);
+      });
+      return result;
+    }
+
+    /**
+     * Recursively merges own enumerable properties of the source object(s), that
+     * don't resolve to `undefined` into the destination object. Subsequent sources
+     * will overwrite property assignments of previous sources. If a callback is
+     * provided it will be executed to produce the merged values of the destination
+     * and source properties. If the callback returns `undefined` merging will
+     * be handled by the method instead. The callback is bound to `thisArg` and
+     * invoked with two arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {...Object} [source] The source objects.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var names = {
+     *   'characters': [
+     *     { 'name': 'barney' },
+     *     { 'name': 'fred' }
+     *   ]
+     * };
+     *
+     * var ages = {
+     *   'characters': [
+     *     { 'age': 36 },
+     *     { 'age': 40 }
+     *   ]
+     * };
+     *
+     * _.merge(names, ages);
+     * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] }
+     *
+     * var food = {
+     *   'fruits': ['apple'],
+     *   'vegetables': ['beet']
+     * };
+     *
+     * var otherFood = {
+     *   'fruits': ['banana'],
+     *   'vegetables': ['carrot']
+     * };
+     *
+     * _.merge(food, otherFood, function(a, b) {
+     *   return _.isArray(a) ? a.concat(b) : undefined;
+     * });
+     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
+     */
+    function merge(object) {
+      var args = arguments,
+          length = 2;
+
+      if (!isObject(object)) {
+        return object;
+      }
+      // allows working with `_.reduce` and `_.reduceRight` without using
+      // their `index` and `collection` arguments
+      if (typeof args[2] != 'number') {
+        length = args.length;
+      }
+      if (length > 3 && typeof args[length - 2] == 'function') {
+        var callback = baseCreateCallback(args[--length - 1], args[length--], 2);
+      } else if (length > 2 && typeof args[length - 1] == 'function') {
+        callback = args[--length];
+      }
+      var sources = slice(arguments, 1, length),
+          index = -1,
+          stackA = getArray(),
+          stackB = getArray();
+
+      while (++index < length) {
+        baseMerge(object, sources[index], callback, stackA, stackB);
+      }
+      releaseArray(stackA);
+      releaseArray(stackB);
+      return object;
+    }
+
+    /**
+     * Creates a shallow clone of `object` excluding the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a callback is provided it will be executed for each
+     * property of `object` omitting the properties the callback returns truey
+     * for. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|...string|string[]} [callback] The properties to omit or the
+     *  function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object without the omitted properties.
+     * @example
+     *
+     * _.omit({ 'name': 'fred', 'age': 40 }, 'age');
+     * // => { 'name': 'fred' }
+     *
+     * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {
+     *   return typeof value == 'number';
+     * });
+     * // => { 'name': 'fred' }
+     */
+    function omit(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var props = [];
+        forIn(object, function(value, key) {
+          props.push(key);
+        });
+        props = baseDifference(props, baseFlatten(arguments, true, false, 1));
+
+        var index = -1,
+            length = props.length;
+
+        while (++index < length) {
+          var key = props[index];
+          result[key] = object[key];
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg, 3);
+        forIn(object, function(value, key, object) {
+          if (!callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Creates a two dimensional array of an object's key-value pairs,
+     * i.e. `[[key1, value1], [key2, value2]]`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns new array of key-value pairs.
+     * @example
+     *
+     * _.pairs({ 'barney': 36, 'fred': 40 });
+     * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments)
+     */
+    function pairs(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        var key = props[index];
+        result[index] = [key, object[key]];
+      }
+      return result;
+    }
+
+    /**
+     * Creates a shallow clone of `object` composed of the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a callback is provided it will be executed for each
+     * property of `object` picking the properties the callback returns truey
+     * for. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|...string|string[]} [callback] The function called per
+     *  iteration or property names to pick, specified as individual property
+     *  names or arrays of property names.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object composed of the picked properties.
+     * @example
+     *
+     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name');
+     * // => { 'name': 'fred' }
+     *
+     * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) {
+     *   return key.charAt(0) != '_';
+     * });
+     * // => { 'name': 'fred' }
+     */
+    function pick(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var index = -1,
+            props = baseFlatten(arguments, true, false, 1),
+            length = isObject(object) ? props.length : 0;
+
+        while (++index < length) {
+          var key = props[index];
+          if (key in object) {
+            result[key] = object[key];
+          }
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg, 3);
+        forIn(object, function(value, key, object) {
+          if (callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * An alternative to `_.reduce` this method transforms `object` to a new
+     * `accumulator` object which is the result of running each of its own
+     * enumerable properties through a callback, with each callback execution
+     * potentially mutating the `accumulator` object. The callback is bound to
+     * `thisArg` and invoked with four arguments; (accumulator, value, key, object).
+     * Callbacks may exit iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] The custom accumulator value.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {
+     *   num *= num;
+     *   if (num % 2) {
+     *     return result.push(num) < 3;
+     *   }
+     * });
+     * // => [1, 9, 25]
+     *
+     * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     * });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function transform(object, callback, accumulator, thisArg) {
+      var isArr = isArray(object);
+      if (accumulator == null) {
+        if (isArr) {
+          accumulator = [];
+        } else {
+          var ctor = object && object.constructor,
+              proto = ctor && ctor.prototype;
+
+          accumulator = baseCreate(proto);
+        }
+      }
+      if (callback) {
+        callback = lodash.createCallback(callback, thisArg, 4);
+        (isArr ? baseEach : forOwn)(object, function(value, index, object) {
+          return callback(accumulator, value, index, object);
+        });
+      }
+      return accumulator;
+    }
+
+    /**
+     * Creates an array composed of the own enumerable property values of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns an array of property values.
+     * @example
+     *
+     * _.values({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => [1, 2, 3] (property order is not guaranteed across environments)
+     */
+    function values(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = object[props[index]];
+      }
+      return result;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array of elements from the specified indexes, or keys, of the
+     * `collection`. Indexes may be specified as individual arguments or as arrays
+     * of indexes.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {...(number|number[]|string|string[])} [index] The indexes of `collection`
+     *   to retrieve, specified as individual indexes or arrays of indexes.
+     * @returns {Array} Returns a new array of elements corresponding to the
+     *  provided indexes.
+     * @example
+     *
+     * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
+     * // => ['a', 'c', 'e']
+     *
+     * _.at(['fred', 'barney', 'pebbles'], 0, 2);
+     * // => ['fred', 'pebbles']
+     */
+    function at(collection) {
+      var args = arguments,
+          index = -1,
+          props = baseFlatten(args, true, false, 1),
+          length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length,
+          result = Array(length);
+
+      if (support.unindexedChars && isString(collection)) {
+        collection = collection.split('');
+      }
+      while(++index < length) {
+        result[index] = collection[props[index]];
+      }
+      return result;
+    }
+
+    /**
+     * Checks if a given value is present in a collection using strict equality
+     * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
+     * offset from the end of the collection.
+     *
+     * @static
+     * @memberOf _
+     * @alias include
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {*} target The value to check for.
+     * @param {number} [fromIndex=0] The index to search from.
+     * @returns {boolean} Returns `true` if the `target` element is found, else `false`.
+     * @example
+     *
+     * _.contains([1, 2, 3], 1);
+     * // => true
+     *
+     * _.contains([1, 2, 3], 1, 2);
+     * // => false
+     *
+     * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
+     * // => true
+     *
+     * _.contains('pebbles', 'eb');
+     * // => true
+     */
+    function contains(collection, target, fromIndex) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = collection ? collection.length : 0,
+          result = false;
+
+      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
+      if (isArray(collection)) {
+        result = indexOf(collection, target, fromIndex) > -1;
+      } else if (typeof length == 'number') {
+        result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1;
+      } else {
+        baseEach(collection, function(value) {
+          if (++index >= fromIndex) {
+            return !(result = value === target);
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of `collection` through the callback. The corresponding value
+     * of each key is the number of times the key was returned by the callback.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy(['one', 'two', 'three'], 'length');
+     * // => { '3': 2, '5': 1 }
+     */
+    var countBy = createAggregator(function(result, value, key) {
+      (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);
+    });
+
+    /**
+     * Checks if the given callback returns truey value for **all** elements of
+     * a collection. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias all
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if all elements passed the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.every([true, 1, null, 'yes']);
+     * // => false
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.every(characters, 'age');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.every(characters, { 'age': 36 });
+     * // => false
+     */
+    function every(collection, callback, thisArg) {
+      var result = true;
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          if (!(result = !!callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          return (result = !!callback(value, index, collection));
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, returning an array of all elements
+     * the callback returns truey for. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias select
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that passed the callback check.
+     * @example
+     *
+     * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [2, 4, 6]
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.filter(characters, 'blocked');
+     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+     *
+     * // using "_.where" callback shorthand
+     * _.filter(characters, { 'age': 36 });
+     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+     */
+    function filter(collection, callback, thisArg) {
+      var result = [];
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, returning the first element that
+     * the callback returns truey for. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias detect, findWhere
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the found element, else `undefined`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': false },
+     *   { 'name': 'fred',    'age': 40, 'blocked': true },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+     * ];
+     *
+     * _.find(characters, function(chr) {
+     *   return chr.age < 40;
+     * });
+     * // => { 'name': 'barney', 'age': 36, 'blocked': false }
+     *
+     * // using "_.where" callback shorthand
+     * _.find(characters, { 'age': 1 });
+     * // =>  { 'name': 'pebbles', 'age': 1, 'blocked': false }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.find(characters, 'blocked');
+     * // => { 'name': 'fred', 'age': 40, 'blocked': true }
+     */
+    function find(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            return value;
+          }
+        }
+      } else {
+        var result;
+        baseEach(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result = value;
+            return false;
+          }
+        });
+        return result;
+      }
+    }
+
+    /**
+     * This method is like `_.find` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the found element, else `undefined`.
+     * @example
+     *
+     * _.findLast([1, 2, 3, 4], function(num) {
+     *   return num % 2 == 1;
+     * });
+     * // => 3
+     */
+    function findLast(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      forEachRight(collection, function(value, index, collection) {
+        if (callback(value, index, collection)) {
+          result = value;
+          return false;
+        }
+      });
+      return result;
+    }
+
+    /**
+     * Iterates over elements of a collection, executing the callback for each
+     * element. The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection). Callbacks may exit iteration early by
+     * explicitly returning `false`.
+     *
+     * Note: As with other "Collections" methods, objects with a `length` property
+     * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+     * may be used for object iteration.
+     *
+     * @static
+     * @memberOf _
+     * @alias each
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');
+     * // => logs each number and returns '1,2,3'
+     *
+     * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
+     * // => logs each number and returns the object (property order is not guaranteed across environments)
+     */
+    function forEach(collection, callback, thisArg) {
+      if (callback && typeof thisArg == 'undefined' && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          if (callback(collection[index], index, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        baseEach(collection, callback, thisArg);
+      }
+      return collection;
+    }
+
+    /**
+     * This method is like `_.forEach` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias eachRight
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|string} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(',');
+     * // => logs each number from right to left and returns '3,2,1'
+     */
+    function forEachRight(collection, callback, thisArg) {
+      var iterable = collection,
+          length = collection ? collection.length : 0;
+
+      callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+      if (isArray(collection)) {
+        while (length--) {
+          if (callback(collection[length], length, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        if (typeof length != 'number') {
+          var props = keys(collection);
+          length = props.length;
+        } else if (support.unindexedChars && isString(collection)) {
+          iterable = collection.split('');
+        }
+        baseEach(collection, function(value, key, collection) {
+          key = props ? props[--length] : --length;
+          return callback(iterable[key], key, collection);
+        });
+      }
+      return collection;
+    }
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of a collection through the callback. The corresponding value
+     * of each key is an array of the elements responsible for generating the key.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.groupBy(['one', 'two', 'three'], 'length');
+     * // => { '3': ['one', 'two'], '5': ['three'] }
+     */
+    var groupBy = createAggregator(function(result, value, key) {
+      (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
+    });
+
+    /**
+     * Creates an object composed of keys generated from the results of running
+     * each element of the collection through the given callback. The corresponding
+     * value of each key is the last element responsible for generating the key.
+     * The callback is bound to `thisArg` and invoked with three arguments;
+     * (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * var keys = [
+     *   { 'dir': 'left', 'code': 97 },
+     *   { 'dir': 'right', 'code': 100 }
+     * ];
+     *
+     * _.indexBy(keys, 'dir');
+     * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     *
+     * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String);
+     * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
+     */
+    var indexBy = createAggregator(function(result, value, key) {
+      result[key] = value;
+    });
+
+    /**
+     * Invokes the method named by `methodName` on each element in the `collection`
+     * returning an array of the results of each invoked method. Additional arguments
+     * will be provided to each invoked method. If `methodName` is a function it
+     * will be invoked for, and `this` bound to, each element in the `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|string} methodName The name of the method to invoke or
+     *  the function invoked per iteration.
+     * @param {...*} [arg] Arguments to invoke the method with.
+     * @returns {Array} Returns a new array of the results of each invoked method.
+     * @example
+     *
+     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+     * // => [[1, 5, 7], [1, 2, 3]]
+     *
+     * _.invoke([123, 456], String.prototype.split, '');
+     * // => [['1', '2', '3'], ['4', '5', '6']]
+     */
+    function invoke(collection, methodName) {
+      var args = slice(arguments, 2),
+          index = -1,
+          isFunc = typeof methodName == 'function',
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      forEach(collection, function(value) {
+        result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
+      });
+      return result;
+    }
+
+    /**
+     * Creates an array of values by running each element in the collection
+     * through the callback. The callback is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias collect
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of the results of each `callback` execution.
+     * @example
+     *
+     * _.map([1, 2, 3], function(num) { return num * 3; });
+     * // => [3, 6, 9]
+     *
+     * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
+     * // => [3, 6, 9] (property order is not guaranteed across environments)
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(characters, 'name');
+     * // => ['barney', 'fred']
+     */
+    function map(collection, callback, thisArg) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      if (isArray(collection)) {
+        while (++index < length) {
+          result[index] = callback(collection[index], index, collection);
+        }
+      } else {
+        baseEach(collection, function(value, key, collection) {
+          result[++index] = callback(value, key, collection);
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the maximum value of a collection. If the collection is empty or
+     * falsey `-Infinity` is returned. If a callback is provided it will be executed
+     * for each value in the collection to generate the criterion by which the value
+     * is ranked. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the maximum value.
+     * @example
+     *
+     * _.max([4, 2, 8, 6]);
+     * // => 8
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.max(characters, function(chr) { return chr.age; });
+     * // => { 'name': 'fred', 'age': 40 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.max(characters, 'age');
+     * // => { 'name': 'fred', 'age': 40 };
+     */
+    function max(collection, callback, thisArg) {
+      var computed = -Infinity,
+          result = computed;
+
+      // allows working with functions like `_.map` without using
+      // their `index` argument as a callback
+      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+        callback = null;
+      }
+      if (callback == null && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (value > result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (callback == null && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg, 3);
+
+        baseEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current > computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the minimum value of a collection. If the collection is empty or
+     * falsey `Infinity` is returned. If a callback is provided it will be executed
+     * for each value in the collection to generate the criterion by which the value
+     * is ranked. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the minimum value.
+     * @example
+     *
+     * _.min([4, 2, 8, 6]);
+     * // => 2
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.min(characters, function(chr) { return chr.age; });
+     * // => { 'name': 'barney', 'age': 36 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.min(characters, 'age');
+     * // => { 'name': 'barney', 'age': 36 };
+     */
+    function min(collection, callback, thisArg) {
+      var computed = Infinity,
+          result = computed;
+
+      // allows working with functions like `_.map` without using
+      // their `index` argument as a callback
+      if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) {
+        callback = null;
+      }
+      if (callback == null && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          var value = collection[index];
+          if (value < result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (callback == null && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg, 3);
+
+        baseEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current < computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+
+    /**
+     * Retrieves the value of a specified property from all elements in the collection.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {string} property The name of the property to pluck.
+     * @returns {Array} Returns a new array of property values.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * _.pluck(characters, 'name');
+     * // => ['barney', 'fred']
+     */
+    var pluck = map;
+
+    /**
+     * Reduces a collection to a value which is the accumulated result of running
+     * each element in the collection through the callback, where each successive
+     * callback execution consumes the return value of the previous execution. If
+     * `accumulator` is not provided the first element of the collection will be
+     * used as the initial `accumulator` value. The callback is bound to `thisArg`
+     * and invoked with four arguments; (accumulator, value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @alias foldl, inject
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] Initial value of the accumulator.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var sum = _.reduce([1, 2, 3], function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     *   return result;
+     * }, {});
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function reduce(collection, callback, accumulator, thisArg) {
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        if (noaccum) {
+          accumulator = collection[++index];
+        }
+        while (++index < length) {
+          accumulator = callback(accumulator, collection[index], index, collection);
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          accumulator = noaccum
+            ? (noaccum = false, value)
+            : callback(accumulator, value, index, collection)
+        });
+      }
+      return accumulator;
+    }
+
+    /**
+     * This method is like `_.reduce` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias foldr
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {*} [accumulator] Initial value of the accumulator.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the accumulated value.
+     * @example
+     *
+     * var list = [[0, 1], [2, 3], [4, 5]];
+     * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
+     * // => [4, 5, 2, 3, 0, 1]
+     */
+    function reduceRight(collection, callback, accumulator, thisArg) {
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+      forEachRight(collection, function(value, index, collection) {
+        accumulator = noaccum
+          ? (noaccum = false, value)
+          : callback(accumulator, value, index, collection);
+      });
+      return accumulator;
+    }
+
+    /**
+     * The opposite of `_.filter` this method returns the elements of a
+     * collection that the callback does **not** return truey for.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that failed the callback check.
+     * @example
+     *
+     * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [1, 3, 5]
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.reject(characters, 'blocked');
+     * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }]
+     *
+     * // using "_.where" callback shorthand
+     * _.reject(characters, { 'age': 36 });
+     * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }]
+     */
+    function reject(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg, 3);
+      return filter(collection, function(value, index, collection) {
+        return !callback(value, index, collection);
+      });
+    }
+
+    /**
+     * Retrieves a random element or `n` random elements from a collection.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to sample.
+     * @param {number} [n] The number of elements to sample.
+     * @param- {Object} [guard] Allows working with functions like `_.map`
+     *  without using their `index` arguments as `n`.
+     * @returns {Array} Returns the random sample(s) of `collection`.
+     * @example
+     *
+     * _.sample([1, 2, 3, 4]);
+     * // => 2
+     *
+     * _.sample([1, 2, 3, 4], 2);
+     * // => [3, 1]
+     */
+    function sample(collection, n, guard) {
+      if (collection && typeof collection.length != 'number') {
+        collection = values(collection);
+      } else if (support.unindexedChars && isString(collection)) {
+        collection = collection.split('');
+      }
+      if (n == null || guard) {
+        return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
+      }
+      var result = shuffle(collection);
+      result.length = nativeMin(nativeMax(0, n), result.length);
+      return result;
+    }
+
+    /**
+     * Creates an array of shuffled values, using a version of the Fisher-Yates
+     * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to shuffle.
+     * @returns {Array} Returns a new shuffled collection.
+     * @example
+     *
+     * _.shuffle([1, 2, 3, 4, 5, 6]);
+     * // => [4, 1, 6, 3, 5, 2]
+     */
+    function shuffle(collection) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      forEach(collection, function(value) {
+        var rand = baseRandom(0, ++index);
+        result[index] = result[rand];
+        result[rand] = value;
+      });
+      return result;
+    }
+
+    /**
+     * Gets the size of the `collection` by returning `collection.length` for arrays
+     * and array-like objects or the number of own enumerable properties for objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to inspect.
+     * @returns {number} Returns `collection.length` or number of own enumerable properties.
+     * @example
+     *
+     * _.size([1, 2]);
+     * // => 2
+     *
+     * _.size({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => 3
+     *
+     * _.size('pebbles');
+     * // => 7
+     */
+    function size(collection) {
+      var length = collection ? collection.length : 0;
+      return typeof length == 'number' ? length : keys(collection).length;
+    }
+
+    /**
+     * Checks if the callback returns a truey value for **any** element of a
+     * collection. The function returns as soon as it finds a passing value and
+     * does not iterate over the entire collection. The callback is bound to
+     * `thisArg` and invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias any
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {boolean} Returns `true` if any element passed the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.some([null, 0, 'yes', false], Boolean);
+     * // => true
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'blocked': false },
+     *   { 'name': 'fred',   'age': 40, 'blocked': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.some(characters, 'blocked');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.some(characters, { 'age': 1 });
+     * // => false
+     */
+    function some(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg, 3);
+
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+
+        while (++index < length) {
+          if ((result = callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        baseEach(collection, function(value, index, collection) {
+          return !(result = callback(value, index, collection));
+        });
+      }
+      return !!result;
+    }
+
+    /**
+     * Creates an array of elements, sorted in ascending order by the results of
+     * running each element in a collection through the callback. This method
+     * performs a stable sort, that is, it will preserve the original sort order
+     * of equal elements. The callback is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an array of property names is provided for `callback` the collection
+     * will be sorted by each property value.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Array|Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of sorted elements.
+     * @example
+     *
+     * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
+     * // => [3, 1, 2]
+     *
+     * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
+     * // => [3, 1, 2]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36 },
+     *   { 'name': 'fred',    'age': 40 },
+     *   { 'name': 'barney',  'age': 26 },
+     *   { 'name': 'fred',    'age': 30 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(_.sortBy(characters, 'age'), _.values);
+     * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]]
+     *
+     * // sorting by multiple properties
+     * _.map(_.sortBy(characters, ['name', 'age']), _.values);
+     * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]]
+     */
+    function sortBy(collection, callback, thisArg) {
+      var index = -1,
+          isArr = isArray(callback),
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+
+      if (!isArr) {
+        callback = lodash.createCallback(callback, thisArg, 3);
+      }
+      forEach(collection, function(value, key, collection) {
+        var object = result[++index] = getObject();
+        if (isArr) {
+          object.criteria = map(callback, function(key) { return value[key]; });
+        } else {
+          (object.criteria = getArray())[0] = callback(value, key, collection);
+        }
+        object.index = index;
+        object.value = value;
+      });
+
+      length = result.length;
+      result.sort(compareAscending);
+      while (length--) {
+        var object = result[length];
+        result[length] = object.value;
+        if (!isArr) {
+          releaseArray(object.criteria);
+        }
+        releaseObject(object);
+      }
+      return result;
+    }
+
+    /**
+     * Converts the `collection` to an array.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to convert.
+     * @returns {Array} Returns the new converted array.
+     * @example
+     *
+     * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
+     * // => [2, 3, 4]
+     */
+    function toArray(collection) {
+      if (collection && typeof collection.length == 'number') {
+        return (support.unindexedChars && isString(collection))
+          ? collection.split('')
+          : slice(collection);
+      }
+      return values(collection);
+    }
+
+    /**
+     * Performs a deep comparison of each element in a `collection` to the given
+     * `properties` object, returning an array of all elements that have equivalent
+     * property values.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|string} collection The collection to iterate over.
+     * @param {Object} props The object of property values to filter by.
+     * @returns {Array} Returns a new array of elements that have the given properties.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] },
+     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * _.where(characters, { 'age': 36 });
+     * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }]
+     *
+     * _.where(characters, { 'pets': ['dino'] });
+     * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }]
+     */
+    var where = filter;
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates an array with all falsey values removed. The values `false`, `null`,
+     * `0`, `""`, `undefined`, and `NaN` are all falsey.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to compact.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.compact([0, 1, false, 2, '', 3]);
+     * // => [1, 2, 3]
+     */
+    function compact(array) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      while (++index < length) {
+        var value = array[index];
+        if (value) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Creates an array excluding all values of the provided arrays using strict
+     * equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {...Array} [values] The arrays of values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
+     * // => [1, 3, 4]
+     */
+    function difference(array) {
+      return baseDifference(array, baseFlatten(arguments, true, true, 1));
+    }
+
+    /**
+     * This method is like `_.find` except that it returns the index of the first
+     * element that passes the callback check, instead of the element itself.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': false },
+     *   { 'name': 'fred',    'age': 40, 'blocked': true },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': false }
+     * ];
+     *
+     * _.findIndex(characters, function(chr) {
+     *   return chr.age < 20;
+     * });
+     * // => 2
+     *
+     * // using "_.where" callback shorthand
+     * _.findIndex(characters, { 'age': 36 });
+     * // => 0
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findIndex(characters, 'blocked');
+     * // => 1
+     */
+    function findIndex(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0;
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (++index < length) {
+        if (callback(array[index], index, array)) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * This method is like `_.findIndex` except that it iterates over elements
+     * of a `collection` from right to left.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36, 'blocked': true },
+     *   { 'name': 'fred',    'age': 40, 'blocked': false },
+     *   { 'name': 'pebbles', 'age': 1,  'blocked': true }
+     * ];
+     *
+     * _.findLastIndex(characters, function(chr) {
+     *   return chr.age > 30;
+     * });
+     * // => 1
+     *
+     * // using "_.where" callback shorthand
+     * _.findLastIndex(characters, { 'age': 36 });
+     * // => 0
+     *
+     * // using "_.pluck" callback shorthand
+     * _.findLastIndex(characters, 'blocked');
+     * // => 2
+     */
+    function findLastIndex(array, callback, thisArg) {
+      var length = array ? array.length : 0;
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (length--) {
+        if (callback(array[length], length, array)) {
+          return length;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Gets the first element or first `n` elements of an array. If a callback
+     * is provided elements at the beginning of the array are returned as long
+     * as the callback returns truey. The callback is bound to `thisArg` and
+     * invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias head, take
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the first element(s) of `array`.
+     * @example
+     *
+     * _.first([1, 2, 3]);
+     * // => 1
+     *
+     * _.first([1, 2, 3], 2);
+     * // => [1, 2]
+     *
+     * _.first([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [1, 2]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.first(characters, 'blocked');
+     * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name');
+     * // => ['barney', 'fred']
+     */
+    function first(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = -1;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = callback;
+        if (n == null || thisArg) {
+          return array ? array[0] : undefined;
+        }
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, n), length));
+    }
+
+    /**
+     * Flattens a nested array (the nesting can be to any depth). If `isShallow`
+     * is truey, the array will only be flattened a single level. If a callback
+     * is provided each element of the array is passed through the callback before
+     * flattening. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to flatten.
+     * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new flattened array.
+     * @example
+     *
+     * _.flatten([1, [2], [3, [[4]]]]);
+     * // => [1, 2, 3, 4];
+     *
+     * _.flatten([1, [2], [3, [[4]]]], true);
+     * // => [1, 2, 3, [[4]]];
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },
+     *   { 'name': 'fred',   'age': 40, 'pets': ['baby puss', 'dino'] }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.flatten(characters, 'pets');
+     * // => ['hoppy', 'baby puss', 'dino']
+     */
+    function flatten(array, isShallow, callback, thisArg) {
+      // juggle arguments
+      if (typeof isShallow != 'boolean' && isShallow != null) {
+        thisArg = callback;
+        callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow;
+        isShallow = false;
+      }
+      if (callback != null) {
+        array = map(array, callback, thisArg);
+      }
+      return baseFlatten(array, isShallow);
+    }
+
+    /**
+     * Gets the index at which the first occurrence of `value` is found using
+     * strict equality for comparisons, i.e. `===`. If the array is already sorted
+     * providing `true` for `fromIndex` will run a faster binary search.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+     *  to perform a binary search on a sorted array.
+     * @returns {number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 1
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 4
+     *
+     * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
+     * // => 2
+     */
+    function indexOf(array, value, fromIndex) {
+      if (typeof fromIndex == 'number') {
+        var length = array ? array.length : 0;
+        fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
+      } else if (fromIndex) {
+        var index = sortedIndex(array, value);
+        return array[index] === value ? index : -1;
+      }
+      return baseIndexOf(array, value, fromIndex);
+    }
+
+    /**
+     * Gets all but the last element or last `n` elements of an array. If a
+     * callback is provided elements at the end of the array are excluded from
+     * the result as long as the callback returns truey. The callback is bound
+     * to `thisArg` and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.initial([1, 2, 3]);
+     * // => [1, 2]
+     *
+     * _.initial([1, 2, 3], 2);
+     * // => [1]
+     *
+     * _.initial([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [1]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.initial(characters, 'blocked');
+     * // => [{ 'name': 'barney',  'blocked': false, 'employer': 'slate' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name');
+     * // => ['barney', 'fred']
+     */
+    function initial(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : callback || n;
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
+    }
+
+    /**
+     * Creates an array of unique values present in all provided arrays using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of shared values.
+     * @example
+     *
+     * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+     * // => [1, 2]
+     */
+    function intersection() {
+      var args = [],
+          argsIndex = -1,
+          argsLength = arguments.length,
+          caches = getArray(),
+          indexOf = getIndexOf(),
+          trustIndexOf = indexOf === baseIndexOf,
+          seen = getArray();
+
+      while (++argsIndex < argsLength) {
+        var value = arguments[argsIndex];
+        if (isArray(value) || isArguments(value)) {
+          args.push(value);
+          caches.push(trustIndexOf && value.length >= largeArraySize &&
+            createCache(argsIndex ? args[argsIndex] : seen));
+        }
+      }
+      var array = args[0],
+          index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      outer:
+      while (++index < length) {
+        var cache = caches[0];
+        value = array[index];
+
+        if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
+          argsIndex = argsLength;
+          (cache || seen).push(value);
+          while (--argsIndex) {
+            cache = caches[argsIndex];
+            if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
+              continue outer;
+            }
+          }
+          result.push(value);
+        }
+      }
+      while (argsLength--) {
+        cache = caches[argsLength];
+        if (cache) {
+          releaseObject(cache);
+        }
+      }
+      releaseArray(caches);
+      releaseArray(seen);
+      return result;
+    }
+
+    /**
+     * Gets the last element or last `n` elements of an array. If a callback is
+     * provided elements at the end of the array are returned as long as the
+     * callback returns truey. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {*} Returns the last element(s) of `array`.
+     * @example
+     *
+     * _.last([1, 2, 3]);
+     * // => 3
+     *
+     * _.last([1, 2, 3], 2);
+     * // => [2, 3]
+     *
+     * _.last([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [2, 3]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': false, 'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true,  'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.pluck(_.last(characters, 'blocked'), 'name');
+     * // => ['fred', 'pebbles']
+     *
+     * // using "_.where" callback shorthand
+     * _.last(characters, { 'employer': 'na' });
+     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+     */
+    function last(array, callback, thisArg) {
+      var n = 0,
+          length = array ? array.length : 0;
+
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = callback;
+        if (n == null || thisArg) {
+          return array ? array[length - 1] : undefined;
+        }
+      }
+      return slice(array, nativeMax(0, length - n));
+    }
+
+    /**
+     * Gets the index at which the last occurrence of `value` is found using strict
+     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
+     * as the offset from the end of the collection.
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {*} value The value to search for.
+     * @param {number} [fromIndex=array.length-1] The index to search from.
+     * @returns {number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 4
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 1
+     */
+    function lastIndexOf(array, value, fromIndex) {
+      var index = array ? array.length : 0;
+      if (typeof fromIndex == 'number') {
+        index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
+      }
+      while (index--) {
+        if (array[index] === value) {
+          return index;
+        }
+      }
+      return -1;
+    }
+
+    /**
+     * Removes all provided values from the given array using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to modify.
+     * @param {...*} [value] The values to remove.
+     * @returns {Array} Returns `array`.
+     * @example
+     *
+     * var array = [1, 2, 3, 1, 2, 3];
+     * _.pull(array, 2, 3);
+     * console.log(array);
+     * // => [1, 1]
+     */
+    function pull(array) {
+      var args = arguments,
+          argsIndex = 0,
+          argsLength = args.length,
+          length = array ? array.length : 0;
+
+      while (++argsIndex < argsLength) {
+        var index = -1,
+            value = args[argsIndex];
+        while (++index < length) {
+          if (array[index] === value) {
+            splice.call(array, index--, 1);
+            length--;
+          }
+        }
+      }
+      return array;
+    }
+
+    /**
+     * Creates an array of numbers (positive and/or negative) progressing from
+     * `start` up to but not including `end`. If `start` is less than `stop` a
+     * zero-length range is created unless a negative `step` is specified.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {number} [start=0] The start of the range.
+     * @param {number} end The end of the range.
+     * @param {number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns a new range array.
+     * @example
+     *
+     * _.range(4);
+     * // => [0, 1, 2, 3]
+     *
+     * _.range(1, 5);
+     * // => [1, 2, 3, 4]
+     *
+     * _.range(0, 20, 5);
+     * // => [0, 5, 10, 15]
+     *
+     * _.range(0, -4, -1);
+     * // => [0, -1, -2, -3]
+     *
+     * _.range(1, 4, 0);
+     * // => [1, 1, 1]
+     *
+     * _.range(0);
+     * // => []
+     */
+    function range(start, end, step) {
+      start = +start || 0;
+      step = typeof step == 'number' ? step : (+step || 1);
+
+      if (end == null) {
+        end = start;
+        start = 0;
+      }
+      // use `Array(length)` so engines like Chakra and V8 avoid slower modes
+      // http://youtu.be/XAqIpGU8ZZk#t=17m25s
+      var index = -1,
+          length = nativeMax(0, ceil((end - start) / (step || 1))),
+          result = Array(length);
+
+      while (++index < length) {
+        result[index] = start;
+        start += step;
+      }
+      return result;
+    }
+
+    /**
+     * Removes all elements from an array that the callback returns truey for
+     * and returns an array of removed elements. The callback is bound to `thisArg`
+     * and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to modify.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of removed elements.
+     * @example
+     *
+     * var array = [1, 2, 3, 4, 5, 6];
+     * var evens = _.remove(array, function(num) { return num % 2 == 0; });
+     *
+     * console.log(array);
+     * // => [1, 3, 5]
+     *
+     * console.log(evens);
+     * // => [2, 4, 6]
+     */
+    function remove(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+
+      callback = lodash.createCallback(callback, thisArg, 3);
+      while (++index < length) {
+        var value = array[index];
+        if (callback(value, index, array)) {
+          result.push(value);
+          splice.call(array, index--, 1);
+          length--;
+        }
+      }
+      return result;
+    }
+
+    /**
+     * The opposite of `_.initial` this method gets all but the first element or
+     * first `n` elements of an array. If a callback function is provided elements
+     * at the beginning of the array are excluded from the result as long as the
+     * callback returns truey. The callback is bound to `thisArg` and invoked
+     * with three arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias drop, tail
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|number|string} [callback=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is provided it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.rest([1, 2, 3]);
+     * // => [2, 3]
+     *
+     * _.rest([1, 2, 3], 2);
+     * // => [3]
+     *
+     * _.rest([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [3]
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'blocked': true,  'employer': 'slate' },
+     *   { 'name': 'fred',    'blocked': false,  'employer': 'slate' },
+     *   { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.pluck(_.rest(characters, 'blocked'), 'name');
+     * // => ['fred', 'pebbles']
+     *
+     * // using "_.where" callback shorthand
+     * _.rest(characters, { 'employer': 'slate' });
+     * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+     */
+    function rest(array, callback, thisArg) {
+      if (typeof callback != 'number' && callback != null) {
+        var n = 0,
+            index = -1,
+            length = array ? array.length : 0;
+
+        callback = lodash.createCallback(callback, thisArg, 3);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
+      }
+      return slice(array, n);
+    }
+
+    /**
+     * Uses a binary search to determine the smallest index at which a value
+     * should be inserted into a given sorted array in order to maintain the sort
+     * order of the array. If a callback is provided it will be executed for
+     * `value` and each element of `array` to compute their sort ranking. The
+     * callback is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to inspect.
+     * @param {*} value The value to evaluate.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {number} Returns the index at which `value` should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedIndex([20, 30, 50], 40);
+     * // => 2
+     *
+     * // using "_.pluck" callback shorthand
+     * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+     * // => 2
+     *
+     * var dict = {
+     *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
+     * };
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return dict.wordToNumber[word];
+     * });
+     * // => 2
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return this.wordToNumber[word];
+     * }, dict);
+     * // => 2
+     */
+    function sortedIndex(array, value, callback, thisArg) {
+      var low = 0,
+          high = array ? array.length : low;
+
+      // explicitly reference `identity` for better inlining in Firefox
+      callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
+      value = callback(value);
+
+      while (low < high) {
+        var mid = (low + high) >>> 1;
+        (callback(array[mid]) < value)
+          ? low = mid + 1
+          : high = mid;
+      }
+      return low;
+    }
+
+    /**
+     * Creates an array of unique values, in order, of the provided arrays using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of combined values.
+     * @example
+     *
+     * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+     * // => [1, 2, 3, 5, 4]
+     */
+    function union() {
+      return baseUniq(baseFlatten(arguments, true, true));
+    }
+
+    /**
+     * Creates a duplicate-value-free version of an array using strict equality
+     * for comparisons, i.e. `===`. If the array is sorted, providing
+     * `true` for `isSorted` will use a faster algorithm. If a callback is provided
+     * each element of `array` is passed through the callback before uniqueness
+     * is computed. The callback is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is provided for `callback` the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is provided for `callback` the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias unique
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted.
+     * @param {Function|Object|string} [callback=identity] The function called
+     *  per iteration. If a property name or object is provided it will be used
+     *  to create a "_.pluck" or "_.where" style callback, respectively.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a duplicate-value-free array.
+     * @example
+     *
+     * _.uniq([1, 2, 1, 3, 1]);
+     * // => [1, 2, 3]
+     *
+     * _.uniq([1, 1, 2, 2, 3], true);
+     * // => [1, 2, 3]
+     *
+     * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
+     * // => ['A', 'b', 'C']
+     *
+     * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
+     * // => [1, 2.5, 3]
+     *
+     * // using "_.pluck" callback shorthand
+     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    function uniq(array, isSorted, callback, thisArg) {
+      // juggle arguments
+      if (typeof isSorted != 'boolean' && isSorted != null) {
+        thisArg = callback;
+        callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted;
+        isSorted = false;
+      }
+      if (callback != null) {
+        callback = lodash.createCallback(callback, thisArg, 3);
+      }
+      return baseUniq(array, isSorted, callback);
+    }
+
+    /**
+     * Creates an array excluding all provided values using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to filter.
+     * @param {...*} [value] The values to exclude.
+     * @returns {Array} Returns a new array of filtered values.
+     * @example
+     *
+     * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
+     * // => [2, 3, 4]
+     */
+    function without(array) {
+      return baseDifference(array, slice(arguments, 1));
+    }
+
+    /**
+     * Creates an array that is the symmetric difference of the provided arrays.
+     * See http://en.wikipedia.org/wiki/Symmetric_difference.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {...Array} [array] The arrays to inspect.
+     * @returns {Array} Returns an array of values.
+     * @example
+     *
+     * _.xor([1, 2, 3], [5, 2, 1, 4]);
+     * // => [3, 5, 4]
+     *
+     * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);
+     * // => [1, 4, 5]
+     */
+    function xor() {
+      var index = -1,
+          length = arguments.length;
+
+      while (++index < length) {
+        var array = arguments[index];
+        if (isArray(array) || isArguments(array)) {
+          var result = result
+            ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result)))
+            : array;
+        }
+      }
+      return result || [];
+    }
+
+    /**
+     * Creates an array of grouped elements, the first of which contains the first
+     * elements of the given arrays, the second of which contains the second
+     * elements of the given arrays, and so on.
+     *
+     * @static
+     * @memberOf _
+     * @alias unzip
+     * @category Arrays
+     * @param {...Array} [array] Arrays to process.
+     * @returns {Array} Returns a new array of grouped elements.
+     * @example
+     *
+     * _.zip(['fred', 'barney'], [30, 40], [true, false]);
+     * // => [['fred', 30, true], ['barney', 40, false]]
+     */
+    function zip() {
+      var array = arguments.length > 1 ? arguments : arguments[0],
+          index = -1,
+          length = array ? max(pluck(array, 'length')) : 0,
+          result = Array(length < 0 ? 0 : length);
+
+      while (++index < length) {
+        result[index] = pluck(array, index);
+      }
+      return result;
+    }
+
+    /**
+     * Creates an object composed from arrays of `keys` and `values`. Provide
+     * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`
+     * or two arrays, one of `keys` and one of corresponding `values`.
+     *
+     * @static
+     * @memberOf _
+     * @alias object
+     * @category Arrays
+     * @param {Array} keys The array of keys.
+     * @param {Array} [values=[]] The array of values.
+     * @returns {Object} Returns an object composed of the given keys and
+     *  corresponding values.
+     * @example
+     *
+     * _.zipObject(['fred', 'barney'], [30, 40]);
+     * // => { 'fred': 30, 'barney': 40 }
+     */
+    function zipObject(keys, values) {
+      var index = -1,
+          length = keys ? keys.length : 0,
+          result = {};
+
+      if (!values && length && !isArray(keys[0])) {
+        values = [];
+      }
+      while (++index < length) {
+        var key = keys[index];
+        if (values) {
+          result[key] = values[index];
+        } else if (key) {
+          result[key[0]] = key[1];
+        }
+      }
+      return result;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a function that executes `func`, with  the `this` binding and
+     * arguments of the created function, only after being called `n` times.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {number} n The number of times the function must be called before
+     *  `func` is executed.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var saves = ['profile', 'settings'];
+     *
+     * var done = _.after(saves.length, function() {
+     *   console.log('Done saving!');
+     * });
+     *
+     * _.forEach(saves, function(type) {
+     *   asyncSave({ 'type': type, 'complete': done });
+     * });
+     * // => logs 'Done saving!', after all saves have completed
+     */
+    function after(n, func) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      return function() {
+        if (--n < 1) {
+          return func.apply(this, arguments);
+        }
+      };
+    }
+
+    /**
+     * Creates a function that, when called, invokes `func` with the `this`
+     * binding of `thisArg` and prepends any additional `bind` arguments to those
+     * provided to the bound function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to bind.
+     * @param {*} [thisArg] The `this` binding of `func`.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var func = function(greeting) {
+     *   return greeting + ' ' + this.name;
+     * };
+     *
+     * func = _.bind(func, { 'name': 'fred' }, 'hi');
+     * func();
+     * // => 'hi fred'
+     */
+    function bind(func, thisArg) {
+      return arguments.length > 2
+        ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
+        : createWrapper(func, 1, null, null, thisArg);
+    }
+
+    /**
+     * Binds methods of an object to the object itself, overwriting the existing
+     * method. Method names may be specified as individual arguments or as arrays
+     * of method names. If no method names are provided all the function properties
+     * of `object` will be bound.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object to bind and assign the bound methods to.
+     * @param {...string} [methodName] The object method names to
+     *  bind, specified as individual method names or arrays of method names.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'onClick': function() { console.log('clicked ' + this.label); }
+     * };
+     *
+     * _.bindAll(view);
+     * jQuery('#docs').on('click', view.onClick);
+     * // => logs 'clicked docs', when the button is clicked
+     */
+    function bindAll(object) {
+      var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),
+          index = -1,
+          length = funcs.length;
+
+      while (++index < length) {
+        var key = funcs[index];
+        object[key] = createWrapper(object[key], 1, null, null, object);
+      }
+      return object;
+    }
+
+    /**
+     * Creates a function that, when called, invokes the method at `object[key]`
+     * and prepends any additional `bindKey` arguments to those provided to the bound
+     * function. This method differs from `_.bind` by allowing bound functions to
+     * reference methods that will be redefined or don't yet exist.
+     * See http://michaux.ca/articles/lazy-function-definition-pattern.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object the method belongs to.
+     * @param {string} key The key of the method.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var object = {
+     *   'name': 'fred',
+     *   'greet': function(greeting) {
+     *     return greeting + ' ' + this.name;
+     *   }
+     * };
+     *
+     * var func = _.bindKey(object, 'greet', 'hi');
+     * func();
+     * // => 'hi fred'
+     *
+     * object.greet = function(greeting) {
+     *   return greeting + 'ya ' + this.name + '!';
+     * };
+     *
+     * func();
+     * // => 'hiya fred!'
+     */
+    function bindKey(object, key) {
+      return arguments.length > 2
+        ? createWrapper(key, 19, slice(arguments, 2), null, object)
+        : createWrapper(key, 3, null, null, object);
+    }
+
+    /**
+     * Creates a function that is the composition of the provided functions,
+     * where each function consumes the return value of the function that follows.
+     * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
+     * Each function is executed with the `this` binding of the composed function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {...Function} [func] Functions to compose.
+     * @returns {Function} Returns the new composed function.
+     * @example
+     *
+     * var realNameMap = {
+     *   'pebbles': 'penelope'
+     * };
+     *
+     * var format = function(name) {
+     *   name = realNameMap[name.toLowerCase()] || name;
+     *   return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
+     * };
+     *
+     * var greet = function(formatted) {
+     *   return 'Hiya ' + formatted + '!';
+     * };
+     *
+     * var welcome = _.compose(greet, format);
+     * welcome('pebbles');
+     * // => 'Hiya Penelope!'
+     */
+    function compose() {
+      var funcs = arguments,
+          length = funcs.length;
+
+      while (length--) {
+        if (!isFunction(funcs[length])) {
+          throw new TypeError;
+        }
+      }
+      return function() {
+        var args = arguments,
+            length = funcs.length;
+
+        while (length--) {
+          args = [funcs[length].apply(this, args)];
+        }
+        return args[0];
+      };
+    }
+
+    /**
+     * Creates a function which accepts one or more arguments of `func` that when
+     * invoked either executes `func` returning its result, if all `func` arguments
+     * have been provided, or returns a function that accepts one or more of the
+     * remaining `func` arguments, and so on. The arity of `func` can be specified
+     * if `func.length` is not sufficient.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to curry.
+     * @param {number} [arity=func.length] The arity of `func`.
+     * @returns {Function} Returns the new curried function.
+     * @example
+     *
+     * var curried = _.curry(function(a, b, c) {
+     *   console.log(a + b + c);
+     * });
+     *
+     * curried(1)(2)(3);
+     * // => 6
+     *
+     * curried(1, 2)(3);
+     * // => 6
+     *
+     * curried(1, 2, 3);
+     * // => 6
+     */
+    function curry(func, arity) {
+      arity = typeof arity == 'number' ? arity : (+arity || func.length);
+      return createWrapper(func, 4, null, null, null, arity);
+    }
+
+    /**
+     * Creates a function that will delay the execution of `func` until after
+     * `wait` milliseconds have elapsed since the last time it was invoked.
+     * Provide an options object to indicate that `func` should be invoked on
+     * the leading and/or trailing edge of the `wait` timeout. Subsequent calls
+     * to the debounced function will return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true` `func` will be called
+     * on the trailing edge of the timeout only if the the debounced function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to debounce.
+     * @param {number} wait The number of milliseconds to delay.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout.
+     * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called.
+     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new debounced function.
+     * @example
+     *
+     * // avoid costly calculations while the window size is in flux
+     * var lazyLayout = _.debounce(calculateLayout, 150);
+     * jQuery(window).on('resize', lazyLayout);
+     *
+     * // execute `sendMail` when the click event is fired, debouncing subsequent calls
+     * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+     *   'leading': true,
+     *   'trailing': false
+     * });
+     *
+     * // ensure `batchLog` is executed once after 1 second of debounced calls
+     * var source = new EventSource('/stream');
+     * source.addEventListener('message', _.debounce(batchLog, 250, {
+     *   'maxWait': 1000
+     * }, false);
+     */
+    function debounce(func, wait, options) {
+      var args,
+          maxTimeoutId,
+          result,
+          stamp,
+          thisArg,
+          timeoutId,
+          trailingCall,
+          lastCalled = 0,
+          maxWait = false,
+          trailing = true;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      wait = nativeMax(0, wait) || 0;
+      if (options === true) {
+        var leading = true;
+        trailing = false;
+      } else if (isObject(options)) {
+        leading = options.leading;
+        maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0);
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      var delayed = function() {
+        var remaining = wait - (now() - stamp);
+        if (remaining <= 0) {
+          if (maxTimeoutId) {
+            clearTimeout(maxTimeoutId);
+          }
+          var isCalled = trailingCall;
+          maxTimeoutId = timeoutId = trailingCall = undefined;
+          if (isCalled) {
+            lastCalled = now();
+            result = func.apply(thisArg, args);
+            if (!timeoutId && !maxTimeoutId) {
+              args = thisArg = null;
+            }
+          }
+        } else {
+          timeoutId = setTimeout(delayed, remaining);
+        }
+      };
+
+      var maxDelayed = function() {
+        if (timeoutId) {
+          clearTimeout(timeoutId);
+        }
+        maxTimeoutId = timeoutId = trailingCall = undefined;
+        if (trailing || (maxWait !== wait)) {
+          lastCalled = now();
+          result = func.apply(thisArg, args);
+          if (!timeoutId && !maxTimeoutId) {
+            args = thisArg = null;
+          }
+        }
+      };
+
+      return function() {
+        args = arguments;
+        stamp = now();
+        thisArg = this;
+        trailingCall = trailing && (timeoutId || !leading);
+
+        if (maxWait === false) {
+          var leadingCall = leading && !timeoutId;
+        } else {
+          if (!maxTimeoutId && !leading) {
+            lastCalled = stamp;
+          }
+          var remaining = maxWait - (stamp - lastCalled),
+              isCalled = remaining <= 0;
+
+          if (isCalled) {
+            if (maxTimeoutId) {
+              maxTimeoutId = clearTimeout(maxTimeoutId);
+            }
+            lastCalled = stamp;
+            result = func.apply(thisArg, args);
+          }
+          else if (!maxTimeoutId) {
+            maxTimeoutId = setTimeout(maxDelayed, remaining);
+          }
+        }
+        if (isCalled && timeoutId) {
+          timeoutId = clearTimeout(timeoutId);
+        }
+        else if (!timeoutId && wait !== maxWait) {
+          timeoutId = setTimeout(delayed, wait);
+        }
+        if (leadingCall) {
+          isCalled = true;
+          result = func.apply(thisArg, args);
+        }
+        if (isCalled && !timeoutId && !maxTimeoutId) {
+          args = thisArg = null;
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Defers executing the `func` function until the current call stack has cleared.
+     * Additional arguments will be provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to defer.
+     * @param {...*} [arg] Arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.defer(function(text) { console.log(text); }, 'deferred');
+     * // logs 'deferred' after one or more milliseconds
+     */
+    function defer(func) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var args = slice(arguments, 1);
+      return setTimeout(function() { func.apply(undefined, args); }, 1);
+    }
+
+    /**
+     * Executes the `func` function after `wait` milliseconds. Additional arguments
+     * will be provided to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to delay.
+     * @param {number} wait The number of milliseconds to delay execution.
+     * @param {...*} [arg] Arguments to invoke the function with.
+     * @returns {number} Returns the timer id.
+     * @example
+     *
+     * _.delay(function(text) { console.log(text); }, 1000, 'later');
+     * // => logs 'later' after one second
+     */
+    function delay(func, wait) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var args = slice(arguments, 2);
+      return setTimeout(function() { func.apply(undefined, args); }, wait);
+    }
+
+    /**
+     * Creates a function that memoizes the result of `func`. If `resolver` is
+     * provided it will be used to determine the cache key for storing the result
+     * based on the arguments provided to the memoized function. By default, the
+     * first argument provided to the memoized function is used as the cache key.
+     * The `func` is executed with the `this` binding of the memoized function.
+     * The result cache is exposed as the `cache` property on the memoized function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to have its output memoized.
+     * @param {Function} [resolver] A function used to resolve the cache key.
+     * @returns {Function} Returns the new memoizing function.
+     * @example
+     *
+     * var fibonacci = _.memoize(function(n) {
+     *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
+     * });
+     *
+     * fibonacci(9)
+     * // => 34
+     *
+     * var data = {
+     *   'fred': { 'name': 'fred', 'age': 40 },
+     *   'pebbles': { 'name': 'pebbles', 'age': 1 }
+     * };
+     *
+     * // modifying the result cache
+     * var get = _.memoize(function(name) { return data[name]; }, _.identity);
+     * get('pebbles');
+     * // => { 'name': 'pebbles', 'age': 1 }
+     *
+     * get.cache.pebbles.name = 'penelope';
+     * get('pebbles');
+     * // => { 'name': 'penelope', 'age': 1 }
+     */
+    function memoize(func, resolver) {
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      var memoized = function() {
+        var cache = memoized.cache,
+            key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0];
+
+        return hasOwnProperty.call(cache, key)
+          ? cache[key]
+          : (cache[key] = func.apply(this, arguments));
+      }
+      memoized.cache = {};
+      return memoized;
+    }
+
+    /**
+     * Creates a function that is restricted to execute `func` once. Repeat calls to
+     * the function will return the value of the first call. The `func` is executed
+     * with the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var initialize = _.once(createApplication);
+     * initialize();
+     * initialize();
+     * // `initialize` executes `createApplication` once
+     */
+    function once(func) {
+      var ran,
+          result;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      return function() {
+        if (ran) {
+          return result;
+        }
+        ran = true;
+        result = func.apply(this, arguments);
+
+        // clear the `func` variable so the function may be garbage collected
+        func = null;
+        return result;
+      };
+    }
+
+    /**
+     * Creates a function that, when called, invokes `func` with any additional
+     * `partial` arguments prepended to those provided to the new function. This
+     * method is similar to `_.bind` except it does **not** alter the `this` binding.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var greet = function(greeting, name) { return greeting + ' ' + name; };
+     * var hi = _.partial(greet, 'hi');
+     * hi('fred');
+     * // => 'hi fred'
+     */
+    function partial(func) {
+      return createWrapper(func, 16, slice(arguments, 1));
+    }
+
+    /**
+     * This method is like `_.partial` except that `partial` arguments are
+     * appended to those provided to the new function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {...*} [arg] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var defaultsDeep = _.partialRight(_.merge, _.defaults);
+     *
+     * var options = {
+     *   'variable': 'data',
+     *   'imports': { 'jq': $ }
+     * };
+     *
+     * defaultsDeep(options, _.templateSettings);
+     *
+     * options.variable
+     * // => 'data'
+     *
+     * options.imports
+     * // => { '_': _, 'jq': $ }
+     */
+    function partialRight(func) {
+      return createWrapper(func, 32, null, slice(arguments, 1));
+    }
+
+    /**
+     * Creates a function that, when executed, will only call the `func` function
+     * at most once per every `wait` milliseconds. Provide an options object to
+     * indicate that `func` should be invoked on the leading and/or trailing edge
+     * of the `wait` timeout. Subsequent calls to the throttled function will
+     * return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true` `func` will be called
+     * on the trailing edge of the timeout only if the the throttled function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to throttle.
+     * @param {number} wait The number of milliseconds to throttle executions to.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout.
+     * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new throttled function.
+     * @example
+     *
+     * // avoid excessively updating the position while scrolling
+     * var throttled = _.throttle(updatePosition, 100);
+     * jQuery(window).on('scroll', throttled);
+     *
+     * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes
+     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+     *   'trailing': false
+     * }));
+     */
+    function throttle(func, wait, options) {
+      var leading = true,
+          trailing = true;
+
+      if (!isFunction(func)) {
+        throw new TypeError;
+      }
+      if (options === false) {
+        leading = false;
+      } else if (isObject(options)) {
+        leading = 'leading' in options ? options.leading : leading;
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      debounceOptions.leading = leading;
+      debounceOptions.maxWait = wait;
+      debounceOptions.trailing = trailing;
+
+      return debounce(func, wait, debounceOptions);
+    }
+
+    /**
+     * Creates a function that provides `value` to the wrapper function as its
+     * first argument. Additional arguments provided to the function are appended
+     * to those provided to the wrapper function. The wrapper is executed with
+     * the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {*} value The value to wrap.
+     * @param {Function} wrapper The wrapper function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var p = _.wrap(_.escape, function(func, text) {
+     *   return '<p>' + func(text) + '</p>';
+     * });
+     *
+     * p('Fred, Wilma, & Pebbles');
+     * // => '<p>Fred, Wilma, &amp; Pebbles</p>'
+     */
+    function wrap(value, wrapper) {
+      return createWrapper(wrapper, 16, [value]);
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a function that returns `value`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} value The value to return from the new function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * var getter = _.constant(object);
+     * getter() === object;
+     * // => true
+     */
+    function constant(value) {
+      return function() {
+        return value;
+      };
+    }
+
+    /**
+     * Produces a callback bound to an optional `thisArg`. If `func` is a property
+     * name the created callback will return the property value for a given element.
+     * If `func` is an object the created callback will return `true` for elements
+     * that contain the equivalent object properties, otherwise it will return `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} [func=identity] The value to convert to a callback.
+     * @param {*} [thisArg] The `this` binding of the created callback.
+     * @param {number} [argCount] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // wrap to create custom callback shorthands
+     * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
+     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
+     *   return !match ? func(callback, thisArg) : function(object) {
+     *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
+     *   };
+     * });
+     *
+     * _.filter(characters, 'age__gt38');
+     * // => [{ 'name': 'fred', 'age': 40 }]
+     */
+    function createCallback(func, thisArg, argCount) {
+      var type = typeof func;
+      if (func == null || type == 'function') {
+        return baseCreateCallback(func, thisArg, argCount);
+      }
+      // handle "_.pluck" style callback shorthands
+      if (type != 'object') {
+        return property(func);
+      }
+      var props = keys(func),
+          key = props[0],
+          a = func[key];
+
+      // handle "_.where" style callback shorthands
+      if (props.length == 1 && a === a && !isObject(a)) {
+        // fast path the common case of providing an object with a single
+        // property containing a primitive value
+        return function(object) {
+          var b = object[key];
+          return a === b && (a !== 0 || (1 / a == 1 / b));
+        };
+      }
+      return function(object) {
+        var length = props.length,
+            result = false;
+
+        while (length--) {
+          if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) {
+            break;
+          }
+        }
+        return result;
+      };
+    }
+
+    /**
+     * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
+     * corresponding HTML entities.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} string The string to escape.
+     * @returns {string} Returns the escaped string.
+     * @example
+     *
+     * _.escape('Fred, Wilma, & Pebbles');
+     * // => 'Fred, Wilma, &amp; Pebbles'
+     */
+    function escape(string) {
+      return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+    }
+
+    /**
+     * This method returns the first argument provided to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {*} value Any value.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * _.identity(object) === object;
+     * // => true
+     */
+    function identity(value) {
+      return value;
+    }
+
+    /**
+     * Adds function properties of a source object to the destination object.
+     * If `object` is a function methods will be added to its prototype as well.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Function|Object} [object=lodash] object The destination object.
+     * @param {Object} source The object of functions to add.
+     * @param {Object} [options] The options object.
+     * @param {boolean} [options.chain=true] Specify whether the functions added are chainable.
+     * @example
+     *
+     * function capitalize(string) {
+     *   return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
+     * }
+     *
+     * _.mixin({ 'capitalize': capitalize });
+     * _.capitalize('fred');
+     * // => 'Fred'
+     *
+     * _('fred').capitalize().value();
+     * // => 'Fred'
+     *
+     * _.mixin({ 'capitalize': capitalize }, { 'chain': false });
+     * _('fred').capitalize();
+     * // => 'Fred'
+     */
+    function mixin(object, source, options) {
+      var chain = true,
+          methodNames = source && functions(source);
+
+      if (!source || (!options && !methodNames.length)) {
+        if (options == null) {
+          options = source;
+        }
+        ctor = lodashWrapper;
+        source = object;
+        object = lodash;
+        methodNames = functions(source);
+      }
+      if (options === false) {
+        chain = false;
+      } else if (isObject(options) && 'chain' in options) {
+        chain = options.chain;
+      }
+      var ctor = object,
+          isFunc = isFunction(ctor);
+
+      forEach(methodNames, function(methodName) {
+        var func = object[methodName] = source[methodName];
+        if (isFunc) {
+          ctor.prototype[methodName] = function() {
+            var chainAll = this.__chain__,
+                value = this.__wrapped__,
+                args = [value];
+
+            push.apply(args, arguments);
+            var result = func.apply(object, args);
+            if (chain || chainAll) {
+              if (value === result && isObject(result)) {
+                return this;
+              }
+              result = new ctor(result);
+              result.__chain__ = chainAll;
+            }
+            return result;
+          };
+        }
+      });
+    }
+
+    /**
+     * Reverts the '_' variable to its previous value and returns a reference to
+     * the `lodash` function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @returns {Function} Returns the `lodash` function.
+     * @example
+     *
+     * var lodash = _.noConflict();
+     */
+    function noConflict() {
+      context._ = oldDash;
+      return this;
+    }
+
+    /**
+     * A no-operation function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @example
+     *
+     * var object = { 'name': 'fred' };
+     * _.noop(object) === undefined;
+     * // => true
+     */
+    function noop() {
+      // no operation performed
+    }
+
+    /**
+     * Gets the number of milliseconds that have elapsed since the Unix epoch
+     * (1 January 1970 00:00:00 UTC).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @example
+     *
+     * var stamp = _.now();
+     * _.defer(function() { console.log(_.now() - stamp); });
+     * // => logs the number of milliseconds it took for the deferred function to be called
+     */
+    var now = isNative(now = Date.now) && now || function() {
+      return new Date().getTime();
+    };
+
+    /**
+     * Converts the given value into an integer of the specified radix.
+     * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the
+     * `value` is a hexadecimal, in which case a `radix` of `16` is used.
+     *
+     * Note: This method avoids differences in native ES3 and ES5 `parseInt`
+     * implementations. See http://es5.github.io/#E.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} value The value to parse.
+     * @param {number} [radix] The radix used to interpret the value to parse.
+     * @returns {number} Returns the new integer value.
+     * @example
+     *
+     * _.parseInt('08');
+     * // => 8
+     */
+    var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
+      // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt`
+      return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
+    };
+
+    /**
+     * Creates a "_.pluck" style function, which returns the `key` value of a
+     * given object.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} key The name of the property to retrieve.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'fred',   'age': 40 },
+     *   { 'name': 'barney', 'age': 36 }
+     * ];
+     *
+     * var getName = _.property('name');
+     *
+     * _.map(characters, getName);
+     * // => ['barney', 'fred']
+     *
+     * _.sortBy(characters, getName);
+     * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred',   'age': 40 }]
+     */
+    function property(key) {
+      return function(object) {
+        return object[key];
+      };
+    }
+
+    /**
+     * Produces a random number between `min` and `max` (inclusive). If only one
+     * argument is provided a number between `0` and the given number will be
+     * returned. If `floating` is truey or either `min` or `max` are floats a
+     * floating-point number will be returned instead of an integer.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {number} [min=0] The minimum possible value.
+     * @param {number} [max=1] The maximum possible value.
+     * @param {boolean} [floating=false] Specify returning a floating-point number.
+     * @returns {number} Returns a random number.
+     * @example
+     *
+     * _.random(0, 5);
+     * // => an integer between 0 and 5
+     *
+     * _.random(5);
+     * // => also an integer between 0 and 5
+     *
+     * _.random(5, true);
+     * // => a floating-point number between 0 and 5
+     *
+     * _.random(1.2, 5.2);
+     * // => a floating-point number between 1.2 and 5.2
+     */
+    function random(min, max, floating) {
+      var noMin = min == null,
+          noMax = max == null;
+
+      if (floating == null) {
+        if (typeof min == 'boolean' && noMax) {
+          floating = min;
+          min = 1;
+        }
+        else if (!noMax && typeof max == 'boolean') {
+          floating = max;
+          noMax = true;
+        }
+      }
+      if (noMin && noMax) {
+        max = 1;
+      }
+      min = +min || 0;
+      if (noMax) {
+        max = min;
+        min = 0;
+      } else {
+        max = +max || 0;
+      }
+      if (floating || min % 1 || max % 1) {
+        var rand = nativeRandom();
+        return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max);
+      }
+      return baseRandom(min, max);
+    }
+
+    /**
+     * Resolves the value of property `key` on `object`. If `key` is a function
+     * it will be invoked with the `this` binding of `object` and its result returned,
+     * else the property value is returned. If `object` is falsey then `undefined`
+     * is returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Object} object The object to inspect.
+     * @param {string} key The name of the property to resolve.
+     * @returns {*} Returns the resolved value.
+     * @example
+     *
+     * var object = {
+     *   'cheese': 'crumpets',
+     *   'stuff': function() {
+     *     return 'nonsense';
+     *   }
+     * };
+     *
+     * _.result(object, 'cheese');
+     * // => 'crumpets'
+     *
+     * _.result(object, 'stuff');
+     * // => 'nonsense'
+     */
+    function result(object, key) {
+      if (object) {
+        var value = object[key];
+        return isFunction(value) ? object[key]() : value;
+      }
+    }
+
+    /**
+     * A micro-templating method that handles arbitrary delimiters, preserves
+     * whitespace, and correctly escapes quotes within interpolated code.
+     *
+     * Note: In the development build, `_.template` utilizes sourceURLs for easier
+     * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+     *
+     * For more information on precompiling templates see:
+     * http://lodash.com/custom-builds
+     *
+     * For more information on Chrome extension sandboxes see:
+     * http://developer.chrome.com/stable/extensions/sandboxingEval.html
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} text The template text.
+     * @param {Object} data The data object used to populate the text.
+     * @param {Object} [options] The options object.
+     * @param {RegExp} [options.escape] The "escape" delimiter.
+     * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
+     * @param {Object} [options.imports] An object to import into the template as local variables.
+     * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
+     * @param {string} [sourceURL] The sourceURL of the template's compiled source.
+     * @param {string} [variable] The data object variable name.
+     * @returns {Function|string} Returns a compiled function when no `data` object
+     *  is given, else it returns the interpolated text.
+     * @example
+     *
+     * // using the "interpolate" delimiter to create a compiled template
+     * var compiled = _.template('hello <%= name %>');
+     * compiled({ 'name': 'fred' });
+     * // => 'hello fred'
+     *
+     * // using the "escape" delimiter to escape HTML in data property values
+     * _.template('<b><%- value %></b>', { 'value': '<script>' });
+     * // => '<b>&lt;script&gt;</b>'
+     *
+     * // using the "evaluate" delimiter to generate HTML
+     * var list = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';
+     * _.template(list, { 'people': ['fred', 'barney'] });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+     * _.template('hello ${ name }', { 'name': 'pebbles' });
+     * // => 'hello pebbles'
+     *
+     * // using the internal `print` function in "evaluate" delimiters
+     * _.template('<% print("hello " + name); %>!', { 'name': 'barney' });
+     * // => 'hello barney!'
+     *
+     * // using a custom template delimiters
+     * _.templateSettings = {
+     *   'interpolate': /{{([\s\S]+?)}}/g
+     * };
+     *
+     * _.template('hello {{ name }}!', { 'name': 'mustache' });
+     * // => 'hello mustache!'
+     *
+     * // using the `imports` option to import jQuery
+     * var list = '<% jq.each(people, function(name) { %><li><%- name %></li><% }); %>';
+     * _.template(list, { 'people': ['fred', 'barney'] }, { 'imports': { 'jq': jQuery } });
+     * // => '<li>fred</li><li>barney</li>'
+     *
+     * // using the `sourceURL` option to specify a custom sourceURL for the template
+     * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
+     * compiled(data);
+     * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+     *
+     * // using the `variable` option to ensure a with-statement isn't used in the compiled template
+     * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });
+     * compiled.source;
+     * // => function(data) {
+     *   var __t, __p = '', __e = _.escape;
+     *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
+     *   return __p;
+     * }
+     *
+     * // using the `source` property to inline compiled templates for meaningful
+     * // line numbers in error messages and a stack trace
+     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+     *   var JST = {\
+     *     "main": ' + _.template(mainText).source + '\
+     *   };\
+     * ');
+     */
+    function template(text, data, options) {
+      // based on John Resig's `tmpl` implementation
+      // http://ejohn.org/blog/javascript-micro-templating/
+      // and Laura Doktorova's doT.js
+      // https://github.com/olado/doT
+      var settings = lodash.templateSettings;
+      text = String(text || '');
+
+      // avoid missing dependencies when `iteratorTemplate` is not defined
+      options = iteratorTemplate ? defaults({}, options, settings) : settings;
+
+      var imports = iteratorTemplate && defaults({}, options.imports, settings.imports),
+          importsKeys = iteratorTemplate ? keys(imports) : ['_'],
+          importsValues = iteratorTemplate ? values(imports) : [lodash];
+
+      var isEvaluating,
+          index = 0,
+          interpolate = options.interpolate || reNoMatch,
+          source = "__p += '";
+
+      // compile the regexp to match each delimiter
+      var reDelimiters = RegExp(
+        (options.escape || reNoMatch).source + '|' +
+        interpolate.source + '|' +
+        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
+        (options.evaluate || reNoMatch).source + '|$'
+      , 'g');
+
+      text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
+        interpolateValue || (interpolateValue = esTemplateValue);
+
+        // escape characters that cannot be included in string literals
+        source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+
+        // replace delimiters with snippets
+        if (escapeValue) {
+          source += "' +\n__e(" + escapeValue + ") +\n'";
+        }
+        if (evaluateValue) {
+          isEvaluating = true;
+          source += "';\n" + evaluateValue + ";\n__p += '";
+        }
+        if (interpolateValue) {
+          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+        }
+        index = offset + match.length;
+
+        // the JS engine embedded in Adobe products requires returning the `match`
+        // string in order to produce the correct `offset` value
+        return match;
+      });
+
+      source += "';\n";
+
+      // if `variable` is not specified, wrap a with-statement around the generated
+      // code to add the data object to the top of the scope chain
+      var variable = options.variable,
+          hasVariable = variable;
+
+      if (!hasVariable) {
+        variable = 'obj';
+        source = 'with (' + variable + ') {\n' + source + '\n}\n';
+      }
+      // cleanup code by stripping empty strings
+      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
+        .replace(reEmptyStringMiddle, '$1')
+        .replace(reEmptyStringTrailing, '$1;');
+
+      // frame code as the function body
+      source = 'function(' + variable + ') {\n' +
+        (hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') +
+        "var __t, __p = '', __e = _.escape" +
+        (isEvaluating
+          ? ', __j = Array.prototype.join;\n' +
+            "function print() { __p += __j.call(arguments, '') }\n"
+          : ';\n'
+        ) +
+        source +
+        'return __p\n}';
+
+      // Use a sourceURL for easier debugging.
+      // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+      var sourceURL = '\n/*\n//# sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
+
+      try {
+        var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues);
+      } catch(e) {
+        e.source = source;
+        throw e;
+      }
+      if (data) {
+        return result(data);
+      }
+      // provide the compiled function's source by its `toString` method, in
+      // supported environments, or the `source` property as a convenience for
+      // inlining compiled templates during the build process
+      result.source = source;
+      return result;
+    }
+
+    /**
+     * Executes the callback `n` times, returning an array of the results
+     * of each callback execution. The callback is bound to `thisArg` and invoked
+     * with one argument; (index).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {number} n The number of times to execute the callback.
+     * @param {Function} callback The function called per iteration.
+     * @param {*} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns an array of the results of each `callback` execution.
+     * @example
+     *
+     * var diceRolls = _.times(3, _.partial(_.random, 1, 6));
+     * // => [3, 6, 4]
+     *
+     * _.times(3, function(n) { mage.castSpell(n); });
+     * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+     *
+     * _.times(3, function(n) { this.cast(n); }, mage);
+     * // => also calls `mage.castSpell(n)` three times
+     */
+    function times(n, callback, thisArg) {
+      n = (n = +n) > -1 ? n : 0;
+      var index = -1,
+          result = Array(n);
+
+      callback = baseCreateCallback(callback, thisArg, 1);
+      while (++index < n) {
+        result[index] = callback(index);
+      }
+      return result;
+    }
+
+    /**
+     * The inverse of `_.escape` this method converts the HTML entities
+     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
+     * corresponding characters.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} string The string to unescape.
+     * @returns {string} Returns the unescaped string.
+     * @example
+     *
+     * _.unescape('Fred, Barney &amp; Pebbles');
+     * // => 'Fred, Barney & Pebbles'
+     */
+    function unescape(string) {
+      return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
+    }
+
+    /**
+     * Generates a unique ID. If `prefix` is provided the ID will be appended to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {string} [prefix] The value to prefix the ID with.
+     * @returns {string} Returns the unique ID.
+     * @example
+     *
+     * _.uniqueId('contact_');
+     * // => 'contact_104'
+     *
+     * _.uniqueId();
+     * // => '105'
+     */
+    function uniqueId(prefix) {
+      var id = ++idCounter;
+      return String(prefix == null ? '' : prefix) + id;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * Creates a `lodash` object that wraps the given value with explicit
+     * method chaining enabled.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {*} value The value to wrap.
+     * @returns {Object} Returns the wrapper object.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney',  'age': 36 },
+     *   { 'name': 'fred',    'age': 40 },
+     *   { 'name': 'pebbles', 'age': 1 }
+     * ];
+     *
+     * var youngest = _.chain(characters)
+     *     .sortBy('age')
+     *     .map(function(chr) { return chr.name + ' is ' + chr.age; })
+     *     .first()
+     *     .value();
+     * // => 'pebbles is 1'
+     */
+    function chain(value) {
+      value = new lodashWrapper(value);
+      value.__chain__ = true;
+      return value;
+    }
+
+    /**
+     * Invokes `interceptor` with the `value` as the first argument and then
+     * returns `value`. The purpose of this method is to "tap into" a method
+     * chain in order to perform operations on intermediate results within
+     * the chain.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {*} value The value to provide to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @returns {*} Returns `value`.
+     * @example
+     *
+     * _([1, 2, 3, 4])
+     *  .tap(function(array) { array.pop(); })
+     *  .reverse()
+     *  .value();
+     * // => [3, 2, 1]
+     */
+    function tap(value, interceptor) {
+      interceptor(value);
+      return value;
+    }
+
+    /**
+     * Enables explicit method chaining on the wrapper object.
+     *
+     * @name chain
+     * @memberOf _
+     * @category Chaining
+     * @returns {*} Returns the wrapper object.
+     * @example
+     *
+     * var characters = [
+     *   { 'name': 'barney', 'age': 36 },
+     *   { 'name': 'fred',   'age': 40 }
+     * ];
+     *
+     * // without explicit chaining
+     * _(characters).first();
+     * // => { 'name': 'barney', 'age': 36 }
+     *
+     * // with explicit chaining
+     * _(characters).chain()
+     *   .first()
+     *   .pick('age')
+     *   .value();
+     * // => { 'age': 36 }
+     */
+    function wrapperChain() {
+      this.__chain__ = true;
+      return this;
+    }
+
+    /**
+     * Produces the `toString` result of the wrapped value.
+     *
+     * @name toString
+     * @memberOf _
+     * @category Chaining
+     * @returns {string} Returns the string result.
+     * @example
+     *
+     * _([1, 2, 3]).toString();
+     * // => '1,2,3'
+     */
+    function wrapperToString() {
+      return String(this.__wrapped__);
+    }
+
+    /**
+     * Extracts the wrapped value.
+     *
+     * @name valueOf
+     * @memberOf _
+     * @alias value
+     * @category Chaining
+     * @returns {*} Returns the wrapped value.
+     * @example
+     *
+     * _([1, 2, 3]).valueOf();
+     * // => [1, 2, 3]
+     */
+    function wrapperValueOf() {
+      return this.__wrapped__;
+    }
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions that return wrapped values when chaining
+    lodash.after = after;
+    lodash.assign = assign;
+    lodash.at = at;
+    lodash.bind = bind;
+    lodash.bindAll = bindAll;
+    lodash.bindKey = bindKey;
+    lodash.chain = chain;
+    lodash.compact = compact;
+    lodash.compose = compose;
+    lodash.constant = constant;
+    lodash.countBy = countBy;
+    lodash.create = create;
+    lodash.createCallback = createCallback;
+    lodash.curry = curry;
+    lodash.debounce = debounce;
+    lodash.defaults = defaults;
+    lodash.defer = defer;
+    lodash.delay = delay;
+    lodash.difference = difference;
+    lodash.filter = filter;
+    lodash.flatten = flatten;
+    lodash.forEach = forEach;
+    lodash.forEachRight = forEachRight;
+    lodash.forIn = forIn;
+    lodash.forInRight = forInRight;
+    lodash.forOwn = forOwn;
+    lodash.forOwnRight = forOwnRight;
+    lodash.functions = functions;
+    lodash.groupBy = groupBy;
+    lodash.indexBy = indexBy;
+    lodash.initial = initial;
+    lodash.intersection = intersection;
+    lodash.invert = invert;
+    lodash.invoke = invoke;
+    lodash.keys = keys;
+    lodash.map = map;
+    lodash.mapValues = mapValues;
+    lodash.max = max;
+    lodash.memoize = memoize;
+    lodash.merge = merge;
+    lodash.min = min;
+    lodash.omit = omit;
+    lodash.once = once;
+    lodash.pairs = pairs;
+    lodash.partial = partial;
+    lodash.partialRight = partialRight;
+    lodash.pick = pick;
+    lodash.pluck = pluck;
+    lodash.property = property;
+    lodash.pull = pull;
+    lodash.range = range;
+    lodash.reject = reject;
+    lodash.remove = remove;
+    lodash.rest = rest;
+    lodash.shuffle = shuffle;
+    lodash.sortBy = sortBy;
+    lodash.tap = tap;
+    lodash.throttle = throttle;
+    lodash.times = times;
+    lodash.toArray = toArray;
+    lodash.transform = transform;
+    lodash.union = union;
+    lodash.uniq = uniq;
+    lodash.values = values;
+    lodash.where = where;
+    lodash.without = without;
+    lodash.wrap = wrap;
+    lodash.xor = xor;
+    lodash.zip = zip;
+    lodash.zipObject = zipObject;
+
+    // add aliases
+    lodash.collect = map;
+    lodash.drop = rest;
+    lodash.each = forEach;
+    lodash.eachRight = forEachRight;
+    lodash.extend = assign;
+    lodash.methods = functions;
+    lodash.object = zipObject;
+    lodash.select = filter;
+    lodash.tail = rest;
+    lodash.unique = uniq;
+    lodash.unzip = zip;
+
+    // add functions to `lodash.prototype`
+    mixin(lodash);
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions that return unwrapped values when chaining
+    lodash.clone = clone;
+    lodash.cloneDeep = cloneDeep;
+    lodash.contains = contains;
+    lodash.escape = escape;
+    lodash.every = every;
+    lodash.find = find;
+    lodash.findIndex = findIndex;
+    lodash.findKey = findKey;
+    lodash.findLast = findLast;
+    lodash.findLastIndex = findLastIndex;
+    lodash.findLastKey = findLastKey;
+    lodash.has = has;
+    lodash.identity = identity;
+    lodash.indexOf = indexOf;
+    lodash.isArguments = isArguments;
+    lodash.isArray = isArray;
+    lodash.isBoolean = isBoolean;
+    lodash.isDate = isDate;
+    lodash.isElement = isElement;
+    lodash.isEmpty = isEmpty;
+    lodash.isEqual = isEqual;
+    lodash.isFinite = isFinite;
+    lodash.isFunction = isFunction;
+    lodash.isNaN = isNaN;
+    lodash.isNull = isNull;
+    lodash.isNumber = isNumber;
+    lodash.isObject = isObject;
+    lodash.isPlainObject = isPlainObject;
+    lodash.isRegExp = isRegExp;
+    lodash.isString = isString;
+    lodash.isUndefined = isUndefined;
+    lodash.lastIndexOf = lastIndexOf;
+    lodash.mixin = mixin;
+    lodash.noConflict = noConflict;
+    lodash.noop = noop;
+    lodash.now = now;
+    lodash.parseInt = parseInt;
+    lodash.random = random;
+    lodash.reduce = reduce;
+    lodash.reduceRight = reduceRight;
+    lodash.result = result;
+    lodash.runInContext = runInContext;
+    lodash.size = size;
+    lodash.some = some;
+    lodash.sortedIndex = sortedIndex;
+    lodash.template = template;
+    lodash.unescape = unescape;
+    lodash.uniqueId = uniqueId;
+
+    // add aliases
+    lodash.all = every;
+    lodash.any = some;
+    lodash.detect = find;
+    lodash.findWhere = find;
+    lodash.foldl = reduce;
+    lodash.foldr = reduceRight;
+    lodash.include = contains;
+    lodash.inject = reduce;
+
+    mixin(function() {
+      var source = {}
+      forOwn(lodash, function(func, methodName) {
+        if (!lodash.prototype[methodName]) {
+          source[methodName] = func;
+        }
+      });
+      return source;
+    }(), false);
+
+    /*--------------------------------------------------------------------------*/
+
+    // add functions capable of returning wrapped and unwrapped values when chaining
+    lodash.first = first;
+    lodash.last = last;
+    lodash.sample = sample;
+
+    // add aliases
+    lodash.take = first;
+    lodash.head = first;
+
+    forOwn(lodash, function(func, methodName) {
+      var callbackable = methodName !== 'sample';
+      if (!lodash.prototype[methodName]) {
+        lodash.prototype[methodName]= function(n, guard) {
+          var chainAll = this.__chain__,
+              result = func(this.__wrapped__, n, guard);
+
+          return !chainAll && (n == null || (guard && !(callbackable && typeof n == 'function')))
+            ? result
+            : new lodashWrapper(result, chainAll);
+        };
+      }
+    });
+
+    /*--------------------------------------------------------------------------*/
+
+    /**
+     * The semantic version number.
+     *
+     * @static
+     * @memberOf _
+     * @type string
+     */
+    lodash.VERSION = '2.4.1';
+
+    // add "Chaining" functions to the wrapper
+    lodash.prototype.chain = wrapperChain;
+    lodash.prototype.toString = wrapperToString;
+    lodash.prototype.value = wrapperValueOf;
+    lodash.prototype.valueOf = wrapperValueOf;
+
+    // add `Array` functions that return unwrapped values
+    baseEach(['join', 'pop', 'shift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        var chainAll = this.__chain__,
+            result = func.apply(this.__wrapped__, arguments);
+
+        return chainAll
+          ? new lodashWrapper(result, chainAll)
+          : result;
+      };
+    });
+
+    // add `Array` functions that return the existing wrapped value
+    baseEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        func.apply(this.__wrapped__, arguments);
+        return this;
+      };
+    });
+
+    // add `Array` functions that return new wrapped values
+    baseEach(['concat', 'slice', 'splice'], function(methodName) {
+      var func = arrayRef[methodName];
+      lodash.prototype[methodName] = function() {
+        return new lodashWrapper(func.apply(this.__wrapped__, arguments), this.__chain__);
+      };
+    });
+
+    // avoid array-like object bugs with `Array#shift` and `Array#splice`
+    // in IE < 9, Firefox < 10, Narwhal, and RingoJS
+    if (!support.spliceObjects) {
+      baseEach(['pop', 'shift', 'splice'], function(methodName) {
+        var func = arrayRef[methodName],
+            isSplice = methodName == 'splice';
+
+        lodash.prototype[methodName] = function() {
+          var chainAll = this.__chain__,
+              value = this.__wrapped__,
+              result = func.apply(value, arguments);
+
+          if (value.length === 0) {
+            delete value[0];
+          }
+          return (chainAll || isSplice)
+            ? new lodashWrapper(result, chainAll)
+            : result;
+        };
+      });
+    }
+
+    // add pseudo private property to be used and removed during the build process
+    lodash._baseEach = baseEach;
+    lodash._iteratorTemplate = iteratorTemplate;
+    lodash._shimKeys = shimKeys;
+
+    return lodash;
+  }
+
+  /*--------------------------------------------------------------------------*/
+
+  // expose Lo-Dash
+  var _ = runInContext();
+
+  // some AMD build optimizers like r.js check for condition patterns like the following:
+  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lo-Dash to the global object even when an AMD loader is present in
+    // case Lo-Dash is loaded with a RequireJS shim config.
+    // See http://requirejs.org/docs/api.html#config-shim
+    root._ = _;
+
+    // define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module
+    define(function() {
+      return _;
+    });
+  }
+  // check for `exports` after `define` in case a build optimizer adds an `exports` object
+  else if (freeExports && freeModule) {
+    // in Node.js or RingoJS
+    if (moduleExports) {
+      (freeModule.exports = _)._ = _;
+    }
+    // in Narwhal or Rhino -require
+    else {
+      freeExports._ = _;
+    }
+  }
+  else {
+    // in a browser or Rhino
+    root._ = _;
+  }
+}.call(this));
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/lodash/package.json
new file mode 100755 (executable)
index 0000000..b492293
--- /dev/null
@@ -0,0 +1,131 @@
+{
+  "name": "lodash",
+  "version": "2.4.1",
+  "description": "A utility library delivering consistency, customization, performance, & extras.",
+  "homepage": "http://lodash.com/",
+  "license": "MIT",
+  "main": "dist/lodash.js",
+  "keywords": [
+    "amd",
+    "browser",
+    "client",
+    "customize",
+    "functional",
+    "server",
+    "util"
+  ],
+  "author": {
+    "name": "John-David Dalton",
+    "email": "john.david.dalton@gmail.com",
+    "url": "http://allyoucanleet.com/"
+  },
+  "contributors": [
+    {
+      "name": "John-David Dalton",
+      "email": "john.david.dalton@gmail.com",
+      "url": "http://allyoucanleet.com/"
+    },
+    {
+      "name": "Blaine Bublitz",
+      "email": "blaine@iceddev.com",
+      "url": "http://www.iceddev.com/"
+    },
+    {
+      "name": "Kit Cambridge",
+      "email": "github@kitcambridge.be",
+      "url": "http://kitcambridge.be/"
+    },
+    {
+      "name": "Mathias Bynens",
+      "email": "mathias@qiwi.be",
+      "url": "http://mathiasbynens.be/"
+    }
+  ],
+  "bugs": {
+    "url": "https://github.com/lodash/lodash/issues"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/lodash/lodash.git"
+  },
+  "engines": [
+    "node",
+    "rhino"
+  ],
+  "files": [
+    "LICENSE.txt",
+    "lodash.js",
+    "dist/lodash.js",
+    "dist/lodash.min.js",
+    "dist/lodash.compat.js",
+    "dist/lodash.compat.min.js",
+    "dist/lodash.underscore.js",
+    "dist/lodash.underscore.min.js"
+  ],
+  "jam": {
+    "main": "dist/lodash.compat.js",
+    "include": [
+      "LICENSE.txt",
+      "dist/lodash.js",
+      "dist/lodash.min.js",
+      "dist/lodash.compat.js",
+      "dist/lodash.compat.min.js",
+      "dist/lodash.underscore.js",
+      "dist/lodash.underscore.min.js"
+    ]
+  },
+  "volo": {
+    "type": "directory",
+    "ignore": [
+      ".*",
+      "*.custom.*",
+      "*.min.*",
+      "*.template.*",
+      "*.map",
+      "*.md",
+      "lodash.js",
+      "index.js",
+      "bower.json",
+      "component.json",
+      "doc",
+      "modularize",
+      "node_modules",
+      "perf",
+      "test",
+      "vendor"
+    ]
+  },
+  "_id": "lodash@2.4.1",
+  "dist": {
+    "shasum": "5b7723034dda4d262e5a46fb2c58d7cc22f71420",
+    "tarball": "http://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz"
+  },
+  "_from": "lodash@^2.4.1",
+  "_npmVersion": "1.3.14",
+  "_npmUser": {
+    "name": "jdalton",
+    "email": "john.david.dalton@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "jdalton",
+      "email": "john.david.dalton@gmail.com"
+    },
+    {
+      "name": "mathias",
+      "email": "mathias@qiwi.be"
+    },
+    {
+      "name": "phated",
+      "email": "blaine@iceddev.com"
+    },
+    {
+      "name": "kitcambridge",
+      "email": "github@kitcambridge.be"
+    }
+  ],
+  "directories": {},
+  "_shasum": "5b7723034dda4d262e5a46fb2c58d7cc22f71420",
+  "_resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/LICENSE
new file mode 100755 (executable)
index 0000000..432d1ae
--- /dev/null
@@ -0,0 +1,21 @@
+Copyright 2010 James Halliday (mail@substack.net)
+
+This project is free software released under the MIT/X11 license:
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/bin/cmd.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/bin/cmd.js
new file mode 100755 (executable)
index 0000000..d95de15
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env node
+
+var mkdirp = require('../');
+var minimist = require('minimist');
+var fs = require('fs');
+
+var argv = minimist(process.argv.slice(2), {
+    alias: { m: 'mode', h: 'help' },
+    string: [ 'mode' ]
+});
+if (argv.help) {
+    fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout);
+    return;
+}
+
+var paths = argv._.slice();
+var mode = argv.mode ? parseInt(argv.mode, 8) : undefined;
+
+(function next () {
+    if (paths.length === 0) return;
+    var p = paths.shift();
+    
+    if (mode === undefined) mkdirp(p, cb)
+    else mkdirp(p, mode, cb)
+    
+    function cb (err) {
+        if (err) {
+            console.error(err.message);
+            process.exit(1);
+        }
+        else next();
+    }
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/bin/usage.txt b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/bin/usage.txt
new file mode 100755 (executable)
index 0000000..f952aa2
--- /dev/null
@@ -0,0 +1,12 @@
+usage: mkdirp [DIR1,DIR2..] {OPTIONS}
+
+  Create each supplied directory including any necessary parent directories that
+  don't yet exist.
+  
+  If the directory already exists, do nothing.
+
+OPTIONS are:
+
+  -m, --mode   If a directory needs to be created, set the mode as an octal
+               permission string.
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/examples/pow.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/examples/pow.js
new file mode 100755 (executable)
index 0000000..e692421
--- /dev/null
@@ -0,0 +1,6 @@
+var mkdirp = require('mkdirp');
+
+mkdirp('/tmp/foo/bar/baz', function (err) {
+    if (err) console.error(err)
+    else console.log('pow!')
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/index.js
new file mode 100755 (executable)
index 0000000..a1742b2
--- /dev/null
@@ -0,0 +1,97 @@
+var path = require('path');
+var fs = require('fs');
+
+module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
+
+function mkdirP (p, opts, f, made) {
+    if (typeof opts === 'function') {
+        f = opts;
+        opts = {};
+    }
+    else if (!opts || typeof opts !== 'object') {
+        opts = { mode: opts };
+    }
+    
+    var mode = opts.mode;
+    var xfs = opts.fs || fs;
+    
+    if (mode === undefined) {
+        mode = 0777 & (~process.umask());
+    }
+    if (!made) made = null;
+    
+    var cb = f || function () {};
+    p = path.resolve(p);
+    
+    xfs.mkdir(p, mode, function (er) {
+        if (!er) {
+            made = made || p;
+            return cb(null, made);
+        }
+        switch (er.code) {
+            case 'ENOENT':
+                mkdirP(path.dirname(p), opts, function (er, made) {
+                    if (er) cb(er, made);
+                    else mkdirP(p, opts, cb, made);
+                });
+                break;
+
+            // In the case of any other error, just see if there's a dir
+            // there already.  If so, then hooray!  If not, then something
+            // is borked.
+            default:
+                xfs.stat(p, function (er2, stat) {
+                    // if the stat fails, then that's super weird.
+                    // let the original error be the failure reason.
+                    if (er2 || !stat.isDirectory()) cb(er, made)
+                    else cb(null, made);
+                });
+                break;
+        }
+    });
+}
+
+mkdirP.sync = function sync (p, opts, made) {
+    if (!opts || typeof opts !== 'object') {
+        opts = { mode: opts };
+    }
+    
+    var mode = opts.mode;
+    var xfs = opts.fs || fs;
+    
+    if (mode === undefined) {
+        mode = 0777 & (~process.umask());
+    }
+    if (!made) made = null;
+
+    p = path.resolve(p);
+
+    try {
+        xfs.mkdirSync(p, mode);
+        made = made || p;
+    }
+    catch (err0) {
+        switch (err0.code) {
+            case 'ENOENT' :
+                made = sync(path.dirname(p), opts, made);
+                sync(p, opts, made);
+                break;
+
+            // In the case of any other error, just see if there's a dir
+            // there already.  If so, then hooray!  If not, then something
+            // is borked.
+            default:
+                var stat;
+                try {
+                    stat = xfs.statSync(p);
+                }
+                catch (err1) {
+                    throw err0;
+                }
+                if (!stat.isDirectory()) throw err0;
+                break;
+        }
+    }
+
+    return made;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/LICENSE
new file mode 100755 (executable)
index 0000000..ee27ba4
--- /dev/null
@@ -0,0 +1,18 @@
+This software is released under the MIT license:
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/example/parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/example/parse.js
new file mode 100755 (executable)
index 0000000..abff3e8
--- /dev/null
@@ -0,0 +1,2 @@
+var argv = require('../')(process.argv.slice(2));
+console.dir(argv);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/index.js
new file mode 100755 (executable)
index 0000000..584f551
--- /dev/null
@@ -0,0 +1,187 @@
+module.exports = function (args, opts) {
+    if (!opts) opts = {};
+    
+    var flags = { bools : {}, strings : {} };
+    
+    [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
+        flags.bools[key] = true;
+    });
+    
+    [].concat(opts.string).filter(Boolean).forEach(function (key) {
+        flags.strings[key] = true;
+    });
+    
+    var aliases = {};
+    Object.keys(opts.alias || {}).forEach(function (key) {
+        aliases[key] = [].concat(opts.alias[key]);
+        aliases[key].forEach(function (x) {
+            aliases[x] = [key].concat(aliases[key].filter(function (y) {
+                return x !== y;
+            }));
+        });
+    });
+    
+    var defaults = opts['default'] || {};
+    
+    var argv = { _ : [] };
+    Object.keys(flags.bools).forEach(function (key) {
+        setArg(key, defaults[key] === undefined ? false : defaults[key]);
+    });
+    
+    var notFlags = [];
+
+    if (args.indexOf('--') !== -1) {
+        notFlags = args.slice(args.indexOf('--')+1);
+        args = args.slice(0, args.indexOf('--'));
+    }
+
+    function setArg (key, val) {
+        var value = !flags.strings[key] && isNumber(val)
+            ? Number(val) : val
+        ;
+        setKey(argv, key.split('.'), value);
+        
+        (aliases[key] || []).forEach(function (x) {
+            setKey(argv, x.split('.'), value);
+        });
+    }
+    
+    for (var i = 0; i < args.length; i++) {
+        var arg = args[i];
+        
+        if (/^--.+=/.test(arg)) {
+            // Using [\s\S] instead of . because js doesn't support the
+            // 'dotall' regex modifier. See:
+            // http://stackoverflow.com/a/1068308/13216
+            var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
+            setArg(m[1], m[2]);
+        }
+        else if (/^--no-.+/.test(arg)) {
+            var key = arg.match(/^--no-(.+)/)[1];
+            setArg(key, false);
+        }
+        else if (/^--.+/.test(arg)) {
+            var key = arg.match(/^--(.+)/)[1];
+            var next = args[i + 1];
+            if (next !== undefined && !/^-/.test(next)
+            && !flags.bools[key]
+            && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
+                setArg(key, next);
+                i++;
+            }
+            else if (/^(true|false)$/.test(next)) {
+                setArg(key, next === 'true');
+                i++;
+            }
+            else {
+                setArg(key, flags.strings[key] ? '' : true);
+            }
+        }
+        else if (/^-[^-]+/.test(arg)) {
+            var letters = arg.slice(1,-1).split('');
+            
+            var broken = false;
+            for (var j = 0; j < letters.length; j++) {
+                var next = arg.slice(j+2);
+                
+                if (next === '-') {
+                    setArg(letters[j], next)
+                    continue;
+                }
+                
+                if (/[A-Za-z]/.test(letters[j])
+                && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
+                    setArg(letters[j], next);
+                    broken = true;
+                    break;
+                }
+                
+                if (letters[j+1] && letters[j+1].match(/\W/)) {
+                    setArg(letters[j], arg.slice(j+2));
+                    broken = true;
+                    break;
+                }
+                else {
+                    setArg(letters[j], flags.strings[letters[j]] ? '' : true);
+                }
+            }
+            
+            var key = arg.slice(-1)[0];
+            if (!broken && key !== '-') {
+                if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
+                && !flags.bools[key]
+                && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
+                    setArg(key, args[i+1]);
+                    i++;
+                }
+                else if (args[i+1] && /true|false/.test(args[i+1])) {
+                    setArg(key, args[i+1] === 'true');
+                    i++;
+                }
+                else {
+                    setArg(key, flags.strings[key] ? '' : true);
+                }
+            }
+        }
+        else {
+            argv._.push(
+                flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
+            );
+        }
+    }
+    
+    Object.keys(defaults).forEach(function (key) {
+        if (!hasKey(argv, key.split('.'))) {
+            setKey(argv, key.split('.'), defaults[key]);
+            
+            (aliases[key] || []).forEach(function (x) {
+                setKey(argv, x.split('.'), defaults[key]);
+            });
+        }
+    });
+    
+    notFlags.forEach(function(key) {
+        argv._.push(key);
+    });
+
+    return argv;
+};
+
+function hasKey (obj, keys) {
+    var o = obj;
+    keys.slice(0,-1).forEach(function (key) {
+        o = (o[key] || {});
+    });
+
+    var key = keys[keys.length - 1];
+    return key in o;
+}
+
+function setKey (obj, keys, value) {
+    var o = obj;
+    keys.slice(0,-1).forEach(function (key) {
+        if (o[key] === undefined) o[key] = {};
+        o = o[key];
+    });
+    
+    var key = keys[keys.length - 1];
+    if (o[key] === undefined || typeof o[key] === 'boolean') {
+        o[key] = value;
+    }
+    else if (Array.isArray(o[key])) {
+        o[key].push(value);
+    }
+    else {
+        o[key] = [ o[key], value ];
+    }
+}
+
+function isNumber (x) {
+    if (typeof x === 'number') return true;
+    if (/^0x[0-9a-f]+$/i.test(x)) return true;
+    return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
+}
+
+function longest (xs) {
+    return Math.max.apply(null, xs.map(function (x) { return x.length }));
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/package.json
new file mode 100755 (executable)
index 0000000..09e9ec4
--- /dev/null
@@ -0,0 +1,67 @@
+{
+  "name": "minimist",
+  "version": "0.0.8",
+  "description": "parse argument options",
+  "main": "index.js",
+  "devDependencies": {
+    "tape": "~1.0.4",
+    "tap": "~0.4.0"
+  },
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "testling": {
+    "files": "test/*.js",
+    "browsers": [
+      "ie/6..latest",
+      "ff/5",
+      "firefox/latest",
+      "chrome/10",
+      "chrome/latest",
+      "safari/5.1",
+      "safari/latest",
+      "opera/12"
+    ]
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/substack/minimist.git"
+  },
+  "homepage": "https://github.com/substack/minimist",
+  "keywords": [
+    "argv",
+    "getopt",
+    "parser",
+    "optimist"
+  ],
+  "author": {
+    "name": "James Halliday",
+    "email": "mail@substack.net",
+    "url": "http://substack.net"
+  },
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/substack/minimist/issues"
+  },
+  "_id": "minimist@0.0.8",
+  "dist": {
+    "shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
+    "tarball": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
+  },
+  "_from": "minimist@0.0.8",
+  "_npmVersion": "1.4.3",
+  "_npmUser": {
+    "name": "substack",
+    "email": "mail@substack.net"
+  },
+  "maintainers": [
+    {
+      "name": "substack",
+      "email": "mail@substack.net"
+    }
+  ],
+  "directories": {},
+  "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
+  "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/readme.markdown b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/readme.markdown
new file mode 100755 (executable)
index 0000000..c256353
--- /dev/null
@@ -0,0 +1,73 @@
+# minimist
+
+parse argument options
+
+This module is the guts of optimist's argument parser without all the
+fanciful decoration.
+
+[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist)
+
+[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist)
+
+# example
+
+``` js
+var argv = require('minimist')(process.argv.slice(2));
+console.dir(argv);
+```
+
+```
+$ node example/parse.js -a beep -b boop
+{ _: [], a: 'beep', b: 'boop' }
+```
+
+```
+$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
+{ _: [ 'foo', 'bar', 'baz' ],
+  x: 3,
+  y: 4,
+  n: 5,
+  a: true,
+  b: true,
+  c: true,
+  beep: 'boop' }
+```
+
+# methods
+
+``` js
+var parseArgs = require('minimist')
+```
+
+## var argv = parseArgs(args, opts={})
+
+Return an argument object `argv` populated with the array arguments from `args`.
+
+`argv._` contains all the arguments that didn't have an option associated with
+them.
+
+Numeric-looking arguments will be returned as numbers unless `opts.string` or
+`opts.boolean` is set for that argument name.
+
+Any arguments after `'--'` will not be parsed and will end up in `argv._`.
+
+options can be:
+
+* `opts.string` - a string or array of strings argument names to always treat as
+strings
+* `opts.boolean` - a string or array of strings to always treat as booleans
+* `opts.alias` - an object mapping string names to strings or arrays of string
+argument names to use as aliases
+* `opts.default` - an object mapping string argument names to default values
+
+# install
+
+With [npm](https://npmjs.org) do:
+
+```
+npm install minimist
+```
+
+# license
+
+MIT
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/dash.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/dash.js
new file mode 100755 (executable)
index 0000000..8b034b9
--- /dev/null
@@ -0,0 +1,24 @@
+var parse = require('../');
+var test = require('tape');
+
+test('-', function (t) {
+    t.plan(5);
+    t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
+    t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
+    t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
+    t.deepEqual(
+        parse([ '-b', '-' ], { boolean: 'b' }),
+        { b: true, _: [ '-' ] }
+    );
+    t.deepEqual(
+        parse([ '-s', '-' ], { string: 's' }),
+        { s: '-', _: [] }
+    );
+});
+
+test('-a -- b', function (t) {
+    t.plan(3);
+    t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
+    t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
+    t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/default_bool.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/default_bool.js
new file mode 100755 (executable)
index 0000000..f0041ee
--- /dev/null
@@ -0,0 +1,20 @@
+var test = require('tape');
+var parse = require('../');
+
+test('boolean default true', function (t) {
+    var argv = parse([], {
+        boolean: 'sometrue',
+        default: { sometrue: true }
+    });
+    t.equal(argv.sometrue, true);
+    t.end();
+});
+
+test('boolean default false', function (t) {
+    var argv = parse([], {
+        boolean: 'somefalse',
+        default: { somefalse: false }
+    });
+    t.equal(argv.somefalse, false);
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/dotted.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/dotted.js
new file mode 100755 (executable)
index 0000000..ef0ae34
--- /dev/null
@@ -0,0 +1,16 @@
+var parse = require('../');
+var test = require('tape');
+
+test('dotted alias', function (t) {
+    var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
+    t.equal(argv.a.b, 22);
+    t.equal(argv.aa.bb, 22);
+    t.end();
+});
+
+test('dotted default', function (t) {
+    var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
+    t.equal(argv.a.b, 11);
+    t.equal(argv.aa.bb, 11);
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/long.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/long.js
new file mode 100755 (executable)
index 0000000..5d3a1e0
--- /dev/null
@@ -0,0 +1,31 @@
+var test = require('tape');
+var parse = require('../');
+
+test('long opts', function (t) {
+    t.deepEqual(
+        parse([ '--bool' ]),
+        { bool : true, _ : [] },
+        'long boolean'
+    );
+    t.deepEqual(
+        parse([ '--pow', 'xixxle' ]),
+        { pow : 'xixxle', _ : [] },
+        'long capture sp'
+    );
+    t.deepEqual(
+        parse([ '--pow=xixxle' ]),
+        { pow : 'xixxle', _ : [] },
+        'long capture eq'
+    );
+    t.deepEqual(
+        parse([ '--host', 'localhost', '--port', '555' ]),
+        { host : 'localhost', port : 555, _ : [] },
+        'long captures sp'
+    );
+    t.deepEqual(
+        parse([ '--host=localhost', '--port=555' ]),
+        { host : 'localhost', port : 555, _ : [] },
+        'long captures eq'
+    );
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/parse.js
new file mode 100755 (executable)
index 0000000..8a90646
--- /dev/null
@@ -0,0 +1,318 @@
+var parse = require('../');
+var test = require('tape');
+
+test('parse args', function (t) {
+    t.deepEqual(
+        parse([ '--no-moo' ]),
+        { moo : false, _ : [] },
+        'no'
+    );
+    t.deepEqual(
+        parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
+        { v : ['a','b','c'], _ : [] },
+        'multi'
+    );
+    t.end();
+});
+test('comprehensive', function (t) {
+    t.deepEqual(
+        parse([
+            '--name=meowmers', 'bare', '-cats', 'woo',
+            '-h', 'awesome', '--multi=quux',
+            '--key', 'value',
+            '-b', '--bool', '--no-meep', '--multi=baz',
+            '--', '--not-a-flag', 'eek'
+        ]),
+        {
+            c : true,
+            a : true,
+            t : true,
+            s : 'woo',
+            h : 'awesome',
+            b : true,
+            bool : true,
+            key : 'value',
+            multi : [ 'quux', 'baz' ],
+            meep : false,
+            name : 'meowmers',
+            _ : [ 'bare', '--not-a-flag', 'eek' ]
+        }
+    );
+    t.end();
+});
+
+test('nums', function (t) {
+    var argv = parse([
+        '-x', '1234',
+        '-y', '5.67',
+        '-z', '1e7',
+        '-w', '10f',
+        '--hex', '0xdeadbeef',
+        '789'
+    ]);
+    t.deepEqual(argv, {
+        x : 1234,
+        y : 5.67,
+        z : 1e7,
+        w : '10f',
+        hex : 0xdeadbeef,
+        _ : [ 789 ]
+    });
+    t.deepEqual(typeof argv.x, 'number');
+    t.deepEqual(typeof argv.y, 'number');
+    t.deepEqual(typeof argv.z, 'number');
+    t.deepEqual(typeof argv.w, 'string');
+    t.deepEqual(typeof argv.hex, 'number');
+    t.deepEqual(typeof argv._[0], 'number');
+    t.end();
+});
+
+test('flag boolean', function (t) {
+    var argv = parse([ '-t', 'moo' ], { boolean: 't' });
+    t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
+    t.deepEqual(typeof argv.t, 'boolean');
+    t.end();
+});
+
+test('flag boolean value', function (t) {
+    var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
+        boolean: [ 't', 'verbose' ],
+        default: { verbose: true }
+    });
+    
+    t.deepEqual(argv, {
+        verbose: false,
+        t: true,
+        _: ['moo']
+    });
+    
+    t.deepEqual(typeof argv.verbose, 'boolean');
+    t.deepEqual(typeof argv.t, 'boolean');
+    t.end();
+});
+
+test('flag boolean default false', function (t) {
+    var argv = parse(['moo'], {
+        boolean: ['t', 'verbose'],
+        default: { verbose: false, t: false }
+    });
+    
+    t.deepEqual(argv, {
+        verbose: false,
+        t: false,
+        _: ['moo']
+    });
+    
+    t.deepEqual(typeof argv.verbose, 'boolean');
+    t.deepEqual(typeof argv.t, 'boolean');
+    t.end();
+
+});
+
+test('boolean groups', function (t) {
+    var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
+        boolean: ['x','y','z']
+    });
+    
+    t.deepEqual(argv, {
+        x : true,
+        y : false,
+        z : true,
+        _ : [ 'one', 'two', 'three' ]
+    });
+    
+    t.deepEqual(typeof argv.x, 'boolean');
+    t.deepEqual(typeof argv.y, 'boolean');
+    t.deepEqual(typeof argv.z, 'boolean');
+    t.end();
+});
+
+test('newlines in params' , function (t) {
+    var args = parse([ '-s', "X\nX" ])
+    t.deepEqual(args, { _ : [], s : "X\nX" });
+    
+    // reproduce in bash:
+    // VALUE="new
+    // line"
+    // node program.js --s="$VALUE"
+    args = parse([ "--s=X\nX" ])
+    t.deepEqual(args, { _ : [], s : "X\nX" });
+    t.end();
+});
+
+test('strings' , function (t) {
+    var s = parse([ '-s', '0001234' ], { string: 's' }).s;
+    t.equal(s, '0001234');
+    t.equal(typeof s, 'string');
+    
+    var x = parse([ '-x', '56' ], { string: 'x' }).x;
+    t.equal(x, '56');
+    t.equal(typeof x, 'string');
+    t.end();
+});
+
+test('stringArgs', function (t) {
+    var s = parse([ '  ', '  ' ], { string: '_' })._;
+    t.same(s.length, 2);
+    t.same(typeof s[0], 'string');
+    t.same(s[0], '  ');
+    t.same(typeof s[1], 'string');
+    t.same(s[1], '  ');
+    t.end();
+});
+
+test('empty strings', function(t) {
+    var s = parse([ '-s' ], { string: 's' }).s;
+    t.equal(s, '');
+    t.equal(typeof s, 'string');
+
+    var str = parse([ '--str' ], { string: 'str' }).str;
+    t.equal(str, '');
+    t.equal(typeof str, 'string');
+
+    var letters = parse([ '-art' ], {
+        string: [ 'a', 't' ]
+    });
+
+    t.equal(letters.a, '');
+    t.equal(letters.r, true);
+    t.equal(letters.t, '');
+
+    t.end();
+});
+
+
+test('slashBreak', function (t) {
+    t.same(
+        parse([ '-I/foo/bar/baz' ]),
+        { I : '/foo/bar/baz', _ : [] }
+    );
+    t.same(
+        parse([ '-xyz/foo/bar/baz' ]),
+        { x : true, y : true, z : '/foo/bar/baz', _ : [] }
+    );
+    t.end();
+});
+
+test('alias', function (t) {
+    var argv = parse([ '-f', '11', '--zoom', '55' ], {
+        alias: { z: 'zoom' }
+    });
+    t.equal(argv.zoom, 55);
+    t.equal(argv.z, argv.zoom);
+    t.equal(argv.f, 11);
+    t.end();
+});
+
+test('multiAlias', function (t) {
+    var argv = parse([ '-f', '11', '--zoom', '55' ], {
+        alias: { z: [ 'zm', 'zoom' ] }
+    });
+    t.equal(argv.zoom, 55);
+    t.equal(argv.z, argv.zoom);
+    t.equal(argv.z, argv.zm);
+    t.equal(argv.f, 11);
+    t.end();
+});
+
+test('nested dotted objects', function (t) {
+    var argv = parse([
+        '--foo.bar', '3', '--foo.baz', '4',
+        '--foo.quux.quibble', '5', '--foo.quux.o_O',
+        '--beep.boop'
+    ]);
+    
+    t.same(argv.foo, {
+        bar : 3,
+        baz : 4,
+        quux : {
+            quibble : 5,
+            o_O : true
+        }
+    });
+    t.same(argv.beep, { boop : true });
+    t.end();
+});
+
+test('boolean and alias with chainable api', function (t) {
+    var aliased = [ '-h', 'derp' ];
+    var regular = [ '--herp',  'derp' ];
+    var opts = {
+        herp: { alias: 'h', boolean: true }
+    };
+    var aliasedArgv = parse(aliased, {
+        boolean: 'herp',
+        alias: { h: 'herp' }
+    });
+    var propertyArgv = parse(regular, {
+        boolean: 'herp',
+        alias: { h: 'herp' }
+    });
+    var expected = {
+        herp: true,
+        h: true,
+        '_': [ 'derp' ]
+    };
+    
+    t.same(aliasedArgv, expected);
+    t.same(propertyArgv, expected); 
+    t.end();
+});
+
+test('boolean and alias with options hash', function (t) {
+    var aliased = [ '-h', 'derp' ];
+    var regular = [ '--herp', 'derp' ];
+    var opts = {
+        alias: { 'h': 'herp' },
+        boolean: 'herp'
+    };
+    var aliasedArgv = parse(aliased, opts);
+    var propertyArgv = parse(regular, opts);
+    var expected = {
+        herp: true,
+        h: true,
+        '_': [ 'derp' ]
+    };
+    t.same(aliasedArgv, expected);
+    t.same(propertyArgv, expected);
+    t.end();
+});
+
+test('boolean and alias using explicit true', function (t) {
+    var aliased = [ '-h', 'true' ];
+    var regular = [ '--herp',  'true' ];
+    var opts = {
+        alias: { h: 'herp' },
+        boolean: 'h'
+    };
+    var aliasedArgv = parse(aliased, opts);
+    var propertyArgv = parse(regular, opts);
+    var expected = {
+        herp: true,
+        h: true,
+        '_': [ ]
+    };
+
+    t.same(aliasedArgv, expected);
+    t.same(propertyArgv, expected); 
+    t.end();
+});
+
+// regression, see https://github.com/substack/node-optimist/issues/71
+test('boolean and --x=true', function(t) {
+    var parsed = parse(['--boool', '--other=true'], {
+        boolean: 'boool'
+    });
+
+    t.same(parsed.boool, true);
+    t.same(parsed.other, 'true');
+
+    parsed = parse(['--boool', '--other=false'], {
+        boolean: 'boool'
+    });
+    
+    t.same(parsed.boool, true);
+    t.same(parsed.other, 'false');
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
new file mode 100755 (executable)
index 0000000..21851b0
--- /dev/null
@@ -0,0 +1,9 @@
+var parse = require('../');
+var test = require('tape');
+
+test('parse with modifier functions' , function (t) {
+    t.plan(1);
+    
+    var argv = parse([ '-b', '123' ], { boolean: 'b' });
+    t.deepEqual(argv, { b: true, _: ['123'] });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/short.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/short.js
new file mode 100755 (executable)
index 0000000..d513a1c
--- /dev/null
@@ -0,0 +1,67 @@
+var parse = require('../');
+var test = require('tape');
+
+test('numeric short args', function (t) {
+    t.plan(2);
+    t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
+    t.deepEqual(
+        parse([ '-123', '456' ]),
+        { 1: true, 2: true, 3: 456, _: [] }
+    );
+});
+
+test('short', function (t) {
+    t.deepEqual(
+        parse([ '-b' ]),
+        { b : true, _ : [] },
+        'short boolean'
+    );
+    t.deepEqual(
+        parse([ 'foo', 'bar', 'baz' ]),
+        { _ : [ 'foo', 'bar', 'baz' ] },
+        'bare'
+    );
+    t.deepEqual(
+        parse([ '-cats' ]),
+        { c : true, a : true, t : true, s : true, _ : [] },
+        'group'
+    );
+    t.deepEqual(
+        parse([ '-cats', 'meow' ]),
+        { c : true, a : true, t : true, s : 'meow', _ : [] },
+        'short group next'
+    );
+    t.deepEqual(
+        parse([ '-h', 'localhost' ]),
+        { h : 'localhost', _ : [] },
+        'short capture'
+    );
+    t.deepEqual(
+        parse([ '-h', 'localhost', '-p', '555' ]),
+        { h : 'localhost', p : 555, _ : [] },
+        'short captures'
+    );
+    t.end();
+});
+test('mixed short bool and capture', function (t) {
+    t.same(
+        parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
+        {
+            f : true, p : 555, h : 'localhost',
+            _ : [ 'script.js' ]
+        }
+    );
+    t.end();
+});
+test('short and long', function (t) {
+    t.deepEqual(
+        parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
+        {
+            f : true, p : 555, h : 'localhost',
+            _ : [ 'script.js' ]
+        }
+    );
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/whitespace.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/node_modules/minimist/test/whitespace.js
new file mode 100755 (executable)
index 0000000..8a52a58
--- /dev/null
@@ -0,0 +1,8 @@
+var parse = require('../');
+var test = require('tape');
+
+test('whitespace should be whitespace' , function (t) {
+    t.plan(1);
+    var x = parse([ '-x', '\t' ]).x;
+    t.equal(x, '\t');
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/package.json
new file mode 100755 (executable)
index 0000000..becdf58
--- /dev/null
@@ -0,0 +1,58 @@
+{
+  "name": "mkdirp",
+  "description": "Recursively mkdir, like `mkdir -p`",
+  "version": "0.5.0",
+  "author": {
+    "name": "James Halliday",
+    "email": "mail@substack.net",
+    "url": "http://substack.net"
+  },
+  "main": "./index",
+  "keywords": [
+    "mkdir",
+    "directory"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/substack/node-mkdirp.git"
+  },
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "dependencies": {
+    "minimist": "0.0.8"
+  },
+  "devDependencies": {
+    "tap": "~0.4.0",
+    "mock-fs": "~2.2.0"
+  },
+  "bin": {
+    "mkdirp": "bin/cmd.js"
+  },
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/substack/node-mkdirp/issues"
+  },
+  "homepage": "https://github.com/substack/node-mkdirp",
+  "_id": "mkdirp@0.5.0",
+  "dist": {
+    "shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12",
+    "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz"
+  },
+  "_from": "mkdirp@^0.5.0",
+  "_npmVersion": "1.4.3",
+  "_npmUser": {
+    "name": "substack",
+    "email": "mail@substack.net"
+  },
+  "maintainers": [
+    {
+      "name": "substack",
+      "email": "mail@substack.net"
+    }
+  ],
+  "directories": {},
+  "_shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12",
+  "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/readme.markdown b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/readme.markdown
new file mode 100755 (executable)
index 0000000..3cc1315
--- /dev/null
@@ -0,0 +1,100 @@
+# mkdirp
+
+Like `mkdir -p`, but in node.js!
+
+[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
+
+# example
+
+## pow.js
+
+```js
+var mkdirp = require('mkdirp');
+    
+mkdirp('/tmp/foo/bar/baz', function (err) {
+    if (err) console.error(err)
+    else console.log('pow!')
+});
+```
+
+Output
+
+```
+pow!
+```
+
+And now /tmp/foo/bar/baz exists, huzzah!
+
+# methods
+
+```js
+var mkdirp = require('mkdirp');
+```
+
+## mkdirp(dir, opts, cb)
+
+Create a new directory and any necessary subdirectories at `dir` with octal
+permission string `opts.mode`. If `opts` is a non-object, it will be treated as
+the `opts.mode`.
+
+If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
+
+`cb(err, made)` fires with the error or the first directory `made`
+that had to be created, if any.
+
+You can optionally pass in an alternate `fs` implementation by passing in
+`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and
+`opts.fs.stat(path, cb)`.
+
+## mkdirp.sync(dir, opts)
+
+Synchronously create a new directory and any necessary subdirectories at `dir`
+with octal permission string `opts.mode`. If `opts` is a non-object, it will be
+treated as the `opts.mode`.
+
+If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
+
+Returns the first directory that had to be created, if any.
+
+You can optionally pass in an alternate `fs` implementation by passing in
+`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and
+`opts.fs.statSync(path)`.
+
+# usage
+
+This package also ships with a `mkdirp` command.
+
+```
+usage: mkdirp [DIR1,DIR2..] {OPTIONS}
+
+  Create each supplied directory including any necessary parent directories that
+  don't yet exist.
+  
+  If the directory already exists, do nothing.
+
+OPTIONS are:
+
+  -m, --mode   If a directory needs to be created, set the mode as an octal
+               permission string.
+
+```
+
+# install
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install mkdirp
+```
+
+to get the library, or
+
+```
+npm install -g mkdirp
+```
+
+to get the command.
+
+# license
+
+MIT
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/chmod.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/chmod.js
new file mode 100755 (executable)
index 0000000..520dcb8
--- /dev/null
@@ -0,0 +1,38 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    ps.push(dir);
+}
+
+var file = ps.join('/');
+
+test('chmod-pre', function (t) {
+    var mode = 0744
+    mkdirp(file, mode, function (er) {
+        t.ifError(er, 'should not error');
+        fs.stat(file, function (er, stat) {
+            t.ifError(er, 'should exist');
+            t.ok(stat && stat.isDirectory(), 'should be directory');
+            t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
+            t.end();
+        });
+    });
+});
+
+test('chmod', function (t) {
+    var mode = 0755
+    mkdirp(file, mode, function (er) {
+        t.ifError(er, 'should not error');
+        fs.stat(file, function (er, stat) {
+            t.ifError(er, 'should exist');
+            t.ok(stat && stat.isDirectory(), 'should be directory');
+            t.end();
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/clobber.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/clobber.js
new file mode 100755 (executable)
index 0000000..0eb7099
--- /dev/null
@@ -0,0 +1,37 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    ps.push(dir);
+}
+
+var file = ps.join('/');
+
+// a file in the way
+var itw = ps.slice(0, 3).join('/');
+
+
+test('clobber-pre', function (t) {
+    console.error("about to write to "+itw)
+    fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
+
+    fs.stat(itw, function (er, stat) {
+        t.ifError(er)
+        t.ok(stat && stat.isFile(), 'should be file')
+        t.end()
+    })
+})
+
+test('clobber', function (t) {
+    t.plan(2);
+    mkdirp(file, 0755, function (err) {
+        t.ok(err);
+        t.equal(err.code, 'ENOTDIR');
+        t.end();
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/mkdirp.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/mkdirp.js
new file mode 100755 (executable)
index 0000000..3b624dd
--- /dev/null
@@ -0,0 +1,26 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('woo', function (t) {
+    t.plan(5);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/tmp/' + [x,y,z].join('/');
+    
+    mkdirp(file, 0755, function (err) {
+        t.ifError(err);
+        exists(file, function (ex) {
+            t.ok(ex, 'file created');
+            fs.stat(file, function (err, stat) {
+                t.ifError(err);
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+            })
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/opts_fs.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/opts_fs.js
new file mode 100755 (executable)
index 0000000..f1fbeca
--- /dev/null
@@ -0,0 +1,27 @@
+var mkdirp = require('../');
+var path = require('path');
+var test = require('tap').test;
+var mockfs = require('mock-fs');
+
+test('opts.fs', function (t) {
+    t.plan(5);
+    
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/beep/boop/' + [x,y,z].join('/');
+    var xfs = mockfs.fs();
+    
+    mkdirp(file, { fs: xfs, mode: 0755 }, function (err) {
+        t.ifError(err);
+        xfs.exists(file, function (ex) {
+            t.ok(ex, 'created file');
+            xfs.stat(file, function (err, stat) {
+                t.ifError(err);
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+            });
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/opts_fs_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/opts_fs_sync.js
new file mode 100755 (executable)
index 0000000..224b506
--- /dev/null
@@ -0,0 +1,25 @@
+var mkdirp = require('../');
+var path = require('path');
+var test = require('tap').test;
+var mockfs = require('mock-fs');
+
+test('opts.fs sync', function (t) {
+    t.plan(4);
+    
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/beep/boop/' + [x,y,z].join('/');
+    var xfs = mockfs.fs();
+    
+    mkdirp.sync(file, { fs: xfs, mode: 0755 });
+    xfs.exists(file, function (ex) {
+        t.ok(ex, 'created file');
+        xfs.stat(file, function (err, stat) {
+            t.ifError(err);
+            t.equal(stat.mode & 0777, 0755);
+            t.ok(stat.isDirectory(), 'target not a directory');
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/perm.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/perm.js
new file mode 100755 (executable)
index 0000000..2c97590
--- /dev/null
@@ -0,0 +1,30 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('async perm', function (t) {
+    t.plan(5);
+    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
+    
+    mkdirp(file, 0755, function (err) {
+        t.ifError(err);
+        exists(file, function (ex) {
+            t.ok(ex, 'file created');
+            fs.stat(file, function (err, stat) {
+                t.ifError(err);
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+            })
+        })
+    });
+});
+
+test('async root perm', function (t) {
+    mkdirp('/tmp', 0755, function (err) {
+        if (err) t.fail(err);
+        t.end();
+    });
+    t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/perm_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/perm_sync.js
new file mode 100755 (executable)
index 0000000..327e54b
--- /dev/null
@@ -0,0 +1,34 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('sync perm', function (t) {
+    t.plan(4);
+    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
+    
+    mkdirp.sync(file, 0755);
+    exists(file, function (ex) {
+        t.ok(ex, 'file created');
+        fs.stat(file, function (err, stat) {
+            t.ifError(err);
+            t.equal(stat.mode & 0777, 0755);
+            t.ok(stat.isDirectory(), 'target not a directory');
+        });
+    });
+});
+
+test('sync root perm', function (t) {
+    t.plan(3);
+    
+    var file = '/tmp';
+    mkdirp.sync(file, 0755);
+    exists(file, function (ex) {
+        t.ok(ex, 'file created');
+        fs.stat(file, function (err, stat) {
+            t.ifError(err);
+            t.ok(stat.isDirectory(), 'target not a directory');
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/race.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/race.js
new file mode 100755 (executable)
index 0000000..7c295f4
--- /dev/null
@@ -0,0 +1,40 @@
+var mkdirp = require('../').mkdirp;
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('race', function (t) {
+    t.plan(6);
+    var ps = [ '', 'tmp' ];
+    
+    for (var i = 0; i < 25; i++) {
+        var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+        ps.push(dir);
+    }
+    var file = ps.join('/');
+    
+    var res = 2;
+    mk(file, function () {
+        if (--res === 0) t.end();
+    });
+    
+    mk(file, function () {
+        if (--res === 0) t.end();
+    });
+    
+    function mk (file, cb) {
+        mkdirp(file, 0755, function (err) {
+            t.ifError(err);
+            exists(file, function (ex) {
+                t.ok(ex, 'file created');
+                fs.stat(file, function (err, stat) {
+                    t.ifError(err);
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    if (cb) cb();
+                });
+            })
+        });
+    }
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/rel.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/rel.js
new file mode 100755 (executable)
index 0000000..d1f175c
--- /dev/null
@@ -0,0 +1,30 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('rel', function (t) {
+    t.plan(5);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var cwd = process.cwd();
+    process.chdir('/tmp');
+    
+    var file = [x,y,z].join('/');
+    
+    mkdirp(file, 0755, function (err) {
+        t.ifError(err);
+        exists(file, function (ex) {
+            t.ok(ex, 'file created');
+            fs.stat(file, function (err, stat) {
+                t.ifError(err);
+                process.chdir(cwd);
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+            })
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/return.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/return.js
new file mode 100755 (executable)
index 0000000..bce68e5
--- /dev/null
@@ -0,0 +1,25 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('return value', function (t) {
+    t.plan(4);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    // should return the first dir created.
+    // By this point, it would be profoundly surprising if /tmp didn't
+    // already exist, since every other test makes things in there.
+    mkdirp(file, function (err, made) {
+        t.ifError(err);
+        t.equal(made, '/tmp/' + x);
+        mkdirp(file, function (err, made) {
+          t.ifError(err);
+          t.equal(made, null);
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/return_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/return_sync.js
new file mode 100755 (executable)
index 0000000..7c222d3
--- /dev/null
@@ -0,0 +1,24 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('return value', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    // should return the first dir created.
+    // By this point, it would be profoundly surprising if /tmp didn't
+    // already exist, since every other test makes things in there.
+    // Note that this will throw on failure, which will fail the test.
+    var made = mkdirp.sync(file);
+    t.equal(made, '/tmp/' + x);
+
+    // making the same file again should have no effect.
+    made = mkdirp.sync(file);
+    t.equal(made, null);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/root.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/root.js
new file mode 100755 (executable)
index 0000000..97ad7a2
--- /dev/null
@@ -0,0 +1,18 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('root', function (t) {
+    // '/' on unix, 'c:/' on windows.
+    var file = path.resolve('/');
+
+    mkdirp(file, 0755, function (err) {
+        if (err) throw err
+        fs.stat(file, function (er, stat) {
+            if (er) throw er
+            t.ok(stat.isDirectory(), 'target is a directory');
+            t.end();
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/sync.js
new file mode 100755 (executable)
index 0000000..88fa432
--- /dev/null
@@ -0,0 +1,30 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('sync', function (t) {
+    t.plan(4);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    try {
+        mkdirp.sync(file, 0755);
+    } catch (err) {
+        t.fail(err);
+        return t.end();
+    }
+
+    exists(file, function (ex) {
+        t.ok(ex, 'file created');
+        fs.stat(file, function (err, stat) {
+            t.ifError(err);
+            t.equal(stat.mode & 0777, 0755);
+            t.ok(stat.isDirectory(), 'target not a directory');
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/umask.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/umask.js
new file mode 100755 (executable)
index 0000000..82c393a
--- /dev/null
@@ -0,0 +1,26 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('implicit mode from umask', function (t) {
+    t.plan(5);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/tmp/' + [x,y,z].join('/');
+    
+    mkdirp(file, function (err) {
+        t.ifError(err);
+        exists(file, function (ex) {
+            t.ok(ex, 'file created');
+            fs.stat(file, function (err, stat) {
+                t.ifError(err);
+                t.equal(stat.mode & 0777, 0777 & (~process.umask()));
+                t.ok(stat.isDirectory(), 'target not a directory');
+            });
+        })
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/umask_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/mkdirp/test/umask_sync.js
new file mode 100755 (executable)
index 0000000..e537fbe
--- /dev/null
@@ -0,0 +1,30 @@
+var mkdirp = require('../');
+var path = require('path');
+var fs = require('fs');
+var exists = fs.exists || path.exists;
+var test = require('tap').test;
+
+test('umask sync modes', function (t) {
+    t.plan(4);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    try {
+        mkdirp.sync(file);
+    } catch (err) {
+        t.fail(err);
+        return t.end();
+    }
+
+    exists(file, function (ex) {
+        t.ok(ex, 'file created');
+        fs.stat(file, function (err, stat) {
+            t.ifError(err);
+            t.equal(stat.mode & 0777, (0777 & (~process.umask())));
+            t.ok(stat.isDirectory(), 'target not a directory');
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/README.md
new file mode 100755 (executable)
index 0000000..f04df5b
--- /dev/null
@@ -0,0 +1,80 @@
+ngrok [![Build Status](https://travis-ci.org/bubenshchykov/ngrok.png?branch=master)](https://travis-ci.org/bubenshchykov/ngrok)
+=====
+
+![alt ngrok.com](https://ngrok.com/static/img/overview.png)
+
+Ngrok exposes your localhost to the web. https://ngrok.com/
+
+usage
+===
+
+[![NPM](https://nodei.co/npm/ngrok.png?global=true&&downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/ngrok/)
+
+It will download the ngrok binary for your platform and put it into the bin folder. You can also install ngrok globally and use it directly from bash
+```shell
+$ npm install ngrok -g
+$ ngrok 8080
+```
+
+## basic
+
+```javascript
+var ngrok = require('ngrok');
+
+ngrok.connect(8080, function (err, url) {
+       // https://757c1652.ngrok.com -> 127.0.0.1:8080 
+});
+```
+## subdomain
+```javascript
+ngrok.connect({
+       authtoken: 'your-token',
+       subdomain: 'susanna',
+       port: 8080
+}, function (err, url) {
+       // https://susanna.ngrok.com -> 127.0.0.1:8080
+});
+```
+
+## http auth
+```javascript
+ngrok.connect({
+       authtoken: 'your-token',
+       httpauth: 'user:pwd'
+       port: 8080
+}, function (err, url) {
+       // https://757c1652.ngrok.com -> 127.0.0.1:8080 with http auth required
+});
+```
+
+## tcp
+```javascript
+ngrok.connect({
+       // http is the default protocol (and you should use it for the https
+       // support) but tcp will work for everything else.
+       authtoken: 'your-token',
+       proto: 'tcp',
+       port: 5672
+}, function (err, url) {
+       // tcp://abcd.ngrok.com:60234 -> 127.0.0.1:5762
+});
+```
+
+## disconnect
+The tunnel will be killed when node process is done. For manual shutdown use
+```javascript
+ngrok.disconnect();
+```
+## emitter
+
+Also you can use ngrok as an event emitter, it fires "connect", "disconnect" and "error" events
+```javascript
+ngrok.once('connect', function (url) {
+       console.log('got a tunnel url', url);
+});
+
+ngrok.connect(port);
+```
+
+## inspector
+When tunnel is established you can use the ngrok interface http://127.0.0.1:4040 to inspect the webhooks done via ngrok.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/bin/ngrok.cmd b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/bin/ngrok.cmd
new file mode 100755 (executable)
index 0000000..9f785c9
--- /dev/null
@@ -0,0 +1 @@
+ngrok.exe
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/index.js
new file mode 100755 (executable)
index 0000000..dae7b6e
--- /dev/null
@@ -0,0 +1,134 @@
+var os = require('os');
+var spawn = require('child_process').spawn;
+var EventEmitter = require('events').EventEmitter;
+
+var emitter = new EventEmitter();
+var tunnels = {};
+var exports = {};
+
+var TUNNEL_OK = /\[INFO\] \[client\] Tunnel established at ((tcp|https)..*.ngrok.com(:[0-9]+)?)/;
+var TUNNEL_BUSY = /\[EROR\] \[client\] Server failed to allocate tunnel: The tunnel ((tcp|http|https)..*.ngrok.com([0-9]+)?) (.*is already registered)/;
+
+function connect(opts, cb) {
+
+       cb || (cb = function(){});
+       if (typeof opts === 'number') {
+               opts = {log: false, port: opts};
+       }
+
+       var error = validateOpts(opts);
+       if (error) {
+               cb(error);
+               return emitter.emit('error', error);
+       }
+
+       var tunnelUrl;
+       var ngrok = spawn('./' + getNgrokBin(), getNgrokArgs(opts), {cwd: __dirname + '/bin'});
+
+       ngrok.stdout.on('data', function (data) {
+               var urlOk = data.toString().match(TUNNEL_OK);
+               if (urlOk && urlOk[1]) {
+                       tunnelUrl = urlOk[1];
+                       tunnels[tunnelUrl] = ngrok;
+                       log('ngrok: tunnel established at ' + tunnelUrl);
+                       cb(null, tunnelUrl);
+                       return emitter.emit('connect', tunnelUrl);
+               }
+               var urlBusy = data.toString().match(TUNNEL_BUSY);
+               if (urlBusy && urlBusy[1]) {
+                       ngrok.kill();
+                       var info = 'ngrok: The tunnel ' + urlBusy[1] + ' ' + urlBusy[4];
+                       var err = new Error(info);
+                       log(info);
+                       return cb(err);
+               }
+       });
+
+       ngrok.stderr.on('data', function (data) {
+               ngrok.kill();
+               var info = 'ngrok: process exited due to error\n' + data.toString().substring(0, 10000);
+               var err = new Error(info);
+               log(info);
+               cb(err);
+               return emitter.emit('error', err);
+       });
+
+       ngrok.on('close', function () {
+               var tunnelInfo = tunnelUrl ? tunnelUrl + ' ' : '';
+               log('ngrok: ' + tunnelInfo + 'disconnected');
+               return emitter.emit('close');
+       });
+
+       function log(message) {
+               opts.log && console.log(message);
+       }
+}
+
+function validateOpts (opts) {
+       if (!opts.port) {
+               return new Error('port not specified');
+       }
+       if (opts.start || opts.hostname) {
+               return new Error('starting multiple ngrok clients or using hostname option is not supported yet');
+       }
+       if ((opts.subdomain || opts.httpauth || opts.proto) && !opts.authtoken) {
+               return new Error('authtoken should be specified to use signup features: subdomain|httpauth|proto');
+       }
+       return false;
+}
+
+function getNgrokBin () {
+       var suffix = os.platform() === 'win32' ? '.exe' : '';
+       return 'ngrok' + suffix;
+}
+
+function getNgrokArgs(opts) {
+       var args = ['-log=stdout'];
+       opts.authtoken && args.push('-authtoken', opts.authtoken);
+       opts.subdomain && args.push('-subdomain', opts.subdomain);
+       opts.httpauth && args.push('-httpauth', opts.httpauth);
+       opts.proto && args.push('-proto', opts.proto);
+       args.push(opts.port);
+       return args;
+}
+
+function disconnect(tunnelUrl, callback) {
+       if (typeof tunnelUrl === 'function') {
+               callback = tunnelUrl;
+               tunnelUrl = null;
+       }
+       if (tunnelUrl) {
+               return kill(tunnelUrl, callback);
+       }
+       var pending = 1;
+       Object.keys(tunnels).forEach(function(url) {
+               pending++;
+               kill(url, next);
+       });
+       process.nextTick(next);
+       
+       function next() {
+               if (--pending === 0) callback && callback();
+       }
+}
+
+function kill(tunnelUrl, callback) {
+       var ngrok = tunnels[tunnelUrl];
+       delete tunnels[tunnelUrl];
+       if (!ngrok) {
+               return callback && process.nextTick(callback);
+       }
+       ngrok.once('exit', function() {
+               emitter.emit('disconnect');  
+               return callback && callback();
+       });
+       return ngrok.kill();
+}
+
+for(var key in emitter ) {
+       exports[key] = emitter[key];
+}
+exports.connect = connect;
+exports.disconnect = disconnect;
+
+module.exports = exports;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/Gruntfile.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/Gruntfile.js
new file mode 100755 (executable)
index 0000000..56e7eea
--- /dev/null
@@ -0,0 +1,62 @@
+'use strict';
+module.exports = function (grunt) {
+    grunt.initConfig({
+        jshint: {
+            options: {
+                jshintrc: '.jshintrc'
+            },
+            files: [
+                'Gruntfile.js',
+                'bin/*',
+                'lib/**/*.js',
+                'test/*.js'
+            ]
+        },
+        simplemocha: {
+            options: {
+                reporter: 'spec',
+                timeout: '5000'
+            },
+            full: {
+                src: [
+                    'test/*.js'
+                ]
+            },
+            short: {
+                options: {
+                    reporter: 'dot'
+                },
+                src: [
+                    '<%= simplemocha.full.src %>'
+                ]
+            }
+        },
+        exec: {
+            coverage: {
+                command: 'node node_modules/istanbul/lib/cli.js cover --dir ./coverage node_modules/mocha/bin/_mocha -- -R dot test/*.js'
+            },
+            'test-files': {
+                command: 'node download-test-assets.js'
+            }
+        },
+        watch: {
+            files: [
+                '<%= jshint.files %>'
+            ],
+            tasks: [
+                'jshint',
+                'simplemocha:short'
+            ]
+        }
+    });
+
+    grunt.loadNpmTasks('grunt-contrib-jshint');
+    grunt.loadNpmTasks('grunt-contrib-watch');
+    grunt.loadNpmTasks('grunt-simple-mocha');
+    grunt.loadNpmTasks('grunt-exec');
+
+    grunt.registerTask('test', ['jshint', 'simplemocha:full']);
+    grunt.registerTask('coverage', 'exec:coverage');
+    grunt.registerTask('test-files', 'exec:test-files');
+    grunt.registerTask('default', 'test');
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/README.md
new file mode 100755 (executable)
index 0000000..e447fd5
--- /dev/null
@@ -0,0 +1,73 @@
+# decompress-zip [![Build Status](https://travis-ci.org/bower/decompress-zip.svg?branch=master)](https://travis-ci.org/bower/decompress-zip)
+
+> Extract files from a ZIP archive
+
+
+## Usage
+
+### .extract(options)
+
+Extracts the contents of the ZIP archive `file`.
+
+Returns an EventEmitter with two possible events - `error` on an error, and `extract` when the extraction has completed. The value passed to the `extract` event is a basic log of each file and how it was compressed.
+
+**Options**
+- **path** *String* - Path to extract into (default `.`)
+- **follow** *Boolean* - If true, rather than create stored symlinks as symlinks make a shallow copy of the target instead (default `false`)
+- **filter** *Function* - A function that will be called once for each file in the archive. It takes one argument which is an object containing details of the file. Return true for any file that you want to extract, and false otherwise. (default `null`)
+- **strip** *Number* - Remove leading folders in the path structure. Equivalent to `--strip-components` for tar.
+
+```js
+var DecompressZip = require('decompress-zip');
+var unzipper = new DecompressZip(filename)
+
+unzipper.on('error', function (err) {
+    console.log('Caught an error');
+});
+
+unzipper.on('extract', function (log) {
+    console.log('Finished extracting');
+});
+
+unzipper.on('progress', function (fileIndex, fileCount) {
+    console.log('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount);
+});
+
+unzipper.extract({
+    path: 'some/path',
+    filter: function (file) {
+        return file.type !== "SymbolicLink";
+    }
+});
+```
+
+If `path` does not exist, decompress-zip will attempt to create it first.
+
+### .list()
+
+Much like extract, except:
+- the success event is `list`
+- the data for the event is an array of paths
+- no files are actually extracted
+- there are no options
+
+```js
+var DecompressZip = require('decompress-zip');
+var unzipper = new DecompressZip(filename)
+
+unzipper.on('error', function (err) {
+    console.log('Caught an error');
+});
+
+unzipper.on('list', function (files) {
+    console.log('The archive contains:');
+    console.log(files);
+});
+
+unzipper.list();
+```
+
+
+## License
+
+MIT © Bower team
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/bin/decompress-zip b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/bin/decompress-zip
new file mode 100755 (executable)
index 0000000..e64348b
--- /dev/null
@@ -0,0 +1,83 @@
+#!/usr/bin/env node
+'use strict';
+var nopt = require('nopt');
+var path = require('path');
+var version = require('../package.json').version;
+
+var knownOptions = {
+    'list': Boolean,
+    'extract': Boolean,
+    'path': path
+};
+
+var shortcuts = {
+    'x': ['--extract'],
+    'l': ['--list'],
+    'p': ['--path'],
+    'v': ['--version']
+};
+
+var parsedOptions = nopt(knownOptions, shortcuts);
+
+var pad = function (string, length) {
+    string = String(string);
+
+    if (length <= string.length) {
+        return string;
+    }
+
+    return string + (new Array(length - string.length).join(' '));
+};
+
+var octal = function (number, digits) {
+    var result = '';
+
+    for (var i = 0; i < digits; i++) {
+        result = (number & 0x07) + result;
+        number >>= 3;
+    }
+
+    return result;
+};
+
+var DecompressZip = require('../lib/decompress-zip');
+var zip = new DecompressZip(parsedOptions.argv.remain[0]);
+
+zip.on('file', function (file) {
+    console.log([octal(file.mode, 4), pad(file.type, 13), pad(file.compressedSize, 10), pad(file.uncompressedSize, 10), file.path].join(' '));
+});
+
+zip.on('list', function (fileList) {
+    //  console.log(fileList);
+});
+
+zip.on('extract', function (result) {
+    console.log(result);
+});
+
+zip.on('error', function (error) {
+    console.error(error.message, error.stack);
+});
+
+if (parsedOptions.version) {
+    console.log('version ' + version);
+} else if (parsedOptions.list) {
+    console.log('Mode Type         Zip size  Full size Path');
+    console.log('---- ----         --------  --------- ----');
+    zip.list();
+} else if (parsedOptions.extract) {
+    var options = {};
+
+    if (parsedOptions.path) {
+        options.path = parsedOptions.path;
+    }
+
+    zip.extract(options);
+} else {
+    console.log('Usage: decompress-zip <options> <file>');
+    console.log('    -x, --extract      extract the given file');
+    console.log('    -l, --list         list the contents of the given file');
+    console.log('    -v, --version      extract the given file');
+    console.log('    -p, --path <path>  extract the file into <path>');
+    console.log('    -h, --help         show this message');
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/download-test-assets.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/download-test-assets.js
new file mode 100755 (executable)
index 0000000..e4db1a7
--- /dev/null
@@ -0,0 +1,45 @@
+'use strict';
+var fs = require('fs');
+var request = require('request');
+var tmp = require('tmp');
+var exec = require('child_process').exec;
+var path = require('path');
+
+var url = 'https://drive.google.com/uc?id=0Bxxp2pVhWG1DTFNWQ1hsSkZKZmM&export=download';
+
+var errorHandler = function (err) {
+    throw err;
+};
+
+var extract = function (filename) {
+    exec('tar -xvzf ' + filename, {
+        cwd: path.join(__dirname, 'test'),
+        maxBuffer: 1024 * 1024
+    }, function (err, stdout, stderr) {
+        if (err) {
+            throw err;
+        }
+
+        console.log('Done');
+    });
+};
+
+tmp.file({
+    prefix: 'assets',
+    postfix: '.tgz'
+}, function (err, filename, fd) {
+    console.log('Downloading ' + url + ' to ' + filename);
+
+    var read = request(url);
+    var write = fs.createWriteStream(filename);
+
+    read.on('error', errorHandler);
+    write.on('error', errorHandler);
+
+    // For node 0.8 we can't just use the 'finish' event of the pipe
+    read.on('end', function () {
+        write.end(extract.bind(null, filename));
+    });
+
+    read.pipe(write, {end: false});
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/decompress-zip.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/decompress-zip.js
new file mode 100755 (executable)
index 0000000..db0f8d1
--- /dev/null
@@ -0,0 +1,312 @@
+'use strict';
+
+// The zip file spec is at http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+// TODO: There is fair chunk of the spec that I have ignored. Need to add
+// assertions everywhere to make sure that we are not dealing with a ZIP type
+// that I haven't designed for. Things like spanning archives, non-DEFLATE
+// compression, encryption, etc.
+var fs = require('graceful-fs');
+var Q = require('q');
+var path = require('path');
+var util = require('util');
+var events = require('events');
+var structures = require('./structures');
+var signatures = require('./signatures');
+var extractors = require('./extractors');
+var FileDetails = require('./file-details');
+
+var fstat = Q.denodeify(fs.fstat);
+var read = Q.denodeify(fs.read);
+var fopen = Q.denodeify(fs.open);
+
+function DecompressZip(filename) {
+    events.EventEmitter.call(this);
+
+    this.filename = filename;
+    this.stats = null;
+    this.fd = null;
+    this.chunkSize = 1024 * 1024; // Buffer up to 1Mb at a time
+    this.dirCache = {};
+
+    // When we need a resource, we should check if there is a promise for it
+    // already and use that. If the promise is already fulfilled we don't do the
+    // async work again and we get to queue up dependant tasks.
+    this._p = {}; // _p instead of _promises because it is a lot easier to read
+}
+
+util.inherits(DecompressZip, events.EventEmitter);
+
+DecompressZip.prototype.openFile = function () {
+    return fopen(this.filename, 'r');
+};
+
+DecompressZip.prototype.closeFile = function () {
+    if (this.fd) {
+        fs.closeSync(this.fd);
+        this.fd = null;
+    }
+};
+
+DecompressZip.prototype.statFile = function (fd) {
+    this.fd = fd;
+    return fstat(fd);
+};
+
+DecompressZip.prototype.list = function () {
+    var self = this;
+
+    this.getFiles()
+    .then(function (files) {
+        var result = [];
+
+        files.forEach(function (file) {
+            result.push(file.path);
+        });
+
+        self.emit('list', result);
+    })
+    .fail(function (error) {
+        self.emit('error', error);
+    })
+    .fin(self.closeFile.bind(self));
+
+    return this;
+};
+
+DecompressZip.prototype.extract = function (options) {
+    var self = this;
+
+    options = options || {};
+    options.path = options.path || '.';
+    options.filter = options.filter || null;
+    options.follow = !!options.follow;
+    options.strip = +options.strip || 0;
+
+    this.getFiles()
+    .then(function (files) {
+        var copies = [];
+
+        if (options.filter) {
+            files = files.filter(options.filter);
+        }
+
+        if (options.follow) {
+            copies = files.filter(function (file) {
+                return file.type === 'SymbolicLink';
+            });
+            files = files.filter(function (file) {
+                return file.type !== 'SymbolicLink';
+            });
+        }
+
+        if (options.strip) {
+            files = files.map(function (file) {
+                if (file.type !== 'Directory') {
+                    // we don't use `path.sep` as we're using `/` in Windows too
+                    var dir = file.parent.split('/');
+                    var filename = file.filename;
+
+                    if (options.strip > dir.length) {
+                        throw new Error('You cannot strip more levels than there are directories');
+                    } else {
+                        dir = dir.slice(options.strip);
+                    }
+
+                    file.path = path.join(dir.join(path.sep), filename);
+                    return file;
+                }
+            });
+        }
+
+        return self.extractFiles(files, options)
+        .then(self.extractFiles.bind(self, copies, options));
+    })
+    .then(function (results) {
+        self.emit('extract', results);
+    })
+    .fail(function (error) {
+        self.emit('error', error);
+    })
+    .fin(self.closeFile.bind(self));
+
+    return this;
+};
+
+// Utility methods
+DecompressZip.prototype.getSearchBuffer = function (stats) {
+    var size = Math.min(stats.size, this.chunkSize);
+    this.stats = stats;
+    return this.getBuffer(stats.size - size, stats.size);
+};
+
+DecompressZip.prototype.getBuffer = function (start, end) {
+    var size = end - start;
+    return read(this.fd, new Buffer(size), 0, size, start)
+    .then(function (result) {
+        return result[1];
+    });
+};
+
+DecompressZip.prototype.findEndOfDirectory = function (buffer) {
+    var index = buffer.length - 3;
+    var chunk = '';
+
+    // Apparently the ZIP spec is not very good and it is impossible to
+    // guarantee that you have read a zip file correctly, or to determine
+    // the location of the CD without hunting.
+    // Search backwards through the buffer, as it is very likely to be near the
+    // end of the file.
+    while (index > Math.max(buffer.length - this.chunkSize, 0) && chunk !== signatures.END_OF_CENTRAL_DIRECTORY) {
+        index--;
+        chunk = buffer.readUInt32LE(index);
+    }
+
+    if (chunk !== signatures.END_OF_CENTRAL_DIRECTORY) {
+        throw new Error('Could not find the End of Central Directory Record');
+    }
+
+    return buffer.slice(index);
+};
+
+// Directory here means the ZIP Central Directory, not a folder
+DecompressZip.prototype.readDirectory = function (recordBuffer) {
+    var record = structures.readEndRecord(recordBuffer);
+
+    return this.getBuffer(record.directoryOffset, record.directoryOffset + record.directorySize)
+    .then(structures.readDirectory.bind(null));
+};
+
+DecompressZip.prototype.getFiles = function () {
+    if (!this._p.getFiles) {
+        this._p.getFiles = this.openFile()
+        .then(this.statFile.bind(this))
+        .then(this.getSearchBuffer.bind(this))
+        .then(this.findEndOfDirectory.bind(this))
+        .then(this.readDirectory.bind(this))
+        .then(this.readFileEntries.bind(this));
+    }
+
+    return this._p.getFiles;
+};
+
+DecompressZip.prototype.readFileEntries = function (directory) {
+    var promises = [];
+    var files = [];
+    var self = this;
+
+    directory.forEach(function (directoryEntry, index) {
+        var start = directoryEntry.relativeOffsetOfLocalHeader;
+        var end = Math.min(self.stats.size, start + structures.maxFileEntrySize);
+        var fileDetails = new FileDetails(directoryEntry);
+
+        var promise = self.getBuffer(start, end)
+        .then(structures.readFileEntry.bind(null))
+        .then(function (fileEntry) {
+            var maxSize;
+
+            if (fileDetails.compressedSize > 0) {
+                maxSize = fileDetails.compressedSize;
+            } else {
+                maxSize = self.stats.size;
+
+                if (index < directory.length - 1) {
+                    maxSize = directory[index + 1].relativeOffsetOfLocalHeader;
+                }
+
+                maxSize -= start + fileEntry.entryLength;
+            }
+
+            fileDetails._offset = start + fileEntry.entryLength;
+            fileDetails._maxSize = maxSize;
+
+            self.emit('file', fileDetails);
+            files[index] = fileDetails;
+        });
+
+        promises.push(promise);
+    });
+
+    return Q.all(promises)
+    .then(function () {
+        return files;
+    });
+};
+
+DecompressZip.prototype.extractFiles = function (files, options, results) {
+    var promises = [];
+    var self = this;
+
+    results = results || [];
+    var fileIndex = 0;
+    files.forEach(function (file) {
+        var promise = self.extractFile(file, options)
+        .then(function (result) {
+            self.emit('progress', fileIndex++, files.length);
+            results.push(result);
+        });
+
+        promises.push(promise);
+    });
+
+    return Q.all(promises)
+    .then(function () {
+        return results;
+    });
+};
+
+DecompressZip.prototype.extractFile = function (file, options) {
+    var destination = path.join(options.path, file.path);
+
+    // Possible compression methods:
+    //    0 - The file is stored (no compression)
+    //    1 - The file is Shrunk
+    //    2 - The file is Reduced with compression factor 1
+    //    3 - The file is Reduced with compression factor 2
+    //    4 - The file is Reduced with compression factor 3
+    //    5 - The file is Reduced with compression factor 4
+    //    6 - The file is Imploded
+    //    7 - Reserved for Tokenizing compression algorithm
+    //    8 - The file is Deflated
+    //    9 - Enhanced Deflating using Deflate64(tm)
+    //   10 - PKWARE Data Compression Library Imploding (old IBM TERSE)
+    //   11 - Reserved by PKWARE
+    //   12 - File is compressed using BZIP2 algorithm
+    //   13 - Reserved by PKWARE
+    //   14 - LZMA (EFS)
+    //   15 - Reserved by PKWARE
+    //   16 - Reserved by PKWARE
+    //   17 - Reserved by PKWARE
+    //   18 - File is compressed using IBM TERSE (new)
+    //   19 - IBM LZ77 z Architecture (PFS)
+    //   97 - WavPack compressed data
+    //   98 - PPMd version I, Rev 1
+
+    if (file.type === 'Directory') {
+        return extractors.folder(file, destination, this);
+    }
+
+    if (file.type === 'File') {
+        switch (file.compressionMethod) {
+        case 0:
+            return extractors.store(file, destination, this);
+
+        case 8:
+            return extractors.deflate(file, destination, this);
+
+        default:
+            throw new Error('Unsupported compression type');
+        }
+    }
+
+    if (file.type === 'SymbolicLink') {
+        if (options.follow) {
+            return extractors.copy(file, destination, this, options.path);
+        } else {
+            return extractors.symlink(file, destination, this, options.path);
+        }
+    }
+
+    throw new Error('Unsupported file type "' + file.type + '"');
+};
+
+module.exports = DecompressZip;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/extractors.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/extractors.js
new file mode 100755 (executable)
index 0000000..32b0a5b
--- /dev/null
@@ -0,0 +1,179 @@
+var stream = require('stream');
+if (!stream.Readable) {
+    var stream = require('readable-stream');
+}
+var fs = require('graceful-fs');
+var Q = require('q');
+var path = require('path');
+var zlib = require('zlib');
+var touch = Q.denodeify(require('touch'));
+var mkpath = Q.denodeify(require('mkpath'));
+var writeFile = Q.denodeify(fs.writeFile);
+var inflateRaw = Q.denodeify(zlib.inflateRaw);
+var symlink = Q.denodeify(fs.symlink);
+var stat = Q.denodeify(fs.stat);
+
+// Use a cache of promises for building the directory tree. This allows us to
+// correctly queue up file extractions for after their path has been created,
+// avoid trying to create the path twice and still be async.
+var mkdir = function (dir, cache) {
+    dir = path.normalize(path.resolve(process.cwd(), dir) + path.sep);
+
+    if (!cache[dir]) {
+        var parent;
+
+        if (fs.existsSync(dir)) {
+            parent = new Q();
+        } else {
+            parent = mkdir(path.dirname(dir), cache);
+        }
+
+        cache[dir] = parent.then(function () {
+            return mkpath(dir);
+        });
+    }
+
+    return cache[dir];
+};
+
+// Utility methods for writing output files
+var extractors = {
+    folder: function (folder, destination, zip) {
+        return mkdir(destination, zip.dirCache)
+        .then(function () {
+            return {folder: folder.path};
+        });
+    },
+    store: function (file, destination, zip) {
+        var writer;
+
+        if (file.uncompressedSize === 0) {
+            writer = touch.bind(null, destination);
+        } else if (file.uncompressedSize <= zip.chunkSize) {
+            writer = function () {
+                return zip.getBuffer(file._offset, file._offset + file.uncompressedSize)
+                .then(writeFile.bind(null, destination));
+            };
+        } else {
+            var input = new stream.Readable();
+            input.wrap(fs.createReadStream(zip.filename, {start: file._offset, end: file._offset + file.uncompressedSize - 1}));
+            writer = pipePromise.bind(null, input, destination);
+        }
+
+        return mkdir(path.dirname(destination), zip.dirCache)
+        .then(writer)
+        .then(function () {
+            return {stored: file.path};
+        });
+    },
+    deflate: function (file, destination, zip) {
+        // For Deflate you don't actually need to specify the end offset - and
+        // in fact many ZIP files don't include compressed file sizes for
+        // Deflated files so we don't even know what the end offset is.
+
+        return mkdir(path.dirname(destination), zip.dirCache)
+        .then(function () {
+            if (file._maxSize <= zip.chunkSize) {
+                return zip.getBuffer(file._offset, file._offset + file._maxSize)
+                .then(inflateRaw)
+                .then(function (buffer) {
+                    return writeFile(destination, buffer);
+                });
+            } else {
+                // For node 0.8 we need to create the Zlib stream and attach
+                // handlers in the same tick of the event loop, which is why we do
+                // the creation in here
+                var input = new stream.Readable();
+                input.wrap(fs.createReadStream(zip.filename, {start: file._offset}));
+                var inflater = input.pipe(zlib.createInflateRaw({highWaterMark: 32 * 1024}));
+
+                return pipePromise(inflater, destination);
+            }
+        })
+        .then(function () {
+            return {deflated: file.path};
+        });
+    },
+    symlink: function (file, destination, zip, basePath) {
+        var parent = path.dirname(destination);
+        return mkdir(parent, zip.dirCache)
+        .then(function () {
+            return getLinkLocation(file, destination, zip, basePath);
+        })
+        .then(function (linkTo) {
+            return symlink(path.resolve(parent, linkTo), destination)
+            .then(function () {
+                return {symlink: file.path, linkTo: linkTo};
+            });
+        });
+    },
+    // Make a shallow copy of the file/directory this symlink points to instead
+    // of actually creating a link
+    copy: function (file, destination, zip, basePath) {
+        var type;
+        var parent = path.dirname(destination);
+
+        return mkdir(parent, zip.dirCache)
+        .then(function () {
+            return getLinkLocation(file, destination, zip, basePath);
+        })
+        .then(function (linkTo) {
+            return stat(path.resolve(parent, linkTo))
+            .then(function (stats) {
+                if (stats.isFile()) {
+                    type = 'File';
+                    var input = new stream.Readable();
+                    input.wrap(fs.createReadStream(path.resolve(parent, linkTo)));
+                    return pipePromise(input, destination);
+                } else if (stats.isDirectory()) {
+                    type = 'Directory';
+                    return mkdir(destination, zip.dirCache);
+                } else {
+                    throw new Error('Could not follow symlink to unknown file type');
+                }
+            })
+            .then(function () {
+                return {copy: file.path, original: linkTo, type: type};
+            });
+        });
+    }
+};
+
+var getLinkLocation = function (file, destination, zip, basePath) {
+    var parent = path.dirname(destination);
+    return zip.getBuffer(file._offset, file._offset + file.uncompressedSize)
+    .then(function (buffer) {
+        var linkTo = buffer.toString();
+        var fullLink = path.resolve(parent, linkTo);
+
+        if (path.relative(basePath, fullLink).slice(0, 2) === '..') {
+            throw new Error('Symlink links outside archive');
+        }
+
+        return linkTo;
+    });
+};
+
+var pipePromise = function (input, destination) {
+    var deferred = Q.defer();
+    var output = fs.createWriteStream(destination);
+    var errorHandler = function (error) {
+        deferred.reject(error);
+    };
+
+    input.on('error', errorHandler);
+    output.on('error', errorHandler);
+
+    // For node 0.8 we can't just use the 'finish' event of the pipe
+    input.on('end', function () {
+        output.end(function () {
+            deferred.resolve();
+        });
+    });
+
+    input.pipe(output, {end: false});
+
+    return deferred.promise;
+};
+
+module.exports = extractors;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/file-details.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/file-details.js
new file mode 100755 (executable)
index 0000000..1f3ca68
--- /dev/null
@@ -0,0 +1,37 @@
+// Objects with this prototype are used as the public representation of a file
+var path = require('path');
+
+var FileDetails = function (directoryEntry) {
+    // TODO: Add 'extra field' support
+
+    this._offset = 0;
+    this._maxSize = 0;
+
+    this.parent = path.dirname(directoryEntry.fileName);
+    this.filename = path.basename(directoryEntry.fileName);
+    this.path = path.normalize(directoryEntry.fileName);
+
+    this.type = directoryEntry.fileAttributes.type;
+    this.mode = directoryEntry.fileAttributes.mode;
+    this.compressionMethod = directoryEntry.compressionMethod;
+    this.modified = directoryEntry.modifiedTime;
+    this.crc32 = directoryEntry.crc32;
+    this.compressedSize = directoryEntry.compressedSize;
+    this.uncompressedSize = directoryEntry.uncompressedSize;
+    this.comment = directoryEntry.fileComment;
+
+    this.flags = {
+        encrypted: directoryEntry.generalPurposeFlags.encrypted,
+        compressionFlag1: directoryEntry.generalPurposeFlags.compressionFlag1,
+        compressionFlag2: directoryEntry.generalPurposeFlags.compressionFlag2,
+        useDataDescriptor: directoryEntry.generalPurposeFlags.useDataDescriptor,
+        enhancedDeflating: directoryEntry.generalPurposeFlags.enhancedDeflating,
+        compressedPatched: directoryEntry.generalPurposeFlags.compressedPatched,
+        strongEncryption: directoryEntry.generalPurposeFlags.strongEncryption,
+        utf8: directoryEntry.generalPurposeFlags.utf8,
+        encryptedCD: directoryEntry.generalPurposeFlags.encryptedCD
+    };
+
+};
+
+module.exports = FileDetails;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/signatures.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/signatures.js
new file mode 100755 (executable)
index 0000000..1d29941
--- /dev/null
@@ -0,0 +1,10 @@
+module.exports = {
+    LOCAL_FILE_HEADER: 0x04034b50,
+    DATA_DESCRIPTOR_RECORD: 0x08074b50,
+    ARCHIVE_EXTRA_DATA: 0x08064b50,
+    CENTRAL_FILE_HEADER: 0x02014b50,
+    HEADER: 0x05054b50,
+    ZIP64_END_OF_CENTRAL_DIRECTORY: 0x06064b50,
+    ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR: 0x07064b50,
+    END_OF_CENTRAL_DIRECTORY: 0x06054b50
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/structures.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/lib/structures.js
new file mode 100755 (executable)
index 0000000..3f8acaf
--- /dev/null
@@ -0,0 +1,228 @@
+'use strict';
+var binary = require('binary');
+
+var convertDateTime = function (dosDate, dosTime) {
+    var year = ((dosDate >> 9) & 0x7F) + 1980;
+    var month = (dosDate >> 5) & 0x0F;
+    var day = dosDate & 0x1F;
+
+    var hour = (dosTime >> 11);
+    var minute = (dosTime >> 5) & 0x3F;
+    var second = (dosTime & 0x1F) * 2;
+
+    var result = new Date(year, month - 1, day, hour, minute, second, 0);
+
+    return result;
+};
+
+var convertGeneralPurposeFlags = function (value) {
+    var bits = [];
+
+    for (var i = 0; i < 16; i++) {
+        bits[i] = (value >> i) & 1;
+    }
+
+    return {
+        encrypted: !!bits[0],
+        compressionFlag1: !!bits[1],
+        compressionFlag2: !!bits[2],
+        useDataDescriptor: !!bits[3],
+        enhancedDeflating: !!bits[4],
+        compressedPatched: !!bits[5],
+        strongEncryption: !!bits[6],
+        utf8: !!bits[11],
+        encryptedCD: !!bits[13]
+    };
+};
+
+var parseExternalFileAttributes = function (externalAttributes, platform) {
+    var types = {
+        // In theory, any of these could be set. Realistically, though, it will
+        // be regular, directory or symlink
+        1: 'NamedPipe',
+        2: 'Character',
+        4: 'Directory',
+        6: 'Block',
+        8: 'File',
+        10: 'SymbolicLink',
+        12: 'Socket'
+    };
+
+    switch (platform) {
+
+    case 3: // Unix
+        return {
+            platform: 'Unix',
+            type: types[(externalAttributes >> 60) & 0x0F],
+            mode: (externalAttributes >> 48) & 0xFFF
+        };
+
+    // case 0: // MSDOS
+    default:
+        if (platform !== 0) {
+            console.warn('Possibly unsupported ZIP platform type, ' + platform);
+        }
+
+        var attribs = {
+            A: (externalAttributes >> 5) & 0x01,
+            D: (externalAttributes >> 4) & 0x01,
+            V: (externalAttributes >> 3) & 0x01,
+            S: (externalAttributes >> 2) & 0x01,
+            H: (externalAttributes >> 1) & 0x01,
+            R: externalAttributes & 0x01
+        };
+
+        // With no better guidance we'll make the default permissions ugo+r
+        var mode = parseInt('0444', 8);
+
+        if (attribs.D) {
+            mode |= parseInt('0111', 8); // Set the execute bit
+        }
+
+        if (!attribs.R) {
+            mode |= parseInt('0222', 8); // Set the write bit
+        }
+
+        mode &= ~process.umask();
+
+        return {
+            platform: 'DOS',
+            type: attribs.D ? 'Directory' : 'File',
+            mode: mode
+        };
+    }
+};
+
+var readEndRecord = function (buffer) {
+    var data = binary.parse(buffer)
+    .word32lu('signature')
+    .word16lu('diskNumber')
+    .word16lu('directoryStartDisk')
+    .word16lu('directoryEntryCountDisk')
+    .word16lu('directoryEntryCount')
+    .word32lu('directorySize')
+    .word32lu('directoryOffset')
+    .word16lu('commentLength')
+    .buffer('comment', 'commentLength')
+    .vars;
+
+    data.comment = data.comment.toString();
+
+    return data;
+};
+
+var directorySort = function (a, b) {
+    return a.relativeOffsetOfLocalHeader - b.relativeOffsetOfLocalHeader;
+};
+
+var readDirectory = function (buffer) {
+    var directory = [];
+    var current;
+    var index = 0;
+
+    while (index < buffer.length) {
+        current = binary.parse(buffer.slice(index, index + 46))
+        .word32lu('signature')
+        .word8lu('creatorSpecVersion')
+        .word8lu('creatorPlatform')
+        .word8lu('requiredSpecVersion')
+        .word8lu('requiredPlatform')
+        .word16lu('generalPurposeBitFlag')
+        .word16lu('compressionMethod')
+        .word16lu('lastModFileTime')
+        .word16lu('lastModFileDate')
+        .word32lu('crc32')
+        .word32lu('compressedSize')
+        .word32lu('uncompressedSize')
+        .word16lu('fileNameLength')
+        .word16lu('extraFieldLength')
+        .word16lu('fileCommentLength')
+        .word16lu('diskNumberStart')
+        .word16lu('internalFileAttributes')
+        .word32lu('externalFileAttributes')
+        .word32lu('relativeOffsetOfLocalHeader')
+        .vars;
+
+        index += 46;
+
+        current.generalPurposeFlags = convertGeneralPurposeFlags(current.generalPurposeBitFlag);
+        current.fileAttributes = parseExternalFileAttributes(current.externalFileAttributes, current.creatorPlatform);
+
+        current.modifiedTime = convertDateTime(current.lastModFileDate, current.lastModFileTime);
+        current.fileName = current.extraField = current.fileComment = '';
+        current.headerLength = 46 + current.fileNameLength + current.extraFieldLength + current.fileCommentLength;
+
+        if (current.fileNameLength > 0) {
+            current.fileName = buffer.slice(index, index + current.fileNameLength).toString();
+            index += current.fileNameLength;
+        }
+
+        if (current.extraFieldLength > 0) {
+            current.extraField = buffer.slice(index, index + current.extraFieldLength).toString();
+            index += current.extraFieldLength;
+        }
+
+        if (current.fileCommentLength > 0) {
+            current.fileComment = buffer.slice(index, index + current.fileCommentLength).toString();
+            index += current.fileCommentLength;
+        }
+
+        if (current.fileAttributes.type !== 'Directory' && current.fileName.substr(-1) === '/') {
+            // TODO: check that this is a reasonable check
+            current.fileAttributes.type = 'Directory';
+        }
+
+        directory.push(current);
+    }
+
+    directory.sort(directorySort);
+
+    return directory;
+};
+
+var readFileEntry = function (buffer) {
+    var index = 0;
+
+    var fileEntry = binary.parse(buffer.slice(index, 30))
+    .word32lu('signature')
+    .word16lu('versionNeededToExtract')
+    .word16lu('generalPurposeBitFlag')
+    .word16lu('compressionMethod')
+    .word16lu('lastModFileTime')
+    .word16lu('lastModFileDate')
+    .word32lu('crc32')
+    .word32lu('compressedSize')
+    .word32lu('uncompressedSize')
+    .word16lu('fileNameLength')
+    .word16lu('extraFieldLength')
+    .vars;
+
+    index += 30;
+
+    fileEntry.fileName = fileEntry.extraField = '';
+
+    fileEntry.entryLength = 30 + fileEntry.fileNameLength + fileEntry.extraFieldLength;
+
+    if (fileEntry.entryLength > structures.maxFileEntrySize) {
+        throw new Error('File entry unexpectedly large: ' + fileEntry.entryLength + ' (max: ' + structures.maxFileEntrySize + ')');
+    }
+
+    if (fileEntry.fileNameLength > 0) {
+        fileEntry.fileName = buffer.slice(index, index + fileEntry.fileNameLength).toString();
+        index += fileEntry.fileNameLength;
+    }
+
+    if (fileEntry.extraFieldLength > 0) {
+        fileEntry.extraField = buffer.slice(index, index + fileEntry.extraFieldLength).toString();
+        index += fileEntry.extraFieldLength;
+    }
+
+    return fileEntry;
+};
+
+var structures = module.exports = {
+    readEndRecord: readEndRecord,
+    readDirectory: readDirectory,
+    readFileEntry: readFileEntry,
+    maxFileEntrySize: 4096
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/README.markdown b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/README.markdown
new file mode 100755 (executable)
index 0000000..bbeac2e
--- /dev/null
@@ -0,0 +1,177 @@
+binary
+======
+
+Unpack multibyte binary values from buffers and streams.
+You can specify the endianness and signedness of the fields to be unpacked too.
+
+This module is a cleaner and more complete version of
+[bufferlist](https://github.com/substack/node-bufferlist)'s binary module that
+runs on pre-allocated buffers instead of a linked list.
+
+[![build status](https://secure.travis-ci.org/substack/node-binary.png)](http://travis-ci.org/substack/node-binary)
+
+examples
+========
+
+stream.js
+---------
+
+``` js
+var binary = require('binary');
+
+var ws = binary()
+    .word32lu('x')
+    .word16bs('y')
+    .word16bu('z')
+    .tap(function (vars) {
+        console.dir(vars);
+    })
+;
+process.stdin.pipe(ws);
+process.stdin.resume();
+```
+
+output:
+
+```
+$ node examples/stream.js
+abcdefgh
+{ x: 1684234849, y: 25958, z: 26472 }
+^D
+```
+
+parse.js
+--------
+
+``` js
+var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
+
+var binary = require('binary');
+var vars = binary.parse(buf)
+    .word16ls('ab')
+    .word32bu('cf')
+    .word8('x')
+    .vars
+;
+console.dir(vars);
+```
+
+output:
+
+```
+{ ab: 25185, cf: 1667523942, x: 0 }
+```
+
+methods
+=======
+
+`var binary = require('binary')`
+
+var b = binary()
+----------------
+
+Return a new writable stream `b` that has the chainable methods documented below
+for buffering binary input.
+
+binary.parse(buf)
+-----------------
+
+Parse a static buffer in one pass. Returns a chainable interface with the
+methods below plus a `vars` field to get at the variable stash as the last item
+in a chain.
+
+In parse mode, methods will set their keys to `null` if the buffer isn't big
+enough except `buffer()` and `scan()` which read up up to the end of the buffer
+and stop.
+
+b.word{8,16,32,64}{l,b}{e,u,s}(key)
+-----------------------------------
+
+Parse bytes in the buffer or stream given:
+
+* number of bits
+* endianness ( l : little, b : big ),
+* signedness ( u and e : unsigned, s : signed )
+
+These functions won't start parsing until all previous parser functions have run
+and the data is available.
+
+The result of the parse goes into the variable stash at `key`.
+If `key` has dots (`.`s), it refers to a nested address. If parent container
+values don't exist they will be created automatically, so for instance you can
+assign into `dst.addr` and `dst.port` and the `dst` key in the variable stash
+will be `{ addr : x, port : y }` afterwards.
+
+b.buffer(key, size)
+-------------------
+
+Take `size` bytes directly off the buffer stream, putting the resulting buffer
+slice in the variable stash at `key`. If `size` is a string, use the value at
+`vars[size]`. The key follows the same dotted address rules as the word
+functions.
+
+b.scan(key, buffer)
+-------------------
+
+Search for `buffer` in the stream and store all the intervening data in the
+stash at at `key`, excluding the search buffer. If `buffer` passed as a string,
+it will be converted into a Buffer internally.
+
+For example, to read in a line you can just do:
+
+``` js
+var b = binary()
+    .scan('line', new Buffer('\r\n'))
+    .tap(function (vars) {
+        console.log(vars.line)
+    })
+;
+stream.pipe(b);
+```
+
+b.tap(cb)
+---------
+
+The callback `cb` is provided with the variable stash from all the previous
+actions once they've all finished.
+
+You can nest additional actions onto `this` inside the callback.
+
+b.into(key, cb)
+---------------
+
+Like `.tap()`, except all nested actions will assign into a `key` in the `vars`
+stash.
+
+b.loop(cb)
+----------
+
+Loop, each time calling `cb(end, vars)` for function `end` and the variable
+stash with `this` set to a new chain for nested parsing. The loop terminates
+once `end` is called.
+
+b.flush()
+---------
+
+Clear the variable stash entirely.
+
+installation
+============
+
+To install with [npm](http://github.com/isaacs/npm):
+
+```
+npm install binary
+```
+
+notes
+=====
+
+The word64 functions will only return approximations since javascript uses ieee
+floating point for all number types. Mind the loss of precision.
+
+license
+=======
+
+MIT
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/buf.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/buf.js
new file mode 100755 (executable)
index 0000000..7f5d30b
--- /dev/null
@@ -0,0 +1,11 @@
+var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
+
+var binary = require('binary');
+binary(buf)
+    .word16ls('ab')
+    .word32bu('cf')
+    .word8('x')
+    .tap(function (vars) {
+        console.dir(vars);
+    })
+;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/parse.js
new file mode 100755 (executable)
index 0000000..b326883
--- /dev/null
@@ -0,0 +1,10 @@
+var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
+
+var binary = require('binary');
+var vars = binary.parse(buf)
+    .word16ls('ab')
+    .word32bu('cf')
+    .word8('x')
+    .vars
+;
+console.dir(vars);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/stream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/example/stream.js
new file mode 100755 (executable)
index 0000000..28a6f96
--- /dev/null
@@ -0,0 +1,12 @@
+var binary = require('binary');
+
+var ws = binary()
+    .word32lu('x')
+    .word16bs('y')
+    .word16bu('z')
+    .tap(function (vars) {
+        console.dir(vars);
+    })
+;
+process.stdin.pipe(ws);
+process.stdin.resume();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/index.js
new file mode 100755 (executable)
index 0000000..bf2ba4b
--- /dev/null
@@ -0,0 +1,397 @@
+var Chainsaw = require('chainsaw');
+var EventEmitter = require('events').EventEmitter;
+var Buffers = require('buffers');
+var Vars = require('./lib/vars.js');
+var Stream = require('stream').Stream;
+
+exports = module.exports = function (bufOrEm, eventName) {
+    if (Buffer.isBuffer(bufOrEm)) {
+        return exports.parse(bufOrEm);
+    }
+    
+    var s = exports.stream();
+    if (bufOrEm && bufOrEm.pipe) {
+        bufOrEm.pipe(s);
+    }
+    else if (bufOrEm) {
+        bufOrEm.on(eventName || 'data', function (buf) {
+            s.write(buf);
+        });
+        
+        bufOrEm.on('end', function () {
+            s.end();
+        });
+    }
+    return s;
+};
+
+exports.stream = function (input) {
+    if (input) return exports.apply(null, arguments);
+    
+    var pending = null;
+    function getBytes (bytes, cb, skip) {
+        pending = {
+            bytes : bytes,
+            skip : skip,
+            cb : function (buf) {
+                pending = null;
+                cb(buf);
+            },
+        };
+        dispatch();
+    }
+    
+    var offset = null;
+    function dispatch () {
+        if (!pending) {
+            if (caughtEnd) done = true;
+            return;
+        }
+        if (typeof pending === 'function') {
+            pending();
+        }
+        else {
+            var bytes = offset + pending.bytes;
+            
+            if (buffers.length >= bytes) {
+                var buf;
+                if (offset == null) {
+                    buf = buffers.splice(0, bytes);
+                    if (!pending.skip) {
+                        buf = buf.slice();
+                    }
+                }
+                else {
+                    if (!pending.skip) {
+                        buf = buffers.slice(offset, bytes);
+                    }
+                    offset = bytes;
+                }
+                
+                if (pending.skip) {
+                    pending.cb();
+                }
+                else {
+                    pending.cb(buf);
+                }
+            }
+        }
+    }
+    
+    function builder (saw) {
+        function next () { if (!done) saw.next() }
+        
+        var self = words(function (bytes, cb) {
+            return function (name) {
+                getBytes(bytes, function (buf) {
+                    vars.set(name, cb(buf));
+                    next();
+                });
+            };
+        });
+        
+        self.tap = function (cb) {
+            saw.nest(cb, vars.store);
+        };
+        
+        self.into = function (key, cb) {
+            if (!vars.get(key)) vars.set(key, {});
+            var parent = vars;
+            vars = Vars(parent.get(key));
+            
+            saw.nest(function () {
+                cb.apply(this, arguments);
+                this.tap(function () {
+                    vars = parent;
+                });
+            }, vars.store);
+        };
+        
+        self.flush = function () {
+            vars.store = {};
+            next();
+        };
+        
+        self.loop = function (cb) {
+            var end = false;
+            
+            saw.nest(false, function loop () {
+                this.vars = vars.store;
+                cb.call(this, function () {
+                    end = true;
+                    next();
+                }, vars.store);
+                this.tap(function () {
+                    if (end) saw.next()
+                    else loop.call(this)
+                }.bind(this));
+            }, vars.store);
+        };
+        
+        self.buffer = function (name, bytes) {
+            if (typeof bytes === 'string') {
+                bytes = vars.get(bytes);
+            }
+            
+            getBytes(bytes, function (buf) {
+                vars.set(name, buf);
+                next();
+            });
+        };
+        
+        self.skip = function (bytes) {
+            if (typeof bytes === 'string') {
+                bytes = vars.get(bytes);
+            }
+            
+            getBytes(bytes, function () {
+                next();
+            });
+        };
+        
+        self.scan = function find (name, search) {
+            if (typeof search === 'string') {
+                search = new Buffer(search);
+            }
+            else if (!Buffer.isBuffer(search)) {
+                throw new Error('search must be a Buffer or a string');
+            }
+            
+            var taken = 0;
+            pending = function () {
+                var pos = buffers.indexOf(search, offset + taken);
+                var i = pos-offset-taken;
+                if (pos !== -1) {
+                    pending = null;
+                    if (offset != null) {
+                        vars.set(
+                            name,
+                            buffers.slice(offset, offset + taken + i)
+                        );
+                        offset += taken + i + search.length;
+                    }
+                    else {
+                        vars.set(
+                            name,
+                            buffers.slice(0, taken + i)
+                        );
+                        buffers.splice(0, taken + i + search.length);
+                    }
+                    next();
+                    dispatch();
+                } else {
+                    i = Math.max(buffers.length - search.length - offset - taken, 0);
+                               }
+                taken += i;
+            };
+            dispatch();
+        };
+        
+        self.peek = function (cb) {
+            offset = 0;
+            saw.nest(function () {
+                cb.call(this, vars.store);
+                this.tap(function () {
+                    offset = null;
+                });
+            });
+        };
+        
+        return self;
+    };
+    
+    var stream = Chainsaw.light(builder);
+    stream.writable = true;
+    
+    var buffers = Buffers();
+    
+    stream.write = function (buf) {
+        buffers.push(buf);
+        dispatch();
+    };
+    
+    var vars = Vars();
+    
+    var done = false, caughtEnd = false;
+    stream.end = function () {
+        caughtEnd = true;
+    };
+    
+    stream.pipe = Stream.prototype.pipe;
+    Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
+        stream[name] = EventEmitter.prototype[name];
+    });
+    
+    return stream;
+};
+
+exports.parse = function parse (buffer) {
+    var self = words(function (bytes, cb) {
+        return function (name) {
+            if (offset + bytes <= buffer.length) {
+                var buf = buffer.slice(offset, offset + bytes);
+                offset += bytes;
+                vars.set(name, cb(buf));
+            }
+            else {
+                vars.set(name, null);
+            }
+            return self;
+        };
+    });
+    
+    var offset = 0;
+    var vars = Vars();
+    self.vars = vars.store;
+    
+    self.tap = function (cb) {
+        cb.call(self, vars.store);
+        return self;
+    };
+    
+    self.into = function (key, cb) {
+        if (!vars.get(key)) {
+            vars.set(key, {});
+        }
+        var parent = vars;
+        vars = Vars(parent.get(key));
+        cb.call(self, vars.store);
+        vars = parent;
+        return self;
+    };
+    
+    self.loop = function (cb) {
+        var end = false;
+        var ender = function () { end = true };
+        while (end === false) {
+            cb.call(self, ender, vars.store);
+        }
+        return self;
+    };
+    
+    self.buffer = function (name, size) {
+        if (typeof size === 'string') {
+            size = vars.get(size);
+        }
+        var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
+        offset += size;
+        vars.set(name, buf);
+        
+        return self;
+    };
+    
+    self.skip = function (bytes) {
+        if (typeof bytes === 'string') {
+            bytes = vars.get(bytes);
+        }
+        offset += bytes;
+        
+        return self;
+    };
+    
+    self.scan = function (name, search) {
+        if (typeof search === 'string') {
+            search = new Buffer(search);
+        }
+        else if (!Buffer.isBuffer(search)) {
+            throw new Error('search must be a Buffer or a string');
+        }
+        vars.set(name, null);
+        
+        // simple but slow string search
+        for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
+            for (
+                var j = 0;
+                j < search.length && buffer[offset+i+j] === search[j];
+                j++
+            );
+            if (j === search.length) break;
+        }
+        
+        vars.set(name, buffer.slice(offset, offset + i));
+        offset += i + search.length;
+        return self;
+    };
+    
+    self.peek = function (cb) {
+        var was = offset;
+        cb.call(self, vars.store);
+        offset = was;
+        return self;
+    };
+    
+    self.flush = function () {
+        vars.store = {};
+        return self;
+    };
+    
+    self.eof = function () {
+        return offset >= buffer.length;
+    };
+    
+    return self;
+};
+
+// convert byte strings to unsigned little endian numbers
+function decodeLEu (bytes) {
+    var acc = 0;
+    for (var i = 0; i < bytes.length; i++) {
+        acc += Math.pow(256,i) * bytes[i];
+    }
+    return acc;
+}
+
+// convert byte strings to unsigned big endian numbers
+function decodeBEu (bytes) {
+    var acc = 0;
+    for (var i = 0; i < bytes.length; i++) {
+        acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
+    }
+    return acc;
+}
+
+// convert byte strings to signed big endian numbers
+function decodeBEs (bytes) {
+    var val = decodeBEu(bytes);
+    if ((bytes[0] & 0x80) == 0x80) {
+        val -= Math.pow(256, bytes.length);
+    }
+    return val;
+}
+
+// convert byte strings to signed little endian numbers
+function decodeLEs (bytes) {
+    var val = decodeLEu(bytes);
+    if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
+        val -= Math.pow(256, bytes.length);
+    }
+    return val;
+}
+
+function words (decode) {
+    var self = {};
+    
+    [ 1, 2, 4, 8 ].forEach(function (bytes) {
+        var bits = bytes * 8;
+        
+        self['word' + bits + 'le']
+        = self['word' + bits + 'lu']
+        = decode(bytes, decodeLEu);
+        
+        self['word' + bits + 'ls']
+        = decode(bytes, decodeLEs);
+        
+        self['word' + bits + 'be']
+        = self['word' + bits + 'bu']
+        = decode(bytes, decodeBEu);
+        
+        self['word' + bits + 'bs']
+        = decode(bytes, decodeBEs);
+    });
+    
+    // word8be(n) == word8le(n) for all n
+    self.word8 = self.word8u = self.word8be;
+    self.word8s = self.word8bs;
+    
+    return self;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/lib/vars.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/lib/vars.js
new file mode 100755 (executable)
index 0000000..00d6df6
--- /dev/null
@@ -0,0 +1,28 @@
+module.exports = function (store) {
+    function getset (name, value) {
+        var node = vars.store;
+        var keys = name.split('.');
+        keys.slice(0,-1).forEach(function (k) {
+            if (node[k] === undefined) node[k] = {};
+            node = node[k]
+        });
+        var key = keys[keys.length - 1];
+        if (arguments.length == 1) {
+            return node[key];
+        }
+        else {
+            return node[key] = value;
+        }
+    }
+    
+    var vars = {
+        get : function (name) {
+            return getset(name);
+        },
+        set : function (name, value) {
+            return getset(name, value);
+        },
+        store : store || {},
+    };
+    return vars;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/README.markdown b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/README.markdown
new file mode 100755 (executable)
index 0000000..73a18a4
--- /dev/null
@@ -0,0 +1,122 @@
+buffers
+=======
+
+Treat a collection of Buffers as a single contiguous partially mutable Buffer.
+
+Where possible, operations execute without creating a new Buffer and copying
+everything over.
+
+This is a cleaner more Buffery rehash of
+[bufferlist](http://github.com/substack/node-bufferlist).
+
+example
+=======
+
+slice
+-----
+
+    var Buffers = require('buffers');
+    var bufs = Buffers();
+    bufs.push(new Buffer([1,2,3]));
+    bufs.push(new Buffer([4,5,6,7]));
+    bufs.push(new Buffer([8,9,10]));
+    
+    console.dir(bufs.slice(2,8))
+
+output:
+
+    $ node examples/slice.js 
+    <Buffer 03 04 05 06 07 08>
+
+splice
+------
+
+    var Buffers = require('buffers');
+    var bufs = Buffers([
+        new Buffer([1,2,3]),
+        new Buffer([4,5,6,7]),
+        new Buffer([8,9,10]),
+    ]);
+    
+    var removed = bufs.splice(2, 4);
+    console.dir({
+        removed : removed.slice(),
+        bufs : bufs.slice(),
+    });
+    
+output:
+
+    $ node examples/splice.js
+    { removed: <Buffer 03 04 05 06>,
+      bufs: <Buffer 01 02 07 08 09 0a> }
+
+methods
+=======
+
+Buffers(buffers)
+----------------
+
+Create a Buffers with an array of `Buffer`s if specified, else `[]`.
+
+.push(buf1, buf2...)
+--------------------
+
+Push buffers onto the end. Just like `Array.prototype.push`.
+
+.unshift(buf1, buf2...)
+-----------------------
+
+Unshift buffers onto the head. Just like `Array.prototype.unshift`.
+
+.slice(i, j)
+------------
+
+Slice a range out of the buffer collection as if it were contiguous.
+Works just like the `Array.prototype.slice` version.
+
+.splice(i, howMany, replacements)
+---------------------------------
+
+Splice the buffer collection as if it were contiguous.
+Works just like `Array.prototype.splice`, even the replacement part!
+
+.copy(dst, dstStart, start, end)
+--------------------------------
+
+Copy the buffer collection as if it were contiguous to the `dst` Buffer with the
+specified bounds.
+Works just like `Buffer.prototype.copy`.
+
+.get(i)
+-------
+
+Get a single element at index `i`.
+
+.set(i, x)
+----------
+
+Set a single element's value at index `i`.
+
+.indexOf(needle, offset)
+----------
+
+Find a string or buffer `needle` inside the buffer collection. Returns
+the position of the search string or -1 if the search string was not
+found.
+
+Provide an `offset` to skip that number of characters at the beginning
+of the search. This can be used to find additional matches.
+
+This function will return the correct result even if the search string
+is spread out over multiple internal buffers.
+
+.toBuffer()
+-----------
+
+Convert the buffer collection to a single buffer, equivalent with `.slice(0, buffers.length)`;
+
+.toString(encoding, start, end)
+-----------
+
+Decodes and returns a string from the buffer collection.
+Works just like `Buffer.prototype.toString`
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/examples/slice.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/examples/slice.js
new file mode 100755 (executable)
index 0000000..0bea38c
--- /dev/null
@@ -0,0 +1,9 @@
+var Buffers = require('buffers');
+var bufs = Buffers();
+bufs.push(new Buffer([1,2,3]));
+bufs.push(new Buffer([4,5,6,7]));
+bufs.push(new Buffer([8,9,10]));
+
+console.dir(bufs.slice(2,8))
+
+// Output: <Buffer 03 04 05 06 07 08>
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/examples/splice.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/examples/splice.js
new file mode 100755 (executable)
index 0000000..56a1751
--- /dev/null
@@ -0,0 +1,17 @@
+var Buffers = require('buffers');
+var bufs = Buffers([
+    new Buffer([1,2,3]),
+    new Buffer([4,5,6,7]),
+    new Buffer([8,9,10]),
+]);
+
+var removed = bufs.splice(2, 4, new Buffer('ab'), new Buffer('cd'));
+console.dir({
+    removed : removed.slice(),
+    bufs : bufs.slice(),
+});
+
+/* Output:
+{ removed: <Buffer 03 04 05 06>,
+  bufs: <Buffer 01 02 07 08 09 0a> }
+*/
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/index.js
new file mode 100755 (executable)
index 0000000..86a9696
--- /dev/null
@@ -0,0 +1,269 @@
+module.exports = Buffers;
+
+function Buffers (bufs) {
+    if (!(this instanceof Buffers)) return new Buffers(bufs);
+    this.buffers = bufs || [];
+    this.length = this.buffers.reduce(function (size, buf) {
+        return size + buf.length
+    }, 0);
+}
+
+Buffers.prototype.push = function () {
+    for (var i = 0; i < arguments.length; i++) {
+        if (!Buffer.isBuffer(arguments[i])) {
+            throw new TypeError('Tried to push a non-buffer');
+        }
+    }
+    
+    for (var i = 0; i < arguments.length; i++) {
+        var buf = arguments[i];
+        this.buffers.push(buf);
+        this.length += buf.length;
+    }
+    return this.length;
+};
+
+Buffers.prototype.unshift = function () {
+    for (var i = 0; i < arguments.length; i++) {
+        if (!Buffer.isBuffer(arguments[i])) {
+            throw new TypeError('Tried to unshift a non-buffer');
+        }
+    }
+    
+    for (var i = 0; i < arguments.length; i++) {
+        var buf = arguments[i];
+        this.buffers.unshift(buf);
+        this.length += buf.length;
+    }
+    return this.length;
+};
+
+Buffers.prototype.copy = function (dst, dStart, start, end) {
+    return this.slice(start, end).copy(dst, dStart, 0, end - start);
+};
+
+Buffers.prototype.splice = function (i, howMany) {
+    var buffers = this.buffers;
+    var index = i >= 0 ? i : this.length - i;
+    var reps = [].slice.call(arguments, 2);
+    
+    if (howMany === undefined) {
+        howMany = this.length - index;
+    }
+    else if (howMany > this.length - index) {
+        howMany = this.length - index;
+    }
+    
+    for (var i = 0; i < reps.length; i++) {
+        this.length += reps[i].length;
+    }
+    
+    var removed = new Buffers();
+    var bytes = 0;
+    
+    var startBytes = 0;
+    for (
+        var ii = 0;
+        ii < buffers.length && startBytes + buffers[ii].length < index;
+        ii ++
+    ) { startBytes += buffers[ii].length }
+    
+    if (index - startBytes > 0) {
+        var start = index - startBytes;
+        
+        if (start + howMany < buffers[ii].length) {
+            removed.push(buffers[ii].slice(start, start + howMany));
+            
+            var orig = buffers[ii];
+            //var buf = new Buffer(orig.length - howMany);
+            var buf0 = new Buffer(start);
+            for (var i = 0; i < start; i++) {
+                buf0[i] = orig[i];
+            }
+            
+            var buf1 = new Buffer(orig.length - start - howMany);
+            for (var i = start + howMany; i < orig.length; i++) {
+                buf1[ i - howMany - start ] = orig[i]
+            }
+            
+            if (reps.length > 0) {
+                var reps_ = reps.slice();
+                reps_.unshift(buf0);
+                reps_.push(buf1);
+                buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
+                ii += reps_.length;
+                reps = [];
+            }
+            else {
+                buffers.splice(ii, 1, buf0, buf1);
+                //buffers[ii] = buf;
+                ii += 2;
+            }
+        }
+        else {
+            removed.push(buffers[ii].slice(start));
+            buffers[ii] = buffers[ii].slice(0, start);
+            ii ++;
+        }
+    }
+    
+    if (reps.length > 0) {
+        buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
+        ii += reps.length;
+    }
+    
+    while (removed.length < howMany) {
+        var buf = buffers[ii];
+        var len = buf.length;
+        var take = Math.min(len, howMany - removed.length);
+        
+        if (take === len) {
+            removed.push(buf);
+            buffers.splice(ii, 1);
+        }
+        else {
+            removed.push(buf.slice(0, take));
+            buffers[ii] = buffers[ii].slice(take);
+        }
+    }
+    
+    this.length -= removed.length;
+    
+    return removed;
+};
+Buffers.prototype.slice = function (i, j) {
+    var buffers = this.buffers;
+    if (j === undefined) j = this.length;
+    if (i === undefined) i = 0;
+    
+    if (j > this.length) j = this.length;
+    
+    var startBytes = 0;
+    for (
+        var si = 0;
+        si < buffers.length && startBytes + buffers[si].length <= i;
+        si ++
+    ) { startBytes += buffers[si].length }
+    
+    var target = new Buffer(j - i);
+    
+    var ti = 0;
+    for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
+        var len = buffers[ii].length;
+        
+        var start = ti === 0 ? i - startBytes : 0;
+        var end = ti + len >= j - i
+            ? Math.min(start + (j - i) - ti, len)
+            : len
+        ;
+        
+        buffers[ii].copy(target, ti, start, end);
+        ti += end - start;
+    }
+    
+    return target;
+};
+
+Buffers.prototype.pos = function (i) {
+    if (i < 0 || i >= this.length) throw new Error('oob');
+    var l = i, bi = 0, bu = null;
+    for (;;) {
+        bu = this.buffers[bi];
+        if (l < bu.length) {
+            return {buf: bi, offset: l};
+        } else {
+            l -= bu.length;
+        }
+        bi++;
+    }
+};
+
+Buffers.prototype.get = function get (i) {
+    var pos = this.pos(i);
+
+    return this.buffers[pos.buf].get(pos.offset);
+};
+
+Buffers.prototype.set = function set (i, b) {
+    var pos = this.pos(i);
+
+    return this.buffers[pos.buf].set(pos.offset, b);
+};
+
+Buffers.prototype.indexOf = function (needle, offset) {
+    if ("string" === typeof needle) {
+        needle = new Buffer(needle);
+    } else if (needle instanceof Buffer) {
+        // already a buffer
+    } else {
+        throw new Error('Invalid type for a search string');
+    }
+
+    if (!needle.length) {
+        return 0;
+    }
+
+    if (!this.length) {
+        return -1;
+    }
+
+    var i = 0, j = 0, match = 0, mstart, pos = 0;
+
+    // start search from a particular point in the virtual buffer
+    if (offset) {
+        var p = this.pos(offset);
+        i = p.buf;
+        j = p.offset;
+        pos = offset;
+    }
+
+    // for each character in virtual buffer
+    for (;;) {
+        while (j >= this.buffers[i].length) {
+            j = 0;
+            i++;
+
+            if (i >= this.buffers.length) {
+                // search string not found
+                return -1;
+            }
+        }
+
+        var char = this.buffers[i][j];
+
+        if (char == needle[match]) {
+            // keep track where match started
+            if (match == 0) {
+                mstart = {
+                    i: i,
+                    j: j,
+                    pos: pos
+                };
+            }
+            match++;
+            if (match == needle.length) {
+                // full match
+                return mstart.pos;
+            }
+        } else if (match != 0) {
+            // a partial match ended, go back to match starting position
+            // this will continue the search at the next character
+            i = mstart.i;
+            j = mstart.j;
+            pos = mstart.pos;
+            match = 0;
+        }
+
+        j++;
+        pos++;
+    }
+};
+
+Buffers.prototype.toBuffer = function() {
+    return this.slice();
+}
+
+Buffers.prototype.toString = function(encoding, start, end) {
+    return this.slice(start, end).toString(encoding);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/package.json
new file mode 100755 (executable)
index 0000000..b9c8d3a
--- /dev/null
@@ -0,0 +1,53 @@
+{
+  "name": "buffers",
+  "description": "Treat a collection of Buffers as a single contiguous partially mutable Buffer.",
+  "version": "0.1.1",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/substack/node-buffers.git"
+  },
+  "author": {
+    "name": "James Halliday",
+    "email": "mail@substack.net",
+    "url": "http://substack.net"
+  },
+  "main": "./index",
+  "scripts": {
+    "test": "expresso"
+  },
+  "engines": {
+    "node": ">=0.2.0"
+  },
+  "_npmJsonOpts": {
+    "file": "/home/substack/.npm/buffers/0.1.1/package/package.json",
+    "wscript": false,
+    "contributors": false,
+    "serverjs": false
+  },
+  "_id": "buffers@0.1.1",
+  "dependencies": {},
+  "devDependencies": {},
+  "_engineSupported": true,
+  "_npmVersion": "1.0.30",
+  "_nodeVersion": "v0.4.12",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb",
+    "tarball": "http://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "substack",
+      "email": "mail@substack.net"
+    }
+  ],
+  "directories": {},
+  "_shasum": "b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb",
+  "_from": "buffers@~0.1.1",
+  "_resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
+  "bugs": {
+    "url": "https://github.com/substack/node-buffers/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/substack/node-buffers"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/test/buffers.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/buffers/test/buffers.js
new file mode 100755 (executable)
index 0000000..0c24066
--- /dev/null
@@ -0,0 +1,209 @@
+var assert = require('assert');
+var Buffers = require('../');
+
+function create (xs, split) {
+    var bufs = Buffers();
+    var offset = 0;
+    split.forEach(function (i) {
+        bufs.push(new Buffer(xs.slice(offset, offset + i)));
+        offset += i;
+    });
+    return bufs;
+}
+
+exports.slice = function () {
+    var xs = [0,1,2,3,4,5,6,7,8,9];
+    var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
+    
+    splits.forEach(function (split) {
+        var bufs = create(xs, split);
+        assert.eql(new Buffer(xs), bufs.slice(),
+            '[' + xs.join(',') + ']'
+                + ' != ' + 
+            '[' + [].join.call(bufs.slice(), ',') + ']'
+        );
+        
+        for (var i = 0; i < xs.length; i++) {
+            for (var j = i; j < xs.length; j++) {
+                var a = bufs.slice(i,j);
+                var b = new Buffer(xs.slice(i,j));
+                
+                assert.eql(a, b,
+                    '[' + [].join.call(a, ',') + ']'
+                        + ' != ' + 
+                    '[' + [].join.call(b, ',') + ']'
+                );
+            }
+        }
+    });
+};
+
+exports.splice = function () {
+    var xs = [0,1,2,3,4,5,6,7,8,9];
+    var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
+    
+    splits.forEach(function (split) {
+        for (var i = 0; i < xs.length; i++) {
+            for (var j = i; j < xs.length; j++) {
+                var bufs = create(xs, split);
+                var xs_ = xs.slice();
+                
+                var a_ = bufs.splice(i,j);
+                var a = [].slice.call(a_.slice());
+                var b = xs_.splice(i,j);
+                assert.eql(a, b,
+                    '[' + a.join(',') + ']'
+                        + ' != ' + 
+                    '[' + b.join(',') + ']'
+                );
+                
+                assert.eql(bufs.slice(), new Buffer(xs_),
+                    '[' + [].join.call(bufs.slice(), ',') + ']'
+                        + ' != ' + 
+                    '[' + [].join.call(xs_, ',') + ']'
+                );
+            }
+        }
+    });
+};
+
+exports.spliceRep = function () {
+    var xs = [0,1,2,3,4,5,6,7,8,9];
+    var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
+    var reps = [ [], [1], [5,6], [3,1,3,3,7], [9,8,7,6,5,4,3,2,1,2,3,4,5] ];
+    
+    splits.forEach(function (split) {
+        reps.forEach(function (rep) {
+            for (var i = 0; i < xs.length; i++) {
+                for (var j = i; j < xs.length; j++) {
+                    var bufs = create(xs, split);
+                    var xs_ = xs.slice();
+                    
+                    var a_ = bufs.splice.apply(
+                        bufs, [ i, j ].concat(new Buffer(rep))
+                    );
+                    var a = [].slice.call(a_.slice());
+                    var b = xs_.splice.apply(xs_, [ i, j ].concat(rep));
+                    
+                    assert.eql(a, b,
+                        '[' + a.join(',') + ']'
+                            + ' != ' + 
+                        '[' + b.join(',') + ']'
+                    );
+                    
+                    assert.eql(bufs.slice(), new Buffer(xs_),
+                        '[' + [].join.call(bufs.slice(), ',') + ']'
+                            + ' != ' + 
+                        '[' + [].join.call(xs_, ',') + ']'
+                    );
+                }
+            }
+        });
+    });
+}; 
+
+exports.copy = function () {
+    var xs = [0,1,2,3,4,5,6,7,8,9];
+    var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
+    
+    splits.forEach(function (split) {
+        var bufs = create(xs, split);
+        var buf = new Buffer(xs);
+        
+        for (var i = 0; i < xs.length; i++) {
+            for (var j = i; j < xs.length; j++) {
+                var t0 = new Buffer(j - i);
+                var t1 = new Buffer(j - i);
+                
+                assert.eql(
+                    bufs.copy(t0, 0, i, j),
+                    buf.copy(t1, 0, i, j)
+                );
+                
+                assert.eql(
+                    [].slice.call(t0),
+                    [].slice.call(t1)
+                );
+            }
+        }
+    });
+};
+
+exports.push = function () {
+    var bufs = Buffers();
+    bufs.push(new Buffer([0]));
+    bufs.push(new Buffer([1,2,3]));
+    bufs.push(new Buffer([4,5]));
+    bufs.push(new Buffer([6,7,8,9]));
+    assert.eql(
+        [].slice.call(bufs.slice()),
+        [0,1,2,3,4,5,6,7,8,9]
+    );
+    
+    assert.throws(function () {
+        bufs.push(new Buffer([11,12]), 'moo');
+    });
+    assert.eql(bufs.buffers.length, 4);
+};
+
+exports.unshift = function () {
+    var bufs = Buffers();
+    bufs.unshift(new Buffer([6,7,8,9]));
+    bufs.unshift(new Buffer([4,5]));
+    bufs.unshift(new Buffer([1,2,3]));
+    bufs.unshift(new Buffer([0]));
+    assert.eql(
+        [].slice.call(bufs.slice()),
+        [0,1,2,3,4,5,6,7,8,9]
+    );
+    assert.throws(function () {
+        bufs.unshift(new Buffer([-2,-1]), 'moo');
+    });
+    assert.eql(bufs.buffers.length, 4);
+};
+
+exports.get = function () {
+    var bufs = Buffers();
+    bufs.unshift(new Buffer([6,7,8,9]));
+    bufs.unshift(new Buffer([4,5]));
+    bufs.unshift(new Buffer([1,2,3]));
+    bufs.unshift(new Buffer([0]));
+    assert.eql( bufs.get(0), 0 );
+    assert.eql( bufs.get(1), 1 );
+    assert.eql( bufs.get(2), 2 );
+    assert.eql( bufs.get(3), 3 );
+    assert.eql( bufs.get(4), 4 );
+    assert.eql( bufs.get(5), 5 );
+    assert.eql( bufs.get(6), 6 );
+    assert.eql( bufs.get(7), 7 );
+    assert.eql( bufs.get(8), 8 );
+    assert.eql( bufs.get(9), 9 );
+};
+
+exports.set = function () {
+    var bufs = Buffers();
+    bufs.push(new Buffer("Hel"));
+    bufs.push(new Buffer("lo"));
+    bufs.push(new Buffer("!"));
+    bufs.set(0, 'h'.charCodeAt(0) );
+    bufs.set(3, 'L'.charCodeAt(0) );
+    bufs.set(5, '.'.charCodeAt(0) );
+    assert.eql( bufs.slice(0).toString(), 'helLo.' );
+};
+
+exports.indexOf = function () {
+    var bufs = Buffers();
+    bufs.push(new Buffer("Hel"));
+    bufs.push(new Buffer("lo,"));
+    bufs.push(new Buffer(" how are "));
+    bufs.push(new Buffer("you"));
+    bufs.push(new Buffer("?"));
+    assert.eql( bufs.indexOf("Hello"), 0 );
+    assert.eql( bufs.indexOf("Hello", 1), -1 );
+    assert.eql( bufs.indexOf("ello"), 1 );
+    assert.eql( bufs.indexOf("ello", 1), 1 );
+    assert.eql( bufs.indexOf("ello", 2), -1 );
+    assert.eql( bufs.indexOf("e"), 1 );
+    assert.eql( bufs.indexOf("e", 2), 13 );
+    assert.eql( bufs.indexOf(new Buffer([0x65]), 2), 13 );
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/README.markdown b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/README.markdown
new file mode 100755 (executable)
index 0000000..4721f78
--- /dev/null
@@ -0,0 +1,157 @@
+Chainsaw
+========
+
+Build chainable fluent interfaces the easy way in node.js.
+
+With this meta-module you can write modules with chainable interfaces.
+Chainsaw takes care of all of the boring details and makes nested flow control
+super simple too.
+
+Just call `Chainsaw` with a constructor function like in the examples below.
+In your methods, just do `saw.next()` to move along to the next event and
+`saw.nest()` to create a nested chain.
+
+Examples
+========
+
+add_do.js
+---------
+
+This silly example adds values with a chainsaw.
+
+    var Chainsaw = require('chainsaw');
+    
+    function AddDo (sum) {
+        return Chainsaw(function (saw) {
+            this.add = function (n) {
+                sum += n;
+                saw.next();
+            };
+             
+            this.do = function (cb) {
+                saw.nest(cb, sum);
+            };
+        });
+    }
+    
+    AddDo(0)
+        .add(5)
+        .add(10)
+        .do(function (sum) {
+            if (sum > 12) this.add(-10);
+        })
+        .do(function (sum) {
+            console.log('Sum: ' + sum);
+        })
+    ;
+
+Output:
+    Sum: 5
+
+prompt.js
+---------
+
+This example provides a wrapper on top of stdin with the help of
+[node-lazy](https://github.com/pkrumins/node-lazy) for line-processing.
+
+    var Chainsaw = require('chainsaw');
+    var Lazy = require('lazy');
+    
+    module.exports = Prompt;
+    function Prompt (stream) {
+        var waiting = [];
+        var lines = [];
+        var lazy = Lazy(stream).lines.map(String)
+            .forEach(function (line) {
+                if (waiting.length) {
+                    var w = waiting.shift();
+                    w(line);
+                }
+                else lines.push(line);
+            })
+        ;
+        
+        var vars = {};
+        return Chainsaw(function (saw) {
+            this.getline = function (f) {
+                var g = function (line) {
+                    saw.nest(f, line, vars);
+                };
+                
+                if (lines.length) g(lines.shift());
+                else waiting.push(g);
+            };
+            
+            this.do = function (cb) {
+                saw.nest(cb, vars);
+            };
+        });
+    }
+
+And now for the new Prompt() module in action:
+
+    var util = require('util');
+    var stdin = process.openStdin();
+     
+    Prompt(stdin)
+        .do(function () {
+            util.print('x = ');
+        })
+        .getline(function (line, vars) {
+            vars.x = parseInt(line, 10);
+        })
+        .do(function () {
+            util.print('y = ');
+        })
+        .getline(function (line, vars) {
+            vars.y = parseInt(line, 10);
+        })
+        .do(function (vars) {
+            if (vars.x + vars.y < 10) {
+                util.print('z = ');
+                this.getline(function (line) {
+                    vars.z = parseInt(line, 10);
+                })
+            }
+            else {
+                vars.z = 0;
+            }
+        })
+        .do(function (vars) {
+            console.log('x + y + z = ' + (vars.x + vars.y + vars.z));
+            process.exit();
+        })
+    ;
+
+Installation
+============
+
+With [npm](http://github.com/isaacs/npm), just do:
+    npm install chainsaw
+
+or clone this project on github:
+
+    git clone http://github.com/substack/node-chainsaw.git
+
+To run the tests with [expresso](http://github.com/visionmedia/expresso),
+just do:
+
+    expresso
+
+
+Light Mode vs Full Mode
+=======================
+
+`node-chainsaw` supports two different modes. In full mode, every
+action is recorded, which allows you to replay actions using the
+`jump()`, `trap()` and `down()` methods.
+
+However, if your chainsaws are long-lived, recording every action can
+consume a tremendous amount of memory, so we also offer a "light" mode
+where actions are not recorded and the aforementioned methods are
+disabled.
+
+To enable light mode simply use `Chainsaw.light()` to construct your
+saw, instead of `Chainsaw()`.
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/examples/add_do.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/examples/add_do.js
new file mode 100755 (executable)
index 0000000..378705d
--- /dev/null
@@ -0,0 +1,25 @@
+var Chainsaw = require('chainsaw');
+
+function AddDo (sum) {
+    return Chainsaw(function (saw) {
+        this.add = function (n) {
+            sum += n;
+            saw.next();
+        };
+        
+        this.do = function (cb) {
+            saw.nest(cb, sum);
+        };
+    });
+}
+
+AddDo(0)
+    .add(5)
+    .add(10)
+    .do(function (sum) {
+        if (sum > 12) this.add(-10);
+    })
+    .do(function (sum) {
+        console.log('Sum: ' + sum);
+    })
+;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/examples/prompt.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/examples/prompt.js
new file mode 100755 (executable)
index 0000000..0a06d71
--- /dev/null
@@ -0,0 +1,67 @@
+var Chainsaw = require('chainsaw');
+var Lazy = require('lazy');
+
+module.exports = Prompt;
+function Prompt (stream) {
+    var waiting = [];
+    var lines = [];
+    var lazy = Lazy(stream).lines.map(String)
+        .forEach(function (line) {
+            if (waiting.length) {
+                var w = waiting.shift();
+                w(line);
+            }
+            else lines.push(line);
+        })
+    ;
+    
+    var vars = {};
+    return Chainsaw(function (saw) {
+        this.getline = function (f) {
+            var g = function (line) {
+                saw.nest(f, line, vars);
+            };
+            
+            if (lines.length) g(lines.shift());
+            else waiting.push(g);
+        };
+        
+        this.do = function (cb) {
+            saw.nest(cb, vars);
+        };
+    });
+}
+
+var util = require('util');
+if (__filename === process.argv[1]) {
+    var stdin = process.openStdin();
+    Prompt(stdin)
+        .do(function () {
+            util.print('x = ');
+        })
+        .getline(function (line, vars) {
+            vars.x = parseInt(line, 10);
+        })
+        .do(function () {
+            util.print('y = ');
+        })
+        .getline(function (line, vars) {
+            vars.y = parseInt(line, 10);
+        })
+        .do(function (vars) {
+            if (vars.x + vars.y < 10) {
+                util.print('z = ');
+                this.getline(function (line) {
+                    vars.z = parseInt(line, 10);
+                })
+            }
+            else {
+                vars.z = 0;
+            }
+        })
+        .do(function (vars) {
+            console.log('x + y + z = ' + (vars.x + vars.y + vars.z));
+            process.exit();
+        })
+    ;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/index.js
new file mode 100755 (executable)
index 0000000..39f8c07
--- /dev/null
@@ -0,0 +1,145 @@
+var Traverse = require('traverse');
+var EventEmitter = require('events').EventEmitter;
+
+module.exports = Chainsaw;
+function Chainsaw (builder) {
+    var saw = Chainsaw.saw(builder, {});
+    var r = builder.call(saw.handlers, saw);
+    if (r !== undefined) saw.handlers = r;
+    saw.record();
+    return saw.chain();
+};
+
+Chainsaw.light = function ChainsawLight (builder) {
+    var saw = Chainsaw.saw(builder, {});
+    var r = builder.call(saw.handlers, saw);
+    if (r !== undefined) saw.handlers = r;
+    return saw.chain();
+};
+
+Chainsaw.saw = function (builder, handlers) {
+    var saw = new EventEmitter;
+    saw.handlers = handlers;
+    saw.actions = [];
+
+    saw.chain = function () {
+        var ch = Traverse(saw.handlers).map(function (node) {
+            if (this.isRoot) return node;
+            var ps = this.path;
+
+            if (typeof node === 'function') {
+                this.update(function () {
+                    saw.actions.push({
+                        path : ps,
+                        args : [].slice.call(arguments)
+                    });
+                    return ch;
+                });
+            }
+        });
+
+        process.nextTick(function () {
+            saw.emit('begin');
+            saw.next();
+        });
+
+        return ch;
+    };
+
+    saw.pop = function () {
+        return saw.actions.shift();
+    };
+
+    saw.next = function () {
+        var action = saw.pop();
+
+        if (!action) {
+            saw.emit('end');
+        }
+        else if (!action.trap) {
+            var node = saw.handlers;
+            action.path.forEach(function (key) { node = node[key] });
+            node.apply(saw.handlers, action.args);
+        }
+    };
+
+    saw.nest = function (cb) {
+        var args = [].slice.call(arguments, 1);
+        var autonext = true;
+
+        if (typeof cb === 'boolean') {
+            var autonext = cb;
+            cb = args.shift();
+        }
+
+        var s = Chainsaw.saw(builder, {});
+        var r = builder.call(s.handlers, s);
+
+        if (r !== undefined) s.handlers = r;
+
+        // If we are recording...
+        if ("undefined" !== typeof saw.step) {
+            // ... our children should, too
+            s.record();
+        }
+
+        cb.apply(s.chain(), args);
+        if (autonext !== false) s.on('end', saw.next);
+    };
+
+    saw.record = function () {
+        upgradeChainsaw(saw);
+    };
+
+    ['trap', 'down', 'jump'].forEach(function (method) {
+        saw[method] = function () {
+            throw new Error("To use the trap, down and jump features, please "+
+                            "call record() first to start recording actions.");
+        };
+    });
+
+    return saw;
+};
+
+function upgradeChainsaw(saw) {
+    saw.step = 0;
+
+    // override pop
+    saw.pop = function () {
+        return saw.actions[saw.step++];
+    };
+
+    saw.trap = function (name, cb) {
+        var ps = Array.isArray(name) ? name : [name];
+        saw.actions.push({
+            path : ps,
+            step : saw.step,
+            cb : cb,
+            trap : true
+        });
+    };
+
+    saw.down = function (name) {
+        var ps = (Array.isArray(name) ? name : [name]).join('/');
+        var i = saw.actions.slice(saw.step).map(function (x) {
+            if (x.trap && x.step <= saw.step) return false;
+            return x.path.join('/') == ps;
+        }).indexOf(true);
+
+        if (i >= 0) saw.step += i;
+        else saw.step = saw.actions.length;
+
+        var act = saw.actions[saw.step - 1];
+        if (act && act.trap) {
+            // It's a trap!
+            saw.step = act.step;
+            act.cb();
+        }
+        else saw.next();
+    };
+
+    saw.jump = function (step) {
+        saw.step = step;
+        saw.next();
+    };
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/package.json
new file mode 100755 (executable)
index 0000000..496744e
--- /dev/null
@@ -0,0 +1,52 @@
+{
+  "name": "chainsaw",
+  "version": "0.1.0",
+  "description": "Build chainable fluent interfaces the easy way... with a freakin' chainsaw!",
+  "main": "./index.js",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/substack/node-chainsaw.git"
+  },
+  "dependencies": {
+    "traverse": ">=0.3.0 <0.4"
+  },
+  "keywords": [
+    "chain",
+    "fluent",
+    "interface",
+    "monad",
+    "monadic"
+  ],
+  "author": {
+    "name": "James Halliday",
+    "email": "mail@substack.net",
+    "url": "http://substack.net"
+  },
+  "license": "MIT/X11",
+  "engine": {
+    "node": ">=0.4.0"
+  },
+  "_id": "chainsaw@0.1.0",
+  "devDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.0.10",
+  "_nodeVersion": "v0.5.0-pre",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "5eab50b28afe58074d0d58291388828b5e5fbc98",
+    "tarball": "http://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz"
+  },
+  "scripts": {},
+  "directories": {},
+  "_shasum": "5eab50b28afe58074d0d58291388828b5e5fbc98",
+  "_from": "chainsaw@~0.1.0",
+  "_resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
+  "bugs": {
+    "url": "https://github.com/substack/node-chainsaw/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/substack/node-chainsaw"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/test/chainsaw.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/node_modules/chainsaw/test/chainsaw.js
new file mode 100755 (executable)
index 0000000..8895e89
--- /dev/null
@@ -0,0 +1,418 @@
+var assert = require('assert');
+var Chainsaw = require('../index');
+
+exports.getset = function () {
+    var to = setTimeout(function () {
+        assert.fail('builder never fired');
+    }, 1000);
+    
+    var ch = Chainsaw(function (saw) {
+        clearTimeout(to);
+        var num = 0;
+        
+        this.get = function (cb) {
+            cb(num);
+            saw.next();
+        };
+        
+        this.set = function (n) {
+            num = n;
+            saw.next();
+        };
+        
+        var ti = setTimeout(function () {
+            assert.fail('end event not emitted');
+        }, 50);
+        
+        saw.on('end', function () {
+            clearTimeout(ti);
+            assert.equal(times, 3);
+        });
+    });
+    
+    var times = 0;
+    ch
+        .get(function (x) {
+            assert.equal(x, 0);
+            times ++;
+        })
+        .set(10)
+        .get(function (x) {
+            assert.equal(x, 10);
+            times ++;
+        })
+        .set(20)
+        .get(function (x) {
+            assert.equal(x, 20);
+            times ++;
+        })
+    ;
+};
+
+exports.nest = function () {
+    var ch = (function () {
+        var vars = {};
+        return Chainsaw(function (saw) {
+            this.do = function (cb) {
+                saw.nest(cb, vars);
+            };
+        });
+    })();
+    
+    var order = [];
+    var to = setTimeout(function () {
+        assert.fail("Didn't get to the end");
+    }, 50);
+    
+    ch
+        .do(function (vars) {
+            vars.x = 'y';
+            order.push(1);
+            
+            this
+                .do(function (vs) {
+                    order.push(2);
+                    vs.x = 'x';
+                })
+                .do(function (vs) {
+                    order.push(3);
+                    vs.z = 'z';
+                })
+            ;
+        })
+        .do(function (vars) {
+            vars.y = 'y';
+            order.push(4);
+        })
+        .do(function (vars) {
+            assert.eql(order, [1,2,3,4]);
+            assert.eql(vars, { x : 'x', y : 'y', z : 'z' });
+            clearTimeout(to);
+        })
+    ;
+};
+
+exports.nestWait = function () {
+    var ch = (function () {
+        var vars = {};
+        return Chainsaw(function (saw) {
+            this.do = function (cb) {
+                saw.nest(cb, vars);
+            };
+            
+            this.wait = function (n) {
+                setTimeout(function () {
+                    saw.next();
+                }, n);
+            };
+        });
+    })();
+    
+    var order = [];
+    var to = setTimeout(function () {
+        assert.fail("Didn't get to the end");
+    }, 1000);
+    
+    var times = {};
+    
+    ch
+        .do(function (vars) {
+            vars.x = 'y';
+            order.push(1);
+            
+            this
+                .do(function (vs) {
+                    order.push(2);
+                    vs.x = 'x';
+                    times.x = Date.now();
+                })
+                .wait(50)
+                .do(function (vs) {
+                    order.push(3);
+                    vs.z = 'z';
+                    
+                    times.z = Date.now();
+                    var dt = times.z - times.x;
+                    assert.ok(dt >= 50 && dt < 75);
+                })
+            ;
+        })
+        .do(function (vars) {
+            vars.y = 'y';
+            order.push(4);
+            
+            times.y = Date.now();
+        })
+        .wait(100)
+        .do(function (vars) {
+            assert.eql(order, [1,2,3,4]);
+            assert.eql(vars, { x : 'x', y : 'y', z : 'z' });
+            clearTimeout(to);
+            
+            times.end = Date.now();
+            var dt = times.end - times.y;
+            assert.ok(dt >= 100 && dt < 125)
+        })
+    ;
+};
+
+exports.nestNext = function () {
+    var ch = (function () {
+        var vars = {};
+        return Chainsaw(function (saw) {
+            this.do = function (cb) {
+                saw.nest(false, function () {
+                    var args = [].slice.call(arguments);
+                    args.push(saw.next);
+                    cb.apply(this, args);
+                }, vars);
+            };
+        });
+    })();
+    
+    var order = [];
+    var to = setTimeout(function () {
+        assert.fail("Didn't get to the end");
+    }, 500);
+    
+    var times = [];
+    
+    ch
+        .do(function (vars, next_) {
+            vars.x = 'y';
+            order.push(1);
+            
+            this
+                .do(function (vs, next) {
+                    order.push(2);
+                    vs.x = 'x';
+                    setTimeout(next, 30);
+                })
+                .do(function (vs, next) {
+                    order.push(3);
+                    vs.z = 'z';
+                    setTimeout(next, 10);
+                })
+                .do(function () {
+                    setTimeout(next_, 20);
+                })
+            ;
+        })
+        .do(function (vars, next) {
+            vars.y = 'y';
+            order.push(4);
+            setTimeout(next, 5);
+        })
+        .do(function (vars) {
+            assert.eql(order, [1,2,3,4]);
+            assert.eql(vars, { x : 'x', y : 'y', z : 'z' });
+            
+            clearTimeout(to);
+        })
+    ;
+};
+
+exports.builder = function () {
+    var cx = Chainsaw(function (saw) {
+        this.x = function () {};
+    });
+    assert.ok(cx.x);
+    
+    var cy = Chainsaw(function (saw) {
+        return { y : function () {} };
+    });
+    assert.ok(cy.y);
+    
+    var cz = Chainsaw(function (saw) {
+        return { z : function (cb) { saw.nest(cb) } };
+    });
+    assert.ok(cz.z);
+    
+    var to = setTimeout(function () {
+        assert.fail("Nested z didn't run");
+    }, 50);
+    
+    cz.z(function () {
+        clearTimeout(to);
+        assert.ok(this.z);
+    });
+};
+
+this.attr = function () {
+    var to = setTimeout(function () {
+        assert.fail("attr chain didn't finish");
+    }, 50);
+    
+    var xy = [];
+    var ch = Chainsaw(function (saw) {
+        this.h = {
+            x : function () { 
+                xy.push('x');
+                saw.next();
+            },
+            y : function () {
+                xy.push('y');
+                saw.next();
+                assert.eql(xy, ['x','y']);
+                clearTimeout(to);
+            }
+        };
+    });
+    assert.ok(ch.h);
+    assert.ok(ch.h.x);
+    assert.ok(ch.h.y);
+    
+    ch.h.x().h.y();
+};
+
+exports.down = function () {
+    var error = null;
+    var s;
+    var ch = Chainsaw(function (saw) {
+        s = saw;
+        this.raise = function (err) {
+            error = err;
+            saw.down('catch');
+        };
+        
+        this.do = function (cb) {
+            cb.call(this);
+        };
+        
+        this.catch = function (cb) {
+            if (error) {
+                saw.nest(cb, error);
+                error = null;
+            }
+            else saw.next();
+        };
+    });
+    
+    var to = setTimeout(function () {
+        assert.fail(".do() after .catch() didn't fire");
+    }, 50);
+    
+    ch
+        .do(function () {
+            this.raise('pow');
+        })
+        .do(function () {
+            assert.fail("raise didn't skip over this do block");
+        })
+        .catch(function (err) {
+            assert.equal(err, 'pow');
+        })
+        .do(function () {
+            clearTimeout(to);
+        })
+    ;
+};
+
+exports.trap = function () {
+    var error = null;
+    var ch = Chainsaw(function (saw) {
+        var pars = 0;
+        var stack = [];
+        var i = 0;
+        
+        this.par = function (cb) {
+            pars ++;
+            var j = i ++;
+            cb.call(function () {
+                pars --;
+                stack[j] = [].slice.call(arguments);
+                saw.down('result');
+            });
+            saw.next();
+        };
+        
+        this.join = function (cb) {
+            saw.trap('result', function () {
+                if (pars == 0) {
+                    cb.apply(this, stack);
+                    saw.next();
+                }
+            });
+        };
+        
+        this.raise = function (err) {
+            error = err;
+            saw.down('catch');
+        };
+        
+        this.do = function (cb) {
+            cb.call(this);
+        };
+        
+        this.catch = function (cb) {
+            if (error) {
+                saw.nest(cb, error);
+                error = null;
+            }
+            else saw.next();
+        };
+    });
+    
+    var to = setTimeout(function () {
+        assert.fail(".do() after .join() didn't fire");
+    }, 100);
+    var tj = setTimeout(function () {
+        assert.fail('.join() never fired');
+    }, 100);
+    
+    var joined = false;
+    ch
+        .par(function () {
+            setTimeout(this.bind(null, 1), 50);
+        })
+        .par(function () {
+            setTimeout(this.bind(null, 2), 25);
+        })
+        .join(function (x, y) {
+            assert.equal(x[0], 1);
+            assert.equal(y[0], 2);
+            clearTimeout(tj);
+            joined = true;
+        })
+        .do(function () {
+            clearTimeout(to);
+            assert.ok(joined);
+        })
+    ;
+};
+
+exports.jump = function () {
+    var to = setTimeout(function () {
+        assert.fail('builder never fired');
+    }, 50);
+    
+    var xs = [ 4, 5, 6, -4, 8, 9, -1, 8 ];
+    var xs_ = [];
+    
+    var ch = Chainsaw(function (saw) {
+        this.x = function (i) {
+            xs_.push(i);
+            saw.next();
+        };
+        
+        this.y = function (step) {
+            var x = xs.shift();
+            if (x > 0) saw.jump(step);
+            else saw.next();
+        };
+        
+        saw.on('end', function () {
+            clearTimeout(to);
+            assert.eql(xs, [ 8 ]);
+            assert.eql(xs_, [ 1, 1, 1, 1, 2, 3, 2, 3, 2, 3 ]);
+        });
+    });
+    
+    ch
+        .x(1)
+        .y(0)
+        .x(2)
+        .x(3)
+        .y(2)
+    ;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/package.json
new file mode 100755 (executable)
index 0000000..89e21bb
--- /dev/null
@@ -0,0 +1,70 @@
+{
+  "name": "binary",
+  "version": "0.3.0",
+  "description": "Unpack multibyte binary values from buffers",
+  "main": "./index.js",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/substack/node-binary.git"
+  },
+  "keywords": [
+    "binary",
+    "decode",
+    "endian",
+    "unpack",
+    "signed",
+    "unsigned"
+  ],
+  "author": {
+    "name": "James Halliday",
+    "email": "mail@substack.net",
+    "url": "http://substack.net"
+  },
+  "dependencies": {
+    "chainsaw": "~0.1.0",
+    "buffers": "~0.1.1"
+  },
+  "devDependencies": {
+    "seq": "~0.2.5",
+    "tap": "~0.2.4"
+  },
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "license": "MIT",
+  "engine": {
+    "node": ">=0.4.0"
+  },
+  "_npmUser": {
+    "name": "substack",
+    "email": "mail@substack.net"
+  },
+  "_id": "binary@0.3.0",
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.1.19",
+  "_nodeVersion": "v0.6.11",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "9f60553bc5ce8c3386f3b553cff47462adecaa79",
+    "tarball": "http://registry.npmjs.org/binary/-/binary-0.3.0.tgz"
+  },
+  "readme": "ERROR: No README data found!",
+  "maintainers": [
+    {
+      "name": "substack",
+      "email": "mail@substack.net"
+    }
+  ],
+  "directories": {},
+  "_shasum": "9f60553bc5ce8c3386f3b553cff47462adecaa79",
+  "_from": "binary@^0.3.0",
+  "_resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz",
+  "bugs": {
+    "url": "https://github.com/substack/node-binary/issues"
+  },
+  "homepage": "https://github.com/substack/node-binary"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/perf/loop.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/perf/loop.js
new file mode 100755 (executable)
index 0000000..bec60a8
--- /dev/null
@@ -0,0 +1,92 @@
+var Seq = require('seq');
+var Hash = require('hashish');
+var EventEmitter = require('events').EventEmitter;
+
+var Bin = require('binary');
+var Buf = require('bufferlist/binary');
+var BufferList = require('bufferlist');
+
+console.log('loop');
+function emitter () {
+    var em = new EventEmitter;
+    
+    var i = 0;
+    var iv = setInterval(function () {
+        var buf = new Buffer(10000);
+        buf[0] = 0xff;
+        
+        if (++ i >= 2000) {
+            buf[0] = 0;
+            clearInterval(iv);
+        }
+        em.emit('data', buf);
+    }, 1);
+    
+    return em;
+}
+
+Seq()
+    .seq(function () {
+        var next = this.bind({}, null);
+        bufferlist(next);
+    })
+    .seq(function () {
+        var next = this.bind({}, null);
+        binary(next);
+    })
+;
+
+function binary (next) {
+    var em = emitter();
+    var t0 = Date.now();
+    
+    Bin(em)
+        .loop(function (end) {
+            this
+            .word8('x')
+            .word8('y')
+            .word32be('z')
+            .word32le('w')
+            .buffer('buf', 10000 - 10)
+            .tap(function (vars) {
+                if (vars.x === 0) {
+                    var tf = Date.now();
+                    console.log('    binary: ' + (tf - t0) + ' ms');
+                    end();
+                    setTimeout(next, 20);
+                }
+            })
+        })
+    ;
+}
+
+function bufferlist (next) {
+    var em = emitter();
+    var t0 = Date.now();
+    
+    var blist = new BufferList;
+    em.on('data', function (buf) {
+        blist.push(buf);
+    });
+    
+    Buf(blist)
+        .forever(function () {
+            var top = this;
+            this
+            .getWord8('x')
+            .getWord8('y')
+            .getWord32be('z')
+            .getWord32le('w')
+            .getBuffer('buf', 10000 - 10)
+            .tap(function (vars) {
+                if (vars.x === 0) {
+                    var tf = Date.now();
+                    console.log('    bufferlist: ' + (tf - t0) + ' ms');
+                    top.exit();
+                    setTimeout(next, 20);
+                }
+            })
+        })
+        .end()
+    ;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/perf/small.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/perf/small.js
new file mode 100755 (executable)
index 0000000..2a5ed52
--- /dev/null
@@ -0,0 +1,80 @@
+var Seq = require('seq');
+var Hash = require('hashish');
+
+var Bin = require('binary');
+var Buf = require('bufferlist/binary');
+var BufferList = require('bufferlist');
+var EventEmitter = require('events').EventEmitter;
+
+function binary (buf, cb) {
+    Bin(buf)
+        .word32le('x')
+        .word16be('y')
+        .word16be('z')
+        .word32le('w')
+        .tap(cb)
+    ;
+};
+
+function stream (buf, cb) {
+    var em = new EventEmitter;
+    Bin(em)
+        .word32le('x')
+        .word16be('y')
+        .word16be('z')
+        .word32le('w')
+        .tap(cb)
+    ;
+    em.emit('data', buf);
+};
+
+function parse (buf, cb) {
+    cb(Bin.parse(buf)
+        .word32le('x')
+        .word16be('y')
+        .word16be('z')
+        .word32le('w')
+        .vars
+    );
+};
+
+function bufferlist (buf, cb) {
+    var blist = new BufferList;
+    blist.push(buf);
+    Buf(blist)
+        .getWord32le('x')
+        .getWord16be('y')
+        .getWord16be('z')
+        .getWord32le('w')
+        .tap(cb)
+        .end()
+    ;
+};
+
+
+var buffers = [];
+for (var i = 0; i < 200; i++) {
+    buffers.push(new Buffer(12));
+}
+
+console.log('small');
+Seq(binary, stream, parse, bufferlist)
+    .seqEach(function (f) {
+        var t = this;
+        var t0 = Date.now();
+        Seq()
+            .extend(buffers)
+            .seqEach(function (buf) {
+                f(buf, this.bind(this, null));
+            })
+            .seq(function () {
+                var tf = Date.now();
+                console.log('    ' + f.name + ': ' + (tf - t0));
+                t(null);
+            })
+        ;
+    })
+    .seq(function () {
+        this(null);
+    })
+;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/bu.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/bu.js
new file mode 100755 (executable)
index 0000000..d557e3c
--- /dev/null
@@ -0,0 +1,46 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('bu', function (t) {
+    t.plan(8);
+    
+    // note: can't store -12667700813876161 exactly in an ieee float
+    
+    var buf = new Buffer([
+        44, // a == 44
+        2, 43, // b == 555
+        164, 213, 37, 37, // c == 2765432101
+        29, 81, 180, 20, 155, 115, 203, 193, // d == 2112667700813876161
+    ]);
+    
+    binary.parse(buf)
+        .word8bu('a')
+        .word16bu('b')
+        .word32bu('c')
+        .word64bu('d')
+        .tap(function (vars) {
+            t.same(vars.a, 44);
+            t.same(vars.b, 555);
+            t.same(vars.c, 2765432101);
+            t.ok(
+                Math.abs(vars.d - 2112667700813876161) < 1500
+            );
+        })
+    ;
+    
+    // also check aliases here:
+    binary.parse(buf)
+        .word8be('a')
+        .word16be('b')
+        .word32be('c')
+        .word64be('d')
+        .tap(function (vars) {
+            t.same(vars.a, 44);
+            t.same(vars.b, 555);
+            t.same(vars.c, 2765432101);
+            t.ok(
+                Math.abs(vars.d - 2112667700813876161) < 1500
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/deferred.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/deferred.js
new file mode 100755 (executable)
index 0000000..52623f7
--- /dev/null
@@ -0,0 +1,20 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('deferred', function (t) {
+    t.plan(1);
+    
+    var em = new EventEmitter;
+    binary.stream(em)
+        .word8('a')
+        .word16be('bc')
+        .tap(function (vars) {
+            t.same(vars, { a : 97, bc : 25187 });
+        })
+    ;
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 97, 98, 99 ]));
+    }, 10);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/dots.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/dots.js
new file mode 100755 (executable)
index 0000000..f730eb3
--- /dev/null
@@ -0,0 +1,23 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('dots', function (t) {
+    t.plan(1);
+    
+    binary.parse(new Buffer([ 97, 98, 99, 100, 101, 102 ]))
+        .word8('a')
+        .word16be('b.x')
+        .word16be('b.y')
+        .word8('b.z')
+        .tap(function (vars) {
+            t.same(vars, {
+                a : 97,
+                b : {
+                    x : 256 * 98 + 99,
+                    y : 256 * 100 + 101,
+                    z : 102
+                },
+            });
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/eof.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/eof.js
new file mode 100755 (executable)
index 0000000..e5268ff
--- /dev/null
@@ -0,0 +1,41 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('eof', function (t) {
+    t.plan(4);
+    
+    var stream = new EventEmitter;
+    binary.stream(stream)
+        .buffer('sixone', 5)
+        .peek(function () {
+            this.word32le('len');
+        })
+        .buffer('buf', 'len')
+        .word8('x')
+        .tap(function (vars) {
+            t.same(
+                [].slice.call(vars.sixone),
+                [].slice.call(new Buffer([ 6, 1, 6, 1, 6 ]))
+            );
+            t.same(vars.buf.length, vars.len);
+            t.same(
+                [].slice.call(vars.buf),
+                [ 9, 0, 0, 0, 97, 98, 99, 100, 101 ]
+            );
+            t.same(vars.x, 102);
+        })
+    ;
+    
+    var bufs = [
+        new Buffer([ 6, 1, 6, 1, 6, 9, 0, 0, 0, 97 ]),
+        new Buffer([ 98, 99 ]),
+        new Buffer([ 100, 101, 102 ]),
+    ];
+    
+    bufs.forEach(function (buf) {
+        stream.emit('data', buf);
+    });
+    
+    stream.emit('end');
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/flush.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/flush.js
new file mode 100755 (executable)
index 0000000..b9c0dde
--- /dev/null
@@ -0,0 +1,17 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('flush', function (t) {
+    t.plan(1);
+    
+    binary.parse(new Buffer([ 97, 98, 99, 100, 101, 102 ]))
+        .word8('a')
+        .word16be('b')
+        .word16be('c')
+        .flush()
+        .word8('d')
+        .tap(function (vars) {
+            t.same(vars, { d : 102 });
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/from_buffer.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/from_buffer.js
new file mode 100755 (executable)
index 0000000..b5061e7
--- /dev/null
@@ -0,0 +1,14 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('from buffer', function (t) {
+    t.plan(1);
+    
+    binary(new Buffer([ 97, 98, 99 ]))
+        .word8('a')
+        .word16be('bc')
+        .tap(function (vars) {
+            t.same(vars, { a : 97, bc : 25187 });
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/get_buffer.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/get_buffer.js
new file mode 100755 (executable)
index 0000000..1c62192
--- /dev/null
@@ -0,0 +1,28 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('get buffer', function (t) {
+    t.plan(4);
+    
+    var buf = new Buffer([ 4, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]);
+    binary.parse(buf)
+        .word8('a')
+        .buffer('b', 7)
+        .word16lu('c')
+        .tap(function (vars) {
+            t.equal(vars.a, 4);
+            t.equal(
+                vars.b.toString(), 
+                new Buffer([ 2, 3, 4, 5, 6, 7, 8 ]).toString()
+            );
+            t.equal(vars.c, 2569);
+        })
+        .buffer('d', 'a')
+        .tap(function (vars) {
+            t.equal(
+                vars.d.toString(),
+                new Buffer([ 11, 12, 13, 14 ]).toString()
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/immediate.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/immediate.js
new file mode 100755 (executable)
index 0000000..1f0ea77
--- /dev/null
@@ -0,0 +1,18 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('immediate', function (t) {
+    t.plan(1);
+    
+    var em = new EventEmitter;
+    binary.stream(em, 'moo')
+        .word8('a')
+        .word16be('bc')
+        .tap(function (vars) {
+            t.same(vars, { a : 97, bc : 25187 });
+        })
+    ;
+    
+    em.emit('moo', new Buffer([ 97, 98, 99 ]));
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/interval.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/interval.js
new file mode 100755 (executable)
index 0000000..b17c0cb
--- /dev/null
@@ -0,0 +1,38 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('interval', function (t) {
+    t.plan(1);
+    
+    var em = new EventEmitter;
+    var i = 0;
+    var iv = setInterval(function () {
+        var buf = new Buffer(1000);
+        buf[0] = 0xff;
+        if (++i >= 1000) {
+            clearInterval(iv);
+            buf[0] = 0;
+        }
+        em.emit('data', buf);
+    }, 1);
+    
+    var loops = 0;
+    binary(em)
+        .loop(function (end) {
+            this
+            .word8('x')
+            .word8('y')
+            .word32be('z')
+            .word32le('w')
+            .buffer('buf', 1000 - 10)
+            .tap(function (vars) {
+                loops ++;
+                if (vars.x == 0) end();
+            })
+        })
+        .tap(function () {
+            t.same(loops, 1000);
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/into_buffer.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/into_buffer.js
new file mode 100755 (executable)
index 0000000..10d3d4a
--- /dev/null
@@ -0,0 +1,35 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('intoBuffer', function (t) {
+    t.plan(3);
+    var buf = new Buffer([ 1, 2, 3, 4, 5, 6 ])
+    
+    binary.parse(buf)
+        .into('moo', function () {
+            this
+                .word8('x')
+                .word8('y')
+                .word8('z')
+            ;
+        })
+        .tap(function (vars) {
+            t.same(vars, { moo : { x : 1, y : 2, z : 3 } });
+        })
+        .word8('w')
+        .tap(function (vars) {
+            t.same(vars, {
+                moo : { x : 1, y : 2, z : 3 },
+                w : 4,
+            });
+        })
+        .word8('x')
+        .tap(function (vars) {
+            t.same(vars, {
+                moo : { x : 1, y : 2, z : 3 },
+                w : 4,
+                x : 5,
+            });
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/into_stream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/into_stream.js
new file mode 100755 (executable)
index 0000000..db77092
--- /dev/null
@@ -0,0 +1,43 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('into stream', function (t) {
+    t.plan(3);
+    
+    var digits = [ 1, 2, 3, 4, 5, 6 ];
+    var stream = new EventEmitter;
+    var iv = setInterval(function () {
+        var d = digits.shift();
+        if (d) stream.emit('data', new Buffer([ d ]))
+        else clearInterval(iv)
+    }, 20);
+    
+    binary.stream(stream)
+        .into('moo', function () {
+            this
+                .word8('x')
+                .word8('y')
+                .word8('z')
+            ;
+        })
+        .tap(function (vars) {
+            t.same(vars, { moo : { x : 1, y : 2, z : 3 } });
+        })
+        .word8('w')
+        .tap(function (vars) {
+            t.same(vars, {
+                moo : { x : 1, y : 2, z : 3 },
+                w : 4,
+            });
+        })
+        .word8('x')
+        .tap(function (vars) {
+            t.same(vars, {
+                moo : { x : 1, y : 2, z : 3 },
+                w : 4,
+                x : 5,
+            });
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/loop.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/loop.js
new file mode 100755 (executable)
index 0000000..74576a9
--- /dev/null
@@ -0,0 +1,44 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('loop', function (t) {
+    t.plan(3 * 2 + 1);
+    
+    var em = new EventEmitter;
+    
+    binary.stream(em)
+        .loop(function (end, vars) {
+            t.strictEqual(vars, this.vars);
+            this
+                .word16lu('a')
+                .word8u('b')
+                .word8s('c')
+                .tap(function (vars_) {
+                    t.strictEqual(vars, vars_);
+                    if (vars.c < 0) end();
+                })
+            ;
+        })
+        .tap(function (vars) {
+            t.same(vars, { a : 1337, b : 55, c : -5 });
+        })
+    ;
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 2, 10, 88 ]));
+    }, 10);
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 100, 3, 6, 242, 30 ]));
+    }, 20);
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 60, 60, 199, 44 ]));
+    }, 30);
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 57, 5 ]));
+    }, 80);
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 55, 251 ]));
+    }, 90);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/loop_scan.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/loop_scan.js
new file mode 100755 (executable)
index 0000000..394603a
--- /dev/null
@@ -0,0 +1,54 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('loop scan', function (t) {
+    t.plan(8 + 6 + 2);
+    
+    var em = new EventEmitter;
+    
+    binary.stream(em)
+        .loop(function (end) {
+            var vars_ = this.vars;
+            this
+                .scan('filler', 'BEGINMSG')
+                .buffer('cmd', 3)
+                .word8('num')
+                .tap(function (vars) {
+                    t.strictEqual(vars, vars_);
+                    if (vars.num != 0x02 && vars.num != 0x06) {
+                        t.same(vars.filler.length, 0);
+                    }
+                    if (vars.cmd.toString() == 'end') end();
+                })
+            ;
+        })
+        .tap(function (vars) {
+            t.same(vars.cmd.toString(), 'end');
+                       t.same(vars.num, 0x08);
+        })
+    ;
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer(
+            'BEGINMSGcmd\x01'
+            + 'GARBAGEDATAXXXX'
+            + 'BEGINMSGcmd\x02'
+            + 'BEGINMSGcmd\x03'
+        ));
+    }, 10);
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer(
+            'BEGINMSGcmd\x04'
+            + 'BEGINMSGcmd\x05'
+            + 'GARBAGEDATAXXXX'
+            + 'BEGINMSGcmd\x06'
+        ));
+        em.emit('data', new Buffer('BEGINMSGcmd\x07'));
+    }, 20);
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer('BEGINMSGend\x08'));
+    }, 30);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/lu.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/lu.js
new file mode 100755 (executable)
index 0000000..8d3e9e7
--- /dev/null
@@ -0,0 +1,46 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('lu', function (t) {
+    t.plan(8);
+    
+    // note: can't store -12667700813876161 exactly in an ieee float
+    
+    var buf = new Buffer([
+        44, // a == 44
+        43, 2, // b == 555
+        37, 37, 213, 164, // c == 2765432101
+        193, 203, 115, 155, 20, 180, 81, 29, // d == 2112667700813876161
+    ]);
+    
+    binary.parse(buf)
+        .word8lu('a')
+        .word16lu('b')
+        .word32lu('c')
+        .word64lu('d')
+        .tap(function (vars) {
+            t.same(vars.a, 44);
+            t.same(vars.b, 555);
+            t.same(vars.c, 2765432101);
+            t.ok(
+                Math.abs(vars.d - 2112667700813876161) < 1500
+            );
+        })
+    ;
+    
+    // also check aliases here:
+    binary.parse(buf)
+        .word8le('a')
+        .word16le('b')
+        .word32le('c')
+        .word64le('d')
+        .tap(function (vars) {
+            t.same(vars.a, 44);
+            t.same(vars.b, 555);
+            t.same(vars.c, 2765432101);
+            t.ok(
+                Math.abs(vars.d - 2112667700813876161) < 1500
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/negbs.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/negbs.js
new file mode 100755 (executable)
index 0000000..dd23a9a
--- /dev/null
@@ -0,0 +1,29 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('negbs', function (t) {
+    t.plan(4);
+    // note: can't store -12667700813876161 exactly in an ieee float
+    
+    var buf = new Buffer([
+        226, // a == -30
+        246, 219, // b == -2341
+        255, 243, 245, 236, // c == -789012
+        255, 210, 254, 203, 16, 222, 52, 63, // d == -12667700813876161
+    ]);
+    
+    binary.parse(buf)
+        .word8bs('a')
+        .word16bs('b')
+        .word32bs('c')
+        .word64bs('d')
+        .tap(function (vars) {
+            t.same(vars.a, -30);
+            t.same(vars.b, -2341);
+            t.same(vars.c, -789012);
+            t.ok(
+                Math.abs(vars.d - -12667700813876161) < 1500
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/negls.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/negls.js
new file mode 100755 (executable)
index 0000000..2a229f4
--- /dev/null
@@ -0,0 +1,29 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('negls', function (t) {
+    t.plan(4);
+    // note: can't store -12667700813876161 exactly in an ieee float
+    
+    var buf = new Buffer([
+        226, // a == -30
+        219, 246, // b == -2341
+        236, 245, 243, 255, // c == -789012
+        63, 52, 222, 16, 203, 254, 210, 255, // d == -12667700813876161
+    ]);
+    
+    binary.parse(buf)
+        .word8ls('a')
+        .word16ls('b')
+        .word32ls('c')
+        .word64ls('d')
+        .tap(function (vars) {
+            t.same(vars.a, -30);
+            t.same(vars.b, -2341);
+            t.same(vars.c, -789012);
+            t.ok(
+                Math.abs(vars.d - -12667700813876161) < 1000
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/nested.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/nested.js
new file mode 100755 (executable)
index 0000000..869d51c
--- /dev/null
@@ -0,0 +1,35 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('nested', function (t) {
+    t.plan(3);
+    var insideDone = false;
+    
+    var em = new EventEmitter;
+    binary.stream(em)
+        .word16be('ab')
+        .tap(function () {
+            this
+                .word8('c')
+                .word8('d')
+                .tap(function () {
+                    insideDone = true;
+                })
+            ;
+        })
+        .tap(function (vars) {
+            t.ok(insideDone);
+            t.same(vars.c, 'c'.charCodeAt(0));
+            t.same(vars.d, 'd'.charCodeAt(0));
+            
+        })
+    ;
+    
+    var strs = [ 'abc', 'def', 'hi', 'jkl' ];
+    var iv = setInterval(function () {
+        var s = strs.shift();
+        if (s) em.emit('data', new Buffer(s));
+        else clearInterval(iv);
+    }, 50);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/not_enough_buf.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/not_enough_buf.js
new file mode 100755 (executable)
index 0000000..bbf8fff
--- /dev/null
@@ -0,0 +1,17 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('not enough buf', function (t) {
+    t.plan(3);
+    
+    var vars = binary(new Buffer([1,2,3,4]))
+        .word8('a')
+        .buffer('b', 10)
+        .word8('c')
+        .vars
+    ;
+    
+    t.same(vars.a, 1);
+    t.equal(vars.b.toString(), new Buffer([2,3,4]).toString());
+    t.strictEqual(vars.c, null);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/not_enough_parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/not_enough_parse.js
new file mode 100755 (executable)
index 0000000..f9a32e2
--- /dev/null
@@ -0,0 +1,19 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('not enough parse', function (t) {
+    t.plan(4);
+    
+    var vars = binary(new Buffer([1,2]))
+        .word8('a')
+        .word8('b')
+        .word8('c')
+        .word8('d')
+        .vars
+    ;
+    
+    t.same(vars.a, 1);
+    t.same(vars.b, 2);
+    t.strictEqual(vars.c, null);
+    t.strictEqual(vars.d, null);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/parse.js
new file mode 100755 (executable)
index 0000000..fbc9f5b
--- /dev/null
@@ -0,0 +1,54 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('parse', function (t) {
+    t.plan(6);
+    var res = binary.parse(new Buffer([ 97, 98, 99, 99, 99, 99, 1, 2, 3 ]))
+        .word8('a')
+        .word16be('bc')
+        .skip(3)
+        .buffer('def', 3)
+        .tap(function (vars) {
+            t.equal(vars.a, 97);
+            t.equal(vars.bc, 25187);
+            t.same(
+                [].slice.call(vars.def),
+                [].slice.call(new Buffer([ 1, 2, 3]))
+            );
+        })
+        .vars
+    ;
+    t.equal(res.a, 97);
+    t.equal(res.bc, 25187);
+    t.same(
+        [].slice.call(res.def),
+        [].slice.call(new Buffer([ 1, 2, 3 ]))
+    );
+});
+
+test('loop', function (t) {
+    t.plan(2);
+    var res = binary.parse(new Buffer([ 97, 98, 99, 4, 5, 2, -3, 9 ]))
+        .word8('a')
+        .word16be('bc')
+        .loop(function (end) {
+            var x = this.word8s('x').vars.x;
+            if (x < 0) end();
+        })
+        .tap(function (vars) {
+            t.same(vars, {
+                a : 97,
+                bc : 25187,
+                x : -3,
+            });
+        })
+        .word8('y')
+        .vars
+    ;
+    t.same(res, {
+        a : 97,
+        bc : 25187,
+        x : -3,
+        y : 9,
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/peek.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/peek.js
new file mode 100755 (executable)
index 0000000..00109d3
--- /dev/null
@@ -0,0 +1,40 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('peek', function (t) {
+    t.plan(4);
+    var bufs = [
+        new Buffer([ 6, 1, 6, 1, 6, 9, 0, 0, 0, 97 ]),
+        new Buffer([ 98, 99 ]),
+        new Buffer([ 100, 101, 102 ]),
+    ];
+    
+    var stream = new EventEmitter;
+    var iv = setInterval(function () {
+        var buf = bufs.shift();
+        if (buf) stream.emit('data', buf)
+        else clearInterval(iv)
+    }, 20);
+    
+    binary.stream(stream)
+        .buffer('sixone', 5)
+        .peek(function () {
+            this.word32le('len');
+        })
+        .buffer('buf', 'len')
+        .word8('x')
+        .tap(function (vars) {
+            t.same(
+                [].slice.call(vars.sixone),
+                [].slice.call(new Buffer([ 6, 1, 6, 1, 6 ]))
+            );
+            t.same(vars.buf.length, vars.len);
+            t.same(
+                [].slice.call(vars.buf),
+                [ 9, 0, 0, 0, 97, 98, 99, 100, 101 ]
+            );
+            t.same(vars.x, 102);
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/pipe.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/pipe.js
new file mode 100755 (executable)
index 0000000..7c260cd
--- /dev/null
@@ -0,0 +1,49 @@
+var binary = require('../');
+var test = require('tap').test;
+var Stream = require('stream').Stream;
+
+test('loop', function (t) {
+    t.plan(3 * 2 + 1);
+    
+    var rs = new Stream;
+    rs.readable = true;
+    
+    var ws = binary()
+        .loop(function (end, vars) {
+            t.strictEqual(vars, this.vars);
+            this
+                .word16lu('a')
+                .word8u('b')
+                .word8s('c')
+                .tap(function (vars_) {
+                    t.strictEqual(vars, vars_);
+                    if (vars.c < 0) end();
+                })
+            ;
+        })
+        .tap(function (vars) {
+            t.same(vars, { a : 1337, b : 55, c : -5 });
+        })
+    ;
+    rs.pipe(ws);
+    
+    setTimeout(function () {
+        rs.emit('data', new Buffer([ 2, 10, 88 ]));
+    }, 10);
+    setTimeout(function () {
+        rs.emit('data', new Buffer([ 100, 3, 6, 242, 30 ]));
+    }, 20);
+    setTimeout(function () {
+        rs.emit('data', new Buffer([ 60, 60, 199, 44 ]));
+    }, 30);
+    
+    setTimeout(function () {
+        rs.emit('data', new Buffer([ 57, 5 ]));
+    }, 80);
+    setTimeout(function () {
+        rs.emit('data', new Buffer([ 55, 251 ]));
+    }, 90);
+    setTimeout(function () {
+        rs.emit('end');
+    }, 100);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/posbs.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/posbs.js
new file mode 100755 (executable)
index 0000000..0642948
--- /dev/null
@@ -0,0 +1,29 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('posbs', function (t) {
+    t.plan(4);
+    // note: can't store 12667700813876161 exactly in an ieee float
+    
+    var buf = new Buffer([
+        30, // a == -30
+        9, 37, // b == -2341
+        0, 12, 10, 20, // c == -789012
+        0, 45, 1, 52, 239, 33, 203, 193, // d == 12667700813876161
+    ]);
+    
+    binary.parse(buf)
+        .word8bs('a')
+        .word16bs('b')
+        .word32bs('c')
+        .word64bs('d')
+        .tap(function (vars) {
+            t.same(vars.a, 30);
+            t.same(vars.b, 2341);
+            t.same(vars.c, 789012);
+            t.ok(
+                Math.abs(vars.d - 12667700813876161) < 1000
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/posls.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/posls.js
new file mode 100755 (executable)
index 0000000..2b8f208
--- /dev/null
@@ -0,0 +1,29 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('posls', function (t) {
+    t.plan(4);
+    
+    // note: can't store 12667700813876161 exactly in an ieee float
+    var buf = new Buffer([
+        30, // a == -30
+        37, 9, // b == -2341
+        20, 10, 12, 0, // c == -789012
+        193, 203, 33, 239, 52, 1, 45, 0, // d == 12667700813876161
+    ]);
+    
+    binary.parse(buf)
+        .word8ls('a')
+        .word16ls('b')
+        .word32ls('c')
+        .word64ls('d')
+        .tap(function (vars) {
+            t.same(vars.a, 30);
+            t.same(vars.b, 2341);
+            t.same(vars.c, 789012);
+            t.ok(
+                Math.abs(vars.d - 12667700813876161) < 1000
+            );
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan.js
new file mode 100755 (executable)
index 0000000..6acf2b2
--- /dev/null
@@ -0,0 +1,33 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('scan', function (t) {
+    t.plan(4);
+    
+    var em = new EventEmitter;
+    binary(em)
+        .word8('a')
+        .scan('l1', new Buffer('\r\n'))
+        .scan('l2', '\r\n')
+        .word8('z')
+        .tap(function (vars) {
+            t.same(vars.a, 99);
+            t.same(vars.l1.toString(), 'foo bar');
+            t.same(vars.l2.toString(), 'baz');
+            t.same(vars.z, 42);
+        })
+    ;
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer([99,0x66,0x6f,0x6f,0x20]));
+    }, 20);
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer('bar\r'));
+    }, 40);
+    
+    setTimeout(function () {
+        em.emit('data', new Buffer('\nbaz\r\n*'));
+    }, 60);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan_buf.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan_buf.js
new file mode 100755 (executable)
index 0000000..5e975c8
--- /dev/null
@@ -0,0 +1,18 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('scan buf', function (t) {
+    t.plan(4);
+    
+    var vars = binary(new Buffer('\x63foo bar\r\nbaz\r\n*'))
+        .word8('a')
+        .scan('l1', new Buffer('\r\n'))
+        .scan('l2', '\r\n')
+        .word8('z')
+        .vars
+    ;
+    t.same(vars.a, 99);
+    t.same(vars.z, 42);
+    t.same(vars.l1.toString(), 'foo bar');
+    t.same(vars.l2.toString(), 'baz');
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan_buf_null.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/scan_buf_null.js
new file mode 100755 (executable)
index 0000000..96d9767
--- /dev/null
@@ -0,0 +1,16 @@
+var binary = require('../');
+var test = require('tap').test;
+
+test('scan buf null', function (t) {
+    t.plan(3);
+    var vars = binary(new Buffer('\x63foo bar baz'))
+        .word8('a')
+        .scan('b', '\r\n')
+        .word8('c')
+        .vars
+    ;
+    
+    t.same(vars.a, 99);
+    t.same(vars.b.toString(), 'foo bar baz');
+    t.strictEqual(vars.c, null);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/skip.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/skip.js
new file mode 100755 (executable)
index 0000000..6a26051
--- /dev/null
@@ -0,0 +1,58 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+var seq = require('seq');
+
+test('skip', function (t) {
+    t.plan(7);
+    var em = new EventEmitter;
+    var state = 0;
+    
+    binary(em)
+        .word16lu('a')
+        .tap(function () { state = 1 })
+        .skip(7)
+        .tap(function () { state = 2 })
+        .word8('b')
+        .tap(function () { state = 3 })
+        .tap(function (vars) {
+            t.same(state, 3);
+            t.same(vars, {
+                a : 2569,
+                b : 8,
+            });
+        })
+    ;
+    
+    seq()
+        .seq(setTimeout, seq, 20)
+        .seq(function () {
+            t.same(state, 0);
+            em.emit('data', new Buffer([ 9 ]));
+            this(null);
+        })
+        .seq(setTimeout, seq, 5)
+        .seq(function () {
+            t.same(state, 0);
+            em.emit('data', new Buffer([ 10, 1, 2 ]));
+            this(null);
+        })
+        .seq(setTimeout, seq, 30)
+        .seq(function () {
+            t.same(state, 1);
+            em.emit('data', new Buffer([ 3, 4, 5 ]));
+            this(null);
+        })
+        .seq(setTimeout, seq, 15)
+        .seq(function () {
+            t.same(state, 1);
+            em.emit('data', new Buffer([ 6, 7 ]));
+            this(null);
+        })
+        .seq(function () {
+            t.same(state, 2);
+            em.emit('data', new Buffer([ 8 ]));
+            this(null);
+        })
+    ;
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/split.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/binary/test/split.js
new file mode 100755 (executable)
index 0000000..cb9dffc
--- /dev/null
@@ -0,0 +1,34 @@
+var binary = require('../');
+var test = require('tap').test;
+var EventEmitter = require('events').EventEmitter;
+
+test('split', function (t) {
+    t.plan(1);
+    
+    var em = new EventEmitter;
+    binary.stream(em)
+        .word8('a')
+        .word16be('bc')
+        .word32ls('x')
+        .word32bs('y')
+        .tap(function (vars) {
+            t.same(vars, {
+                a : 97,
+                bc : 25187,
+                x : 621609828,
+                y : 621609828,
+            });
+        })
+    ;
+    
+    em.emit('data', new Buffer([ 97, 98 ]));
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 99, 100 ]));
+    }, 25);
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 3, 13, 37, 37 ]));
+    }, 30);
+    setTimeout(function () {
+        em.emit('data', new Buffer([ 13, 3, 100 ]));
+    }, 40);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/LICENSE
new file mode 100755 (executable)
index 0000000..0c44ae7
--- /dev/null
@@ -0,0 +1,27 @@
+Copyright (c) Isaac Z. Schlueter ("Author")
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/README.md
new file mode 100755 (executable)
index 0000000..13a2e86
--- /dev/null
@@ -0,0 +1,36 @@
+# graceful-fs
+
+graceful-fs functions as a drop-in replacement for the fs module,
+making various improvements.
+
+The improvements are meant to normalize behavior across different
+platforms and environments, and to make filesystem access more
+resilient to errors.
+
+## Improvements over [fs module](http://api.nodejs.org/fs.html)
+
+graceful-fs:
+
+* Queues up `open` and `readdir` calls, and retries them once
+  something closes if there is an EMFILE error from too many file
+  descriptors.
+* fixes `lchmod` for Node versions prior to 0.6.2.
+* implements `fs.lutimes` if possible. Otherwise it becomes a noop.
+* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
+  `lchown` if the user isn't root.
+* makes `lchmod` and `lchown` become noops, if not available.
+* retries reading a file if `read` results in EAGAIN error.
+
+On Windows, it retries renaming a file for up to one second if `EACCESS`
+or `EPERM` error occurs, likely because antivirus software has locked
+the directory.
+
+## USAGE
+
+```javascript
+// use just like fs
+var fs = require('graceful-fs')
+
+// now go and do stuff with it...
+fs.readFileSync('some-file-or-whatever')
+```
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/fs.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/fs.js
new file mode 100755 (executable)
index 0000000..64ad980
--- /dev/null
@@ -0,0 +1,11 @@
+// eeeeeevvvvviiiiiiillllll
+// more evil than monkey-patching the native builtin?
+// Not sure.
+
+var mod = require("module")
+var pre = '(function (exports, require, module, __filename, __dirname) { '
+var post = '});'
+var src = pre + process.binding('natives').fs + post
+var vm = require('vm')
+var fn = vm.runInThisContext(src)
+fn(exports, require, module, __filename, __dirname)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/graceful-fs.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/graceful-fs.js
new file mode 100755 (executable)
index 0000000..77fc702
--- /dev/null
@@ -0,0 +1,158 @@
+// Monkey-patching the fs module.
+// It's ugly, but there is simply no other way to do this.
+var fs = module.exports = require('./fs.js')
+
+var assert = require('assert')
+
+// fix up some busted stuff, mostly on windows and old nodes
+require('./polyfills.js')
+
+var util = require('util')
+
+function noop () {}
+
+var debug = noop
+if (util.debuglog)
+  debug = util.debuglog('gfs')
+else if (/\bgfs\b/i.test(process.env.NODE_DEBUG || ''))
+  debug = function() {
+    var m = util.format.apply(util, arguments)
+    m = 'GFS: ' + m.split(/\n/).join('\nGFS: ')
+    console.error(m)
+  }
+
+if (/\bgfs\b/i.test(process.env.NODE_DEBUG || '')) {
+  process.on('exit', function() {
+    debug('fds', fds)
+    debug(queue)
+    assert.equal(queue.length, 0)
+  })
+}
+
+
+var originalOpen = fs.open
+fs.open = open
+
+function open(path, flags, mode, cb) {
+  if (typeof mode === "function") cb = mode, mode = null
+  if (typeof cb !== "function") cb = noop
+  new OpenReq(path, flags, mode, cb)
+}
+
+function OpenReq(path, flags, mode, cb) {
+  this.path = path
+  this.flags = flags
+  this.mode = mode
+  this.cb = cb
+  Req.call(this)
+}
+
+util.inherits(OpenReq, Req)
+
+OpenReq.prototype.process = function() {
+  originalOpen.call(fs, this.path, this.flags, this.mode, this.done)
+}
+
+var fds = {}
+OpenReq.prototype.done = function(er, fd) {
+  debug('open done', er, fd)
+  if (fd)
+    fds['fd' + fd] = this.path
+  Req.prototype.done.call(this, er, fd)
+}
+
+
+var originalReaddir = fs.readdir
+fs.readdir = readdir
+
+function readdir(path, cb) {
+  if (typeof cb !== "function") cb = noop
+  new ReaddirReq(path, cb)
+}
+
+function ReaddirReq(path, cb) {
+  this.path = path
+  this.cb = cb
+  Req.call(this)
+}
+
+util.inherits(ReaddirReq, Req)
+
+ReaddirReq.prototype.process = function() {
+  originalReaddir.call(fs, this.path, this.done)
+}
+
+ReaddirReq.prototype.done = function(er, files) {
+  if (files && files.sort)
+    files = files.sort()
+  Req.prototype.done.call(this, er, files)
+  onclose()
+}
+
+
+var originalClose = fs.close
+fs.close = close
+
+function close (fd, cb) {
+  debug('close', fd)
+  if (typeof cb !== "function") cb = noop
+  delete fds['fd' + fd]
+  originalClose.call(fs, fd, function(er) {
+    onclose()
+    cb(er)
+  })
+}
+
+
+var originalCloseSync = fs.closeSync
+fs.closeSync = closeSync
+
+function closeSync (fd) {
+  try {
+    return originalCloseSync(fd)
+  } finally {
+    onclose()
+  }
+}
+
+
+// Req class
+function Req () {
+  // start processing
+  this.done = this.done.bind(this)
+  this.failures = 0
+  this.process()
+}
+
+Req.prototype.done = function (er, result) {
+  var tryAgain = false
+  if (er) {
+    var code = er.code
+    var tryAgain = code === "EMFILE"
+    if (process.platform === "win32")
+      tryAgain = tryAgain || code === "OK"
+  }
+
+  if (tryAgain) {
+    this.failures ++
+    enqueue(this)
+  } else {
+    var cb = this.cb
+    cb(er, result)
+  }
+}
+
+var queue = []
+
+function enqueue(req) {
+  queue.push(req)
+  debug('enqueue %d %s', queue.length, req.constructor.name, req)
+}
+
+function onclose() {
+  var req = queue.shift()
+  if (req) {
+    debug('process', req.constructor.name, req)
+    req.process()
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/package.json
new file mode 100755 (executable)
index 0000000..e0bdb3c
--- /dev/null
@@ -0,0 +1,72 @@
+{
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me"
+  },
+  "name": "graceful-fs",
+  "description": "A drop-in replacement for fs, making various improvements.",
+  "version": "3.0.6",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/node-graceful-fs.git"
+  },
+  "main": "graceful-fs.js",
+  "engines": {
+    "node": ">=0.4.0"
+  },
+  "directories": {
+    "test": "test"
+  },
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "keywords": [
+    "fs",
+    "module",
+    "reading",
+    "retry",
+    "retries",
+    "queue",
+    "error",
+    "errors",
+    "handling",
+    "EMFILE",
+    "EAGAIN",
+    "EINVAL",
+    "EPERM",
+    "EACCESS"
+  ],
+  "license": "BSD",
+  "devDependencies": {
+    "mkdirp": "^0.5.0",
+    "rimraf": "^2.2.8",
+    "tap": "^0.4.13"
+  },
+  "gitHead": "8c93aeee947014dafa113dcc8fa04d2e6a6e3e14",
+  "bugs": {
+    "url": "https://github.com/isaacs/node-graceful-fs/issues"
+  },
+  "homepage": "https://github.com/isaacs/node-graceful-fs",
+  "_id": "graceful-fs@3.0.6",
+  "_shasum": "dce3a18351cb94cdc82e688b2e3dd2842d1b09bb",
+  "_from": "graceful-fs@^3.0.0",
+  "_npmVersion": "2.7.1",
+  "_nodeVersion": "1.4.2",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "dist": {
+    "shasum": "dce3a18351cb94cdc82e688b2e3dd2842d1b09bb",
+    "tarball": "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.6.tgz"
+  },
+  "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.6.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/polyfills.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/polyfills.js
new file mode 100755 (executable)
index 0000000..4270539
--- /dev/null
@@ -0,0 +1,255 @@
+var fs = require('./fs.js')
+var constants = require('constants')
+
+var origCwd = process.cwd
+var cwd = null
+process.cwd = function() {
+  if (!cwd)
+    cwd = origCwd.call(process)
+  return cwd
+}
+var chdir = process.chdir
+process.chdir = function(d) {
+  cwd = null
+  chdir.call(process, d)
+}
+
+// (re-)implement some things that are known busted or missing.
+
+// lchmod, broken prior to 0.6.2
+// back-port the fix here.
+if (constants.hasOwnProperty('O_SYMLINK') &&
+    process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
+  fs.lchmod = function (path, mode, callback) {
+    callback = callback || noop
+    fs.open( path
+           , constants.O_WRONLY | constants.O_SYMLINK
+           , mode
+           , function (err, fd) {
+      if (err) {
+        callback(err)
+        return
+      }
+      // prefer to return the chmod error, if one occurs,
+      // but still try to close, and report closing errors if they occur.
+      fs.fchmod(fd, mode, function (err) {
+        fs.close(fd, function(err2) {
+          callback(err || err2)
+        })
+      })
+    })
+  }
+
+  fs.lchmodSync = function (path, mode) {
+    var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
+
+    // prefer to return the chmod error, if one occurs,
+    // but still try to close, and report closing errors if they occur.
+    var err, err2
+    try {
+      var ret = fs.fchmodSync(fd, mode)
+    } catch (er) {
+      err = er
+    }
+    try {
+      fs.closeSync(fd)
+    } catch (er) {
+      err2 = er
+    }
+    if (err || err2) throw (err || err2)
+    return ret
+  }
+}
+
+
+// lutimes implementation, or no-op
+if (!fs.lutimes) {
+  if (constants.hasOwnProperty("O_SYMLINK")) {
+    fs.lutimes = function (path, at, mt, cb) {
+      fs.open(path, constants.O_SYMLINK, function (er, fd) {
+        cb = cb || noop
+        if (er) return cb(er)
+        fs.futimes(fd, at, mt, function (er) {
+          fs.close(fd, function (er2) {
+            return cb(er || er2)
+          })
+        })
+      })
+    }
+
+    fs.lutimesSync = function (path, at, mt) {
+      var fd = fs.openSync(path, constants.O_SYMLINK)
+        , err
+        , err2
+        , ret
+
+      try {
+        var ret = fs.futimesSync(fd, at, mt)
+      } catch (er) {
+        err = er
+      }
+      try {
+        fs.closeSync(fd)
+      } catch (er) {
+        err2 = er
+      }
+      if (err || err2) throw (err || err2)
+      return ret
+    }
+
+  } else if (fs.utimensat && constants.hasOwnProperty("AT_SYMLINK_NOFOLLOW")) {
+    // maybe utimensat will be bound soonish?
+    fs.lutimes = function (path, at, mt, cb) {
+      fs.utimensat(path, at, mt, constants.AT_SYMLINK_NOFOLLOW, cb)
+    }
+
+    fs.lutimesSync = function (path, at, mt) {
+      return fs.utimensatSync(path, at, mt, constants.AT_SYMLINK_NOFOLLOW)
+    }
+
+  } else {
+    fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) }
+    fs.lutimesSync = function () {}
+  }
+}
+
+
+// https://github.com/isaacs/node-graceful-fs/issues/4
+// Chown should not fail on einval or eperm if non-root.
+// It should not fail on enosys ever, as this just indicates
+// that a fs doesn't support the intended operation.
+
+fs.chown = chownFix(fs.chown)
+fs.fchown = chownFix(fs.fchown)
+fs.lchown = chownFix(fs.lchown)
+
+fs.chmod = chownFix(fs.chmod)
+fs.fchmod = chownFix(fs.fchmod)
+fs.lchmod = chownFix(fs.lchmod)
+
+fs.chownSync = chownFixSync(fs.chownSync)
+fs.fchownSync = chownFixSync(fs.fchownSync)
+fs.lchownSync = chownFixSync(fs.lchownSync)
+
+fs.chmodSync = chownFix(fs.chmodSync)
+fs.fchmodSync = chownFix(fs.fchmodSync)
+fs.lchmodSync = chownFix(fs.lchmodSync)
+
+function chownFix (orig) {
+  if (!orig) return orig
+  return function (target, uid, gid, cb) {
+    return orig.call(fs, target, uid, gid, function (er, res) {
+      if (chownErOk(er)) er = null
+      cb(er, res)
+    })
+  }
+}
+
+function chownFixSync (orig) {
+  if (!orig) return orig
+  return function (target, uid, gid) {
+    try {
+      return orig.call(fs, target, uid, gid)
+    } catch (er) {
+      if (!chownErOk(er)) throw er
+    }
+  }
+}
+
+// ENOSYS means that the fs doesn't support the op. Just ignore
+// that, because it doesn't matter.
+//
+// if there's no getuid, or if getuid() is something other
+// than 0, and the error is EINVAL or EPERM, then just ignore
+// it.
+//
+// This specific case is a silent failure in cp, install, tar,
+// and most other unix tools that manage permissions.
+//
+// When running as root, or if other types of errors are
+// encountered, then it's strict.
+function chownErOk (er) {
+  if (!er)
+    return true
+
+  if (er.code === "ENOSYS")
+    return true
+
+  var nonroot = !process.getuid || process.getuid() !== 0
+  if (nonroot) {
+    if (er.code === "EINVAL" || er.code === "EPERM")
+      return true
+  }
+
+  return false
+}
+
+
+// if lchmod/lchown do not exist, then make them no-ops
+if (!fs.lchmod) {
+  fs.lchmod = function (path, mode, cb) {
+    process.nextTick(cb)
+  }
+  fs.lchmodSync = function () {}
+}
+if (!fs.lchown) {
+  fs.lchown = function (path, uid, gid, cb) {
+    process.nextTick(cb)
+  }
+  fs.lchownSync = function () {}
+}
+
+
+
+// on Windows, A/V software can lock the directory, causing this
+// to fail with an EACCES or EPERM if the directory contains newly
+// created files.  Try again on failure, for up to 1 second.
+if (process.platform === "win32") {
+  var rename_ = fs.rename
+  fs.rename = function rename (from, to, cb) {
+    var start = Date.now()
+    rename_(from, to, function CB (er) {
+      if (er
+          && (er.code === "EACCES" || er.code === "EPERM")
+          && Date.now() - start < 1000) {
+        return rename_(from, to, CB)
+      }
+      if(cb) cb(er)
+    })
+  }
+}
+
+
+// if read() returns EAGAIN, then just try it again.
+var read = fs.read
+fs.read = function (fd, buffer, offset, length, position, callback_) {
+  var callback
+  if (callback_ && typeof callback_ === 'function') {
+    var eagCounter = 0
+    callback = function (er, _, __) {
+      if (er && er.code === 'EAGAIN' && eagCounter < 10) {
+        eagCounter ++
+        return read.call(fs, fd, buffer, offset, length, position, callback)
+      }
+      callback_.apply(this, arguments)
+    }
+  }
+  return read.call(fs, fd, buffer, offset, length, position, callback)
+}
+
+var readSync = fs.readSync
+fs.readSync = function (fd, buffer, offset, length, position) {
+  var eagCounter = 0
+  while (true) {
+    try {
+      return readSync.call(fs, fd, buffer, offset, length, position)
+    } catch (er) {
+      if (er.code === 'EAGAIN' && eagCounter < 10) {
+        eagCounter ++
+        continue
+      }
+      throw er
+    }
+  }
+}
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/max-open.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/max-open.js
new file mode 100755 (executable)
index 0000000..44d5267
--- /dev/null
@@ -0,0 +1,69 @@
+var test = require('tap').test
+var fs = require('../')
+
+test('open lots of stuff', function (t) {
+  // Get around EBADF from libuv by making sure that stderr is opened
+  // Otherwise Darwin will refuse to give us a FD for stderr!
+  process.stderr.write('')
+
+  // How many parallel open()'s to do
+  var n = 1024
+  var opens = 0
+  var fds = []
+  var going = true
+  var closing = false
+  var doneCalled = 0
+
+  for (var i = 0; i < n; i++) {
+    go()
+  }
+
+  function go() {
+    opens++
+    fs.open(__filename, 'r', function (er, fd) {
+      if (er) throw er
+      fds.push(fd)
+      if (going) go()
+    })
+  }
+
+  // should hit ulimit pretty fast
+  setTimeout(function () {
+    going = false
+    t.equal(opens - fds.length, n)
+    done()
+  }, 100)
+
+
+  function done () {
+    if (closing) return
+    doneCalled++
+
+    if (fds.length === 0) {
+      //console.error('done called %d times', doneCalled)
+      // First because of the timeout
+      // Then to close the fd's opened afterwards
+      // Then this time, to complete.
+      // Might take multiple passes, depending on CPU speed
+      // and ulimit, but at least 3 in every case.
+      t.ok(doneCalled >= 3)
+      return t.end()
+    }
+
+    closing = true
+    setTimeout(function () {
+      // console.error('do closing again')
+      closing = false
+      done()
+    }, 100)
+
+    // console.error('closing time')
+    var closes = fds.slice(0)
+    fds.length = 0
+    closes.forEach(function (fd) {
+      fs.close(fd, function (er) {
+        if (er) throw er
+      })
+    })
+  }
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/open.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/open.js
new file mode 100755 (executable)
index 0000000..85732f2
--- /dev/null
@@ -0,0 +1,39 @@
+var test = require('tap').test
+var fs = require('../graceful-fs.js')
+
+test('graceful fs is monkeypatched fs', function (t) {
+  t.equal(fs, require('../fs.js'))
+  t.end()
+})
+
+test('open an existing file works', function (t) {
+  var fd = fs.openSync(__filename, 'r')
+  fs.closeSync(fd)
+  fs.open(__filename, 'r', function (er, fd) {
+    if (er) throw er
+    fs.close(fd, function (er) {
+      if (er) throw er
+      t.pass('works')
+      t.end()
+    })
+  })
+})
+
+test('open a non-existing file throws', function (t) {
+  var er
+  try {
+    var fd = fs.openSync('this file does not exist', 'r')
+  } catch (x) {
+    er = x
+  }
+  t.ok(er, 'should throw')
+  t.notOk(fd, 'should not get an fd')
+  t.equal(er.code, 'ENOENT')
+
+  fs.open('neither does this file', 'r', function (er, fd) {
+    t.ok(er, 'should throw')
+    t.notOk(fd, 'should not get an fd')
+    t.equal(er.code, 'ENOENT')
+    t.end()
+  })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/readdir-sort.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/readdir-sort.js
new file mode 100755 (executable)
index 0000000..cb63a68
--- /dev/null
@@ -0,0 +1,20 @@
+var test = require("tap").test
+var fs = require("../fs.js")
+
+var readdir = fs.readdir
+fs.readdir = function(path, cb) {
+  process.nextTick(function() {
+    cb(null, ["b", "z", "a"])
+  })
+}
+
+var g = require("../")
+
+test("readdir reorder", function (t) {
+  g.readdir("whatevers", function (er, files) {
+    if (er)
+      throw er
+    t.same(files, [ "a", "b", "z" ])
+    t.end()
+  })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/write-then-read.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/graceful-fs/test/write-then-read.js
new file mode 100755 (executable)
index 0000000..3a3db54
--- /dev/null
@@ -0,0 +1,45 @@
+var fs = require('../');
+var rimraf = require('rimraf');
+var mkdirp = require('mkdirp');
+var test = require('tap').test;
+var p = require('path').resolve(__dirname, 'files');
+
+// Make sure to reserve the stderr fd
+process.stderr.write('');
+
+var num = 4097;
+var paths = new Array(num);
+
+test('make files', function (t) {
+  rimraf.sync(p);
+  mkdirp.sync(p);
+
+  for (var i = 0; i < num; ++i) {
+    paths[i] = 'files/file-' + i;
+    fs.writeFileSync(paths[i], 'content');
+  }
+
+  t.end();
+})
+
+test('read files', function (t) {
+  // now read them
+  var done = 0;
+  for (var i = 0; i < num; ++i) {
+    fs.readFile(paths[i], function(err, data) {
+      if (err)
+        throw err;
+
+      ++done;
+      if (done === num) {
+        t.pass('success');
+        t.end()
+      }
+    });
+  }
+});
+
+test('cleanup', function (t) {
+  rimraf.sync(p);
+  t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/LICENSE
new file mode 100755 (executable)
index 0000000..45b6725
--- /dev/null
@@ -0,0 +1,7 @@
+Copyright (C) 2012 Jonathan Rajavuori
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/README.md
new file mode 100755 (executable)
index 0000000..1a6b51d
--- /dev/null
@@ -0,0 +1,27 @@
+# mkpath
+
+Make all directories in a path, like `mkdir -p`.
+
+## How to use
+
+    var mkpath = require('mkpath');
+    
+    mkpath('red/green/violet', function (err) {
+        if (err) throw err;
+        console.log('Directory structure red/green/violet created');
+    });
+    
+    mkpath.sync('/tmp/blue/orange', 0700);
+
+### mkpath(path, [mode = 0777 & (~process.umask()),] [callback])
+
+Create all directories that don't exist in `path` with permissions `mode`. When finished, `callback(err)` fires with the error, if any.
+
+### mkpath.sync(path, [mode = 0777 & (~process.umask())]);
+
+Synchronous version of the same. Throws error, if any.
+
+## License
+
+This software is released under the [MIT license](http://www.opensource.org/licenses/MIT).
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/mkpath.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/mkpath.js
new file mode 100755 (executable)
index 0000000..aa62f04
--- /dev/null
@@ -0,0 +1,59 @@
+var fs = require('fs');
+var path = require('path');
+
+var mkpath = function mkpath(dirpath, mode, callback) {
+    dirpath = path.resolve(dirpath);
+    
+    if (typeof mode === 'function' || typeof mode === 'undefined') {
+        callback = mode;
+        mode = 0777 & (~process.umask());
+    }
+    
+    if (!callback) {
+        callback = function () {};
+    }
+    
+    fs.stat(dirpath, function (err, stats) {
+        if (err) {
+            if (err.code === 'ENOENT') {
+                mkpath(path.dirname(dirpath), mode, function (err) {
+                    if (err) {
+                        callback(err);
+                    } else {
+                        fs.mkdir(dirpath, mode, callback);
+                    }
+                });
+            } else {
+                callback(err);
+            }
+        } else if (stats.isDirectory()) {
+            callback(null);
+        } else {
+            callback(new Error(dirpath + ' exists and is not a directory'));
+        }
+    });
+};
+
+mkpath.sync = function mkpathsync(dirpath, mode) {
+    dirpath = path.resolve(dirpath);
+    
+    if (typeof mode === 'undefined') {
+        mode = 0777 & (~process.umask());
+    }
+    
+    try {
+        if (!fs.statSync(dirpath).isDirectory()) {
+            throw new Error(dirpath + ' exists and is not a directory');
+        }
+    } catch (err) {
+        if (err.code === 'ENOENT') {
+            mkpathsync(path.dirname(dirpath), mode);
+            fs.mkdirSync(dirpath, mode);
+        } else {
+            throw err;
+        }
+    }
+};
+
+module.exports = mkpath;
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/package.json
new file mode 100755 (executable)
index 0000000..e92c387
--- /dev/null
@@ -0,0 +1,54 @@
+{
+  "name": "mkpath",
+  "version": "0.1.0",
+  "author": {
+    "name": "Jonathan Rajavuori",
+    "email": "jrajav@gmail.com"
+  },
+  "description": "Make all directories in a path, like mkdir -p",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/jrajav/mkpath"
+  },
+  "keywords": [
+    "mkdir",
+    "mkdirp",
+    "directory",
+    "path",
+    "tree"
+  ],
+  "main": "./mkpath",
+  "scripts": {
+    "test": "node node_modules/tap/bin/tap.js ./test"
+  },
+  "devDependencies": {
+    "tap": "~0.3"
+  },
+  "license": "MIT",
+  "readme": "# mkpath\n\nMake all directories in a path, like `mkdir -p`.\n\n## How to use\n\n    var mkpath = require('mkpath');\n    \n    mkpath('red/green/violet', function (err) {\n        if (err) throw err;\n        console.log('Directory structure red/green/violet created');\n    });\n    \n    mkpath.sync('/tmp/blue/orange', 0700);\n\n### mkpath(path, [mode = 0777 & (~process.umask()),] [callback])\n\nCreate all directories that don't exist in `path` with permissions `mode`. When finished, `callback(err)` fires with the error, if any.\n\n### mkpath.sync(path, [mode = 0777 & (~process.umask())]);\n\nSynchronous version of the same. Throws error, if any.\n\n## License\n\nThis software is released under the [MIT license](http://www.opensource.org/licenses/MIT).\n\n",
+  "readmeFilename": "README.md",
+  "_id": "mkpath@0.1.0",
+  "dist": {
+    "shasum": "7554a6f8d871834cc97b5462b122c4c124d6de91",
+    "tarball": "http://registry.npmjs.org/mkpath/-/mkpath-0.1.0.tgz"
+  },
+  "_npmVersion": "1.1.65",
+  "_npmUser": {
+    "name": "jrajav",
+    "email": "jrajav@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "jrajav",
+      "email": "jrajav@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "7554a6f8d871834cc97b5462b122c4c124d6de91",
+  "_from": "mkpath@^0.1.0",
+  "_resolved": "https://registry.npmjs.org/mkpath/-/mkpath-0.1.0.tgz",
+  "bugs": {
+    "url": "https://github.com/jrajav/mkpath/issues"
+  },
+  "homepage": "https://github.com/jrajav/mkpath"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/chmod.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/chmod.js
new file mode 100755 (executable)
index 0000000..96d51bd
--- /dev/null
@@ -0,0 +1,42 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    ps.push(dir);
+}
+
+var file = ps.join('/');
+
+test('chmod-pre', function (t) {
+    var mode = 0744
+    mkpath(file, mode, function (er) {
+        t.ifError(er, 'should not error');
+        fs.stat(file, function (er, stat) {
+            t.ifError(er, 'should exist');
+            t.ok(stat && stat.isDirectory(), 'should be directory');
+            t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
+            t.end();
+        });
+    });
+});
+
+test('chmod', function (t) {
+    var mode = 0755
+    mkpath(file, mode, function (er) {
+        t.ifError(er, 'should not error');
+        fs.stat(file, function (er, stat) {
+            t.ifError(er, 'should exist');
+            t.ok(stat && stat.isDirectory(), 'should be directory');
+            t.end();
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/clobber.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/clobber.js
new file mode 100755 (executable)
index 0000000..16d48ca
--- /dev/null
@@ -0,0 +1,41 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+var ps = [ '', 'tmp' ];
+
+for (var i = 0; i < 25; i++) {
+    var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    ps.push(dir);
+}
+
+var file = ps.join('/');
+
+// a file in the way
+var itw = ps.slice(0, 3).join('/');
+
+
+test('clobber-pre', function (t) {
+    console.error("about to write to "+itw)
+    fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
+
+    fs.stat(itw, function (er, stat) {
+        t.ifError(er)
+        t.ok(stat && stat.isFile(), 'should be file')
+        t.end()
+    })
+})
+
+test('clobber', function (t) {
+    t.plan(2);
+    mkpath(file, 0755, function (err) {
+        t.ok(err);
+        t.equal(err.code, 'ENOTDIR');
+        t.end();
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/mkpath.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/mkpath.js
new file mode 100755 (executable)
index 0000000..75cd4ec
--- /dev/null
@@ -0,0 +1,32 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('woo', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/tmp/' + [x,y,z].join('/');
+    
+    mkpath(file, 0755, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/perm.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/perm.js
new file mode 100755 (executable)
index 0000000..bb09d20
--- /dev/null
@@ -0,0 +1,36 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('async perm', function (t) {
+    t.plan(2);
+    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16);
+    
+    mkpath(file, 0755, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
+
+test('async root perm', function (t) {
+    mkpath('/tmp', 0755, function (err) {
+        if (err) t.fail(err);
+        t.end();
+    });
+    t.end();
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/perm_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/perm_sync.js
new file mode 100755 (executable)
index 0000000..ee7f330
--- /dev/null
@@ -0,0 +1,43 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('sync perm', function (t) {
+    t.plan(2);
+    var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json';
+    
+    mkpath.sync(file, 0755);
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        })
+    });
+});
+
+test('sync root perm', function (t) {
+    t.plan(1);
+    
+    var file = '/tmp';
+    mkpath.sync(file, 0755);
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        })
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/rel.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/rel.js
new file mode 100755 (executable)
index 0000000..20ea10e
--- /dev/null
@@ -0,0 +1,36 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('rel', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var cwd = process.cwd();
+    process.chdir('/tmp');
+    
+    var file = [x,y,z].join('/');
+    
+    mkpath(file, 0755, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    process.chdir(cwd);
+                    t.equal(stat.mode & 0777, 0755);
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/root.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/root.js
new file mode 100755 (executable)
index 0000000..78d4a02
--- /dev/null
@@ -0,0 +1,22 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('root', function (t) {
+    // '/' on unix, 'c:/' on windows.
+    var file = path.resolve('/');
+
+    mkpath(file, 0755, function (err) {
+        if (err) throw err
+        fs.stat(file, function (er, stat) {
+            if (er) throw er
+            t.ok(stat.isDirectory(), 'target is a directory');
+            t.end();
+        })
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/sync.js
new file mode 100755 (executable)
index 0000000..20fbc47
--- /dev/null
@@ -0,0 +1,36 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('sync', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    try {
+        mkpath.sync(file, 0755);
+    } catch (err) {
+        t.fail(err);
+        return t.end();
+    }
+
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.equal(stat.mode & 0777, 0755);
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/umask.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/umask.js
new file mode 100755 (executable)
index 0000000..d2f8a71
--- /dev/null
@@ -0,0 +1,32 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('implicit mode from umask', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    
+    var file = '/tmp/' + [x,y,z].join('/');
+    
+    mkpath(file, function (err) {
+        if (err) t.fail(err);
+        else path.exists(file, function (ex) {
+            if (!ex) t.fail('file not created')
+            else fs.stat(file, function (err, stat) {
+                if (err) t.fail(err)
+                else {
+                    t.equal(stat.mode & 0777, 0777 & (~process.umask()));
+                    t.ok(stat.isDirectory(), 'target not a directory');
+                    t.end();
+                }
+            })
+        })
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/umask_sync.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/mkpath/test/umask_sync.js
new file mode 100755 (executable)
index 0000000..4b9e7ba
--- /dev/null
@@ -0,0 +1,36 @@
+/* Tests borrowed from substack's node-mkdirp
+ * https://github.com/substack/node-mkdirp */
+
+var mkpath = require('../');
+var path = require('path');
+var fs = require('fs');
+var test = require('tap').test;
+
+test('umask sync modes', function (t) {
+    t.plan(2);
+    var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+    var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
+
+    var file = '/tmp/' + [x,y,z].join('/');
+
+    try {
+        mkpath.sync(file);
+    } catch (err) {
+        t.fail(err);
+        return t.end();
+    }
+
+    path.exists(file, function (ex) {
+        if (!ex) t.fail('file not created')
+        else fs.stat(file, function (err, stat) {
+            if (err) t.fail(err)
+            else {
+                t.equal(stat.mode & 0777, (0777 & (~process.umask())));
+                t.ok(stat.isDirectory(), 'target not a directory');
+                t.end();
+            }
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/LICENSE
new file mode 100755 (executable)
index 0000000..05a4010
--- /dev/null
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+All rights reserved.
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/README.md
new file mode 100755 (executable)
index 0000000..5aba088
--- /dev/null
@@ -0,0 +1,209 @@
+If you want to write an option parser, and have it be good, there are
+two ways to do it.  The Right Way, and the Wrong Way.
+
+The Wrong Way is to sit down and write an option parser.  We've all done
+that.
+
+The Right Way is to write some complex configurable program with so many
+options that you go half-insane just trying to manage them all, and put
+it off with duct-tape solutions until you see exactly to the core of the
+problem, and finally snap and write an awesome option parser.
+
+If you want to write an option parser, don't write an option parser.
+Write a package manager, or a source control system, or a service
+restarter, or an operating system.  You probably won't end up with a
+good one of those, but if you don't give up, and you are relentless and
+diligent enough in your procrastination, you may just end up with a very
+nice option parser.
+
+## USAGE
+
+    // my-program.js
+    var nopt = require("nopt")
+      , Stream = require("stream").Stream
+      , path = require("path")
+      , knownOpts = { "foo" : [String, null]
+                    , "bar" : [Stream, Number]
+                    , "baz" : path
+                    , "bloo" : [ "big", "medium", "small" ]
+                    , "flag" : Boolean
+                    , "pick" : Boolean
+                    , "many" : [String, Array]
+                    }
+      , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+                     , "b7" : ["--bar", "7"]
+                     , "m" : ["--bloo", "medium"]
+                     , "p" : ["--pick"]
+                     , "f" : ["--flag"]
+                     }
+                 // everything is optional.
+                 // knownOpts and shorthands default to {}
+                 // arg list defaults to process.argv
+                 // slice defaults to 2
+      , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+    console.log(parsed)
+
+This would give you support for any of the following:
+
+```bash
+$ node my-program.js --foo "blerp" --no-flag
+{ "foo" : "blerp", "flag" : false }
+
+$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
+{ bar: 7, foo: "Mr. Hand", flag: true }
+
+$ node my-program.js --foo "blerp" -f -----p
+{ foo: "blerp", flag: true, pick: true }
+
+$ node my-program.js -fp --foofoo
+{ foo: "Mr. Foo", flag: true, pick: true }
+
+$ node my-program.js --foofoo -- -fp  # -- stops the flag parsing.
+{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
+
+$ node my-program.js --blatzk -fp # unknown opts are ok.
+{ blatzk: true, flag: true, pick: true }
+
+$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value
+{ blatzk: 1000, flag: true, pick: true }
+
+$ node my-program.js --no-blatzk -fp # unless they start with "no-"
+{ blatzk: false, flag: true, pick: true }
+
+$ node my-program.js --baz b/a/z # known paths are resolved.
+{ baz: "/Users/isaacs/b/a/z" }
+
+# if Array is one of the types, then it can take many
+# values, and will always be an array.  The other types provided
+# specify what types are allowed in the list.
+
+$ node my-program.js --many 1 --many null --many foo
+{ many: ["1", "null", "foo"] }
+
+$ node my-program.js --many foo
+{ many: ["foo"] }
+```
+
+Read the tests at the bottom of `lib/nopt.js` for more examples of
+what this puppy can do.
+
+## Types
+
+The following types are supported, and defined on `nopt.typeDefs`
+
+* String: A normal string.  No parsing is done.
+* path: A file system path.  Gets resolved against cwd if not absolute.
+* url: A url.  If it doesn't parse, it isn't accepted.
+* Number: Must be numeric.
+* Date: Must parse as a date. If it does, and `Date` is one of the options,
+  then it will return a Date object, not a string.
+* Boolean: Must be either `true` or `false`.  If an option is a boolean,
+  then it does not need a value, and its presence will imply `true` as
+  the value.  To negate boolean flags, do `--no-whatever` or `--whatever
+  false`
+* NaN: Means that the option is strictly not allowed.  Any value will
+  fail.
+* Stream: An object matching the "Stream" class in node.  Valuable
+  for use when validating programmatically.  (npm uses this to let you
+  supply any WriteStream on the `outfd` and `logfd` config options.)
+* Array: If `Array` is specified as one of the types, then the value
+  will be parsed as a list of options.  This means that multiple values
+  can be specified, and that the value will always be an array.
+
+If a type is an array of values not on this list, then those are
+considered valid values.  For instance, in the example above, the
+`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
+and any other value will be rejected.
+
+When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
+interpreted as their JavaScript equivalents.
+
+You can also mix types and values, or multiple types, in a list.  For
+instance `{ blah: [Number, null] }` would allow a value to be set to
+either a Number or null.  When types are ordered, this implies a
+preference, and the first type that can be used to properly interpret
+the value will be used.
+
+To define a new type, add it to `nopt.typeDefs`.  Each item in that
+hash is an object with a `type` member and a `validate` method.  The
+`type` member is an object that matches what goes in the type list.  The
+`validate` method is a function that gets called with `validate(data,
+key, val)`.  Validate methods should assign `data[key]` to the valid
+value of `val` if it can be handled properly, or return boolean
+`false` if it cannot.
+
+You can also call `nopt.clean(data, types, typeDefs)` to clean up a
+config object and remove its invalid properties.
+
+## Error Handling
+
+By default, nopt outputs a warning to standard error when invalid
+options are found.  You can change this behavior by assigning a method
+to `nopt.invalidHandler`.  This method will be called with
+the offending `nopt.invalidHandler(key, val, types)`.
+
+If no `nopt.invalidHandler` is assigned, then it will console.error
+its whining.  If it is assigned to boolean `false` then the warning is
+suppressed.
+
+## Abbreviations
+
+Yes, they are supported.  If you define options like this:
+
+```javascript
+{ "foolhardyelephants" : Boolean
+, "pileofmonkeys" : Boolean }
+```
+
+Then this will work:
+
+```bash
+node program.js --foolhar --pil
+node program.js --no-f --pileofmon
+# etc.
+```
+
+## Shorthands
+
+Shorthands are a hash of shorter option names to a snippet of args that
+they expand to.
+
+If multiple one-character shorthands are all combined, and the
+combination does not unambiguously match any other option or shorthand,
+then they will be broken up into their constituent parts.  For example:
+
+```json
+{ "s" : ["--loglevel", "silent"]
+, "g" : "--global"
+, "f" : "--force"
+, "p" : "--parseable"
+, "l" : "--long"
+}
+```
+
+```bash
+npm ls -sgflp
+# just like doing this:
+npm ls --loglevel silent --global --force --long --parseable
+```
+
+## The Rest of the args
+
+The config object returned by nopt is given a special member called
+`argv`, which is an object with the following fields:
+
+* `remain`: The remaining args after all the parsing has occurred.
+* `original`: The args as they originally appeared.
+* `cooked`: The args after flags and shorthands are expanded.
+
+## Slicing
+
+Node programs are called with more or less the exact argv as it appears
+in C land, after the v8 and node-specific options have been plucked off.
+As such, `argv[0]` is always `node` and `argv[1]` is always the
+JavaScript program being run.
+
+That's usually not very useful to you.  So they're sliced off by
+default.  If you want them, then you can pass in `0` as the last
+argument, or any other number that you'd like to slice off the start of
+the list.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/bin/nopt.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/bin/nopt.js
new file mode 100755 (executable)
index 0000000..3232d4c
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/env node
+var nopt = require("../lib/nopt")
+  , path = require("path")
+  , types = { num: Number
+            , bool: Boolean
+            , help: Boolean
+            , list: Array
+            , "num-list": [Number, Array]
+            , "str-list": [String, Array]
+            , "bool-list": [Boolean, Array]
+            , str: String
+            , clear: Boolean
+            , config: Boolean
+            , length: Number
+            , file: path
+            }
+  , shorthands = { s: [ "--str", "astring" ]
+                 , b: [ "--bool" ]
+                 , nb: [ "--no-bool" ]
+                 , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
+                 , "?": ["--help"]
+                 , h: ["--help"]
+                 , H: ["--help"]
+                 , n: [ "--num", "125" ]
+                 , c: ["--config"]
+                 , l: ["--length"]
+                 , f: ["--file"]
+                 }
+  , parsed = nopt( types
+                 , shorthands
+                 , process.argv
+                 , 2 )
+
+console.log("parsed", parsed)
+
+if (parsed.help) {
+  console.log("")
+  console.log("nopt cli tester")
+  console.log("")
+  console.log("types")
+  console.log(Object.keys(types).map(function M (t) {
+    var type = types[t]
+    if (Array.isArray(type)) {
+      return [t, type.map(function (type) { return type.name })]
+    }
+    return [t, type && type.name]
+  }).reduce(function (s, i) {
+    s[i[0]] = i[1]
+    return s
+  }, {}))
+  console.log("")
+  console.log("shorthands")
+  console.log(shorthands)
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/examples/my-program.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/examples/my-program.js
new file mode 100755 (executable)
index 0000000..142447e
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env node
+
+//process.env.DEBUG_NOPT = 1
+
+// my-program.js
+var nopt = require("../lib/nopt")
+  , Stream = require("stream").Stream
+  , path = require("path")
+  , knownOpts = { "foo" : [String, null]
+                , "bar" : [Stream, Number]
+                , "baz" : path
+                , "bloo" : [ "big", "medium", "small" ]
+                , "flag" : Boolean
+                , "pick" : Boolean
+                }
+  , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+                 , "b7" : ["--bar", "7"]
+                 , "m" : ["--bloo", "medium"]
+                 , "p" : ["--pick"]
+                 , "f" : ["--flag", "true"]
+                 , "g" : ["--flag"]
+                 , "s" : "--flag"
+                 }
+             // everything is optional.
+             // knownOpts and shorthands default to {}
+             // arg list defaults to process.argv
+             // slice defaults to 2
+  , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+
+console.log("parsed =\n"+ require("util").inspect(parsed))
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/lib/nopt.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/lib/nopt.js
new file mode 100755 (executable)
index 0000000..5309a00
--- /dev/null
@@ -0,0 +1,414 @@
+// info about each config option.
+
+var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
+  ? function () { console.error.apply(console, arguments) }
+  : function () {}
+
+var url = require("url")
+  , path = require("path")
+  , Stream = require("stream").Stream
+  , abbrev = require("abbrev")
+
+module.exports = exports = nopt
+exports.clean = clean
+
+exports.typeDefs =
+  { String  : { type: String,  validate: validateString  }
+  , Boolean : { type: Boolean, validate: validateBoolean }
+  , url     : { type: url,     validate: validateUrl     }
+  , Number  : { type: Number,  validate: validateNumber  }
+  , path    : { type: path,    validate: validatePath    }
+  , Stream  : { type: Stream,  validate: validateStream  }
+  , Date    : { type: Date,    validate: validateDate    }
+  }
+
+function nopt (types, shorthands, args, slice) {
+  args = args || process.argv
+  types = types || {}
+  shorthands = shorthands || {}
+  if (typeof slice !== "number") slice = 2
+
+  debug(types, shorthands, args, slice)
+
+  args = args.slice(slice)
+  var data = {}
+    , key
+    , remain = []
+    , cooked = args
+    , original = args.slice(0)
+
+  parse(args, data, remain, types, shorthands)
+  // now data is full
+  clean(data, types, exports.typeDefs)
+  data.argv = {remain:remain,cooked:cooked,original:original}
+  Object.defineProperty(data.argv, 'toString', { value: function () {
+    return this.original.map(JSON.stringify).join(" ")
+  }, enumerable: false })
+  return data
+}
+
+function clean (data, types, typeDefs) {
+  typeDefs = typeDefs || exports.typeDefs
+  var remove = {}
+    , typeDefault = [false, true, null, String, Array]
+
+  Object.keys(data).forEach(function (k) {
+    if (k === "argv") return
+    var val = data[k]
+      , isArray = Array.isArray(val)
+      , type = types[k]
+    if (!isArray) val = [val]
+    if (!type) type = typeDefault
+    if (type === Array) type = typeDefault.concat(Array)
+    if (!Array.isArray(type)) type = [type]
+
+    debug("val=%j", val)
+    debug("types=", type)
+    val = val.map(function (val) {
+      // if it's an unknown value, then parse false/true/null/numbers/dates
+      if (typeof val === "string") {
+        debug("string %j", val)
+        val = val.trim()
+        if ((val === "null" && ~type.indexOf(null))
+            || (val === "true" &&
+               (~type.indexOf(true) || ~type.indexOf(Boolean)))
+            || (val === "false" &&
+               (~type.indexOf(false) || ~type.indexOf(Boolean)))) {
+          val = JSON.parse(val)
+          debug("jsonable %j", val)
+        } else if (~type.indexOf(Number) && !isNaN(val)) {
+          debug("convert to number", val)
+          val = +val
+        } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) {
+          debug("convert to date", val)
+          val = new Date(val)
+        }
+      }
+
+      if (!types.hasOwnProperty(k)) {
+        return val
+      }
+
+      // allow `--no-blah` to set 'blah' to null if null is allowed
+      if (val === false && ~type.indexOf(null) &&
+          !(~type.indexOf(false) || ~type.indexOf(Boolean))) {
+        val = null
+      }
+
+      var d = {}
+      d[k] = val
+      debug("prevalidated val", d, val, types[k])
+      if (!validate(d, k, val, types[k], typeDefs)) {
+        if (exports.invalidHandler) {
+          exports.invalidHandler(k, val, types[k], data)
+        } else if (exports.invalidHandler !== false) {
+          debug("invalid: "+k+"="+val, types[k])
+        }
+        return remove
+      }
+      debug("validated val", d, val, types[k])
+      return d[k]
+    }).filter(function (val) { return val !== remove })
+
+    if (!val.length) delete data[k]
+    else if (isArray) {
+      debug(isArray, data[k], val)
+      data[k] = val
+    } else data[k] = val[0]
+
+    debug("k=%s val=%j", k, val, data[k])
+  })
+}
+
+function validateString (data, k, val) {
+  data[k] = String(val)
+}
+
+function validatePath (data, k, val) {
+  if (val === true) return false
+  if (val === null) return true
+
+  val = String(val)
+  var homePattern = process.platform === 'win32' ? /^~(\/|\\)/ : /^~\//
+  if (val.match(homePattern) && process.env.HOME) {
+    val = path.resolve(process.env.HOME, val.substr(2))
+  }
+  data[k] = path.resolve(String(val))
+  return true
+}
+
+function validateNumber (data, k, val) {
+  debug("validate Number %j %j %j", k, val, isNaN(val))
+  if (isNaN(val)) return false
+  data[k] = +val
+}
+
+function validateDate (data, k, val) {
+  debug("validate Date %j %j %j", k, val, Date.parse(val))
+  var s = Date.parse(val)
+  if (isNaN(s)) return false
+  data[k] = new Date(val)
+}
+
+function validateBoolean (data, k, val) {
+  if (val instanceof Boolean) val = val.valueOf()
+  else if (typeof val === "string") {
+    if (!isNaN(val)) val = !!(+val)
+    else if (val === "null" || val === "false") val = false
+    else val = true
+  } else val = !!val
+  data[k] = val
+}
+
+function validateUrl (data, k, val) {
+  val = url.parse(String(val))
+  if (!val.host) return false
+  data[k] = val.href
+}
+
+function validateStream (data, k, val) {
+  if (!(val instanceof Stream)) return false
+  data[k] = val
+}
+
+function validate (data, k, val, type, typeDefs) {
+  // arrays are lists of types.
+  if (Array.isArray(type)) {
+    for (var i = 0, l = type.length; i < l; i ++) {
+      if (type[i] === Array) continue
+      if (validate(data, k, val, type[i], typeDefs)) return true
+    }
+    delete data[k]
+    return false
+  }
+
+  // an array of anything?
+  if (type === Array) return true
+
+  // NaN is poisonous.  Means that something is not allowed.
+  if (type !== type) {
+    debug("Poison NaN", k, val, type)
+    delete data[k]
+    return false
+  }
+
+  // explicit list of values
+  if (val === type) {
+    debug("Explicitly allowed %j", val)
+    // if (isArray) (data[k] = data[k] || []).push(val)
+    // else data[k] = val
+    data[k] = val
+    return true
+  }
+
+  // now go through the list of typeDefs, validate against each one.
+  var ok = false
+    , types = Object.keys(typeDefs)
+  for (var i = 0, l = types.length; i < l; i ++) {
+    debug("test type %j %j %j", k, val, types[i])
+    var t = typeDefs[types[i]]
+    if (t && type === t.type) {
+      var d = {}
+      ok = false !== t.validate(d, k, val)
+      val = d[k]
+      if (ok) {
+        // if (isArray) (data[k] = data[k] || []).push(val)
+        // else data[k] = val
+        data[k] = val
+        break
+      }
+    }
+  }
+  debug("OK? %j (%j %j %j)", ok, k, val, types[i])
+
+  if (!ok) delete data[k]
+  return ok
+}
+
+function parse (args, data, remain, types, shorthands) {
+  debug("parse", args, data, remain)
+
+  var key = null
+    , abbrevs = abbrev(Object.keys(types))
+    , shortAbbr = abbrev(Object.keys(shorthands))
+
+  for (var i = 0; i < args.length; i ++) {
+    var arg = args[i]
+    debug("arg", arg)
+
+    if (arg.match(/^-{2,}$/)) {
+      // done with keys.
+      // the rest are args.
+      remain.push.apply(remain, args.slice(i + 1))
+      args[i] = "--"
+      break
+    }
+    var hadEq = false
+    if (arg.charAt(0) === "-" && arg.length > 1) {
+      if (arg.indexOf("=") !== -1) {
+        hadEq = true
+        var v = arg.split("=")
+        arg = v.shift()
+        v = v.join("=")
+        args.splice.apply(args, [i, 1].concat([arg, v]))
+      }
+
+      // see if it's a shorthand
+      // if so, splice and back up to re-parse it.
+      var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
+      debug("arg=%j shRes=%j", arg, shRes)
+      if (shRes) {
+        debug(arg, shRes)
+        args.splice.apply(args, [i, 1].concat(shRes))
+        if (arg !== shRes[0]) {
+          i --
+          continue
+        }
+      }
+      arg = arg.replace(/^-+/, "")
+      var no = null
+      while (arg.toLowerCase().indexOf("no-") === 0) {
+        no = !no
+        arg = arg.substr(3)
+      }
+
+      if (abbrevs[arg]) arg = abbrevs[arg]
+
+      var isArray = types[arg] === Array ||
+        Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1
+
+      // allow unknown things to be arrays if specified multiple times.
+      if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) {
+        if (!Array.isArray(data[arg]))
+          data[arg] = [data[arg]]
+        isArray = true
+      }
+
+      var val
+        , la = args[i + 1]
+
+      var isBool = typeof no === 'boolean' ||
+        types[arg] === Boolean ||
+        Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 ||
+        (typeof types[arg] === 'undefined' && !hadEq) ||
+        (la === "false" &&
+         (types[arg] === null ||
+          Array.isArray(types[arg]) && ~types[arg].indexOf(null)))
+
+      if (isBool) {
+        // just set and move along
+        val = !no
+        // however, also support --bool true or --bool false
+        if (la === "true" || la === "false") {
+          val = JSON.parse(la)
+          la = null
+          if (no) val = !val
+          i ++
+        }
+
+        // also support "foo":[Boolean, "bar"] and "--foo bar"
+        if (Array.isArray(types[arg]) && la) {
+          if (~types[arg].indexOf(la)) {
+            // an explicit type
+            val = la
+            i ++
+          } else if ( la === "null" && ~types[arg].indexOf(null) ) {
+            // null allowed
+            val = null
+            i ++
+          } else if ( !la.match(/^-{2,}[^-]/) &&
+                      !isNaN(la) &&
+                      ~types[arg].indexOf(Number) ) {
+            // number
+            val = +la
+            i ++
+          } else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) {
+            // string
+            val = la
+            i ++
+          }
+        }
+
+        if (isArray) (data[arg] = data[arg] || []).push(val)
+        else data[arg] = val
+
+        continue
+      }
+
+      if (types[arg] === String && la === undefined)
+        la = ""
+
+      if (la && la.match(/^-{2,}$/)) {
+        la = undefined
+        i --
+      }
+
+      val = la === undefined ? true : la
+      if (isArray) (data[arg] = data[arg] || []).push(val)
+      else data[arg] = val
+
+      i ++
+      continue
+    }
+    remain.push(arg)
+  }
+}
+
+function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
+  // handle single-char shorthands glommed together, like
+  // npm ls -glp, but only if there is one dash, and only if
+  // all of the chars are single-char shorthands, and it's
+  // not a match to some other abbrev.
+  arg = arg.replace(/^-+/, '')
+
+  // if it's an exact known option, then don't go any further
+  if (abbrevs[arg] === arg)
+    return null
+
+  // if it's an exact known shortopt, same deal
+  if (shorthands[arg]) {
+    // make it an array, if it's a list of words
+    if (shorthands[arg] && !Array.isArray(shorthands[arg]))
+      shorthands[arg] = shorthands[arg].split(/\s+/)
+
+    return shorthands[arg]
+  }
+
+  // first check to see if this arg is a set of single-char shorthands
+  var singles = shorthands.___singles
+  if (!singles) {
+    singles = Object.keys(shorthands).filter(function (s) {
+      return s.length === 1
+    }).reduce(function (l,r) {
+      l[r] = true
+      return l
+    }, {})
+    shorthands.___singles = singles
+    debug('shorthand singles', singles)
+  }
+
+  var chrs = arg.split("").filter(function (c) {
+    return singles[c]
+  })
+
+  if (chrs.join("") === arg) return chrs.map(function (c) {
+    return shorthands[c]
+  }).reduce(function (l, r) {
+    return l.concat(r)
+  }, [])
+
+
+  // if it's an arg abbrev, and not a literal shorthand, then prefer the arg
+  if (abbrevs[arg] && !shorthands[arg])
+    return null
+
+  // if it's an abbr for a shorthand, then use that
+  if (shortAbbr[arg])
+    arg = shortAbbr[arg]
+
+  // make it an array, if it's a list of words
+  if (shorthands[arg] && !Array.isArray(shorthands[arg]))
+    shorthands[arg] = shorthands[arg].split(/\s+/)
+
+  return shorthands[arg]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/CONTRIBUTING.md
new file mode 100755 (executable)
index 0000000..2f30261
--- /dev/null
@@ -0,0 +1,3 @@
+ To get started, <a
+ href="http://www.clahub.com/agreements/isaacs/abbrev-js">sign the
+ Contributor License Agreement</a>.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/LICENSE
new file mode 100755 (executable)
index 0000000..05a4010
--- /dev/null
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+All rights reserved.
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/README.md
new file mode 100755 (executable)
index 0000000..99746fe
--- /dev/null
@@ -0,0 +1,23 @@
+# abbrev-js
+
+Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
+
+Usage:
+
+    var abbrev = require("abbrev");
+    abbrev("foo", "fool", "folding", "flop");
+    
+    // returns:
+    { fl: 'flop'
+    , flo: 'flop'
+    , flop: 'flop'
+    , fol: 'folding'
+    , fold: 'folding'
+    , foldi: 'folding'
+    , foldin: 'folding'
+    , folding: 'folding'
+    , foo: 'foo'
+    , fool: 'fool'
+    }
+
+This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/abbrev.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/abbrev.js
new file mode 100755 (executable)
index 0000000..69cfeac
--- /dev/null
@@ -0,0 +1,62 @@
+
+module.exports = exports = abbrev.abbrev = abbrev
+
+abbrev.monkeyPatch = monkeyPatch
+
+function monkeyPatch () {
+  Object.defineProperty(Array.prototype, 'abbrev', {
+    value: function () { return abbrev(this) },
+    enumerable: false, configurable: true, writable: true
+  })
+
+  Object.defineProperty(Object.prototype, 'abbrev', {
+    value: function () { return abbrev(Object.keys(this)) },
+    enumerable: false, configurable: true, writable: true
+  })
+}
+
+function abbrev (list) {
+  if (arguments.length !== 1 || !Array.isArray(list)) {
+    list = Array.prototype.slice.call(arguments, 0)
+  }
+  for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
+    args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
+  }
+
+  // sort them lexicographically, so that they're next to their nearest kin
+  args = args.sort(lexSort)
+
+  // walk through each, seeing how much it has in common with the next and previous
+  var abbrevs = {}
+    , prev = ""
+  for (var i = 0, l = args.length ; i < l ; i ++) {
+    var current = args[i]
+      , next = args[i + 1] || ""
+      , nextMatches = true
+      , prevMatches = true
+    if (current === next) continue
+    for (var j = 0, cl = current.length ; j < cl ; j ++) {
+      var curChar = current.charAt(j)
+      nextMatches = nextMatches && curChar === next.charAt(j)
+      prevMatches = prevMatches && curChar === prev.charAt(j)
+      if (!nextMatches && !prevMatches) {
+        j ++
+        break
+      }
+    }
+    prev = current
+    if (j === cl) {
+      abbrevs[current] = current
+      continue
+    }
+    for (var a = current.substr(0, j) ; j <= cl ; j ++) {
+      abbrevs[a] = current
+      a += current.charAt(j)
+    }
+  }
+  return abbrevs
+}
+
+function lexSort (a, b) {
+  return a === b ? 0 : a > b ? 1 : -1
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/package.json
new file mode 100755 (executable)
index 0000000..1dad5f2
--- /dev/null
@@ -0,0 +1,46 @@
+{
+  "name": "abbrev",
+  "version": "1.0.5",
+  "description": "Like ruby's abbrev module, but in js",
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me"
+  },
+  "main": "abbrev.js",
+  "scripts": {
+    "test": "node test.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/isaacs/abbrev-js"
+  },
+  "license": {
+    "type": "MIT",
+    "url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE"
+  },
+  "bugs": {
+    "url": "https://github.com/isaacs/abbrev-js/issues"
+  },
+  "homepage": "https://github.com/isaacs/abbrev-js",
+  "_id": "abbrev@1.0.5",
+  "_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
+  "_from": "abbrev@1",
+  "_npmVersion": "1.4.7",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "dist": {
+    "shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
+    "tarball": "http://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/node_modules/abbrev/test.js
new file mode 100755 (executable)
index 0000000..d5a7303
--- /dev/null
@@ -0,0 +1,47 @@
+var abbrev = require('./abbrev.js')
+var assert = require("assert")
+var util = require("util")
+
+console.log("TAP Version 13")
+var count = 0
+
+function test (list, expect) {
+  count++
+  var actual = abbrev(list)
+  assert.deepEqual(actual, expect,
+    "abbrev("+util.inspect(list)+") === " + util.inspect(expect) + "\n"+
+    "actual: "+util.inspect(actual))
+  actual = abbrev.apply(exports, list)
+  assert.deepEqual(abbrev.apply(exports, list), expect,
+    "abbrev("+list.map(JSON.stringify).join(",")+") === " + util.inspect(expect) + "\n"+
+    "actual: "+util.inspect(actual))
+  console.log('ok - ' + list.join(' '))
+}
+
+test([ "ruby", "ruby", "rules", "rules", "rules" ],
+{ rub: 'ruby'
+, ruby: 'ruby'
+, rul: 'rules'
+, rule: 'rules'
+, rules: 'rules'
+})
+test(["fool", "foom", "pool", "pope"],
+{ fool: 'fool'
+, foom: 'foom'
+, poo: 'pool'
+, pool: 'pool'
+, pop: 'pope'
+, pope: 'pope'
+})
+test(["a", "ab", "abc", "abcd", "abcde", "acde"],
+{ a: 'a'
+, ab: 'ab'
+, abc: 'abc'
+, abcd: 'abcd'
+, abcde: 'abcde'
+, ac: 'acde'
+, acd: 'acde'
+, acde: 'acde'
+})
+
+console.log("0..%d", count)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/package.json
new file mode 100755 (executable)
index 0000000..e392be4
--- /dev/null
@@ -0,0 +1,57 @@
+{
+  "name": "nopt",
+  "version": "3.0.1",
+  "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me/"
+  },
+  "main": "lib/nopt.js",
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/isaacs/nopt"
+  },
+  "bin": {
+    "nopt": "./bin/nopt.js"
+  },
+  "license": {
+    "type": "MIT",
+    "url": "https://github.com/isaacs/nopt/raw/master/LICENSE"
+  },
+  "dependencies": {
+    "abbrev": "1"
+  },
+  "devDependencies": {
+    "tap": "~0.4.8"
+  },
+  "gitHead": "4296f7aba7847c198fea2da594f9e1bec02817ec",
+  "bugs": {
+    "url": "https://github.com/isaacs/nopt/issues"
+  },
+  "homepage": "https://github.com/isaacs/nopt",
+  "_id": "nopt@3.0.1",
+  "_shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd",
+  "_from": "nopt@^3.0.1",
+  "_npmVersion": "1.4.18",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "dist": {
+    "shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd",
+    "tarball": "http://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/test/basic.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/nopt/test/basic.js
new file mode 100755 (executable)
index 0000000..2f9088c
--- /dev/null
@@ -0,0 +1,251 @@
+var nopt = require("../")
+  , test = require('tap').test
+
+
+test("passing a string results in a string", function (t) {
+  var parsed = nopt({ key: String }, {}, ["--key", "myvalue"], 0)
+  t.same(parsed.key, "myvalue")
+  t.end()
+})
+
+// https://github.com/npm/nopt/issues/31
+test("Empty String results in empty string, not true", function (t) {
+  var parsed = nopt({ empty: String }, {}, ["--empty"], 0)
+  t.same(parsed.empty, "")
+  t.end()
+})
+
+test("~ path is resolved to $HOME", function (t) {
+  var path = require("path")
+  if (!process.env.HOME) process.env.HOME = "/tmp"
+  var parsed = nopt({key: path}, {}, ["--key=~/val"], 0)
+  t.same(parsed.key, path.resolve(process.env.HOME, "val"))
+  t.end()
+})
+
+// https://github.com/npm/nopt/issues/24
+test("Unknown options are not parsed as numbers", function (t) {
+    var parsed = nopt({"parse-me": Number}, null, ['--leave-as-is=1.20', '--parse-me=1.20'], 0)
+    t.equal(parsed['leave-as-is'], '1.20')
+    t.equal(parsed['parse-me'], 1.2)
+    t.end()
+});
+
+test("other tests", function (t) {
+
+  var util = require("util")
+    , Stream = require("stream")
+    , path = require("path")
+    , url = require("url")
+
+    , shorthands =
+      { s : ["--loglevel", "silent"]
+      , d : ["--loglevel", "info"]
+      , dd : ["--loglevel", "verbose"]
+      , ddd : ["--loglevel", "silly"]
+      , noreg : ["--no-registry"]
+      , reg : ["--registry"]
+      , "no-reg" : ["--no-registry"]
+      , silent : ["--loglevel", "silent"]
+      , verbose : ["--loglevel", "verbose"]
+      , h : ["--usage"]
+      , H : ["--usage"]
+      , "?" : ["--usage"]
+      , help : ["--usage"]
+      , v : ["--version"]
+      , f : ["--force"]
+      , desc : ["--description"]
+      , "no-desc" : ["--no-description"]
+      , "local" : ["--no-global"]
+      , l : ["--long"]
+      , p : ["--parseable"]
+      , porcelain : ["--parseable"]
+      , g : ["--global"]
+      }
+
+    , types =
+      { aoa: Array
+      , nullstream: [null, Stream]
+      , date: Date
+      , str: String
+      , browser : String
+      , cache : path
+      , color : ["always", Boolean]
+      , depth : Number
+      , description : Boolean
+      , dev : Boolean
+      , editor : path
+      , force : Boolean
+      , global : Boolean
+      , globalconfig : path
+      , group : [String, Number]
+      , gzipbin : String
+      , logfd : [Number, Stream]
+      , loglevel : ["silent","win","error","warn","info","verbose","silly"]
+      , long : Boolean
+      , "node-version" : [false, String]
+      , npaturl : url
+      , npat : Boolean
+      , "onload-script" : [false, String]
+      , outfd : [Number, Stream]
+      , parseable : Boolean
+      , pre: Boolean
+      , prefix: path
+      , proxy : url
+      , "rebuild-bundle" : Boolean
+      , registry : url
+      , searchopts : String
+      , searchexclude: [null, String]
+      , shell : path
+      , t: [Array, String]
+      , tag : String
+      , tar : String
+      , tmp : path
+      , "unsafe-perm" : Boolean
+      , usage : Boolean
+      , user : String
+      , username : String
+      , userconfig : path
+      , version : Boolean
+      , viewer: path
+      , _exit : Boolean
+      , path: path
+      }
+
+  ; [["-v", {version:true}, []]
+    ,["---v", {version:true}, []]
+    ,["ls -s --no-reg connect -d",
+      {loglevel:"info",registry:null},["ls","connect"]]
+    ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
+    ,["ls --registry blargle", {}, ["ls"]]
+    ,["--no-registry", {registry:null}, []]
+    ,["--no-color true", {color:false}, []]
+    ,["--no-color false", {color:true}, []]
+    ,["--no-color", {color:false}, []]
+    ,["--color false", {color:false}, []]
+    ,["--color --logfd 7", {logfd:7,color:true}, []]
+    ,["--color=true", {color:true}, []]
+    ,["--logfd=10", {logfd:10}, []]
+    ,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]]
+    ,["--tmp=tmp -tar=gtar",
+      {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
+    ,["--logfd x", {}, []]
+    ,["a -true -- -no-false", {true:true},["a","-no-false"]]
+    ,["a -no-false", {false:false},["a"]]
+    ,["a -no-no-true", {true:true}, ["a"]]
+    ,["a -no-no-no-false", {false:false}, ["a"]]
+    ,["---NO-no-No-no-no-no-nO-no-no"+
+      "-No-no-no-no-no-no-no-no-no"+
+      "-no-no-no-no-NO-NO-no-no-no-no-no-no"+
+      "-no-body-can-do-the-boogaloo-like-I-do"
+     ,{"body-can-do-the-boogaloo-like-I-do":false}, []]
+    ,["we are -no-strangers-to-love "+
+      "--you-know=the-rules --and=so-do-i "+
+      "---im-thinking-of=a-full-commitment "+
+      "--no-you-would-get-this-from-any-other-guy "+
+      "--no-gonna-give-you-up "+
+      "-no-gonna-let-you-down=true "+
+      "--no-no-gonna-run-around false "+
+      "--desert-you=false "+
+      "--make-you-cry false "+
+      "--no-tell-a-lie "+
+      "--no-no-and-hurt-you false"
+     ,{"strangers-to-love":false
+      ,"you-know":"the-rules"
+      ,"and":"so-do-i"
+      ,"you-would-get-this-from-any-other-guy":false
+      ,"gonna-give-you-up":false
+      ,"gonna-let-you-down":false
+      ,"gonna-run-around":false
+      ,"desert-you":false
+      ,"make-you-cry":false
+      ,"tell-a-lie":false
+      ,"and-hurt-you":false
+      },["we", "are"]]
+    ,["-t one -t two -t three"
+     ,{t: ["one", "two", "three"]}
+     ,[]]
+    ,["-t one -t null -t three four five null"
+     ,{t: ["one", "null", "three"]}
+     ,["four", "five", "null"]]
+    ,["-t foo"
+     ,{t:["foo"]}
+     ,[]]
+    ,["--no-t"
+     ,{t:["false"]}
+     ,[]]
+    ,["-no-no-t"
+     ,{t:["true"]}
+     ,[]]
+    ,["-aoa one -aoa null -aoa 100"
+     ,{aoa:["one", null, '100']}
+     ,[]]
+    ,["-str 100"
+     ,{str:"100"}
+     ,[]]
+    ,["--color always"
+     ,{color:"always"}
+     ,[]]
+    ,["--no-nullstream"
+     ,{nullstream:null}
+     ,[]]
+    ,["--nullstream false"
+     ,{nullstream:null}
+     ,[]]
+    ,["--notadate=2011-01-25"
+     ,{notadate: "2011-01-25"}
+     ,[]]
+    ,["--date 2011-01-25"
+     ,{date: new Date("2011-01-25")}
+     ,[]]
+    ,["-cl 1"
+     ,{config: true, length: 1}
+     ,[]
+     ,{config: Boolean, length: Number, clear: Boolean}
+     ,{c: "--config", l: "--length"}]
+    ,["--acount bla"
+     ,{"acount":true}
+     ,["bla"]
+     ,{account: Boolean, credentials: Boolean, options: String}
+     ,{a:"--account", c:"--credentials",o:"--options"}]
+    ,["--clear"
+     ,{clear:true}
+     ,[]
+     ,{clear:Boolean,con:Boolean,len:Boolean,exp:Boolean,add:Boolean,rep:Boolean}
+     ,{c:"--con",l:"--len",e:"--exp",a:"--add",r:"--rep"}]
+    ,["--file -"
+     ,{"file":"-"}
+     ,[]
+     ,{file:String}
+     ,{}]
+    ,["--file -"
+     ,{"file":true}
+     ,["-"]
+     ,{file:Boolean}
+     ,{}]
+    ,["--path"
+     ,{"path":null}
+     ,[]]
+    ,["--path ."
+     ,{"path":process.cwd()}
+     ,[]]
+    ].forEach(function (test) {
+      var argv = test[0].split(/\s+/)
+        , opts = test[1]
+        , rem = test[2]
+        , actual = nopt(test[3] || types, test[4] || shorthands, argv, 0)
+        , parsed = actual.argv
+      delete actual.argv
+      for (var i in opts) {
+        var e = JSON.stringify(opts[i])
+          , a = JSON.stringify(actual[i] === undefined ? null : actual[i])
+        if (e && typeof e === "object") {
+          t.deepEqual(e, a)
+        } else {
+          t.equal(e, a)
+        }
+      }
+      t.deepEqual(rem, parsed.remain)
+    })
+  t.end()
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/LICENSE
new file mode 100755 (executable)
index 0000000..8a706b5
--- /dev/null
@@ -0,0 +1,18 @@
+Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/README.md
new file mode 100755 (executable)
index 0000000..9065bfa
--- /dev/null
@@ -0,0 +1,881 @@
+[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)
+
+<a href="http://promises-aplus.github.com/promises-spec">
+    <img src="http://kriskowal.github.io/q/q.png"
+         align="right" alt="Q logo" />
+</a>
+
+*This is Q version 1, from the `v1` branch in Git. This documentation applies to
+the latest of both the version 1 and version 0.9 release trains. These releases
+are stable. There will be no further releases of 0.9 after 0.9.7 which is nearly
+equivalent to version 1.0.0. All further releases of `q@~1.0` will be backward
+compatible. The version 2 release train introduces significant and
+backward-incompatible changes and is experimental at this time.*
+
+If a function cannot return a value or throw an exception without
+blocking, it can return a promise instead.  A promise is an object
+that represents the return value or the thrown exception that the
+function may eventually provide.  A promise can also be used as a
+proxy for a [remote object][Q-Connection] to overcome latency.
+
+[Q-Connection]: https://github.com/kriskowal/q-connection
+
+On the first pass, promises can mitigate the “[Pyramid of
+Doom][POD]”: the situation where code marches to the right faster
+than it marches forward.
+
+[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/
+
+```javascript
+step1(function (value1) {
+    step2(value1, function(value2) {
+        step3(value2, function(value3) {
+            step4(value3, function(value4) {
+                // Do something with value4
+            });
+        });
+    });
+});
+```
+
+With a promise library, you can flatten the pyramid.
+
+```javascript
+Q.fcall(promisedStep1)
+.then(promisedStep2)
+.then(promisedStep3)
+.then(promisedStep4)
+.then(function (value4) {
+    // Do something with value4
+})
+.catch(function (error) {
+    // Handle any error from all above steps
+})
+.done();
+```
+
+With this approach, you also get implicit error propagation, just like `try`,
+`catch`, and `finally`.  An error in `promisedStep1` will flow all the way to
+the `catch` function, where it’s caught and handled.  (Here `promisedStepN` is
+a version of `stepN` that returns a promise.)
+
+The callback approach is called an “inversion of control”.
+A function that accepts a callback instead of a return value
+is saying, “Don’t call me, I’ll call you.”.  Promises
+[un-invert][IOC] the inversion, cleanly separating the input
+arguments from control flow arguments.  This simplifies the
+use and creation of API’s, particularly variadic,
+rest and spread arguments.
+
+[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
+
+
+## Getting Started
+
+The Q module can be loaded as:
+
+-   A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and
+    gzipped.
+-   A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as
+    the [q](https://npmjs.org/package/q) package
+-   An AMD module
+-   A [component](https://github.com/component/component) as ``microjs/q``
+-   Using [bower](http://bower.io/) as `q#1.0.1`
+-   Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
+
+Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
+
+## Resources
+
+Our [wiki][] contains a number of useful resources, including:
+
+- A method-by-method [Q API reference][reference].
+- A growing [examples gallery][examples], showing how Q can be used to make
+  everything better. From XHR to database access to accessing the Flickr API,
+  Q is there for you.
+- There are many libraries that produce and consume Q promises for everything
+  from file system/database access or RPC to templating. For a list of some of
+  the more popular ones, see [Libraries][].
+- If you want materials that introduce the promise concept generally, and the
+  below tutorial isn't doing it for you, check out our collection of
+  [presentations, blog posts, and podcasts][resources].
+- A guide for those [coming from jQuery's `$.Deferred`][jquery].
+
+We'd also love to have you join the Q-Continuum [mailing list][].
+
+[wiki]: https://github.com/kriskowal/q/wiki
+[reference]: https://github.com/kriskowal/q/wiki/API-Reference
+[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery
+[Libraries]: https://github.com/kriskowal/q/wiki/Libraries
+[resources]: https://github.com/kriskowal/q/wiki/General-Promise-Resources
+[jquery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery
+[mailing list]: https://groups.google.com/forum/#!forum/q-continuum
+
+
+## Tutorial
+
+Promises have a ``then`` method, which you can use to get the eventual
+return value (fulfillment) or thrown exception (rejection).
+
+```javascript
+promiseMeSomething()
+.then(function (value) {
+}, function (reason) {
+});
+```
+
+If ``promiseMeSomething`` returns a promise that gets fulfilled later
+with a return value, the first function (the fulfillment handler) will be
+called with the value.  However, if the ``promiseMeSomething`` function
+gets rejected later by a thrown exception, the second function (the
+rejection handler) will be called with the exception.
+
+Note that resolution of a promise is always asynchronous: that is, the
+fulfillment or rejection handler will always be called in the next turn of the
+event loop (i.e. `process.nextTick` in Node). This gives you a nice
+guarantee when mentally tracing the flow of your code, namely that
+``then`` will always return before either handler is executed.
+
+In this tutorial, we begin with how to consume and work with promises. We'll
+talk about how to create them, and thus create functions like
+`promiseMeSomething` that return promises, [below](#the-beginning).
+
+
+### Propagation
+
+The ``then`` method returns a promise, which in this example, I’m
+assigning to ``outputPromise``.
+
+```javascript
+var outputPromise = getInputPromise()
+.then(function (input) {
+}, function (reason) {
+});
+```
+
+The ``outputPromise`` variable becomes a new promise for the return
+value of either handler.  Since a function can only either return a
+value or throw an exception, only one handler will ever be called and it
+will be responsible for resolving ``outputPromise``.
+
+-   If you return a value in a handler, ``outputPromise`` will get
+    fulfilled.
+
+-   If you throw an exception in a handler, ``outputPromise`` will get
+    rejected.
+
+-   If you return a **promise** in a handler, ``outputPromise`` will
+    “become” that promise.  Being able to become a new promise is useful
+    for managing delays, combining results, or recovering from errors.
+
+If the ``getInputPromise()`` promise gets rejected and you omit the
+rejection handler, the **error** will go to ``outputPromise``:
+
+```javascript
+var outputPromise = getInputPromise()
+.then(function (value) {
+});
+```
+
+If the input promise gets fulfilled and you omit the fulfillment handler, the
+**value** will go to ``outputPromise``:
+
+```javascript
+var outputPromise = getInputPromise()
+.then(null, function (error) {
+});
+```
+
+Q promises provide a ``fail`` shorthand for ``then`` when you are only
+interested in handling the error:
+
+```javascript
+var outputPromise = getInputPromise()
+.fail(function (error) {
+});
+```
+
+If you are writing JavaScript for modern engines only or using
+CoffeeScript, you may use `catch` instead of `fail`.
+
+Promises also have a ``fin`` function that is like a ``finally`` clause.
+The final handler gets called, with no arguments, when the promise
+returned by ``getInputPromise()`` either returns a value or throws an
+error.  The value returned or error thrown by ``getInputPromise()``
+passes directly to ``outputPromise`` unless the final handler fails, and
+may be delayed if the final handler returns a promise.
+
+```javascript
+var outputPromise = getInputPromise()
+.fin(function () {
+    // close files, database connections, stop servers, conclude tests
+});
+```
+
+-   If the handler returns a value, the value is ignored
+-   If the handler throws an error, the error passes to ``outputPromise``
+-   If the handler returns a promise, ``outputPromise`` gets postponed.  The
+    eventual value or error has the same effect as an immediate return
+    value or thrown error: a value would be ignored, an error would be
+    forwarded.
+
+If you are writing JavaScript for modern engines only or using
+CoffeeScript, you may use `finally` instead of `fin`.
+
+### Chaining
+
+There are two ways to chain promises.  You can chain promises either
+inside or outside handlers.  The next two examples are equivalent.
+
+```javascript
+return getUsername()
+.then(function (username) {
+    return getUser(username)
+    .then(function (user) {
+        // if we get here without an error,
+        // the value returned here
+        // or the exception thrown here
+        // resolves the promise returned
+        // by the first line
+    })
+});
+```
+
+```javascript
+return getUsername()
+.then(function (username) {
+    return getUser(username);
+})
+.then(function (user) {
+    // if we get here without an error,
+    // the value returned here
+    // or the exception thrown here
+    // resolves the promise returned
+    // by the first line
+});
+```
+
+The only difference is nesting.  It’s useful to nest handlers if you
+need to capture multiple input values in your closure.
+
+```javascript
+function authenticate() {
+    return getUsername()
+    .then(function (username) {
+        return getUser(username);
+    })
+    // chained because we will not need the user name in the next event
+    .then(function (user) {
+        return getPassword()
+        // nested because we need both user and password next
+        .then(function (password) {
+            if (user.passwordHash !== hash(password)) {
+                throw new Error("Can't authenticate");
+            }
+        });
+    });
+}
+```
+
+
+### Combination
+
+You can turn an array of promises into a promise for the whole,
+fulfilled array using ``all``.
+
+```javascript
+return Q.all([
+    eventualAdd(2, 2),
+    eventualAdd(10, 20)
+]);
+```
+
+If you have a promise for an array, you can use ``spread`` as a
+replacement for ``then``.  The ``spread`` function “spreads” the
+values over the arguments of the fulfillment handler.  The rejection handler
+will get called at the first sign of failure.  That is, whichever of
+the received promises fails first gets handled by the rejection handler.
+
+```javascript
+function eventualAdd(a, b) {
+    return Q.spread([a, b], function (a, b) {
+        return a + b;
+    })
+}
+```
+
+But ``spread`` calls ``all`` initially, so you can skip it in chains.
+
+```javascript
+return getUsername()
+.then(function (username) {
+    return [username, getUser(username)];
+})
+.spread(function (username, user) {
+});
+```
+
+The ``all`` function returns a promise for an array of values.  When this
+promise is fulfilled, the array contains the fulfillment values of the original
+promises, in the same order as those promises.  If one of the given promises
+is rejected, the returned promise is immediately rejected, not waiting for the
+rest of the batch.  If you want to wait for all of the promises to either be
+fulfilled or rejected, you can use ``allSettled``.
+
+```javascript
+Q.allSettled(promises)
+.then(function (results) {
+    results.forEach(function (result) {
+        if (result.state === "fulfilled") {
+            var value = result.value;
+        } else {
+            var reason = result.reason;
+        }
+    });
+});
+```
+
+The ``any`` function accepts an array of promises and returns a promise that is
+fulfilled by the first given promise to be fulfilled, or rejected if all of the
+given promises are rejected.
+
+```javascript
+Q.any(promises)
+.then(function (first) {
+    // Any of the promises was fulfilled.
+}, function (error) {
+    // All of the promises were rejected.
+});
+```
+
+### Sequences
+
+If you have a number of promise-producing functions that need
+to be run sequentially, you can of course do so manually:
+
+```javascript
+return foo(initialVal).then(bar).then(baz).then(qux);
+```
+
+However, if you want to run a dynamically constructed sequence of
+functions, you'll want something like this:
+
+```javascript
+var funcs = [foo, bar, baz, qux];
+
+var result = Q(initialVal);
+funcs.forEach(function (f) {
+    result = result.then(f);
+});
+return result;
+```
+
+You can make this slightly more compact using `reduce`:
+
+```javascript
+return funcs.reduce(function (soFar, f) {
+    return soFar.then(f);
+}, Q(initialVal));
+```
+
+Or, you could use the ultra-compact version:
+
+```javascript
+return funcs.reduce(Q.when, Q(initialVal));
+```
+
+### Handling Errors
+
+One sometimes-unintuive aspect of promises is that if you throw an
+exception in the fulfillment handler, it will not be caught by the error
+handler.
+
+```javascript
+return foo()
+.then(function (value) {
+    throw new Error("Can't bar.");
+}, function (error) {
+    // We only get here if "foo" fails
+});
+```
+
+To see why this is, consider the parallel between promises and
+``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error
+handler represents a ``catch`` for ``foo()``, while the fulfillment handler
+represents code that happens *after* the ``try``/``catch`` block.
+That code then needs its own ``try``/``catch`` block.
+
+In terms of promises, this means chaining your rejection handler:
+
+```javascript
+return foo()
+.then(function (value) {
+    throw new Error("Can't bar.");
+})
+.fail(function (error) {
+    // We get here with either foo's error or bar's error
+});
+```
+
+### Progress Notification
+
+It's possible for promises to report their progress, e.g. for tasks that take a
+long time like a file upload. Not all promises will implement progress
+notifications, but for those that do, you can consume the progress values using
+a third parameter to ``then``:
+
+```javascript
+return uploadFile()
+.then(function () {
+    // Success uploading the file
+}, function (err) {
+    // There was an error, and we get the reason for error
+}, function (progress) {
+    // We get notified of the upload's progress as it is executed
+});
+```
+
+Like `fail`, Q also provides a shorthand for progress callbacks
+called `progress`:
+
+```javascript
+return uploadFile().progress(function (progress) {
+    // We get notified of the upload's progress
+});
+```
+
+### The End
+
+When you get to the end of a chain of promises, you should either
+return the last promise or end the chain.  Since handlers catch
+errors, it’s an unfortunate pattern that the exceptions can go
+unobserved.
+
+So, either return it,
+
+```javascript
+return foo()
+.then(function () {
+    return "bar";
+});
+```
+
+Or, end it.
+
+```javascript
+foo()
+.then(function () {
+    return "bar";
+})
+.done();
+```
+
+Ending a promise chain makes sure that, if an error doesn’t get
+handled before the end, it will get rethrown and reported.
+
+This is a stopgap. We are exploring ways to make unhandled errors
+visible without any explicit handling.
+
+
+### The Beginning
+
+Everything above assumes you get a promise from somewhere else.  This
+is the common case.  Every once in a while, you will need to create a
+promise from scratch.
+
+#### Using ``Q.fcall``
+
+You can create a promise from a value using ``Q.fcall``.  This returns a
+promise for 10.
+
+```javascript
+return Q.fcall(function () {
+    return 10;
+});
+```
+
+You can also use ``fcall`` to get a promise for an exception.
+
+```javascript
+return Q.fcall(function () {
+    throw new Error("Can't do it");
+});
+```
+
+As the name implies, ``fcall`` can call functions, or even promised
+functions.  This uses the ``eventualAdd`` function above to add two
+numbers.
+
+```javascript
+return Q.fcall(eventualAdd, 2, 2);
+```
+
+
+#### Using Deferreds
+
+If you have to interface with asynchronous functions that are callback-based
+instead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and
+friends). But much of the time, the solution will be to use *deferreds*.
+
+```javascript
+var deferred = Q.defer();
+FS.readFile("foo.txt", "utf-8", function (error, text) {
+    if (error) {
+        deferred.reject(new Error(error));
+    } else {
+        deferred.resolve(text);
+    }
+});
+return deferred.promise;
+```
+
+Note that a deferred can be resolved with a value or a promise.  The
+``reject`` function is a shorthand for resolving with a rejected
+promise.
+
+```javascript
+// this:
+deferred.reject(new Error("Can't do it"));
+
+// is shorthand for:
+var rejection = Q.fcall(function () {
+    throw new Error("Can't do it");
+});
+deferred.resolve(rejection);
+```
+
+This is a simplified implementation of ``Q.delay``.
+
+```javascript
+function delay(ms) {
+    var deferred = Q.defer();
+    setTimeout(deferred.resolve, ms);
+    return deferred.promise;
+}
+```
+
+This is a simplified implementation of ``Q.timeout``
+
+```javascript
+function timeout(promise, ms) {
+    var deferred = Q.defer();
+    Q.when(promise, deferred.resolve);
+    delay(ms).then(function () {
+        deferred.reject(new Error("Timed out"));
+    });
+    return deferred.promise;
+}
+```
+
+Finally, you can send a progress notification to the promise with
+``deferred.notify``.
+
+For illustration, this is a wrapper for XML HTTP requests in the browser. Note
+that a more [thorough][XHR] implementation would be in order in practice.
+
+[XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73
+
+```javascript
+function requestOkText(url) {
+    var request = new XMLHttpRequest();
+    var deferred = Q.defer();
+
+    request.open("GET", url, true);
+    request.onload = onload;
+    request.onerror = onerror;
+    request.onprogress = onprogress;
+    request.send();
+
+    function onload() {
+        if (request.status === 200) {
+            deferred.resolve(request.responseText);
+        } else {
+            deferred.reject(new Error("Status code was " + request.status));
+        }
+    }
+
+    function onerror() {
+        deferred.reject(new Error("Can't XHR " + JSON.stringify(url)));
+    }
+
+    function onprogress(event) {
+        deferred.notify(event.loaded / event.total);
+    }
+
+    return deferred.promise;
+}
+```
+
+Below is an example of how to use this ``requestOkText`` function:
+
+```javascript
+requestOkText("http://localhost:3000")
+.then(function (responseText) {
+    // If the HTTP response returns 200 OK, log the response text.
+    console.log(responseText);
+}, function (error) {
+    // If there's an error or a non-200 status code, log the error.
+    console.error(error);
+}, function (progress) {
+    // Log the progress as it comes in.
+    console.log("Request progress: " + Math.round(progress * 100) + "%");
+});
+```
+
+#### Using `Q.Promise`
+
+This is an alternative promise-creation API that has the same power as
+the deferred concept, but without introducing another conceptual entity.
+
+Rewriting the `requestOkText` example above using `Q.Promise`:
+
+```javascript
+function requestOkText(url) {
+    return Q.Promise(function(resolve, reject, notify) {
+        var request = new XMLHttpRequest();
+
+        request.open("GET", url, true);
+        request.onload = onload;
+        request.onerror = onerror;
+        request.onprogress = onprogress;
+        request.send();
+
+        function onload() {
+            if (request.status === 200) {
+                resolve(request.responseText);
+            } else {
+                reject(new Error("Status code was " + request.status));
+            }
+        }
+
+        function onerror() {
+            reject(new Error("Can't XHR " + JSON.stringify(url)));
+        }
+
+        function onprogress(event) {
+            notify(event.loaded / event.total);
+        }
+    });
+}
+```
+
+If `requestOkText` were to throw an exception, the returned promise would be
+rejected with that thrown exception as the rejection reason.
+
+### The Middle
+
+If you are using a function that may return a promise, but just might
+return a value if it doesn’t need to defer, you can use the “static”
+methods of the Q library.
+
+The ``when`` function is the static equivalent for ``then``.
+
+```javascript
+return Q.when(valueOrPromise, function (value) {
+}, function (error) {
+});
+```
+
+All of the other methods on a promise have static analogs with the
+same name.
+
+The following are equivalent:
+
+```javascript
+return Q.all([a, b]);
+```
+
+```javascript
+return Q.fcall(function () {
+    return [a, b];
+})
+.all();
+```
+
+When working with promises provided by other libraries, you should
+convert it to a Q promise.  Not all promise libraries make the same
+guarantees as Q and certainly don’t provide all of the same methods.
+Most libraries only provide a partially functional ``then`` method.
+This thankfully is all we need to turn them into vibrant Q promises.
+
+```javascript
+return Q($.ajax(...))
+.then(function () {
+});
+```
+
+If there is any chance that the promise you receive is not a Q promise
+as provided by your library, you should wrap it using a Q function.
+You can even use ``Q.invoke`` as a shorthand.
+
+```javascript
+return Q.invoke($, 'ajax', ...)
+.then(function () {
+});
+```
+
+
+### Over the Wire
+
+A promise can serve as a proxy for another object, even a remote
+object.  There are methods that allow you to optimistically manipulate
+properties or call functions.  All of these interactions return
+promises, so they can be chained.
+
+```
+direct manipulation         using a promise as a proxy
+--------------------------  -------------------------------
+value.foo                   promise.get("foo")
+value.foo = value           promise.put("foo", value)
+delete value.foo            promise.del("foo")
+value.foo(...args)          promise.post("foo", [args])
+value.foo(...args)          promise.invoke("foo", ...args)
+value(...args)              promise.fapply([args])
+value(...args)              promise.fcall(...args)
+```
+
+If the promise is a proxy for a remote object, you can shave
+round-trips by using these functions instead of ``then``.  To take
+advantage of promises for remote objects, check out [Q-Connection][].
+
+[Q-Connection]: https://github.com/kriskowal/q-connection
+
+Even in the case of non-remote objects, these methods can be used as
+shorthand for particularly-simple fulfillment handlers. For example, you
+can replace
+
+```javascript
+return Q.fcall(function () {
+    return [{ foo: "bar" }, { foo: "baz" }];
+})
+.then(function (value) {
+    return value[0].foo;
+});
+```
+
+with
+
+```javascript
+return Q.fcall(function () {
+    return [{ foo: "bar" }, { foo: "baz" }];
+})
+.get(0)
+.get("foo");
+```
+
+
+### Adapting Node
+
+If you're working with functions that make use of the Node.js callback pattern,
+where callbacks are in the form of `function(err, result)`, Q provides a few
+useful utility functions for converting between them. The most straightforward
+are probably `Q.nfcall` and `Q.nfapply` ("Node function call/apply") for calling
+Node.js-style functions and getting back a promise:
+
+```javascript
+return Q.nfcall(FS.readFile, "foo.txt", "utf-8");
+return Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
+```
+
+If you are working with methods, instead of simple functions, you can easily
+run in to the usual problems where passing a method to another function—like
+`Q.nfcall`—"un-binds" the method from its owner. To avoid this, you can either
+use `Function.prototype.bind` or some nice shortcut methods we provide:
+
+```javascript
+return Q.ninvoke(redisClient, "get", "user:1:id");
+return Q.npost(redisClient, "get", ["user:1:id"]);
+```
+
+You can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:
+
+```javascript
+var readFile = Q.denodeify(FS.readFile);
+return readFile("foo.txt", "utf-8");
+
+var redisClientGet = Q.nbind(redisClient.get, redisClient);
+return redisClientGet("user:1:id");
+```
+
+Finally, if you're working with raw deferred objects, there is a
+`makeNodeResolver` method on deferreds that can be handy:
+
+```javascript
+var deferred = Q.defer();
+FS.readFile("foo.txt", "utf-8", deferred.makeNodeResolver());
+return deferred.promise;
+```
+
+### Long Stack Traces
+
+Q comes with optional support for “long stack traces,” wherein the `stack`
+property of `Error` rejection reasons is rewritten to be traced along
+asynchronous jumps instead of stopping at the most recent one. As an example:
+
+```js
+function theDepthsOfMyProgram() {
+  Q.delay(100).done(function explode() {
+    throw new Error("boo!");
+  });
+}
+
+theDepthsOfMyProgram();
+```
+
+usually would give a rather unhelpful stack trace looking something like
+
+```
+Error: boo!
+    at explode (/path/to/test.js:3:11)
+    at _fulfilled (/path/to/test.js:q:54)
+    at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)
+    at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)
+    at pending (/path/to/q.js:397:39)
+    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
+```
+
+But, if you turn this feature on by setting
+
+```js
+Q.longStackSupport = true;
+```
+
+then the above code gives a nice stack trace to the tune of
+
+```
+Error: boo!
+    at explode (/path/to/test.js:3:11)
+From previous event:
+    at theDepthsOfMyProgram (/path/to/test.js:2:16)
+    at Object.<anonymous> (/path/to/test.js:7:1)
+```
+
+Note how you can see the function that triggered the async operation in the
+stack trace! This is very helpful for debugging, as otherwise you end up getting
+only the first line, plus a bunch of Q internals, with no sign of where the
+operation started.
+
+In node.js, this feature can also be enabled through the Q_DEBUG environment
+variable:
+
+```
+Q_DEBUG=1 node server.js
+```
+
+This will enable long stack support in every instance of Q.
+
+This feature does come with somewhat-serious performance and memory overhead,
+however. If you're working with lots of promises, or trying to scale a server
+to many users, you should probably keep it off. But in development, go for it!
+
+## Tests
+
+You can view the results of the Q test suite [in your browser][tests]!
+
+[tests]: https://rawgithub.com/kriskowal/q/v1/spec/q-spec.html
+
+## License
+
+Copyright 2009–2015 Kristopher Michael Kowal and contributors
+MIT License (enclosed)
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/package.json
new file mode 100755 (executable)
index 0000000..cfca946
--- /dev/null
@@ -0,0 +1,119 @@
+{
+  "name": "q",
+  "version": "1.2.0",
+  "description": "A library for promises (CommonJS/Promises/A,B,D)",
+  "homepage": "https://github.com/kriskowal/q",
+  "author": {
+    "name": "Kris Kowal",
+    "email": "kris@cixar.com",
+    "url": "https://github.com/kriskowal"
+  },
+  "keywords": [
+    "q",
+    "promise",
+    "promises",
+    "promises-a",
+    "promises-aplus",
+    "deferred",
+    "future",
+    "async",
+    "flow control",
+    "fluent",
+    "browser",
+    "node"
+  ],
+  "contributors": [
+    {
+      "name": "Kris Kowal",
+      "email": "kris@cixar.com",
+      "url": "https://github.com/kriskowal"
+    },
+    {
+      "name": "Irakli Gozalishvili",
+      "email": "rfobic@gmail.com",
+      "url": "http://jeditoolkit.com"
+    },
+    {
+      "name": "Domenic Denicola",
+      "email": "domenic@domenicdenicola.com",
+      "url": "http://domenicdenicola.com"
+    }
+  ],
+  "bugs": {
+    "url": "http://github.com/kriskowal/q/issues"
+  },
+  "license": {
+    "type": "MIT",
+    "url": "http://github.com/kriskowal/q/raw/master/LICENSE"
+  },
+  "main": "q.js",
+  "files": [
+    "LICENSE",
+    "q.js",
+    "queue.js"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/kriskowal/q.git"
+  },
+  "engines": {
+    "node": ">=0.6.0",
+    "teleport": ">=0.2.0"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "jshint": "~2.1.9",
+    "cover": "*",
+    "jasmine-node": "1.11.0",
+    "opener": "*",
+    "promises-aplus-tests": "1.x",
+    "grunt": "~0.4.1",
+    "grunt-cli": "~0.1.9",
+    "grunt-contrib-uglify": "~0.2.2",
+    "matcha": "~0.2.0"
+  },
+  "scripts": {
+    "test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
+    "test-browser": "opener spec/q-spec.html",
+    "benchmark": "matcha",
+    "lint": "jshint q.js",
+    "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html",
+    "minify": "grunt",
+    "prepublish": "grunt"
+  },
+  "overlay": {
+    "teleport": {
+      "dependencies": {
+        "system": ">=0.0.4"
+      }
+    }
+  },
+  "directories": {
+    "test": "./spec"
+  },
+  "gitHead": "2d9b6ab155ec8229516d34628b9aeeda90f6b6b8",
+  "_id": "q@1.2.0",
+  "_shasum": "811705ce4a9802adff811ab0fcdbd01946e1fe22",
+  "_from": "q@^1.1.2",
+  "_npmVersion": "1.4.21",
+  "_npmUser": {
+    "name": "kriskowal",
+    "email": "kris.kowal@cixar.com"
+  },
+  "maintainers": [
+    {
+      "name": "kriskowal",
+      "email": "kris.kowal@cixar.com"
+    },
+    {
+      "name": "domenic",
+      "email": "domenic@domenicdenicola.com"
+    }
+  ],
+  "dist": {
+    "shasum": "811705ce4a9802adff811ab0fcdbd01946e1fe22",
+    "tarball": "http://registry.npmjs.org/q/-/q-1.2.0.tgz"
+  },
+  "_resolved": "https://registry.npmjs.org/q/-/q-1.2.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/q.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/q.js
new file mode 100755 (executable)
index 0000000..d9405fd
--- /dev/null
@@ -0,0 +1,1986 @@
+// vim:ts=4:sts=4:sw=4:
+/*!
+ *
+ * Copyright 2009-2012 Kris Kowal under the terms of the MIT
+ * license found at http://github.com/kriskowal/q/raw/master/LICENSE
+ *
+ * With parts by Tyler Close
+ * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
+ * at http://www.opensource.org/licenses/mit-license.html
+ * Forked at ref_send.js version: 2009-05-11
+ *
+ * With parts by Mark Miller
+ * Copyright (C) 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+(function (definition) {
+    "use strict";
+
+    // This file will function properly as a <script> tag, or a module
+    // using CommonJS and NodeJS or RequireJS module formats.  In
+    // Common/Node/RequireJS, the module exports the Q API and when
+    // executed as a simple <script>, it creates a Q global instead.
+
+    // Montage Require
+    if (typeof bootstrap === "function") {
+        bootstrap("promise", definition);
+
+    // CommonJS
+    } else if (typeof exports === "object" && typeof module === "object") {
+        module.exports = definition();
+
+    // RequireJS
+    } else if (typeof define === "function" && define.amd) {
+        define(definition);
+
+    // SES (Secure EcmaScript)
+    } else if (typeof ses !== "undefined") {
+        if (!ses.ok()) {
+            return;
+        } else {
+            ses.makeQ = definition;
+        }
+
+    // <script>
+    } else if (typeof self !== "undefined") {
+        self.Q = definition();
+
+    } else {
+        throw new Error("This environment was not anticipated by Q. Please file a bug.");
+    }
+
+})(function () {
+"use strict";
+
+var hasStacks = false;
+try {
+    throw new Error();
+} catch (e) {
+    hasStacks = !!e.stack;
+}
+
+// All code after this point will be filtered from stack traces reported
+// by Q.
+var qStartingLine = captureLine();
+var qFileName;
+
+// shims
+
+// used for fallback in "allResolved"
+var noop = function () {};
+
+// Use the fastest possible means to execute a task in a future turn
+// of the event loop.
+var nextTick =(function () {
+    // linked list of tasks (single, with head node)
+    var head = {task: void 0, next: null};
+    var tail = head;
+    var flushing = false;
+    var requestTick = void 0;
+    var isNodeJS = false;
+
+    function flush() {
+        /* jshint loopfunc: true */
+
+        while (head.next) {
+            head = head.next;
+            var task = head.task;
+            head.task = void 0;
+            var domain = head.domain;
+
+            if (domain) {
+                head.domain = void 0;
+                domain.enter();
+            }
+
+            try {
+                task();
+
+            } catch (e) {
+                if (isNodeJS) {
+                    // In node, uncaught exceptions are considered fatal errors.
+                    // Re-throw them synchronously to interrupt flushing!
+
+                    // Ensure continuation if the uncaught exception is suppressed
+                    // listening "uncaughtException" events (as domains does).
+                    // Continue in next event to avoid tick recursion.
+                    if (domain) {
+                        domain.exit();
+                    }
+                    setTimeout(flush, 0);
+                    if (domain) {
+                        domain.enter();
+                    }
+
+                    throw e;
+
+                } else {
+                    // In browsers, uncaught exceptions are not fatal.
+                    // Re-throw them asynchronously to avoid slow-downs.
+                    setTimeout(function() {
+                       throw e;
+                    }, 0);
+                }
+            }
+
+            if (domain) {
+                domain.exit();
+            }
+        }
+
+        flushing = false;
+    }
+
+    nextTick = function (task) {
+        tail = tail.next = {
+            task: task,
+            domain: isNodeJS && process.domain,
+            next: null
+        };
+
+        if (!flushing) {
+            flushing = true;
+            requestTick();
+        }
+    };
+
+    if (typeof process !== "undefined" && process.nextTick) {
+        // Node.js before 0.9. Note that some fake-Node environments, like the
+        // Mocha test runner, introduce a `process` global without a `nextTick`.
+        isNodeJS = true;
+
+        requestTick = function () {
+            process.nextTick(flush);
+        };
+
+    } else if (typeof setImmediate === "function") {
+        // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate
+        if (typeof window !== "undefined") {
+            requestTick = setImmediate.bind(window, flush);
+        } else {
+            requestTick = function () {
+                setImmediate(flush);
+            };
+        }
+
+    } else if (typeof MessageChannel !== "undefined") {
+        // modern browsers
+        // http://www.nonblocking.io/2011/06/windownexttick.html
+        var channel = new MessageChannel();
+        // At least Safari Version 6.0.5 (8536.30.1) intermittently cannot create
+        // working message ports the first time a page loads.
+        channel.port1.onmessage = function () {
+            requestTick = requestPortTick;
+            channel.port1.onmessage = flush;
+            flush();
+        };
+        var requestPortTick = function () {
+            // Opera requires us to provide a message payload, regardless of
+            // whether we use it.
+            channel.port2.postMessage(0);
+        };
+        requestTick = function () {
+            setTimeout(flush, 0);
+            requestPortTick();
+        };
+
+    } else {
+        // old browsers
+        requestTick = function () {
+            setTimeout(flush, 0);
+        };
+    }
+
+    return nextTick;
+})();
+
+// Attempt to make generics safe in the face of downstream
+// modifications.
+// There is no situation where this is necessary.
+// If you need a security guarantee, these primordials need to be
+// deeply frozen anyway, and if you don’t need a security guarantee,
+// this is just plain paranoid.
+// However, this **might** have the nice side-effect of reducing the size of
+// the minified code by reducing x.call() to merely x()
+// See Mark Miller’s explanation of what this does.
+// http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming
+var call = Function.call;
+function uncurryThis(f) {
+    return function () {
+        return call.apply(f, arguments);
+    };
+}
+// This is equivalent, but slower:
+// uncurryThis = Function_bind.bind(Function_bind.call);
+// http://jsperf.com/uncurrythis
+
+var array_slice = uncurryThis(Array.prototype.slice);
+
+var array_reduce = uncurryThis(
+    Array.prototype.reduce || function (callback, basis) {
+        var index = 0,
+            length = this.length;
+        // concerning the initial value, if one is not provided
+        if (arguments.length === 1) {
+            // seek to the first value in the array, accounting
+            // for the possibility that is is a sparse array
+            do {
+                if (index in this) {
+                    basis = this[index++];
+                    break;
+                }
+                if (++index >= length) {
+                    throw new TypeError();
+                }
+            } while (1);
+        }
+        // reduce
+        for (; index < length; index++) {
+            // account for the possibility that the array is sparse
+            if (index in this) {
+                basis = callback(basis, this[index], index);
+            }
+        }
+        return basis;
+    }
+);
+
+var array_indexOf = uncurryThis(
+    Array.prototype.indexOf || function (value) {
+        // not a very good shim, but good enough for our one use of it
+        for (var i = 0; i < this.length; i++) {
+            if (this[i] === value) {
+                return i;
+            }
+        }
+        return -1;
+    }
+);
+
+var array_map = uncurryThis(
+    Array.prototype.map || function (callback, thisp) {
+        var self = this;
+        var collect = [];
+        array_reduce(self, function (undefined, value, index) {
+            collect.push(callback.call(thisp, value, index, self));
+        }, void 0);
+        return collect;
+    }
+);
+
+var object_create = Object.create || function (prototype) {
+    function Type() { }
+    Type.prototype = prototype;
+    return new Type();
+};
+
+var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
+
+var object_keys = Object.keys || function (object) {
+    var keys = [];
+    for (var key in object) {
+        if (object_hasOwnProperty(object, key)) {
+            keys.push(key);
+        }
+    }
+    return keys;
+};
+
+var object_toString = uncurryThis(Object.prototype.toString);
+
+function isObject(value) {
+    return value === Object(value);
+}
+
+// generator related shims
+
+// FIXME: Remove this function once ES6 generators are in SpiderMonkey.
+function isStopIteration(exception) {
+    return (
+        object_toString(exception) === "[object StopIteration]" ||
+        exception instanceof QReturnValue
+    );
+}
+
+// FIXME: Remove this helper and Q.return once ES6 generators are in
+// SpiderMonkey.
+var QReturnValue;
+if (typeof ReturnValue !== "undefined") {
+    QReturnValue = ReturnValue;
+} else {
+    QReturnValue = function (value) {
+        this.value = value;
+    };
+}
+
+// long stack traces
+
+var STACK_JUMP_SEPARATOR = "From previous event:";
+
+function makeStackTraceLong(error, promise) {
+    // If possible, transform the error stack trace by removing Node and Q
+    // cruft, then concatenating with the stack trace of `promise`. See #57.
+    if (hasStacks &&
+        promise.stack &&
+        typeof error === "object" &&
+        error !== null &&
+        error.stack &&
+        error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
+    ) {
+        var stacks = [];
+        for (var p = promise; !!p; p = p.source) {
+            if (p.stack) {
+                stacks.unshift(p.stack);
+            }
+        }
+        stacks.unshift(error.stack);
+
+        var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
+        error.stack = filterStackString(concatedStacks);
+    }
+}
+
+function filterStackString(stackString) {
+    var lines = stackString.split("\n");
+    var desiredLines = [];
+    for (var i = 0; i < lines.length; ++i) {
+        var line = lines[i];
+
+        if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
+            desiredLines.push(line);
+        }
+    }
+    return desiredLines.join("\n");
+}
+
+function isNodeFrame(stackLine) {
+    return stackLine.indexOf("(module.js:") !== -1 ||
+           stackLine.indexOf("(node.js:") !== -1;
+}
+
+function getFileNameAndLineNumber(stackLine) {
+    // Named functions: "at functionName (filename:lineNumber:columnNumber)"
+    // In IE10 function name can have spaces ("Anonymous function") O_o
+    var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
+    if (attempt1) {
+        return [attempt1[1], Number(attempt1[2])];
+    }
+
+    // Anonymous functions: "at filename:lineNumber:columnNumber"
+    var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
+    if (attempt2) {
+        return [attempt2[1], Number(attempt2[2])];
+    }
+
+    // Firefox style: "function@filename:lineNumber or @filename:lineNumber"
+    var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
+    if (attempt3) {
+        return [attempt3[1], Number(attempt3[2])];
+    }
+}
+
+function isInternalFrame(stackLine) {
+    var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
+
+    if (!fileNameAndLineNumber) {
+        return false;
+    }
+
+    var fileName = fileNameAndLineNumber[0];
+    var lineNumber = fileNameAndLineNumber[1];
+
+    return fileName === qFileName &&
+        lineNumber >= qStartingLine &&
+        lineNumber <= qEndingLine;
+}
+
+// discover own file name and line number range for filtering stack
+// traces
+function captureLine() {
+    if (!hasStacks) {
+        return;
+    }
+
+    try {
+        throw new Error();
+    } catch (e) {
+        var lines = e.stack.split("\n");
+        var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
+        var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
+        if (!fileNameAndLineNumber) {
+            return;
+        }
+
+        qFileName = fileNameAndLineNumber[0];
+        return fileNameAndLineNumber[1];
+    }
+}
+
+function deprecate(callback, name, alternative) {
+    return function () {
+        if (typeof console !== "undefined" &&
+            typeof console.warn === "function") {
+            console.warn(name + " is deprecated, use " + alternative +
+                         " instead.", new Error("").stack);
+        }
+        return callback.apply(callback, arguments);
+    };
+}
+
+// end of shims
+// beginning of real work
+
+/**
+ * Constructs a promise for an immediate reference, passes promises through, or
+ * coerces promises from different systems.
+ * @param value immediate reference or promise
+ */
+function Q(value) {
+    // If the object is already a Promise, return it directly.  This enables
+    // the resolve function to both be used to created references from objects,
+    // but to tolerably coerce non-promises to promises.
+    if (value instanceof Promise) {
+        return value;
+    }
+
+    // assimilate thenables
+    if (isPromiseAlike(value)) {
+        return coerce(value);
+    } else {
+        return fulfill(value);
+    }
+}
+Q.resolve = Q;
+
+/**
+ * Performs a task in a future turn of the event loop.
+ * @param {Function} task
+ */
+Q.nextTick = nextTick;
+
+/**
+ * Controls whether or not long stack traces will be on
+ */
+Q.longStackSupport = false;
+
+// enable long stacks if Q_DEBUG is set
+if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) {
+    Q.longStackSupport = true;
+}
+
+/**
+ * Constructs a {promise, resolve, reject} object.
+ *
+ * `resolve` is a callback to invoke with a more resolved value for the
+ * promise. To fulfill the promise, invoke `resolve` with any value that is
+ * not a thenable. To reject the promise, invoke `resolve` with a rejected
+ * thenable, or invoke `reject` with the reason directly. To resolve the
+ * promise to another thenable, thus putting it in the same state, invoke
+ * `resolve` with that other thenable.
+ */
+Q.defer = defer;
+function defer() {
+    // if "messages" is an "Array", that indicates that the promise has not yet
+    // been resolved.  If it is "undefined", it has been resolved.  Each
+    // element of the messages array is itself an array of complete arguments to
+    // forward to the resolved promise.  We coerce the resolution value to a
+    // promise using the `resolve` function because it handles both fully
+    // non-thenable values and other thenables gracefully.
+    var messages = [], progressListeners = [], resolvedPromise;
+
+    var deferred = object_create(defer.prototype);
+    var promise = object_create(Promise.prototype);
+
+    promise.promiseDispatch = function (resolve, op, operands) {
+        var args = array_slice(arguments);
+        if (messages) {
+            messages.push(args);
+            if (op === "when" && operands[1]) { // progress operand
+                progressListeners.push(operands[1]);
+            }
+        } else {
+            Q.nextTick(function () {
+                resolvedPromise.promiseDispatch.apply(resolvedPromise, args);
+            });
+        }
+    };
+
+    // XXX deprecated
+    promise.valueOf = function () {
+        if (messages) {
+            return promise;
+        }
+        var nearerValue = nearer(resolvedPromise);
+        if (isPromise(nearerValue)) {
+            resolvedPromise = nearerValue; // shorten chain
+        }
+        return nearerValue;
+    };
+
+    promise.inspect = function () {
+        if (!resolvedPromise) {
+            return { state: "pending" };
+        }
+        return resolvedPromise.inspect();
+    };
+
+    if (Q.longStackSupport && hasStacks) {
+        try {
+            throw new Error();
+        } catch (e) {
+            // NOTE: don't try to use `Error.captureStackTrace` or transfer the
+            // accessor around; that causes memory leaks as per GH-111. Just
+            // reify the stack trace as a string ASAP.
+            //
+            // At the same time, cut off the first line; it's always just
+            // "[object Promise]\n", as per the `toString`.
+            promise.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
+        }
+    }
+
+    // NOTE: we do the checks for `resolvedPromise` in each method, instead of
+    // consolidating them into `become`, since otherwise we'd create new
+    // promises with the lines `become(whatever(value))`. See e.g. GH-252.
+
+    function become(newPromise) {
+        resolvedPromise = newPromise;
+        promise.source = newPromise;
+
+        array_reduce(messages, function (undefined, message) {
+            Q.nextTick(function () {
+                newPromise.promiseDispatch.apply(newPromise, message);
+            });
+        }, void 0);
+
+        messages = void 0;
+        progressListeners = void 0;
+    }
+
+    deferred.promise = promise;
+    deferred.resolve = function (value) {
+        if (resolvedPromise) {
+            return;
+        }
+
+        become(Q(value));
+    };
+
+    deferred.fulfill = function (value) {
+        if (resolvedPromise) {
+            return;
+        }
+
+        become(fulfill(value));
+    };
+    deferred.reject = function (reason) {
+        if (resolvedPromise) {
+            return;
+        }
+
+        become(reject(reason));
+    };
+    deferred.notify = function (progress) {
+        if (resolvedPromise) {
+            return;
+        }
+
+        array_reduce(progressListeners, function (undefined, progressListener) {
+            Q.nextTick(function () {
+                progressListener(progress);
+            });
+        }, void 0);
+    };
+
+    return deferred;
+}
+
+/**
+ * Creates a Node-style callback that will resolve or reject the deferred
+ * promise.
+ * @returns a nodeback
+ */
+defer.prototype.makeNodeResolver = function () {
+    var self = this;
+    return function (error, value) {
+        if (error) {
+            self.reject(error);
+        } else if (arguments.length > 2) {
+            self.resolve(array_slice(arguments, 1));
+        } else {
+            self.resolve(value);
+        }
+    };
+};
+
+/**
+ * @param resolver {Function} a function that returns nothing and accepts
+ * the resolve, reject, and notify functions for a deferred.
+ * @returns a promise that may be resolved with the given resolve and reject
+ * functions, or rejected by a thrown exception in resolver
+ */
+Q.Promise = promise; // ES6
+Q.promise = promise;
+function promise(resolver) {
+    if (typeof resolver !== "function") {
+        throw new TypeError("resolver must be a function.");
+    }
+    var deferred = defer();
+    try {
+        resolver(deferred.resolve, deferred.reject, deferred.notify);
+    } catch (reason) {
+        deferred.reject(reason);
+    }
+    return deferred.promise;
+}
+
+promise.race = race; // ES6
+promise.all = all; // ES6
+promise.reject = reject; // ES6
+promise.resolve = Q; // ES6
+
+// XXX experimental.  This method is a way to denote that a local value is
+// serializable and should be immediately dispatched to a remote upon request,
+// instead of passing a reference.
+Q.passByCopy = function (object) {
+    //freeze(object);
+    //passByCopies.set(object, true);
+    return object;
+};
+
+Promise.prototype.passByCopy = function () {
+    //freeze(object);
+    //passByCopies.set(object, true);
+    return this;
+};
+
+/**
+ * If two promises eventually fulfill to the same value, promises that value,
+ * but otherwise rejects.
+ * @param x {Any*}
+ * @param y {Any*}
+ * @returns {Any*} a promise for x and y if they are the same, but a rejection
+ * otherwise.
+ *
+ */
+Q.join = function (x, y) {
+    return Q(x).join(y);
+};
+
+Promise.prototype.join = function (that) {
+    return Q([this, that]).spread(function (x, y) {
+        if (x === y) {
+            // TODO: "===" should be Object.is or equiv
+            return x;
+        } else {
+            throw new Error("Can't join: not the same: " + x + " " + y);
+        }
+    });
+};
+
+/**
+ * Returns a promise for the first of an array of promises to become settled.
+ * @param answers {Array[Any*]} promises to race
+ * @returns {Any*} the first promise to be settled
+ */
+Q.race = race;
+function race(answerPs) {
+    return promise(function(resolve, reject) {
+        // Switch to this once we can assume at least ES5
+        // answerPs.forEach(function(answerP) {
+        //     Q(answerP).then(resolve, reject);
+        // });
+        // Use this in the meantime
+        for (var i = 0, len = answerPs.length; i < len; i++) {
+            Q(answerPs[i]).then(resolve, reject);
+        }
+    });
+}
+
+Promise.prototype.race = function () {
+    return this.then(Q.race);
+};
+
+/**
+ * Constructs a Promise with a promise descriptor object and optional fallback
+ * function.  The descriptor contains methods like when(rejected), get(name),
+ * set(name, value), post(name, args), and delete(name), which all
+ * return either a value, a promise for a value, or a rejection.  The fallback
+ * accepts the operation name, a resolver, and any further arguments that would
+ * have been forwarded to the appropriate method above had a method been
+ * provided with the proper name.  The API makes no guarantees about the nature
+ * of the returned object, apart from that it is usable whereever promises are
+ * bought and sold.
+ */
+Q.makePromise = Promise;
+function Promise(descriptor, fallback, inspect) {
+    if (fallback === void 0) {
+        fallback = function (op) {
+            return reject(new Error(
+                "Promise does not support operation: " + op
+            ));
+        };
+    }
+    if (inspect === void 0) {
+        inspect = function () {
+            return {state: "unknown"};
+        };
+    }
+
+    var promise = object_create(Promise.prototype);
+
+    promise.promiseDispatch = function (resolve, op, args) {
+        var result;
+        try {
+            if (descriptor[op]) {
+                result = descriptor[op].apply(promise, args);
+            } else {
+                result = fallback.call(promise, op, args);
+            }
+        } catch (exception) {
+            result = reject(exception);
+        }
+        if (resolve) {
+            resolve(result);
+        }
+    };
+
+    promise.inspect = inspect;
+
+    // XXX deprecated `valueOf` and `exception` support
+    if (inspect) {
+        var inspected = inspect();
+        if (inspected.state === "rejected") {
+            promise.exception = inspected.reason;
+        }
+
+        promise.valueOf = function () {
+            var inspected = inspect();
+            if (inspected.state === "pending" ||
+                inspected.state === "rejected") {
+                return promise;
+            }
+            return inspected.value;
+        };
+    }
+
+    return promise;
+}
+
+Promise.prototype.toString = function () {
+    return "[object Promise]";
+};
+
+Promise.prototype.then = function (fulfilled, rejected, progressed) {
+    var self = this;
+    var deferred = defer();
+    var done = false;   // ensure the untrusted promise makes at most a
+                        // single call to one of the callbacks
+
+    function _fulfilled(value) {
+        try {
+            return typeof fulfilled === "function" ? fulfilled(value) : value;
+        } catch (exception) {
+            return reject(exception);
+        }
+    }
+
+    function _rejected(exception) {
+        if (typeof rejected === "function") {
+            makeStackTraceLong(exception, self);
+            try {
+                return rejected(exception);
+            } catch (newException) {
+                return reject(newException);
+            }
+        }
+        return reject(exception);
+    }
+
+    function _progressed(value) {
+        return typeof progressed === "function" ? progressed(value) : value;
+    }
+
+    Q.nextTick(function () {
+        self.promiseDispatch(function (value) {
+            if (done) {
+                return;
+            }
+            done = true;
+
+            deferred.resolve(_fulfilled(value));
+        }, "when", [function (exception) {
+            if (done) {
+                return;
+            }
+            done = true;
+
+            deferred.resolve(_rejected(exception));
+        }]);
+    });
+
+    // Progress propagator need to be attached in the current tick.
+    self.promiseDispatch(void 0, "when", [void 0, function (value) {
+        var newValue;
+        var threw = false;
+        try {
+            newValue = _progressed(value);
+        } catch (e) {
+            threw = true;
+            if (Q.onerror) {
+                Q.onerror(e);
+            } else {
+                throw e;
+            }
+        }
+
+        if (!threw) {
+            deferred.notify(newValue);
+        }
+    }]);
+
+    return deferred.promise;
+};
+
+Q.tap = function (promise, callback) {
+    return Q(promise).tap(callback);
+};
+
+/**
+ * Works almost like "finally", but not called for rejections.
+ * Original resolution value is passed through callback unaffected.
+ * Callback may return a promise that will be awaited for.
+ * @param {Function} callback
+ * @returns {Q.Promise}
+ * @example
+ * doSomething()
+ *   .then(...)
+ *   .tap(console.log)
+ *   .then(...);
+ */
+Promise.prototype.tap = function (callback) {
+    callback = Q(callback);
+
+    return this.then(function (value) {
+        return callback.fcall(value).thenResolve(value);
+    });
+};
+
+/**
+ * Registers an observer on a promise.
+ *
+ * Guarantees:
+ *
+ * 1. that fulfilled and rejected will be called only once.
+ * 2. that either the fulfilled callback or the rejected callback will be
+ *    called, but not both.
+ * 3. that fulfilled and rejected will not be called in this turn.
+ *
+ * @param value      promise or immediate reference to observe
+ * @param fulfilled  function to be called with the fulfilled value
+ * @param rejected   function to be called with the rejection exception
+ * @param progressed function to be called on any progress notifications
+ * @return promise for the return value from the invoked callback
+ */
+Q.when = when;
+function when(value, fulfilled, rejected, progressed) {
+    return Q(value).then(fulfilled, rejected, progressed);
+}
+
+Promise.prototype.thenResolve = function (value) {
+    return this.then(function () { return value; });
+};
+
+Q.thenResolve = function (promise, value) {
+    return Q(promise).thenResolve(value);
+};
+
+Promise.prototype.thenReject = function (reason) {
+    return this.then(function () { throw reason; });
+};
+
+Q.thenReject = function (promise, reason) {
+    return Q(promise).thenReject(reason);
+};
+
+/**
+ * If an object is not a promise, it is as "near" as possible.
+ * If a promise is rejected, it is as "near" as possible too.
+ * If it’s a fulfilled promise, the fulfillment value is nearer.
+ * If it’s a deferred promise and the deferred has been resolved, the
+ * resolution is "nearer".
+ * @param object
+ * @returns most resolved (nearest) form of the object
+ */
+
+// XXX should we re-do this?
+Q.nearer = nearer;
+function nearer(value) {
+    if (isPromise(value)) {
+        var inspected = value.inspect();
+        if (inspected.state === "fulfilled") {
+            return inspected.value;
+        }
+    }
+    return value;
+}
+
+/**
+ * @returns whether the given object is a promise.
+ * Otherwise it is a fulfilled value.
+ */
+Q.isPromise = isPromise;
+function isPromise(object) {
+    return object instanceof Promise;
+}
+
+Q.isPromiseAlike = isPromiseAlike;
+function isPromiseAlike(object) {
+    return isObject(object) && typeof object.then === "function";
+}
+
+/**
+ * @returns whether the given object is a pending promise, meaning not
+ * fulfilled or rejected.
+ */
+Q.isPending = isPending;
+function isPending(object) {
+    return isPromise(object) && object.inspect().state === "pending";
+}
+
+Promise.prototype.isPending = function () {
+    return this.inspect().state === "pending";
+};
+
+/**
+ * @returns whether the given object is a value or fulfilled
+ * promise.
+ */
+Q.isFulfilled = isFulfilled;
+function isFulfilled(object) {
+    return !isPromise(object) || object.inspect().state === "fulfilled";
+}
+
+Promise.prototype.isFulfilled = function () {
+    return this.inspect().state === "fulfilled";
+};
+
+/**
+ * @returns whether the given object is a rejected promise.
+ */
+Q.isRejected = isRejected;
+function isRejected(object) {
+    return isPromise(object) && object.inspect().state === "rejected";
+}
+
+Promise.prototype.isRejected = function () {
+    return this.inspect().state === "rejected";
+};
+
+//// BEGIN UNHANDLED REJECTION TRACKING
+
+// This promise library consumes exceptions thrown in handlers so they can be
+// handled by a subsequent promise.  The exceptions get added to this array when
+// they are created, and removed when they are handled.  Note that in ES6 or
+// shimmed environments, this would naturally be a `Set`.
+var unhandledReasons = [];
+var unhandledRejections = [];
+var trackUnhandledRejections = true;
+
+function resetUnhandledRejections() {
+    unhandledReasons.length = 0;
+    unhandledRejections.length = 0;
+
+    if (!trackUnhandledRejections) {
+        trackUnhandledRejections = true;
+    }
+}
+
+function trackRejection(promise, reason) {
+    if (!trackUnhandledRejections) {
+        return;
+    }
+
+    unhandledRejections.push(promise);
+    if (reason && typeof reason.stack !== "undefined") {
+        unhandledReasons.push(reason.stack);
+    } else {
+        unhandledReasons.push("(no stack) " + reason);
+    }
+}
+
+function untrackRejection(promise) {
+    if (!trackUnhandledRejections) {
+        return;
+    }
+
+    var at = array_indexOf(unhandledRejections, promise);
+    if (at !== -1) {
+        unhandledRejections.splice(at, 1);
+        unhandledReasons.splice(at, 1);
+    }
+}
+
+Q.resetUnhandledRejections = resetUnhandledRejections;
+
+Q.getUnhandledReasons = function () {
+    // Make a copy so that consumers can't interfere with our internal state.
+    return unhandledReasons.slice();
+};
+
+Q.stopUnhandledRejectionTracking = function () {
+    resetUnhandledRejections();
+    trackUnhandledRejections = false;
+};
+
+resetUnhandledRejections();
+
+//// END UNHANDLED REJECTION TRACKING
+
+/**
+ * Constructs a rejected promise.
+ * @param reason value describing the failure
+ */
+Q.reject = reject;
+function reject(reason) {
+    var rejection = Promise({
+        "when": function (rejected) {
+            // note that the error has been handled
+            if (rejected) {
+                untrackRejection(this);
+            }
+            return rejected ? rejected(reason) : this;
+        }
+    }, function fallback() {
+        return this;
+    }, function inspect() {
+        return { state: "rejected", reason: reason };
+    });
+
+    // Note that the reason has not been handled.
+    trackRejection(rejection, reason);
+
+    return rejection;
+}
+
+/**
+ * Constructs a fulfilled promise for an immediate reference.
+ * @param value immediate reference
+ */
+Q.fulfill = fulfill;
+function fulfill(value) {
+    return Promise({
+        "when": function () {
+            return value;
+        },
+        "get": function (name) {
+            return value[name];
+        },
+        "set": function (name, rhs) {
+            value[name] = rhs;
+        },
+        "delete": function (name) {
+            delete value[name];
+        },
+        "post": function (name, args) {
+            // Mark Miller proposes that post with no name should apply a
+            // promised function.
+            if (name === null || name === void 0) {
+                return value.apply(void 0, args);
+            } else {
+                return value[name].apply(value, args);
+            }
+        },
+        "apply": function (thisp, args) {
+            return value.apply(thisp, args);
+        },
+        "keys": function () {
+            return object_keys(value);
+        }
+    }, void 0, function inspect() {
+        return { state: "fulfilled", value: value };
+    });
+}
+
+/**
+ * Converts thenables to Q promises.
+ * @param promise thenable promise
+ * @returns a Q promise
+ */
+function coerce(promise) {
+    var deferred = defer();
+    Q.nextTick(function () {
+        try {
+            promise.then(deferred.resolve, deferred.reject, deferred.notify);
+        } catch (exception) {
+            deferred.reject(exception);
+        }
+    });
+    return deferred.promise;
+}
+
+/**
+ * Annotates an object such that it will never be
+ * transferred away from this process over any promise
+ * communication channel.
+ * @param object
+ * @returns promise a wrapping of that object that
+ * additionally responds to the "isDef" message
+ * without a rejection.
+ */
+Q.master = master;
+function master(object) {
+    return Promise({
+        "isDef": function () {}
+    }, function fallback(op, args) {
+        return dispatch(object, op, args);
+    }, function () {
+        return Q(object).inspect();
+    });
+}
+
+/**
+ * Spreads the values of a promised array of arguments into the
+ * fulfillment callback.
+ * @param fulfilled callback that receives variadic arguments from the
+ * promised array
+ * @param rejected callback that receives the exception if the promise
+ * is rejected.
+ * @returns a promise for the return value or thrown exception of
+ * either callback.
+ */
+Q.spread = spread;
+function spread(value, fulfilled, rejected) {
+    return Q(value).spread(fulfilled, rejected);
+}
+
+Promise.prototype.spread = function (fulfilled, rejected) {
+    return this.all().then(function (array) {
+        return fulfilled.apply(void 0, array);
+    }, rejected);
+};
+
+/**
+ * The async function is a decorator for generator functions, turning
+ * them into asynchronous generators.  Although generators are only part
+ * of the newest ECMAScript 6 drafts, this code does not cause syntax
+ * errors in older engines.  This code should continue to work and will
+ * in fact improve over time as the language improves.
+ *
+ * ES6 generators are currently part of V8 version 3.19 with the
+ * --harmony-generators runtime flag enabled.  SpiderMonkey has had them
+ * for longer, but under an older Python-inspired form.  This function
+ * works on both kinds of generators.
+ *
+ * Decorates a generator function such that:
+ *  - it may yield promises
+ *  - execution will continue when that promise is fulfilled
+ *  - the value of the yield expression will be the fulfilled value
+ *  - it returns a promise for the return value (when the generator
+ *    stops iterating)
+ *  - the decorated function returns a promise for the return value
+ *    of the generator or the first rejected promise among those
+ *    yielded.
+ *  - if an error is thrown in the generator, it propagates through
+ *    every following yield until it is caught, or until it escapes
+ *    the generator function altogether, and is translated into a
+ *    rejection for the promise returned by the decorated generator.
+ */
+Q.async = async;
+function async(makeGenerator) {
+    return function () {
+        // when verb is "send", arg is a value
+        // when verb is "throw", arg is an exception
+        function continuer(verb, arg) {
+            var result;
+
+            // Until V8 3.19 / Chromium 29 is released, SpiderMonkey is the only
+            // engine that has a deployed base of browsers that support generators.
+            // However, SM's generators use the Python-inspired semantics of
+            // outdated ES6 drafts.  We would like to support ES6, but we'd also
+            // like to make it possible to use generators in deployed browsers, so
+            // we also support Python-style generators.  At some point we can remove
+            // this block.
+
+            if (typeof StopIteration === "undefined") {
+                // ES6 Generators
+                try {
+                    result = generator[verb](arg);
+                } catch (exception) {
+                    return reject(exception);
+                }
+                if (result.done) {
+                    return Q(result.value);
+                } else {
+                    return when(result.value, callback, errback);
+                }
+            } else {
+                // SpiderMonkey Generators
+                // FIXME: Remove this case when SM does ES6 generators.
+                try {
+                    result = generator[verb](arg);
+                } catch (exception) {
+                    if (isStopIteration(exception)) {
+                        return Q(exception.value);
+                    } else {
+                        return reject(exception);
+                    }
+                }
+                return when(result, callback, errback);
+            }
+        }
+        var generator = makeGenerator.apply(this, arguments);
+        var callback = continuer.bind(continuer, "next");
+        var errback = continuer.bind(continuer, "throw");
+        return callback();
+    };
+}
+
+/**
+ * The spawn function is a small wrapper around async that immediately
+ * calls the generator and also ends the promise chain, so that any
+ * unhandled errors are thrown instead of forwarded to the error
+ * handler. This is useful because it's extremely common to run
+ * generators at the top-level to work with libraries.
+ */
+Q.spawn = spawn;
+function spawn(makeGenerator) {
+    Q.done(Q.async(makeGenerator)());
+}
+
+// FIXME: Remove this interface once ES6 generators are in SpiderMonkey.
+/**
+ * Throws a ReturnValue exception to stop an asynchronous generator.
+ *
+ * This interface is a stop-gap measure to support generator return
+ * values in older Firefox/SpiderMonkey.  In browsers that support ES6
+ * generators like Chromium 29, just use "return" in your generator
+ * functions.
+ *
+ * @param value the return value for the surrounding generator
+ * @throws ReturnValue exception with the value.
+ * @example
+ * // ES6 style
+ * Q.async(function* () {
+ *      var foo = yield getFooPromise();
+ *      var bar = yield getBarPromise();
+ *      return foo + bar;
+ * })
+ * // Older SpiderMonkey style
+ * Q.async(function () {
+ *      var foo = yield getFooPromise();
+ *      var bar = yield getBarPromise();
+ *      Q.return(foo + bar);
+ * })
+ */
+Q["return"] = _return;
+function _return(value) {
+    throw new QReturnValue(value);
+}
+
+/**
+ * The promised function decorator ensures that any promise arguments
+ * are settled and passed as values (`this` is also settled and passed
+ * as a value).  It will also ensure that the result of a function is
+ * always a promise.
+ *
+ * @example
+ * var add = Q.promised(function (a, b) {
+ *     return a + b;
+ * });
+ * add(Q(a), Q(B));
+ *
+ * @param {function} callback The function to decorate
+ * @returns {function} a function that has been decorated.
+ */
+Q.promised = promised;
+function promised(callback) {
+    return function () {
+        return spread([this, all(arguments)], function (self, args) {
+            return callback.apply(self, args);
+        });
+    };
+}
+
+/**
+ * sends a message to a value in a future turn
+ * @param object* the recipient
+ * @param op the name of the message operation, e.g., "when",
+ * @param args further arguments to be forwarded to the operation
+ * @returns result {Promise} a promise for the result of the operation
+ */
+Q.dispatch = dispatch;
+function dispatch(object, op, args) {
+    return Q(object).dispatch(op, args);
+}
+
+Promise.prototype.dispatch = function (op, args) {
+    var self = this;
+    var deferred = defer();
+    Q.nextTick(function () {
+        self.promiseDispatch(deferred.resolve, op, args);
+    });
+    return deferred.promise;
+};
+
+/**
+ * Gets the value of a property in a future turn.
+ * @param object    promise or immediate reference for target object
+ * @param name      name of property to get
+ * @return promise for the property value
+ */
+Q.get = function (object, key) {
+    return Q(object).dispatch("get", [key]);
+};
+
+Promise.prototype.get = function (key) {
+    return this.dispatch("get", [key]);
+};
+
+/**
+ * Sets the value of a property in a future turn.
+ * @param object    promise or immediate reference for object object
+ * @param name      name of property to set
+ * @param value     new value of property
+ * @return promise for the return value
+ */
+Q.set = function (object, key, value) {
+    return Q(object).dispatch("set", [key, value]);
+};
+
+Promise.prototype.set = function (key, value) {
+    return this.dispatch("set", [key, value]);
+};
+
+/**
+ * Deletes a property in a future turn.
+ * @param object    promise or immediate reference for target object
+ * @param name      name of property to delete
+ * @return promise for the return value
+ */
+Q.del = // XXX legacy
+Q["delete"] = function (object, key) {
+    return Q(object).dispatch("delete", [key]);
+};
+
+Promise.prototype.del = // XXX legacy
+Promise.prototype["delete"] = function (key) {
+    return this.dispatch("delete", [key]);
+};
+
+/**
+ * Invokes a method in a future turn.
+ * @param object    promise or immediate reference for target object
+ * @param name      name of method to invoke
+ * @param value     a value to post, typically an array of
+ *                  invocation arguments for promises that
+ *                  are ultimately backed with `resolve` values,
+ *                  as opposed to those backed with URLs
+ *                  wherein the posted value can be any
+ *                  JSON serializable object.
+ * @return promise for the return value
+ */
+// bound locally because it is used by other methods
+Q.mapply = // XXX As proposed by "Redsandro"
+Q.post = function (object, name, args) {
+    return Q(object).dispatch("post", [name, args]);
+};
+
+Promise.prototype.mapply = // XXX As proposed by "Redsandro"
+Promise.prototype.post = function (name, args) {
+    return this.dispatch("post", [name, args]);
+};
+
+/**
+ * Invokes a method in a future turn.
+ * @param object    promise or immediate reference for target object
+ * @param name      name of method to invoke
+ * @param ...args   array of invocation arguments
+ * @return promise for the return value
+ */
+Q.send = // XXX Mark Miller's proposed parlance
+Q.mcall = // XXX As proposed by "Redsandro"
+Q.invoke = function (object, name /*...args*/) {
+    return Q(object).dispatch("post", [name, array_slice(arguments, 2)]);
+};
+
+Promise.prototype.send = // XXX Mark Miller's proposed parlance
+Promise.prototype.mcall = // XXX As proposed by "Redsandro"
+Promise.prototype.invoke = function (name /*...args*/) {
+    return this.dispatch("post", [name, array_slice(arguments, 1)]);
+};
+
+/**
+ * Applies the promised function in a future turn.
+ * @param object    promise or immediate reference for target function
+ * @param args      array of application arguments
+ */
+Q.fapply = function (object, args) {
+    return Q(object).dispatch("apply", [void 0, args]);
+};
+
+Promise.prototype.fapply = function (args) {
+    return this.dispatch("apply", [void 0, args]);
+};
+
+/**
+ * Calls the promised function in a future turn.
+ * @param object    promise or immediate reference for target function
+ * @param ...args   array of application arguments
+ */
+Q["try"] =
+Q.fcall = function (object /* ...args*/) {
+    return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]);
+};
+
+Promise.prototype.fcall = function (/*...args*/) {
+    return this.dispatch("apply", [void 0, array_slice(arguments)]);
+};
+
+/**
+ * Binds the promised function, transforming return values into a fulfilled
+ * promise and thrown errors into a rejected one.
+ * @param object    promise or immediate reference for target function
+ * @param ...args   array of application arguments
+ */
+Q.fbind = function (object /*...args*/) {
+    var promise = Q(object);
+    var args = array_slice(arguments, 1);
+    return function fbound() {
+        return promise.dispatch("apply", [
+            this,
+            args.concat(array_slice(arguments))
+        ]);
+    };
+};
+Promise.prototype.fbind = function (/*...args*/) {
+    var promise = this;
+    var args = array_slice(arguments);
+    return function fbound() {
+        return promise.dispatch("apply", [
+            this,
+            args.concat(array_slice(arguments))
+        ]);
+    };
+};
+
+/**
+ * Requests the names of the owned properties of a promised
+ * object in a future turn.
+ * @param object    promise or immediate reference for target object
+ * @return promise for the keys of the eventually settled object
+ */
+Q.keys = function (object) {
+    return Q(object).dispatch("keys", []);
+};
+
+Promise.prototype.keys = function () {
+    return this.dispatch("keys", []);
+};
+
+/**
+ * Turns an array of promises into a promise for an array.  If any of
+ * the promises gets rejected, the whole array is rejected immediately.
+ * @param {Array*} an array (or promise for an array) of values (or
+ * promises for values)
+ * @returns a promise for an array of the corresponding values
+ */
+// By Mark Miller
+// http://wiki.ecmascript.org/doku.php?id=strawman:concurrency&rev=1308776521#allfulfilled
+Q.all = all;
+function all(promises) {
+    return when(promises, function (promises) {
+        var pendingCount = 0;
+        var deferred = defer();
+        array_reduce(promises, function (undefined, promise, index) {
+            var snapshot;
+            if (
+                isPromise(promise) &&
+                (snapshot = promise.inspect()).state === "fulfilled"
+            ) {
+                promises[index] = snapshot.value;
+            } else {
+                ++pendingCount;
+                when(
+                    promise,
+                    function (value) {
+                        promises[index] = value;
+                        if (--pendingCount === 0) {
+                            deferred.resolve(promises);
+                        }
+                    },
+                    deferred.reject,
+                    function (progress) {
+                        deferred.notify({ index: index, value: progress });
+                    }
+                );
+            }
+        }, void 0);
+        if (pendingCount === 0) {
+            deferred.resolve(promises);
+        }
+        return deferred.promise;
+    });
+}
+
+Promise.prototype.all = function () {
+    return all(this);
+};
+
+/**
+ * Returns the first resolved promise of an array. Prior rejected promises are
+ * ignored.  Rejects only if all promises are rejected.
+ * @param {Array*} an array containing values or promises for values
+ * @returns a promise fulfilled with the value of the first resolved promise,
+ * or a rejected promise if all promises are rejected.
+ */
+Q.any = any;
+
+function any(promises) {
+    if (promises.length === 0) {
+        return Q.resolve();
+    }
+
+    var deferred = Q.defer();
+    var pendingCount = 0;
+    array_reduce(promises, function(prev, current, index) {
+        var promise = promises[index];
+
+        pendingCount++;
+
+        when(promise, onFulfilled, onRejected, onProgress);
+        function onFulfilled(result) {
+            deferred.resolve(result);
+        }
+        function onRejected() {
+            pendingCount--;
+            if (pendingCount === 0) {
+                deferred.reject(new Error(
+                    "Can't get fulfillment value from any promise, all " +
+                    "promises were rejected."
+                ));
+            }
+        }
+        function onProgress(progress) {
+            deferred.notify({
+                index: index,
+                value: progress
+            });
+        }
+    }, undefined);
+
+    return deferred.promise;
+}
+
+Promise.prototype.any = function() {
+    return any(this);
+};
+
+/**
+ * Waits for all promises to be settled, either fulfilled or
+ * rejected.  This is distinct from `all` since that would stop
+ * waiting at the first rejection.  The promise returned by
+ * `allResolved` will never be rejected.
+ * @param promises a promise for an array (or an array) of promises
+ * (or values)
+ * @return a promise for an array of promises
+ */
+Q.allResolved = deprecate(allResolved, "allResolved", "allSettled");
+function allResolved(promises) {
+    return when(promises, function (promises) {
+        promises = array_map(promises, Q);
+        return when(all(array_map(promises, function (promise) {
+            return when(promise, noop, noop);
+        })), function () {
+            return promises;
+        });
+    });
+}
+
+Promise.prototype.allResolved = function () {
+    return allResolved(this);
+};
+
+/**
+ * @see Promise#allSettled
+ */
+Q.allSettled = allSettled;
+function allSettled(promises) {
+    return Q(promises).allSettled();
+}
+
+/**
+ * Turns an array of promises into a promise for an array of their states (as
+ * returned by `inspect`) when they have all settled.
+ * @param {Array[Any*]} values an array (or promise for an array) of values (or
+ * promises for values)
+ * @returns {Array[State]} an array of states for the respective values.
+ */
+Promise.prototype.allSettled = function () {
+    return this.then(function (promises) {
+        return all(array_map(promises, function (promise) {
+            promise = Q(promise);
+            function regardless() {
+                return promise.inspect();
+            }
+            return promise.then(regardless, regardless);
+        }));
+    });
+};
+
+/**
+ * Captures the failure of a promise, giving an oportunity to recover
+ * with a callback.  If the given promise is fulfilled, the returned
+ * promise is fulfilled.
+ * @param {Any*} promise for something
+ * @param {Function} callback to fulfill the returned promise if the
+ * given promise is rejected
+ * @returns a promise for the return value of the callback
+ */
+Q.fail = // XXX legacy
+Q["catch"] = function (object, rejected) {
+    return Q(object).then(void 0, rejected);
+};
+
+Promise.prototype.fail = // XXX legacy
+Promise.prototype["catch"] = function (rejected) {
+    return this.then(void 0, rejected);
+};
+
+/**
+ * Attaches a listener that can respond to progress notifications from a
+ * promise's originating deferred. This listener receives the exact arguments
+ * passed to ``deferred.notify``.
+ * @param {Any*} promise for something
+ * @param {Function} callback to receive any progress notifications
+ * @returns the given promise, unchanged
+ */
+Q.progress = progress;
+function progress(object, progressed) {
+    return Q(object).then(void 0, void 0, progressed);
+}
+
+Promise.prototype.progress = function (progressed) {
+    return this.then(void 0, void 0, progressed);
+};
+
+/**
+ * Provides an opportunity to observe the settling of a promise,
+ * regardless of whether the promise is fulfilled or rejected.  Forwards
+ * the resolution to the returned promise when the callback is done.
+ * The callback can return a promise to defer completion.
+ * @param {Any*} promise
+ * @param {Function} callback to observe the resolution of the given
+ * promise, takes no arguments.
+ * @returns a promise for the resolution of the given promise when
+ * ``fin`` is done.
+ */
+Q.fin = // XXX legacy
+Q["finally"] = function (object, callback) {
+    return Q(object)["finally"](callback);
+};
+
+Promise.prototype.fin = // XXX legacy
+Promise.prototype["finally"] = function (callback) {
+    callback = Q(callback);
+    return this.then(function (value) {
+        return callback.fcall().then(function () {
+            return value;
+        });
+    }, function (reason) {
+        // TODO attempt to recycle the rejection with "this".
+        return callback.fcall().then(function () {
+            throw reason;
+        });
+    });
+};
+
+/**
+ * Terminates a chain of promises, forcing rejections to be
+ * thrown as exceptions.
+ * @param {Any*} promise at the end of a chain of promises
+ * @returns nothing
+ */
+Q.done = function (object, fulfilled, rejected, progress) {
+    return Q(object).done(fulfilled, rejected, progress);
+};
+
+Promise.prototype.done = function (fulfilled, rejected, progress) {
+    var onUnhandledError = function (error) {
+        // forward to a future turn so that ``when``
+        // does not catch it and turn it into a rejection.
+        Q.nextTick(function () {
+            makeStackTraceLong(error, promise);
+            if (Q.onerror) {
+                Q.onerror(error);
+            } else {
+                throw error;
+            }
+        });
+    };
+
+    // Avoid unnecessary `nextTick`ing via an unnecessary `when`.
+    var promise = fulfilled || rejected || progress ?
+        this.then(fulfilled, rejected, progress) :
+        this;
+
+    if (typeof process === "object" && process && process.domain) {
+        onUnhandledError = process.domain.bind(onUnhandledError);
+    }
+
+    promise.then(void 0, onUnhandledError);
+};
+
+/**
+ * Causes a promise to be rejected if it does not get fulfilled before
+ * some milliseconds time out.
+ * @param {Any*} promise
+ * @param {Number} milliseconds timeout
+ * @param {Any*} custom error message or Error object (optional)
+ * @returns a promise for the resolution of the given promise if it is
+ * fulfilled before the timeout, otherwise rejected.
+ */
+Q.timeout = function (object, ms, error) {
+    return Q(object).timeout(ms, error);
+};
+
+Promise.prototype.timeout = function (ms, error) {
+    var deferred = defer();
+    var timeoutId = setTimeout(function () {
+        if (!error || "string" === typeof error) {
+            error = new Error(error || "Timed out after " + ms + " ms");
+            error.code = "ETIMEDOUT";
+        }
+        deferred.reject(error);
+    }, ms);
+
+    this.then(function (value) {
+        clearTimeout(timeoutId);
+        deferred.resolve(value);
+    }, function (exception) {
+        clearTimeout(timeoutId);
+        deferred.reject(exception);
+    }, deferred.notify);
+
+    return deferred.promise;
+};
+
+/**
+ * Returns a promise for the given value (or promised value), some
+ * milliseconds after it resolved. Passes rejections immediately.
+ * @param {Any*} promise
+ * @param {Number} milliseconds
+ * @returns a promise for the resolution of the given promise after milliseconds
+ * time has elapsed since the resolution of the given promise.
+ * If the given promise rejects, that is passed immediately.
+ */
+Q.delay = function (object, timeout) {
+    if (timeout === void 0) {
+        timeout = object;
+        object = void 0;
+    }
+    return Q(object).delay(timeout);
+};
+
+Promise.prototype.delay = function (timeout) {
+    return this.then(function (value) {
+        var deferred = defer();
+        setTimeout(function () {
+            deferred.resolve(value);
+        }, timeout);
+        return deferred.promise;
+    });
+};
+
+/**
+ * Passes a continuation to a Node function, which is called with the given
+ * arguments provided as an array, and returns a promise.
+ *
+ *      Q.nfapply(FS.readFile, [__filename])
+ *      .then(function (content) {
+ *      })
+ *
+ */
+Q.nfapply = function (callback, args) {
+    return Q(callback).nfapply(args);
+};
+
+Promise.prototype.nfapply = function (args) {
+    var deferred = defer();
+    var nodeArgs = array_slice(args);
+    nodeArgs.push(deferred.makeNodeResolver());
+    this.fapply(nodeArgs).fail(deferred.reject);
+    return deferred.promise;
+};
+
+/**
+ * Passes a continuation to a Node function, which is called with the given
+ * arguments provided individually, and returns a promise.
+ * @example
+ * Q.nfcall(FS.readFile, __filename)
+ * .then(function (content) {
+ * })
+ *
+ */
+Q.nfcall = function (callback /*...args*/) {
+    var args = array_slice(arguments, 1);
+    return Q(callback).nfapply(args);
+};
+
+Promise.prototype.nfcall = function (/*...args*/) {
+    var nodeArgs = array_slice(arguments);
+    var deferred = defer();
+    nodeArgs.push(deferred.makeNodeResolver());
+    this.fapply(nodeArgs).fail(deferred.reject);
+    return deferred.promise;
+};
+
+/**
+ * Wraps a NodeJS continuation passing function and returns an equivalent
+ * version that returns a promise.
+ * @example
+ * Q.nfbind(FS.readFile, __filename)("utf-8")
+ * .then(console.log)
+ * .done()
+ */
+Q.nfbind =
+Q.denodeify = function (callback /*...args*/) {
+    var baseArgs = array_slice(arguments, 1);
+    return function () {
+        var nodeArgs = baseArgs.concat(array_slice(arguments));
+        var deferred = defer();
+        nodeArgs.push(deferred.makeNodeResolver());
+        Q(callback).fapply(nodeArgs).fail(deferred.reject);
+        return deferred.promise;
+    };
+};
+
+Promise.prototype.nfbind =
+Promise.prototype.denodeify = function (/*...args*/) {
+    var args = array_slice(arguments);
+    args.unshift(this);
+    return Q.denodeify.apply(void 0, args);
+};
+
+Q.nbind = function (callback, thisp /*...args*/) {
+    var baseArgs = array_slice(arguments, 2);
+    return function () {
+        var nodeArgs = baseArgs.concat(array_slice(arguments));
+        var deferred = defer();
+        nodeArgs.push(deferred.makeNodeResolver());
+        function bound() {
+            return callback.apply(thisp, arguments);
+        }
+        Q(bound).fapply(nodeArgs).fail(deferred.reject);
+        return deferred.promise;
+    };
+};
+
+Promise.prototype.nbind = function (/*thisp, ...args*/) {
+    var args = array_slice(arguments, 0);
+    args.unshift(this);
+    return Q.nbind.apply(void 0, args);
+};
+
+/**
+ * Calls a method of a Node-style object that accepts a Node-style
+ * callback with a given array of arguments, plus a provided callback.
+ * @param object an object that has the named method
+ * @param {String} name name of the method of object
+ * @param {Array} args arguments to pass to the method; the callback
+ * will be provided by Q and appended to these arguments.
+ * @returns a promise for the value or error
+ */
+Q.nmapply = // XXX As proposed by "Redsandro"
+Q.npost = function (object, name, args) {
+    return Q(object).npost(name, args);
+};
+
+Promise.prototype.nmapply = // XXX As proposed by "Redsandro"
+Promise.prototype.npost = function (name, args) {
+    var nodeArgs = array_slice(args || []);
+    var deferred = defer();
+    nodeArgs.push(deferred.makeNodeResolver());
+    this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
+    return deferred.promise;
+};
+
+/**
+ * Calls a method of a Node-style object that accepts a Node-style
+ * callback, forwarding the given variadic arguments, plus a provided
+ * callback argument.
+ * @param object an object that has the named method
+ * @param {String} name name of the method of object
+ * @param ...args arguments to pass to the method; the callback will
+ * be provided by Q and appended to these arguments.
+ * @returns a promise for the value or error
+ */
+Q.nsend = // XXX Based on Mark Miller's proposed "send"
+Q.nmcall = // XXX Based on "Redsandro's" proposal
+Q.ninvoke = function (object, name /*...args*/) {
+    var nodeArgs = array_slice(arguments, 2);
+    var deferred = defer();
+    nodeArgs.push(deferred.makeNodeResolver());
+    Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject);
+    return deferred.promise;
+};
+
+Promise.prototype.nsend = // XXX Based on Mark Miller's proposed "send"
+Promise.prototype.nmcall = // XXX Based on "Redsandro's" proposal
+Promise.prototype.ninvoke = function (name /*...args*/) {
+    var nodeArgs = array_slice(arguments, 1);
+    var deferred = defer();
+    nodeArgs.push(deferred.makeNodeResolver());
+    this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
+    return deferred.promise;
+};
+
+/**
+ * If a function would like to support both Node continuation-passing-style and
+ * promise-returning-style, it can end its internal promise chain with
+ * `nodeify(nodeback)`, forwarding the optional nodeback argument.  If the user
+ * elects to use a nodeback, the result will be sent there.  If they do not
+ * pass a nodeback, they will receive the result promise.
+ * @param object a result (or a promise for a result)
+ * @param {Function} nodeback a Node.js-style callback
+ * @returns either the promise or nothing
+ */
+Q.nodeify = nodeify;
+function nodeify(object, nodeback) {
+    return Q(object).nodeify(nodeback);
+}
+
+Promise.prototype.nodeify = function (nodeback) {
+    if (nodeback) {
+        this.then(function (value) {
+            Q.nextTick(function () {
+                nodeback(null, value);
+            });
+        }, function (error) {
+            Q.nextTick(function () {
+                nodeback(error);
+            });
+        });
+    } else {
+        return this;
+    }
+};
+
+// All code before this point will be filtered from stack traces.
+var qEndingLine = captureLine();
+
+return Q;
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/queue.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/q/queue.js
new file mode 100755 (executable)
index 0000000..1505fd0
--- /dev/null
@@ -0,0 +1,35 @@
+
+var Q = require("./q");
+
+module.exports = Queue;
+function Queue() {
+    var ends = Q.defer();
+    var closed = Q.defer();
+    return {
+        put: function (value) {
+            var next = Q.defer();
+            ends.resolve({
+                head: value,
+                tail: next.promise
+            });
+            ends.resolve = next.resolve;
+        },
+        get: function () {
+            var result = ends.promise.get("head");
+            ends.promise = ends.promise.get("tail");
+            return result.fail(function (error) {
+                closed.resolve(error);
+                throw error;
+            });
+        },
+        closed: closed.promise,
+        close: function (error) {
+            error = error || new Error("Can't get value from closed queue");
+            var end = {head: Q.reject(error)};
+            end.tail = end;
+            ends.resolve(end);
+            return closed.promise;
+        }
+    };
+}
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/LICENSE
new file mode 100755 (executable)
index 0000000..e3d4e69
--- /dev/null
@@ -0,0 +1,18 @@
+Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/README.md
new file mode 100755 (executable)
index 0000000..e46b823
--- /dev/null
@@ -0,0 +1,15 @@
+# readable-stream
+
+***Node-core streams for userland***
+
+[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
+[![NPM](https://nodei.co/npm-dl/readable-stream.png&months=6&height=3)](https://nodei.co/npm/readable-stream/)
+
+This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
+
+If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
+
+**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
+
+**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/duplex.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/duplex.js
new file mode 100755 (executable)
index 0000000..ca807af
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_duplex.js")
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/float.patch b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/float.patch
new file mode 100755 (executable)
index 0000000..b984607
--- /dev/null
@@ -0,0 +1,923 @@
+diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js
+index c5a741c..a2e0d8e 100644
+--- a/lib/_stream_duplex.js
++++ b/lib/_stream_duplex.js
+@@ -26,8 +26,8 @@
+ module.exports = Duplex;
+ var util = require('util');
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('./_stream_readable');
++var Writable = require('./_stream_writable');
+ util.inherits(Duplex, Readable);
+diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js
+index a5e9864..330c247 100644
+--- a/lib/_stream_passthrough.js
++++ b/lib/_stream_passthrough.js
+@@ -25,7 +25,7 @@
+ module.exports = PassThrough;
+-var Transform = require('_stream_transform');
++var Transform = require('./_stream_transform');
+ var util = require('util');
+ util.inherits(PassThrough, Transform);
+diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
+index 0c3fe3e..90a8298 100644
+--- a/lib/_stream_readable.js
++++ b/lib/_stream_readable.js
+@@ -23,10 +23,34 @@ module.exports = Readable;
+ Readable.ReadableState = ReadableState;
+ var EE = require('events').EventEmitter;
++if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
++  return emitter.listeners(type).length;
++};
++
++if (!global.setImmediate) global.setImmediate = function setImmediate(fn) {
++  return setTimeout(fn, 0);
++};
++if (!global.clearImmediate) global.clearImmediate = function clearImmediate(i) {
++  return clearTimeout(i);
++};
++
+ var Stream = require('stream');
+ var util = require('util');
++if (!util.isUndefined) {
++  var utilIs = require('core-util-is');
++  for (var f in utilIs) {
++    util[f] = utilIs[f];
++  }
++}
+ var StringDecoder;
+-var debug = util.debuglog('stream');
++var debug;
++if (util.debuglog)
++  debug = util.debuglog('stream');
++else try {
++  debug = require('debuglog')('stream');
++} catch (er) {
++  debug = function() {};
++}
+ util.inherits(Readable, Stream);
+@@ -380,7 +404,7 @@ function chunkInvalid(state, chunk) {
+ function onEofChunk(stream, state) {
+-  if (state.decoder && !state.ended) {
++  if (state.decoder && !state.ended && state.decoder.end) {
+     var chunk = state.decoder.end();
+     if (chunk && chunk.length) {
+       state.buffer.push(chunk);
+diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js
+index b1f9fcc..b0caf57 100644
+--- a/lib/_stream_transform.js
++++ b/lib/_stream_transform.js
+@@ -64,8 +64,14 @@
+ module.exports = Transform;
+-var Duplex = require('_stream_duplex');
++var Duplex = require('./_stream_duplex');
+ var util = require('util');
++if (!util.isUndefined) {
++  var utilIs = require('core-util-is');
++  for (var f in utilIs) {
++    util[f] = utilIs[f];
++  }
++}
+ util.inherits(Transform, Duplex);
+diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
+index ba2e920..f49288b 100644
+--- a/lib/_stream_writable.js
++++ b/lib/_stream_writable.js
+@@ -27,6 +27,12 @@ module.exports = Writable;
+ Writable.WritableState = WritableState;
+ var util = require('util');
++if (!util.isUndefined) {
++  var utilIs = require('core-util-is');
++  for (var f in utilIs) {
++    util[f] = utilIs[f];
++  }
++}
+ var Stream = require('stream');
+ util.inherits(Writable, Stream);
+@@ -119,7 +125,7 @@ function WritableState(options, stream) {
+ function Writable(options) {
+   // Writable ctor is applied to Duplexes, though they're not
+   // instanceof Writable, they're instanceof Readable.
+-  if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))
++  if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex')))
+     return new Writable(options);
+   this._writableState = new WritableState(options, this);
+diff --git a/test/simple/test-stream-big-push.js b/test/simple/test-stream-big-push.js
+index e3787e4..8cd2127 100644
+--- a/test/simple/test-stream-big-push.js
++++ b/test/simple/test-stream-big-push.js
+@@ -21,7 +21,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var str = 'asdfasdfasdfasdfasdf';
+ var r = new stream.Readable({
+diff --git a/test/simple/test-stream-end-paused.js b/test/simple/test-stream-end-paused.js
+index bb73777..d40efc7 100644
+--- a/test/simple/test-stream-end-paused.js
++++ b/test/simple/test-stream-end-paused.js
+@@ -25,7 +25,7 @@ var gotEnd = false;
+ // Make sure we don't miss the end event for paused 0-length streams
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var stream = new Readable();
+ var calledRead = false;
+ stream._read = function() {
+diff --git a/test/simple/test-stream-pipe-after-end.js b/test/simple/test-stream-pipe-after-end.js
+index b46ee90..0be8366 100644
+--- a/test/simple/test-stream-pipe-after-end.js
++++ b/test/simple/test-stream-pipe-after-end.js
+@@ -22,8 +22,8 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('../../lib/_stream_readable');
++var Writable = require('../../lib/_stream_writable');
+ var util = require('util');
+ util.inherits(TestReadable, Readable);
+diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js
+deleted file mode 100644
+index f689358..0000000
+--- a/test/simple/test-stream-pipe-cleanup.js
++++ /dev/null
+@@ -1,122 +0,0 @@
+-// Copyright Joyent, Inc. and other Node contributors.
+-//
+-// 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.
+-
+-// This test asserts that Stream.prototype.pipe does not leave listeners
+-// hanging on the source or dest.
+-
+-var common = require('../common');
+-var stream = require('stream');
+-var assert = require('assert');
+-var util = require('util');
+-
+-function Writable() {
+-  this.writable = true;
+-  this.endCalls = 0;
+-  stream.Stream.call(this);
+-}
+-util.inherits(Writable, stream.Stream);
+-Writable.prototype.end = function() {
+-  this.endCalls++;
+-};
+-
+-Writable.prototype.destroy = function() {
+-  this.endCalls++;
+-};
+-
+-function Readable() {
+-  this.readable = true;
+-  stream.Stream.call(this);
+-}
+-util.inherits(Readable, stream.Stream);
+-
+-function Duplex() {
+-  this.readable = true;
+-  Writable.call(this);
+-}
+-util.inherits(Duplex, Writable);
+-
+-var i = 0;
+-var limit = 100;
+-
+-var w = new Writable();
+-
+-var r;
+-
+-for (i = 0; i < limit; i++) {
+-  r = new Readable();
+-  r.pipe(w);
+-  r.emit('end');
+-}
+-assert.equal(0, r.listeners('end').length);
+-assert.equal(limit, w.endCalls);
+-
+-w.endCalls = 0;
+-
+-for (i = 0; i < limit; i++) {
+-  r = new Readable();
+-  r.pipe(w);
+-  r.emit('close');
+-}
+-assert.equal(0, r.listeners('close').length);
+-assert.equal(limit, w.endCalls);
+-
+-w.endCalls = 0;
+-
+-r = new Readable();
+-
+-for (i = 0; i < limit; i++) {
+-  w = new Writable();
+-  r.pipe(w);
+-  w.emit('close');
+-}
+-assert.equal(0, w.listeners('close').length);
+-
+-r = new Readable();
+-w = new Writable();
+-var d = new Duplex();
+-r.pipe(d); // pipeline A
+-d.pipe(w); // pipeline B
+-assert.equal(r.listeners('end').length, 2);   // A.onend, A.cleanup
+-assert.equal(r.listeners('close').length, 2); // A.onclose, A.cleanup
+-assert.equal(d.listeners('end').length, 2);   // B.onend, B.cleanup
+-assert.equal(d.listeners('close').length, 3); // A.cleanup, B.onclose, B.cleanup
+-assert.equal(w.listeners('end').length, 0);
+-assert.equal(w.listeners('close').length, 1); // B.cleanup
+-
+-r.emit('end');
+-assert.equal(d.endCalls, 1);
+-assert.equal(w.endCalls, 0);
+-assert.equal(r.listeners('end').length, 0);
+-assert.equal(r.listeners('close').length, 0);
+-assert.equal(d.listeners('end').length, 2);   // B.onend, B.cleanup
+-assert.equal(d.listeners('close').length, 2); // B.onclose, B.cleanup
+-assert.equal(w.listeners('end').length, 0);
+-assert.equal(w.listeners('close').length, 1); // B.cleanup
+-
+-d.emit('end');
+-assert.equal(d.endCalls, 1);
+-assert.equal(w.endCalls, 1);
+-assert.equal(r.listeners('end').length, 0);
+-assert.equal(r.listeners('close').length, 0);
+-assert.equal(d.listeners('end').length, 0);
+-assert.equal(d.listeners('close').length, 0);
+-assert.equal(w.listeners('end').length, 0);
+-assert.equal(w.listeners('close').length, 0);
+diff --git a/test/simple/test-stream-pipe-error-handling.js b/test/simple/test-stream-pipe-error-handling.js
+index c5d724b..c7d6b7d 100644
+--- a/test/simple/test-stream-pipe-error-handling.js
++++ b/test/simple/test-stream-pipe-error-handling.js
+@@ -21,7 +21,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Stream = require('stream').Stream;
++var Stream = require('../../').Stream;
+ (function testErrorListenerCatches() {
+   var source = new Stream();
+diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js
+index cb9d5fe..56f8d61 100644
+--- a/test/simple/test-stream-pipe-event.js
++++ b/test/simple/test-stream-pipe-event.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+ var common = require('../common');
+-var stream = require('stream');
++var stream = require('../../');
+ var assert = require('assert');
+ var util = require('util');
+diff --git a/test/simple/test-stream-push-order.js b/test/simple/test-stream-push-order.js
+index f2e6ec2..a5c9bf9 100644
+--- a/test/simple/test-stream-push-order.js
++++ b/test/simple/test-stream-push-order.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+ var common = require('../common.js');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var assert = require('assert');
+ var s = new Readable({
+diff --git a/test/simple/test-stream-push-strings.js b/test/simple/test-stream-push-strings.js
+index 06f43dc..1701a9a 100644
+--- a/test/simple/test-stream-push-strings.js
++++ b/test/simple/test-stream-push-strings.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var util = require('util');
+ util.inherits(MyStream, Readable);
+diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js
+index ba6a577..a8e6f7b 100644
+--- a/test/simple/test-stream-readable-event.js
++++ b/test/simple/test-stream-readable-event.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ (function first() {
+   // First test, not reading when the readable is added.
+diff --git a/test/simple/test-stream-readable-flow-recursion.js b/test/simple/test-stream-readable-flow-recursion.js
+index 2891ad6..11689ba 100644
+--- a/test/simple/test-stream-readable-flow-recursion.js
++++ b/test/simple/test-stream-readable-flow-recursion.js
+@@ -27,7 +27,7 @@ var assert = require('assert');
+ // more data continuously, but without triggering a nextTick
+ // warning or RangeError.
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ // throw an error if we trigger a nextTick warning.
+ process.throwDeprecation = true;
+diff --git a/test/simple/test-stream-unshift-empty-chunk.js b/test/simple/test-stream-unshift-empty-chunk.js
+index 0c96476..7827538 100644
+--- a/test/simple/test-stream-unshift-empty-chunk.js
++++ b/test/simple/test-stream-unshift-empty-chunk.js
+@@ -24,7 +24,7 @@ var assert = require('assert');
+ // This test verifies that stream.unshift(Buffer(0)) or 
+ // stream.unshift('') does not set state.reading=false.
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var r = new Readable();
+ var nChunks = 10;
+diff --git a/test/simple/test-stream-unshift-read-race.js b/test/simple/test-stream-unshift-read-race.js
+index 83fd9fa..17c18aa 100644
+--- a/test/simple/test-stream-unshift-read-race.js
++++ b/test/simple/test-stream-unshift-read-race.js
+@@ -29,7 +29,7 @@ var assert = require('assert');
+ // 3. push() after the EOF signaling null is an error.
+ // 4. _read() is not called after pushing the EOF null chunk.
+-var stream = require('stream');
++var stream = require('../../');
+ var hwm = 10;
+ var r = stream.Readable({ highWaterMark: hwm });
+ var chunks = 10;
+@@ -51,7 +51,14 @@ r._read = function(n) {
+   function push(fast) {
+     assert(!pushedNull, 'push() after null push');
+-    var c = pos >= data.length ? null : data.slice(pos, pos + n);
++    var c;
++    if (pos >= data.length)
++      c = null;
++    else {
++      if (n + pos > data.length)
++        n = data.length - pos;
++      c = data.slice(pos, pos + n);
++    }
+     pushedNull = c === null;
+     if (fast) {
+       pos += n;
+diff --git a/test/simple/test-stream-writev.js b/test/simple/test-stream-writev.js
+index 5b49e6e..b5321f3 100644
+--- a/test/simple/test-stream-writev.js
++++ b/test/simple/test-stream-writev.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var queue = [];
+ for (var decode = 0; decode < 2; decode++) {
+diff --git a/test/simple/test-stream2-basic.js b/test/simple/test-stream2-basic.js
+index 3814bf0..248c1be 100644
+--- a/test/simple/test-stream2-basic.js
++++ b/test/simple/test-stream2-basic.js
+@@ -21,7 +21,7 @@
+ var common = require('../common.js');
+-var R = require('_stream_readable');
++var R = require('../../lib/_stream_readable');
+ var assert = require('assert');
+ var util = require('util');
+diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js
+index 6cdd4e9..f0fa84b 100644
+--- a/test/simple/test-stream2-compatibility.js
++++ b/test/simple/test-stream2-compatibility.js
+@@ -21,7 +21,7 @@
+ var common = require('../common.js');
+-var R = require('_stream_readable');
++var R = require('../../lib/_stream_readable');
+ var assert = require('assert');
+ var util = require('util');
+diff --git a/test/simple/test-stream2-finish-pipe.js b/test/simple/test-stream2-finish-pipe.js
+index 39b274f..006a19b 100644
+--- a/test/simple/test-stream2-finish-pipe.js
++++ b/test/simple/test-stream2-finish-pipe.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+ var common = require('../common.js');
+-var stream = require('stream');
++var stream = require('../../');
+ var Buffer = require('buffer').Buffer;
+ var r = new stream.Readable();
+diff --git a/test/simple/test-stream2-fs.js b/test/simple/test-stream2-fs.js
+deleted file mode 100644
+index e162406..0000000
+--- a/test/simple/test-stream2-fs.js
++++ /dev/null
+@@ -1,72 +0,0 @@
+-// Copyright Joyent, Inc. and other Node contributors.
+-//
+-// 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.
+-
+-
+-var common = require('../common.js');
+-var R = require('_stream_readable');
+-var assert = require('assert');
+-
+-var fs = require('fs');
+-var FSReadable = fs.ReadStream;
+-
+-var path = require('path');
+-var file = path.resolve(common.fixturesDir, 'x1024.txt');
+-
+-var size = fs.statSync(file).size;
+-
+-var expectLengths = [1024];
+-
+-var util = require('util');
+-var Stream = require('stream');
+-
+-util.inherits(TestWriter, Stream);
+-
+-function TestWriter() {
+-  Stream.apply(this);
+-  this.buffer = [];
+-  this.length = 0;
+-}
+-
+-TestWriter.prototype.write = function(c) {
+-  this.buffer.push(c.toString());
+-  this.length += c.length;
+-  return true;
+-};
+-
+-TestWriter.prototype.end = function(c) {
+-  if (c) this.buffer.push(c.toString());
+-  this.emit('results', this.buffer);
+-}
+-
+-var r = new FSReadable(file);
+-var w = new TestWriter();
+-
+-w.on('results', function(res) {
+-  console.error(res, w.length);
+-  assert.equal(w.length, size);
+-  var l = 0;
+-  assert.deepEqual(res.map(function (c) {
+-    return c.length;
+-  }), expectLengths);
+-  console.log('ok');
+-});
+-
+-r.pipe(w);
+diff --git a/test/simple/test-stream2-httpclient-response-end.js b/test/simple/test-stream2-httpclient-response-end.js
+deleted file mode 100644
+index 15cffc2..0000000
+--- a/test/simple/test-stream2-httpclient-response-end.js
++++ /dev/null
+@@ -1,52 +0,0 @@
+-// Copyright Joyent, Inc. and other Node contributors.
+-//
+-// 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.
+-
+-var common = require('../common.js');
+-var assert = require('assert');
+-var http = require('http');
+-var msg = 'Hello';
+-var readable_event = false;
+-var end_event = false;
+-var server = http.createServer(function(req, res) {
+-  res.writeHead(200, {'Content-Type': 'text/plain'});
+-  res.end(msg);
+-}).listen(common.PORT, function() {
+-  http.get({port: common.PORT}, function(res) {
+-    var data = '';
+-    res.on('readable', function() {
+-      console.log('readable event');
+-      readable_event = true;
+-      data += res.read();
+-    });
+-    res.on('end', function() {
+-      console.log('end event');
+-      end_event = true;
+-      assert.strictEqual(msg, data);
+-      server.close();
+-    });
+-  });
+-});
+-
+-process.on('exit', function() {
+-  assert(readable_event);
+-  assert(end_event);
+-});
+-
+diff --git a/test/simple/test-stream2-large-read-stall.js b/test/simple/test-stream2-large-read-stall.js
+index 2fbfbca..667985b 100644
+--- a/test/simple/test-stream2-large-read-stall.js
++++ b/test/simple/test-stream2-large-read-stall.js
+@@ -30,7 +30,7 @@ var PUSHSIZE = 20;
+ var PUSHCOUNT = 1000;
+ var HWM = 50;
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var r = new Readable({
+   highWaterMark: HWM
+ });
+@@ -39,23 +39,23 @@ var rs = r._readableState;
+ r._read = push;
+ r.on('readable', function() {
+-  console.error('>> readable');
++  //console.error('>> readable');
+   do {
+-    console.error('  > read(%d)', READSIZE);
++    //console.error('  > read(%d)', READSIZE);
+     var ret = r.read(READSIZE);
+-    console.error('  < %j (%d remain)', ret && ret.length, rs.length);
++    //console.error('  < %j (%d remain)', ret && ret.length, rs.length);
+   } while (ret && ret.length === READSIZE);
+-  console.error('<< after read()',
+-                ret && ret.length,
+-                rs.needReadable,
+-                rs.length);
++  //console.error('<< after read()',
++  //              ret && ret.length,
++  //              rs.needReadable,
++  //              rs.length);
+ });
+ var endEmitted = false;
+ r.on('end', function() {
+   endEmitted = true;
+-  console.error('end');
++  //console.error('end');
+ });
+ var pushes = 0;
+@@ -64,11 +64,11 @@ function push() {
+     return;
+   if (pushes++ === PUSHCOUNT) {
+-    console.error('   push(EOF)');
++    //console.error('   push(EOF)');
+     return r.push(null);
+   }
+-  console.error('   push #%d', pushes);
++  //console.error('   push #%d', pushes);
+   if (r.push(new Buffer(PUSHSIZE)))
+     setTimeout(push);
+ }
+diff --git a/test/simple/test-stream2-objects.js b/test/simple/test-stream2-objects.js
+index 3e6931d..ff47d89 100644
+--- a/test/simple/test-stream2-objects.js
++++ b/test/simple/test-stream2-objects.js
+@@ -21,8 +21,8 @@
+ var common = require('../common.js');
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('../../lib/_stream_readable');
++var Writable = require('../../lib/_stream_writable');
+ var assert = require('assert');
+ // tiny node-tap lookalike.
+diff --git a/test/simple/test-stream2-pipe-error-handling.js b/test/simple/test-stream2-pipe-error-handling.js
+index cf7531c..e3f3e4e 100644
+--- a/test/simple/test-stream2-pipe-error-handling.js
++++ b/test/simple/test-stream2-pipe-error-handling.js
+@@ -21,7 +21,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ (function testErrorListenerCatches() {
+   var count = 1000;
+diff --git a/test/simple/test-stream2-pipe-error-once-listener.js b/test/simple/test-stream2-pipe-error-once-listener.js
+index 5e8e3cb..53b2616 100755
+--- a/test/simple/test-stream2-pipe-error-once-listener.js
++++ b/test/simple/test-stream2-pipe-error-once-listener.js
+@@ -24,7 +24,7 @@ var common = require('../common.js');
+ var assert = require('assert');
+ var util = require('util');
+-var stream = require('stream');
++var stream = require('../../');
+ var Read = function() {
+diff --git a/test/simple/test-stream2-push.js b/test/simple/test-stream2-push.js
+index b63edc3..eb2b0e9 100644
+--- a/test/simple/test-stream2-push.js
++++ b/test/simple/test-stream2-push.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+ var common = require('../common.js');
+-var stream = require('stream');
++var stream = require('../../');
+ var Readable = stream.Readable;
+ var Writable = stream.Writable;
+ var assert = require('assert');
+diff --git a/test/simple/test-stream2-read-sync-stack.js b/test/simple/test-stream2-read-sync-stack.js
+index e8a7305..9740a47 100644
+--- a/test/simple/test-stream2-read-sync-stack.js
++++ b/test/simple/test-stream2-read-sync-stack.js
+@@ -21,7 +21,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var r = new Readable();
+ var N = 256 * 1024;
+diff --git a/test/simple/test-stream2-readable-empty-buffer-no-eof.js b/test/simple/test-stream2-readable-empty-buffer-no-eof.js
+index cd30178..4b1659d 100644
+--- a/test/simple/test-stream2-readable-empty-buffer-no-eof.js
++++ b/test/simple/test-stream2-readable-empty-buffer-no-eof.js
+@@ -22,10 +22,9 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ test1();
+-test2();
+ function test1() {
+   var r = new Readable();
+@@ -88,31 +87,3 @@ function test1() {
+     console.log('ok');
+   });
+ }
+-
+-function test2() {
+-  var r = new Readable({ encoding: 'base64' });
+-  var reads = 5;
+-  r._read = function(n) {
+-    if (!reads--)
+-      return r.push(null); // EOF
+-    else
+-      return r.push(new Buffer('x'));
+-  };
+-
+-  var results = [];
+-  function flow() {
+-    var chunk;
+-    while (null !== (chunk = r.read()))
+-      results.push(chunk + '');
+-  }
+-  r.on('readable', flow);
+-  r.on('end', function() {
+-    results.push('EOF');
+-  });
+-  flow();
+-
+-  process.on('exit', function() {
+-    assert.deepEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]);
+-    console.log('ok');
+-  });
+-}
+diff --git a/test/simple/test-stream2-readable-from-list.js b/test/simple/test-stream2-readable-from-list.js
+index 7c96ffe..04a96f5 100644
+--- a/test/simple/test-stream2-readable-from-list.js
++++ b/test/simple/test-stream2-readable-from-list.js
+@@ -21,7 +21,7 @@
+ var assert = require('assert');
+ var common = require('../common.js');
+-var fromList = require('_stream_readable')._fromList;
++var fromList = require('../../lib/_stream_readable')._fromList;
+ // tiny node-tap lookalike.
+ var tests = [];
+diff --git a/test/simple/test-stream2-readable-legacy-drain.js b/test/simple/test-stream2-readable-legacy-drain.js
+index 675da8e..51fd3d5 100644
+--- a/test/simple/test-stream2-readable-legacy-drain.js
++++ b/test/simple/test-stream2-readable-legacy-drain.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Stream = require('stream');
++var Stream = require('../../');
+ var Readable = Stream.Readable;
+ var r = new Readable();
+diff --git a/test/simple/test-stream2-readable-non-empty-end.js b/test/simple/test-stream2-readable-non-empty-end.js
+index 7314ae7..c971898 100644
+--- a/test/simple/test-stream2-readable-non-empty-end.js
++++ b/test/simple/test-stream2-readable-non-empty-end.js
+@@ -21,7 +21,7 @@
+ var assert = require('assert');
+ var common = require('../common.js');
+-var Readable = require('_stream_readable');
++var Readable = require('../../lib/_stream_readable');
+ var len = 0;
+ var chunks = new Array(10);
+diff --git a/test/simple/test-stream2-readable-wrap-empty.js b/test/simple/test-stream2-readable-wrap-empty.js
+index 2e5cf25..fd8a3dc 100644
+--- a/test/simple/test-stream2-readable-wrap-empty.js
++++ b/test/simple/test-stream2-readable-wrap-empty.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('_stream_readable');
++var Readable = require('../../lib/_stream_readable');
+ var EE = require('events').EventEmitter;
+ var oldStream = new EE();
+diff --git a/test/simple/test-stream2-readable-wrap.js b/test/simple/test-stream2-readable-wrap.js
+index 90eea01..6b177f7 100644
+--- a/test/simple/test-stream2-readable-wrap.js
++++ b/test/simple/test-stream2-readable-wrap.js
+@@ -22,8 +22,8 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('../../lib/_stream_readable');
++var Writable = require('../../lib/_stream_writable');
+ var EE = require('events').EventEmitter;
+ var testRuns = 0, completedRuns = 0;
+diff --git a/test/simple/test-stream2-set-encoding.js b/test/simple/test-stream2-set-encoding.js
+index 5d2c32a..685531b 100644
+--- a/test/simple/test-stream2-set-encoding.js
++++ b/test/simple/test-stream2-set-encoding.js
+@@ -22,7 +22,7 @@
+ var common = require('../common.js');
+ var assert = require('assert');
+-var R = require('_stream_readable');
++var R = require('../../lib/_stream_readable');
+ var util = require('util');
+ // tiny node-tap lookalike.
+diff --git a/test/simple/test-stream2-transform.js b/test/simple/test-stream2-transform.js
+index 9c9ddd8..a0cacc6 100644
+--- a/test/simple/test-stream2-transform.js
++++ b/test/simple/test-stream2-transform.js
+@@ -21,8 +21,8 @@
+ var assert = require('assert');
+ var common = require('../common.js');
+-var PassThrough = require('_stream_passthrough');
+-var Transform = require('_stream_transform');
++var PassThrough = require('../../').PassThrough;
++var Transform = require('../../').Transform;
+ // tiny node-tap lookalike.
+ var tests = [];
+diff --git a/test/simple/test-stream2-unpipe-drain.js b/test/simple/test-stream2-unpipe-drain.js
+index d66dc3c..365b327 100644
+--- a/test/simple/test-stream2-unpipe-drain.js
++++ b/test/simple/test-stream2-unpipe-drain.js
+@@ -22,7 +22,7 @@
+ var common = require('../common.js');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var crypto = require('crypto');
+ var util = require('util');
+diff --git a/test/simple/test-stream2-unpipe-leak.js b/test/simple/test-stream2-unpipe-leak.js
+index 99f8746..17c92ae 100644
+--- a/test/simple/test-stream2-unpipe-leak.js
++++ b/test/simple/test-stream2-unpipe-leak.js
+@@ -22,7 +22,7 @@
+ var common = require('../common.js');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var chunk = new Buffer('hallo');
+diff --git a/test/simple/test-stream2-writable.js b/test/simple/test-stream2-writable.js
+index 704100c..209c3a6 100644
+--- a/test/simple/test-stream2-writable.js
++++ b/test/simple/test-stream2-writable.js
+@@ -20,8 +20,8 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+ var common = require('../common.js');
+-var W = require('_stream_writable');
+-var D = require('_stream_duplex');
++var W = require('../../').Writable;
++var D = require('../../').Duplex;
+ var assert = require('assert');
+ var util = require('util');
+diff --git a/test/simple/test-stream3-pause-then-read.js b/test/simple/test-stream3-pause-then-read.js
+index b91bde3..2f72c15 100644
+--- a/test/simple/test-stream3-pause-then-read.js
++++ b/test/simple/test-stream3-pause-then-read.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var Readable = stream.Readable;
+ var Writable = stream.Writable;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_duplex.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_duplex.js
new file mode 100755 (executable)
index 0000000..b513d61
--- /dev/null
@@ -0,0 +1,89 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+// a duplex stream is just a stream that is both readable and writable.
+// Since JS doesn't have multiple prototypal inheritance, this class
+// prototypally inherits from Readable, and then parasitically from
+// Writable.
+
+module.exports = Duplex;
+
+/*<replacement>*/
+var objectKeys = Object.keys || function (obj) {
+  var keys = [];
+  for (var key in obj) keys.push(key);
+  return keys;
+}
+/*</replacement>*/
+
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var Readable = require('./_stream_readable');
+var Writable = require('./_stream_writable');
+
+util.inherits(Duplex, Readable);
+
+forEach(objectKeys(Writable.prototype), function(method) {
+  if (!Duplex.prototype[method])
+    Duplex.prototype[method] = Writable.prototype[method];
+});
+
+function Duplex(options) {
+  if (!(this instanceof Duplex))
+    return new Duplex(options);
+
+  Readable.call(this, options);
+  Writable.call(this, options);
+
+  if (options && options.readable === false)
+    this.readable = false;
+
+  if (options && options.writable === false)
+    this.writable = false;
+
+  this.allowHalfOpen = true;
+  if (options && options.allowHalfOpen === false)
+    this.allowHalfOpen = false;
+
+  this.once('end', onend);
+}
+
+// the no-half-open enforcer
+function onend() {
+  // if we allow half-open state, or if the writable side ended,
+  // then we're ok.
+  if (this.allowHalfOpen || this._writableState.ended)
+    return;
+
+  // no more data can be written.
+  // But allow more writes to happen in this tick.
+  process.nextTick(this.end.bind(this));
+}
+
+function forEach (xs, f) {
+  for (var i = 0, l = xs.length; i < l; i++) {
+    f(xs[i], i);
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_passthrough.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_passthrough.js
new file mode 100755 (executable)
index 0000000..895ca50
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+// a passthrough stream.
+// basically just the most minimal sort of Transform stream.
+// Every written chunk gets output as-is.
+
+module.exports = PassThrough;
+
+var Transform = require('./_stream_transform');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(PassThrough, Transform);
+
+function PassThrough(options) {
+  if (!(this instanceof PassThrough))
+    return new PassThrough(options);
+
+  Transform.call(this, options);
+}
+
+PassThrough.prototype._transform = function(chunk, encoding, cb) {
+  cb(null, chunk);
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_readable.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_readable.js
new file mode 100755 (executable)
index 0000000..19ab358
--- /dev/null
@@ -0,0 +1,951 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+module.exports = Readable;
+
+/*<replacement>*/
+var isArray = require('isarray');
+/*</replacement>*/
+
+
+/*<replacement>*/
+var Buffer = require('buffer').Buffer;
+/*</replacement>*/
+
+Readable.ReadableState = ReadableState;
+
+var EE = require('events').EventEmitter;
+
+/*<replacement>*/
+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
+  return emitter.listeners(type).length;
+};
+/*</replacement>*/
+
+var Stream = require('stream');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var StringDecoder;
+
+
+/*<replacement>*/
+var debug = require('util');
+if (debug && debug.debuglog) {
+  debug = debug.debuglog('stream');
+} else {
+  debug = function () {};
+}
+/*</replacement>*/
+
+
+util.inherits(Readable, Stream);
+
+function ReadableState(options, stream) {
+  var Duplex = require('./_stream_duplex');
+
+  options = options || {};
+
+  // the point at which it stops calling _read() to fill the buffer
+  // Note: 0 is a valid value, means "don't call _read preemptively ever"
+  var hwm = options.highWaterMark;
+  var defaultHwm = options.objectMode ? 16 : 16 * 1024;
+  this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
+
+  // cast to ints.
+  this.highWaterMark = ~~this.highWaterMark;
+
+  this.buffer = [];
+  this.length = 0;
+  this.pipes = null;
+  this.pipesCount = 0;
+  this.flowing = null;
+  this.ended = false;
+  this.endEmitted = false;
+  this.reading = false;
+
+  // a flag to be able to tell if the onwrite cb is called immediately,
+  // or on a later tick.  We set this to true at first, because any
+  // actions that shouldn't happen until "later" should generally also
+  // not happen before the first write call.
+  this.sync = true;
+
+  // whenever we return null, then we set a flag to say
+  // that we're awaiting a 'readable' event emission.
+  this.needReadable = false;
+  this.emittedReadable = false;
+  this.readableListening = false;
+
+
+  // object stream flag. Used to make read(n) ignore n and to
+  // make all the buffer merging and length checks go away
+  this.objectMode = !!options.objectMode;
+
+  if (stream instanceof Duplex)
+    this.objectMode = this.objectMode || !!options.readableObjectMode;
+
+  // Crypto is kind of old and crusty.  Historically, its default string
+  // encoding is 'binary' so we have to make this configurable.
+  // Everything else in the universe uses 'utf8', though.
+  this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+  // when piping, we only care about 'readable' events that happen
+  // after read()ing all the bytes and not getting any pushback.
+  this.ranOut = false;
+
+  // the number of writers that are awaiting a drain event in .pipe()s
+  this.awaitDrain = 0;
+
+  // if true, a maybeReadMore has been scheduled
+  this.readingMore = false;
+
+  this.decoder = null;
+  this.encoding = null;
+  if (options.encoding) {
+    if (!StringDecoder)
+      StringDecoder = require('string_decoder/').StringDecoder;
+    this.decoder = new StringDecoder(options.encoding);
+    this.encoding = options.encoding;
+  }
+}
+
+function Readable(options) {
+  var Duplex = require('./_stream_duplex');
+
+  if (!(this instanceof Readable))
+    return new Readable(options);
+
+  this._readableState = new ReadableState(options, this);
+
+  // legacy
+  this.readable = true;
+
+  Stream.call(this);
+}
+
+// Manually shove something into the read() buffer.
+// This returns true if the highWaterMark has not been hit yet,
+// similar to how Writable.write() returns true if you should
+// write() some more.
+Readable.prototype.push = function(chunk, encoding) {
+  var state = this._readableState;
+
+  if (util.isString(chunk) && !state.objectMode) {
+    encoding = encoding || state.defaultEncoding;
+    if (encoding !== state.encoding) {
+      chunk = new Buffer(chunk, encoding);
+      encoding = '';
+    }
+  }
+
+  return readableAddChunk(this, state, chunk, encoding, false);
+};
+
+// Unshift should *always* be something directly out of read()
+Readable.prototype.unshift = function(chunk) {
+  var state = this._readableState;
+  return readableAddChunk(this, state, chunk, '', true);
+};
+
+function readableAddChunk(stream, state, chunk, encoding, addToFront) {
+  var er = chunkInvalid(state, chunk);
+  if (er) {
+    stream.emit('error', er);
+  } else if (util.isNullOrUndefined(chunk)) {
+    state.reading = false;
+    if (!state.ended)
+      onEofChunk(stream, state);
+  } else if (state.objectMode || chunk && chunk.length > 0) {
+    if (state.ended && !addToFront) {
+      var e = new Error('stream.push() after EOF');
+      stream.emit('error', e);
+    } else if (state.endEmitted && addToFront) {
+      var e = new Error('stream.unshift() after end event');
+      stream.emit('error', e);
+    } else {
+      if (state.decoder && !addToFront && !encoding)
+        chunk = state.decoder.write(chunk);
+
+      if (!addToFront)
+        state.reading = false;
+
+      // if we want the data now, just emit it.
+      if (state.flowing && state.length === 0 && !state.sync) {
+        stream.emit('data', chunk);
+        stream.read(0);
+      } else {
+        // update the buffer info.
+        state.length += state.objectMode ? 1 : chunk.length;
+        if (addToFront)
+          state.buffer.unshift(chunk);
+        else
+          state.buffer.push(chunk);
+
+        if (state.needReadable)
+          emitReadable(stream);
+      }
+
+      maybeReadMore(stream, state);
+    }
+  } else if (!addToFront) {
+    state.reading = false;
+  }
+
+  return needMoreData(state);
+}
+
+
+
+// if it's past the high water mark, we can push in some more.
+// Also, if we have no data yet, we can stand some
+// more bytes.  This is to work around cases where hwm=0,
+// such as the repl.  Also, if the push() triggered a
+// readable event, and the user called read(largeNumber) such that
+// needReadable was set, then we ought to push more, so that another
+// 'readable' event will be triggered.
+function needMoreData(state) {
+  return !state.ended &&
+         (state.needReadable ||
+          state.length < state.highWaterMark ||
+          state.length === 0);
+}
+
+// backwards compatibility.
+Readable.prototype.setEncoding = function(enc) {
+  if (!StringDecoder)
+    StringDecoder = require('string_decoder/').StringDecoder;
+  this._readableState.decoder = new StringDecoder(enc);
+  this._readableState.encoding = enc;
+  return this;
+};
+
+// Don't raise the hwm > 128MB
+var MAX_HWM = 0x800000;
+function roundUpToNextPowerOf2(n) {
+  if (n >= MAX_HWM) {
+    n = MAX_HWM;
+  } else {
+    // Get the next highest power of 2
+    n--;
+    for (var p = 1; p < 32; p <<= 1) n |= n >> p;
+    n++;
+  }
+  return n;
+}
+
+function howMuchToRead(n, state) {
+  if (state.length === 0 && state.ended)
+    return 0;
+
+  if (state.objectMode)
+    return n === 0 ? 0 : 1;
+
+  if (isNaN(n) || util.isNull(n)) {
+    // only flow one buffer at a time
+    if (state.flowing && state.buffer.length)
+      return state.buffer[0].length;
+    else
+      return state.length;
+  }
+
+  if (n <= 0)
+    return 0;
+
+  // If we're asking for more than the target buffer level,
+  // then raise the water mark.  Bump up to the next highest
+  // power of 2, to prevent increasing it excessively in tiny
+  // amounts.
+  if (n > state.highWaterMark)
+    state.highWaterMark = roundUpToNextPowerOf2(n);
+
+  // don't have that much.  return null, unless we've ended.
+  if (n > state.length) {
+    if (!state.ended) {
+      state.needReadable = true;
+      return 0;
+    } else
+      return state.length;
+  }
+
+  return n;
+}
+
+// you can override either this method, or the async _read(n) below.
+Readable.prototype.read = function(n) {
+  debug('read', n);
+  var state = this._readableState;
+  var nOrig = n;
+
+  if (!util.isNumber(n) || n > 0)
+    state.emittedReadable = false;
+
+  // if we're doing read(0) to trigger a readable event, but we
+  // already have a bunch of data in the buffer, then just trigger
+  // the 'readable' event and move on.
+  if (n === 0 &&
+      state.needReadable &&
+      (state.length >= state.highWaterMark || state.ended)) {
+    debug('read: emitReadable', state.length, state.ended);
+    if (state.length === 0 && state.ended)
+      endReadable(this);
+    else
+      emitReadable(this);
+    return null;
+  }
+
+  n = howMuchToRead(n, state);
+
+  // if we've ended, and we're now clear, then finish it up.
+  if (n === 0 && state.ended) {
+    if (state.length === 0)
+      endReadable(this);
+    return null;
+  }
+
+  // All the actual chunk generation logic needs to be
+  // *below* the call to _read.  The reason is that in certain
+  // synthetic stream cases, such as passthrough streams, _read
+  // may be a completely synchronous operation which may change
+  // the state of the read buffer, providing enough data when
+  // before there was *not* enough.
+  //
+  // So, the steps are:
+  // 1. Figure out what the state of things will be after we do
+  // a read from the buffer.
+  //
+  // 2. If that resulting state will trigger a _read, then call _read.
+  // Note that this may be asynchronous, or synchronous.  Yes, it is
+  // deeply ugly to write APIs this way, but that still doesn't mean
+  // that the Readable class should behave improperly, as streams are
+  // designed to be sync/async agnostic.
+  // Take note if the _read call is sync or async (ie, if the read call
+  // has returned yet), so that we know whether or not it's safe to emit
+  // 'readable' etc.
+  //
+  // 3. Actually pull the requested chunks out of the buffer and return.
+
+  // if we need a readable event, then we need to do some reading.
+  var doRead = state.needReadable;
+  debug('need readable', doRead);
+
+  // if we currently have less than the highWaterMark, then also read some
+  if (state.length === 0 || state.length - n < state.highWaterMark) {
+    doRead = true;
+    debug('length less than watermark', doRead);
+  }
+
+  // however, if we've ended, then there's no point, and if we're already
+  // reading, then it's unnecessary.
+  if (state.ended || state.reading) {
+    doRead = false;
+    debug('reading or ended', doRead);
+  }
+
+  if (doRead) {
+    debug('do read');
+    state.reading = true;
+    state.sync = true;
+    // if the length is currently zero, then we *need* a readable event.
+    if (state.length === 0)
+      state.needReadable = true;
+    // call internal read method
+    this._read(state.highWaterMark);
+    state.sync = false;
+  }
+
+  // If _read pushed data synchronously, then `reading` will be false,
+  // and we need to re-evaluate how much data we can return to the user.
+  if (doRead && !state.reading)
+    n = howMuchToRead(nOrig, state);
+
+  var ret;
+  if (n > 0)
+    ret = fromList(n, state);
+  else
+    ret = null;
+
+  if (util.isNull(ret)) {
+    state.needReadable = true;
+    n = 0;
+  }
+
+  state.length -= n;
+
+  // If we have nothing in the buffer, then we want to know
+  // as soon as we *do* get something into the buffer.
+  if (state.length === 0 && !state.ended)
+    state.needReadable = true;
+
+  // If we tried to read() past the EOF, then emit end on the next tick.
+  if (nOrig !== n && state.ended && state.length === 0)
+    endReadable(this);
+
+  if (!util.isNull(ret))
+    this.emit('data', ret);
+
+  return ret;
+};
+
+function chunkInvalid(state, chunk) {
+  var er = null;
+  if (!util.isBuffer(chunk) &&
+      !util.isString(chunk) &&
+      !util.isNullOrUndefined(chunk) &&
+      !state.objectMode) {
+    er = new TypeError('Invalid non-string/buffer chunk');
+  }
+  return er;
+}
+
+
+function onEofChunk(stream, state) {
+  if (state.decoder && !state.ended) {
+    var chunk = state.decoder.end();
+    if (chunk && chunk.length) {
+      state.buffer.push(chunk);
+      state.length += state.objectMode ? 1 : chunk.length;
+    }
+  }
+  state.ended = true;
+
+  // emit 'readable' now to make sure it gets picked up.
+  emitReadable(stream);
+}
+
+// Don't emit readable right away in sync mode, because this can trigger
+// another read() call => stack overflow.  This way, it might trigger
+// a nextTick recursion warning, but that's not so bad.
+function emitReadable(stream) {
+  var state = stream._readableState;
+  state.needReadable = false;
+  if (!state.emittedReadable) {
+    debug('emitReadable', state.flowing);
+    state.emittedReadable = true;
+    if (state.sync)
+      process.nextTick(function() {
+        emitReadable_(stream);
+      });
+    else
+      emitReadable_(stream);
+  }
+}
+
+function emitReadable_(stream) {
+  debug('emit readable');
+  stream.emit('readable');
+  flow(stream);
+}
+
+
+// at this point, the user has presumably seen the 'readable' event,
+// and called read() to consume some data.  that may have triggered
+// in turn another _read(n) call, in which case reading = true if
+// it's in progress.
+// However, if we're not ended, or reading, and the length < hwm,
+// then go ahead and try to read some more preemptively.
+function maybeReadMore(stream, state) {
+  if (!state.readingMore) {
+    state.readingMore = true;
+    process.nextTick(function() {
+      maybeReadMore_(stream, state);
+    });
+  }
+}
+
+function maybeReadMore_(stream, state) {
+  var len = state.length;
+  while (!state.reading && !state.flowing && !state.ended &&
+         state.length < state.highWaterMark) {
+    debug('maybeReadMore read 0');
+    stream.read(0);
+    if (len === state.length)
+      // didn't get any data, stop spinning.
+      break;
+    else
+      len = state.length;
+  }
+  state.readingMore = false;
+}
+
+// abstract method.  to be overridden in specific implementation classes.
+// call cb(er, data) where data is <= n in length.
+// for virtual (non-string, non-buffer) streams, "length" is somewhat
+// arbitrary, and perhaps not very meaningful.
+Readable.prototype._read = function(n) {
+  this.emit('error', new Error('not implemented'));
+};
+
+Readable.prototype.pipe = function(dest, pipeOpts) {
+  var src = this;
+  var state = this._readableState;
+
+  switch (state.pipesCount) {
+    case 0:
+      state.pipes = dest;
+      break;
+    case 1:
+      state.pipes = [state.pipes, dest];
+      break;
+    default:
+      state.pipes.push(dest);
+      break;
+  }
+  state.pipesCount += 1;
+  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
+
+  var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
+              dest !== process.stdout &&
+              dest !== process.stderr;
+
+  var endFn = doEnd ? onend : cleanup;
+  if (state.endEmitted)
+    process.nextTick(endFn);
+  else
+    src.once('end', endFn);
+
+  dest.on('unpipe', onunpipe);
+  function onunpipe(readable) {
+    debug('onunpipe');
+    if (readable === src) {
+      cleanup();
+    }
+  }
+
+  function onend() {
+    debug('onend');
+    dest.end();
+  }
+
+  // when the dest drains, it reduces the awaitDrain counter
+  // on the source.  This would be more elegant with a .once()
+  // handler in flow(), but adding and removing repeatedly is
+  // too slow.
+  var ondrain = pipeOnDrain(src);
+  dest.on('drain', ondrain);
+
+  function cleanup() {
+    debug('cleanup');
+    // cleanup event handlers once the pipe is broken
+    dest.removeListener('close', onclose);
+    dest.removeListener('finish', onfinish);
+    dest.removeListener('drain', ondrain);
+    dest.removeListener('error', onerror);
+    dest.removeListener('unpipe', onunpipe);
+    src.removeListener('end', onend);
+    src.removeListener('end', cleanup);
+    src.removeListener('data', ondata);
+
+    // if the reader is waiting for a drain event from this
+    // specific writer, then it would cause it to never start
+    // flowing again.
+    // So, if this is awaiting a drain, then we just call it now.
+    // If we don't know, then assume that we are waiting for one.
+    if (state.awaitDrain &&
+        (!dest._writableState || dest._writableState.needDrain))
+      ondrain();
+  }
+
+  src.on('data', ondata);
+  function ondata(chunk) {
+    debug('ondata');
+    var ret = dest.write(chunk);
+    if (false === ret) {
+      debug('false write response, pause',
+            src._readableState.awaitDrain);
+      src._readableState.awaitDrain++;
+      src.pause();
+    }
+  }
+
+  // if the dest has an error, then stop piping into it.
+  // however, don't suppress the throwing behavior for this.
+  function onerror(er) {
+    debug('onerror', er);
+    unpipe();
+    dest.removeListener('error', onerror);
+    if (EE.listenerCount(dest, 'error') === 0)
+      dest.emit('error', er);
+  }
+  // This is a brutally ugly hack to make sure that our error handler
+  // is attached before any userland ones.  NEVER DO THIS.
+  if (!dest._events || !dest._events.error)
+    dest.on('error', onerror);
+  else if (isArray(dest._events.error))
+    dest._events.error.unshift(onerror);
+  else
+    dest._events.error = [onerror, dest._events.error];
+
+
+
+  // Both close and finish should trigger unpipe, but only once.
+  function onclose() {
+    dest.removeListener('finish', onfinish);
+    unpipe();
+  }
+  dest.once('close', onclose);
+  function onfinish() {
+    debug('onfinish');
+    dest.removeListener('close', onclose);
+    unpipe();
+  }
+  dest.once('finish', onfinish);
+
+  function unpipe() {
+    debug('unpipe');
+    src.unpipe(dest);
+  }
+
+  // tell the dest that it's being piped to
+  dest.emit('pipe', src);
+
+  // start the flow if it hasn't been started already.
+  if (!state.flowing) {
+    debug('pipe resume');
+    src.resume();
+  }
+
+  return dest;
+};
+
+function pipeOnDrain(src) {
+  return function() {
+    var state = src._readableState;
+    debug('pipeOnDrain', state.awaitDrain);
+    if (state.awaitDrain)
+      state.awaitDrain--;
+    if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
+      state.flowing = true;
+      flow(src);
+    }
+  };
+}
+
+
+Readable.prototype.unpipe = function(dest) {
+  var state = this._readableState;
+
+  // if we're not piping anywhere, then do nothing.
+  if (state.pipesCount === 0)
+    return this;
+
+  // just one destination.  most common case.
+  if (state.pipesCount === 1) {
+    // passed in one, but it's not the right one.
+    if (dest && dest !== state.pipes)
+      return this;
+
+    if (!dest)
+      dest = state.pipes;
+
+    // got a match.
+    state.pipes = null;
+    state.pipesCount = 0;
+    state.flowing = false;
+    if (dest)
+      dest.emit('unpipe', this);
+    return this;
+  }
+
+  // slow case. multiple pipe destinations.
+
+  if (!dest) {
+    // remove all.
+    var dests = state.pipes;
+    var len = state.pipesCount;
+    state.pipes = null;
+    state.pipesCount = 0;
+    state.flowing = false;
+
+    for (var i = 0; i < len; i++)
+      dests[i].emit('unpipe', this);
+    return this;
+  }
+
+  // try to find the right one.
+  var i = indexOf(state.pipes, dest);
+  if (i === -1)
+    return this;
+
+  state.pipes.splice(i, 1);
+  state.pipesCount -= 1;
+  if (state.pipesCount === 1)
+    state.pipes = state.pipes[0];
+
+  dest.emit('unpipe', this);
+
+  return this;
+};
+
+// set up data events if they are asked for
+// Ensure readable listeners eventually get something
+Readable.prototype.on = function(ev, fn) {
+  var res = Stream.prototype.on.call(this, ev, fn);
+
+  // If listening to data, and it has not explicitly been paused,
+  // then call resume to start the flow of data on the next tick.
+  if (ev === 'data' && false !== this._readableState.flowing) {
+    this.resume();
+  }
+
+  if (ev === 'readable' && this.readable) {
+    var state = this._readableState;
+    if (!state.readableListening) {
+      state.readableListening = true;
+      state.emittedReadable = false;
+      state.needReadable = true;
+      if (!state.reading) {
+        var self = this;
+        process.nextTick(function() {
+          debug('readable nexttick read 0');
+          self.read(0);
+        });
+      } else if (state.length) {
+        emitReadable(this, state);
+      }
+    }
+  }
+
+  return res;
+};
+Readable.prototype.addListener = Readable.prototype.on;
+
+// pause() and resume() are remnants of the legacy readable stream API
+// If the user uses them, then switch into old mode.
+Readable.prototype.resume = function() {
+  var state = this._readableState;
+  if (!state.flowing) {
+    debug('resume');
+    state.flowing = true;
+    if (!state.reading) {
+      debug('resume read 0');
+      this.read(0);
+    }
+    resume(this, state);
+  }
+  return this;
+};
+
+function resume(stream, state) {
+  if (!state.resumeScheduled) {
+    state.resumeScheduled = true;
+    process.nextTick(function() {
+      resume_(stream, state);
+    });
+  }
+}
+
+function resume_(stream, state) {
+  state.resumeScheduled = false;
+  stream.emit('resume');
+  flow(stream);
+  if (state.flowing && !state.reading)
+    stream.read(0);
+}
+
+Readable.prototype.pause = function() {
+  debug('call pause flowing=%j', this._readableState.flowing);
+  if (false !== this._readableState.flowing) {
+    debug('pause');
+    this._readableState.flowing = false;
+    this.emit('pause');
+  }
+  return this;
+};
+
+function flow(stream) {
+  var state = stream._readableState;
+  debug('flow', state.flowing);
+  if (state.flowing) {
+    do {
+      var chunk = stream.read();
+    } while (null !== chunk && state.flowing);
+  }
+}
+
+// wrap an old-style stream as the async data source.
+// This is *not* part of the readable stream interface.
+// It is an ugly unfortunate mess of history.
+Readable.prototype.wrap = function(stream) {
+  var state = this._readableState;
+  var paused = false;
+
+  var self = this;
+  stream.on('end', function() {
+    debug('wrapped end');
+    if (state.decoder && !state.ended) {
+      var chunk = state.decoder.end();
+      if (chunk && chunk.length)
+        self.push(chunk);
+    }
+
+    self.push(null);
+  });
+
+  stream.on('data', function(chunk) {
+    debug('wrapped data');
+    if (state.decoder)
+      chunk = state.decoder.write(chunk);
+    if (!chunk || !state.objectMode && !chunk.length)
+      return;
+
+    var ret = self.push(chunk);
+    if (!ret) {
+      paused = true;
+      stream.pause();
+    }
+  });
+
+  // proxy all the other methods.
+  // important when wrapping filters and duplexes.
+  for (var i in stream) {
+    if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
+      this[i] = function(method) { return function() {
+        return stream[method].apply(stream, arguments);
+      }}(i);
+    }
+  }
+
+  // proxy certain important events.
+  var events = ['error', 'close', 'destroy', 'pause', 'resume'];
+  forEach(events, function(ev) {
+    stream.on(ev, self.emit.bind(self, ev));
+  });
+
+  // when we try to consume some more bytes, simply unpause the
+  // underlying stream.
+  self._read = function(n) {
+    debug('wrapped _read', n);
+    if (paused) {
+      paused = false;
+      stream.resume();
+    }
+  };
+
+  return self;
+};
+
+
+
+// exposed for testing purposes only.
+Readable._fromList = fromList;
+
+// Pluck off n bytes from an array of buffers.
+// Length is the combined lengths of all the buffers in the list.
+function fromList(n, state) {
+  var list = state.buffer;
+  var length = state.length;
+  var stringMode = !!state.decoder;
+  var objectMode = !!state.objectMode;
+  var ret;
+
+  // nothing in the list, definitely empty.
+  if (list.length === 0)
+    return null;
+
+  if (length === 0)
+    ret = null;
+  else if (objectMode)
+    ret = list.shift();
+  else if (!n || n >= length) {
+    // read it all, truncate the array.
+    if (stringMode)
+      ret = list.join('');
+    else
+      ret = Buffer.concat(list, length);
+    list.length = 0;
+  } else {
+    // read just some of it.
+    if (n < list[0].length) {
+      // just take a part of the first list item.
+      // slice is the same for buffers and strings.
+      var buf = list[0];
+      ret = buf.slice(0, n);
+      list[0] = buf.slice(n);
+    } else if (n === list[0].length) {
+      // first list is a perfect match
+      ret = list.shift();
+    } else {
+      // complex case.
+      // we have enough to cover it, but it spans past the first buffer.
+      if (stringMode)
+        ret = '';
+      else
+        ret = new Buffer(n);
+
+      var c = 0;
+      for (var i = 0, l = list.length; i < l && c < n; i++) {
+        var buf = list[0];
+        var cpy = Math.min(n - c, buf.length);
+
+        if (stringMode)
+          ret += buf.slice(0, cpy);
+        else
+          buf.copy(ret, c, 0, cpy);
+
+        if (cpy < buf.length)
+          list[0] = buf.slice(cpy);
+        else
+          list.shift();
+
+        c += cpy;
+      }
+    }
+  }
+
+  return ret;
+}
+
+function endReadable(stream) {
+  var state = stream._readableState;
+
+  // If we get here before consuming all the bytes, then that is a
+  // bug in node.  Should never happen.
+  if (state.length > 0)
+    throw new Error('endReadable called on non-empty stream');
+
+  if (!state.endEmitted) {
+    state.ended = true;
+    process.nextTick(function() {
+      // Check that we didn't get one last unshift.
+      if (!state.endEmitted && state.length === 0) {
+        state.endEmitted = true;
+        stream.readable = false;
+        stream.emit('end');
+      }
+    });
+  }
+}
+
+function forEach (xs, f) {
+  for (var i = 0, l = xs.length; i < l; i++) {
+    f(xs[i], i);
+  }
+}
+
+function indexOf (xs, x) {
+  for (var i = 0, l = xs.length; i < l; i++) {
+    if (xs[i] === x) return i;
+  }
+  return -1;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_transform.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_transform.js
new file mode 100755 (executable)
index 0000000..905c5e4
--- /dev/null
@@ -0,0 +1,209 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+
+// a transform stream is a readable/writable stream where you do
+// something with the data.  Sometimes it's called a "filter",
+// but that's not a great name for it, since that implies a thing where
+// some bits pass through, and others are simply ignored.  (That would
+// be a valid example of a transform, of course.)
+//
+// While the output is causally related to the input, it's not a
+// necessarily symmetric or synchronous transformation.  For example,
+// a zlib stream might take multiple plain-text writes(), and then
+// emit a single compressed chunk some time in the future.
+//
+// Here's how this works:
+//
+// The Transform stream has all the aspects of the readable and writable
+// stream classes.  When you write(chunk), that calls _write(chunk,cb)
+// internally, and returns false if there's a lot of pending writes
+// buffered up.  When you call read(), that calls _read(n) until
+// there's enough pending readable data buffered up.
+//
+// In a transform stream, the written data is placed in a buffer.  When
+// _read(n) is called, it transforms the queued up data, calling the
+// buffered _write cb's as it consumes chunks.  If consuming a single
+// written chunk would result in multiple output chunks, then the first
+// outputted bit calls the readcb, and subsequent chunks just go into
+// the read buffer, and will cause it to emit 'readable' if necessary.
+//
+// This way, back-pressure is actually determined by the reading side,
+// since _read has to be called to start processing a new chunk.  However,
+// a pathological inflate type of transform can cause excessive buffering
+// here.  For example, imagine a stream where every byte of input is
+// interpreted as an integer from 0-255, and then results in that many
+// bytes of output.  Writing the 4 bytes {ff,ff,ff,ff} would result in
+// 1kb of data being output.  In this case, you could write a very small
+// amount of input, and end up with a very large amount of output.  In
+// such a pathological inflating mechanism, there'd be no way to tell
+// the system to stop doing the transform.  A single 4MB write could
+// cause the system to run out of memory.
+//
+// However, even in such a pathological case, only a single written chunk
+// would be consumed, and then the rest would wait (un-transformed) until
+// the results of the previous transformed chunk were consumed.
+
+module.exports = Transform;
+
+var Duplex = require('./_stream_duplex');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(Transform, Duplex);
+
+
+function TransformState(options, stream) {
+  this.afterTransform = function(er, data) {
+    return afterTransform(stream, er, data);
+  };
+
+  this.needTransform = false;
+  this.transforming = false;
+  this.writecb = null;
+  this.writechunk = null;
+}
+
+function afterTransform(stream, er, data) {
+  var ts = stream._transformState;
+  ts.transforming = false;
+
+  var cb = ts.writecb;
+
+  if (!cb)
+    return stream.emit('error', new Error('no writecb in Transform class'));
+
+  ts.writechunk = null;
+  ts.writecb = null;
+
+  if (!util.isNullOrUndefined(data))
+    stream.push(data);
+
+  if (cb)
+    cb(er);
+
+  var rs = stream._readableState;
+  rs.reading = false;
+  if (rs.needReadable || rs.length < rs.highWaterMark) {
+    stream._read(rs.highWaterMark);
+  }
+}
+
+
+function Transform(options) {
+  if (!(this instanceof Transform))
+    return new Transform(options);
+
+  Duplex.call(this, options);
+
+  this._transformState = new TransformState(options, this);
+
+  // when the writable side finishes, then flush out anything remaining.
+  var stream = this;
+
+  // start out asking for a readable event once data is transformed.
+  this._readableState.needReadable = true;
+
+  // we have implemented the _read method, and done the other things
+  // that Readable wants before the first _read call, so unset the
+  // sync guard flag.
+  this._readableState.sync = false;
+
+  this.once('prefinish', function() {
+    if (util.isFunction(this._flush))
+      this._flush(function(er) {
+        done(stream, er);
+      });
+    else
+      done(stream);
+  });
+}
+
+Transform.prototype.push = function(chunk, encoding) {
+  this._transformState.needTransform = false;
+  return Duplex.prototype.push.call(this, chunk, encoding);
+};
+
+// This is the part where you do stuff!
+// override this function in implementation classes.
+// 'chunk' is an input chunk.
+//
+// Call `push(newChunk)` to pass along transformed output
+// to the readable side.  You may call 'push' zero or more times.
+//
+// Call `cb(err)` when you are done with this chunk.  If you pass
+// an error, then that'll put the hurt on the whole operation.  If you
+// never call cb(), then you'll never get another chunk.
+Transform.prototype._transform = function(chunk, encoding, cb) {
+  throw new Error('not implemented');
+};
+
+Transform.prototype._write = function(chunk, encoding, cb) {
+  var ts = this._transformState;
+  ts.writecb = cb;
+  ts.writechunk = chunk;
+  ts.writeencoding = encoding;
+  if (!ts.transforming) {
+    var rs = this._readableState;
+    if (ts.needTransform ||
+        rs.needReadable ||
+        rs.length < rs.highWaterMark)
+      this._read(rs.highWaterMark);
+  }
+};
+
+// Doesn't matter what the args are here.
+// _transform does all the work.
+// That we got here means that the readable side wants more data.
+Transform.prototype._read = function(n) {
+  var ts = this._transformState;
+
+  if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
+    ts.transforming = true;
+    this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
+  } else {
+    // mark that we need a transform, so that any data that comes in
+    // will get processed, now that we've asked for it.
+    ts.needTransform = true;
+  }
+};
+
+
+function done(stream, er) {
+  if (er)
+    return stream.emit('error', er);
+
+  // if there's nothing in the write buffer, then that means
+  // that nothing more will ever be provided
+  var ws = stream._writableState;
+  var ts = stream._transformState;
+
+  if (ws.length)
+    throw new Error('calling transform done when ws.length != 0');
+
+  if (ts.transforming)
+    throw new Error('calling transform done when still transforming');
+
+  return stream.push(null);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_writable.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/lib/_stream_writable.js
new file mode 100755 (executable)
index 0000000..db8539c
--- /dev/null
@@ -0,0 +1,477 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+// A bit simpler than readable streams.
+// Implement an async ._write(chunk, cb), and it'll handle all
+// the drain event emission and buffering.
+
+module.exports = Writable;
+
+/*<replacement>*/
+var Buffer = require('buffer').Buffer;
+/*</replacement>*/
+
+Writable.WritableState = WritableState;
+
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var Stream = require('stream');
+
+util.inherits(Writable, Stream);
+
+function WriteReq(chunk, encoding, cb) {
+  this.chunk = chunk;
+  this.encoding = encoding;
+  this.callback = cb;
+}
+
+function WritableState(options, stream) {
+  var Duplex = require('./_stream_duplex');
+
+  options = options || {};
+
+  // the point at which write() starts returning false
+  // Note: 0 is a valid value, means that we always return false if
+  // the entire buffer is not flushed immediately on write()
+  var hwm = options.highWaterMark;
+  var defaultHwm = options.objectMode ? 16 : 16 * 1024;
+  this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
+
+  // object stream flag to indicate whether or not this stream
+  // contains buffers or objects.
+  this.objectMode = !!options.objectMode;
+
+  if (stream instanceof Duplex)
+    this.objectMode = this.objectMode || !!options.writableObjectMode;
+
+  // cast to ints.
+  this.highWaterMark = ~~this.highWaterMark;
+
+  this.needDrain = false;
+  // at the start of calling end()
+  this.ending = false;
+  // when end() has been called, and returned
+  this.ended = false;
+  // when 'finish' is emitted
+  this.finished = false;
+
+  // should we decode strings into buffers before passing to _write?
+  // this is here so that some node-core streams can optimize string
+  // handling at a lower level.
+  var noDecode = options.decodeStrings === false;
+  this.decodeStrings = !noDecode;
+
+  // Crypto is kind of old and crusty.  Historically, its default string
+  // encoding is 'binary' so we have to make this configurable.
+  // Everything else in the universe uses 'utf8', though.
+  this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+  // not an actual buffer we keep track of, but a measurement
+  // of how much we're waiting to get pushed to some underlying
+  // socket or file.
+  this.length = 0;
+
+  // a flag to see when we're in the middle of a write.
+  this.writing = false;
+
+  // when true all writes will be buffered until .uncork() call
+  this.corked = 0;
+
+  // a flag to be able to tell if the onwrite cb is called immediately,
+  // or on a later tick.  We set this to true at first, because any
+  // actions that shouldn't happen until "later" should generally also
+  // not happen before the first write call.
+  this.sync = true;
+
+  // a flag to know if we're processing previously buffered items, which
+  // may call the _write() callback in the same tick, so that we don't
+  // end up in an overlapped onwrite situation.
+  this.bufferProcessing = false;
+
+  // the callback that's passed to _write(chunk,cb)
+  this.onwrite = function(er) {
+    onwrite(stream, er);
+  };
+
+  // the callback that the user supplies to write(chunk,encoding,cb)
+  this.writecb = null;
+
+  // the amount that is being written when _write is called.
+  this.writelen = 0;
+
+  this.buffer = [];
+
+  // number of pending user-supplied write callbacks
+  // this must be 0 before 'finish' can be emitted
+  this.pendingcb = 0;
+
+  // emit prefinish if the only thing we're waiting for is _write cbs
+  // This is relevant for synchronous Transform streams
+  this.prefinished = false;
+
+  // True if the error was already emitted and should not be thrown again
+  this.errorEmitted = false;
+}
+
+function Writable(options) {
+  var Duplex = require('./_stream_duplex');
+
+  // Writable ctor is applied to Duplexes, though they're not
+  // instanceof Writable, they're instanceof Readable.
+  if (!(this instanceof Writable) && !(this instanceof Duplex))
+    return new Writable(options);
+
+  this._writableState = new WritableState(options, this);
+
+  // legacy.
+  this.writable = true;
+
+  Stream.call(this);
+}
+
+// Otherwise people can pipe Writable streams, which is just wrong.
+Writable.prototype.pipe = function() {
+  this.emit('error', new Error('Cannot pipe. Not readable.'));
+};
+
+
+function writeAfterEnd(stream, state, cb) {
+  var er = new Error('write after end');
+  // TODO: defer error events consistently everywhere, not just the cb
+  stream.emit('error', er);
+  process.nextTick(function() {
+    cb(er);
+  });
+}
+
+// If we get something that is not a buffer, string, null, or undefined,
+// and we're not in objectMode, then that's an error.
+// Otherwise stream chunks are all considered to be of length=1, and the
+// watermarks determine how many objects to keep in the buffer, rather than
+// how many bytes or characters.
+function validChunk(stream, state, chunk, cb) {
+  var valid = true;
+  if (!util.isBuffer(chunk) &&
+      !util.isString(chunk) &&
+      !util.isNullOrUndefined(chunk) &&
+      !state.objectMode) {
+    var er = new TypeError('Invalid non-string/buffer chunk');
+    stream.emit('error', er);
+    process.nextTick(function() {
+      cb(er);
+    });
+    valid = false;
+  }
+  return valid;
+}
+
+Writable.prototype.write = function(chunk, encoding, cb) {
+  var state = this._writableState;
+  var ret = false;
+
+  if (util.isFunction(encoding)) {
+    cb = encoding;
+    encoding = null;
+  }
+
+  if (util.isBuffer(chunk))
+    encoding = 'buffer';
+  else if (!encoding)
+    encoding = state.defaultEncoding;
+
+  if (!util.isFunction(cb))
+    cb = function() {};
+
+  if (state.ended)
+    writeAfterEnd(this, state, cb);
+  else if (validChunk(this, state, chunk, cb)) {
+    state.pendingcb++;
+    ret = writeOrBuffer(this, state, chunk, encoding, cb);
+  }
+
+  return ret;
+};
+
+Writable.prototype.cork = function() {
+  var state = this._writableState;
+
+  state.corked++;
+};
+
+Writable.prototype.uncork = function() {
+  var state = this._writableState;
+
+  if (state.corked) {
+    state.corked--;
+
+    if (!state.writing &&
+        !state.corked &&
+        !state.finished &&
+        !state.bufferProcessing &&
+        state.buffer.length)
+      clearBuffer(this, state);
+  }
+};
+
+function decodeChunk(state, chunk, encoding) {
+  if (!state.objectMode &&
+      state.decodeStrings !== false &&
+      util.isString(chunk)) {
+    chunk = new Buffer(chunk, encoding);
+  }
+  return chunk;
+}
+
+// if we're already writing something, then just put this
+// in the queue, and wait our turn.  Otherwise, call _write
+// If we return false, then we need a drain event, so set that flag.
+function writeOrBuffer(stream, state, chunk, encoding, cb) {
+  chunk = decodeChunk(state, chunk, encoding);
+  if (util.isBuffer(chunk))
+    encoding = 'buffer';
+  var len = state.objectMode ? 1 : chunk.length;
+
+  state.length += len;
+
+  var ret = state.length < state.highWaterMark;
+  // we must ensure that previous needDrain will not be reset to false.
+  if (!ret)
+    state.needDrain = true;
+
+  if (state.writing || state.corked)
+    state.buffer.push(new WriteReq(chunk, encoding, cb));
+  else
+    doWrite(stream, state, false, len, chunk, encoding, cb);
+
+  return ret;
+}
+
+function doWrite(stream, state, writev, len, chunk, encoding, cb) {
+  state.writelen = len;
+  state.writecb = cb;
+  state.writing = true;
+  state.sync = true;
+  if (writev)
+    stream._writev(chunk, state.onwrite);
+  else
+    stream._write(chunk, encoding, state.onwrite);
+  state.sync = false;
+}
+
+function onwriteError(stream, state, sync, er, cb) {
+  if (sync)
+    process.nextTick(function() {
+      state.pendingcb--;
+      cb(er);
+    });
+  else {
+    state.pendingcb--;
+    cb(er);
+  }
+
+  stream._writableState.errorEmitted = true;
+  stream.emit('error', er);
+}
+
+function onwriteStateUpdate(state) {
+  state.writing = false;
+  state.writecb = null;
+  state.length -= state.writelen;
+  state.writelen = 0;
+}
+
+function onwrite(stream, er) {
+  var state = stream._writableState;
+  var sync = state.sync;
+  var cb = state.writecb;
+
+  onwriteStateUpdate(state);
+
+  if (er)
+    onwriteError(stream, state, sync, er, cb);
+  else {
+    // Check if we're actually ready to finish, but don't emit yet
+    var finished = needFinish(stream, state);
+
+    if (!finished &&
+        !state.corked &&
+        !state.bufferProcessing &&
+        state.buffer.length) {
+      clearBuffer(stream, state);
+    }
+
+    if (sync) {
+      process.nextTick(function() {
+        afterWrite(stream, state, finished, cb);
+      });
+    } else {
+      afterWrite(stream, state, finished, cb);
+    }
+  }
+}
+
+function afterWrite(stream, state, finished, cb) {
+  if (!finished)
+    onwriteDrain(stream, state);
+  state.pendingcb--;
+  cb();
+  finishMaybe(stream, state);
+}
+
+// Must force callback to be called on nextTick, so that we don't
+// emit 'drain' before the write() consumer gets the 'false' return
+// value, and has a chance to attach a 'drain' listener.
+function onwriteDrain(stream, state) {
+  if (state.length === 0 && state.needDrain) {
+    state.needDrain = false;
+    stream.emit('drain');
+  }
+}
+
+
+// if there's something in the buffer waiting, then process it
+function clearBuffer(stream, state) {
+  state.bufferProcessing = true;
+
+  if (stream._writev && state.buffer.length > 1) {
+    // Fast case, write everything using _writev()
+    var cbs = [];
+    for (var c = 0; c < state.buffer.length; c++)
+      cbs.push(state.buffer[c].callback);
+
+    // count the one we are adding, as well.
+    // TODO(isaacs) clean this up
+    state.pendingcb++;
+    doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
+      for (var i = 0; i < cbs.length; i++) {
+        state.pendingcb--;
+        cbs[i](err);
+      }
+    });
+
+    // Clear buffer
+    state.buffer = [];
+  } else {
+    // Slow case, write chunks one-by-one
+    for (var c = 0; c < state.buffer.length; c++) {
+      var entry = state.buffer[c];
+      var chunk = entry.chunk;
+      var encoding = entry.encoding;
+      var cb = entry.callback;
+      var len = state.objectMode ? 1 : chunk.length;
+
+      doWrite(stream, state, false, len, chunk, encoding, cb);
+
+      // if we didn't call the onwrite immediately, then
+      // it means that we need to wait until it does.
+      // also, that means that the chunk and cb are currently
+      // being processed, so move the buffer counter past them.
+      if (state.writing) {
+        c++;
+        break;
+      }
+    }
+
+    if (c < state.buffer.length)
+      state.buffer = state.buffer.slice(c);
+    else
+      state.buffer.length = 0;
+  }
+
+  state.bufferProcessing = false;
+}
+
+Writable.prototype._write = function(chunk, encoding, cb) {
+  cb(new Error('not implemented'));
+
+};
+
+Writable.prototype._writev = null;
+
+Writable.prototype.end = function(chunk, encoding, cb) {
+  var state = this._writableState;
+
+  if (util.isFunction(chunk)) {
+    cb = chunk;
+    chunk = null;
+    encoding = null;
+  } else if (util.isFunction(encoding)) {
+    cb = encoding;
+    encoding = null;
+  }
+
+  if (!util.isNullOrUndefined(chunk))
+    this.write(chunk, encoding);
+
+  // .end() fully uncorks
+  if (state.corked) {
+    state.corked = 1;
+    this.uncork();
+  }
+
+  // ignore unnecessary end() calls.
+  if (!state.ending && !state.finished)
+    endWritable(this, state, cb);
+};
+
+
+function needFinish(stream, state) {
+  return (state.ending &&
+          state.length === 0 &&
+          !state.finished &&
+          !state.writing);
+}
+
+function prefinish(stream, state) {
+  if (!state.prefinished) {
+    state.prefinished = true;
+    stream.emit('prefinish');
+  }
+}
+
+function finishMaybe(stream, state) {
+  var need = needFinish(stream, state);
+  if (need) {
+    if (state.pendingcb === 0) {
+      prefinish(stream, state);
+      state.finished = true;
+      stream.emit('finish');
+    } else
+      prefinish(stream, state);
+  }
+  return need;
+}
+
+function endWritable(stream, state, cb) {
+  state.ending = true;
+  finishMaybe(stream, state);
+  if (cb) {
+    if (state.finished)
+      process.nextTick(cb);
+    else
+      stream.once('finish', cb);
+  }
+  state.ended = true;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/LICENSE
new file mode 100755 (executable)
index 0000000..dea3013
--- /dev/null
@@ -0,0 +1,16 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/README.md
new file mode 100755 (executable)
index 0000000..b1c5665
--- /dev/null
@@ -0,0 +1,42 @@
+Browser-friendly inheritance fully compatible with standard node.js
+[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
+
+This package exports standard `inherits` from node.js `util` module in
+node environment, but also provides alternative browser-friendly
+implementation through [browser
+field](https://gist.github.com/shtylman/4339901). Alternative
+implementation is a literal copy of standard one located in standalone
+module to avoid requiring of `util`. It also has a shim for old
+browsers with no `Object.create` support.
+
+While keeping you sure you are using standard `inherits`
+implementation in node.js environment, it allows bundlers such as
+[browserify](https://github.com/substack/node-browserify) to not
+include full `util` package to your client code if all you need is
+just `inherits` function. It worth, because browser shim for `util`
+package is large and `inherits` is often the single function you need
+from it.
+
+It's recommended to use this package instead of
+`require('util').inherits` for any code that has chances to be used
+not only in node.js but in browser too.
+
+## usage
+
+```js
+var inherits = require('inherits');
+// then use exactly as the standard one
+```
+
+## note on version ~1.0
+
+Version ~1.0 had completely different motivation and is not compatible
+neither with 2.0 nor with standard node.js `inherits`.
+
+If you are using version ~1.0 and planning to switch to ~2.0, be
+careful:
+
+* new version uses `super_` instead of `super` for referencing
+  superclass
+* new version overwrites current prototype while old one preserves any
+  existing fields on it
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/inherits/test.js
new file mode 100755 (executable)
index 0000000..fc53012
--- /dev/null
@@ -0,0 +1,25 @@
+var inherits = require('./inherits.js')
+var assert = require('assert')
+
+function test(c) {
+  assert(c.constructor === Child)
+  assert(c.constructor.super_ === Parent)
+  assert(Object.getPrototypeOf(c) === Child.prototype)
+  assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
+  assert(c instanceof Child)
+  assert(c instanceof Parent)
+}
+
+function Child() {
+  Parent.call(this)
+  test(this)
+}
+
+function Parent() {}
+
+inherits(Child, Parent)
+
+var c = new Child
+test(c)
+
+console.log('ok')
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/isarray/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/isarray/README.md
new file mode 100755 (executable)
index 0000000..052a62b
--- /dev/null
@@ -0,0 +1,54 @@
+
+# isarray
+
+`Array#isArray` for older browsers.
+
+## Usage
+
+```js
+var isArray = require('isarray');
+
+console.log(isArray([])); // => true
+console.log(isArray({})); // => false
+```
+
+## Installation
+
+With [npm](http://npmjs.org) do
+
+```bash
+$ npm install isarray
+```
+
+Then bundle for the browser with
+[browserify](https://github.com/substack/browserify).
+
+With [component](http://component.io) do
+
+```bash
+$ component install juliangruber/isarray
+```
+
+## License
+
+(MIT)
+
+Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/isarray/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/node_modules/isarray/index.js
new file mode 100755 (executable)
index 0000000..5f5ad45
--- /dev/null
@@ -0,0 +1,3 @@
+module.exports = Array.isArray || function (arr) {
+  return Object.prototype.toString.call(arr) == '[object Array]';
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/package.json
new file mode 100755 (executable)
index 0000000..6a8ffa0
--- /dev/null
@@ -0,0 +1,70 @@
+{
+  "name": "readable-stream",
+  "version": "1.1.13",
+  "description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x",
+  "main": "readable.js",
+  "dependencies": {
+    "core-util-is": "~1.0.0",
+    "isarray": "0.0.1",
+    "string_decoder": "~0.10.x",
+    "inherits": "~2.0.1"
+  },
+  "devDependencies": {
+    "tap": "~0.2.6"
+  },
+  "scripts": {
+    "test": "tap test/simple/*.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/readable-stream"
+  },
+  "keywords": [
+    "readable",
+    "stream",
+    "pipe"
+  ],
+  "browser": {
+    "util": false
+  },
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me/"
+  },
+  "license": "MIT",
+  "gitHead": "3b672fd7ae92acf5b4ffdbabf74b372a0a56b051",
+  "bugs": {
+    "url": "https://github.com/isaacs/readable-stream/issues"
+  },
+  "homepage": "https://github.com/isaacs/readable-stream",
+  "_id": "readable-stream@1.1.13",
+  "_shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e",
+  "_from": "readable-stream@^1.1.8",
+  "_npmVersion": "1.4.23",
+  "_npmUser": {
+    "name": "rvagg",
+    "email": "rod@vagg.org"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    },
+    {
+      "name": "tootallnate",
+      "email": "nathan@tootallnate.net"
+    },
+    {
+      "name": "rvagg",
+      "email": "rod@vagg.org"
+    }
+  ],
+  "dist": {
+    "shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e",
+    "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/passthrough.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/passthrough.js
new file mode 100755 (executable)
index 0000000..27e8d8a
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_passthrough.js")
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/readable.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/readable.js
new file mode 100755 (executable)
index 0000000..09b8bf5
--- /dev/null
@@ -0,0 +1,7 @@
+exports = module.exports = require('./lib/_stream_readable.js');
+exports.Stream = require('stream');
+exports.Readable = exports;
+exports.Writable = require('./lib/_stream_writable.js');
+exports.Duplex = require('./lib/_stream_duplex.js');
+exports.Transform = require('./lib/_stream_transform.js');
+exports.PassThrough = require('./lib/_stream_passthrough.js');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/transform.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/transform.js
new file mode 100755 (executable)
index 0000000..5d482f0
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_transform.js")
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/writable.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/readable-stream/writable.js
new file mode 100755 (executable)
index 0000000..e1e9efd
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_writable.js")
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/LICENSE
new file mode 100755 (executable)
index 0000000..05eeeb8
--- /dev/null
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) Isaac Z. Schlueter
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/README.md
new file mode 100755 (executable)
index 0000000..7fb7ec4
--- /dev/null
@@ -0,0 +1,39 @@
+# node-touch
+
+For all your node touching needs.
+
+## Installing
+
+```bash
+npm install touch
+```
+
+## CLI Usage:
+
+See `man touch`
+
+## API Usage:
+
+```javascript
+var touch = require("touch")
+```
+
+Gives you the following functions:
+
+* `touch(filename, options, cb)`
+* `touch.sync(filename, options)`
+* `touch.ftouch(fd, options, cb)`
+* `touch.ftouchSync(fd, options)`
+
+## Options
+
+* `force` like `touch -f` Boolean
+* `time` like `touch -t <date>` Can be a Date object, or any parseable
+  Date string, or epoch ms number.
+* `atime` like `touch -a` Can be either a Boolean, or a Date.
+* `mtime` like `touch -m` Can be either a Boolean, or a Date.
+* `ref` like `touch -r <file>` Must be path to a file.
+* `nocreate` like `touch -c` Boolean
+
+If neither `atime` nor `mtime` are set, then both values are set.  If
+one of them is set, then the other is not.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/bin/touch.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/bin/touch.js
new file mode 100755 (executable)
index 0000000..931ca4d
--- /dev/null
@@ -0,0 +1,31 @@
+var touch = require("../touch")
+  , fs = require("fs")
+  , path = require("path")
+  , nopt = require("nopt")
+  , types = { atime: Boolean
+            , mtime: Boolean
+            , time: Date
+            , ref: path
+            , nocreate: Boolean
+            , force: Boolean }
+  , shorthands = { a: "--atime"
+                 , m: "--mtime"
+                 , r: "--ref"
+                 , t: "--time"
+                 , c: "--nocreate"
+                 , f: "--force" }
+
+var options = nopt(types, shorthands)
+
+var files = options.argv.remain
+delete options.argv
+
+files.forEach(function (file) {
+  touch(file, options, function (er) {
+    if (er) {
+      console.error("bad touch!")
+      throw er
+    }
+    console.error(file, fs.statSync(file))
+  })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/LICENSE
new file mode 100755 (executable)
index 0000000..05a4010
--- /dev/null
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+All rights reserved.
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/README.md
new file mode 100755 (executable)
index 0000000..eeddfd4
--- /dev/null
@@ -0,0 +1,208 @@
+If you want to write an option parser, and have it be good, there are
+two ways to do it.  The Right Way, and the Wrong Way.
+
+The Wrong Way is to sit down and write an option parser.  We've all done
+that.
+
+The Right Way is to write some complex configurable program with so many
+options that you go half-insane just trying to manage them all, and put
+it off with duct-tape solutions until you see exactly to the core of the
+problem, and finally snap and write an awesome option parser.
+
+If you want to write an option parser, don't write an option parser.
+Write a package manager, or a source control system, or a service
+restarter, or an operating system.  You probably won't end up with a
+good one of those, but if you don't give up, and you are relentless and
+diligent enough in your procrastination, you may just end up with a very
+nice option parser.
+
+## USAGE
+
+    // my-program.js
+    var nopt = require("nopt")
+      , Stream = require("stream").Stream
+      , path = require("path")
+      , knownOpts = { "foo" : [String, null]
+                    , "bar" : [Stream, Number]
+                    , "baz" : path
+                    , "bloo" : [ "big", "medium", "small" ]
+                    , "flag" : Boolean
+                    , "pick" : Boolean
+                    , "many" : [String, Array]
+                    }
+      , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+                     , "b7" : ["--bar", "7"]
+                     , "m" : ["--bloo", "medium"]
+                     , "p" : ["--pick"]
+                     , "f" : ["--flag"]
+                     }
+                 // everything is optional.
+                 // knownOpts and shorthands default to {}
+                 // arg list defaults to process.argv
+                 // slice defaults to 2
+      , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+    console.log(parsed)
+
+This would give you support for any of the following:
+
+```bash
+$ node my-program.js --foo "blerp" --no-flag
+{ "foo" : "blerp", "flag" : false }
+
+$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag
+{ bar: 7, foo: "Mr. Hand", flag: true }
+
+$ node my-program.js --foo "blerp" -f -----p
+{ foo: "blerp", flag: true, pick: true }
+
+$ node my-program.js -fp --foofoo
+{ foo: "Mr. Foo", flag: true, pick: true }
+
+$ node my-program.js --foofoo -- -fp  # -- stops the flag parsing.
+{ foo: "Mr. Foo", argv: { remain: ["-fp"] } }
+
+$ node my-program.js --blatzk 1000 -fp # unknown opts are ok.
+{ blatzk: 1000, flag: true, pick: true }
+
+$ node my-program.js --blatzk true -fp # but they need a value
+{ blatzk: true, flag: true, pick: true }
+
+$ node my-program.js --no-blatzk -fp # unless they start with "no-"
+{ blatzk: false, flag: true, pick: true }
+
+$ node my-program.js --baz b/a/z # known paths are resolved.
+{ baz: "/Users/isaacs/b/a/z" }
+
+# if Array is one of the types, then it can take many
+# values, and will always be an array.  The other types provided
+# specify what types are allowed in the list.
+
+$ node my-program.js --many 1 --many null --many foo
+{ many: ["1", "null", "foo"] }
+
+$ node my-program.js --many foo
+{ many: ["foo"] }
+```
+
+Read the tests at the bottom of `lib/nopt.js` for more examples of
+what this puppy can do.
+
+## Types
+
+The following types are supported, and defined on `nopt.typeDefs`
+
+* String: A normal string.  No parsing is done.
+* path: A file system path.  Gets resolved against cwd if not absolute.
+* url: A url.  If it doesn't parse, it isn't accepted.
+* Number: Must be numeric.
+* Date: Must parse as a date. If it does, and `Date` is one of the options,
+  then it will return a Date object, not a string.
+* Boolean: Must be either `true` or `false`.  If an option is a boolean,
+  then it does not need a value, and its presence will imply `true` as
+  the value.  To negate boolean flags, do `--no-whatever` or `--whatever
+  false`
+* NaN: Means that the option is strictly not allowed.  Any value will
+  fail.
+* Stream: An object matching the "Stream" class in node.  Valuable
+  for use when validating programmatically.  (npm uses this to let you
+  supply any WriteStream on the `outfd` and `logfd` config options.)
+* Array: If `Array` is specified as one of the types, then the value
+  will be parsed as a list of options.  This means that multiple values
+  can be specified, and that the value will always be an array.
+
+If a type is an array of values not on this list, then those are
+considered valid values.  For instance, in the example above, the
+`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`,
+and any other value will be rejected.
+
+When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be
+interpreted as their JavaScript equivalents, and numeric values will be
+interpreted as a number.
+
+You can also mix types and values, or multiple types, in a list.  For
+instance `{ blah: [Number, null] }` would allow a value to be set to
+either a Number or null.
+
+To define a new type, add it to `nopt.typeDefs`.  Each item in that
+hash is an object with a `type` member and a `validate` method.  The
+`type` member is an object that matches what goes in the type list.  The
+`validate` method is a function that gets called with `validate(data,
+key, val)`.  Validate methods should assign `data[key]` to the valid
+value of `val` if it can be handled properly, or return boolean
+`false` if it cannot.
+
+You can also call `nopt.clean(data, types, typeDefs)` to clean up a
+config object and remove its invalid properties.
+
+## Error Handling
+
+By default, nopt outputs a warning to standard error when invalid
+options are found.  You can change this behavior by assigning a method
+to `nopt.invalidHandler`.  This method will be called with
+the offending `nopt.invalidHandler(key, val, types)`.
+
+If no `nopt.invalidHandler` is assigned, then it will console.error
+its whining.  If it is assigned to boolean `false` then the warning is
+suppressed.
+
+## Abbreviations
+
+Yes, they are supported.  If you define options like this:
+
+```javascript
+{ "foolhardyelephants" : Boolean
+, "pileofmonkeys" : Boolean }
+```
+
+Then this will work:
+
+```bash
+node program.js --foolhar --pil
+node program.js --no-f --pileofmon
+# etc.
+```
+
+## Shorthands
+
+Shorthands are a hash of shorter option names to a snippet of args that
+they expand to.
+
+If multiple one-character shorthands are all combined, and the
+combination does not unambiguously match any other option or shorthand,
+then they will be broken up into their constituent parts.  For example:
+
+```json
+{ "s" : ["--loglevel", "silent"]
+, "g" : "--global"
+, "f" : "--force"
+, "p" : "--parseable"
+, "l" : "--long"
+}
+```
+
+```bash
+npm ls -sgflp
+# just like doing this:
+npm ls --loglevel silent --global --force --long --parseable
+```
+
+## The Rest of the args
+
+The config object returned by nopt is given a special member called
+`argv`, which is an object with the following fields:
+
+* `remain`: The remaining args after all the parsing has occurred.
+* `original`: The args as they originally appeared.
+* `cooked`: The args after flags and shorthands are expanded.
+
+## Slicing
+
+Node programs are called with more or less the exact argv as it appears
+in C land, after the v8 and node-specific options have been plucked off.
+As such, `argv[0]` is always `node` and `argv[1]` is always the
+JavaScript program being run.
+
+That's usually not very useful to you.  So they're sliced off by
+default.  If you want them, then you can pass in `0` as the last
+argument, or any other number that you'd like to slice off the start of
+the list.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/bin/nopt.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/bin/nopt.js
new file mode 100755 (executable)
index 0000000..df90c72
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/env node
+var nopt = require("../lib/nopt")
+  , types = { num: Number
+            , bool: Boolean
+            , help: Boolean
+            , list: Array
+            , "num-list": [Number, Array]
+            , "str-list": [String, Array]
+            , "bool-list": [Boolean, Array]
+            , str: String }
+  , shorthands = { s: [ "--str", "astring" ]
+                 , b: [ "--bool" ]
+                 , nb: [ "--no-bool" ]
+                 , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ]
+                 , "?": ["--help"]
+                 , h: ["--help"]
+                 , H: ["--help"]
+                 , n: [ "--num", "125" ] }
+  , parsed = nopt( types
+                 , shorthands
+                 , process.argv
+                 , 2 )
+
+console.log("parsed", parsed)
+
+if (parsed.help) {
+  console.log("")
+  console.log("nopt cli tester")
+  console.log("")
+  console.log("types")
+  console.log(Object.keys(types).map(function M (t) {
+    var type = types[t]
+    if (Array.isArray(type)) {
+      return [t, type.map(function (type) { return type.name })]
+    }
+    return [t, type && type.name]
+  }).reduce(function (s, i) {
+    s[i[0]] = i[1]
+    return s
+  }, {}))
+  console.log("")
+  console.log("shorthands")
+  console.log(shorthands)
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/examples/my-program.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/examples/my-program.js
new file mode 100755 (executable)
index 0000000..142447e
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env node
+
+//process.env.DEBUG_NOPT = 1
+
+// my-program.js
+var nopt = require("../lib/nopt")
+  , Stream = require("stream").Stream
+  , path = require("path")
+  , knownOpts = { "foo" : [String, null]
+                , "bar" : [Stream, Number]
+                , "baz" : path
+                , "bloo" : [ "big", "medium", "small" ]
+                , "flag" : Boolean
+                , "pick" : Boolean
+                }
+  , shortHands = { "foofoo" : ["--foo", "Mr. Foo"]
+                 , "b7" : ["--bar", "7"]
+                 , "m" : ["--bloo", "medium"]
+                 , "p" : ["--pick"]
+                 , "f" : ["--flag", "true"]
+                 , "g" : ["--flag"]
+                 , "s" : "--flag"
+                 }
+             // everything is optional.
+             // knownOpts and shorthands default to {}
+             // arg list defaults to process.argv
+             // slice defaults to 2
+  , parsed = nopt(knownOpts, shortHands, process.argv, 2)
+
+console.log("parsed =\n"+ require("util").inspect(parsed))
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/lib/nopt.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/lib/nopt.js
new file mode 100755 (executable)
index 0000000..ff802da
--- /dev/null
@@ -0,0 +1,552 @@
+// info about each config option.
+
+var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG
+  ? function () { console.error.apply(console, arguments) }
+  : function () {}
+
+var url = require("url")
+  , path = require("path")
+  , Stream = require("stream").Stream
+  , abbrev = require("abbrev")
+
+module.exports = exports = nopt
+exports.clean = clean
+
+exports.typeDefs =
+  { String  : { type: String,  validate: validateString  }
+  , Boolean : { type: Boolean, validate: validateBoolean }
+  , url     : { type: url,     validate: validateUrl     }
+  , Number  : { type: Number,  validate: validateNumber  }
+  , path    : { type: path,    validate: validatePath    }
+  , Stream  : { type: Stream,  validate: validateStream  }
+  , Date    : { type: Date,    validate: validateDate    }
+  }
+
+function nopt (types, shorthands, args, slice) {
+  args = args || process.argv
+  types = types || {}
+  shorthands = shorthands || {}
+  if (typeof slice !== "number") slice = 2
+
+  debug(types, shorthands, args, slice)
+
+  args = args.slice(slice)
+  var data = {}
+    , key
+    , remain = []
+    , cooked = args
+    , original = args.slice(0)
+
+  parse(args, data, remain, types, shorthands)
+  // now data is full
+  clean(data, types, exports.typeDefs)
+  data.argv = {remain:remain,cooked:cooked,original:original}
+  data.argv.toString = function () {
+    return this.original.map(JSON.stringify).join(" ")
+  }
+  return data
+}
+
+function clean (data, types, typeDefs) {
+  typeDefs = typeDefs || exports.typeDefs
+  var remove = {}
+    , typeDefault = [false, true, null, String, Number]
+
+  Object.keys(data).forEach(function (k) {
+    if (k === "argv") return
+    var val = data[k]
+      , isArray = Array.isArray(val)
+      , type = types[k]
+    if (!isArray) val = [val]
+    if (!type) type = typeDefault
+    if (type === Array) type = typeDefault.concat(Array)
+    if (!Array.isArray(type)) type = [type]
+
+    debug("val=%j", val)
+    debug("types=", type)
+    val = val.map(function (val) {
+      // if it's an unknown value, then parse false/true/null/numbers/dates
+      if (typeof val === "string") {
+        debug("string %j", val)
+        val = val.trim()
+        if ((val === "null" && ~type.indexOf(null))
+            || (val === "true" &&
+               (~type.indexOf(true) || ~type.indexOf(Boolean)))
+            || (val === "false" &&
+               (~type.indexOf(false) || ~type.indexOf(Boolean)))) {
+          val = JSON.parse(val)
+          debug("jsonable %j", val)
+        } else if (~type.indexOf(Number) && !isNaN(val)) {
+          debug("convert to number", val)
+          val = +val
+        } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) {
+          debug("convert to date", val)
+          val = new Date(val)
+        }
+      }
+
+      if (!types.hasOwnProperty(k)) {
+        return val
+      }
+
+      // allow `--no-blah` to set 'blah' to null if null is allowed
+      if (val === false && ~type.indexOf(null) &&
+          !(~type.indexOf(false) || ~type.indexOf(Boolean))) {
+        val = null
+      }
+
+      var d = {}
+      d[k] = val
+      debug("prevalidated val", d, val, types[k])
+      if (!validate(d, k, val, types[k], typeDefs)) {
+        if (exports.invalidHandler) {
+          exports.invalidHandler(k, val, types[k], data)
+        } else if (exports.invalidHandler !== false) {
+          debug("invalid: "+k+"="+val, types[k])
+        }
+        return remove
+      }
+      debug("validated val", d, val, types[k])
+      return d[k]
+    }).filter(function (val) { return val !== remove })
+
+    if (!val.length) delete data[k]
+    else if (isArray) {
+      debug(isArray, data[k], val)
+      data[k] = val
+    } else data[k] = val[0]
+
+    debug("k=%s val=%j", k, val, data[k])
+  })
+}
+
+function validateString (data, k, val) {
+  data[k] = String(val)
+}
+
+function validatePath (data, k, val) {
+  data[k] = path.resolve(String(val))
+  return true
+}
+
+function validateNumber (data, k, val) {
+  debug("validate Number %j %j %j", k, val, isNaN(val))
+  if (isNaN(val)) return false
+  data[k] = +val
+}
+
+function validateDate (data, k, val) {
+  debug("validate Date %j %j %j", k, val, Date.parse(val))
+  var s = Date.parse(val)
+  if (isNaN(s)) return false
+  data[k] = new Date(val)
+}
+
+function validateBoolean (data, k, val) {
+  if (val instanceof Boolean) val = val.valueOf()
+  else if (typeof val === "string") {
+    if (!isNaN(val)) val = !!(+val)
+    else if (val === "null" || val === "false") val = false
+    else val = true
+  } else val = !!val
+  data[k] = val
+}
+
+function validateUrl (data, k, val) {
+  val = url.parse(String(val))
+  if (!val.host) return false
+  data[k] = val.href
+}
+
+function validateStream (data, k, val) {
+  if (!(val instanceof Stream)) return false
+  data[k] = val
+}
+
+function validate (data, k, val, type, typeDefs) {
+  // arrays are lists of types.
+  if (Array.isArray(type)) {
+    for (var i = 0, l = type.length; i < l; i ++) {
+      if (type[i] === Array) continue
+      if (validate(data, k, val, type[i], typeDefs)) return true
+    }
+    delete data[k]
+    return false
+  }
+
+  // an array of anything?
+  if (type === Array) return true
+
+  // NaN is poisonous.  Means that something is not allowed.
+  if (type !== type) {
+    debug("Poison NaN", k, val, type)
+    delete data[k]
+    return false
+  }
+
+  // explicit list of values
+  if (val === type) {
+    debug("Explicitly allowed %j", val)
+    // if (isArray) (data[k] = data[k] || []).push(val)
+    // else data[k] = val
+    data[k] = val
+    return true
+  }
+
+  // now go through the list of typeDefs, validate against each one.
+  var ok = false
+    , types = Object.keys(typeDefs)
+  for (var i = 0, l = types.length; i < l; i ++) {
+    debug("test type %j %j %j", k, val, types[i])
+    var t = typeDefs[types[i]]
+    if (t && type === t.type) {
+      var d = {}
+      ok = false !== t.validate(d, k, val)
+      val = d[k]
+      if (ok) {
+        // if (isArray) (data[k] = data[k] || []).push(val)
+        // else data[k] = val
+        data[k] = val
+        break
+      }
+    }
+  }
+  debug("OK? %j (%j %j %j)", ok, k, val, types[i])
+
+  if (!ok) delete data[k]
+  return ok
+}
+
+function parse (args, data, remain, types, shorthands) {
+  debug("parse", args, data, remain)
+
+  var key = null
+    , abbrevs = abbrev(Object.keys(types))
+    , shortAbbr = abbrev(Object.keys(shorthands))
+
+  for (var i = 0; i < args.length; i ++) {
+    var arg = args[i]
+    debug("arg", arg)
+
+    if (arg.match(/^-{2,}$/)) {
+      // done with keys.
+      // the rest are args.
+      remain.push.apply(remain, args.slice(i + 1))
+      args[i] = "--"
+      break
+    }
+    if (arg.charAt(0) === "-") {
+      if (arg.indexOf("=") !== -1) {
+        var v = arg.split("=")
+        arg = v.shift()
+        v = v.join("=")
+        args.splice.apply(args, [i, 1].concat([arg, v]))
+      }
+      // see if it's a shorthand
+      // if so, splice and back up to re-parse it.
+      var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs)
+      debug("arg=%j shRes=%j", arg, shRes)
+      if (shRes) {
+        debug(arg, shRes)
+        args.splice.apply(args, [i, 1].concat(shRes))
+        if (arg !== shRes[0]) {
+          i --
+          continue
+        }
+      }
+      arg = arg.replace(/^-+/, "")
+      var no = false
+      while (arg.toLowerCase().indexOf("no-") === 0) {
+        no = !no
+        arg = arg.substr(3)
+      }
+
+      if (abbrevs[arg]) arg = abbrevs[arg]
+
+      var isArray = types[arg] === Array ||
+        Array.isArray(types[arg]) && types[arg].indexOf(Array) !== -1
+
+      var val
+        , la = args[i + 1]
+
+      var isBool = no ||
+        types[arg] === Boolean ||
+        Array.isArray(types[arg]) && types[arg].indexOf(Boolean) !== -1 ||
+        (la === "false" &&
+         (types[arg] === null ||
+          Array.isArray(types[arg]) && ~types[arg].indexOf(null)))
+
+      if (isBool) {
+        // just set and move along
+        val = !no
+        // however, also support --bool true or --bool false
+        if (la === "true" || la === "false") {
+          val = JSON.parse(la)
+          la = null
+          if (no) val = !val
+          i ++
+        }
+
+        // also support "foo":[Boolean, "bar"] and "--foo bar"
+        if (Array.isArray(types[arg]) && la) {
+          if (~types[arg].indexOf(la)) {
+            // an explicit type
+            val = la
+            i ++
+          } else if ( la === "null" && ~types[arg].indexOf(null) ) {
+            // null allowed
+            val = null
+            i ++
+          } else if ( !la.match(/^-{2,}[^-]/) &&
+                      !isNaN(la) &&
+                      ~types[arg].indexOf(Number) ) {
+            // number
+            val = +la
+            i ++
+          } else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) {
+            // string
+            val = la
+            i ++
+          }
+        }
+
+        if (isArray) (data[arg] = data[arg] || []).push(val)
+        else data[arg] = val
+
+        continue
+      }
+
+      if (la && la.match(/^-{2,}$/)) {
+        la = undefined
+        i --
+      }
+
+      val = la === undefined ? true : la
+      if (isArray) (data[arg] = data[arg] || []).push(val)
+      else data[arg] = val
+
+      i ++
+      continue
+    }
+    remain.push(arg)
+  }
+}
+
+function resolveShort (arg, shorthands, shortAbbr, abbrevs) {
+  // handle single-char shorthands glommed together, like
+  // npm ls -glp, but only if there is one dash, and only if
+  // all of the chars are single-char shorthands, and it's
+  // not a match to some other abbrev.
+  arg = arg.replace(/^-+/, '')
+  if (abbrevs[arg] && !shorthands[arg]) {
+    return null
+  }
+  if (shortAbbr[arg]) {
+    arg = shortAbbr[arg]
+  } else {
+    var singles = shorthands.___singles
+    if (!singles) {
+      singles = Object.keys(shorthands).filter(function (s) {
+        return s.length === 1
+      }).reduce(function (l,r) { l[r] = true ; return l }, {})
+      shorthands.___singles = singles
+    }
+    var chrs = arg.split("").filter(function (c) {
+      return singles[c]
+    })
+    if (chrs.join("") === arg) return chrs.map(function (c) {
+      return shorthands[c]
+    }).reduce(function (l, r) {
+      return l.concat(r)
+    }, [])
+  }
+
+  if (shorthands[arg] && !Array.isArray(shorthands[arg])) {
+    shorthands[arg] = shorthands[arg].split(/\s+/)
+  }
+  return shorthands[arg]
+}
+
+if (module === require.main) {
+var assert = require("assert")
+  , util = require("util")
+
+  , shorthands =
+    { s : ["--loglevel", "silent"]
+    , d : ["--loglevel", "info"]
+    , dd : ["--loglevel", "verbose"]
+    , ddd : ["--loglevel", "silly"]
+    , noreg : ["--no-registry"]
+    , reg : ["--registry"]
+    , "no-reg" : ["--no-registry"]
+    , silent : ["--loglevel", "silent"]
+    , verbose : ["--loglevel", "verbose"]
+    , h : ["--usage"]
+    , H : ["--usage"]
+    , "?" : ["--usage"]
+    , help : ["--usage"]
+    , v : ["--version"]
+    , f : ["--force"]
+    , desc : ["--description"]
+    , "no-desc" : ["--no-description"]
+    , "local" : ["--no-global"]
+    , l : ["--long"]
+    , p : ["--parseable"]
+    , porcelain : ["--parseable"]
+    , g : ["--global"]
+    }
+
+  , types =
+    { aoa: Array
+    , nullstream: [null, Stream]
+    , date: Date
+    , str: String
+    , browser : String
+    , cache : path
+    , color : ["always", Boolean]
+    , depth : Number
+    , description : Boolean
+    , dev : Boolean
+    , editor : path
+    , force : Boolean
+    , global : Boolean
+    , globalconfig : path
+    , group : [String, Number]
+    , gzipbin : String
+    , logfd : [Number, Stream]
+    , loglevel : ["silent","win","error","warn","info","verbose","silly"]
+    , long : Boolean
+    , "node-version" : [false, String]
+    , npaturl : url
+    , npat : Boolean
+    , "onload-script" : [false, String]
+    , outfd : [Number, Stream]
+    , parseable : Boolean
+    , pre: Boolean
+    , prefix: path
+    , proxy : url
+    , "rebuild-bundle" : Boolean
+    , registry : url
+    , searchopts : String
+    , searchexclude: [null, String]
+    , shell : path
+    , t: [Array, String]
+    , tag : String
+    , tar : String
+    , tmp : path
+    , "unsafe-perm" : Boolean
+    , usage : Boolean
+    , user : String
+    , username : String
+    , userconfig : path
+    , version : Boolean
+    , viewer: path
+    , _exit : Boolean
+    }
+
+; [["-v", {version:true}, []]
+  ,["---v", {version:true}, []]
+  ,["ls -s --no-reg connect -d",
+    {loglevel:"info",registry:null},["ls","connect"]]
+  ,["ls ---s foo",{loglevel:"silent"},["ls","foo"]]
+  ,["ls --registry blargle", {}, ["ls"]]
+  ,["--no-registry", {registry:null}, []]
+  ,["--no-color true", {color:false}, []]
+  ,["--no-color false", {color:true}, []]
+  ,["--no-color", {color:false}, []]
+  ,["--color false", {color:false}, []]
+  ,["--color --logfd 7", {logfd:7,color:true}, []]
+  ,["--color=true", {color:true}, []]
+  ,["--logfd=10", {logfd:10}, []]
+  ,["--tmp=/tmp -tar=gtar",{tmp:"/tmp",tar:"gtar"},[]]
+  ,["--tmp=tmp -tar=gtar",
+    {tmp:path.resolve(process.cwd(), "tmp"),tar:"gtar"},[]]
+  ,["--logfd x", {}, []]
+  ,["a -true -- -no-false", {true:true},["a","-no-false"]]
+  ,["a -no-false", {false:false},["a"]]
+  ,["a -no-no-true", {true:true}, ["a"]]
+  ,["a -no-no-no-false", {false:false}, ["a"]]
+  ,["---NO-no-No-no-no-no-nO-no-no"+
+    "-No-no-no-no-no-no-no-no-no"+
+    "-no-no-no-no-NO-NO-no-no-no-no-no-no"+
+    "-no-body-can-do-the-boogaloo-like-I-do"
+   ,{"body-can-do-the-boogaloo-like-I-do":false}, []]
+  ,["we are -no-strangers-to-love "+
+    "--you-know the-rules --and so-do-i "+
+    "---im-thinking-of=a-full-commitment "+
+    "--no-you-would-get-this-from-any-other-guy "+
+    "--no-gonna-give-you-up "+
+    "-no-gonna-let-you-down=true "+
+    "--no-no-gonna-run-around false "+
+    "--desert-you=false "+
+    "--make-you-cry false "+
+    "--no-tell-a-lie "+
+    "--no-no-and-hurt-you false"
+   ,{"strangers-to-love":false
+    ,"you-know":"the-rules"
+    ,"and":"so-do-i"
+    ,"you-would-get-this-from-any-other-guy":false
+    ,"gonna-give-you-up":false
+    ,"gonna-let-you-down":false
+    ,"gonna-run-around":false
+    ,"desert-you":false
+    ,"make-you-cry":false
+    ,"tell-a-lie":false
+    ,"and-hurt-you":false
+    },["we", "are"]]
+  ,["-t one -t two -t three"
+   ,{t: ["one", "two", "three"]}
+   ,[]]
+  ,["-t one -t null -t three four five null"
+   ,{t: ["one", "null", "three"]}
+   ,["four", "five", "null"]]
+  ,["-t foo"
+   ,{t:["foo"]}
+   ,[]]
+  ,["--no-t"
+   ,{t:["false"]}
+   ,[]]
+  ,["-no-no-t"
+   ,{t:["true"]}
+   ,[]]
+  ,["-aoa one -aoa null -aoa 100"
+   ,{aoa:["one", null, 100]}
+   ,[]]
+  ,["-str 100"
+   ,{str:"100"}
+   ,[]]
+  ,["--color always"
+   ,{color:"always"}
+   ,[]]
+  ,["--no-nullstream"
+   ,{nullstream:null}
+   ,[]]
+  ,["--nullstream false"
+   ,{nullstream:null}
+   ,[]]
+  ,["--notadate 2011-01-25"
+   ,{notadate: "2011-01-25"}
+   ,[]]
+  ,["--date 2011-01-25"
+   ,{date: new Date("2011-01-25")}
+   ,[]]
+  ].forEach(function (test) {
+    var argv = test[0].split(/\s+/)
+      , opts = test[1]
+      , rem = test[2]
+      , actual = nopt(types, shorthands, argv, 0)
+      , parsed = actual.argv
+    delete actual.argv
+    console.log(util.inspect(actual, false, 2, true), parsed.remain)
+    for (var i in opts) {
+      var e = JSON.stringify(opts[i])
+        , a = JSON.stringify(actual[i] === undefined ? null : actual[i])
+      if (e && typeof e === "object") {
+        assert.deepEqual(e, a)
+      } else {
+        assert.equal(e, a)
+      }
+    }
+    assert.deepEqual(rem, parsed.remain)
+  })
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/node_modules/nopt/package.json
new file mode 100755 (executable)
index 0000000..17a1faa
--- /dev/null
@@ -0,0 +1,60 @@
+{
+  "name": "nopt",
+  "version": "1.0.10",
+  "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me/"
+  },
+  "main": "lib/nopt.js",
+  "scripts": {
+    "test": "node lib/nopt.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/nopt.git"
+  },
+  "bin": {
+    "nopt": "./bin/nopt.js"
+  },
+  "license": {
+    "type": "MIT",
+    "url": "https://github.com/isaacs/nopt/raw/master/LICENSE"
+  },
+  "dependencies": {
+    "abbrev": "1"
+  },
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "_id": "nopt@1.0.10",
+  "devDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_engineSupported": true,
+  "_npmVersion": "1.0.93",
+  "_nodeVersion": "v0.5.9-pre",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "6ddd21bd2a31417b92727dd585f8a6f37608ebee",
+    "tarball": "http://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "directories": {},
+  "_shasum": "6ddd21bd2a31417b92727dd585f8a6f37608ebee",
+  "_from": "nopt@~1.0.10",
+  "_resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
+  "bugs": {
+    "url": "https://github.com/isaacs/nopt/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/isaacs/nopt"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/package.json
new file mode 100755 (executable)
index 0000000..622ad4d
--- /dev/null
@@ -0,0 +1,47 @@
+{
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me/"
+  },
+  "name": "touch",
+  "description": "like touch(1) in node",
+  "version": "0.0.3",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/node-touch.git"
+  },
+  "main": "touch.js",
+  "engines": {
+    "node": ">=0.6"
+  },
+  "dependencies": {
+    "nopt": "~1.0.10"
+  },
+  "license": "ISC",
+  "bugs": {
+    "url": "https://github.com/isaacs/node-touch/issues"
+  },
+  "homepage": "https://github.com/isaacs/node-touch",
+  "_id": "touch@0.0.3",
+  "dist": {
+    "shasum": "51aef3d449571d4f287a5d87c9c8b49181a0db1d",
+    "tarball": "http://registry.npmjs.org/touch/-/touch-0.0.3.tgz"
+  },
+  "_from": "touch@0.0.3",
+  "_npmVersion": "1.3.25",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "directories": {},
+  "_shasum": "51aef3d449571d4f287a5d87c9c8b49181a0db1d",
+  "_resolved": "https://registry.npmjs.org/touch/-/touch-0.0.3.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/test/sanity.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/test/sanity.js
new file mode 100755 (executable)
index 0000000..d7d8a9b
--- /dev/null
@@ -0,0 +1,31 @@
+var fs = require("fs")
+var touch = require("../touch.js")
+
+function _ (fn) { return function (er) {
+  if (er) throw er
+  fn()
+}}
+
+touch.sync("sync")
+touch("async", _(function () {
+  console.log("async", fs.statSync("async"))
+  console.log("sync", fs.statSync("sync"))
+
+  setTimeout(function () {
+    touch.sync("sync")
+    touch("async", _(function () {
+      console.log("async", fs.statSync("async"))
+      console.log("sync", fs.statSync("sync"))
+      setTimeout(function () {
+        touch.sync("sync")
+        touch("async", _(function () {
+          console.log("async", fs.statSync("async"))
+          console.log("sync", fs.statSync("sync"))
+          fs.unlinkSync("sync")
+          fs.unlinkSync("async")
+        }))
+      }, 1000)
+    }))
+  }, 1000)
+}))
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/touch.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/node_modules/touch/touch.js
new file mode 100755 (executable)
index 0000000..e2bb3ec
--- /dev/null
@@ -0,0 +1,154 @@
+var fs = require("fs")
+  , cons = require("constants")
+
+module.exports = touch
+touch.touchSync = touch.sync = function (f, options) {
+  return touch(f, options)
+}
+
+touch.ftouch = ftouch
+touch.ftouchSync = function (fd, options) {
+  return ftouch(fd, options)
+}
+
+function validOpts (options) {
+  options = Object.create(options || {})
+
+  // {mtime: true}, {ctime: true}
+  // If set to something else, then treat as epoch ms value
+  var now = new Date(options.time || Date.now())
+  if (!options.atime && !options.mtime) {
+    options.atime = options.mtime = now
+  } else if (true === options.atime) {
+    options.atime = now
+  } else if (true === options.mtime) {
+    options.mtime = now
+  }
+
+  var oflags = 0
+  if (!options.force) {
+    oflags = oflags | cons.O_RDWR
+  }
+  if (!options.nocreate) {
+    oflags = oflags | cons.O_CREAT
+  }
+
+  options.oflags = oflags
+  return options
+}
+
+function optionsRef (then, arg, options, cb) {
+  if (!options.ref) return then(arg, options, cb)
+
+  return cb
+       ? fs.stat(options.ref, optionsRefcb(then, arg, options, cb))
+       : optionsRefcb(then, arg, options)(null, fs.statSync(options.ref))
+}
+
+function optionsRefcb (then, arg, options, cb) { return function (er, s) {
+  if (er) {
+    er.path = er.file = options.ref
+    return cb(er)
+  }
+  options.atime = options.atime && s.atime.getTime()
+  options.mtime = options.mtime && s.mtime.getTime()
+
+  // so we don't keep doing this.
+  options.ref = null
+
+  return then(arg, options, cb)
+}}
+
+function touch (f, options, cb) {
+  if (typeof options === "function") cb = options, options = null
+  options = validOpts(options)
+  return optionsRef(touch_, f, validOpts(options), cb)
+}
+
+function touch_ (f, options, cb) {
+  return openThenF(f, options, cb)
+}
+
+function openThenF (f, options, cb) {
+  options.closeAfter = true
+  return cb
+       ? fs.open(f, options.oflags, openThenFcb(options, cb))
+       : openThenFcb(options)(null, fs.openSync(f, options.oflags))
+}
+
+function openThenFcb (options, cb) { return function (er, fd) {
+  if (er) {
+    if (fd && options.closeAfter) fs.close(fd, function () {})
+    return cb(er)
+  }
+  return ftouch(fd, options, cb)
+}}
+
+function ftouch (fd, options, cb) {
+  if (typeof options === "function") cb = options, options = null
+  return optionsRef(ftouch_, fd, validOpts(options), cb)
+}
+
+function ftouch_ (fd, options, cb) {
+  // still not set.  leave as what the file already has.
+  return fstatThenFutimes(fd, options, cb)
+}
+
+function fstatThenFutimes (fd, options, cb) {
+  if (options.atime && options.mtime) return thenFutimes(fd, options, cb)
+
+  return cb
+       ? fs.fstat(fd, fstatThenFutimescb(fd, options, cb))
+       : fstatThenFutimescb(fd, options)(null, fs.fstatSync(fd))
+}
+
+function fstatThenFutimescb (fd, options, cb) { return function (er, s) {
+  if (er) {
+    if (options.closeAfter) fs.close(fd, function () {})
+    return cb(er)
+  }
+  options.atime = options.atime || s.atime.getTime()
+  options.mtime = options.mtime || s.mtime.getTime()
+  return thenFutimes(fd, options, cb)
+}}
+
+function thenFutimes (fd, options, cb) {
+  if (typeof options.atime === "object") {
+    options.atime = options.atime.getTime()
+  }
+  if (typeof options.mtime === "object") {
+    options.mtime = options.mtime.getTime()
+  }
+
+  var a = parseInt(options.atime / 1000, 10)
+    , m = parseInt(options.mtime / 1000, 10)
+  return cb
+       ? fs.futimes(fd, a, m, thenFutimescb(fd, options, cb))
+       : thenFutimescb(fd, options)(null, fs.futimesSync(fd, a, m))
+}
+
+function thenFutimescb (fd, options, cb) { return function (er, res) {
+  if (er) {
+    if (options.closeAfter) fs.close(fd, function () {})
+    return cb(er)
+  }
+  return finish(fd, options, res, cb)
+}}
+
+function finish (fd, options, res, cb) {
+  return options.closeAfter ? finishClose(fd, options, res, cb)
+       : cb ? cb(null, res)
+       : res
+}
+
+function finishClose (fd, options, res, cb) {
+  return cb
+       ? fs.close(fd, finishClosecb(res, options, cb))
+       : finishClosecb(res, options)(null, fs.closeSync(fd))
+}
+
+function finishClosecb (res, options, cb) { return function (er) {
+  if (er) return cb(er)
+  options.closeAfter = null
+  return finish(null, options, res, cb)
+}}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/package.json
new file mode 100755 (executable)
index 0000000..92a8024
--- /dev/null
@@ -0,0 +1,105 @@
+{
+  "name": "decompress-zip",
+  "version": "0.1.0",
+  "description": "Extract files from a ZIP archive",
+  "main": "lib/decompress-zip.js",
+  "scripts": {
+    "test": "grunt test"
+  },
+  "bin": {
+    "decompress-zip": "bin/decompress-zip"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/bower/decompress-zip.git"
+  },
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "keywords": [
+    "zip",
+    "unzip",
+    "tar",
+    "untar",
+    "compress",
+    "decompress",
+    "archive",
+    "extract",
+    "zlib"
+  ],
+  "author": {
+    "name": "Bower team"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://github.com/bower/bower/blob/master/LICENSE"
+    }
+  ],
+  "dependencies": {
+    "binary": "^0.3.0",
+    "graceful-fs": "^3.0.0",
+    "mkpath": "^0.1.0",
+    "nopt": "^3.0.1",
+    "q": "^1.1.2",
+    "readable-stream": "^1.1.8",
+    "touch": "0.0.3"
+  },
+  "devDependencies": {
+    "chai": "^1.10.0",
+    "glob": "^4.3.2",
+    "grunt": "^0.4.1",
+    "grunt-cli": "^0.1.13",
+    "grunt-contrib-jshint": "^0.10.0",
+    "grunt-contrib-watch": "^0.6.1",
+    "grunt-exec": "^0.4.2",
+    "grunt-simple-mocha": "^0.4.0",
+    "istanbul": "^0.3.5",
+    "mocha": "^2.1.0",
+    "request": "^2.51.0",
+    "tmp": "0.0.24"
+  },
+  "gitHead": "2280a68c81f0b9b5c159fa16988c891ff4bd2984",
+  "bugs": {
+    "url": "https://github.com/bower/decompress-zip/issues"
+  },
+  "homepage": "https://github.com/bower/decompress-zip",
+  "_id": "decompress-zip@0.1.0",
+  "_shasum": "bce60c11664f2d660fca4bcf634af6de5d6c14c7",
+  "_from": "decompress-zip@0.1.0",
+  "_npmVersion": "2.1.16",
+  "_nodeVersion": "0.10.32",
+  "_npmUser": {
+    "name": "sindresorhus",
+    "email": "sindresorhus@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "wibblymat",
+      "email": "mat@wibbly.org.uk"
+    },
+    {
+      "name": "paulirish",
+      "email": "paul.irish@gmail.com"
+    },
+    {
+      "name": "sheerun",
+      "email": "sheerun@sher.pl"
+    },
+    {
+      "name": "sindresorhus",
+      "email": "sindresorhus@gmail.com"
+    },
+    {
+      "name": "satazor",
+      "email": "andremiguelcruz@msn.com"
+    }
+  ],
+  "dist": {
+    "shasum": "bce60c11664f2d660fca4bcf634af6de5d6c14c7",
+    "tarball": "http://registry.npmjs.org/decompress-zip/-/decompress-zip-0.1.0.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/decompress-zip/-/decompress-zip-0.1.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/test/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/node_modules/decompress-zip/test/test.js
new file mode 100755 (executable)
index 0000000..03c6d47
--- /dev/null
@@ -0,0 +1,181 @@
+'use strict';
+var path = require('path');
+var exec = require('child_process').exec;
+var glob = require('glob');
+var assert = require('chai').assert;
+var tmp = require('tmp');
+var assetsPath = path.join(__dirname, 'assets');
+var DecompressZip = require('../lib/decompress-zip');
+
+var samples = glob.sync('*/archive.zip', {cwd: assetsPath});
+
+if (samples.length === 0) {
+    console.log('No sample ZIP files were found. Run "grunt test-files" to download them.');
+    process.exit(1);
+}
+
+describe('Smoke test', function () {
+    it('should find the public interface', function () {
+        assert.isFunction(DecompressZip, 'constructor is a function');
+        assert.isFunction(DecompressZip.prototype.list, 'decompress.list is a function');
+        assert.isFunction(DecompressZip.prototype.extract, 'decompress.extract is a function');
+    });
+});
+
+describe('Extract', function () {
+    describe('errors', function () {
+        var tmpDir;
+
+        before(function (done) {
+            tmp.dir({unsafeCleanup: true}, function (err, dir) {
+                if (err) {
+                    throw err;
+                }
+
+                tmpDir = dir;
+                done();
+            });
+        });
+
+        it('should emit an error when the file does not exist', function (done) {
+            var zip = new DecompressZip('/my/non/existant/file.zip');
+
+            zip.on('extract', function () {
+                assert(false, '"extract" event should not fire');
+                done();
+            });
+
+            zip.on('error', function (error) {
+                assert(true, '"error" event should fire');
+                done();
+            });
+
+            zip.extract({path: tmpDir});
+        });
+
+        it('should emit an error when stripping deeper than the path structure', function (done) {
+            var zip = new DecompressZip(path.join(assetsPath, samples[0]));
+
+            zip.on('extract', function () {
+                assert(false, '"extract" event should not fire');
+                done();
+            });
+
+            zip.on('error', function (error) {
+                assert(true, '"error" event should fire');
+                done();
+            });
+
+            zip.extract({path: tmpDir, strip: 3});
+        });
+
+        it('should emit a progress event on each file', function (done) {
+            var zip = new DecompressZip(path.join(assetsPath, samples[0]));
+            var numProgressEvents = 0;
+            var numTotalFiles = 921;
+
+            zip.on('progress', function (i, numFiles) {
+                assert.equal(numFiles, numTotalFiles, '"progress" event should include the correct number of files');
+                assert(typeof i === 'number', '"progress" event should include the number of the current file');
+                numProgressEvents++;
+            });
+
+            zip.on('extract', function () {
+                assert(true, '"extract" event should fire');
+                assert.equal(numProgressEvents, numTotalFiles, 'there should be a "progress" event for every file');
+                done();
+            });
+
+            zip.on('error', function (error) {
+                assert(false, '"error" event should not fire');
+                done();
+            });
+
+            zip.extract({path: tmpDir});
+        });
+    });
+
+    describe('directory creation', function () {
+        var tmpDir;
+        var rmdirSync;
+        before(function (done) {
+            tmp.dir({unsafeCleanup: true}, function (err, dir, cleanupCallback) {
+                if (err) {
+                    throw err;
+                }
+
+                tmpDir = dir;
+                rmdirSync = cleanupCallback;
+                done();
+            });
+        });
+
+        it('should create necessary directories, even on 2nd run', function (done) {
+            var zip = new DecompressZip(path.join(assetsPath, samples[0]));
+            zip.on('error', done);
+            zip.on('extract', function () {
+                rmdirSync(tmpDir);
+                var zip2 = new DecompressZip(path.join(assetsPath, samples[0]));
+                zip2.on('error', done);
+                zip2.on('extract', function () {
+                    done();
+                });
+                zip2.extract({path: tmpDir});
+            });
+
+            zip.extract({path: tmpDir});
+        });
+    });
+
+    samples.forEach(function (sample) {
+        var extracted = path.join(path.dirname(sample), 'extracted');
+
+        describe(sample, function () {
+            var tmpDir;
+
+            before(function (done) {
+                tmp.dir({unsafeCleanup: true}, function (err, dir) {
+                    if (err) {
+                        throw err;
+                    }
+
+                    tmpDir = dir;
+                    done();
+                });
+            });
+
+
+            it('should extract without any errors', function (done) {
+                this.timeout(60000);
+                var zip = new DecompressZip(path.join(assetsPath, sample));
+
+                zip.on('extract', function () {
+                    assert(true, 'success callback should be called');
+                    done();
+                });
+
+                zip.on('error', function () {
+                    assert(false, 'error callback should not be called');
+                    done();
+                });
+
+                zip.extract({path: tmpDir});
+            });
+
+            it('should have the same output files as expected', function (done) {
+                exec('diff -qr ' + extracted + ' ' + tmpDir, {cwd: assetsPath}, function (err, stdout, stderr) {
+                    if (err) {
+                        if (err.code === 1) {
+                            assert(false, 'output should match');
+                        } else {
+                            throw err;
+                        }
+                    }
+                    assert.equal(stdout, '');
+                    assert.equal(stderr, '');
+                    done();
+                });
+            });
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/package.json
new file mode 100755 (executable)
index 0000000..fd45816
--- /dev/null
@@ -0,0 +1,62 @@
+{
+  "name": "ngrok",
+  "version": "0.1.99",
+  "description": "node wrapper for ngrok",
+  "main": "index.js",
+  "scripts": {
+    "test": "node ./node_modules/mocha/bin/_mocha",
+    "postinstall": "node ./postinstall.js",
+    "postupdate": "node ./postinstall.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/bubenshchykov/ngrok.git"
+  },
+  "keywords": [
+    "ngrok",
+    "localhost",
+    "tunneling",
+    "localtunnel",
+    "webhook"
+  ],
+  "author": {
+    "name": "bubenshchykov"
+  },
+  "license": "BSD-2-Clause",
+  "bugs": {
+    "url": "https://github.com/bubenshchykov/ngrok/issues"
+  },
+  "devDependencies": {
+    "mocha": "~1.14.0",
+    "chai": "~1.8.1",
+    "request": "~2.27.0"
+  },
+  "dependencies": {
+    "decompress-zip": "0.1.0"
+  },
+  "bin": {
+    "ngrok": "./bin/ngrok"
+  },
+  "homepage": "https://github.com/bubenshchykov/ngrok",
+  "_id": "ngrok@0.1.99",
+  "dist": {
+    "shasum": "b9fd7007bb4968a23fa90e0ea53e38fecab96435",
+    "tarball": "http://registry.npmjs.org/ngrok/-/ngrok-0.1.99.tgz"
+  },
+  "_from": "ngrok@^0.1.99",
+  "_npmVersion": "1.4.3",
+  "_npmUser": {
+    "name": "bubenshchykov",
+    "email": "a.bubenshchykov@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "bubenshchykov",
+      "email": "a.bubenshchykov@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "b9fd7007bb4968a23fa90e0ea53e38fecab96435",
+  "_resolved": "https://registry.npmjs.org/ngrok/-/ngrok-0.1.99.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/postinstall.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/postinstall.js
new file mode 100755 (executable)
index 0000000..6442ec1
--- /dev/null
@@ -0,0 +1,63 @@
+console.error('ngrok - downloading newest binary...');
+
+var os = require('os');
+var fs = require('fs');
+var util = require('util');
+var https = require('https');
+var DecompressZip = require('decompress-zip');
+
+var source = 'https://api.equinox.io/1/Applications/ap_pJSFC5wQYkAyI0FIVwKYs9h1hW/Updates/Asset/ngrok.zip?channel=stable&';
+var files = {
+       darwinia32:     source + 'os=darwin&arch=386',
+       darwinx64:      source + 'os=darwin&arch=amd64',
+       linuxarm:       source + 'os=linux&arch=arm',
+       linuxia32:      source + 'os=linux&arch=386',
+       linuxx64:       source + 'os=linux&arch=amd64',
+       win32ia32:      source + 'os=windows&arch=386',
+       win32x64:       source + 'os=windows&arch=amd64',
+       freebsdia32:    source + 'os=freebsd&arch=386',
+       freebsdx64:     source + 'os=freebsd&arch=amd64'
+};
+
+var path = __dirname + '/bin/';
+if (!fs.existsSync(path)) {
+       fs.mkdirSync(path);
+}
+
+var which = os.platform() + os.arch();
+https.get(files[which], function(resp) {
+       var zip = fs.createWriteStream(path + 'ngrok.zip');
+       resp.pipe(zip)
+               .on('finish', function() {
+                       console.log('ngrok - binary downloaded (' + files[which] + ')...');
+                       unzipFile(path + 'ngrok.zip');
+               })
+               .on('error', function(e) {
+                       console.error('ngrok - error downloading binary', e);
+                       process.exit(1);
+               });
+});
+
+function unzipFile(file) {
+       new DecompressZip(file)
+               .extract({path: path})
+               .once('error', function(e) {
+                       console.error('ngrok - error unpacking binary', e);
+                       process.exit(1);     
+               })
+               .once('extract', function(log) {
+                       var suffix = os.platform() === 'win32' ? '.exe' : '';
+                       if (suffix === '.exe') {
+                               fs.writeFileSync(path + 'ngrok.cmd', 'ngrok.exe');
+                       }
+                       fs.unlinkSync(path + 'ngrok.zip');
+                       var target = path + 'ngrok' + suffix;
+                       fs.chmodSync(target, 0755);
+                       if (fs.existsSync(target) && fs.statSync(target).size > 0) {
+                               console.log('ngrok - binary unpacked.');
+                               process.exit(0);
+                       }
+                       console.error('ngrok - error unpacking binary.');
+                       process.exit(1);
+               });
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/chai.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/chai.js
new file mode 100755 (executable)
index 0000000..bec9994
--- /dev/null
@@ -0,0 +1,3 @@
+var chai = require('chai');
+global.expect = chai.expect;
+chai.Assertion.includeStack = true;
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/mocha.opts b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/mocha.opts
new file mode 100755 (executable)
index 0000000..6a35e95
--- /dev/null
@@ -0,0 +1,7 @@
+--require ./test/chai.js
+--reporter spec
+--ui bdd
+--recursive
+--colors
+--timeout 10000
+--slow 100
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/ngrok.eventemitter.spec.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/ngrok.eventemitter.spec.js
new file mode 100755 (executable)
index 0000000..9fa6ada
--- /dev/null
@@ -0,0 +1,58 @@
+var ngrok = require('..');
+var port = 8080;
+var authtoken = '9qh-WUj4noglhhjqe_-Q';
+ngrok.disconnect();
+
+
+describe('using ngrok as event emitter', function ( ) {
+
+       describe('connecting to ngrok', function ( ) {
+               var connected, tunnelUrl;
+               before(function(done) {
+                       ngrok.once('connect', function (url) {
+                               connected = true;
+                               tunnelUrl = url;
+                               done();
+                       });
+                       ngrok.connect(port);
+               });
+
+               it('should fire "connect" event', function ( ) {
+                       expect(connected).to.be.true;
+               });
+
+               it('should pass tunnel url with a "connect" event', function ( ) {
+                       expect(tunnelUrl).to.match(/https:\/\/.(.*).ngrok.com/);
+               });
+       });
+
+       describe('disconnecting from ngrok', function ( ) {
+               var disconnected;
+               before(function(done){
+                       ngrok.once('disconnect', function ( ) {
+                               disconnected = true;
+                               done();
+                       });     
+                       ngrok.disconnect();
+               });
+               it('should fire "disconnect" event', function ( ) {
+                       expect(disconnected).to.be.true;
+               });
+       });
+
+       describe('connecting to ngrok with error', function(){
+               var error;
+               before(function(done){
+                       ngrok.once('error', function ( err ) {
+                               error = err;
+                               done();
+                       });     
+                       ngrok.connect({});
+               });
+
+               it('should fire error event', function(){
+                       expect(error).to.be.instanceof.Error;
+               });
+       });
+
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/ngrok.spec.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/ngrok/test/ngrok.spec.js
new file mode 100755 (executable)
index 0000000..a7050b5
--- /dev/null
@@ -0,0 +1,273 @@
+var ngrok = require('..');
+var http = require('http');
+var net = require('net');
+var request = require('request');
+var URL = require('url');
+
+var port = 8080;
+var authtoken = '9qh-WUj4noglhhjqe_-Q';
+var localUrl = 'http://localhost:' + port;
+var tunnelUrl, respBody;
+
+describe('starting local http server', function() {
+
+       before(function() {
+               http.createServer(function (req, res) {
+                       res.writeHead(200);
+                       res.end('oki-doki: ' + req.url);
+               }).listen(port);
+       });
+
+       describe('calling local server directly', function() {
+               
+               before(function(done) {
+                       request.get(localUrl + '/local', function (err, resp, body) {
+                               respBody = body;
+                               done(err);
+                       });
+               });
+
+               it('should return oki-doki', function() {
+                       expect(respBody).to.equal('oki-doki: /local');
+               });
+
+               describe('connecting to ngrok with port specified', function () {
+
+                       before(function (done) {
+                               ngrok.connect(port, function(err, url){
+                                       tunnelUrl = url;
+                                       done(err);
+                               });
+                       });
+
+                       it('should return url pointing to ngrok domain', function(){
+                               expect(tunnelUrl).to.match(/https:\/\/.(.*).ngrok.com/);
+                       });
+
+                       describe('calling local server through ngrok', function() {
+
+                               before(function(done) {
+                                       request.get(tunnelUrl + '/ngrok', function (err, resp, body) {
+                                               respBody = body;
+                                               done(err);
+                                       });
+                               });
+
+                               it('should return oki-doki too', function() {
+                                       expect(respBody).to.equal('oki-doki: /ngrok');
+                               });
+
+                               describe('disconnecting from ngrok', function () {
+
+                                       before(function(done) {
+                                               ngrok.disconnect(done);
+                                       });
+
+                                       describe('calling local server through discconected ngrok', function() {
+
+                                               before(function(done) {
+                                                       request.get(tunnelUrl + '/ngrok', function (err, resp, body) {
+                                                               respBody = body;
+                                                               done(err);
+                                                       });
+                                               });
+
+                                               it('should return error message', function() {
+                                                       expect(respBody).to.match(/Tunnel (.)* not found/);
+                                               });
+
+                                       });
+
+                               });
+
+                       });
+               });
+
+               describe('connecting to ngrok with authtoken and subdomain', function () {
+                       var uniqDomain = 'koko-' + Math.random().toString(36).slice(-4); 
+                       
+                       before(function (done) {
+                               ngrok.connect({
+                                       port: port,
+                                       authtoken: authtoken,
+                                       subdomain: uniqDomain
+                               }, function(err, url){
+                                       tunnelUrl = url;
+                                       done(err);
+                               });
+                       });
+
+                       it('should return ngrok url with a given subdomain', function(){
+                               expect(tunnelUrl).to.equal('https://' + uniqDomain + '.ngrok.com');
+                       });
+
+                       describe('calling local server through ngrok', function() {
+
+                               before(function(done) {
+                                       request.get(tunnelUrl + '/ngrok-subdomain', function (err, resp, body) {
+                                               respBody = body;
+                                               done(err);
+                                       });
+                               });
+
+                               it('should return oki-doki too', function() {
+                                       expect(respBody).to.equal('oki-doki: /ngrok-subdomain');
+                               });
+
+                       });
+
+                       describe('connecting to ngrok with same subdomain again', function () {
+                               var error;
+
+                               before(function (done) {
+                                       ngrok.connect({
+                                               port: port,
+                                               authtoken: authtoken,
+                                               subdomain: uniqDomain
+                                       }, function(err, url){
+                                               error = err;
+                                               done();
+                                       });
+                               });
+
+                               it('should return an error that the tunnel is already established', function () {
+                                       expect(error)
+                                               .to.be.an.instanceof(Error)
+                                               .to.match(/ngrok: The tunnel (.*) is already registered/);
+                               });
+                       });
+
+                       describe('disconnecting from ngrok and connecting with same subdomain again', function () {
+                               var error;
+
+                               before(function(done) {
+                                       ngrok.disconnect(done);
+                               });
+
+                               before(function (done) {
+                                       ngrok.connect({
+                                               port: port,
+                                               authtoken: authtoken,
+                                               subdomain: uniqDomain
+                                       }, function(err, url){
+                                               error = err;
+                                               done();
+                                       });
+                               });
+
+                               it('should be able to connect and return the same ngrok url', function(){
+                                       expect(tunnelUrl).to.equal('https://' + uniqDomain + '.ngrok.com');
+                               });
+                       });
+               });
+
+               describe('connecting to ngrok with authtoken and httpauth', function () {
+                       
+                       before(function (done) {
+                               ngrok.connect({
+                                       port: port,
+                                       authtoken: authtoken,
+                                       httpauth: 'oki:doki'
+                               }, function(err, url){
+                                       tunnelUrl = url;
+                                       done(err);
+                               });
+                       });
+
+                       it('should return url pointing to ngrok domain', function(){
+                               expect(tunnelUrl).to.match(/https:\/\/.(.*).ngrok.com/);
+                       });
+
+                       describe('calling local server through ngrok without http authorization', function() {
+
+                               before(function(done) {
+                                       request.get(tunnelUrl + '/ngrok-httpauth', function (err, resp, body) {
+                                               respBody = body;
+                                               done(err);
+                                       });
+                               });
+
+                               it('should return error message', function() {
+                                       expect(respBody).to.contain('Authorization required');
+                               });
+
+                       });
+
+                       describe('calling local server through ngrok with http authorization', function() {
+
+                               before(function(done) {
+                                       request.get(tunnelUrl + '/ngrok-httpauth', {auth: {user: 'oki', password: 'doki'}}, function (err, resp, body) {
+                                               respBody = body;
+                                               done(err);
+                                       });
+                               });
+
+                               it('should return oki-doki too', function() {
+                                       expect(respBody).to.equal('oki-doki: /ngrok-httpauth');
+                               });
+
+                       });
+               });
+
+       });
+});
+
+describe('starting local tcp server', function () {
+               
+       var tcpServer;
+       var tcpServerPort;
+       before(function(done) {
+               tcpServer = net.createServer(function(socket) {
+                       socket.end('oki-doki: tcp');
+               });
+               // bind to some new port
+               tcpServer.listen(0, function() {
+                       tcpServerPort = tcpServer.address().port;
+                       done();
+               });
+       });
+
+       describe('connecting to ngrok by tcp', function() {
+               var tunnelUrlParts;
+               before(function (done) {
+                       ngrok.connect({
+                               proto: 'tcp',
+                               port: tcpServerPort,
+                               authtoken: authtoken,
+                       }, function(err, url){
+                               tunnelUrl = url;
+                               tunnelUrlParts = URL.parse(tunnelUrl);
+                               done(err);
+                       });
+               });
+
+               it('should return ngrok url with tcp protocol', function() {
+                       expect(tunnelUrlParts.protocol).to.equal('tcp:');
+               });
+
+               it('should return ngrok url with a port', function() {
+                       expect(tunnelUrlParts.port).to.be.ok;
+               });
+
+               describe('calling local tcp server through ngrok', function() {
+                       var socketData;
+                       var socket;
+                       before(function(done) {
+                               var socket = net.connect(
+                                       tunnelUrlParts.port,
+                                       tunnelUrlParts.hostname,
+                                       function() {
+                                               socket.once('data', function(data) {
+                                                       socketData = data.toString();
+                                                       done();
+                                               });
+                                       }
+                               );
+                       });
+
+                       it('should be able to connect through the tunnel', function() {
+                               expect(socketData).to.equal('oki-doki: tcp');
+                       });
+               });
+       })
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/LICENSE.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/LICENSE.md
new file mode 100755 (executable)
index 0000000..652609b
--- /dev/null
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c)  2010-2012 Robert Kieffer 
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/README.md
new file mode 100755 (executable)
index 0000000..b7d04c9
--- /dev/null
@@ -0,0 +1,243 @@
+# node-uuid
+
+Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.
+
+Features:
+
+* Generate RFC4122 version 1 or version 4 UUIDs
+* Runs in node.js and all browsers.
+* Registered as a [ComponentJS](https://github.com/component/component) [component](https://github.com/component/component/wiki/Components) ('broofa/node-uuid').
+* Cryptographically strong random # generation on supporting platforms
+* 1.1K minified and gzip'ed  (Want something smaller?  Check this [crazy shit](https://gist.github.com/982883) out! )
+* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)
+* Comes with a Command Line Interface for generating uuids on the command line
+
+## Getting Started
+
+Install it in your browser:
+
+```html
+<script src="uuid.js"></script>
+```
+
+Or in node.js:
+
+```
+npm install node-uuid
+```
+
+```javascript
+var uuid = require('node-uuid');
+```
+
+Then create some ids ...
+
+```javascript
+// Generate a v1 (time-based) id
+uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
+
+// Generate a v4 (random) id
+uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
+```
+
+## API
+
+### uuid.v1([`options` [, `buffer` [, `offset`]]])
+
+Generate and return a RFC4122 v1 (timestamp-based) UUID.
+
+* `options` - (Object) Optional uuid state to apply. Properties may include:
+
+  * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID.  See note 1.
+  * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence.  Default: An internally maintained clockseq is used.
+  * `msecs` - (Number | Date) Time in milliseconds since unix Epoch.  Default: The current time is used.
+  * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.
+
+* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
+* `offset` - (Number) Starting index in `buffer` at which to begin writing.
+
+Returns `buffer`, if specified, otherwise the string form of the UUID
+
+Notes:
+
+1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
+
+Example: Generate string UUID with fully-specified options
+
+```javascript
+uuid.v1({
+  node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
+  clockseq: 0x1234,
+  msecs: new Date('2011-11-01').getTime(),
+  nsecs: 5678
+});   // -> "710b962e-041c-11e1-9234-0123456789ab"
+```
+
+Example: In-place generation of two binary IDs
+
+```javascript
+// Generate two ids in an array
+var arr = new Array(32); // -> []
+uuid.v1(null, arr, 0);   // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
+uuid.v1(null, arr, 16);  // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
+
+// Optionally use uuid.unparse() to get stringify the ids
+uuid.unparse(buffer);    // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'
+uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'
+```
+
+### uuid.v4([`options` [, `buffer` [, `offset`]]])
+
+Generate and return a RFC4122 v4 UUID.
+
+* `options` - (Object) Optional uuid state to apply. Properties may include:
+
+  * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values
+  * `rng` - (Function) Random # generator to use.  Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values.
+
+* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
+* `offset` - (Number) Starting index in `buffer` at which to begin writing.
+
+Returns `buffer`, if specified, otherwise the string form of the UUID
+
+Example: Generate string UUID with fully-specified options
+
+```javascript
+uuid.v4({
+  random: [
+    0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
+    0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
+  ]
+});
+// -> "109156be-c4fb-41ea-b1b4-efe1671c5836"
+```
+
+Example: Generate two IDs in a single buffer
+
+```javascript
+var buffer = new Array(32); // (or 'new Buffer' in node.js)
+uuid.v4(null, buffer, 0);
+uuid.v4(null, buffer, 16);
+```
+
+### uuid.parse(id[, buffer[, offset]])
+### uuid.unparse(buffer[, offset])
+
+Parse and unparse UUIDs
+
+  * `id` - (String) UUID(-like) string
+  * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used
+  * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0
+
+Example parsing and unparsing a UUID string
+
+```javascript
+var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> <Buffer 79 7f f0 43 11 eb 11 e1 80 d6 51 09 98 75 5d 10>
+var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'
+```
+
+### uuid.noConflict()
+
+(Browsers only) Set `uuid` property back to it's previous value.
+
+Returns the node-uuid object.
+
+Example:
+
+```javascript
+var myUuid = uuid.noConflict();
+myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
+```
+
+## Deprecated APIs
+
+Support for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version.
+
+### uuid([format [, buffer [, offset]]])
+
+uuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary).
+
+### uuid.BufferClass
+
+The class of container created when generating binary uuid data if no buffer argument is specified.  This is expected to go away, with no replacement API.
+
+## Command Line Interface
+
+To use the executable, it's probably best to install this library globally.
+
+`npm install -g node-uuid`
+
+Usage:
+
+```
+USAGE: uuid [version] [options]
+
+
+options:
+
+--help                     Display this message and exit
+```
+
+`version` must be an RFC4122 version that is supported by this library, which is currently version 1 and version 4 (denoted by "v1" and "v4", respectively). `version` defaults to version 4 when not supplied.
+
+### Examples
+
+```
+> uuid
+3a91f950-dec8-4688-ba14-5b7bbfc7a563
+```
+
+```
+> uuid v1
+9d0b43e0-7696-11e3-964b-250efa37a98e
+```
+
+```
+> uuid v4
+6790ac7c-24ac-4f98-8464-42f6d98a53ae
+```
+
+## Testing
+
+In node.js
+
+```
+npm test
+```
+
+In Browser
+
+```
+open test/test.html
+```
+
+### Benchmarking
+
+Requires node.js
+
+```
+npm install uuid uuid-js
+node benchmark/benchmark.js
+```
+
+For a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark)
+
+For browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance).
+
+## Release notes
+
+### 1.4.0
+
+* Improved module context detection
+* Removed public RNG functions
+
+### 1.3.2
+
+* Improve tests and handling of v1() options (Issue #24)
+* Expose RNG option to allow for perf testing with different generators
+
+### 1.3.0
+
+* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
+* Support for node.js crypto API
+* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/README.md
new file mode 100755 (executable)
index 0000000..aaeb2ea
--- /dev/null
@@ -0,0 +1,53 @@
+# node-uuid Benchmarks
+
+### Results
+
+To see the results of our benchmarks visit https://github.com/broofa/node-uuid/wiki/Benchmark
+
+### Run them yourself
+
+node-uuid comes with some benchmarks to measure performance of generating UUIDs. These can be run using node.js. node-uuid is being benchmarked against some other uuid modules, that are available through npm namely `uuid` and `uuid-js`.
+
+To prepare and run the benchmark issue;
+
+```
+npm install uuid uuid-js
+node benchmark/benchmark.js
+```
+
+You'll see an output like this one:
+
+```
+# v4
+nodeuuid.v4(): 854700 uuids/second
+nodeuuid.v4('binary'): 788643 uuids/second
+nodeuuid.v4('binary', buffer): 1336898 uuids/second
+uuid(): 479386 uuids/second
+uuid('binary'): 582072 uuids/second
+uuidjs.create(4): 312304 uuids/second
+
+# v1
+nodeuuid.v1(): 938086 uuids/second
+nodeuuid.v1('binary'): 683060 uuids/second
+nodeuuid.v1('binary', buffer): 1644736 uuids/second
+uuidjs.create(1): 190621 uuids/second
+```
+
+* The `uuid()` entries are for Nikhil Marathe's [uuid module](https://bitbucket.org/nikhilm/uuidjs) which is a wrapper around the native libuuid library.
+* The `uuidjs()` entries are for Patrick Negri's [uuid-js module](https://github.com/pnegri/uuid-js) which is a pure javascript implementation based on [UUID.js](https://github.com/LiosK/UUID.js) by LiosK.
+
+If you want to get more reliable results you can run the benchmark multiple times and write the output into a log file:
+
+```
+for i in {0..9}; do node benchmark/benchmark.js >> benchmark/bench_0.4.12.log; done;
+```
+
+If you're interested in how performance varies between different node versions, you can issue the above command multiple times.
+
+You can then use the shell script `bench.sh` provided in this directory to calculate the averages over all benchmark runs and draw a nice plot:
+
+```
+(cd benchmark/ && ./bench.sh)
+```
+
+This assumes you have [gnuplot](http://www.gnuplot.info/) and [ImageMagick](http://www.imagemagick.org/) installed. You'll find a nice `bench.png` graph in the `benchmark/` directory then.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/bench.gnu b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/bench.gnu
new file mode 100755 (executable)
index 0000000..a342fbb
--- /dev/null
@@ -0,0 +1,174 @@
+#!/opt/local/bin/gnuplot -persist
+#
+#    
+#      G N U P L O T
+#      Version 4.4 patchlevel 3
+#      last modified March 2011
+#      System: Darwin 10.8.0
+#    
+#      Copyright (C) 1986-1993, 1998, 2004, 2007-2010
+#      Thomas Williams, Colin Kelley and many others
+#    
+#      gnuplot home:     http://www.gnuplot.info
+#      faq, bugs, etc:   type "help seeking-assistance"
+#      immediate help:   type "help"
+#      plot window:      hit 'h'
+set terminal postscript eps noenhanced defaultplex \
+ leveldefault color colortext \
+ solid linewidth 1.2 butt noclip \
+ palfuncparam 2000,0.003 \
+ "Helvetica" 14 
+set output 'bench.eps'
+unset clip points
+set clip one
+unset clip two
+set bar 1.000000 front
+set border 31 front linetype -1 linewidth 1.000
+set xdata
+set ydata
+set zdata
+set x2data
+set y2data
+set timefmt x "%d/%m/%y,%H:%M"
+set timefmt y "%d/%m/%y,%H:%M"
+set timefmt z "%d/%m/%y,%H:%M"
+set timefmt x2 "%d/%m/%y,%H:%M"
+set timefmt y2 "%d/%m/%y,%H:%M"
+set timefmt cb "%d/%m/%y,%H:%M"
+set boxwidth
+set style fill  empty border
+set style rectangle back fc lt -3 fillstyle   solid 1.00 border lt -1
+set style circle radius graph 0.02, first 0, 0 
+set dummy x,y
+set format x "% g"
+set format y "% g"
+set format x2 "% g"
+set format y2 "% g"
+set format z "% g"
+set format cb "% g"
+set angles radians
+unset grid
+set key title ""
+set key outside left top horizontal Right noreverse enhanced autotitles columnhead nobox
+set key noinvert samplen 4 spacing 1 width 0 height 0 
+set key maxcolumns 2 maxrows 0
+unset label
+unset arrow
+set style increment default
+unset style line
+set style line 1  linetype 1 linewidth 2.000 pointtype 1 pointsize default pointinterval 0
+unset style arrow
+set style histogram clustered gap 2 title  offset character 0, 0, 0
+unset logscale
+set offsets graph 0.05, 0.15, 0, 0
+set pointsize 1.5
+set pointintervalbox 1
+set encoding default
+unset polar
+unset parametric
+unset decimalsign
+set view 60, 30, 1, 1
+set samples 100, 100
+set isosamples 10, 10
+set surface
+unset contour
+set clabel '%8.3g'
+set mapping cartesian
+set datafile separator whitespace
+unset hidden3d
+set cntrparam order 4
+set cntrparam linear
+set cntrparam levels auto 5
+set cntrparam points 5
+set size ratio 0 1,1
+set origin 0,0
+set style data points
+set style function lines
+set xzeroaxis linetype -2 linewidth 1.000
+set yzeroaxis linetype -2 linewidth 1.000
+set zzeroaxis linetype -2 linewidth 1.000
+set x2zeroaxis linetype -2 linewidth 1.000
+set y2zeroaxis linetype -2 linewidth 1.000
+set ticslevel 0.5
+set mxtics default
+set mytics default
+set mztics default
+set mx2tics default
+set my2tics default
+set mcbtics default
+set xtics border in scale 1,0.5 mirror norotate  offset character 0, 0, 0
+set xtics  norangelimit
+set xtics   ()
+set ytics border in scale 1,0.5 mirror norotate  offset character 0, 0, 0
+set ytics autofreq  norangelimit
+set ztics border in scale 1,0.5 nomirror norotate  offset character 0, 0, 0
+set ztics autofreq  norangelimit
+set nox2tics
+set noy2tics
+set cbtics border in scale 1,0.5 mirror norotate  offset character 0, 0, 0
+set cbtics autofreq  norangelimit
+set title "" 
+set title  offset character 0, 0, 0 font "" norotate
+set timestamp bottom 
+set timestamp "" 
+set timestamp  offset character 0, 0, 0 font "" norotate
+set rrange [ * : * ] noreverse nowriteback  # (currently [8.98847e+307:-8.98847e+307] )
+set autoscale rfixmin
+set autoscale rfixmax
+set trange [ * : * ] noreverse nowriteback  # (currently [-5.00000:5.00000] )
+set autoscale tfixmin
+set autoscale tfixmax
+set urange [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
+set autoscale ufixmin
+set autoscale ufixmax
+set vrange [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
+set autoscale vfixmin
+set autoscale vfixmax
+set xlabel "" 
+set xlabel  offset character 0, 0, 0 font "" textcolor lt -1 norotate
+set x2label "" 
+set x2label  offset character 0, 0, 0 font "" textcolor lt -1 norotate
+set xrange [ * : * ] noreverse nowriteback  # (currently [-0.150000:3.15000] )
+set autoscale xfixmin
+set autoscale xfixmax
+set x2range [ * : * ] noreverse nowriteback  # (currently [0.00000:3.00000] )
+set autoscale x2fixmin
+set autoscale x2fixmax
+set ylabel "" 
+set ylabel  offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270
+set y2label "" 
+set y2label  offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270
+set yrange [ 0.00000 : 1.90000e+06 ] noreverse nowriteback  # (currently [:] )
+set autoscale yfixmin
+set autoscale yfixmax
+set y2range [ * : * ] noreverse nowriteback  # (currently [0.00000:1.90000e+06] )
+set autoscale y2fixmin
+set autoscale y2fixmax
+set zlabel "" 
+set zlabel  offset character 0, 0, 0 font "" textcolor lt -1 norotate
+set zrange [ * : * ] noreverse nowriteback  # (currently [-10.0000:10.0000] )
+set autoscale zfixmin
+set autoscale zfixmax
+set cblabel "" 
+set cblabel  offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270
+set cbrange [ * : * ] noreverse nowriteback  # (currently [8.98847e+307:-8.98847e+307] )
+set autoscale cbfixmin
+set autoscale cbfixmax
+set zero 1e-08
+set lmargin  -1
+set bmargin  -1
+set rmargin  -1
+set tmargin  -1
+set pm3d explicit at s
+set pm3d scansautomatic
+set pm3d interpolate 1,1 flush begin noftriangles nohidden3d corners2color mean
+set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB 
+set palette rgbformulae 7, 5, 15
+set colorbox default
+set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault
+set loadpath 
+set fontpath 
+set fit noerrorvariables
+GNUTERM = "aqua"
+plot 'bench_results.txt' using 2:xticlabel(1) w lp lw 2, '' using 3:xticlabel(1) w lp lw 2, '' using 4:xticlabel(1) w lp lw 2, '' using 5:xticlabel(1) w lp lw 2, '' using 6:xticlabel(1) w lp lw 2, '' using 7:xticlabel(1) w lp lw 2, '' using 8:xticlabel(1) w lp lw 2, '' using 9:xticlabel(1) w lp lw 2
+#    EOF
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/bench.sh b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/bench.sh
new file mode 100755 (executable)
index 0000000..d870a0c
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# for a given node version run:
+# for i in {0..9}; do node benchmark.js >> bench_0.6.2.log; done;
+
+PATTERNS=('nodeuuid.v1()' "nodeuuid.v1('binary'," 'nodeuuid.v4()' "nodeuuid.v4('binary'," "uuid()" "uuid('binary')" 'uuidjs.create(1)' 'uuidjs.create(4)' '140byte')
+FILES=(node_uuid_v1_string node_uuid_v1_buf node_uuid_v4_string node_uuid_v4_buf libuuid_v4_string libuuid_v4_binary uuidjs_v1_string uuidjs_v4_string 140byte_es)
+INDICES=(2 3 2 3 2 2 2 2 2)
+VERSIONS=$( ls bench_*.log | sed -e 's/^bench_\([0-9\.]*\)\.log/\1/' | tr "\\n" " " )
+TMPJOIN="tmp_join"
+OUTPUT="bench_results.txt"
+
+for I in ${!FILES[*]}; do
+  F=${FILES[$I]}
+  P=${PATTERNS[$I]}
+  INDEX=${INDICES[$I]}
+  echo "version $F" > $F
+  for V in $VERSIONS; do
+    (VAL=$( grep "$P" bench_$V.log | LC_ALL=en_US awk '{ sum += $'$INDEX' } END { print sum/NR }' ); echo $V $VAL) >> $F
+  done
+  if [ $I == 0 ]; then
+    cat $F > $TMPJOIN
+  else
+    join $TMPJOIN $F > $OUTPUT
+    cp $OUTPUT $TMPJOIN
+  fi
+  rm $F
+done
+
+rm $TMPJOIN
+
+gnuplot bench.gnu
+convert -density 200 -resize 800x560 -flatten bench.eps bench.png
+rm bench.eps
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/benchmark-native.c b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/benchmark-native.c
new file mode 100755 (executable)
index 0000000..dbfc75f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+Test performance of native C UUID generation
+
+To Compile: cc -luuid benchmark-native.c -o benchmark-native
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <uuid/uuid.h>
+
+int main() {
+  uuid_t myid;
+  char buf[36+1];
+  int i;
+  struct timeval t;
+  double start, finish;
+
+  gettimeofday(&t, NULL);
+  start = t.tv_sec + t.tv_usec/1e6;
+
+  int n = 2e5;
+  for (i = 0; i < n; i++) {
+    uuid_generate(myid);
+    uuid_unparse(myid, buf);
+  }
+
+  gettimeofday(&t, NULL);
+  finish = t.tv_sec + t.tv_usec/1e6;
+  double dur = finish - start;
+
+  printf("%d uuids/sec", (int)(n/dur));
+  return 0;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/benchmark.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/benchmark/benchmark.js
new file mode 100755 (executable)
index 0000000..40e6efb
--- /dev/null
@@ -0,0 +1,84 @@
+try {
+  var nodeuuid = require('../uuid');
+} catch (e) {
+  console.error('node-uuid require failed - skipping tests');
+}
+
+try {
+  var uuid = require('uuid');
+} catch (e) {
+  console.error('uuid require failed - skipping tests');
+}
+
+try {
+  var uuidjs = require('uuid-js');
+} catch (e) {
+  console.error('uuid-js require failed - skipping tests');
+}
+
+var N = 5e5;
+
+function rate(msg, t) {
+  console.log(msg + ': ' +
+    (N / (Date.now() - t) * 1e3 | 0) +
+    ' uuids/second');
+}
+
+console.log('# v4');
+
+// node-uuid - string form
+if (nodeuuid) {
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4();
+  rate('nodeuuid.v4() - using node.js crypto RNG', t);
+
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4({rng: nodeuuid.mathRNG});
+  rate('nodeuuid.v4() - using Math.random() RNG', t);
+
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary');
+  rate('nodeuuid.v4(\'binary\')', t);
+
+  var buffer = new nodeuuid.BufferClass(16);
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary', buffer);
+  rate('nodeuuid.v4(\'binary\', buffer)', t);
+}
+
+// libuuid - string form
+if (uuid) {
+  for (var i = 0, t = Date.now(); i < N; i++) uuid();
+  rate('uuid()', t);
+
+  for (var i = 0, t = Date.now(); i < N; i++) uuid('binary');
+  rate('uuid(\'binary\')', t);
+}
+
+// uuid-js - string form
+if (uuidjs) {
+  for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(4);
+  rate('uuidjs.create(4)', t);
+}
+
+// 140byte.es
+for (var i = 0, t = Date.now(); i < N; i++) 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(s,r){r=Math.random()*16|0;return (s=='x'?r:r&0x3|0x8).toString(16)});
+rate('140byte.es_v4', t);
+
+console.log('');
+console.log('# v1');
+
+// node-uuid - v1 string form
+if (nodeuuid) {
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1();
+  rate('nodeuuid.v1()', t);
+
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary');
+  rate('nodeuuid.v1(\'binary\')', t);
+
+  var buffer = new nodeuuid.BufferClass(16);
+  for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary', buffer);
+  rate('nodeuuid.v1(\'binary\', buffer)', t);
+}
+
+// uuid-js - v1 string form
+if (uuidjs) {
+  for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(1);
+  rate('uuidjs.create(1)', t);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/bin/uuid b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/bin/uuid
new file mode 100755 (executable)
index 0000000..f732e99
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env node
+
+var path = require('path');
+var uuid = require(path.join(__dirname, '..'));
+
+var arg = process.argv[2];
+
+if ('--help' === arg) {
+  console.log('\n  USAGE: uuid [version] [options]\n\n');
+  console.log('  options:\n');
+  console.log('  --help                     Display this message and exit\n');
+  process.exit(0);
+}
+
+if (null == arg) {
+  console.log(uuid());
+  process.exit(0);
+}
+
+if ('v1' !== arg && 'v4' !== arg) {
+  console.error('Version must be RFC4122 version 1 or version 4, denoted as "v1" or "v4"');
+  process.exit(1);
+}
+
+console.log(uuid[arg]());
+process.exit(0);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/bower.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/bower.json
new file mode 100755 (executable)
index 0000000..1656dc8
--- /dev/null
@@ -0,0 +1,23 @@
+{
+  "name": "node-uuid",
+  "version": "1.4.3",
+  "homepage": "https://github.com/broofa/node-uuid",
+  "authors": [
+    "Robert Kieffer <robert@broofa.com>"
+  ],
+  "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
+  "main": "uuid.js",
+  "keywords": [
+    "uuid",
+    "gid",
+    "rfc4122"
+  ],
+  "license": "MIT",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/component.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/component.json
new file mode 100755 (executable)
index 0000000..149f84b
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "node-uuid",
+  "repo": "broofa/node-uuid",
+  "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
+  "version": "1.4.3",
+  "author": "Robert Kieffer <robert@broofa.com>",
+  "contributors": [
+    {"name": "Christoph Tavan <dev@tavan.de>", "github": "https://github.com/ctavan"}
+  ],
+  "keywords": ["uuid", "guid", "rfc4122"],
+  "dependencies": {},
+  "development": {},
+  "main": "uuid.js",
+  "scripts": [
+    "uuid.js"
+  ],
+  "license": "MIT"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/package.json
new file mode 100755 (executable)
index 0000000..a35d253
--- /dev/null
@@ -0,0 +1,65 @@
+{
+  "name": "node-uuid",
+  "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
+  "url": "http://github.com/broofa/node-uuid",
+  "keywords": [
+    "uuid",
+    "guid",
+    "rfc4122"
+  ],
+  "author": {
+    "name": "Robert Kieffer",
+    "email": "robert@broofa.com"
+  },
+  "contributors": [
+    {
+      "name": "Christoph Tavan",
+      "email": "dev@tavan.de"
+    }
+  ],
+  "bin": {
+    "uuid": "./bin/uuid"
+  },
+  "scripts": {
+    "test": "node test/test.js"
+  },
+  "lib": ".",
+  "main": "./uuid.js",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/broofa/node-uuid.git"
+  },
+  "version": "1.4.3",
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://raw.github.com/broofa/node-uuid/master/LICENSE.md"
+    }
+  ],
+  "gitHead": "886463c660a095dfebfa69603921a8d156fdb12c",
+  "bugs": {
+    "url": "https://github.com/broofa/node-uuid/issues"
+  },
+  "homepage": "https://github.com/broofa/node-uuid",
+  "_id": "node-uuid@1.4.3",
+  "_shasum": "319bb7a56e7cb63f00b5c0cd7851cd4b4ddf1df9",
+  "_from": "node-uuid@~1.4.0",
+  "_npmVersion": "1.4.28",
+  "_npmUser": {
+    "name": "broofa",
+    "email": "robert@broofa.com"
+  },
+  "maintainers": [
+    {
+      "name": "broofa",
+      "email": "robert@broofa.com"
+    }
+  ],
+  "dist": {
+    "shasum": "319bb7a56e7cb63f00b5c0cd7851cd4b4ddf1df9",
+    "tarball": "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.3.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.3.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/compare_v1.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/compare_v1.js
new file mode 100755 (executable)
index 0000000..05af822
--- /dev/null
@@ -0,0 +1,63 @@
+var assert = require('assert'),
+    nodeuuid = require('../uuid'),
+    uuidjs = require('uuid-js'),
+    libuuid = require('uuid').generate,
+    util = require('util'),
+    exec = require('child_process').exec,
+    os = require('os');
+
+// On Mac Os X / macports there's only the ossp-uuid package that provides uuid
+// On Linux there's uuid-runtime which provides uuidgen
+var uuidCmd = os.type() === 'Darwin' ? 'uuid -1' : 'uuidgen -t';
+
+function compare(ids) {
+  console.log(ids);
+  for (var i = 0; i < ids.length; i++) {
+    var id = ids[i].split('-');
+    id = [id[2], id[1], id[0]].join('');
+    ids[i] = id;
+  }
+  var sorted = ([].concat(ids)).sort();
+
+  if (sorted.toString() !== ids.toString()) {
+    console.log('Warning: sorted !== ids');
+  } else {
+    console.log('everything in order!');
+  }
+}
+
+// Test time order of v1 uuids
+var ids = [];
+while (ids.length < 10e3) ids.push(nodeuuid.v1());
+
+var max = 10;
+console.log('node-uuid:');
+ids = [];
+for (var i = 0; i < max; i++) ids.push(nodeuuid.v1());
+compare(ids);
+
+console.log('');
+console.log('uuidjs:');
+ids = [];
+for (var i = 0; i < max; i++) ids.push(uuidjs.create(1).toString());
+compare(ids);
+
+console.log('');
+console.log('libuuid:');
+ids = [];
+var count = 0;
+var last = function() {
+  compare(ids);
+}
+var cb = function(err, stdout, stderr) {
+  ids.push(stdout.substring(0, stdout.length-1));
+  count++;
+  if (count < max) {
+    return next();
+  }
+  last();
+};
+var next = function() {
+  exec(uuidCmd, cb);
+};
+next();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/test.html b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/test.html
new file mode 100755 (executable)
index 0000000..d80326e
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+  <head>
+    <style>
+      div {
+        font-family: monospace;
+        font-size: 8pt;
+      }
+      div.log {color: #444;}
+      div.warn {color: #550;}
+      div.error {color: #800; font-weight: bold;}
+    </style>
+    <script src="../uuid.js"></script>
+  </head>
+  <body>
+    <script src="./test.js"></script>
+  </body>
+</html>
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/test/test.js
new file mode 100755 (executable)
index 0000000..2469225
--- /dev/null
@@ -0,0 +1,228 @@
+if (!this.uuid) {
+  // node.js
+  uuid = require('../uuid');
+}
+
+//
+// x-platform log/assert shims
+//
+
+function _log(msg, type) {
+  type = type || 'log';
+
+  if (typeof(document) != 'undefined') {
+    document.write('<div class="' + type + '">' + msg.replace(/\n/g, '<br />') + '</div>');
+  }
+  if (typeof(console) != 'undefined') {
+    var color = {
+      log: '\033[39m',
+      warn: '\033[33m',
+      error: '\033[31m'
+    };
+    console[type](color[type] + msg + color.log);
+  }
+}
+
+function log(msg) {_log(msg, 'log');}
+function warn(msg) {_log(msg, 'warn');}
+function error(msg) {_log(msg, 'error');}
+
+function assert(res, msg) {
+  if (!res) {
+    error('FAIL: ' + msg);
+  } else {
+    log('Pass: ' + msg);
+  }
+}
+
+//
+// Unit tests
+//
+
+// Verify ordering of v1 ids created with explicit times
+var TIME = 1321644961388; // 2011-11-18 11:36:01.388-08:00
+
+function compare(name, ids) {
+  ids = ids.map(function(id) {
+    return id.split('-').reverse().join('-');
+  }).sort();
+  var sorted = ([].concat(ids)).sort();
+
+  assert(sorted.toString() == ids.toString(), name + ' have expected order');
+}
+
+// Verify ordering of v1 ids created using default behavior
+compare('uuids with current time', [
+  uuid.v1(),
+  uuid.v1(),
+  uuid.v1(),
+  uuid.v1(),
+  uuid.v1()
+]);
+
+// Verify ordering of v1 ids created with explicit times
+compare('uuids with time option', [
+  uuid.v1({msecs: TIME - 10*3600*1000}),
+  uuid.v1({msecs: TIME - 1}),
+  uuid.v1({msecs: TIME}),
+  uuid.v1({msecs: TIME + 1}),
+  uuid.v1({msecs: TIME + 28*24*3600*1000})
+]);
+
+assert(
+  uuid.v1({msecs: TIME}) != uuid.v1({msecs: TIME}),
+  'IDs created at same msec are different'
+);
+
+// Verify throw if too many ids created
+var thrown = false;
+try {
+  uuid.v1({msecs: TIME, nsecs: 10000});
+} catch (e) {
+  thrown = true;
+}
+assert(thrown, 'Exception thrown when > 10K ids created in 1 ms');
+
+// Verify clock regression bumps clockseq
+var uidt = uuid.v1({msecs: TIME});
+var uidtb = uuid.v1({msecs: TIME - 1});
+assert(
+  parseInt(uidtb.split('-')[3], 16) - parseInt(uidt.split('-')[3], 16) === 1,
+  'Clock regression by msec increments the clockseq'
+);
+
+// Verify clock regression bumps clockseq
+var uidtn = uuid.v1({msecs: TIME, nsecs: 10});
+var uidtnb = uuid.v1({msecs: TIME, nsecs: 9});
+assert(
+  parseInt(uidtnb.split('-')[3], 16) - parseInt(uidtn.split('-')[3], 16) === 1,
+  'Clock regression by nsec increments the clockseq'
+);
+
+// Verify explicit options produce expected id
+var id = uuid.v1({
+  msecs: 1321651533573,
+  nsecs: 5432,
+  clockseq: 0x385c,
+  node: [ 0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10 ]
+});
+assert(id == 'd9428888-122b-11e1-b85c-61cd3cbb3210', 'Explicit options produce expected id');
+
+// Verify adjacent ids across a msec boundary are 1 time unit apart
+var u0 = uuid.v1({msecs: TIME, nsecs: 9999});
+var u1 = uuid.v1({msecs: TIME + 1, nsecs: 0});
+
+var before = u0.split('-')[0], after = u1.split('-')[0];
+var dt = parseInt(after, 16) - parseInt(before, 16);
+assert(dt === 1, 'Ids spanning 1ms boundary are 100ns apart');
+
+//
+// Test parse/unparse
+//
+
+id = '00112233445566778899aabbccddeeff';
+assert(uuid.unparse(uuid.parse(id.substr(0,10))) ==
+  '00112233-4400-0000-0000-000000000000', 'Short parse');
+assert(uuid.unparse(uuid.parse('(this is the uuid -> ' + id + id)) ==
+  '00112233-4455-6677-8899-aabbccddeeff', 'Dirty parse');
+
+//
+// Perf tests
+//
+
+var generators = {
+  v1: uuid.v1,
+  v4: uuid.v4
+};
+
+var UUID_FORMAT = {
+  v1: /[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,
+  v4: /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i
+};
+
+var N = 1e4;
+
+// Get %'age an actual value differs from the ideal value
+function divergence(actual, ideal) {
+  return Math.round(100*100*(actual - ideal)/ideal)/100;
+}
+
+function rate(msg, t) {
+  log(msg + ': ' + (N / (Date.now() - t) * 1e3 | 0) + ' uuids\/second');
+}
+
+for (var version in generators) {
+  var counts = {}, max = 0;
+  var generator = generators[version];
+  var format = UUID_FORMAT[version];
+
+  log('\nSanity check ' + N + ' ' + version + ' uuids');
+  for (var i = 0, ok = 0; i < N; i++) {
+    id = generator();
+    if (!format.test(id)) {
+      throw Error(id + ' is not a valid UUID string');
+    }
+
+    if (id != uuid.unparse(uuid.parse(id))) {
+      assert(fail, id + ' is not a valid id');
+    }
+
+    // Count digits for our randomness check
+    if (version == 'v4') {
+      var digits = id.replace(/-/g, '').split('');
+      for (var j = digits.length-1; j >= 0; j--) {
+        var c = digits[j];
+        max = Math.max(max, counts[c] = (counts[c] || 0) + 1);
+      }
+    }
+  }
+
+  // Check randomness for v4 UUIDs
+  if (version == 'v4') {
+    // Limit that we get worried about randomness. (Purely empirical choice, this!)
+    var limit = 2*100*Math.sqrt(1/N);
+
+    log('\nChecking v4 randomness.  Distribution of Hex Digits (% deviation from ideal)');
+
+    for (var i = 0; i < 16; i++) {
+      var c = i.toString(16);
+      var bar = '', n = counts[c], p = Math.round(n/max*100|0);
+
+      // 1-3,5-8, and D-F: 1:16 odds over 30 digits
+      var ideal = N*30/16;
+      if (i == 4) {
+        // 4: 1:1 odds on 1 digit, plus 1:16 odds on 30 digits
+        ideal = N*(1 + 30/16);
+      } else if (i >= 8 && i <= 11) {
+        // 8-B: 1:4 odds on 1 digit, plus 1:16 odds on 30 digits
+        ideal = N*(1/4 + 30/16);
+      } else {
+        // Otherwise: 1:16 odds on 30 digits
+        ideal = N*30/16;
+      }
+      var d = divergence(n, ideal);
+
+      // Draw bar using UTF squares (just for grins)
+      var s = n/max*50 | 0;
+      while (s--) bar += '=';
+
+      assert(Math.abs(d) < limit, c + ' |' + bar + '| ' + counts[c] + ' (' + d + '% < ' + limit + '%)');
+    }
+  }
+}
+
+// Perf tests
+for (var version in generators) {
+  log('\nPerformance testing ' + version + ' UUIDs');
+  var generator = generators[version];
+  var buf = new uuid.BufferClass(16);
+
+  for (var i = 0, t = Date.now(); i < N; i++) generator();
+  rate('uuid.' + version + '()', t);
+
+  for (var i = 0, t = Date.now(); i < N; i++) generator('binary');
+  rate('uuid.' + version + '(\'binary\')', t);
+
+  for (var i = 0, t = Date.now(); i < N; i++) generator('binary', buf);
+  rate('uuid.' + version + '(\'binary\', buffer)', t);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/uuid.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/node-uuid/uuid.js
new file mode 100755 (executable)
index 0000000..0a61769
--- /dev/null
@@ -0,0 +1,247 @@
+//     uuid.js
+//
+//     Copyright (c) 2010-2012 Robert Kieffer
+//     MIT License - http://opensource.org/licenses/mit-license.php
+
+(function() {
+  var _global = this;
+
+  // Unique ID creation requires a high quality random # generator.  We feature
+  // detect to determine the best RNG source, normalizing to a function that
+  // returns 128-bits of randomness, since that's what's usually required
+  var _rng;
+
+  // Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
+  //
+  // Moderately fast, high quality
+  if (typeof(_global.require) == 'function') {
+    try {
+      var _rb = _global.require('crypto').randomBytes;
+      _rng = _rb && function() {return _rb(16);};
+    } catch(e) {}
+  }
+
+  if (!_rng && _global.crypto && crypto.getRandomValues) {
+    // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
+    //
+    // Moderately fast, high quality
+    var _rnds8 = new Uint8Array(16);
+    _rng = function whatwgRNG() {
+      crypto.getRandomValues(_rnds8);
+      return _rnds8;
+    };
+  }
+
+  if (!_rng) {
+    // Math.random()-based (RNG)
+    //
+    // If all else fails, use Math.random().  It's fast, but is of unspecified
+    // quality.
+    var  _rnds = new Array(16);
+    _rng = function() {
+      for (var i = 0, r; i < 16; i++) {
+        if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
+        _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
+      }
+
+      return _rnds;
+    };
+  }
+
+  // Buffer class to use
+  var BufferClass = typeof(_global.Buffer) == 'function' ? _global.Buffer : Array;
+
+  // Maps for number <-> hex string conversion
+  var _byteToHex = [];
+  var _hexToByte = {};
+  for (var i = 0; i < 256; i++) {
+    _byteToHex[i] = (i + 0x100).toString(16).substr(1);
+    _hexToByte[_byteToHex[i]] = i;
+  }
+
+  // **`parse()` - Parse a UUID into it's component bytes**
+  function parse(s, buf, offset) {
+    var i = (buf && offset) || 0, ii = 0;
+
+    buf = buf || [];
+    s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
+      if (ii < 16) { // Don't overflow!
+        buf[i + ii++] = _hexToByte[oct];
+      }
+    });
+
+    // Zero out remaining bytes if string was short
+    while (ii < 16) {
+      buf[i + ii++] = 0;
+    }
+
+    return buf;
+  }
+
+  // **`unparse()` - Convert UUID byte array (ala parse()) into a string**
+  function unparse(buf, offset) {
+    var i = offset || 0, bth = _byteToHex;
+    return  bth[buf[i++]] + bth[buf[i++]] +
+            bth[buf[i++]] + bth[buf[i++]] + '-' +
+            bth[buf[i++]] + bth[buf[i++]] + '-' +
+            bth[buf[i++]] + bth[buf[i++]] + '-' +
+            bth[buf[i++]] + bth[buf[i++]] + '-' +
+            bth[buf[i++]] + bth[buf[i++]] +
+            bth[buf[i++]] + bth[buf[i++]] +
+            bth[buf[i++]] + bth[buf[i++]];
+  }
+
+  // **`v1()` - Generate time-based UUID**
+  //
+  // Inspired by https://github.com/LiosK/UUID.js
+  // and http://docs.python.org/library/uuid.html
+
+  // random #'s we need to init node and clockseq
+  var _seedBytes = _rng();
+
+  // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
+  var _nodeId = [
+    _seedBytes[0] | 0x01,
+    _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
+  ];
+
+  // Per 4.2.2, randomize (14 bit) clockseq
+  var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
+
+  // Previous uuid creation time
+  var _lastMSecs = 0, _lastNSecs = 0;
+
+  // See https://github.com/broofa/node-uuid for API details
+  function v1(options, buf, offset) {
+    var i = buf && offset || 0;
+    var b = buf || [];
+
+    options = options || {};
+
+    var clockseq = options.clockseq != null ? options.clockseq : _clockseq;
+
+    // UUID timestamps are 100 nano-second units since the Gregorian epoch,
+    // (1582-10-15 00:00).  JSNumbers aren't precise enough for this, so
+    // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
+    // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
+    var msecs = options.msecs != null ? options.msecs : new Date().getTime();
+
+    // Per 4.2.1.2, use count of uuid's generated during the current clock
+    // cycle to simulate higher resolution clock
+    var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1;
+
+    // Time since last uuid creation (in msecs)
+    var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
+
+    // Per 4.2.1.2, Bump clockseq on clock regression
+    if (dt < 0 && options.clockseq == null) {
+      clockseq = clockseq + 1 & 0x3fff;
+    }
+
+    // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
+    // time interval
+    if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) {
+      nsecs = 0;
+    }
+
+    // Per 4.2.1.2 Throw error if too many uuids are requested
+    if (nsecs >= 10000) {
+      throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
+    }
+
+    _lastMSecs = msecs;
+    _lastNSecs = nsecs;
+    _clockseq = clockseq;
+
+    // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
+    msecs += 12219292800000;
+
+    // `time_low`
+    var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
+    b[i++] = tl >>> 24 & 0xff;
+    b[i++] = tl >>> 16 & 0xff;
+    b[i++] = tl >>> 8 & 0xff;
+    b[i++] = tl & 0xff;
+
+    // `time_mid`
+    var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
+    b[i++] = tmh >>> 8 & 0xff;
+    b[i++] = tmh & 0xff;
+
+    // `time_high_and_version`
+    b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
+    b[i++] = tmh >>> 16 & 0xff;
+
+    // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
+    b[i++] = clockseq >>> 8 | 0x80;
+
+    // `clock_seq_low`
+    b[i++] = clockseq & 0xff;
+
+    // `node`
+    var node = options.node || _nodeId;
+    for (var n = 0; n < 6; n++) {
+      b[i + n] = node[n];
+    }
+
+    return buf ? buf : unparse(b);
+  }
+
+  // **`v4()` - Generate random UUID**
+
+  // See https://github.com/broofa/node-uuid for API details
+  function v4(options, buf, offset) {
+    // Deprecated - 'format' argument, as supported in v1.2
+    var i = buf && offset || 0;
+
+    if (typeof(options) == 'string') {
+      buf = options == 'binary' ? new BufferClass(16) : null;
+      options = null;
+    }
+    options = options || {};
+
+    var rnds = options.random || (options.rng || _rng)();
+
+    // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
+    rnds[6] = (rnds[6] & 0x0f) | 0x40;
+    rnds[8] = (rnds[8] & 0x3f) | 0x80;
+
+    // Copy bytes to buffer, if provided
+    if (buf) {
+      for (var ii = 0; ii < 16; ii++) {
+        buf[i + ii] = rnds[ii];
+      }
+    }
+
+    return buf || unparse(rnds);
+  }
+
+  // Export public API
+  var uuid = v4;
+  uuid.v1 = v1;
+  uuid.v4 = v4;
+  uuid.parse = parse;
+  uuid.unparse = unparse;
+  uuid.BufferClass = BufferClass;
+
+  if (typeof(module) != 'undefined' && module.exports) {
+    // Publish as node.js module
+    module.exports = uuid;
+  } else  if (typeof define === 'function' && define.amd) {
+    // Publish as AMD module
+    define(function() {return uuid;});
+
+  } else {
+    // Publish as global (in browsers)
+    var _previousRoot = _global.uuid;
+
+    // **`noConflict()` - (browser only) to reset global 'uuid' var**
+    uuid.noConflict = function() {
+      _global.uuid = _previousRoot;
+      return uuid;
+    };
+
+    _global.uuid = uuid;
+  }
+}).call(this);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/LICENSE
new file mode 100755 (executable)
index 0000000..a4a9aee
--- /dev/null
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/README.md
new file mode 100755 (executable)
index 0000000..712bbe1
--- /dev/null
@@ -0,0 +1,332 @@
+# Request -- Simplified HTTP client
+
+[![NPM](https://nodei.co/npm/request.png)](https://nodei.co/npm/request/)
+
+## Super simple to use
+
+Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.
+
+```javascript
+var request = require('request');
+request('http://www.google.com', function (error, response, body) {
+  if (!error && response.statusCode == 200) {
+    console.log(body) // Print the google web page.
+  }
+})
+```
+
+## Streaming
+
+You can stream any response to a file stream.
+
+```javascript
+request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
+```
+
+You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.
+
+```javascript
+fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))
+```
+
+Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.
+
+```javascript
+request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))
+```
+
+Now let's get fancy.
+
+```javascript
+http.createServer(function (req, resp) {
+  if (req.url === '/doodle.png') {
+    if (req.method === 'PUT') {
+      req.pipe(request.put('http://mysite.com/doodle.png'))
+    } else if (req.method === 'GET' || req.method === 'HEAD') {
+      request.get('http://mysite.com/doodle.png').pipe(resp)
+    }
+  }
+})
+```
+
+You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:
+
+```javascript
+http.createServer(function (req, resp) {
+  if (req.url === '/doodle.png') {
+    var x = request('http://mysite.com/doodle.png')
+    req.pipe(x)
+    x.pipe(resp)
+  }
+})
+```
+
+And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)
+
+```javascript
+req.pipe(request('http://mysite.com/doodle.png')).pipe(resp)
+```
+
+Also, none of this new functionality conflicts with requests previous features, it just expands them.
+
+```javascript
+var r = request.defaults({'proxy':'http://localproxy.com'})
+
+http.createServer(function (req, resp) {
+  if (req.url === '/doodle.png') {
+    r.get('http://google.com/doodle.png').pipe(resp)
+  }
+})
+```
+You can still use intermediate proxies, the requests will still follow HTTP forwards, etc.
+
+## Forms
+
+`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.
+
+Url encoded forms are simple
+
+```javascript
+request.post('http://service.com/upload', {form:{key:'value'}})
+// or
+request.post('http://service.com/upload').form({key:'value'})
+```
+
+For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don't need to worry about piping the form object or setting the headers, `request` will handle that for you.
+
+```javascript
+var r = request.post('http://service.com/upload')
+var form = r.form()
+form.append('my_field', 'my_value')
+form.append('my_buffer', new Buffer([1, 2, 3]))
+form.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))
+form.append('remote_file', request('http://google.com/doodle.png'))
+```
+
+## HTTP Authentication
+
+```javascript
+request.get('http://some.server.com/').auth('username', 'password', false);
+// or
+request.get('http://some.server.com/', {
+  'auth': {
+    'user': 'username',
+    'pass': 'password',
+    'sendImmediately': false
+  }
+});
+```
+
+If passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional).  The method form takes parameters `auth(username, password, sendImmediately)`.
+
+`sendImmediately` defaults to true, which will cause a basic authentication header to be sent.  If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a 401 response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).
+
+Digest authentication is supported, but it only works with `sendImmediately` set to `false` (otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail).
+
+## OAuth Signing
+
+```javascript
+// Twitter OAuth
+var qs = require('querystring')
+  , oauth =
+    { callback: 'http://mysite.com/callback/'
+    , consumer_key: CONSUMER_KEY
+    , consumer_secret: CONSUMER_SECRET
+    }
+  , url = 'https://api.twitter.com/oauth/request_token'
+  ;
+request.post({url:url, oauth:oauth}, function (e, r, body) {
+  // Ideally, you would take the body in the response
+  // and construct a URL that a user clicks on (like a sign in button).
+  // The verifier is only available in the response after a user has
+  // verified with twitter that they are authorizing your app.
+  var access_token = qs.parse(body)
+    , oauth =
+      { consumer_key: CONSUMER_KEY
+      , consumer_secret: CONSUMER_SECRET
+      , token: access_token.oauth_token
+      , verifier: access_token.oauth_verifier
+      }
+    , url = 'https://api.twitter.com/oauth/access_token'
+    ;
+  request.post({url:url, oauth:oauth}, function (e, r, body) {
+    var perm_token = qs.parse(body)
+      , oauth =
+        { consumer_key: CONSUMER_KEY
+        , consumer_secret: CONSUMER_SECRET
+        , token: perm_token.oauth_token
+        , token_secret: perm_token.oauth_token_secret
+        }
+      , url = 'https://api.twitter.com/1/users/show.json?'
+      , params =
+        { screen_name: perm_token.screen_name
+        , user_id: perm_token.user_id
+        }
+      ;
+    url += qs.stringify(params)
+    request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {
+      console.log(user)
+    })
+  })
+})
+```
+
+
+
+### request(options, callback)
+
+The first argument can be either a url or an options object. The only required option is uri, all others are optional.
+
+* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()
+* `qs` - object containing querystring values to be appended to the uri
+* `method` - http method, defaults to GET
+* `headers` - http headers, defaults to {}
+* `body` - entity body for PATCH, POST and PUT requests. Must be buffer or string.
+* `form` - when passed an object this will set `body` but to a querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no option a FormData instance is returned that will be piped to request.
+* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional).  See documentation above.
+* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header.  Additionally, parses the response body as json.
+* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.
+* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.
+* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.
+* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.
+* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer.
+* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.
+* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.
+* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request
+* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.
+* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above.
+* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).
+* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.
+* `jar` - Set to `true` if you want cookies to be remembered for future use, or define your custom cookie jar (see examples section)
+* `aws` - object containing aws signing information, should have the properties `key` and `secret` as well as `bucket` unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)
+* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
+* `localAddress` - Local interface to bind for network connections.
+
+
+The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second is an http.ClientResponse object. The third is the response body String or Buffer.
+
+## Convenience methods
+
+There are also shorthand methods for different HTTP METHODs and some other conveniences.
+
+### request.defaults(options)
+
+This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.
+
+### request.put
+
+Same as request() but defaults to `method: "PUT"`.
+
+```javascript
+request.put(url)
+```
+
+### request.patch
+
+Same as request() but defaults to `method: "PATCH"`.
+
+```javascript
+request.patch(url)
+```
+
+### request.post
+
+Same as request() but defaults to `method: "POST"`.
+
+```javascript
+request.post(url)
+```
+
+### request.head
+
+Same as request() but defaults to `method: "HEAD"`.
+
+```javascript
+request.head(url)
+```
+
+### request.del
+
+Same as request() but defaults to `method: "DELETE"`.
+
+```javascript
+request.del(url)
+```
+
+### request.get
+
+Alias to normal request method for uniformity.
+
+```javascript
+request.get(url)
+```
+### request.cookie
+
+Function that creates a new cookie.
+
+```javascript
+request.cookie('cookie_string_here')
+```
+### request.jar
+
+Function that creates a new cookie jar.
+
+```javascript
+request.jar()
+```
+
+
+## Examples:
+
+```javascript
+  var request = require('request')
+    , rand = Math.floor(Math.random()*100000000).toString()
+    ;
+  request(
+    { method: 'PUT'
+    , uri: 'http://mikeal.iriscouch.com/testjs/' + rand
+    , multipart:
+      [ { 'content-type': 'application/json'
+        ,  body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})
+        }
+      , { body: 'I am an attachment' }
+      ]
+    }
+  , function (error, response, body) {
+      if(response.statusCode == 201){
+        console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)
+      } else {
+        console.log('error: '+ response.statusCode)
+        console.log(body)
+      }
+    }
+  )
+```
+Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies set jar to true (either in defaults or in the options sent).
+
+```javascript
+var request = request.defaults({jar: true})
+request('http://www.google.com', function () {
+  request('http://images.google.com')
+})
+```
+
+If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option:
+
+```javascript
+var j = request.jar()
+var request = request.defaults({jar:j})
+request('http://www.google.com', function () {
+  request('http://images.google.com')
+})
+```
+OR
+
+```javascript
+var j = request.jar()
+var cookie = request.cookie('your_cookie_here')
+j.add(cookie)
+request({url: 'http://www.google.com', jar: j}, function () {
+  request('http://images.google.com')
+})
+```
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/index.js
new file mode 100755 (executable)
index 0000000..06b407d
--- /dev/null
@@ -0,0 +1,149 @@
+// Copyright 2010-2012 Mikeal Rogers
+//
+//    Licensed under the Apache License, Version 2.0 (the "License");
+//    you may not use this file except in compliance with the License.
+//    You may obtain a copy of the License at
+//
+//        http://www.apache.org/licenses/LICENSE-2.0
+//
+//    Unless required by applicable law or agreed to in writing, software
+//    distributed under the License is distributed on an "AS IS" BASIS,
+//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//    See the License for the specific language governing permissions and
+//    limitations under the License.
+
+var Cookie = require('cookie-jar')
+  , CookieJar = Cookie.Jar
+  , cookieJar = new CookieJar
+
+  , copy = require('./lib/copy')
+  , Request = require('./request')
+  ;
+
+
+
+// organize params for patch, post, put, head, del
+function initParams(uri, options, callback) {
+  if ((typeof options === 'function') && !callback) callback = options
+  if (options && typeof options === 'object') {
+    options.uri = uri
+  } else if (typeof uri === 'string') {
+    options = {uri:uri}
+  } else {
+    options = uri
+    uri = options.uri
+  }
+  return { uri: uri, options: options, callback: callback }
+}
+
+function request (uri, options, callback) {
+  if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.')
+  if ((typeof options === 'function') && !callback) callback = options
+  if (options && typeof options === 'object') {
+    options.uri = uri
+  } else if (typeof uri === 'string') {
+    options = {uri:uri}
+  } else {
+    options = uri
+  }
+
+  options = copy(options)
+
+  if (callback) options.callback = callback
+  var r = new Request(options)
+  return r
+}
+
+module.exports = request
+
+request.Request = Request;
+
+request.debug = process.env.NODE_DEBUG && /request/.test(process.env.NODE_DEBUG)
+
+request.initParams = initParams
+
+request.defaults = function (options, requester) {
+  var def = function (method) {
+    var d = function (uri, opts, callback) {
+      var params = initParams(uri, opts, callback)
+      for (var i in options) {
+        if (params.options[i] === undefined) params.options[i] = options[i]
+      }
+      if(typeof requester === 'function') {
+        if(method === request) {
+          method = requester
+        } else {
+          params.options._requester = requester
+        }
+      }
+      return method(params.options, params.callback)
+    }
+    return d
+  }
+  var de = def(request)
+  de.get = def(request.get)
+  de.patch = def(request.patch)
+  de.post = def(request.post)
+  de.put = def(request.put)
+  de.head = def(request.head)
+  de.del = def(request.del)
+  de.cookie = def(request.cookie)
+  de.jar = request.jar
+  return de
+}
+
+request.forever = function (agentOptions, optionsArg) {
+  var options = {}
+  if (optionsArg) {
+    for (option in optionsArg) {
+      options[option] = optionsArg[option]
+    }
+  }
+  if (agentOptions) options.agentOptions = agentOptions
+  options.forever = true
+  return request.defaults(options)
+}
+
+request.get = request
+request.post = function (uri, options, callback) {
+  var params = initParams(uri, options, callback)
+  params.options.method = 'POST'
+  return request(params.uri || null, params.options, params.callback)
+}
+request.put = function (uri, options, callback) {
+  var params = initParams(uri, options, callback)
+  params.options.method = 'PUT'
+  return request(params.uri || null, params.options, params.callback)
+}
+request.patch = function (uri, options, callback) {
+  var params = initParams(uri, options, callback)
+  params.options.method = 'PATCH'
+  return request(params.uri || null, params.options, params.callback)
+}
+request.head = function (uri, options, callback) {
+  var params = initParams(uri, options, callback)
+  params.options.method = 'HEAD'
+  if (params.options.body ||
+      params.options.requestBodyStream ||
+      (params.options.json && typeof params.options.json !== 'boolean') ||
+      params.options.multipart) {
+    throw new Error("HTTP HEAD requests MUST NOT include a request body.")
+  }
+  return request(params.uri || null, params.options, params.callback)
+}
+request.del = function (uri, options, callback) {
+  var params = initParams(uri, options, callback)
+  params.options.method = 'DELETE'
+  if(typeof params.options._requester === 'function') {
+    request = params.options._requester
+  }
+  return request(params.uri || null, params.options, params.callback)
+}
+request.jar = function () {
+  return new CookieJar
+}
+request.cookie = function (str) {
+  if (str && str.uri) str = str.uri
+  if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param")
+  return new Cookie(str)
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/copy.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/copy.js
new file mode 100755 (executable)
index 0000000..56831ff
--- /dev/null
@@ -0,0 +1,8 @@
+module.exports =
+function copy (obj) {
+  var o = {}
+  Object.keys(obj).forEach(function (i) {
+    o[i] = obj[i]
+  })
+  return o
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/debug.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/debug.js
new file mode 100755 (executable)
index 0000000..462259f
--- /dev/null
@@ -0,0 +1,5 @@
+module.exports =
+function debug () {
+  if (/\brequest\b/.test(process.env.NODE_DEBUG))
+    console.error('REQUEST %s', util.format.apply(util, arguments))
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/getSafe.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/lib/getSafe.js
new file mode 100755 (executable)
index 0000000..28e07ea
--- /dev/null
@@ -0,0 +1,34 @@
+// Safe toJSON
+module.exports =
+function getSafe (self, uuid) {
+  if (typeof self === 'object' || typeof self === 'function') var safe = {}
+  if (Array.isArray(self)) var safe = []
+
+  var recurse = []
+
+  Object.defineProperty(self, uuid, {})
+
+  var attrs = Object.keys(self).filter(function (i) {
+    if (i === uuid) return false
+    if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true
+    return !(Object.getOwnPropertyDescriptor(self[i], uuid))
+  })
+
+
+  for (var i=0;i<attrs.length;i++) {
+    if ( (typeof self[attrs[i]] !== 'object' && typeof self[attrs[i]] !== 'function') ||
+          self[attrs[i]] === null
+        ) {
+      safe[attrs[i]] = self[attrs[i]]
+    } else {
+      recurse.push(attrs[i])
+      Object.defineProperty(self[attrs[i]], uuid, {})
+    }
+  }
+
+  for (var i=0;i<recurse.length;i++) {
+    safe[recurse[i]] = getSafe(self[recurse[i]], uuid)
+  }
+
+  return safe
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/LICENSE
new file mode 100755 (executable)
index 0000000..a4a9aee
--- /dev/null
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/README.md
new file mode 100755 (executable)
index 0000000..763564e
--- /dev/null
@@ -0,0 +1,4 @@
+aws-sign
+========
+
+AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/index.js
new file mode 100755 (executable)
index 0000000..d3c705c
--- /dev/null
@@ -0,0 +1,202 @@
+
+/*!
+ * knox - auth
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var crypto = require('crypto')
+  , parse = require('url').parse
+  ;
+
+/**
+ * Valid keys.
+ */
+
+var keys = 
+  [ 'acl'
+  , 'location'
+  , 'logging'
+  , 'notification'
+  , 'partNumber'
+  , 'policy'
+  , 'requestPayment'
+  , 'torrent'
+  , 'uploadId'
+  , 'uploads'
+  , 'versionId'
+  , 'versioning'
+  , 'versions'
+  , 'website'
+  ]
+
+/**
+ * Return an "Authorization" header value with the given `options`
+ * in the form of "AWS <key>:<signature>"
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function authorization (options) {
+  return 'AWS ' + options.key + ':' + sign(options)
+}
+
+module.exports = authorization
+module.exports.authorization = authorization
+
+/**
+ * Simple HMAC-SHA1 Wrapper
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */ 
+
+function hmacSha1 (options) {
+  return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64')
+}
+
+module.exports.hmacSha1 = hmacSha1
+
+/**
+ * Create a base64 sha1 HMAC for `options`. 
+ * 
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function sign (options) {
+  options.message = stringToSign(options)
+  return hmacSha1(options)
+}
+module.exports.sign = sign
+
+/**
+ * Create a base64 sha1 HMAC for `options`. 
+ *
+ * Specifically to be used with S3 presigned URLs
+ * 
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function signQuery (options) {
+  options.message = queryStringToSign(options)
+  return hmacSha1(options)
+}
+module.exports.signQuery= signQuery
+
+/**
+ * Return a string for sign() with the given `options`.
+ *
+ * Spec:
+ * 
+ *    <verb>\n
+ *    <md5>\n
+ *    <content-type>\n
+ *    <date>\n
+ *    [headers\n]
+ *    <resource>
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function stringToSign (options) {
+  var headers = options.amazonHeaders || ''
+  if (headers) headers += '\n'
+  var r = 
+    [ options.verb
+    , options.md5
+    , options.contentType
+    , options.date.toUTCString()
+    , headers + options.resource
+    ]
+  return r.join('\n')
+}
+module.exports.queryStringToSign = stringToSign
+
+/**
+ * Return a string for sign() with the given `options`, but is meant exclusively
+ * for S3 presigned URLs
+ *
+ * Spec:
+ * 
+ *    <date>\n
+ *    <resource>
+ *
+ * @param {Object} options
+ * @return {String}
+ * @api private
+ */
+
+function queryStringToSign (options){
+  return 'GET\n\n\n' + options.date + '\n' + options.resource
+}
+module.exports.queryStringToSign = queryStringToSign
+
+/**
+ * Perform the following:
+ *
+ *  - ignore non-amazon headers
+ *  - lowercase fields
+ *  - sort lexicographically
+ *  - trim whitespace between ":"
+ *  - join with newline
+ *
+ * @param {Object} headers
+ * @return {String}
+ * @api private
+ */
+
+function canonicalizeHeaders (headers) {
+  var buf = []
+    , fields = Object.keys(headers)
+    ;
+  for (var i = 0, len = fields.length; i < len; ++i) {
+    var field = fields[i]
+      , val = headers[field]
+      , field = field.toLowerCase()
+      ;
+    if (0 !== field.indexOf('x-amz')) continue
+    buf.push(field + ':' + val)
+  }
+  return buf.sort().join('\n')
+}
+module.exports.canonicalizeHeaders = canonicalizeHeaders
+
+/**
+ * Perform the following:
+ *
+ *  - ignore non sub-resources
+ *  - sort lexicographically
+ *
+ * @param {String} resource
+ * @return {String}
+ * @api private
+ */
+
+function canonicalizeResource (resource) {
+  var url = parse(resource, true)
+    , path = url.pathname
+    , buf = []
+    ;
+
+  Object.keys(url.query).forEach(function(key){
+    if (!~keys.indexOf(key)) return
+    var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key])
+    buf.push(key + val)
+  })
+
+  return path + (buf.length ? '?' + buf.sort().join('&') : '')
+}
+module.exports.canonicalizeResource = canonicalizeResource
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/aws-sign/package.json
new file mode 100755 (executable)
index 0000000..ea2c190
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "author": {
+    "name": "Mikeal Rogers",
+    "email": "mikeal.rogers@gmail.com",
+    "url": "http://www.futurealoof.com"
+  },
+  "name": "aws-sign",
+  "description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.",
+  "version": "0.3.0",
+  "repository": {
+    "url": "https://github.com/mikeal/aws-sign"
+  },
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {},
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_id": "aws-sign@0.3.0",
+  "dist": {
+    "shasum": "3d81ca69b474b1e16518728b51c24ff0bbedc6e9",
+    "tarball": "http://registry.npmjs.org/aws-sign/-/aws-sign-0.3.0.tgz"
+  },
+  "_from": "aws-sign@~0.3.0",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "mikeal",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "egorfine",
+      "email": "me@egorfine.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "3d81ca69b474b1e16518728b51c24ff0bbedc6e9",
+  "_resolved": "https://registry.npmjs.org/aws-sign/-/aws-sign-0.3.0.tgz",
+  "bugs": {
+    "url": "https://github.com/mikeal/aws-sign/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mikeal/aws-sign"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/LICENSE
new file mode 100755 (executable)
index 0000000..a4a9aee
--- /dev/null
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/README.md
new file mode 100755 (executable)
index 0000000..bcd8f8d
--- /dev/null
@@ -0,0 +1,4 @@
+cookie-jar
+==========
+
+Cookie Jar. Originally pulled from LearnBoost/tobi, maintained as vendor in request, now a standalone module.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/index.js
new file mode 100755 (executable)
index 0000000..7d54d94
--- /dev/null
@@ -0,0 +1,67 @@
+/*!
+ * Tobi - Cookie
+ * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+var url = require('url');
+
+/**
+ * Initialize a new `Cookie` with the given cookie `str` and `req`.
+ *
+ * @param {String} str
+ * @param {IncomingRequest} req
+ * @api private
+ */
+
+var Cookie = exports = module.exports = function Cookie(str, req) {
+  this.str = str;
+
+  // Map the key/val pairs
+  str.split(/ *; */).reduce(function(obj, pair){
+   var p = pair.indexOf('=');
+   var key = p > 0 ? pair.substring(0, p).trim() : pair.trim();
+   var lowerCasedKey = key.toLowerCase();
+   var value = p > 0 ? pair.substring(p + 1).trim() : true;
+
+   if (!obj.name) {
+    // First key is the name
+    obj.name = key;
+    obj.value = value;
+   }
+   else if (lowerCasedKey === 'httponly') {
+    obj.httpOnly = value;
+   }
+   else {
+    obj[lowerCasedKey] = value;
+   }
+   return obj;
+  }, this);
+
+  // Expires
+  this.expires = this.expires
+    ? new Date(this.expires)
+    : Infinity;
+
+  // Default or trim path
+  this.path = this.path
+    ? this.path.trim(): req 
+    ? url.parse(req.url).pathname: '/';
+};
+
+/**
+ * Return the original cookie string.
+ *
+ * @return {String}
+ * @api public
+ */
+
+Cookie.prototype.toString = function(){
+  return this.str;
+};
+
+module.exports.Jar = require('./jar')
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/jar.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/jar.js
new file mode 100755 (executable)
index 0000000..34920e0
--- /dev/null
@@ -0,0 +1,72 @@
+/*!
+* Tobi - CookieJar
+* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
+* MIT Licensed
+*/
+
+/**
+* Module dependencies.
+*/
+
+var url = require('url');
+
+/**
+* Initialize a new `CookieJar`.
+*
+* @api private
+*/
+
+var CookieJar = exports = module.exports = function CookieJar() {
+  this.cookies = [];
+};
+
+/**
+* Add the given `cookie` to the jar.
+*
+* @param {Cookie} cookie
+* @api private
+*/
+
+CookieJar.prototype.add = function(cookie){
+  this.cookies = this.cookies.filter(function(c){
+    // Avoid duplication (same path, same name)
+    return !(c.name == cookie.name && c.path == cookie.path);
+  });
+  this.cookies.push(cookie);
+};
+
+/**
+* Get cookies for the given `req`.
+*
+* @param {IncomingRequest} req
+* @return {Array}
+* @api private
+*/
+
+CookieJar.prototype.get = function(req){
+  var path = url.parse(req.url).pathname
+    , now = new Date
+    , specificity = {};
+  return this.cookies.filter(function(cookie){
+    if (0 == path.indexOf(cookie.path) && now < cookie.expires
+      && cookie.path.length > (specificity[cookie.name] || 0))
+      return specificity[cookie.name] = cookie.path.length;
+  });
+};
+
+/**
+* Return Cookie string for the given `req`.
+*
+* @param {IncomingRequest} req
+* @return {String}
+* @api private
+*/
+
+CookieJar.prototype.cookieString = function(req){
+  var cookies = this.get(req);
+  if (cookies.length) {
+    return cookies.map(function(cookie){
+      return cookie.name + '=' + cookie.value;
+    }).join('; ');
+  }
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/package.json
new file mode 100755 (executable)
index 0000000..2902a9e
--- /dev/null
@@ -0,0 +1,48 @@
+{
+  "author": {
+    "name": "Mikeal Rogers",
+    "email": "mikeal.rogers@gmail.com",
+    "url": "http://www.futurealoof.com"
+  },
+  "name": "cookie-jar",
+  "description": "Cookie Jar. Originally pulled form tobi, maintained as vendor in request, now a standalone module.",
+  "version": "0.3.0",
+  "repository": {
+    "url": "https://github.com/mikeal/cookie-jar"
+  },
+  "main": "index.js",
+  "scripts": {
+    "test": "node tests/run.js"
+  },
+  "dependencies": {},
+  "devDependencies": {},
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_id": "cookie-jar@0.3.0",
+  "dist": {
+    "shasum": "bc9a27d4e2b97e186cd57c9e2063cb99fa68cccc",
+    "tarball": "http://registry.npmjs.org/cookie-jar/-/cookie-jar-0.3.0.tgz"
+  },
+  "_from": "cookie-jar@~0.3.0",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "mikeal",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mikeal",
+      "email": "mikeal.rogers@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "bc9a27d4e2b97e186cd57c9e2063cb99fa68cccc",
+  "_resolved": "https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.3.0.tgz",
+  "bugs": {
+    "url": "https://github.com/mikeal/cookie-jar/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mikeal/cookie-jar"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/run.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/run.js
new file mode 100755 (executable)
index 0000000..e717f02
--- /dev/null
@@ -0,0 +1,40 @@
+var spawn = require('child_process').spawn
+  , exitCode = 0
+  , timeout = 10000
+  , fs = require('fs')
+  ;
+
+fs.readdir(__dirname, function (e, files) {
+  if (e) throw e
+
+  var tests = files.filter(function (f) {return f.slice(0, 'test-'.length) === 'test-'})
+
+  var next = function () {
+    if (tests.length === 0) process.exit(exitCode);
+
+    var file = tests.shift()
+    console.log(file)
+    var proc = spawn('node', [ 'tests/' + file ])
+
+    var killed = false
+    var t = setTimeout(function () {
+      proc.kill()
+      exitCode += 1
+      console.error(file + ' timeout')
+      killed = true
+    }, timeout)
+
+    proc.stdout.pipe(process.stdout)
+    proc.stderr.pipe(process.stderr)
+    proc.on('exit', function (code) {
+      if (code && !killed) console.error(file + ' failed')
+      exitCode += code || 0
+      clearTimeout(t)
+      next()
+    })
+  }
+  next()
+    
+})
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/test-cookie.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/test-cookie.js
new file mode 100755 (executable)
index 0000000..2cdc835
--- /dev/null
@@ -0,0 +1,29 @@
+var Cookie = require('../index')
+  , assert = require('assert');
+
+var str = 'Sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; Path=/; httpOnly; Expires=Sat, 04 Dec 2010 23:27:28 GMT';
+var cookie = new Cookie(str);
+
+// test .toString()
+assert.equal(cookie.toString(), str);
+
+// test .path
+assert.equal(cookie.path, '/');
+
+// test .httpOnly
+assert.equal(cookie.httpOnly, true);
+
+// test .name
+assert.equal(cookie.name, 'Sid');
+
+// test .value
+assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="');
+
+// test .expires
+assert.equal(cookie.expires instanceof Date, true);
+
+// test .path default
+var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' });
+assert.equal(cookie.path, '/bar');
+
+console.log('All tests passed');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/test-cookiejar.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/cookie-jar/tests/test-cookiejar.js
new file mode 100755 (executable)
index 0000000..a33cfb2
--- /dev/null
@@ -0,0 +1,90 @@
+var Cookie = require('../index')
+  , Jar = Cookie.Jar
+  , assert = require('assert');
+
+function expires(ms) {
+  return new Date(Date.now() + ms).toUTCString();
+}
+
+// test .get() expiration
+(function() {
+  var jar = new Jar;
+  var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000));
+  jar.add(cookie);
+  setTimeout(function(){
+    var cookies = jar.get({ url: 'http://foo.com/foo' });
+    assert.equal(cookies.length, 1);
+    assert.equal(cookies[0], cookie);
+    setTimeout(function(){
+      var cookies = jar.get({ url: 'http://foo.com/foo' });
+      assert.equal(cookies.length, 0);
+    }, 1000);
+  }, 5);
+})();
+
+// test .get() path support
+(function() {
+  var jar = new Jar;
+  var a = new Cookie('sid=1234; path=/');
+  var b = new Cookie('sid=1111; path=/foo/bar');
+  var c = new Cookie('sid=2222; path=/');
+  jar.add(a);
+  jar.add(b);
+  jar.add(c);
+
+  // should remove the duplicates
+  assert.equal(jar.cookies.length, 2);
+
+  // same name, same path, latter prevails
+  var cookies = jar.get({ url: 'http://foo.com/' });
+  assert.equal(cookies.length, 1);
+  assert.equal(cookies[0], c);
+
+  // same name, diff path, path specifity prevails, latter prevails
+  var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
+  assert.equal(cookies.length, 1);
+  assert.equal(cookies[0], b);
+
+  var jar = new Jar;
+  var a = new Cookie('sid=1111; path=/foo/bar');
+  var b = new Cookie('sid=1234; path=/');
+  jar.add(a);
+  jar.add(b);
+
+  var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
+  assert.equal(cookies.length, 1);
+  assert.equal(cookies[0], a);
+
+  var cookies = jar.get({ url: 'http://foo.com/' });
+  assert.equal(cookies.length, 1);
+  assert.equal(cookies[0], b);
+
+  var jar = new Jar;
+  var a = new Cookie('sid=1111; path=/foo/bar');
+  var b = new Cookie('sid=3333; path=/foo/bar');
+  var c = new Cookie('pid=3333; path=/foo/bar');
+  var d = new Cookie('sid=2222; path=/foo/');
+  var e = new Cookie('sid=1234; path=/');
+  jar.add(a);
+  jar.add(b);
+  jar.add(c);
+  jar.add(d);
+  jar.add(e);
+
+  var cookies = jar.get({ url: 'http://foo.com/foo/bar' });
+  assert.equal(cookies.length, 2);
+  assert.equal(cookies[0], b);
+  assert.equal(cookies[1], c);
+
+  var cookies = jar.get({ url: 'http://foo.com/foo/' });
+  assert.equal(cookies.length, 1);
+  assert.equal(cookies[0], d);
+
+  var cookies = jar.get({ url: 'http://foo.com/' });
+  assert.equal(cookies.length, 1);
+  assert.equal(cookies[0], e);
+})();
+
+setTimeout(function() {
+  console.log('All tests passed');
+}, 1200);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/LICENSE
new file mode 100755 (executable)
index 0000000..a4a9aee
--- /dev/null
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/README.md
new file mode 100755 (executable)
index 0000000..9d5b663
--- /dev/null
@@ -0,0 +1,4 @@
+forever-agent
+=============
+
+HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/index.js
new file mode 100755 (executable)
index 0000000..1e8efcd
--- /dev/null
@@ -0,0 +1,119 @@
+module.exports = ForeverAgent
+ForeverAgent.SSL = ForeverAgentSSL
+
+var util = require('util')
+  , Agent = require('http').Agent
+  , net = require('net')
+  , tls = require('tls')
+  , AgentSSL = require('https').Agent
+
+function ForeverAgent(options) {
+  var self = this
+  self.options = options || {}
+  self.requests = {}
+  self.sockets = {}
+  self.freeSockets = {}
+  self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets
+  self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets
+  self.on('free', function(socket, host, port) {
+    var name = host + ':' + port
+    if (self.requests[name] && self.requests[name].length) {
+      self.requests[name].shift().onSocket(socket)
+    } else if (self.sockets[name].length < self.minSockets) {
+      if (!self.freeSockets[name]) self.freeSockets[name] = []
+      self.freeSockets[name].push(socket)
+      
+      // if an error happens while we don't use the socket anyway, meh, throw the socket away
+      var onIdleError = function() {
+        socket.destroy()
+      }
+      socket._onIdleError = onIdleError
+      socket.on('error', onIdleError)
+    } else {
+      // If there are no pending requests just destroy the
+      // socket and it will get removed from the pool. This
+      // gets us out of timeout issues and allows us to
+      // default to Connection:keep-alive.
+      socket.destroy()
+    }
+  })
+
+}
+util.inherits(ForeverAgent, Agent)
+
+ForeverAgent.defaultMinSockets = 5
+
+
+ForeverAgent.prototype.createConnection = net.createConnection
+ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest
+ForeverAgent.prototype.addRequest = function(req, host, port) {
+  var name = host + ':' + port
+  if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) {
+    var idleSocket = this.freeSockets[name].pop()
+    idleSocket.removeListener('error', idleSocket._onIdleError)
+    delete idleSocket._onIdleError
+    req._reusedSocket = true
+    req.onSocket(idleSocket)
+  } else {
+    this.addRequestNoreuse(req, host, port)
+  }
+}
+
+ForeverAgent.prototype.removeSocket = function(s, name, host, port) {
+  if (this.sockets[name]) {
+    var index = this.sockets[name].indexOf(s)
+    if (index !== -1) {
+      this.sockets[name].splice(index, 1)
+    }
+  } else if (this.sockets[name] && this.sockets[name].length === 0) {
+    // don't leak
+    delete this.sockets[name]
+    delete this.requests[name]
+  }
+  
+  if (this.freeSockets[name]) {
+    var index = this.freeSockets[name].indexOf(s)
+    if (index !== -1) {
+      this.freeSockets[name].splice(index, 1)
+      if (this.freeSockets[name].length === 0) {
+        delete this.freeSockets[name]
+      }
+    }
+  }
+
+  if (this.requests[name] && this.requests[name].length) {
+    // If we have pending requests and a socket gets closed a new one
+    // needs to be created to take over in the pool for the one that closed.
+    this.createSocket(name, host, port).emit('free')
+  }
+}
+
+function ForeverAgentSSL (options) {
+  ForeverAgent.call(this, options)
+}
+util.inherits(ForeverAgentSSL, ForeverAgent)
+
+ForeverAgentSSL.prototype.createConnection = createConnectionSSL
+ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest
+
+function createConnectionSSL (port, host, options) {
+  if (typeof port === 'object') {
+    options = port;
+  } else if (typeof host === 'object') {
+    options = host;
+  } else if (typeof options === 'object') {
+    options = options;
+  } else {
+    options = {};
+  }
+
+  if (typeof port === 'number') {
+    options.port = port;
+  }
+
+  if (typeof host === 'string') {
+    options.host = host;
+  }
+
+  return tls.connect(options);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/forever-agent/package.json
new file mode 100755 (executable)
index 0000000..110a36f
--- /dev/null
@@ -0,0 +1,46 @@
+{
+  "author": {
+    "name": "Mikeal Rogers",
+    "email": "mikeal.rogers@gmail.com",
+    "url": "http://www.futurealoof.com"
+  },
+  "name": "forever-agent",
+  "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.",
+  "version": "0.5.2",
+  "repository": {
+    "url": "https://github.com/mikeal/forever-agent"
+  },
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {},
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "bugs": {
+    "url": "https://github.com/mikeal/forever-agent/issues"
+  },
+  "homepage": "https://github.com/mikeal/forever-agent",
+  "_id": "forever-agent@0.5.2",
+  "dist": {
+    "shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130",
+    "tarball": "http://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz"
+  },
+  "_from": "forever-agent@~0.5.0",
+  "_npmVersion": "1.3.21",
+  "_npmUser": {
+    "name": "mikeal",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mikeal",
+      "email": "mikeal.rogers@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130",
+  "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz",
+  "readme": "ERROR: No README data found!",
+  "scripts": {}
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/License b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/License
new file mode 100755 (executable)
index 0000000..c7ff12a
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
+
+ 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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/Readme.md
new file mode 100755 (executable)
index 0000000..c8a1a55
--- /dev/null
@@ -0,0 +1,175 @@
+# Form-Data [![Build Status](https://travis-ci.org/felixge/node-form-data.png?branch=master)](https://travis-ci.org/felixge/node-form-data) [![Dependency Status](https://gemnasium.com/felixge/node-form-data.png)](https://gemnasium.com/felixge/node-form-data)
+
+A module to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
+
+The API of this module is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
+
+[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
+[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions
+
+## Install
+
+```
+npm install form-data
+```
+
+## Usage
+
+In this example we are constructing a form with 3 fields that contain a string,
+a buffer and a file stream.
+
+``` javascript
+var FormData = require('form-data');
+var fs = require('fs');
+
+var form = new FormData();
+form.append('my_field', 'my value');
+form.append('my_buffer', new Buffer(10));
+form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
+```
+
+Also you can use http-response stream:
+
+``` javascript
+var FormData = require('form-data');
+var http = require('http');
+
+var form = new FormData();
+
+http.request('http://nodejs.org/images/logo.png', function(response) {
+  form.append('my_field', 'my value');
+  form.append('my_buffer', new Buffer(10));
+  form.append('my_logo', response);
+});
+```
+
+Or @mikeal's request stream:
+
+``` javascript
+var FormData = require('form-data');
+var request = require('request');
+
+var form = new FormData();
+
+form.append('my_field', 'my value');
+form.append('my_buffer', new Buffer(10));
+form.append('my_logo', request('http://nodejs.org/images/logo.png'));
+```
+
+In order to submit this form to a web application, call ```submit(url, [callback])``` method:
+
+``` javascript
+form.submit('http://example.org/', function(err, res) {
+  // res – response object (http.IncomingMessage)  //
+  res.resume(); // for node-0.10.x
+});
+
+```
+
+For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
+
+### Alternative submission methods
+
+You can use node's http client interface:
+
+``` javascript
+var http = require('http');
+
+var request = http.request({
+  method: 'post',
+  host: 'example.org',
+  path: '/upload',
+  headers: form.getHeaders()
+});
+
+form.pipe(request);
+
+request.on('response', function(res) {
+  console.log(res.statusCode);
+});
+```
+
+Or if you would prefer the `'Content-Length'` header to be set for you:
+
+``` javascript
+form.submit('example.org/upload', function(err, res) {
+  console.log(res.statusCode);
+});
+```
+
+To use custom headers and pre-known length in parts:
+
+``` javascript
+var CRLF = '\r\n';
+var form = new FormData();
+
+var options = {
+  header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
+  knownLength: 1
+};
+
+form.append('my_buffer', buffer, options);
+
+form.submit('http://example.com/', function(err, res) {
+  if (err) throw err;
+  console.log('Done');
+});
+```
+
+Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
+
+``` javascript
+someModule.stream(function(err, stdout, stderr) {
+  if (err) throw err;
+
+  var form = new FormData();
+
+  form.append('file', stdout, {
+    filename: 'unicycle.jpg',
+    contentType: 'image/jpg',
+    knownLength: 19806
+  });
+
+  form.submit('http://example.com/', function(err, res) {
+    if (err) throw err;
+    console.log('Done');
+  });
+});
+```
+
+For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
+
+``` javascript
+form.submit({
+  host: 'example.com',
+  path: '/probably.php?extra=params',
+  auth: 'username:password'
+}, function(err, res) {
+  console.log(res.statusCode);
+});
+```
+
+In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
+
+``` javascript
+form.submit({
+  host: 'example.com',
+  path: '/surelynot.php',
+  headers: {'x-test-header': 'test-header-value'}
+}, function(err, res) {
+  console.log(res.statusCode);
+});
+```
+
+## Notes
+
+- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
+- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing]
+
+## TODO
+
+- Add new streams (0.10) support and try really hard not to break it for 0.8.x.
+
+## License
+
+Form-Data is licensed under the MIT license.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/lib/form_data.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/lib/form_data.js
new file mode 100755 (executable)
index 0000000..b8bd158
--- /dev/null
@@ -0,0 +1,351 @@
+var CombinedStream = require('combined-stream');
+var util = require('util');
+var path = require('path');
+var http = require('http');
+var https = require('https');
+var parseUrl = require('url').parse;
+var fs = require('fs');
+var mime = require('mime');
+var async = require('async');
+
+module.exports = FormData;
+function FormData() {
+  this._overheadLength = 0;
+  this._valueLength = 0;
+  this._lengthRetrievers = [];
+
+  CombinedStream.call(this);
+}
+util.inherits(FormData, CombinedStream);
+
+FormData.LINE_BREAK = '\r\n';
+
+FormData.prototype.append = function(field, value, options) {
+  options = options || {};
+
+  var append = CombinedStream.prototype.append.bind(this);
+
+  // all that streamy business can't handle numbers
+  if (typeof value == 'number') value = ''+value;
+
+  // https://github.com/felixge/node-form-data/issues/38
+  if (util.isArray(value)) {
+    // Please convert your array into string
+    // the way web server expects it
+    this._error(new Error('Arrays are not supported.'));
+    return;
+  }
+
+  var header = this._multiPartHeader(field, value, options);
+  var footer = this._multiPartFooter(field, value, options);
+
+  append(header);
+  append(value);
+  append(footer);
+
+  // pass along options.knownLength
+  this._trackLength(header, value, options);
+};
+
+FormData.prototype._trackLength = function(header, value, options) {
+  var valueLength = 0;
+
+  // used w/ getLengthSync(), when length is known.
+  // e.g. for streaming directly from a remote server,
+  // w/ a known file a size, and not wanting to wait for
+  // incoming file to finish to get its size.
+  if (options.knownLength != null) {
+    valueLength += +options.knownLength;
+  } else if (Buffer.isBuffer(value)) {
+    valueLength = value.length;
+  } else if (typeof value === 'string') {
+    valueLength = Buffer.byteLength(value);
+  }
+
+  this._valueLength += valueLength;
+
+  // @check why add CRLF? does this account for custom/multiple CRLFs?
+  this._overheadLength +=
+    Buffer.byteLength(header) +
+    + FormData.LINE_BREAK.length;
+
+  // empty or either doesn't have path or not an http response
+  if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
+    return;
+  }
+
+  // no need to bother with the length
+  if (!options.knownLength)
+  this._lengthRetrievers.push(function(next) {
+
+    if (value.hasOwnProperty('fd')) {
+
+      // take read range into a account
+      // `end` = Infinity –> read file till the end
+      //
+      // TODO: Looks like there is bug in Node fs.createReadStream
+      // it doesn't respect `end` options without `start` options
+      // Fix it when node fixes it.
+      // https://github.com/joyent/node/issues/7819
+      if (value.end != undefined && value.end != Infinity && value.start != undefined) {
+
+        // when end specified
+        // no need to calculate range
+        // inclusive, starts with 0
+        next(null, value.end+1 - (value.start ? value.start : 0));
+
+      // not that fast snoopy
+      } else {
+        // still need to fetch file size from fs
+        fs.stat(value.path, function(err, stat) {
+
+          var fileSize;
+
+          if (err) {
+            next(err);
+            return;
+          }
+
+          // update final size based on the range options
+          fileSize = stat.size - (value.start ? value.start : 0);
+          next(null, fileSize);
+        });
+      }
+
+    // or http response
+    } else if (value.hasOwnProperty('httpVersion')) {
+      next(null, +value.headers['content-length']);
+
+    // or request stream http://github.com/mikeal/request
+    } else if (value.hasOwnProperty('httpModule')) {
+      // wait till response come back
+      value.on('response', function(response) {
+        value.pause();
+        next(null, +response.headers['content-length']);
+      });
+      value.resume();
+
+    // something else
+    } else {
+      next('Unknown stream');
+    }
+  });
+};
+
+FormData.prototype._multiPartHeader = function(field, value, options) {
+  var boundary = this.getBoundary();
+  var header = '';
+
+  // custom header specified (as string)?
+  // it becomes responsible for boundary
+  // (e.g. to handle extra CRLFs on .NET servers)
+  if (options.header != null) {
+    header = options.header;
+  } else {
+    header += '--' + boundary + FormData.LINE_BREAK +
+      'Content-Disposition: form-data; name="' + field + '"';
+
+    // fs- and request- streams have path property
+    // or use custom filename and/or contentType
+    // TODO: Use request's response mime-type
+    if (options.filename || value.path) {
+      header +=
+        '; filename="' + path.basename(options.filename || value.path) + '"' + FormData.LINE_BREAK +
+        'Content-Type: ' +  (options.contentType || mime.lookup(options.filename || value.path));
+
+    // http response has not
+    } else if (value.readable && value.hasOwnProperty('httpVersion')) {
+      header +=
+        '; filename="' + path.basename(value.client._httpMessage.path) + '"' + FormData.LINE_BREAK +
+        'Content-Type: ' + value.headers['content-type'];
+    }
+
+    header += FormData.LINE_BREAK + FormData.LINE_BREAK;
+  }
+
+  return header;
+};
+
+FormData.prototype._multiPartFooter = function(field, value, options) {
+  return function(next) {
+    var footer = FormData.LINE_BREAK;
+
+    var lastPart = (this._streams.length === 0);
+    if (lastPart) {
+      footer += this._lastBoundary();
+    }
+
+    next(footer);
+  }.bind(this);
+};
+
+FormData.prototype._lastBoundary = function() {
+  return '--' + this.getBoundary() + '--';
+};
+
+FormData.prototype.getHeaders = function(userHeaders) {
+  var formHeaders = {
+    'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
+  };
+
+  for (var header in userHeaders) {
+    formHeaders[header.toLowerCase()] = userHeaders[header];
+  }
+
+  return formHeaders;
+}
+
+FormData.prototype.getCustomHeaders = function(contentType) {
+    contentType = contentType ? contentType : 'multipart/form-data';
+
+    var formHeaders = {
+        'content-type': contentType + '; boundary=' + this.getBoundary(),
+        'content-length': this.getLengthSync()
+    };
+
+    return formHeaders;
+}
+
+FormData.prototype.getBoundary = function() {
+  if (!this._boundary) {
+    this._generateBoundary();
+  }
+
+  return this._boundary;
+};
+
+FormData.prototype._generateBoundary = function() {
+  // This generates a 50 character boundary similar to those used by Firefox.
+  // They are optimized for boyer-moore parsing.
+  var boundary = '--------------------------';
+  for (var i = 0; i < 24; i++) {
+    boundary += Math.floor(Math.random() * 10).toString(16);
+  }
+
+  this._boundary = boundary;
+};
+
+// Note: getLengthSync DOESN'T calculate streams length
+// As workaround one can calculate file size manually
+// and add it as knownLength option
+FormData.prototype.getLengthSync = function(debug) {
+  var knownLength = this._overheadLength + this._valueLength;
+
+  // Don't get confused, there are 3 "internal" streams for each keyval pair
+  // so it basically checks if there is any value added to the form
+  if (this._streams.length) {
+    knownLength += this._lastBoundary().length;
+  }
+
+  // https://github.com/felixge/node-form-data/issues/40
+  if (this._lengthRetrievers.length) {
+    // Some async length retrivers are present
+    // therefore synchronous length calculation is false.
+    // Please use getLength(callback) to get proper length
+    this._error(new Error('Cannot calculate proper length in synchronous way.'));
+  }
+
+  return knownLength;
+};
+
+FormData.prototype.getLength = function(cb) {
+  var knownLength = this._overheadLength + this._valueLength;
+
+  if (this._streams.length) {
+    knownLength += this._lastBoundary().length;
+  }
+
+  if (!this._lengthRetrievers.length) {
+    process.nextTick(cb.bind(this, null, knownLength));
+    return;
+  }
+
+  async.parallel(this._lengthRetrievers, function(err, values) {
+    if (err) {
+      cb(err);
+      return;
+    }
+
+    values.forEach(function(length) {
+      knownLength += length;
+    });
+
+    cb(null, knownLength);
+  });
+};
+
+FormData.prototype.submit = function(params, cb) {
+
+  var request
+    , options
+    , defaults = {
+        method : 'post'
+    };
+
+  // parse provided url if it's string
+  // or treat it as options object
+  if (typeof params == 'string') {
+    params = parseUrl(params);
+
+    options = populate({
+      port: params.port,
+      path: params.pathname,
+      host: params.hostname
+    }, defaults);
+  }
+  else // use custom params
+  {
+    options = populate(params, defaults);
+    // if no port provided use default one
+    if (!options.port) {
+      options.port = options.protocol == 'https:' ? 443 : 80;
+    }
+  }
+
+  // put that good code in getHeaders to some use
+  options.headers = this.getHeaders(params.headers);
+
+  // https if specified, fallback to http in any other case
+  if (params.protocol == 'https:') {
+    request = https.request(options);
+  } else {
+    request = http.request(options);
+  }
+
+  // get content length and fire away
+  this.getLength(function(err, length) {
+
+    // TODO: Add chunked encoding when no length (if err)
+
+    // add content length
+    request.setHeader('Content-Length', length);
+
+    this.pipe(request);
+    if (cb) {
+      request.on('error', cb);
+      request.on('response', cb.bind(this, null));
+    }
+  }.bind(this));
+
+  return request;
+};
+
+FormData.prototype._error = function(err) {
+  if (this.error) return;
+
+  this.error = err;
+  this.pause();
+  this.emit('error', err);
+};
+
+/*
+ * Santa's little helpers
+ */
+
+// populates missing values
+function populate(dst, src) {
+  for (var prop in src) {
+    if (!dst[prop]) dst[prop] = src[prop];
+  }
+  return dst;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/LICENSE
new file mode 100755 (executable)
index 0000000..8f29698
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2010-2014 Caolan McMahon
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/README.md
new file mode 100755 (executable)
index 0000000..0bea531
--- /dev/null
@@ -0,0 +1,1646 @@
+# Async.js
+
+[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)
+
+
+Async is a utility module which provides straight-forward, powerful functions
+for working with asynchronous JavaScript. Although originally designed for
+use with [Node.js](http://nodejs.org), it can also be used directly in the
+browser. Also supports [component](https://github.com/component/component).
+
+Async provides around 20 functions that include the usual 'functional'
+suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns
+for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these
+functions assume you follow the Node.js convention of providing a single
+callback as the last argument of your `async` function.
+
+
+## Quick Examples
+
+```javascript
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+    // results is now an array of stats for each file
+});
+
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+    // results now equals an array of the existing files
+});
+
+async.parallel([
+    function(){ ... },
+    function(){ ... }
+], callback);
+
+async.series([
+    function(){ ... },
+    function(){ ... }
+]);
+```
+
+There are many more functions available so take a look at the docs below for a
+full list. This module aims to be comprehensive, so if you feel anything is
+missing please create a GitHub issue for it.
+
+## Common Pitfalls
+
+### Binding a context to an iterator
+
+This section is really about `bind`, not about `async`. If you are wondering how to
+make `async` execute your iterators in a given context, or are confused as to why
+a method of another library isn't working as an iterator, study this example:
+
+```js
+// Here is a simple object with an (unnecessarily roundabout) squaring method
+var AsyncSquaringLibrary = {
+  squareExponent: 2,
+  square: function(number, callback){ 
+    var result = Math.pow(number, this.squareExponent);
+    setTimeout(function(){
+      callback(null, result);
+    }, 200);
+  }
+};
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
+  // result is [NaN, NaN, NaN]
+  // This fails because the `this.squareExponent` expression in the square
+  // function is not evaluated in the context of AsyncSquaringLibrary, and is
+  // therefore undefined.
+});
+
+async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
+  // result is [1, 4, 9]
+  // With the help of bind we can attach a context to the iterator before
+  // passing it to async. Now the square function will be executed in its 
+  // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
+  // will be as expected.
+});
+```
+
+## Download
+
+The source is available for download from
+[GitHub](http://github.com/caolan/async).
+Alternatively, you can install using Node Package Manager (`npm`):
+
+    npm install async
+
+__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
+
+## In the Browser
+
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. 
+
+Usage:
+
+```html
+<script type="text/javascript" src="async.js"></script>
+<script type="text/javascript">
+
+    async.map(data, asyncProcess, function(err, results){
+        alert(results);
+    });
+
+</script>
+```
+
+## Documentation
+
+### Collections
+
+* [`each`](#each)
+* [`eachSeries`](#eachSeries)
+* [`eachLimit`](#eachLimit)
+* [`map`](#map)
+* [`mapSeries`](#mapSeries)
+* [`mapLimit`](#mapLimit)
+* [`filter`](#filter)
+* [`filterSeries`](#filterSeries)
+* [`reject`](#reject)
+* [`rejectSeries`](#rejectSeries)
+* [`reduce`](#reduce)
+* [`reduceRight`](#reduceRight)
+* [`detect`](#detect)
+* [`detectSeries`](#detectSeries)
+* [`sortBy`](#sortBy)
+* [`some`](#some)
+* [`every`](#every)
+* [`concat`](#concat)
+* [`concatSeries`](#concatSeries)
+
+### Control Flow
+
+* [`series`](#seriestasks-callback)
+* [`parallel`](#parallel)
+* [`parallelLimit`](#parallellimittasks-limit-callback)
+* [`whilst`](#whilst)
+* [`doWhilst`](#doWhilst)
+* [`until`](#until)
+* [`doUntil`](#doUntil)
+* [`forever`](#forever)
+* [`waterfall`](#waterfall)
+* [`compose`](#compose)
+* [`seq`](#seq)
+* [`applyEach`](#applyEach)
+* [`applyEachSeries`](#applyEachSeries)
+* [`queue`](#queue)
+* [`priorityQueue`](#priorityQueue)
+* [`cargo`](#cargo)
+* [`auto`](#auto)
+* [`retry`](#retry)
+* [`iterator`](#iterator)
+* [`apply`](#apply)
+* [`nextTick`](#nextTick)
+* [`times`](#times)
+* [`timesSeries`](#timesSeries)
+
+### Utils
+
+* [`memoize`](#memoize)
+* [`unmemoize`](#unmemoize)
+* [`log`](#log)
+* [`dir`](#dir)
+* [`noConflict`](#noConflict)
+
+
+## Collections
+
+<a name="forEach" />
+<a name="each" />
+### each(arr, iterator, callback)
+
+Applies the function `iterator` to each item in `arr`, in parallel.
+The `iterator` is called with an item from the list, and a callback for when it
+has finished. If the `iterator` passes an error to its `callback`, the main
+`callback` (for the `each` function) is immediately called with the error.
+
+Note, that since this function applies `iterator` to each item in parallel,
+there is no guarantee that the iterator functions will complete in order.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+  The iterator is passed a `callback(err)` which must be called once it has 
+  completed. If no error has occured, the `callback` should be run without 
+  arguments or with an explicit `null` argument.
+* `callback(err)` - A callback which is called when all `iterator` functions
+  have finished, or an error occurs.
+
+__Examples__
+
+
+```js
+// assuming openFiles is an array of file names and saveFile is a function
+// to save the modified contents of that file:
+
+async.each(openFiles, saveFile, function(err){
+    // if any of the saves produced an error, err would equal that error
+});
+```
+
+```js
+// assuming openFiles is an array of file names 
+
+async.each(openFiles, function( file, callback) {
+  
+  // Perform operation on file here.
+  console.log('Processing file ' + file);
+  
+  if( file.length > 32 ) {
+    console.log('This file name is too long');
+    callback('File name too long');
+  } else {
+    // Do work to process file here
+    console.log('File processed');
+    callback();
+  }
+}, function(err){
+    // if any of the file processing produced an error, err would equal that error
+    if( err ) {
+      // One of the iterations produced an error.
+      // All processing will now stop.
+      console.log('A file failed to process');
+    } else {
+      console.log('All files have been processed successfully');
+    }
+});
+```
+
+---------------------------------------
+
+<a name="forEachSeries" />
+<a name="eachSeries" />
+### eachSeries(arr, iterator, callback)
+
+The same as [`each`](#each), only `iterator` is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed. 
+This means the `iterator` functions will complete in order.
+
+
+---------------------------------------
+
+<a name="forEachLimit" />
+<a name="eachLimit" />
+### eachLimit(arr, limit, iterator, callback)
+
+The same as [`each`](#each), only no more than `limit` `iterator`s will be simultaneously 
+running at any time.
+
+Note that the items in `arr` are not processed in batches, so there is no guarantee that 
+the first `limit` `iterator` functions will complete before any others are started.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `limit` - The maximum number of `iterator`s to run at any time.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+  The iterator is passed a `callback(err)` which must be called once it has 
+  completed. If no error has occured, the callback should be run without 
+  arguments or with an explicit `null` argument.
+* `callback(err)` - A callback which is called when all `iterator` functions
+  have finished, or an error occurs.
+
+__Example__
+
+```js
+// Assume documents is an array of JSON objects and requestApi is a
+// function that interacts with a rate-limited REST api.
+
+async.eachLimit(documents, 20, requestApi, function(err){
+    // if any of the saves produced an error, err would equal that error
+});
+```
+
+---------------------------------------
+
+<a name="map" />
+### map(arr, iterator, callback)
+
+Produces a new array of values by mapping each value in `arr` through
+the `iterator` function. The `iterator` is called with an item from `arr` and a
+callback for when it has finished processing. Each of these callback takes 2 arguments: 
+an `error`, and the transformed item from `arr`. If `iterator` passes an error to this 
+callback, the main `callback` (for the `map` function) is immediately called with the error.
+
+Note, that since this function applies the `iterator` to each item in parallel,
+there is no guarantee that the `iterator` functions will complete in order. 
+However, the results array will be in the same order as the original `arr`.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+  The iterator is passed a `callback(err, transformed)` which must be called once 
+  it has completed with an error (which can be `null`) and a transformed item.
+* `callback(err, results)` - A callback which is called when all `iterator`
+  functions have finished, or an error occurs. Results is an array of the
+  transformed items from the `arr`.
+
+__Example__
+
+```js
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
+    // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
+<a name="mapSeries" />
+### mapSeries(arr, iterator, callback)
+
+The same as [`map`](#map), only the `iterator` is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed. 
+The results array will be in the same order as the original.
+
+
+---------------------------------------
+
+<a name="mapLimit" />
+### mapLimit(arr, limit, iterator, callback)
+
+The same as [`map`](#map), only no more than `limit` `iterator`s will be simultaneously 
+running at any time.
+
+Note that the items are not processed in batches, so there is no guarantee that 
+the first `limit` `iterator` functions will complete before any others are started.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `limit` - The maximum number of `iterator`s to run at any time.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+  The iterator is passed a `callback(err, transformed)` which must be called once 
+  it has completed with an error (which can be `null`) and a transformed item.
+* `callback(err, results)` - A callback which is called when all `iterator`
+  calls have finished, or an error occurs. The result is an array of the
+  transformed items from the original `arr`.
+
+__Example__
+
+```js
+async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){
+    // results is now an array of stats for each file
+});
+```
+
+---------------------------------------
+
+<a name="select" />
+<a name="filter" />
+### filter(arr, iterator, callback)
+
+__Alias:__ `select`
+
+Returns a new array of all the values in `arr` which pass an async truth test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. This operation is
+performed in parallel, but the results array will be in the same order as the
+original.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+  The `iterator` is passed a `callback(truthValue)`, which must be called with a 
+  boolean argument once it has completed.
+* `callback(results)` - A callback which is called after all the `iterator`
+  functions have finished.
+
+__Example__
+
+```js
+async.filter(['file1','file2','file3'], fs.exists, function(results){
+    // results now equals an array of the existing files
+});
+```
+
+---------------------------------------
+
+<a name="selectSeries" />
+<a name="filterSeries" />
+### filterSeries(arr, iterator, callback)
+
+__Alias:__ `selectSeries`
+
+The same as [`filter`](#filter) only the `iterator` is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed. 
+The results array will be in the same order as the original.
+
+---------------------------------------
+
+<a name="reject" />
+### reject(arr, iterator, callback)
+
+The opposite of [`filter`](#filter). Removes values that pass an `async` truth test.
+
+---------------------------------------
+
+<a name="rejectSeries" />
+### rejectSeries(arr, iterator, callback)
+
+The same as [`reject`](#reject), only the `iterator` is applied to each item in `arr`
+in series.
+
+
+---------------------------------------
+
+<a name="reduce" />
+### reduce(arr, memo, iterator, callback)
+
+__Aliases:__ `inject`, `foldl`
+
+Reduces `arr` into a single value using an async `iterator` to return
+each successive step. `memo` is the initial state of the reduction. 
+This function only operates in series. 
+
+For performance reasons, it may make sense to split a call to this function into 
+a parallel map, and then use the normal `Array.prototype.reduce` on the results. 
+This function is for situations where each step in the reduction needs to be async; 
+if you can get the data before reducing it, then it's probably a good idea to do so.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `memo` - The initial state of the reduction.
+* `iterator(memo, item, callback)` - A function applied to each item in the
+  array to produce the next step in the reduction. The `iterator` is passed a
+  `callback(err, reduction)` which accepts an optional error as its first 
+  argument, and the state of the reduction as the second. If an error is 
+  passed to the callback, the reduction is stopped and the main `callback` is 
+  immediately called with the error.
+* `callback(err, result)` - A callback which is called after all the `iterator`
+  functions have finished. Result is the reduced value.
+
+__Example__
+
+```js
+async.reduce([1,2,3], 0, function(memo, item, callback){
+    // pointless async:
+    process.nextTick(function(){
+        callback(null, memo + item)
+    });
+}, function(err, result){
+    // result is now equal to the last value of memo, which is 6
+});
+```
+
+---------------------------------------
+
+<a name="reduceRight" />
+### reduceRight(arr, memo, iterator, callback)
+
+__Alias:__ `foldr`
+
+Same as [`reduce`](#reduce), only operates on `arr` in reverse order.
+
+
+---------------------------------------
+
+<a name="detect" />
+### detect(arr, iterator, callback)
+
+Returns the first value in `arr` that passes an async truth test. The
+`iterator` is applied in parallel, meaning the first iterator to return `true` will
+fire the detect `callback` with that result. That means the result might not be
+the first item in the original `arr` (in terms of order) that passes the test.
+
+If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries).
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+  The iterator is passed a `callback(truthValue)` which must be called with a 
+  boolean argument once it has completed.
+* `callback(result)` - A callback which is called as soon as any iterator returns
+  `true`, or after all the `iterator` functions have finished. Result will be
+  the first item in the array that passes the truth test (iterator) or the
+  value `undefined` if none passed.
+
+__Example__
+
+```js
+async.detect(['file1','file2','file3'], fs.exists, function(result){
+    // result now equals the first file in the list that exists
+});
+```
+
+---------------------------------------
+
+<a name="detectSeries" />
+### detectSeries(arr, iterator, callback)
+
+The same as [`detect`](#detect), only the `iterator` is applied to each item in `arr`
+in series. This means the result is always the first in the original `arr` (in
+terms of array order) that passes the truth test.
+
+
+---------------------------------------
+
+<a name="sortBy" />
+### sortBy(arr, iterator, callback)
+
+Sorts a list by the results of running each `arr` value through an async `iterator`.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+  The iterator is passed a `callback(err, sortValue)` which must be called once it
+  has completed with an error (which can be `null`) and a value to use as the sort
+  criteria.
+* `callback(err, results)` - A callback which is called after all the `iterator`
+  functions have finished, or an error occurs. Results is the items from
+  the original `arr` sorted by the values returned by the `iterator` calls.
+
+__Example__
+
+```js
+async.sortBy(['file1','file2','file3'], function(file, callback){
+    fs.stat(file, function(err, stats){
+        callback(err, stats.mtime);
+    });
+}, function(err, results){
+    // results is now the original array of files sorted by
+    // modified date
+});
+```
+
+__Sort Order__
+
+By modifying the callback parameter the sorting order can be influenced:
+
+```js
+//ascending order
+async.sortBy([1,9,3,5], function(x, callback){
+    callback(err, x);
+}, function(err,result){
+    //result callback
+} );
+
+//descending order
+async.sortBy([1,9,3,5], function(x, callback){
+    callback(err, x*-1);    //<- x*-1 instead of x, turns the order around
+}, function(err,result){
+    //result callback
+} );
+```
+
+---------------------------------------
+
+<a name="some" />
+### some(arr, iterator, callback)
+
+__Alias:__ `any`
+
+Returns `true` if at least one element in the `arr` satisfies an async test.
+_The callback for each iterator call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. Once any iterator
+call returns `true`, the main `callback` is immediately called.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+  in parallel. The iterator is passed a callback(truthValue) which must be 
+  called with a boolean argument once it has completed.
+* `callback(result)` - A callback which is called as soon as any iterator returns
+  `true`, or after all the iterator functions have finished. Result will be
+  either `true` or `false` depending on the values of the async tests.
+
+__Example__
+
+```js
+async.some(['file1','file2','file3'], fs.exists, function(result){
+    // if result is true then at least one of the files exists
+});
+```
+
+---------------------------------------
+
+<a name="every" />
+### every(arr, iterator, callback)
+
+__Alias:__ `all`
+
+Returns `true` if every element in `arr` satisfies an async test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+  in parallel. The iterator is passed a callback(truthValue) which must be 
+  called with a  boolean argument once it has completed.
+* `callback(result)` - A callback which is called after all the `iterator`
+  functions have finished. Result will be either `true` or `false` depending on
+  the values of the async tests.
+
+__Example__
+
+```js
+async.every(['file1','file2','file3'], fs.exists, function(result){
+    // if result is true then every file exists
+});
+```
+
+---------------------------------------
+
+<a name="concat" />
+### concat(arr, iterator, callback)
+
+Applies `iterator` to each item in `arr`, concatenating the results. Returns the
+concatenated list. The `iterator`s are called in parallel, and the results are
+concatenated as they return. There is no guarantee that the results array will
+be returned in the original order of `arr` passed to the `iterator` function.
+
+__Arguments__
+
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+  The iterator is passed a `callback(err, results)` which must be called once it 
+  has completed with an error (which can be `null`) and an array of results.
+* `callback(err, results)` - A callback which is called after all the `iterator`
+  functions have finished, or an error occurs. Results is an array containing
+  the concatenated results of the `iterator` function.
+
+__Example__
+
+```js
+async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
+    // files is now a list of filenames that exist in the 3 directories
+});
+```
+
+---------------------------------------
+
+<a name="concatSeries" />
+### concatSeries(arr, iterator, callback)
+
+Same as [`concat`](#concat), but executes in series instead of parallel.
+
+
+## Control Flow
+
+<a name="series" />
+### series(tasks, [callback])
+
+Run the functions in the `tasks` array in series, each one running once the previous
+function has completed. If any functions in the series pass an error to its
+callback, no more functions are run, and `callback` is immediately called with the value of the error. 
+Otherwise, `callback` receives an array of results when `tasks` have completed.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function, and the results will be passed to the final `callback` as an object
+instead of an array. This can be a more readable way of handling results from
+[`series`](#series).
+
+**Note** that while many implementations preserve the order of object properties, the
+[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) 
+explicitly states that
+
+> The mechanics and order of enumerating the properties is not specified.
+
+So if you rely on the order in which your series of functions are executed, and want
+this to work on all platforms, consider using an array. 
+
+__Arguments__
+
+* `tasks` - An array or object containing functions to run, each function is passed
+  a `callback(err, result)` it must call on completion with an error `err` (which can
+  be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
+  have completed. This function gets a results array (or object) containing all 
+  the result arguments passed to the `task` callbacks.
+
+__Example__
+
+```js
+async.series([
+    function(callback){
+        // do some stuff ...
+        callback(null, 'one');
+    },
+    function(callback){
+        // do some more stuff ...
+        callback(null, 'two');
+    }
+],
+// optional callback
+function(err, results){
+    // results is now equal to ['one', 'two']
+});
+
+
+// an example using an object instead of an array
+async.series({
+    one: function(callback){
+        setTimeout(function(){
+            callback(null, 1);
+        }, 200);
+    },
+    two: function(callback){
+        setTimeout(function(){
+            callback(null, 2);
+        }, 100);
+    }
+},
+function(err, results) {
+    // results is now equal to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+<a name="parallel" />
+### parallel(tasks, [callback])
+
+Run the `tasks` array of functions in parallel, without waiting until the previous
+function has completed. If any of the functions pass an error to its
+callback, the main `callback` is immediately called with the value of the error.
+Once the `tasks` have completed, the results are passed to the final `callback` as an
+array.
+
+It is also possible to use an object instead of an array. Each property will be
+run as a function and the results will be passed to the final `callback` as an object
+instead of an array. This can be a more readable way of handling results from
+[`parallel`](#parallel).
+
+
+__Arguments__
+
+* `tasks` - An array or object containing functions to run. Each function is passed 
+  a `callback(err, result)` which it must call on completion with an error `err` 
+  (which can be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
+  have completed. This function gets a results array (or object) containing all 
+  the result arguments passed to the task callbacks.
+
+__Example__
+
+```js
+async.parallel([
+    function(callback){
+        setTimeout(function(){
+            callback(null, 'one');
+        }, 200);
+    },
+    function(callback){
+        setTimeout(function(){
+            callback(null, 'two');
+        }, 100);
+    }
+],
+// optional callback
+function(err, results){
+    // the results array will equal ['one','two'] even though
+    // the second function had a shorter timeout.
+});
+
+
+// an example using an object instead of an array
+async.parallel({
+    one: function(callback){
+        setTimeout(function(){
+            callback(null, 1);
+        }, 200);
+    },
+    two: function(callback){
+        setTimeout(function(){
+            callback(null, 2);
+        }, 100);
+    }
+},
+function(err, results) {
+    // results is now equals to: {one: 1, two: 2}
+});
+```
+
+---------------------------------------
+
+<a name="parallelLimit" />
+### parallelLimit(tasks, limit, [callback])
+
+The same as [`parallel`](#parallel), only `tasks` are executed in parallel 
+with a maximum of `limit` tasks executing at any time.
+
+Note that the `tasks` are not executed in batches, so there is no guarantee that 
+the first `limit` tasks will complete before any others are started.
+
+__Arguments__
+
+* `tasks` - An array or object containing functions to run, each function is passed 
+  a `callback(err, result)` it must call on completion with an error `err` (which can
+  be `null`) and an optional `result` value.
+* `limit` - The maximum number of `tasks` to run at any time.
+* `callback(err, results)` - An optional callback to run once all the functions
+  have completed. This function gets a results array (or object) containing all 
+  the result arguments passed to the `task` callbacks.
+
+---------------------------------------
+
+<a name="whilst" />
+### whilst(test, fn, callback)
+
+Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped,
+or an error occurs.
+
+__Arguments__
+
+* `test()` - synchronous truth test to perform before each execution of `fn`.
+* `fn(callback)` - A function which is called each time `test` passes. The function is
+  passed a `callback(err)`, which must be called once it has completed with an 
+  optional `err` argument.
+* `callback(err)` - A callback which is called after the test fails and repeated
+  execution of `fn` has stopped.
+
+__Example__
+
+```js
+var count = 0;
+
+async.whilst(
+    function () { return count < 5; },
+    function (callback) {
+        count++;
+        setTimeout(callback, 1000);
+    },
+    function (err) {
+        // 5 seconds have passed
+    }
+);
+```
+
+---------------------------------------
+
+<a name="doWhilst" />
+### doWhilst(fn, test, callback)
+
+The post-check version of [`whilst`](#whilst). To reflect the difference in 
+the order of operations, the arguments `test` and `fn` are switched. 
+
+`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+
+---------------------------------------
+
+<a name="until" />
+### until(test, fn, callback)
+
+Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped,
+or an error occurs.
+
+The inverse of [`whilst`](#whilst).
+
+---------------------------------------
+
+<a name="doUntil" />
+### doUntil(fn, test, callback)
+
+Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`.
+
+---------------------------------------
+
+<a name="forever" />
+### forever(fn, errback)
+
+Calls the asynchronous function `fn` with a callback parameter that allows it to
+call itself again, in series, indefinitely.
+
+If an error is passed to the callback then `errback` is called with the
+error, and execution stops, otherwise it will never be called.
+
+```js
+async.forever(
+    function(next) {
+        // next is suitable for passing to things that need a callback(err [, whatever]);
+        // it will result in this function being called again.
+    },
+    function(err) {
+        // if next is called with a value in its first parameter, it will appear
+        // in here as 'err', and execution will stop.
+    }
+);
+```
+
+---------------------------------------
+
+<a name="waterfall" />
+### waterfall(tasks, [callback])
+
+Runs the `tasks` array of functions in series, each passing their results to the next in
+the array. However, if any of the `tasks` pass an error to their own callback, the
+next function is not executed, and the main `callback` is immediately called with
+the error.
+
+__Arguments__
+
+* `tasks` - An array of functions to run, each function is passed a 
+  `callback(err, result1, result2, ...)` it must call on completion. The first
+  argument is an error (which can be `null`) and any further arguments will be 
+  passed as arguments in order to the next task.
+* `callback(err, [results])` - An optional callback to run once all the functions
+  have completed. This will be passed the results of the last task's callback.
+
+
+
+__Example__
+
+```js
+async.waterfall([
+    function(callback){
+        callback(null, 'one', 'two');
+    },
+    function(arg1, arg2, callback){
+      // arg1 now equals 'one' and arg2 now equals 'two'
+        callback(null, 'three');
+    },
+    function(arg1, callback){
+        // arg1 now equals 'three'
+        callback(null, 'done');
+    }
+], function (err, result) {
+   // result now equals 'done'    
+});
+```
+
+---------------------------------------
+<a name="compose" />
+### compose(fn1, fn2...)
+
+Creates a function which is a composition of the passed asynchronous
+functions. Each function consumes the return value of the function that
+follows. Composing functions `f()`, `g()`, and `h()` would produce the result of
+`f(g(h()))`, only this version uses callbacks to obtain the return values.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* `functions...` - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+function add1(n, callback) {
+    setTimeout(function () {
+        callback(null, n + 1);
+    }, 10);
+}
+
+function mul3(n, callback) {
+    setTimeout(function () {
+        callback(null, n * 3);
+    }, 10);
+}
+
+var add1mul3 = async.compose(mul3, add1);
+
+add1mul3(4, function (err, result) {
+   // result now equals 15
+});
+```
+
+---------------------------------------
+<a name="seq" />
+### seq(fn1, fn2...)
+
+Version of the compose function that is more natural to read.
+Each following function consumes the return value of the latter function. 
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* functions... - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+// Requires lodash (or underscore), express3 and dresende's orm2.
+// Part of an app, that fetches cats of the logged user.
+// This example uses `seq` function to avoid overnesting and error 
+// handling clutter.
+app.get('/cats', function(request, response) {
+  function handleError(err, data, callback) {
+    if (err) {
+      console.error(err);
+      response.json({ status: 'error', message: err.message });
+    }
+    else {
+      callback(data);
+    }
+  }
+  var User = request.models.User;
+  async.seq(
+    _.bind(User.get, User),  // 'User.get' has signature (id, callback(err, data))
+    handleError,
+    function(user, fn) {
+      user.getCats(fn);      // 'getCats' has signature (callback(err, data))
+    },
+    handleError,
+    function(cats) {
+      response.json({ status: 'ok', message: 'Cats found', data: cats });
+    }
+  )(req.session.user_id);
+  }
+});
+```
+
+---------------------------------------
+<a name="applyEach" />
+### applyEach(fns, args..., callback)
+
+Applies the provided arguments to each function in the array, calling 
+`callback` after all functions have completed. If you only provide the first
+argument, then it will return a function which lets you pass in the
+arguments as if it were a single function call.
+
+__Arguments__
+
+* `fns` - the asynchronous functions to all call with the same arguments
+* `args...` - any number of separate arguments to pass to the function
+* `callback` - the final argument should be the callback, called when all
+  functions have completed processing
+
+
+__Example__
+
+```js
+async.applyEach([enableSearch, updateSchema], 'bucket', callback);
+
+// partial application example:
+async.each(
+    buckets,
+    async.applyEach([enableSearch, updateSchema]),
+    callback
+);
+```
+
+---------------------------------------
+
+<a name="applyEachSeries" />
+### applyEachSeries(arr, iterator, callback)
+
+The same as [`applyEach`](#applyEach) only the functions are applied in series.
+
+---------------------------------------
+
+<a name="queue" />
+### queue(worker, concurrency)
+
+Creates a `queue` object with the specified `concurrency`. Tasks added to the
+`queue` are processed in parallel (up to the `concurrency` limit). If all
+`worker`s are in progress, the task is queued until one becomes available. 
+Once a `worker` completes a `task`, that `task`'s callback is called.
+
+__Arguments__
+
+* `worker(task, callback)` - An asynchronous function for processing a queued
+  task, which must call its `callback(err)` argument when finished, with an 
+  optional `error` as an argument.
+* `concurrency` - An `integer` for determining how many `worker` functions should be
+  run in parallel.
+
+__Queue objects__
+
+The `queue` object returned by this function has the following properties and
+methods:
+
+* `length()` - a function returning the number of items waiting to be processed.
+* `started` - a function returning whether or not any items have been pushed and processed by the queue
+* `running()` - a function returning the number of items currently being processed.
+* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
+* `concurrency` - an integer for determining how many `worker` functions should be
+  run in parallel. This property can be changed after a `queue` is created to
+  alter the concurrency on-the-fly.
+* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once 
+  the `worker` has finished processing the task. Instead of a single task, a `tasks` array
+  can be submitted. The respective callback is used for every task in the list.
+* `unshift(task, [callback])` - add a new task to the front of the `queue`.
+* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, 
+   and further tasks will be queued.
+* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`.
+* `paused` - a boolean for determining whether the queue is in a paused state
+* `pause()` - a function that pauses the processing of tasks until `resume()` is called.
+* `resume()` - a function that resumes the processing of queued tasks when the queue is paused.
+* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle.
+
+__Example__
+
+```js
+// create a queue object with concurrency 2
+
+var q = async.queue(function (task, callback) {
+    console.log('hello ' + task.name);
+    callback();
+}, 2);
+
+
+// assign a callback
+q.drain = function() {
+    console.log('all items have been processed');
+}
+
+// add some items to the queue
+
+q.push({name: 'foo'}, function (err) {
+    console.log('finished processing foo');
+});
+q.push({name: 'bar'}, function (err) {
+    console.log('finished processing bar');
+});
+
+// add some items to the queue (batch-wise)
+
+q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
+    console.log('finished processing bar');
+});
+
+// add some items to the front of the queue
+
+q.unshift({name: 'bar'}, function (err) {
+    console.log('finished processing bar');
+});
+```
+
+
+---------------------------------------
+
+<a name="priorityQueue" />
+### priorityQueue(worker, concurrency)
+
+The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects:
+
+* `push(task, priority, [callback])` - `priority` should be a number. If an array of
+  `tasks` is given, all tasks will be assigned the same priority.
+* The `unshift` method was removed.
+
+---------------------------------------
+
+<a name="cargo" />
+### cargo(worker, [payload])
+
+Creates a `cargo` object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the `payload` limit). If the
+`worker` is in progress, the task is queued until it becomes available. Once
+the `worker` has completed some tasks, each callback of those tasks is called.
+Check out [this animation](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) for how `cargo` and `queue` work.
+
+While [queue](#queue) passes only one task to one of a group of workers
+at a time, cargo passes an array of tasks to a single worker, repeating
+when the worker is finished.
+
+__Arguments__
+
+* `worker(tasks, callback)` - An asynchronous function for processing an array of
+  queued tasks, which must call its `callback(err)` argument when finished, with 
+  an optional `err` argument.
+* `payload` - An optional `integer` for determining how many tasks should be
+  processed per round; if omitted, the default is unlimited.
+
+__Cargo objects__
+
+The `cargo` object returned by this function has the following properties and
+methods:
+
+* `length()` - A function returning the number of items waiting to be processed.
+* `payload` - An `integer` for determining how many tasks should be
+  process per round. This property can be changed after a `cargo` is created to
+  alter the payload on-the-fly.
+* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called
+  once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` 
+  can be submitted. The respective callback is used for every task in the list.
+* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued.
+* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`.
+
+__Example__
+
+```js
+// create a cargo object with payload 2
+
+var cargo = async.cargo(function (tasks, callback) {
+    for(var i=0; i<tasks.length; i++){
+      console.log('hello ' + tasks[i].name);
+    }
+    callback();
+}, 2);
+
+
+// add some items
+
+cargo.push({name: 'foo'}, function (err) {
+    console.log('finished processing foo');
+});
+cargo.push({name: 'bar'}, function (err) {
+    console.log('finished processing bar');
+});
+cargo.push({name: 'baz'}, function (err) {
+    console.log('finished processing baz');
+});
+```
+
+---------------------------------------
+
+<a name="auto" />
+### auto(tasks, [callback])
+
+Determines the best order for running the functions in `tasks`, based on their 
+requirements. Each function can optionally depend on other functions being completed 
+first, and each function is run as soon as its requirements are satisfied. 
+
+If any of the functions pass an error to their callback, it will not 
+complete (so any other functions depending on it will not run), and the main 
+`callback` is immediately called with the error. Functions also receive an 
+object containing the results of functions which have completed so far.
+
+Note, all functions are called with a `results` object as a second argument, 
+so it is unsafe to pass functions in the `tasks` object which cannot handle the
+extra argument. 
+
+For example, this snippet of code:
+
+```js
+async.auto({
+  readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
+}, callback);
+```
+
+will have the effect of calling `readFile` with the results object as the last
+argument, which will fail:
+
+```js
+fs.readFile('data.txt', 'utf-8', cb, {});
+```
+
+Instead, wrap the call to `readFile` in a function which does not forward the 
+`results` object:
+
+```js
+async.auto({
+  readData: function(cb, results){
+    fs.readFile('data.txt', 'utf-8', cb);
+  }
+}, callback);
+```
+
+__Arguments__
+
+* `tasks` - An object. Each of its properties is either a function or an array of
+  requirements, with the function itself the last item in the array. The object's key
+  of a property serves as the name of the task defined by that property,
+  i.e. can be used when specifying requirements for other tasks.
+  The function receives two arguments: (1) a `callback(err, result)` which must be 
+  called when finished, passing an `error` (which can be `null`) and the result of 
+  the function's execution, and (2) a `results` object, containing the results of
+  the previously executed functions.
+* `callback(err, results)` - An optional callback which is called when all the
+  tasks have been completed. It receives the `err` argument if any `tasks` 
+  pass an error to their callback. Results are always returned; however, if 
+  an error occurs, no further `tasks` will be performed, and the results
+  object will only contain partial results.
+
+
+__Example__
+
+```js
+async.auto({
+    get_data: function(callback){
+        console.log('in get_data');
+        // async code to get some data
+        callback(null, 'data', 'converted to array');
+    },
+    make_folder: function(callback){
+        console.log('in make_folder');
+        // async code to create a directory to store a file in
+        // this is run at the same time as getting the data
+        callback(null, 'folder');
+    },
+    write_file: ['get_data', 'make_folder', function(callback, results){
+        console.log('in write_file', JSON.stringify(results));
+        // once there is some data and the directory exists,
+        // write the data to a file in the directory
+        callback(null, 'filename');
+    }],
+    email_link: ['write_file', function(callback, results){
+        console.log('in email_link', JSON.stringify(results));
+        // once the file is written let's email a link to it...
+        // results.write_file contains the filename returned by write_file.
+        callback(null, {'file':results.write_file, 'email':'user@example.com'});
+    }]
+}, function(err, results) {
+    console.log('err = ', err);
+    console.log('results = ', results);
+});
+```
+
+This is a fairly trivial example, but to do this using the basic parallel and
+series functions would look like this:
+
+```js
+async.parallel([
+    function(callback){
+        console.log('in get_data');
+        // async code to get some data
+        callback(null, 'data', 'converted to array');
+    },
+    function(callback){
+        console.log('in make_folder');
+        // async code to create a directory to store a file in
+        // this is run at the same time as getting the data
+        callback(null, 'folder');
+    }
+],
+function(err, results){
+    async.series([
+        function(callback){
+            console.log('in write_file', JSON.stringify(results));
+            // once there is some data and the directory exists,
+            // write the data to a file in the directory
+            results.push('filename');
+            callback(null);
+        },
+        function(callback){
+            console.log('in email_link', JSON.stringify(results));
+            // once the file is written let's email a link to it...
+            callback(null, {'file':results.pop(), 'email':'user@example.com'});
+        }
+    ]);
+});
+```
+
+For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding
+new tasks much easier (and the code more readable).
+
+
+---------------------------------------
+
+<a name="retry" />
+### retry([times = 5], task, [callback])
+
+Attempts to get a successful response from `task` no more than `times` times before
+returning an error. If the task is successful, the `callback` will be passed the result
+of the successfull task. If all attemps fail, the callback will be passed the error and
+result (if any) of the final attempt.
+
+__Arguments__
+
+* `times` - An integer indicating how many times to attempt the `task` before giving up. Defaults to 5.
+* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)`
+  which must be called when finished, passing `err` (which can be `null`) and the `result` of 
+  the function's execution, and (2) a `results` object, containing the results of
+  the previously executed functions (if nested inside another control flow).
+* `callback(err, results)` - An optional callback which is called when the
+  task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`.
+
+The [`retry`](#retry) function can be used as a stand-alone control flow by passing a
+callback, as shown below:
+
+```js
+async.retry(3, apiMethod, function(err, result) {
+    // do something with the result
+});
+```
+
+It can also be embeded within other control flow functions to retry individual methods
+that are not as reliable, like this:
+
+```js
+async.auto({
+    users: api.getUsers.bind(api),
+    payments: async.retry(3, api.getPayments.bind(api))
+}, function(err, results) {
+  // do something with the results
+});
+```
+
+
+---------------------------------------
+
+<a name="iterator" />
+### iterator(tasks)
+
+Creates an iterator function which calls the next function in the `tasks` array,
+returning a continuation to call the next one after that. It's also possible to
+“peek” at the next iterator with `iterator.next()`.
+
+This function is used internally by the `async` module, but can be useful when
+you want to manually control the flow of functions in series.
+
+__Arguments__
+
+* `tasks` - An array of functions to run.
+
+__Example__
+
+```js
+var iterator = async.iterator([
+    function(){ sys.p('one'); },
+    function(){ sys.p('two'); },
+    function(){ sys.p('three'); }
+]);
+
+node> var iterator2 = iterator();
+'one'
+node> var iterator3 = iterator2();
+'two'
+node> iterator3();
+'three'
+node> var nextfn = iterator2.next();
+node> nextfn();
+'three'
+```
+
+---------------------------------------
+
+<a name="apply" />
+### apply(function, arguments..)
+
+Creates a continuation function with some arguments already applied. 
+
+Useful as a shorthand when combined with other control flow functions. Any arguments
+passed to the returned function are added to the arguments originally passed
+to apply.
+
+__Arguments__
+
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to automatically apply when the
+  continuation is called.
+
+__Example__
+
+```js
+// using apply
+
+async.parallel([
+    async.apply(fs.writeFile, 'testfile1', 'test1'),
+    async.apply(fs.writeFile, 'testfile2', 'test2'),
+]);
+
+
+// the same process without using apply
+
+async.parallel([
+    function(callback){
+        fs.writeFile('testfile1', 'test1', callback);
+    },
+    function(callback){
+        fs.writeFile('testfile2', 'test2', callback);
+    }
+]);
+```
+
+It's possible to pass any number of additional arguments when calling the
+continuation:
+
+```js
+node> var fn = async.apply(sys.puts, 'one');
+node> fn('two', 'three');
+one
+two
+three
+```
+
+---------------------------------------
+
+<a name="nextTick" />
+### nextTick(callback)
+
+Calls `callback` on a later loop around the event loop. In Node.js this just
+calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)`
+if available, otherwise `setTimeout(callback, 0)`, which means other higher priority
+events may precede the execution of `callback`.
+
+This is used internally for browser-compatibility purposes.
+
+__Arguments__
+
+* `callback` - The function to call on a later loop around the event loop.
+
+__Example__
+
+```js
+var call_order = [];
+async.nextTick(function(){
+    call_order.push('two');
+    // call_order now equals ['one','two']
+});
+call_order.push('one')
+```
+
+<a name="times" />
+### times(n, callback)
+
+Calls the `callback` function `n` times, and accumulates results in the same manner
+you would use with [`map`](#map).
+
+__Arguments__
+
+* `n` - The number of times to run the function.
+* `callback` - The function to call `n` times.
+
+__Example__
+
+```js
+// Pretend this is some complicated async factory
+var createUser = function(id, callback) {
+  callback(null, {
+    id: 'user' + id
+  })
+}
+// generate 5 users
+async.times(5, function(n, next){
+    createUser(n, function(err, user) {
+      next(err, user)
+    })
+}, function(err, users) {
+  // we should now have 5 users
+});
+```
+
+<a name="timesSeries" />
+### timesSeries(n, callback)
+
+The same as [`times`](#times), only the iterator is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed. 
+The results array will be in the same order as the original.
+
+
+## Utils
+
+<a name="memoize" />
+### memoize(fn, [hasher])
+
+Caches the results of an `async` function. When creating a hash to store function
+results against, the callback is omitted from the hash and an optional hash
+function can be used.
+
+The cache of results is exposed as the `memo` property of the function returned
+by `memoize`.
+
+__Arguments__
+
+* `fn` - The function to proxy and cache results from.
+* `hasher` - Tn optional function for generating a custom hash for storing
+  results. It has all the arguments applied to it apart from the callback, and
+  must be synchronous.
+
+__Example__
+
+```js
+var slow_fn = function (name, callback) {
+    // do something
+    callback(null, result);
+};
+var fn = async.memoize(slow_fn);
+
+// fn can now be used as if it were slow_fn
+fn('some name', function () {
+    // callback
+});
+```
+
+<a name="unmemoize" />
+### unmemoize(fn)
+
+Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized
+form. Handy for testing.
+
+__Arguments__
+
+* `fn` - the memoized function
+
+<a name="log" />
+### log(function, arguments)
+
+Logs the result of an `async` function to the `console`. Only works in Node.js or
+in browsers that support `console.log` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.log` is
+called on each argument in order.
+
+__Arguments__
+
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+    setTimeout(function(){
+        callback(null, 'hello ' + name);
+    }, 1000);
+};
+```
+```js
+node> async.log(hello, 'world');
+'hello world'
+```
+
+---------------------------------------
+
+<a name="dir" />
+### dir(function, arguments)
+
+Logs the result of an `async` function to the `console` using `console.dir` to
+display the properties of the resulting object. Only works in Node.js or
+in browsers that support `console.dir` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.dir` is
+called on each argument in order.
+
+__Arguments__
+
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
+
+__Example__
+
+```js
+var hello = function(name, callback){
+    setTimeout(function(){
+        callback(null, {hello: name});
+    }, 1000);
+};
+```
+```js
+node> async.dir(hello, 'world');
+{hello: 'world'}
+```
+
+---------------------------------------
+
+<a name="noConflict" />
+### noConflict()
+
+Changes the value of `async` back to its original value, returning a reference to the
+`async` object.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/component.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/component.json
new file mode 100755 (executable)
index 0000000..bbb0115
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "name": "async",
+  "repo": "caolan/async",
+  "description": "Higher-order functions and common patterns for asynchronous code",
+  "version": "0.1.23",
+  "keywords": [],
+  "dependencies": {},
+  "development": {},
+  "main": "lib/async.js",
+  "scripts": [ "lib/async.js" ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
new file mode 100755 (executable)
index 0000000..01e8afc
--- /dev/null
@@ -0,0 +1,1123 @@
+/*!
+ * async
+ * https://github.com/caolan/async
+ *
+ * Copyright 2010-2014 Caolan McMahon
+ * Released under the MIT license
+ */
+/*jshint onevar: false, indent:4 */
+/*global setImmediate: false, setTimeout: false, console: false */
+(function () {
+
+    var async = {};
+
+    // global on the server, window in the browser
+    var root, previous_async;
+
+    root = this;
+    if (root != null) {
+      previous_async = root.async;
+    }
+
+    async.noConflict = function () {
+        root.async = previous_async;
+        return async;
+    };
+
+    function only_once(fn) {
+        var called = false;
+        return function() {
+            if (called) throw new Error("Callback was already called.");
+            called = true;
+            fn.apply(root, arguments);
+        }
+    }
+
+    //// cross-browser compatiblity functions ////
+
+    var _toString = Object.prototype.toString;
+
+    var _isArray = Array.isArray || function (obj) {
+        return _toString.call(obj) === '[object Array]';
+    };
+
+    var _each = function (arr, iterator) {
+        if (arr.forEach) {
+            return arr.forEach(iterator);
+        }
+        for (var i = 0; i < arr.length; i += 1) {
+            iterator(arr[i], i, arr);
+        }
+    };
+
+    var _map = function (arr, iterator) {
+        if (arr.map) {
+            return arr.map(iterator);
+        }
+        var results = [];
+        _each(arr, function (x, i, a) {
+            results.push(iterator(x, i, a));
+        });
+        return results;
+    };
+
+    var _reduce = function (arr, iterator, memo) {
+        if (arr.reduce) {
+            return arr.reduce(iterator, memo);
+        }
+        _each(arr, function (x, i, a) {
+            memo = iterator(memo, x, i, a);
+        });
+        return memo;
+    };
+
+    var _keys = function (obj) {
+        if (Object.keys) {
+            return Object.keys(obj);
+        }
+        var keys = [];
+        for (var k in obj) {
+            if (obj.hasOwnProperty(k)) {
+                keys.push(k);
+            }
+        }
+        return keys;
+    };
+
+    //// exported async module functions ////
+
+    //// nextTick implementation with browser-compatible fallback ////
+    if (typeof process === 'undefined' || !(process.nextTick)) {
+        if (typeof setImmediate === 'function') {
+            async.nextTick = function (fn) {
+                // not a direct alias for IE10 compatibility
+                setImmediate(fn);
+            };
+            async.setImmediate = async.nextTick;
+        }
+        else {
+            async.nextTick = function (fn) {
+                setTimeout(fn, 0);
+            };
+            async.setImmediate = async.nextTick;
+        }
+    }
+    else {
+        async.nextTick = process.nextTick;
+        if (typeof setImmediate !== 'undefined') {
+            async.setImmediate = function (fn) {
+              // not a direct alias for IE10 compatibility
+              setImmediate(fn);
+            };
+        }
+        else {
+            async.setImmediate = async.nextTick;
+        }
+    }
+
+    async.each = function (arr, iterator, callback) {
+        callback = callback || function () {};
+        if (!arr.length) {
+            return callback();
+        }
+        var completed = 0;
+        _each(arr, function (x) {
+            iterator(x, only_once(done) );
+        });
+        function done(err) {
+          if (err) {
+              callback(err);
+              callback = function () {};
+          }
+          else {
+              completed += 1;
+              if (completed >= arr.length) {
+                  callback();
+              }
+          }
+        }
+    };
+    async.forEach = async.each;
+
+    async.eachSeries = function (arr, iterator, callback) {
+        callback = callback || function () {};
+        if (!arr.length) {
+            return callback();
+        }
+        var completed = 0;
+        var iterate = function () {
+            iterator(arr[completed], function (err) {
+                if (err) {
+                    callback(err);
+                    callback = function () {};
+                }
+                else {
+                    completed += 1;
+                    if (completed >= arr.length) {
+                        callback();
+                    }
+                    else {
+                        iterate();
+                    }
+                }
+            });
+        };
+        iterate();
+    };
+    async.forEachSeries = async.eachSeries;
+
+    async.eachLimit = function (arr, limit, iterator, callback) {
+        var fn = _eachLimit(limit);
+        fn.apply(null, [arr, iterator, callback]);
+    };
+    async.forEachLimit = async.eachLimit;
+
+    var _eachLimit = function (limit) {
+
+        return function (arr, iterator, callback) {
+            callback = callback || function () {};
+            if (!arr.length || limit <= 0) {
+                return callback();
+            }
+            var completed = 0;
+            var started = 0;
+            var running = 0;
+
+            (function replenish () {
+                if (completed >= arr.length) {
+                    return callback();
+                }
+
+                while (running < limit && started < arr.length) {
+                    started += 1;
+                    running += 1;
+                    iterator(arr[started - 1], function (err) {
+                        if (err) {
+                            callback(err);
+                            callback = function () {};
+                        }
+                        else {
+                            completed += 1;
+                            running -= 1;
+                            if (completed >= arr.length) {
+                                callback();
+                            }
+                            else {
+                                replenish();
+                            }
+                        }
+                    });
+                }
+            })();
+        };
+    };
+
+
+    var doParallel = function (fn) {
+        return function () {
+            var args = Array.prototype.slice.call(arguments);
+            return fn.apply(null, [async.each].concat(args));
+        };
+    };
+    var doParallelLimit = function(limit, fn) {
+        return function () {
+            var args = Array.prototype.slice.call(arguments);
+            return fn.apply(null, [_eachLimit(limit)].concat(args));
+        };
+    };
+    var doSeries = function (fn) {
+        return function () {
+            var args = Array.prototype.slice.call(arguments);
+            return fn.apply(null, [async.eachSeries].concat(args));
+        };
+    };
+
+
+    var _asyncMap = function (eachfn, arr, iterator, callback) {
+        arr = _map(arr, function (x, i) {
+            return {index: i, value: x};
+        });
+        if (!callback) {
+            eachfn(arr, function (x, callback) {
+                iterator(x.value, function (err) {
+                    callback(err);
+                });
+            });
+        } else {
+            var results = [];
+            eachfn(arr, function (x, callback) {
+                iterator(x.value, function (err, v) {
+                    results[x.index] = v;
+                    callback(err);
+                });
+            }, function (err) {
+                callback(err, results);
+            });
+        }
+    };
+    async.map = doParallel(_asyncMap);
+    async.mapSeries = doSeries(_asyncMap);
+    async.mapLimit = function (arr, limit, iterator, callback) {
+        return _mapLimit(limit)(arr, iterator, callback);
+    };
+
+    var _mapLimit = function(limit) {
+        return doParallelLimit(limit, _asyncMap);
+    };
+
+    // reduce only has a series version, as doing reduce in parallel won't
+    // work in many situations.
+    async.reduce = function (arr, memo, iterator, callback) {
+        async.eachSeries(arr, function (x, callback) {
+            iterator(memo, x, function (err, v) {
+                memo = v;
+                callback(err);
+            });
+        }, function (err) {
+            callback(err, memo);
+        });
+    };
+    // inject alias
+    async.inject = async.reduce;
+    // foldl alias
+    async.foldl = async.reduce;
+
+    async.reduceRight = function (arr, memo, iterator, callback) {
+        var reversed = _map(arr, function (x) {
+            return x;
+        }).reverse();
+        async.reduce(reversed, memo, iterator, callback);
+    };
+    // foldr alias
+    async.foldr = async.reduceRight;
+
+    var _filter = function (eachfn, arr, iterator, callback) {
+        var results = [];
+        arr = _map(arr, function (x, i) {
+            return {index: i, value: x};
+        });
+        eachfn(arr, function (x, callback) {
+            iterator(x.value, function (v) {
+                if (v) {
+                    results.push(x);
+                }
+                callback();
+            });
+        }, function (err) {
+            callback(_map(results.sort(function (a, b) {
+                return a.index - b.index;
+            }), function (x) {
+                return x.value;
+            }));
+        });
+    };
+    async.filter = doParallel(_filter);
+    async.filterSeries = doSeries(_filter);
+    // select alias
+    async.select = async.filter;
+    async.selectSeries = async.filterSeries;
+
+    var _reject = function (eachfn, arr, iterator, callback) {
+        var results = [];
+        arr = _map(arr, function (x, i) {
+            return {index: i, value: x};
+        });
+        eachfn(arr, function (x, callback) {
+            iterator(x.value, function (v) {
+                if (!v) {
+                    results.push(x);
+                }
+                callback();
+            });
+        }, function (err) {
+            callback(_map(results.sort(function (a, b) {
+                return a.index - b.index;
+            }), function (x) {
+                return x.value;
+            }));
+        });
+    };
+    async.reject = doParallel(_reject);
+    async.rejectSeries = doSeries(_reject);
+
+    var _detect = function (eachfn, arr, iterator, main_callback) {
+        eachfn(arr, function (x, callback) {
+            iterator(x, function (result) {
+                if (result) {
+                    main_callback(x);
+                    main_callback = function () {};
+                }
+                else {
+                    callback();
+                }
+            });
+        }, function (err) {
+            main_callback();
+        });
+    };
+    async.detect = doParallel(_detect);
+    async.detectSeries = doSeries(_detect);
+
+    async.some = function (arr, iterator, main_callback) {
+        async.each(arr, function (x, callback) {
+            iterator(x, function (v) {
+                if (v) {
+                    main_callback(true);
+                    main_callback = function () {};
+                }
+                callback();
+            });
+        }, function (err) {
+            main_callback(false);
+        });
+    };
+    // any alias
+    async.any = async.some;
+
+    async.every = function (arr, iterator, main_callback) {
+        async.each(arr, function (x, callback) {
+            iterator(x, function (v) {
+                if (!v) {
+                    main_callback(false);
+                    main_callback = function () {};
+                }
+                callback();
+            });
+        }, function (err) {
+            main_callback(true);
+        });
+    };
+    // all alias
+    async.all = async.every;
+
+    async.sortBy = function (arr, iterator, callback) {
+        async.map(arr, function (x, callback) {
+            iterator(x, function (err, criteria) {
+                if (err) {
+                    callback(err);
+                }
+                else {
+                    callback(null, {value: x, criteria: criteria});
+                }
+            });
+        }, function (err, results) {
+            if (err) {
+                return callback(err);
+            }
+            else {
+                var fn = function (left, right) {
+                    var a = left.criteria, b = right.criteria;
+                    return a < b ? -1 : a > b ? 1 : 0;
+                };
+                callback(null, _map(results.sort(fn), function (x) {
+                    return x.value;
+                }));
+            }
+        });
+    };
+
+    async.auto = function (tasks, callback) {
+        callback = callback || function () {};
+        var keys = _keys(tasks);
+        var remainingTasks = keys.length
+        if (!remainingTasks) {
+            return callback();
+        }
+
+        var results = {};
+
+        var listeners = [];
+        var addListener = function (fn) {
+            listeners.unshift(fn);
+        };
+        var removeListener = function (fn) {
+            for (var i = 0; i < listeners.length; i += 1) {
+                if (listeners[i] === fn) {
+                    listeners.splice(i, 1);
+                    return;
+                }
+            }
+        };
+        var taskComplete = function () {
+            remainingTasks--
+            _each(listeners.slice(0), function (fn) {
+                fn();
+            });
+        };
+
+        addListener(function () {
+            if (!remainingTasks) {
+                var theCallback = callback;
+                // prevent final callback from calling itself if it errors
+                callback = function () {};
+
+                theCallback(null, results);
+            }
+        });
+
+        _each(keys, function (k) {
+            var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
+            var taskCallback = function (err) {
+                var args = Array.prototype.slice.call(arguments, 1);
+                if (args.length <= 1) {
+                    args = args[0];
+                }
+                if (err) {
+                    var safeResults = {};
+                    _each(_keys(results), function(rkey) {
+                        safeResults[rkey] = results[rkey];
+                    });
+                    safeResults[k] = args;
+                    callback(err, safeResults);
+                    // stop subsequent errors hitting callback multiple times
+                    callback = function () {};
+                }
+                else {
+                    results[k] = args;
+                    async.setImmediate(taskComplete);
+                }
+            };
+            var requires = task.slice(0, Math.abs(task.length - 1)) || [];
+            var ready = function () {
+                return _reduce(requires, function (a, x) {
+                    return (a && results.hasOwnProperty(x));
+                }, true) && !results.hasOwnProperty(k);
+            };
+            if (ready()) {
+                task[task.length - 1](taskCallback, results);
+            }
+            else {
+                var listener = function () {
+                    if (ready()) {
+                        removeListener(listener);
+                        task[task.length - 1](taskCallback, results);
+                    }
+                };
+                addListener(listener);
+            }
+        });
+    };
+
+    async.retry = function(times, task, callback) {
+        var DEFAULT_TIMES = 5;
+        var attempts = [];
+        // Use defaults if times not passed
+        if (typeof times === 'function') {
+            callback = task;
+            task = times;
+            times = DEFAULT_TIMES;
+        }
+        // Make sure times is a number
+        times = parseInt(times, 10) || DEFAULT_TIMES;
+        var wrappedTask = function(wrappedCallback, wrappedResults) {
+            var retryAttempt = function(task, finalAttempt) {
+                return function(seriesCallback) {
+                    task(function(err, result){
+                        seriesCallback(!err || finalAttempt, {err: err, result: result});
+                    }, wrappedResults);
+                };
+            };
+            while (times) {
+                attempts.push(retryAttempt(task, !(times-=1)));
+            }
+            async.series(attempts, function(done, data){
+                data = data[data.length - 1];
+                (wrappedCallback || callback)(data.err, data.result);
+            });
+        }
+        // If a callback is passed, run this as a controll flow
+        return callback ? wrappedTask() : wrappedTask
+    };
+
+    async.waterfall = function (tasks, callback) {
+        callback = callback || function () {};
+        if (!_isArray(tasks)) {
+          var err = new Error('First argument to waterfall must be an array of functions');
+          return callback(err);
+        }
+        if (!tasks.length) {
+            return callback();
+        }
+        var wrapIterator = function (iterator) {
+            return function (err) {
+                if (err) {
+                    callback.apply(null, arguments);
+                    callback = function () {};
+                }
+                else {
+                    var args = Array.prototype.slice.call(arguments, 1);
+                    var next = iterator.next();
+                    if (next) {
+                        args.push(wrapIterator(next));
+                    }
+                    else {
+                        args.push(callback);
+                    }
+                    async.setImmediate(function () {
+                        iterator.apply(null, args);
+                    });
+                }
+            };
+        };
+        wrapIterator(async.iterator(tasks))();
+    };
+
+    var _parallel = function(eachfn, tasks, callback) {
+        callback = callback || function () {};
+        if (_isArray(tasks)) {
+            eachfn.map(tasks, function (fn, callback) {
+                if (fn) {
+                    fn(function (err) {
+                        var args = Array.prototype.slice.call(arguments, 1);
+                        if (args.length <= 1) {
+                            args = args[0];
+                        }
+                        callback.call(null, err, args);
+                    });
+                }
+            }, callback);
+        }
+        else {
+            var results = {};
+            eachfn.each(_keys(tasks), function (k, callback) {
+                tasks[k](function (err) {
+                    var args = Array.prototype.slice.call(arguments, 1);
+                    if (args.length <= 1) {
+                        args = args[0];
+                    }
+                    results[k] = args;
+                    callback(err);
+                });
+            }, function (err) {
+                callback(err, results);
+            });
+        }
+    };
+
+    async.parallel = function (tasks, callback) {
+        _parallel({ map: async.map, each: async.each }, tasks, callback);
+    };
+
+    async.parallelLimit = function(tasks, limit, callback) {
+        _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
+    };
+
+    async.series = function (tasks, callback) {
+        callback = callback || function () {};
+        if (_isArray(tasks)) {
+            async.mapSeries(tasks, function (fn, callback) {
+                if (fn) {
+                    fn(function (err) {
+                        var args = Array.prototype.slice.call(arguments, 1);
+                        if (args.length <= 1) {
+                            args = args[0];
+                        }
+                        callback.call(null, err, args);
+                    });
+                }
+            }, callback);
+        }
+        else {
+            var results = {};
+            async.eachSeries(_keys(tasks), function (k, callback) {
+                tasks[k](function (err) {
+                    var args = Array.prototype.slice.call(arguments, 1);
+                    if (args.length <= 1) {
+                        args = args[0];
+                    }
+                    results[k] = args;
+                    callback(err);
+                });
+            }, function (err) {
+                callback(err, results);
+            });
+        }
+    };
+
+    async.iterator = function (tasks) {
+        var makeCallback = function (index) {
+            var fn = function () {
+                if (tasks.length) {
+                    tasks[index].apply(null, arguments);
+                }
+                return fn.next();
+            };
+            fn.next = function () {
+                return (index < tasks.length - 1) ? makeCallback(index + 1): null;
+            };
+            return fn;
+        };
+        return makeCallback(0);
+    };
+
+    async.apply = function (fn) {
+        var args = Array.prototype.slice.call(arguments, 1);
+        return function () {
+            return fn.apply(
+                null, args.concat(Array.prototype.slice.call(arguments))
+            );
+        };
+    };
+
+    var _concat = function (eachfn, arr, fn, callback) {
+        var r = [];
+        eachfn(arr, function (x, cb) {
+            fn(x, function (err, y) {
+                r = r.concat(y || []);
+                cb(err);
+            });
+        }, function (err) {
+            callback(err, r);
+        });
+    };
+    async.concat = doParallel(_concat);
+    async.concatSeries = doSeries(_concat);
+
+    async.whilst = function (test, iterator, callback) {
+        if (test()) {
+            iterator(function (err) {
+                if (err) {
+                    return callback(err);
+                }
+                async.whilst(test, iterator, callback);
+            });
+        }
+        else {
+            callback();
+        }
+    };
+
+    async.doWhilst = function (iterator, test, callback) {
+        iterator(function (err) {
+            if (err) {
+                return callback(err);
+            }
+            var args = Array.prototype.slice.call(arguments, 1);
+            if (test.apply(null, args)) {
+                async.doWhilst(iterator, test, callback);
+            }
+            else {
+                callback();
+            }
+        });
+    };
+
+    async.until = function (test, iterator, callback) {
+        if (!test()) {
+            iterator(function (err) {
+                if (err) {
+                    return callback(err);
+                }
+                async.until(test, iterator, callback);
+            });
+        }
+        else {
+            callback();
+        }
+    };
+
+    async.doUntil = function (iterator, test, callback) {
+        iterator(function (err) {
+            if (err) {
+                return callback(err);
+            }
+            var args = Array.prototype.slice.call(arguments, 1);
+            if (!test.apply(null, args)) {
+                async.doUntil(iterator, test, callback);
+            }
+            else {
+                callback();
+            }
+        });
+    };
+
+    async.queue = function (worker, concurrency) {
+        if (concurrency === undefined) {
+            concurrency = 1;
+        }
+        function _insert(q, data, pos, callback) {
+          if (!q.started){
+            q.started = true;
+          }
+          if (!_isArray(data)) {
+              data = [data];
+          }
+          if(data.length == 0) {
+             // call drain immediately if there are no tasks
+             return async.setImmediate(function() {
+                 if (q.drain) {
+                     q.drain();
+                 }
+             });
+          }
+          _each(data, function(task) {
+              var item = {
+                  data: task,
+                  callback: typeof callback === 'function' ? callback : null
+              };
+
+              if (pos) {
+                q.tasks.unshift(item);
+              } else {
+                q.tasks.push(item);
+              }
+
+              if (q.saturated && q.tasks.length === q.concurrency) {
+                  q.saturated();
+              }
+              async.setImmediate(q.process);
+          });
+        }
+
+        var workers = 0;
+        var q = {
+            tasks: [],
+            concurrency: concurrency,
+            saturated: null,
+            empty: null,
+            drain: null,
+            started: false,
+            paused: false,
+            push: function (data, callback) {
+              _insert(q, data, false, callback);
+            },
+            kill: function () {
+              q.drain = null;
+              q.tasks = [];
+            },
+            unshift: function (data, callback) {
+              _insert(q, data, true, callback);
+            },
+            process: function () {
+                if (!q.paused && workers < q.concurrency && q.tasks.length) {
+                    var task = q.tasks.shift();
+                    if (q.empty && q.tasks.length === 0) {
+                        q.empty();
+                    }
+                    workers += 1;
+                    var next = function () {
+                        workers -= 1;
+                        if (task.callback) {
+                            task.callback.apply(task, arguments);
+                        }
+                        if (q.drain && q.tasks.length + workers === 0) {
+                            q.drain();
+                        }
+                        q.process();
+                    };
+                    var cb = only_once(next);
+                    worker(task.data, cb);
+                }
+            },
+            length: function () {
+                return q.tasks.length;
+            },
+            running: function () {
+                return workers;
+            },
+            idle: function() {
+                return q.tasks.length + workers === 0;
+            },
+            pause: function () {
+                if (q.paused === true) { return; }
+                q.paused = true;
+                q.process();
+            },
+            resume: function () {
+                if (q.paused === false) { return; }
+                q.paused = false;
+                q.process();
+            }
+        };
+        return q;
+    };
+    
+    async.priorityQueue = function (worker, concurrency) {
+        
+        function _compareTasks(a, b){
+          return a.priority - b.priority;
+        };
+        
+        function _binarySearch(sequence, item, compare) {
+          var beg = -1,
+              end = sequence.length - 1;
+          while (beg < end) {
+            var mid = beg + ((end - beg + 1) >>> 1);
+            if (compare(item, sequence[mid]) >= 0) {
+              beg = mid;
+            } else {
+              end = mid - 1;
+            }
+          }
+          return beg;
+        }
+        
+        function _insert(q, data, priority, callback) {
+          if (!q.started){
+            q.started = true;
+          }
+          if (!_isArray(data)) {
+              data = [data];
+          }
+          if(data.length == 0) {
+             // call drain immediately if there are no tasks
+             return async.setImmediate(function() {
+                 if (q.drain) {
+                     q.drain();
+                 }
+             });
+          }
+          _each(data, function(task) {
+              var item = {
+                  data: task,
+                  priority: priority,
+                  callback: typeof callback === 'function' ? callback : null
+              };
+              
+              q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+
+              if (q.saturated && q.tasks.length === q.concurrency) {
+                  q.saturated();
+              }
+              async.setImmediate(q.process);
+          });
+        }
+        
+        // Start with a normal queue
+        var q = async.queue(worker, concurrency);
+        
+        // Override push to accept second parameter representing priority
+        q.push = function (data, priority, callback) {
+          _insert(q, data, priority, callback);
+        };
+        
+        // Remove unshift function
+        delete q.unshift;
+
+        return q;
+    };
+
+    async.cargo = function (worker, payload) {
+        var working     = false,
+            tasks       = [];
+
+        var cargo = {
+            tasks: tasks,
+            payload: payload,
+            saturated: null,
+            empty: null,
+            drain: null,
+            drained: true,
+            push: function (data, callback) {
+                if (!_isArray(data)) {
+                    data = [data];
+                }
+                _each(data, function(task) {
+                    tasks.push({
+                        data: task,
+                        callback: typeof callback === 'function' ? callback : null
+                    });
+                    cargo.drained = false;
+                    if (cargo.saturated && tasks.length === payload) {
+                        cargo.saturated();
+                    }
+                });
+                async.setImmediate(cargo.process);
+            },
+            process: function process() {
+                if (working) return;
+                if (tasks.length === 0) {
+                    if(cargo.drain && !cargo.drained) cargo.drain();
+                    cargo.drained = true;
+                    return;
+                }
+
+                var ts = typeof payload === 'number'
+                            ? tasks.splice(0, payload)
+                            : tasks.splice(0, tasks.length);
+
+                var ds = _map(ts, function (task) {
+                    return task.data;
+                });
+
+                if(cargo.empty) cargo.empty();
+                working = true;
+                worker(ds, function () {
+                    working = false;
+
+                    var args = arguments;
+                    _each(ts, function (data) {
+                        if (data.callback) {
+                            data.callback.apply(null, args);
+                        }
+                    });
+
+                    process();
+                });
+            },
+            length: function () {
+                return tasks.length;
+            },
+            running: function () {
+                return working;
+            }
+        };
+        return cargo;
+    };
+
+    var _console_fn = function (name) {
+        return function (fn) {
+            var args = Array.prototype.slice.call(arguments, 1);
+            fn.apply(null, args.concat([function (err) {
+                var args = Array.prototype.slice.call(arguments, 1);
+                if (typeof console !== 'undefined') {
+                    if (err) {
+                        if (console.error) {
+                            console.error(err);
+                        }
+                    }
+                    else if (console[name]) {
+                        _each(args, function (x) {
+                            console[name](x);
+                        });
+                    }
+                }
+            }]));
+        };
+    };
+    async.log = _console_fn('log');
+    async.dir = _console_fn('dir');
+    /*async.info = _console_fn('info');
+    async.warn = _console_fn('warn');
+    async.error = _console_fn('error');*/
+
+    async.memoize = function (fn, hasher) {
+        var memo = {};
+        var queues = {};
+        hasher = hasher || function (x) {
+            return x;
+        };
+        var memoized = function () {
+            var args = Array.prototype.slice.call(arguments);
+            var callback = args.pop();
+            var key = hasher.apply(null, args);
+            if (key in memo) {
+                async.nextTick(function () {
+                    callback.apply(null, memo[key]);
+                });
+            }
+            else if (key in queues) {
+                queues[key].push(callback);
+            }
+            else {
+                queues[key] = [callback];
+                fn.apply(null, args.concat([function () {
+                    memo[key] = arguments;
+                    var q = queues[key];
+                    delete queues[key];
+                    for (var i = 0, l = q.length; i < l; i++) {
+                      q[i].apply(null, arguments);
+                    }
+                }]));
+            }
+        };
+        memoized.memo = memo;
+        memoized.unmemoized = fn;
+        return memoized;
+    };
+
+    async.unmemoize = function (fn) {
+      return function () {
+        return (fn.unmemoized || fn).apply(null, arguments);
+      };
+    };
+
+    async.times = function (count, iterator, callback) {
+        var counter = [];
+        for (var i = 0; i < count; i++) {
+            counter.push(i);
+        }
+        return async.map(counter, iterator, callback);
+    };
+
+    async.timesSeries = function (count, iterator, callback) {
+        var counter = [];
+        for (var i = 0; i < count; i++) {
+            counter.push(i);
+        }
+        return async.mapSeries(counter, iterator, callback);
+    };
+
+    async.seq = function (/* functions... */) {
+        var fns = arguments;
+        return function () {
+            var that = this;
+            var args = Array.prototype.slice.call(arguments);
+            var callback = args.pop();
+            async.reduce(fns, args, function (newargs, fn, cb) {
+                fn.apply(that, newargs.concat([function () {
+                    var err = arguments[0];
+                    var nextargs = Array.prototype.slice.call(arguments, 1);
+                    cb(err, nextargs);
+                }]))
+            },
+            function (err, results) {
+                callback.apply(that, [err].concat(results));
+            });
+        };
+    };
+
+    async.compose = function (/* functions... */) {
+      return async.seq.apply(null, Array.prototype.reverse.call(arguments));
+    };
+
+    var _applyEach = function (eachfn, fns /*args...*/) {
+        var go = function () {
+            var that = this;
+            var args = Array.prototype.slice.call(arguments);
+            var callback = args.pop();
+            return eachfn(fns, function (fn, cb) {
+                fn.apply(that, args.concat([cb]));
+            },
+            callback);
+        };
+        if (arguments.length > 2) {
+            var args = Array.prototype.slice.call(arguments, 2);
+            return go.apply(this, args);
+        }
+        else {
+            return go;
+        }
+    };
+    async.applyEach = doParallel(_applyEach);
+    async.applyEachSeries = doSeries(_applyEach);
+
+    async.forever = function (fn, callback) {
+        function next(err) {
+            if (err) {
+                if (callback) {
+                    return callback(err);
+                }
+                throw err;
+            }
+            fn(next);
+        }
+        next();
+    };
+
+    // Node.js
+    if (typeof module !== 'undefined' && module.exports) {
+        module.exports = async;
+    }
+    // AMD / RequireJS
+    else if (typeof define !== 'undefined' && define.amd) {
+        define([], function () {
+            return async;
+        });
+    }
+    // included directly via <script> tag
+    else {
+        root.async = async;
+    }
+
+}());
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/async/package.json
new file mode 100755 (executable)
index 0000000..bdbe740
--- /dev/null
@@ -0,0 +1,60 @@
+{
+  "name": "async",
+  "description": "Higher-order functions and common patterns for asynchronous code",
+  "main": "./lib/async",
+  "author": {
+    "name": "Caolan McMahon"
+  },
+  "version": "0.9.0",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/caolan/async.git"
+  },
+  "bugs": {
+    "url": "https://github.com/caolan/async/issues"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://github.com/caolan/async/raw/master/LICENSE"
+    }
+  ],
+  "devDependencies": {
+    "nodeunit": ">0.0.0",
+    "uglify-js": "1.2.x",
+    "nodelint": ">0.0.0"
+  },
+  "jam": {
+    "main": "lib/async.js",
+    "include": [
+      "lib/async.js",
+      "README.md",
+      "LICENSE"
+    ]
+  },
+  "scripts": {
+    "test": "nodeunit test/test-async.js"
+  },
+  "homepage": "https://github.com/caolan/async",
+  "_id": "async@0.9.0",
+  "dist": {
+    "shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
+    "tarball": "http://registry.npmjs.org/async/-/async-0.9.0.tgz"
+  },
+  "_from": "async@~0.9.0",
+  "_npmVersion": "1.4.3",
+  "_npmUser": {
+    "name": "caolan",
+    "email": "caolan.mcmahon@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "caolan",
+      "email": "caolan@caolanmcmahon.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
+  "_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/License b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/License
new file mode 100755 (executable)
index 0000000..4804b7a
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md
new file mode 100755 (executable)
index 0000000..8043cb4
--- /dev/null
@@ -0,0 +1,132 @@
+# combined-stream [![Build Status](https://travis-ci.org/felixge/node-combined-stream.svg?branch=master)](https://travis-ci.org/felixge/node-combined-stream)
+
+A stream that emits multiple other streams one after another.
+
+## Installation
+
+``` bash
+npm install combined-stream
+```
+
+## Usage
+
+Here is a simple example that shows how you can use combined-stream to combine
+two files into one:
+
+``` javascript
+var CombinedStream = require('combined-stream');
+var fs = require('fs');
+
+var combinedStream = CombinedStream.create();
+combinedStream.append(fs.createReadStream('file1.txt'));
+combinedStream.append(fs.createReadStream('file2.txt'));
+
+combinedStream.pipe(fs.createWriteStream('combined.txt'));
+```
+
+While the example above works great, it will pause all source streams until
+they are needed. If you don't want that to happen, you can set `pauseStreams`
+to `false`:
+
+``` javascript
+var CombinedStream = require('combined-stream');
+var fs = require('fs');
+
+var combinedStream = CombinedStream.create({pauseStreams: false});
+combinedStream.append(fs.createReadStream('file1.txt'));
+combinedStream.append(fs.createReadStream('file2.txt'));
+
+combinedStream.pipe(fs.createWriteStream('combined.txt'));
+```
+
+However, what if you don't have all the source streams yet, or you don't want
+to allocate the resources (file descriptors, memory, etc.) for them right away?
+Well, in that case you can simply provide a callback that supplies the stream
+by calling a `next()` function:
+
+``` javascript
+var CombinedStream = require('combined-stream');
+var fs = require('fs');
+
+var combinedStream = CombinedStream.create();
+combinedStream.append(function(next) {
+  next(fs.createReadStream('file1.txt'));
+});
+combinedStream.append(function(next) {
+  next(fs.createReadStream('file2.txt'));
+});
+
+combinedStream.pipe(fs.createWriteStream('combined.txt'));
+```
+
+## API
+
+### CombinedStream.create([options])
+
+Returns a new combined stream object. Available options are:
+
+* `maxDataSize`
+* `pauseStreams`
+
+The effect of those options is described below.
+
+### combinedStream.pauseStreams = `true`
+
+Whether to apply back pressure to the underlaying streams. If set to `false`,
+the underlaying streams will never be paused. If set to `true`, the
+underlaying streams will be paused right after being appended, as well as when
+`delayedStream.pipe()` wants to throttle.
+
+### combinedStream.maxDataSize = `2 * 1024 * 1024`
+
+The maximum amount of bytes (or characters) to buffer for all source streams.
+If this value is exceeded, `combinedStream` emits an `'error'` event.
+
+### combinedStream.dataSize = `0`
+
+The amount of bytes (or characters) currently buffered by `combinedStream`.
+
+### combinedStream.append(stream)
+
+Appends the given `stream` to the combinedStream object. If `pauseStreams` is
+set to `true, this stream will also be paused right away.
+
+`streams` can also be a function that takes one parameter called `next`. `next`
+is a function that must be invoked in order to provide the `next` stream, see
+example above.
+
+Regardless of how the `stream` is appended, combined-stream always attaches an
+`'error'` listener to it, so you don't have to do that manually.
+
+Special case: `stream` can also be a String or Buffer.
+
+### combinedStream.write(data)
+
+You should not call this, `combinedStream` takes care of piping the appended
+streams into itself for you.
+
+### combinedStream.resume()
+
+Causes `combinedStream` to start drain the streams it manages. The function is
+idempotent, and also emits a `'resume'` event each time which usually goes to
+the stream that is currently being drained.
+
+### combinedStream.pause();
+
+If `combinedStream.pauseStreams` is set to `false`, this does nothing.
+Otherwise a `'pause'` event is emitted, this goes to the stream that is
+currently being drained, so you can use it to apply back pressure.
+
+### combinedStream.end();
+
+Sets `combinedStream.writable` to false, emits an `'end'` event, and removes
+all streams from the queue.
+
+### combinedStream.destroy();
+
+Same as `combinedStream.end()`, except it emits a `'close'` event instead of
+`'end'`.
+
+## License
+
+combined-stream is licensed under the MIT license.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js
new file mode 100755 (executable)
index 0000000..6b5c21b
--- /dev/null
@@ -0,0 +1,188 @@
+var util = require('util');
+var Stream = require('stream').Stream;
+var DelayedStream = require('delayed-stream');
+
+module.exports = CombinedStream;
+function CombinedStream() {
+  this.writable = false;
+  this.readable = true;
+  this.dataSize = 0;
+  this.maxDataSize = 2 * 1024 * 1024;
+  this.pauseStreams = true;
+
+  this._released = false;
+  this._streams = [];
+  this._currentStream = null;
+}
+util.inherits(CombinedStream, Stream);
+
+CombinedStream.create = function(options) {
+  var combinedStream = new this();
+
+  options = options || {};
+  for (var option in options) {
+    combinedStream[option] = options[option];
+  }
+
+  return combinedStream;
+};
+
+CombinedStream.isStreamLike = function(stream) {
+  return (typeof stream !== 'function')
+    && (typeof stream !== 'string')
+    && (typeof stream !== 'boolean')
+    && (typeof stream !== 'number')
+    && (!Buffer.isBuffer(stream));
+};
+
+CombinedStream.prototype.append = function(stream) {
+  var isStreamLike = CombinedStream.isStreamLike(stream);
+
+  if (isStreamLike) {
+    if (!(stream instanceof DelayedStream)) {
+      var newStream = DelayedStream.create(stream, {
+        maxDataSize: Infinity,
+        pauseStream: this.pauseStreams,
+      });
+      stream.on('data', this._checkDataSize.bind(this));
+      stream = newStream;
+    }
+
+    this._handleErrors(stream);
+
+    if (this.pauseStreams) {
+      stream.pause();
+    }
+  }
+
+  this._streams.push(stream);
+  return this;
+};
+
+CombinedStream.prototype.pipe = function(dest, options) {
+  Stream.prototype.pipe.call(this, dest, options);
+  this.resume();
+  return dest;
+};
+
+CombinedStream.prototype._getNext = function() {
+  this._currentStream = null;
+  var stream = this._streams.shift();
+
+
+  if (typeof stream == 'undefined') {
+    this.end();
+    return;
+  }
+
+  if (typeof stream !== 'function') {
+    this._pipeNext(stream);
+    return;
+  }
+
+  var getStream = stream;
+  getStream(function(stream) {
+    var isStreamLike = CombinedStream.isStreamLike(stream);
+    if (isStreamLike) {
+      stream.on('data', this._checkDataSize.bind(this));
+      this._handleErrors(stream);
+    }
+
+    this._pipeNext(stream);
+  }.bind(this));
+};
+
+CombinedStream.prototype._pipeNext = function(stream) {
+  this._currentStream = stream;
+
+  var isStreamLike = CombinedStream.isStreamLike(stream);
+  if (isStreamLike) {
+    stream.on('end', this._getNext.bind(this));
+    stream.pipe(this, {end: false});
+    return;
+  }
+
+  var value = stream;
+  this.write(value);
+  this._getNext();
+};
+
+CombinedStream.prototype._handleErrors = function(stream) {
+  var self = this;
+  stream.on('error', function(err) {
+    self._emitError(err);
+  });
+};
+
+CombinedStream.prototype.write = function(data) {
+  this.emit('data', data);
+};
+
+CombinedStream.prototype.pause = function() {
+  if (!this.pauseStreams) {
+    return;
+  }
+
+  if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
+  this.emit('pause');
+};
+
+CombinedStream.prototype.resume = function() {
+  if (!this._released) {
+    this._released = true;
+    this.writable = true;
+    this._getNext();
+  }
+
+  if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
+  this.emit('resume');
+};
+
+CombinedStream.prototype.end = function() {
+  this._reset();
+  this.emit('end');
+};
+
+CombinedStream.prototype.destroy = function() {
+  this._reset();
+  this.emit('close');
+};
+
+CombinedStream.prototype._reset = function() {
+  this.writable = false;
+  this._streams = [];
+  this._currentStream = null;
+};
+
+CombinedStream.prototype._checkDataSize = function() {
+  this._updateDataSize();
+  if (this.dataSize <= this.maxDataSize) {
+    return;
+  }
+
+  var message =
+    'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
+  this._emitError(new Error(message));
+};
+
+CombinedStream.prototype._updateDataSize = function() {
+  this.dataSize = 0;
+
+  var self = this;
+  this._streams.forEach(function(stream) {
+    if (!stream.dataSize) {
+      return;
+    }
+
+    self.dataSize += stream.dataSize;
+  });
+
+  if (this._currentStream && this._currentStream.dataSize) {
+    this.dataSize += this._currentStream.dataSize;
+  }
+};
+
+CombinedStream.prototype._emitError = function(err) {
+  this._reset();
+  this.emit('error', err);
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License
new file mode 100755 (executable)
index 0000000..4804b7a
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile
new file mode 100755 (executable)
index 0000000..b4ff85a
--- /dev/null
@@ -0,0 +1,7 @@
+SHELL := /bin/bash
+
+test:
+       @./test/run.js
+
+.PHONY: test
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md
new file mode 100755 (executable)
index 0000000..5cb5b35
--- /dev/null
@@ -0,0 +1,154 @@
+# delayed-stream
+
+Buffers events from a stream until you are ready to handle them.
+
+## Installation
+
+``` bash
+npm install delayed-stream
+```
+
+## Usage
+
+The following example shows how to write a http echo server that delays its
+response by 1000 ms.
+
+``` javascript
+var DelayedStream = require('delayed-stream');
+var http = require('http');
+
+http.createServer(function(req, res) {
+  var delayed = DelayedStream.create(req);
+
+  setTimeout(function() {
+    res.writeHead(200);
+    delayed.pipe(res);
+  }, 1000);
+});
+```
+
+If you are not using `Stream#pipe`, you can also manually release the buffered
+events by calling `delayedStream.resume()`:
+
+``` javascript
+var delayed = DelayedStream.create(req);
+
+setTimeout(function() {
+  // Emit all buffered events and resume underlaying source
+  delayed.resume();
+}, 1000);
+```
+
+## Implementation
+
+In order to use this meta stream properly, here are a few things you should
+know about the implementation.
+
+### Event Buffering / Proxying
+
+All events of the `source` stream are hijacked by overwriting the `source.emit`
+method. Until node implements a catch-all event listener, this is the only way.
+
+However, delayed-stream still continues to emit all events it captures on the
+`source`, regardless of whether you have released the delayed stream yet or
+not.
+
+Upon creation, delayed-stream captures all `source` events and stores them in
+an internal event buffer. Once `delayedStream.release()` is called, all
+buffered events are emitted on the `delayedStream`, and the event buffer is
+cleared. After that, delayed-stream merely acts as a proxy for the underlaying
+source.
+
+### Error handling
+
+Error events on `source` are buffered / proxied just like any other events.
+However, `delayedStream.create` attaches a no-op `'error'` listener to the
+`source`. This way you only have to handle errors on the `delayedStream`
+object, rather than in two places.
+
+### Buffer limits
+
+delayed-stream provides a `maxDataSize` property that can be used to limit
+the amount of data being buffered. In order to protect you from bad `source`
+streams that don't react to `source.pause()`, this feature is enabled by
+default.
+
+## API
+
+### DelayedStream.create(source, [options])
+
+Returns a new `delayedStream`. Available options are:
+
+* `pauseStream`
+* `maxDataSize`
+
+The description for those properties can be found below.
+
+### delayedStream.source
+
+The `source` stream managed by this object. This is useful if you are
+passing your `delayedStream` around, and you still want to access properties
+on the `source` object.
+
+### delayedStream.pauseStream = true
+
+Whether to pause the underlaying `source` when calling
+`DelayedStream.create()`. Modifying this property afterwards has no effect.
+
+### delayedStream.maxDataSize = 1024 * 1024
+
+The amount of data to buffer before emitting an `error`.
+
+If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
+refers to bytes.
+
+If the underlaying source is emitting JavaScript strings, the size refers to
+characters.
+
+If you know what you are doing, you can set this property to `Infinity` to
+disable this feature. You can also modify this property during runtime.
+
+### delayedStream.maxDataSize = 1024 * 1024
+
+The amount of data to buffer before emitting an `error`.
+
+If the underlaying source is emitting `Buffer` objects, the `maxDataSize`
+refers to bytes.
+
+If the underlaying source is emitting JavaScript strings, the size refers to
+characters.
+
+If you know what you are doing, you can set this property to `Infinity` to
+disable this feature.
+
+### delayedStream.dataSize = 0
+
+The amount of data buffered so far.
+
+### delayedStream.readable
+
+An ECMA5 getter that returns the value of `source.readable`.
+
+### delayedStream.resume()
+
+If the `delayedStream` has not been released so far, `delayedStream.release()`
+is called.
+
+In either case, `source.resume()` is called.
+
+### delayedStream.pause()
+
+Calls `source.pause()`.
+
+### delayedStream.pipe(dest)
+
+Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.
+
+### delayedStream.release()
+
+Emits and clears all events that have been buffered up so far. This does not
+resume the underlaying source, use `delayedStream.resume()` instead.
+
+## License
+
+delayed-stream is licensed under the MIT license.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js
new file mode 100755 (executable)
index 0000000..7c10d48
--- /dev/null
@@ -0,0 +1,99 @@
+var Stream = require('stream').Stream;
+var util = require('util');
+
+module.exports = DelayedStream;
+function DelayedStream() {
+  this.source = null;
+  this.dataSize = 0;
+  this.maxDataSize = 1024 * 1024;
+  this.pauseStream = true;
+
+  this._maxDataSizeExceeded = false;
+  this._released = false;
+  this._bufferedEvents = [];
+}
+util.inherits(DelayedStream, Stream);
+
+DelayedStream.create = function(source, options) {
+  var delayedStream = new this();
+
+  options = options || {};
+  for (var option in options) {
+    delayedStream[option] = options[option];
+  }
+
+  delayedStream.source = source;
+
+  var realEmit = source.emit;
+  source.emit = function() {
+    delayedStream._handleEmit(arguments);
+    return realEmit.apply(source, arguments);
+  };
+
+  source.on('error', function() {});
+  if (delayedStream.pauseStream) {
+    source.pause();
+  }
+
+  return delayedStream;
+};
+
+DelayedStream.prototype.__defineGetter__('readable', function() {
+  return this.source.readable;
+});
+
+DelayedStream.prototype.resume = function() {
+  if (!this._released) {
+    this.release();
+  }
+
+  this.source.resume();
+};
+
+DelayedStream.prototype.pause = function() {
+  this.source.pause();
+};
+
+DelayedStream.prototype.release = function() {
+  this._released = true;
+
+  this._bufferedEvents.forEach(function(args) {
+    this.emit.apply(this, args);
+  }.bind(this));
+  this._bufferedEvents = [];
+};
+
+DelayedStream.prototype.pipe = function() {
+  var r = Stream.prototype.pipe.apply(this, arguments);
+  this.resume();
+  return r;
+};
+
+DelayedStream.prototype._handleEmit = function(args) {
+  if (this._released) {
+    this.emit.apply(this, args);
+    return;
+  }
+
+  if (args[0] === 'data') {
+    this.dataSize += args[1].length;
+    this._checkIfMaxDataSizeExceeded();
+  }
+
+  this._bufferedEvents.push(args);
+};
+
+DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
+  if (this._maxDataSizeExceeded) {
+    return;
+  }
+
+  if (this.dataSize <= this.maxDataSize) {
+    return;
+  }
+
+  this._maxDataSizeExceeded = true;
+  var message =
+    'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'
+  this.emit('error', new Error(message));
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
new file mode 100755 (executable)
index 0000000..83a95e6
--- /dev/null
@@ -0,0 +1,38 @@
+{
+  "author": {
+    "name": "Felix Geisendörfer",
+    "email": "felix@debuggable.com",
+    "url": "http://debuggable.com/"
+  },
+  "name": "delayed-stream",
+  "description": "Buffers events from a stream until you are ready to handle them.",
+  "version": "0.0.5",
+  "homepage": "https://github.com/felixge/node-delayed-stream",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/felixge/node-delayed-stream.git"
+  },
+  "main": "./lib/delayed_stream",
+  "engines": {
+    "node": ">=0.4.0"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "fake": "0.2.0",
+    "far": "0.0.1"
+  },
+  "_id": "delayed-stream@0.0.5",
+  "_engineSupported": true,
+  "_npmVersion": "1.0.3",
+  "_nodeVersion": "v0.4.9-pre",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "d4b1f43a93e8296dfe02694f4680bc37a313c73f",
+    "tarball": "http://registry.nodejitsu.com/delayed-stream/-/delayed-stream-0.0.5.tgz"
+  },
+  "scripts": {},
+  "directories": {},
+  "_shasum": "d4b1f43a93e8296dfe02694f4680bc37a313c73f",
+  "_from": "delayed-stream@0.0.5",
+  "_resolved": "http://registry.nodejitsu.com/delayed-stream/-/delayed-stream-0.0.5.tgz"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js
new file mode 100755 (executable)
index 0000000..4d71b8a
--- /dev/null
@@ -0,0 +1,6 @@
+var common = module.exports;
+
+common.DelayedStream = require('..');
+common.assert = require('assert');
+common.fake = require('fake');
+common.PORT = 49252;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
new file mode 100755 (executable)
index 0000000..9ecad5b
--- /dev/null
@@ -0,0 +1,38 @@
+var common = require('../common');
+var assert = common.assert;
+var DelayedStream = common.DelayedStream;
+var http = require('http');
+
+var UPLOAD = new Buffer(10 * 1024 * 1024);
+
+var server = http.createServer(function(req, res) {
+  var delayed = DelayedStream.create(req, {maxDataSize: UPLOAD.length});
+
+  setTimeout(function() {
+    res.writeHead(200);
+    delayed.pipe(res);
+  }, 10);
+});
+server.listen(common.PORT, function() {
+  var request = http.request({
+    method: 'POST',
+    port: common.PORT,
+  });
+
+  request.write(UPLOAD);
+  request.end();
+
+  request.on('response', function(res) {
+    var received = 0;
+    res
+      .on('data', function(chunk) {
+        received += chunk.length;
+      })
+      .on('end', function() {
+        assert.equal(received, UPLOAD.length);
+        server.close();
+      });
+  });
+});
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
new file mode 100755 (executable)
index 0000000..6f417f3
--- /dev/null
@@ -0,0 +1,21 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testAutoPause() {
+  var source = new Stream();
+
+  fake.expect(source, 'pause', 1);
+  var delayedStream = DelayedStream.create(source);
+  fake.verify();
+})();
+
+(function testDisableAutoPause() {
+  var source = new Stream();
+  fake.expect(source, 'pause', 0);
+
+  var delayedStream = DelayedStream.create(source, {pauseStream: false});
+  fake.verify();
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
new file mode 100755 (executable)
index 0000000..b50c397
--- /dev/null
@@ -0,0 +1,14 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testDelayEventsUntilResume() {
+  var source = new Stream();
+  var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+  fake.expect(source, 'pause');
+  delayedStream.pause();
+  fake.verify();
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js
new file mode 100755 (executable)
index 0000000..fc4047e
--- /dev/null
@@ -0,0 +1,48 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testDelayEventsUntilResume() {
+  var source = new Stream();
+  var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+  // delayedStream must not emit until we resume
+  fake.expect(delayedStream, 'emit', 0);
+
+  // but our original source must emit
+  var params = [];
+  source.on('foo', function(param) {
+    params.push(param);
+  });
+
+  source.emit('foo', 1);
+  source.emit('foo', 2);
+
+  // Make sure delayedStream did not emit, and source did
+  assert.deepEqual(params, [1, 2]);
+  fake.verify();
+
+  // After resume, delayedStream must playback all events
+  fake
+    .stub(delayedStream, 'emit')
+    .times(Infinity)
+    .withArg(1, 'newListener');
+  fake.expect(delayedStream, 'emit', ['foo', 1]);
+  fake.expect(delayedStream, 'emit', ['foo', 2]);
+  fake.expect(source, 'resume');
+
+  delayedStream.resume();
+  fake.verify();
+
+  // Calling resume again will delegate to source
+  fake.expect(source, 'resume');
+  delayedStream.resume();
+  fake.verify();
+
+  // Emitting more events directly leads to them being emitted
+  fake.expect(delayedStream, 'emit', ['foo', 3]);
+  source.emit('foo', 3);
+  fake.verify();
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
new file mode 100755 (executable)
index 0000000..a9d35e7
--- /dev/null
@@ -0,0 +1,15 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testHandleSourceErrors() {
+  var source = new Stream();
+  var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+  // We deal with this by attaching a no-op listener to 'error' on the source
+  // when creating a new DelayedStream. This way error events on the source
+  // won't throw.
+  source.emit('error', new Error('something went wrong'));
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js
new file mode 100755 (executable)
index 0000000..7638a2b
--- /dev/null
@@ -0,0 +1,18 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testMaxDataSize() {
+  var source = new Stream();
+  var delayedStream = DelayedStream.create(source, {maxDataSize: 1024, pauseStream: false});
+
+  source.emit('data', new Buffer(1024));
+
+  fake
+    .expect(delayedStream, 'emit')
+    .withArg(1, 'error');
+  source.emit('data', new Buffer(1));
+  fake.verify();
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
new file mode 100755 (executable)
index 0000000..7d312ab
--- /dev/null
@@ -0,0 +1,13 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testPipeReleases() {
+  var source = new Stream();
+  var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+  fake.expect(delayedStream, 'resume');
+  delayedStream.pipe(new Stream());
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js
new file mode 100755 (executable)
index 0000000..d436163
--- /dev/null
@@ -0,0 +1,13 @@
+var common = require('../common');
+var assert = common.assert;
+var fake = common.fake.create();
+var DelayedStream = common.DelayedStream;
+var Stream = require('stream').Stream;
+
+(function testProxyReadableProperty() {
+  var source = new Stream();
+  var delayedStream = DelayedStream.create(source, {pauseStream: false});
+
+  source.readable = fake.value('source.readable');
+  assert.strictEqual(delayedStream.readable, source.readable);
+})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js
new file mode 100755 (executable)
index 0000000..0bb8e82
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var far = require('far').create();
+
+far.add(__dirname);
+far.include(/test-.*\.js$/);
+
+far.execute();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
new file mode 100755 (executable)
index 0000000..55cb227
--- /dev/null
@@ -0,0 +1,60 @@
+{
+  "author": {
+    "name": "Felix Geisendörfer",
+    "email": "felix@debuggable.com",
+    "url": "http://debuggable.com/"
+  },
+  "name": "combined-stream",
+  "description": "A stream that emits multiple other streams one after another.",
+  "version": "0.0.7",
+  "homepage": "https://github.com/felixge/node-combined-stream",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/felixge/node-combined-stream.git"
+  },
+  "main": "./lib/combined_stream",
+  "scripts": {
+    "test": "node test/run.js"
+  },
+  "engines": {
+    "node": ">= 0.8"
+  },
+  "dependencies": {
+    "delayed-stream": "0.0.5"
+  },
+  "devDependencies": {
+    "far": "~0.0.7"
+  },
+  "bugs": {
+    "url": "https://github.com/felixge/node-combined-stream/issues"
+  },
+  "_id": "combined-stream@0.0.7",
+  "dist": {
+    "shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f",
+    "tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz"
+  },
+  "_from": "combined-stream@~0.0.4",
+  "_npmVersion": "1.4.3",
+  "_npmUser": {
+    "name": "felixge",
+    "email": "felix@debuggable.com"
+  },
+  "maintainers": [
+    {
+      "name": "felixge",
+      "email": "felix@debuggable.com"
+    },
+    {
+      "name": "celer",
+      "email": "celer@scrypt.net"
+    },
+    {
+      "name": "alexindigo",
+      "email": "iam@alexindigo.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "0137e657baa5a7541c57ac37ac5fc07d73b4dc1f",
+  "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/form-data/package.json
new file mode 100755 (executable)
index 0000000..afda8b6
--- /dev/null
@@ -0,0 +1,80 @@
+{
+  "author": {
+    "name": "Felix Geisendörfer",
+    "email": "felix@debuggable.com",
+    "url": "http://debuggable.com/"
+  },
+  "name": "form-data",
+  "description": "A module to create readable \"multipart/form-data\" streams.  Can be used to submit forms and file uploads to other web applications.",
+  "version": "0.1.4",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/felixge/node-form-data.git"
+  },
+  "main": "./lib/form_data",
+  "scripts": {
+    "test": "node test/run.js"
+  },
+  "engines": {
+    "node": ">= 0.8"
+  },
+  "dependencies": {
+    "combined-stream": "~0.0.4",
+    "mime": "~1.2.11",
+    "async": "~0.9.0"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://raw.github.com/felixge/node-form-data/master/License"
+    }
+  ],
+  "devDependencies": {
+    "fake": "~0.2.2",
+    "far": "~0.0.7",
+    "formidable": "~1.0.14",
+    "request": "~2.36.0"
+  },
+  "gitHead": "5f5f4809ea685f32658809fa0f13d7eface0e45a",
+  "bugs": {
+    "url": "https://github.com/felixge/node-form-data/issues"
+  },
+  "homepage": "https://github.com/felixge/node-form-data",
+  "_id": "form-data@0.1.4",
+  "_shasum": "91abd788aba9702b1aabfa8bc01031a2ac9e3b12",
+  "_from": "form-data@~0.1.0",
+  "_npmVersion": "1.4.14",
+  "_npmUser": {
+    "name": "alexindigo",
+    "email": "iam@alexindigo.com"
+  },
+  "maintainers": [
+    {
+      "name": "felixge",
+      "email": "felix@debuggable.com"
+    },
+    {
+      "name": "idralyuk",
+      "email": "igor@buran.us"
+    },
+    {
+      "name": "alexindigo",
+      "email": "iam@alexindigo.com"
+    },
+    {
+      "name": "mikeal",
+      "email": "mikeal.rogers@gmail.com"
+    },
+    {
+      "name": "celer",
+      "email": "dtyree77@gmail.com"
+    }
+  ],
+  "dist": {
+    "shasum": "91abd788aba9702b1aabfa8bc01031a2ac9e3b12",
+    "tarball": "http://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/LICENSE
new file mode 100755 (executable)
index 0000000..e699a7b
--- /dev/null
@@ -0,0 +1,24 @@
+Copyright (c) 2012-2013, Eran Hammer.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Eran Hammer nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL ERAN HAMMER BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/Makefile
new file mode 100755 (executable)
index 0000000..5f339bf
--- /dev/null
@@ -0,0 +1,10 @@
+test:
+       @node node_modules/lab/bin/lab
+test-cov: 
+       @node node_modules/lab/bin/lab -r threshold -t 100
+test-cov-html:
+       @node node_modules/lab/bin/lab -r html -o coverage.html
+complexity:
+       @node node_modules/complexity-report/src/cli.js -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/README.md
new file mode 100755 (executable)
index 0000000..010bac6
--- /dev/null
@@ -0,0 +1,627 @@
+![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png)
+
+<img align="right" src="https://raw.github.com/hueniverse/hawk/master/images/logo.png" /> **Hawk** is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial
+HTTP request cryptographic verification. For more complex use cases such as access delegation, see [Oz](https://github.com/hueniverse/oz).
+
+Current version: **1.0**
+
+[![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk)
+
+# Table of Content
+
+- [**Introduction**](#introduction)
+  - [Replay Protection](#replay-protection)
+  - [Usage Example](#usage-example)
+  - [Protocol Example](#protocol-example)
+    - [Payload Validation](#payload-validation)
+    - [Response Payload Validation](#response-payload-validation)
+  - [Browser Support and Considerations](#browser-support-and-considerations)
+<p></p>
+- [**Single URI Authorization**](#single-uri-authorization)
+  - [Usage Example](#bewit-usage-example)
+<p></p>
+- [**Security Considerations**](#security-considerations)
+  - [MAC Keys Transmission](#mac-keys-transmission)
+  - [Confidentiality of Requests](#confidentiality-of-requests)
+  - [Spoofing by Counterfeit Servers](#spoofing-by-counterfeit-servers)
+  - [Plaintext Storage of Credentials](#plaintext-storage-of-credentials)
+  - [Entropy of Keys](#entropy-of-keys)
+  - [Coverage Limitations](#coverage-limitations)
+  - [Future Time Manipulation](#future-time-manipulation)
+  - [Client Clock Poisoning](#client-clock-poisoning)
+  - [Bewit Limitations](#bewit-limitations)
+  - [Host Header Forgery](#host-header-forgery)
+<p></p>
+- [**Frequently Asked Questions**](#frequently-asked-questions)
+<p></p>
+- [**Acknowledgements**](#acknowledgements)
+
+# Introduction
+
+**Hawk** is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with
+partial cryptographic verification of the request and response, covering the HTTP method, request URI, host,
+and optionally the request payload.
+
+Similar to the HTTP [Digest access authentication schemes](http://www.ietf.org/rfc/rfc2617.txt), **Hawk** uses a set of
+client credentials which include an identifier (e.g. username) and key (e.g. password). Likewise, just as with the Digest scheme,
+the key is never included in authenticated requests. Instead, it is used to calculate a request MAC value which is
+included in its place.
+
+However, **Hawk** has several differences from Digest. In particular, while both use a nonce to limit the possibility of
+replay attacks, in **Hawk** the client generates the nonce and uses it in combination with a timestamp, leading to less
+"chattiness" (interaction with the server).
+
+Also unlike Digest, this scheme is not intended to protect the key itself (the password in Digest) because
+the client and server must both have access to the key material in the clear.
+
+The primary design goals of this scheme are to:
+* simplify and improve HTTP authentication for services that are unwilling or unable to deploy TLS for all resources,
+* secure credentials against leakage (e.g., when the client uses some form of dynamic configuration to determine where
+  to send an authenticated request), and
+* avoid the exposure of credentials sent to a malicious server over an unauthenticated secure channel due to client
+  failure to validate the server's identity as part of its TLS handshake.
+
+In addition, **Hawk** supports a method for granting third-parties temporary access to individual resources using
+a query parameter called _bewit_ (in falconry, a leather strap used to attach a tracking device to the leg of a hawk).
+
+The **Hawk** scheme requires the establishment of a shared symmetric key between the client and the server,
+which is beyond the scope of this module. Typically, the shared credentials are established via an initial
+TLS-protected phase or derived from some other shared confidential information available to both the client
+and the server.
+
+
+## Replay Protection
+
+Without replay protection, an attacker can use a compromised (but otherwise valid and authenticated) request more 
+than once, gaining access to a protected resource. To mitigate this, clients include both a nonce and a timestamp when 
+making requests. This gives the server enough information to prevent replay attacks.
+
+The nonce is generated by the client, and is a string unique across all requests with the same timestamp and
+key identifier combination. 
+
+The timestamp enables the server to restrict the validity period of the credentials where requests occuring afterwards
+are rejected. It also removes the need for the server to retain an unbounded number of nonce values for future checks.
+By default, **Hawk** uses a time window of 1 minute to allow for time skew between the client and server (which in
+practice translates to a maximum of 2 minutes as the skew can be positive or negative).
+
+Using a timestamp requires the client's clock to be in sync with the server's clock. **Hawk** requires both the client
+clock and the server clock to use NTP to ensure synchronization. However, given the limitations of some client types
+(e.g. browsers) to deploy NTP, the server provides the client with its current time (in seconds precision) in response
+to a bad timestamp.
+
+There is no expectation that the client will adjust its system clock to match the server (in fact, this would be a
+potential attack vector). Instead, the client only uses the server's time to calculate an offset used only
+for communications with that particular server. The protocol rewards clients with synchronized clocks by reducing
+the number of round trips required to authenticate the first request.
+
+
+## Usage Example
+
+Server code:
+
+```javascript
+var Http = require('http');
+var Hawk = require('hawk');
+
+
+// Credentials lookup function
+
+var credentialsFunc = function (id, callback) {
+
+    var credentials = {
+        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+        algorithm: 'sha256',
+        user: 'Steve'
+    };
+
+    return callback(null, credentials);
+};
+
+// Create HTTP server
+
+var handler = function (req, res) {
+
+    // Authenticate incoming request
+
+    Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+        // Prepare response
+
+        var payload = (!err ? 'Hello ' + credentials.user + ' ' + artifacts.ext : 'Shoosh!');
+        var headers = { 'Content-Type': 'text/plain' };
+
+        // Generate Server-Authorization response header
+
+        var header = Hawk.server.header(credentials, artifacts, { payload: payload, contentType: headers['Content-Type'] });
+        headers['Server-Authorization'] = header;
+
+        // Send the response back
+
+        res.writeHead(!err ? 200 : 401, headers);
+        res.end(payload);
+    });
+};
+
+// Start server
+
+Http.createServer(handler).listen(8000, 'example.com');
+```
+
+Client code:
+
+```javascript
+var Request = require('request');
+var Hawk = require('hawk');
+
+
+// Client credentials
+
+var credentials = {
+    id: 'dh37fgj492je',
+    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+    algorithm: 'sha256'
+}
+
+// Request options
+
+var requestOptions = {
+    uri: 'http://example.com:8000/resource/1?b=1&a=2',
+    method: 'GET',
+    headers: {}
+};
+
+// Generate Authorization request header
+
+var header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'some-app-data' });
+requestOptions.headers.Authorization = header.field;
+
+// Send authenticated request
+
+Request(requestOptions, function (error, response, body) {
+
+    // Authenticate the server's response
+
+    var isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });
+
+    // Output results
+
+    console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));
+});
+```
+
+**Hawk** utilized the [**SNTP**](https://github.com/hueniverse/sntp) module for time sync management. By default, the local
+machine time is used. To automatically retrieve and synchronice the clock within the application, use the SNTP 'start()' method.
+
+```javascript
+Hawk.sntp.start();
+```
+
+
+## Protocol Example
+
+The client attempts to access a protected resource without authentication, sending the following HTTP request to
+the resource server:
+
+```
+GET /resource/1?b=1&a=2 HTTP/1.1
+Host: example.com:8000
+```
+
+The resource server returns an authentication challenge.
+
+```
+HTTP/1.1 401 Unauthorized
+WWW-Authenticate: Hawk
+```
+
+The client has previously obtained a set of **Hawk** credentials for accessing resources on the "http://example.com/"
+server. The **Hawk** credentials issued to the client include the following attributes:
+
+* Key identifier: dh37fgj492je
+* Key: werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn
+* Algorithm: sha256
+
+The client generates the authentication header by calculating a timestamp (e.g. the number of seconds since January 1,
+1970 00:00:00 GMT), generating a nonce, and constructing the normalized request string (each value followed by a newline
+character):
+
+```
+hawk.1.header
+1353832234
+j4h3g2
+GET
+/resource/1?b=1&a=2
+example.com
+8000
+
+some-app-ext-data
+
+```
+
+The request MAC is calculated using HMAC with the specified hash algorithm "sha256" and the key over the normalized request string.
+The result is base64-encoded to produce the request MAC:
+
+```
+6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=
+```
+
+The client includes the **Hawk** key identifier, timestamp, nonce, application specific data, and request MAC with the request using
+the HTTP `Authorization` request header field:
+
+```
+GET /resource/1?b=1&a=2 HTTP/1.1
+Host: example.com:8000
+Authorization: Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="
+```
+
+The server validates the request by calculating the request MAC again based on the request received and verifies the validity
+and scope of the **Hawk** credentials. If valid, the server responds with the requested resource.
+
+
+### Payload Validation
+
+**Hawk** provides optional payload validation. When generating the authentication header, the client calculates a payload hash
+using the specified hash algorithm. The hash is calculated over the concatenated value of (each followed by a newline character):
+* `hawk.1.payload`
+* the content-type in lowercase, without any parameters (e.g. `application/json`)
+* the request payload prior to any content encoding (the exact representation requirements should be specified by the server for payloads other than simple single-part ascii to ensure interoperability)
+
+For example:
+
+* Payload: `Thank you for flying Hawk`
+* Content Type: `text/plain`
+* Hash (sha256): `Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=`
+
+Results in the following input to the payload hash function (newline terminated values):
+
+```
+hawk.1.payload
+text/plain
+Thank you for flying Hawk
+
+```
+
+Which produces the following hash value:
+
+```
+Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=
+```
+
+The client constructs the normalized request string (newline terminated values):
+
+```
+hawk.1.header
+1353832234
+j4h3g2
+POST
+/resource/1?a=1&b=2
+example.com
+8000
+Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=
+some-app-ext-data
+
+```
+
+Then calculates the request MAC and includes the **Hawk** key identifier, timestamp, nonce, payload hash, application specific data,
+and request MAC, with the request using the HTTP `Authorization` request header field:
+
+```
+POST /resource/1?a=1&b=2 HTTP/1.1
+Host: example.com:8000
+Authorization: Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", hash="Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=", ext="some-app-ext-data", mac="aSe1DERmZuRl3pI36/9BdZmnErTw3sNzOOAUlfeKjVw="
+```
+
+It is up to the server if and when it validates the payload for any given request, based solely on it's security policy
+and the nature of the data included.
+
+If the payload is available at the time of authentication, the server uses the hash value provided by the client to construct
+the normalized string and validates the MAC. If the MAC is valid, the server calculates the payload hash and compares the value
+with the provided payload hash in the header. In many cases, checking the MAC first is faster than calculating the payload hash.
+
+However, if the payload is not available at authentication time (e.g. too large to fit in memory, streamed elsewhere, or processed
+at a different stage in the application), the server may choose to defer payload validation for later by retaining the hash value
+provided by the client after validating the MAC.
+
+It is important to note that MAC validation does not mean the hash value provided by the client is valid, only that the value
+included in the header was not modified. Without calculating the payload hash on the server and comparing it to the value provided
+by the client, the payload may be modified by an attacker.
+
+
+## Response Payload Validation
+
+**Hawk** provides partial response payload validation. The server includes the `Server-Authorization` response header which enables the
+client to authenticate the response and ensure it is talking to the right server. **Hawk** defines the HTTP `Server-Authorization` header
+as a response header using the exact same syntax as the `Authorization` request header field.
+
+The header is contructed using the same process as the client's request header. The server uses the same credentials and other
+artifacts provided by the client to constructs the normalized request string. The `ext` and `hash` values are replaced with
+new values based on the server response. The rest as identical to those used by the client.
+
+The result MAC digest is included with the optional `hash` and `ext` values:
+
+```
+Server-Authorization: Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"
+```
+
+
+## Browser Support and Considerations
+
+A browser script is provided for including using a `<script>` tag in [lib/browser.js](/lib/browser.js).
+
+**Hawk** relies on the _Server-Authorization_ and _WWW-Authenticate_ headers in its response to communicate with the client.
+Therefore, in case of CORS requests, it is important to consider sending _Access-Control-Expose-Headers_ with the value
+_"WWW-Authenticate, Server-Authorization"_ on each response from your server. As explained in the
+[specifications](http://www.w3.org/TR/cors/#access-control-expose-headers-response-header), it will indicate that these headers
+can safely be accessed by the client (using getResponseHeader() on the XmlHttpRequest object). Otherwise you will be met with a
+["simple response header"](http://www.w3.org/TR/cors/#simple-response-header) which excludes these fields and would prevent the
+Hawk client from authenticating the requests.You can read more about the why and how in this
+[article](http://www.html5rocks.com/en/tutorials/cors/#toc-adding-cors-support-to-the-server)
+
+
+# Single URI Authorization
+
+There are cases in which limited and short-term access to a protected resource is granted to a third party which does not
+have access to the shared credentials. For example, displaying a protected image on a web page accessed by anyone. **Hawk**
+provides limited support for such URIs in the form of a _bewit_ - a URI query parameter appended to the request URI which contains
+the necessary credentials to authenticate the request.
+
+Because of the significant security risks involved in issuing such access, bewit usage is purposely limited only to GET requests
+and for a finite period of time. Both the client and server can issue bewit credentials, however, the server should not use the same
+credentials as the client to maintain clear traceability as to who issued which credentials.
+
+In order to simplify implementation, bewit credentials do not support single-use policy and can be replayed multiple times within
+the granted access timeframe. 
+
+
+## Bewit Usage Example
+
+Server code:
+
+```javascript
+var Http = require('http');
+var Hawk = require('hawk');
+
+
+// Credentials lookup function
+
+var credentialsFunc = function (id, callback) {
+
+    var credentials = {
+        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+        algorithm: 'sha256'
+    };
+
+    return callback(null, credentials);
+};
+
+// Create HTTP server
+
+var handler = function (req, res) {
+
+    Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+        res.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' });
+        res.end(!err ? 'Access granted' : 'Shoosh!');
+    });
+};
+
+Http.createServer(handler).listen(8000, 'example.com');
+```
+
+Bewit code generation:
+
+```javascript
+var Request = require('request');
+var Hawk = require('hawk');
+
+
+// Client credentials
+
+var credentials = {
+    id: 'dh37fgj492je',
+    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+    algorithm: 'sha256'
+}
+
+// Generate bewit
+
+var duration = 60 * 5;      // 5 Minutes
+var bewit = Hawk.uri.getBewit('http://example.com:8080/resource/1?b=1&a=2', { credentials: credentials, ttlSec: duration, ext: 'some-app-data' });
+var uri = 'http://example.com:8000/resource/1?b=1&a=2' + '&bewit=' + bewit;
+```
+
+
+# Security Considerations
+
+The greatest sources of security risks are usually found not in **Hawk** but in the policies and procedures surrounding its use.
+Implementers are strongly encouraged to assess how this module addresses their security requirements. This section includes
+an incomplete list of security considerations that must be reviewed and understood before deploying **Hawk** on the server.
+Many of the protections provided in **Hawk** depends on whether and how they are used.
+
+### MAC Keys Transmission
+
+**Hawk** does not provide any mechanism for obtaining or transmitting the set of shared credentials required. Any mechanism used
+to obtain **Hawk** credentials must ensure that these transmissions are protected using transport-layer mechanisms such as TLS.
+
+### Confidentiality of Requests
+
+While **Hawk** provides a mechanism for verifying the integrity of HTTP requests, it provides no guarantee of request
+confidentiality. Unless other precautions are taken, eavesdroppers will have full access to the request content. Servers should
+carefully consider the types of data likely to be sent as part of such requests, and employ transport-layer security mechanisms
+to protect sensitive resources.
+
+### Spoofing by Counterfeit Servers
+
+**Hawk** provides limited verification of the server authenticity. When receiving a response back from the server, the server
+may choose to include a response `Server-Authorization` header which the client can use to verify the response. However, it is up to
+the server to determine when such measure is included, to up to the client to enforce that policy.
+
+A hostile party could take advantage of this by intercepting the client's requests and returning misleading or otherwise
+incorrect responses. Service providers should consider such attacks when developing services using this protocol, and should
+require transport-layer security for any requests where the authenticity of the resource server or of server responses is an issue.
+
+### Plaintext Storage of Credentials
+
+The **Hawk** key functions the same way passwords do in traditional authentication systems. In order to compute the request MAC,
+the server must have access to the key in plaintext form. This is in contrast, for example, to modern operating systems, which
+store only a one-way hash of user credentials.
+
+If an attacker were to gain access to these keys - or worse, to the server's database of all such keys - he or she would be able
+to perform any action on behalf of any resource owner. Accordingly, it is critical that servers protect these keys from unauthorized
+access.
+
+### Entropy of Keys
+
+Unless a transport-layer security protocol is used, eavesdroppers will have full access to authenticated requests and request
+MAC values, and will thus be able to mount offline brute-force attacks to recover the key used. Servers should be careful to
+assign keys which are long enough, and random enough, to resist such attacks for at least the length of time that the **Hawk**
+credentials are valid.
+
+For example, if the credentials are valid for two weeks, servers should ensure that it is not possible to mount a brute force
+attack that recovers the key in less than two weeks. Of course, servers are urged to err on the side of caution, and use the
+longest key reasonable.
+
+It is equally important that the pseudo-random number generator (PRNG) used to generate these keys be of sufficiently high
+quality. Many PRNG implementations generate number sequences that may appear to be random, but which nevertheless exhibit
+patterns or other weaknesses which make cryptanalysis or brute force attacks easier. Implementers should be careful to use
+cryptographically secure PRNGs to avoid these problems.
+
+### Coverage Limitations
+
+The request MAC only covers the HTTP `Host` header and optionally the `Content-Type` header. It does not cover any other headers
+which can often affect how the request body is interpreted by the server. If the server behavior is influenced by the presence
+or value of such headers, an attacker can manipulate the request headers without being detected. Implementers should use the
+`ext` feature to pass application-specific information via the `Authorization` header which is protected by the request MAC.
+
+The response authentication, when performed, only covers the response payload, content-type, and the request information 
+provided by the client in it's request (method, resource, timestamp, nonce, etc.). It does not cover the HTTP status code or
+any other response header field (e.g. Location) which can affect the client's behaviour.
+
+### Future Time Manipulation
+
+The protocol relies on a clock sync between the client and server. To accomplish this, the server informs the client of its
+current time when an invalid timestamp is received.
+
+If an attacker is able to manipulate this information and cause the client to use an incorrect time, it would be able to cause
+the client to generate authenticated requests using time in the future. Such requests will fail when sent by the client, and will
+not likely leave a trace on the server (given the common implementation of nonce, if at all enforced). The attacker will then
+be able to replay the request at the correct time without detection.
+
+The client must only use the time information provided by the server if:
+* it was delivered over a TLS connection and the server identity has been verified, or
+* the `tsm` MAC digest calculated using the same client credentials over the timestamp has been verified.
+
+### Client Clock Poisoning
+
+When receiving a request with a bad timestamp, the server provides the client with its current time. The client must never use
+the time received from the server to adjust its own clock, and must only use it to calculate an offset for communicating with
+that particular server.
+
+### Bewit Limitations
+
+Special care must be taken when issuing bewit credentials to third parties. Bewit credentials are valid until expiration and cannot
+be revoked or limited without using other means. Whatever resource they grant access to will be completely exposed to anyone with
+access to the bewit credentials which act as bearer credentials for that particular resource. While bewit usage is limited to GET
+requests only and therefore cannot be used to perform transactions or change server state, it can still be used to expose private
+and sensitive information.
+
+### Host Header Forgery
+
+Hawk validates the incoming request MAC against the incoming HTTP Host header. However, unless the optional `host` and `port`
+options are used with `server.authenticate()`, a malicous client can mint new host names pointing to the server's IP address and
+use that to craft an attack by sending a valid request that's meant for another hostname than the one used by the server. Server
+implementors must manually verify that the host header received matches their expectation (or use the options mentioned above).
+
+# Frequently Asked Questions
+
+### Where is the protocol specification?
+
+If you are looking for some prose explaining how all this works, **this is it**. **Hawk** is being developed as an open source
+project instead of a standard. In other words, the [code](/hueniverse/hawk/tree/master/lib) is the specification. Not sure about
+something? Open an issue!
+
+### Is it done?
+
+At if version 0.10.0, **Hawk** is feature-complete. However, until this module reaches version 1.0.0 it is considered experimental
+and is likely to change. This also means your feedback and contribution are very welcome. Feel free to open issues with questions
+and suggestions.
+
+### Where can I find **Hawk** implementations in other languages?
+
+**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, others are actively porting it to other
+platforms. There is already a [PHP](https://github.com/alexbilbie/PHP-Hawk),
+[.NET](https://github.com/pcibraro/hawknet), and [JAVA](https://github.com/wealdtech/hawk) libraries available. The full list
+is maintained [here](https://github.com/hueniverse/hawk/issues?labels=port). Please add an issue if you are working on another
+port. A cross-platform test-suite is in the works.
+
+### Why isn't the algorithm part of the challenge or dynamically negotiated?
+
+The algorithm used is closely related to the key issued as different algorithms require different key sizes (and other
+requirements). While some keys can be used for multiple algorithm, the protocol is designed to closely bind the key and algorithm
+together as part of the issued credentials.
+
+### Why is Host and Content-Type the only headers covered by the request MAC?
+
+It is really hard to include other headers. Headers can be changed by proxies and other intermediaries and there is no
+well-established way to normalize them. Many platforms change the case of header field names and values. The only
+straight-forward solution is to include the headers in some blob (say, base64 encoded JSON) and include that with the request,
+an approach taken by JWT and other such formats. However, that design violates the HTTP header boundaries, repeats information,
+and introduces other security issues because firewalls will not be aware of these "hidden" headers. In addition, any information
+repeated must be compared to the duplicated information in the header and therefore only moves the problem elsewhere.
+
+### Why not just use HTTP Digest?
+
+Digest requires pre-negotiation to establish a nonce. This means you can't just make a request - you must first send
+a protocol handshake to the server. This pattern has become unacceptable for most web services, especially mobile
+where extra round-trip are costly.
+
+### Why bother with all this nonce and timestamp business?
+
+**Hawk** is an attempt to find a reasonable, practical compromise between security and usability. OAuth 1.0 got timestamp
+and nonces halfway right but failed when it came to scalability and consistent developer experience. **Hawk** addresses
+it by requiring the client to sync its clock, but provides it with tools to accomplish it.
+
+In general, replay protection is a matter of application-specific threat model. It is less of an issue on a TLS-protected
+system where the clients are implemented using best practices and are under the control of the server. Instead of dropping
+replay protection, **Hawk** offers a required time window and an optional nonce verification. Together, it provides developers
+with the ability to decide how to enforce their security policy without impacting the client's implementation.
+
+### What are `app` and `dlg` in the authorization header and normalized mac string?
+
+The original motivation for **Hawk** was to replace the OAuth 1.0 use cases. This included both a simple client-server mode which
+this module is specifically designed for, and a delegated access mode which is being developed separately in
+[Oz](https://github.com/hueniverse/oz). In addition to the **Hawk** use cases, Oz requires another attribute: the application id `app`.
+This provides binding between the credentials and the application in a way that prevents an attacker from tricking an application
+to use credentials issued to someone else. It also has an optional 'delegated-by' attribute `dlg` which is the application id of the
+application the credentials were directly issued to. The goal of these two additions is to allow Oz to utilize **Hawk** directly,
+but with the additional security of delegated credentials.
+
+### What is the purpose of the static strings used in each normalized MAC input?
+
+When calculating a hash or MAC, a static prefix (tag) is added. The prefix is used to prevent MAC values from being
+used or reused for a purpose other than what they were created for (i.e. prevents switching MAC values between a request,
+response, and a bewit use cases). It also protects against expliots created after a potential change in how the protocol
+creates the normalized string. For example, if a future version would switch the order of nonce and timestamp, it
+can create an exploit opportunity for cases where the nonce is similar in format to a timestamp.
+
+### Does **Hawk** have anything to do with OAuth?
+
+Short answer: no.
+
+**Hawk** was originally proposed as the OAuth MAC Token specification. However, the OAuth working group in its consistent
+incompetence failed to produce a final, usable solution to address one of the most popular use cases of OAuth 1.0 - using it
+to authenticate simple client-server transactions (i.e. two-legged). As you can guess, the OAuth working group is still hard
+at work to produce more garbage.
+
+**Hawk** provides a simple HTTP authentication scheme for making client-server requests. It does not address the OAuth use case
+of delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](https://github.com/hueniverse/oz).
+
+
+# Acknowledgements
+
+**Hawk** is a derivative work of the [HTTP MAC Authentication Scheme](http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05) proposal
+co-authored by Ben Adida, Adam Barth, and Eran Hammer, which in turn was based on the OAuth 1.0 community specification.
+
+Special thanks to Ben Laurie for his always insightful feedback and advice.
+
+The **Hawk** logo was created by [Chris Carrasco](http://chriscarrasco.com).
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/example/usage.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/example/usage.js
new file mode 100755 (executable)
index 0000000..8c063f6
--- /dev/null
@@ -0,0 +1,78 @@
+// Load modules
+
+var Http = require('http');
+var Request = require('request');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {
+    credentials: {
+        dh37fgj492je: {
+            id: 'dh37fgj492je',                                             // Required by Hawk.client.header 
+            key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+            algorithm: 'sha256',
+            user: 'Steve'
+        }
+    }
+};
+
+
+// Credentials lookup function
+
+var credentialsFunc = function (id, callback) {
+
+    return callback(null, internals.credentials[id]);
+};
+
+
+// Create HTTP server
+
+var handler = function (req, res) {
+
+    Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+        var payload = (!err ? 'Hello ' + credentials.user + ' ' + artifacts.ext : 'Shoosh!');
+        var headers = {
+            'Content-Type': 'text/plain',
+            'Server-Authorization': Hawk.server.header(credentials, artifacts, { payload: payload, contentType: 'text/plain' })
+        };
+
+        res.writeHead(!err ? 200 : 401, headers);
+        res.end(payload);
+    });
+};
+
+Http.createServer(handler).listen(8000, '127.0.0.1');
+
+
+// Send unauthenticated request
+
+Request('http://127.0.0.1:8000/resource/1?b=1&a=2', function (error, response, body) {
+
+    console.log(response.statusCode + ': ' + body);
+});
+
+
+// Send authenticated request
+
+credentialsFunc('dh37fgj492je', function (err, credentials) {
+
+    var header = Hawk.client.header('http://127.0.0.1:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'and welcome!' });
+    var options = {
+        uri: 'http://127.0.0.1:8000/resource/1?b=1&a=2',
+        method: 'GET',
+        headers: {
+            authorization: header.field
+        }
+    };
+
+    Request(options, function (error, response, body) {
+
+        var isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });
+        console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));
+        process.exit(0);
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/hawk.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/hawk.png
new file mode 100755 (executable)
index 0000000..a0e15cd
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/hawk.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/logo.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/logo.png
new file mode 100755 (executable)
index 0000000..b8ff590
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/images/logo.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/index.js
new file mode 100755 (executable)
index 0000000..4cc88b3
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/browser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/browser.js
new file mode 100755 (executable)
index 0000000..27494f2
--- /dev/null
@@ -0,0 +1,485 @@
+/*
+    HTTP Hawk Authentication Scheme
+    Copyright (c) 2012-2013, Eran Hammer <eran@hueniverse.com>
+    MIT Licensed
+*/
+
+
+// Declare namespace
+
+var hawk = {};
+
+
+// Export if used as a module
+
+if (typeof module !== "undefined" && module.exports) {
+    module.exports = hawk;
+}
+
+hawk.client = {
+
+    // Generate an Authorization header for a given request
+
+    /*
+        uri: 'http://example.com/resource?a=b'
+        method: HTTP verb (e.g. 'GET', 'POST')
+        options: {
+    
+            // Required
+    
+            credentials: {
+                id: 'dh37fgj492je',
+                key: 'aoijedoaijsdlaksjdl',
+                algorithm: 'sha256'                                 // 'sha1', 'sha256'
+            },
+    
+            // Optional
+    
+            ext: 'application-specific',                        // Application specific data sent via the ext attribute
+            timestamp: Date.now() / 1000,                       // A pre-calculated timestamp in seconds
+            nonce: '2334f34f',                                  // A pre-generated nonce
+            localtimeOffsetMsec: 400,                           // Time offset to sync with server time (ignored if timestamp provided)
+            payload: '{"some":"payload"}',                      // UTF-8 encoded string for body hash generation (ignored if hash provided)
+            contentType: 'application/json',                    // Payload content-type (ignored if hash provided)
+            hash: 'U4MKKSmiVxk37JCCrAVIjV=',                    // Pre-calculated payload hash
+            app: '24s23423f34dx',                               // Oz application id
+            dlg: '234sz34tww3sd'                                // Oz delegated-by application id
+        }
+    */
+
+    header: function (uri, method, options) {
+
+        var result = {
+            field: '',
+            artifacts: {}
+        };
+
+        // Validate inputs
+
+        if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') ||
+            !method || typeof method !== 'string' ||
+            !options || typeof options !== 'object') {
+
+            return result;
+        }
+
+        // Application time
+
+        var timestamp = options.timestamp || Math.floor((hawk.utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
+
+        // Validate credentials
+
+        var credentials = options.credentials;
+        if (!credentials ||
+            !credentials.id ||
+            !credentials.key ||
+            !credentials.algorithm) {
+
+            // Invalid credential object
+            return result;
+        }
+
+        if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+            return result;
+        }
+
+        // Parse URI
+
+        if (typeof uri === 'string') {
+            uri = hawk.utils.parseUri(uri);
+        }
+
+        // Calculate signature
+
+        var artifacts = {
+            ts: timestamp,
+            nonce: options.nonce || hawk.utils.randomString(6),
+            method: method,
+            resource: uri.relative,
+            host: uri.hostname,
+            port: uri.port,
+            hash: options.hash,
+            ext: options.ext,
+            app: options.app,
+            dlg: options.dlg
+        };
+
+        result.artifacts = artifacts;
+
+        // Calculate payload hash
+
+        if (!artifacts.hash &&
+            options.hasOwnProperty('payload')) {
+
+            artifacts.hash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+        }
+
+        var mac = hawk.crypto.calculateMac('header', credentials, artifacts);
+
+        // Construct header
+
+        var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== '';       // Other falsey values allowed
+        var header = 'Hawk id="' + credentials.id +
+                     '", ts="' + artifacts.ts +
+                     '", nonce="' + artifacts.nonce +
+                     (artifacts.hash ? '", hash="' + artifacts.hash : '') +
+                     (hasExt ? '", ext="' + hawk.utils.escapeHeaderAttribute(artifacts.ext) : '') +
+                     '", mac="' + mac + '"';
+
+        if (artifacts.app) {
+            header += ', app="' + artifacts.app +
+                      (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
+        }
+
+        result.field = header;
+
+        return result;
+    },
+
+
+    // Validate server response
+
+    /*
+        request:    object created via 'new XMLHttpRequest()' after response received
+        artifacts:  object recieved from header().artifacts
+        options: {
+            payload:    optional payload received
+            required:   specifies if a Server-Authorization header is required. Defaults to 'false'
+        }
+    */
+
+    authenticate: function (request, credentials, artifacts, options) {
+
+        options = options || {};
+
+        if (request.getResponseHeader('www-authenticate')) {
+
+            // Parse HTTP WWW-Authenticate header
+
+            var attributes = hawk.utils.parseAuthorizationHeader(request.getResponseHeader('www-authenticate'), ['ts', 'tsm', 'error']);
+            if (!attributes) {
+                return false;
+            }
+
+            if (attributes.ts) {
+                var tsm = hawk.crypto.calculateTsMac(attributes.ts, credentials);
+                if (tsm !== attributes.tsm) {
+                    return false;
+                }
+
+                hawk.utils.setNtpOffset(attributes.ts - Math.floor(Date.now() / 1000));     // Keep offset at 1 second precision
+            }
+        }
+
+        // Parse HTTP Server-Authorization header
+
+        if (!request.getResponseHeader('server-authorization') &&
+            !options.required) {
+
+            return true;
+        }
+
+        var attributes = hawk.utils.parseAuthorizationHeader(request.getResponseHeader('server-authorization'), ['mac', 'ext', 'hash']);
+        if (!attributes) {
+            return false;
+        }
+
+        var modArtifacts = {
+            ts: artifacts.ts,
+            nonce: artifacts.nonce,
+            method: artifacts.method,
+            resource: artifacts.resource,
+            host: artifacts.host,
+            port: artifacts.port,
+            hash: attributes.hash,
+            ext: attributes.ext,
+            app: artifacts.app,
+            dlg: artifacts.dlg
+        };
+
+        var mac = hawk.crypto.calculateMac('response', credentials, modArtifacts);
+        if (mac !== attributes.mac) {
+            return false;
+        }
+
+        if (!options.hasOwnProperty('payload')) {
+            return true;
+        }
+
+        if (!attributes.hash) {
+            return false;
+        }
+
+        var calculatedHash = hawk.crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.getResponseHeader('content-type'));
+        return (calculatedHash === attributes.hash);
+    },
+
+    message: function (host, port, message, options) {
+
+        // Validate inputs
+
+        if (!host || typeof host !== 'string' ||
+            !port || typeof port !== 'number' ||
+            message === null || message === undefined || typeof message !== 'string' ||
+            !options || typeof options !== 'object') {
+
+            return null;
+        }
+
+        // Application time
+
+        var timestamp = options.timestamp || Math.floor((hawk.utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
+
+        // Validate credentials
+
+        var credentials = options.credentials;
+        if (!credentials ||
+            !credentials.id ||
+            !credentials.key ||
+            !credentials.algorithm) {
+
+            // Invalid credential object
+            return null;
+        }
+
+        if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+            return null;
+        }
+
+        // Calculate signature
+
+        var artifacts = {
+            ts: timestamp,
+            nonce: options.nonce || hawk.utils.randomString(6),
+            host: host,
+            port: port,
+            hash: hawk.crypto.calculatePayloadHash(message, credentials.algorithm)
+        };
+
+        // Construct authorization
+
+        var result = {
+            id: credentials.id,
+            ts: artifacts.ts,
+            nonce: artifacts.nonce,
+            hash: artifacts.hash,
+            mac: hawk.crypto.calculateMac('message', credentials, artifacts)
+        };
+
+        return result;
+    }
+};
+
+
+hawk.crypto = {
+
+    headerVersion: '1',
+
+    algorithms: ['sha1', 'sha256'],
+
+    calculateMac: function (type, credentials, options) {
+
+        var normalized = hawk.crypto.generateNormalizedString(type, options);
+
+        var hmac = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()](normalized, credentials.key);
+        return hmac.toString(CryptoJS.enc.Base64);
+    },
+
+    generateNormalizedString: function (type, options) {
+
+        var normalized = 'hawk.' + hawk.crypto.headerVersion + '.' + type + '\n' +
+                         options.ts + '\n' +
+                         options.nonce + '\n' +
+                         (options.method || '').toUpperCase() + '\n' +
+                         (options.resource || '') + '\n' +
+                         options.host.toLowerCase() + '\n' +
+                         options.port + '\n' +
+                         (options.hash || '') + '\n';
+
+        if (options.ext) {
+            normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n');
+        }
+
+        normalized += '\n';
+
+        if (options.app) {
+            normalized += options.app + '\n' +
+                          (options.dlg || '') + '\n';
+        }
+
+        return normalized;
+    },
+
+    calculatePayloadHash: function (payload, algorithm, contentType) {
+
+        var hash = CryptoJS.algo[algorithm.toUpperCase()].create();
+        hash.update('hawk.' + hawk.crypto.headerVersion + '.payload\n');
+        hash.update(hawk.utils.parseContentType(contentType) + '\n');
+        hash.update(payload || '');
+        hash.update('\n');
+        return hash.finalize().toString(CryptoJS.enc.Base64);
+    },
+
+    calculateTsMac: function (ts, credentials) {
+
+        var hash = CryptoJS['Hmac' + credentials.algorithm.toUpperCase()]('hawk.' + hawk.crypto.headerVersion + '.ts\n' + ts + '\n', credentials.key);
+        return hash.toString(CryptoJS.enc.Base64);
+    }
+};
+
+
+hawk.utils = {
+
+    storage: {                                      // localStorage compatible interface
+        _cache: {},
+        setItem: function (key, value) {
+
+            hawk.utils.storage._cache[key] = value;
+        },
+        getItem: function (key) {
+
+            return hawk.utils.storage._cache[key];
+        }
+    },
+
+    setStorage: function (storage) {
+
+        var ntpOffset = hawk.utils.getNtpOffset() || 0;
+        hawk.utils.storage = storage;
+        hawk.utils.setNtpOffset(ntpOffset);
+    },
+
+    setNtpOffset: function (offset) {
+
+        hawk.utils.storage.setItem('hawk_ntp_offset', offset);
+    },
+
+    getNtpOffset: function () {
+
+        return parseInt(hawk.utils.storage.getItem('hawk_ntp_offset') || '0', 10);
+    },
+
+    now: function () {
+
+        return Date.now() + hawk.utils.getNtpOffset();
+    },
+
+    escapeHeaderAttribute: function (attribute) {
+
+        return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"');
+    },
+
+    parseContentType: function (header) {
+
+        if (!header) {
+            return '';
+        }
+
+        return header.split(';')[0].trim().toLowerCase();
+    },
+
+    parseAuthorizationHeader: function (header, keys) {
+
+        if (!header) {
+            return null;
+        }
+
+        var headerParts = header.match(/^(\w+)(?:\s+(.*))?$/);       // Header: scheme[ something]
+        if (!headerParts) {
+            return null;
+        }
+
+        var scheme = headerParts[1];
+        if (scheme.toLowerCase() !== 'hawk') {
+            return null;
+        }
+
+        var attributesString = headerParts[2];
+        if (!attributesString) {
+            return null;
+        }
+
+        var attributes = {};
+        var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) {
+
+            // Check valid attribute names
+
+            if (keys.indexOf($1) === -1) {
+                return;
+            }
+
+            // Allowed attribute value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9
+
+            if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) {
+                return;
+            }
+
+            // Check for duplicates
+
+            if (attributes.hasOwnProperty($1)) {
+                return;
+            }
+
+            attributes[$1] = $2;
+            return '';
+        });
+
+        if (verify !== '') {
+            return null;
+        }
+
+        return attributes;
+    },
+
+    randomString: function (size) {
+
+        var randomSource = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+        var len = randomSource.length;
+
+        var result = [];
+        for (var i = 0; i < size; ++i) {
+            result[i] = randomSource[Math.floor(Math.random() * len)];
+        }
+
+        return result.join('');
+    },
+
+    parseUri: function (input) {
+
+        // Based on: parseURI 1.2.2
+        // http://blog.stevenlevithan.com/archives/parseuri
+        // (c) Steven Levithan <stevenlevithan.com>
+        // MIT License
+
+        var keys = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'hostname', 'port', 'resource', 'relative', 'pathname', 'directory', 'file', 'query', 'fragment'];
+
+        var uriRegex = /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?)(?:#(.*))?)/;
+        var uriByNumber = uriRegex.exec(input);
+        var uri = {};
+
+        var i = 15;
+        while (i--) {
+            uri[keys[i]] = uriByNumber[i] || '';
+        }
+
+        if (uri.port === null ||
+            uri.port === '') {
+
+            uri.port = (uri.protocol.toLowerCase() === 'http' ? '80' : (uri.protocol.toLowerCase() === 'https' ? '443' : ''));
+        }
+
+        return uri;
+    }
+};
+
+
+// Based on: Crypto-JS v3.1.2
+// Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
+// http://code.google.com/p/crypto-js/
+// http://code.google.com/p/crypto-js/wiki/License
+
+var CryptoJS=CryptoJS||function(h,r){var k={},l=k.lib={},n=function(){},f=l.Base={extend:function(a){n.prototype=this;var b=new n;a&&b.mixIn(a);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},j=l.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=r?b:4*a.length},toString:function(a){return(a||s).stringify(this)},concat:function(a){var b=this.words,d=a.words,c=this.sigBytes;a=a.sigBytes;this.clamp();if(c%4)for(var e=0;e<a;e++)b[c+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((c+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)b[c+e>>>2]=d[e>>>2];else b.push.apply(b,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<32-8*(b%4);a.length=h.ceil(b/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],d=0;d<a;d+=4)b.push(4294967296*h.random()|0);return new j.init(b,a)}}),m=k.enc={},s=m.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c<a;c++){var e=b[c>>>2]>>>24-8*(c%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c<b;c+=2)d[c>>>3]|=parseInt(a.substr(c,2),16)<<24-4*(c%8);return new j.init(d,b/2)}},p=m.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c<a;c++)d.push(String.fromCharCode(b[c>>>2]>>>24-8*(c%4)&255));return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c<b;c++)d[c>>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return new j.init(d,b)}},t=m.Utf8={stringify:function(a){try{return decodeURIComponent(escape(p.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return p.parse(unescape(encodeURIComponent(a)))}},q=l.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new j.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=t.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,d=b.words,c=b.sigBytes,e=this.blockSize,f=c/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;c=h.min(4*a,c);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);b.sigBytes-=c}return new j.init(g,c)},clone:function(){var a=f.clone.call(this);a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=q.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){q.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,d){return(new a.init(d)).finalize(b)}},_createHmacHelper:function(a){return function(b,d){return(new u.HMAC.init(a,d)).finalize(b)}}});var u=k.algo={};return k}(Math);
+(function () { var k = CryptoJS, b = k.lib, m = b.WordArray, l = b.Hasher, d = [], b = k.algo.SHA1 = l.extend({ _doReset: function () { this._hash = new m.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (n, p) { for (var a = this._hash.words, e = a[0], f = a[1], h = a[2], j = a[3], b = a[4], c = 0; 80 > c; c++) { if (16 > c) d[c] = n[p + c] | 0; else { var g = d[c - 3] ^ d[c - 8] ^ d[c - 14] ^ d[c - 16]; d[c] = g << 1 | g >>> 31 } g = (e << 5 | e >>> 27) + b + d[c]; g = 20 > c ? g + ((f & h | ~f & j) + 1518500249) : 40 > c ? g + ((f ^ h ^ j) + 1859775393) : 60 > c ? g + ((f & h | f & j | h & j) - 1894007588) : g + ((f ^ h ^ j) - 899497514); b = j; j = h; h = f << 30 | f >>> 2; f = e; e = g } a[0] = a[0] + e | 0; a[1] = a[1] + f | 0; a[2] = a[2] + h | 0; a[3] = a[3] + j | 0; a[4] = a[4] + b | 0 }, _doFinalize: function () { var b = this._data, d = b.words, a = 8 * this._nDataBytes, e = 8 * b.sigBytes; d[e >>> 5] |= 128 << 24 - e % 32; d[(e + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296); d[(e + 64 >>> 9 << 4) + 15] = a; b.sigBytes = 4 * d.length; this._process(); return this._hash }, clone: function () { var b = l.clone.call(this); b._hash = this._hash.clone(); return b } }); k.SHA1 = l._createHelper(b); k.HmacSHA1 = l._createHmacHelper(b) })();
+(function (k) { for (var g = CryptoJS, h = g.lib, v = h.WordArray, j = h.Hasher, h = g.algo, s = [], t = [], u = function (q) { return 4294967296 * (q - (q | 0)) | 0 }, l = 2, b = 0; 64 > b;) { var d; a: { d = l; for (var w = k.sqrt(d), r = 2; r <= w; r++) if (!(d % r)) { d = !1; break a } d = !0 } d && (8 > b && (s[b] = u(k.pow(l, 0.5))), t[b] = u(k.pow(l, 1 / 3)), b++); l++ } var n = [], h = h.SHA256 = j.extend({ _doReset: function () { this._hash = new v.init(s.slice(0)) }, _doProcessBlock: function (q, h) { for (var a = this._hash.words, c = a[0], d = a[1], b = a[2], k = a[3], f = a[4], g = a[5], j = a[6], l = a[7], e = 0; 64 > e; e++) { if (16 > e) n[e] = q[h + e] | 0; else { var m = n[e - 15], p = n[e - 2]; n[e] = ((m << 25 | m >>> 7) ^ (m << 14 | m >>> 18) ^ m >>> 3) + n[e - 7] + ((p << 15 | p >>> 17) ^ (p << 13 | p >>> 19) ^ p >>> 10) + n[e - 16] } m = l + ((f << 26 | f >>> 6) ^ (f << 21 | f >>> 11) ^ (f << 7 | f >>> 25)) + (f & g ^ ~f & j) + t[e] + n[e]; p = ((c << 30 | c >>> 2) ^ (c << 19 | c >>> 13) ^ (c << 10 | c >>> 22)) + (c & d ^ c & b ^ d & b); l = j; j = g; g = f; f = k + m | 0; k = b; b = d; d = c; c = m + p | 0 } a[0] = a[0] + c | 0; a[1] = a[1] + d | 0; a[2] = a[2] + b | 0; a[3] = a[3] + k | 0; a[4] = a[4] + f | 0; a[5] = a[5] + g | 0; a[6] = a[6] + j | 0; a[7] = a[7] + l | 0 }, _doFinalize: function () { var d = this._data, b = d.words, a = 8 * this._nDataBytes, c = 8 * d.sigBytes; b[c >>> 5] |= 128 << 24 - c % 32; b[(c + 64 >>> 9 << 4) + 14] = k.floor(a / 4294967296); b[(c + 64 >>> 9 << 4) + 15] = a; d.sigBytes = 4 * b.length; this._process(); return this._hash }, clone: function () { var b = j.clone.call(this); b._hash = this._hash.clone(); return b } }); g.SHA256 = j._createHelper(h); g.HmacSHA256 = j._createHmacHelper(h) })(Math);
+(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d<c;d++)h[d]^=1549556828,j[d]^=909522486;f.sigBytes=g.sigBytes=e;this.reset()},reset:function(){var a=this._hasher;a.reset();a.update(this._iKey)},update:function(a){this._hasher.update(a);return this},finalize:function(a){var b=this._hasher;a=b.finalize(a);b.reset();return b.finalize(this._oKey.clone().concat(a))}})})();
+(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d<e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/client.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/client.js
new file mode 100755 (executable)
index 0000000..4198458
--- /dev/null
@@ -0,0 +1,367 @@
+// Load modules
+
+var Url = require('url');
+var Hoek = require('hoek');
+var Cryptiles = require('cryptiles');
+var Crypto = require('./crypto');
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Generate an Authorization header for a given request
+
+/*
+    uri: 'http://example.com/resource?a=b' or object from Url.parse()
+    method: HTTP verb (e.g. 'GET', 'POST')
+    options: {
+
+        // Required
+
+        credentials: {
+            id: 'dh37fgj492je',
+            key: 'aoijedoaijsdlaksjdl',
+            algorithm: 'sha256'                                 // 'sha1', 'sha256'
+        },
+
+        // Optional
+
+        ext: 'application-specific',                        // Application specific data sent via the ext attribute
+        timestamp: Date.now(),                              // A pre-calculated timestamp
+        nonce: '2334f34f',                                  // A pre-generated nonce
+        localtimeOffsetMsec: 400,                           // Time offset to sync with server time (ignored if timestamp provided)
+        payload: '{"some":"payload"}',                      // UTF-8 encoded string for body hash generation (ignored if hash provided)
+        contentType: 'application/json',                    // Payload content-type (ignored if hash provided)
+        hash: 'U4MKKSmiVxk37JCCrAVIjV=',                    // Pre-calculated payload hash
+        app: '24s23423f34dx',                               // Oz application id
+        dlg: '234sz34tww3sd'                                // Oz delegated-by application id
+    }
+*/
+
+exports.header = function (uri, method, options) {
+
+    var result = {
+        field: '',
+        artifacts: {}
+    };
+
+    // Validate inputs
+
+    if (!uri || (typeof uri !== 'string' && typeof uri !== 'object') ||
+        !method || typeof method !== 'string' ||
+        !options || typeof options !== 'object') {
+
+        return result;
+    }
+
+    // Application time
+
+    var timestamp = options.timestamp || Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
+
+    // Validate credentials
+
+    var credentials = options.credentials;
+    if (!credentials ||
+        !credentials.id ||
+        !credentials.key ||
+        !credentials.algorithm) {
+
+        // Invalid credential object
+        return result;
+    }
+
+    if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+        return result;
+    }
+
+    // Parse URI
+
+    if (typeof uri === 'string') {
+        uri = Url.parse(uri);
+    }
+
+    // Calculate signature
+
+    var artifacts = {
+        ts: timestamp,
+        nonce: options.nonce || Cryptiles.randomString(6),
+        method: method,
+        resource: uri.pathname + (uri.search || ''),                            // Maintain trailing '?'
+        host: uri.hostname,
+        port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+        hash: options.hash,
+        ext: options.ext,
+        app: options.app,
+        dlg: options.dlg
+    };
+
+    result.artifacts = artifacts;
+
+    // Calculate payload hash
+
+    if (!artifacts.hash &&
+        options.hasOwnProperty('payload')) {
+
+        artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+    }
+
+    var mac = Crypto.calculateMac('header', credentials, artifacts);
+
+    // Construct header
+
+    var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== '';       // Other falsey values allowed
+    var header = 'Hawk id="' + credentials.id +
+                 '", ts="' + artifacts.ts +
+                 '", nonce="' + artifacts.nonce +
+                 (artifacts.hash ? '", hash="' + artifacts.hash : '') +
+                 (hasExt ? '", ext="' + Utils.escapeHeaderAttribute(artifacts.ext) : '') +
+                 '", mac="' + mac + '"';
+
+    if (artifacts.app) {
+        header += ', app="' + artifacts.app +
+                  (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"';
+    }
+
+    result.field = header;
+
+    return result;
+};
+
+
+// Validate server response
+
+/*
+    res:        node's response object
+    artifacts:  object recieved from header().artifacts
+    options: {
+        payload:    optional payload received
+        required:   specifies if a Server-Authorization header is required. Defaults to 'false'
+    }
+*/
+
+exports.authenticate = function (res, credentials, artifacts, options) {
+
+    artifacts = Hoek.clone(artifacts);
+    options = options || {};
+
+    if (res.headers['www-authenticate']) {
+
+        // Parse HTTP WWW-Authenticate header
+
+        var attributes = Utils.parseAuthorizationHeader(res.headers['www-authenticate'], ['ts', 'tsm', 'error']);
+        if (attributes instanceof Error) {
+            return false;
+        }
+
+        if (attributes.ts) {
+            var tsm = Crypto.calculateTsMac(attributes.ts, credentials);
+            if (tsm !== attributes.tsm) {
+                return false;
+            }
+        }
+    }
+
+    // Parse HTTP Server-Authorization header
+
+    if (!res.headers['server-authorization'] &&
+        !options.required) {
+
+        return true;
+    }
+
+    var attributes = Utils.parseAuthorizationHeader(res.headers['server-authorization'], ['mac', 'ext', 'hash']);
+    if (attributes instanceof Error) {
+        return false;
+    }
+
+    artifacts.ext = attributes.ext;
+    artifacts.hash = attributes.hash;
+
+    var mac = Crypto.calculateMac('response', credentials, artifacts);
+    if (mac !== attributes.mac) {
+        return false;
+    }
+
+    if (!options.hasOwnProperty('payload')) {
+        return true;
+    }
+
+    if (!attributes.hash) {
+        return false;
+    }
+
+    var calculatedHash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, res.headers['content-type']);
+    return (calculatedHash === attributes.hash);
+};
+
+
+// Generate a bewit value for a given URI
+
+/*
+ * credentials is an object with the following keys: 'id, 'key', 'algorithm'.
+ * options is an object with the following optional keys: 'ext', 'localtimeOffsetMsec'
+ */
+/*
+    uri: 'http://example.com/resource?a=b' or object from Url.parse()
+    options: {
+
+        // Required
+
+        credentials: {
+            id: 'dh37fgj492je',
+            key: 'aoijedoaijsdlaksjdl',
+            algorithm: 'sha256'                             // 'sha1', 'sha256'
+        },
+        ttlSec: 60 * 60,                                    // TTL in seconds
+
+        // Optional
+
+        ext: 'application-specific',                        // Application specific data sent via the ext attribute
+        localtimeOffsetMsec: 400                            // Time offset to sync with server time
+    };
+*/
+
+exports.getBewit = function (uri, options) {
+
+    // Validate inputs
+
+    if (!uri ||
+        (typeof uri !== 'string' && typeof uri !== 'object') ||
+        !options ||
+        typeof options !== 'object' ||
+        !options.ttlSec) {
+
+        return '';
+    }
+
+    options.ext = (options.ext === null || options.ext === undefined ? '' : options.ext);       // Zero is valid value
+
+    // Application time
+
+    var now = Utils.now() + (options.localtimeOffsetMsec || 0);
+
+    // Validate credentials
+
+    var credentials = options.credentials;
+    if (!credentials ||
+        !credentials.id ||
+        !credentials.key ||
+        !credentials.algorithm) {
+
+        return '';
+    }
+
+    if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+        return '';
+    }
+
+    // Parse URI
+
+    if (typeof uri === 'string') {
+        uri = Url.parse(uri);
+    }
+
+    // Calculate signature
+
+    var exp = Math.floor(now / 1000) + options.ttlSec;
+    var mac = Crypto.calculateMac('bewit', credentials, {
+        ts: exp,
+        nonce: '',
+        method: 'GET',
+        resource: uri.pathname + (uri.search || ''),                            // Maintain trailing '?'
+        host: uri.hostname,
+        port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
+        ext: options.ext
+    });
+
+    // Construct bewit: id\exp\mac\ext
+
+    var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + options.ext;
+    return Utils.base64urlEncode(bewit);
+};
+
+
+// Generate an authorization string for a message
+
+/*
+    host: 'example.com',
+    port: 8000,
+    message: '{"some":"payload"}',                          // UTF-8 encoded string for body hash generation
+    options: {
+
+        // Required
+
+        credentials: {
+            id: 'dh37fgj492je',
+            key: 'aoijedoaijsdlaksjdl',
+            algorithm: 'sha256'                             // 'sha1', 'sha256'
+        },
+
+        // Optional
+
+        timestamp: Date.now(),                              // A pre-calculated timestamp
+        nonce: '2334f34f',                                  // A pre-generated nonce
+        localtimeOffsetMsec: 400,                           // Time offset to sync with server time (ignored if timestamp provided)
+    }
+*/
+
+exports.message = function (host, port, message, options) {
+
+    // Validate inputs
+
+    if (!host || typeof host !== 'string' ||
+        !port || typeof port !== 'number' ||
+        message === null || message === undefined || typeof message !== 'string' ||
+        !options || typeof options !== 'object') {
+
+        return null;
+    }
+
+    // Application time
+
+    var timestamp = options.timestamp || Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000)
+
+    // Validate credentials
+
+    var credentials = options.credentials;
+    if (!credentials ||
+        !credentials.id ||
+        !credentials.key ||
+        !credentials.algorithm) {
+
+        // Invalid credential object
+        return null;
+    }
+
+    if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+        return null;
+    }
+
+    // Calculate signature
+
+    var artifacts = {
+        ts: timestamp,
+        nonce: options.nonce || Cryptiles.randomString(6),
+        host: host,
+        port: port,
+        hash: Crypto.calculatePayloadHash(message, credentials.algorithm)
+    };
+
+    // Construct authorization
+
+    var result = {
+        id: credentials.id,
+        ts: artifacts.ts,
+        nonce: artifacts.nonce,
+        hash: artifacts.hash,
+        mac: Crypto.calculateMac('message', credentials, artifacts)
+    };
+
+    return result;
+};
+
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/crypto.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/crypto.js
new file mode 100755 (executable)
index 0000000..150340a
--- /dev/null
@@ -0,0 +1,111 @@
+// Load modules
+
+var Crypto = require('crypto');
+var Url = require('url');
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// MAC normalization format version
+
+exports.headerVersion = '1';                        // Prevent comparison of mac values generated with different normalized string formats
+
+
+// Supported HMAC algorithms
+
+exports.algorithms = ['sha1', 'sha256'];
+
+
+// Calculate the request MAC
+
+/*
+    type: 'header',                                 // 'header', 'bewit', 'response'
+    credentials: {
+        key: 'aoijedoaijsdlaksjdl',
+        algorithm: 'sha256'                         // 'sha1', 'sha256'
+    },
+    options: {
+        method: 'GET',
+        resource: '/resource?a=1&b=2',
+        host: 'example.com',
+        port: 8080,
+        ts: 1357718381034,
+        nonce: 'd3d345f',
+        hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=',
+        ext: 'app-specific-data',
+        app: 'hf48hd83qwkj',                        // Application id (Oz)
+        dlg: 'd8djwekds9cj'                         // Delegated by application id (Oz), requires options.app
+    }
+*/
+
+exports.calculateMac = function (type, credentials, options) {
+
+    var normalized = exports.generateNormalizedString(type, options);
+
+    var hmac = Crypto.createHmac(credentials.algorithm, credentials.key).update(normalized);
+    var digest = hmac.digest('base64');
+    return digest;
+};
+
+
+exports.generateNormalizedString = function (type, options) {
+
+    var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' +
+                     options.ts + '\n' +
+                     options.nonce + '\n' +
+                     (options.method || '').toUpperCase() + '\n' +
+                     (options.resource || '') + '\n' +
+                     options.host.toLowerCase() + '\n' +
+                     options.port + '\n' +
+                     (options.hash || '') + '\n';
+
+    if (options.ext) {
+        normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n');
+    }
+
+    normalized += '\n';
+
+    if (options.app) {
+        normalized += options.app + '\n' +
+                      (options.dlg || '') + '\n';
+    }
+
+    return normalized;
+};
+
+
+exports.calculatePayloadHash = function (payload, algorithm, contentType) {
+
+    var hash = exports.initializePayloadHash(algorithm, contentType);
+    hash.update(payload || '');
+    return exports.finalizePayloadHash(hash);
+};
+
+
+exports.initializePayloadHash = function (algorithm, contentType) {
+
+    var hash = Crypto.createHash(algorithm);
+    hash.update('hawk.' + exports.headerVersion + '.payload\n');
+    hash.update(Utils.parseContentType(contentType) + '\n');
+    return hash;
+};
+
+
+exports.finalizePayloadHash = function (hash) {
+
+    hash.update('\n');
+    return hash.digest('base64');
+};
+
+
+exports.calculateTsMac = function (ts, credentials) {
+
+    var hmac = Crypto.createHmac(credentials.algorithm, credentials.key);
+    hmac.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n');
+    return hmac.digest('base64');
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/index.js
new file mode 100755 (executable)
index 0000000..1d713cb
--- /dev/null
@@ -0,0 +1,15 @@
+// Export sub-modules
+
+exports.error = exports.Error = require('boom');
+exports.sntp = require('sntp');
+exports.server = require('./server');
+exports.client = require('./client');
+exports.crypto = require('./crypto');
+exports.utils = require('./utils');
+
+exports.uri = {
+    authenticate: exports.server.authenticateBewit,
+    getBewit: exports.client.getBewit
+};
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/server.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/server.js
new file mode 100755 (executable)
index 0000000..478c47b
--- /dev/null
@@ -0,0 +1,524 @@
+// Load modules
+
+var Boom = require('boom');
+var Hoek = require('hoek');
+var Cryptiles = require('cryptiles');
+var Crypto = require('./crypto');
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Hawk authentication
+
+/*
+   req:                 node's HTTP request object or an object as follows:
+  
+                        var request = {
+                            method: 'GET',
+                            url: '/resource/4?a=1&b=2',
+                            host: 'example.com',
+                            port: 8080,
+                            authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="'
+                        };
+  
+   credentialsFunc:     required function to lookup the set of Hawk credentials based on the provided credentials id.
+                        The credentials include the MAC key, MAC algorithm, and other attributes (such as username)
+                        needed by the application. This function is the equivalent of verifying the username and
+                        password in Basic authentication.
+  
+                        var credentialsFunc = function (id, callback) {
+    
+                            // Lookup credentials in database
+                            db.lookup(id, function (err, item) {
+    
+                                if (err || !item) {
+                                    return callback(err);
+                                }
+    
+                                var credentials = {
+                                    // Required
+                                    key: item.key,
+                                    algorithm: item.algorithm,
+                                    // Application specific
+                                    user: item.user
+                                };
+    
+                                return callback(null, credentials);
+                            });
+                        };
+  
+   options: {
+
+        hostHeaderName:        optional header field name, used to override the default 'Host' header when used
+                               behind a cache of a proxy. Apache2 changes the value of the 'Host' header while preserving
+                               the original (which is what the module must verify) in the 'x-forwarded-host' header field.
+                               Only used when passed a node Http.ServerRequest object.
+  
+        nonceFunc:             optional nonce validation function. The function signature is function(nonce, ts, callback)
+                               where 'callback' must be called using the signature function(err).
+  
+        timestampSkewSec:      optional number of seconds of permitted clock skew for incoming timestamps. Defaults to 60 seconds.
+                               Provides a +/- skew which means actual allowed window is double the number of seconds.
+  
+        localtimeOffsetMsec:   optional local clock time offset express in a number of milliseconds (positive or negative).
+                               Defaults to 0.
+  
+        payload:               optional payload for validation. The client calculates the hash value and includes it via the 'hash'
+                               header attribute. The server always ensures the value provided has been included in the request
+                               MAC. When this option is provided, it validates the hash value itself. Validation is done by calculating
+                               a hash value over the entire payload (assuming it has already be normalized to the same format and
+                               encoding used by the client to calculate the hash on request). If the payload is not available at the time
+                               of authentication, the authenticatePayload() method can be used by passing it the credentials and
+                               attributes.hash returned in the authenticate callback.
+
+        host:                  optional host name override. Only used when passed a node request object.
+        port:                  optional port override. Only used when passed a node request object.
+    }
+
+    callback: function (err, credentials, artifacts) { }
+ */
+
+exports.authenticate = function (req, credentialsFunc, options, callback) {
+
+    callback = Utils.nextTick(callback);
+    
+    // Default options
+
+    options.nonceFunc = options.nonceFunc || function (nonce, ts, nonceCallback) { return nonceCallback(); };   // No validation
+    options.timestampSkewSec = options.timestampSkewSec || 60;                                                  // 60 seconds
+
+    // Application time
+
+    var now = Utils.now() + (options.localtimeOffsetMsec || 0);                 // Measure now before any other processing
+
+    // Convert node Http request object to a request configuration object
+
+    var request = Utils.parseRequest(req, options);
+    if (request instanceof Error) {
+        return callback(Boom.badRequest(request.message));
+    }
+
+    // Parse HTTP Authorization header
+
+    var attributes = Utils.parseAuthorizationHeader(request.authorization);
+    if (attributes instanceof Error) {
+        return callback(attributes);
+    }
+
+    // Construct artifacts container
+
+    var artifacts = {
+        method: request.method,
+        host: request.host,
+        port: request.port,
+        resource: request.url,
+        ts: attributes.ts,
+        nonce: attributes.nonce,
+        hash: attributes.hash,
+        ext: attributes.ext,
+        app: attributes.app,
+        dlg: attributes.dlg,
+        mac: attributes.mac,
+        id: attributes.id
+    };
+
+    // Verify required header attributes
+
+    if (!attributes.id ||
+        !attributes.ts ||
+        !attributes.nonce ||
+        !attributes.mac) {
+
+        return callback(Boom.badRequest('Missing attributes'), null, artifacts);
+    }
+
+    // Fetch Hawk credentials
+
+    credentialsFunc(attributes.id, function (err, credentials) {
+
+        if (err) {
+            return callback(err, credentials || null, artifacts);
+        }
+
+        if (!credentials) {
+            return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, artifacts);
+        }
+
+        if (!credentials.key ||
+            !credentials.algorithm) {
+
+            return callback(Boom.internal('Invalid credentials'), credentials, artifacts);
+        }
+
+        if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+            return callback(Boom.internal('Unknown algorithm'), credentials, artifacts);
+        }
+
+        // Calculate MAC
+
+        var mac = Crypto.calculateMac('header', credentials, artifacts);
+        if (!Cryptiles.fixedTimeComparison(mac, attributes.mac)) {
+            return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, artifacts);
+        }
+
+        // Check payload hash
+
+        if (options.payload !== null &&
+            options.payload !== undefined) {       // '' is valid
+
+            if (!attributes.hash) {
+                return callback(Boom.unauthorized('Missing required payload hash', 'Hawk'), credentials, artifacts);
+            }
+
+            var hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, request.contentType);
+            if (!Cryptiles.fixedTimeComparison(hash, attributes.hash)) {
+                return callback(Boom.unauthorized('Bad payload hash', 'Hawk'), credentials, artifacts);
+            }
+        }
+
+        // Check nonce
+
+        options.nonceFunc(attributes.nonce, attributes.ts, function (err) {
+
+            if (err) {
+                return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials, artifacts);
+            }
+
+            // Check timestamp staleness
+
+            if (Math.abs((attributes.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
+                var fresh = Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000);            // Get fresh now
+                var tsm = Crypto.calculateTsMac(fresh, credentials);
+                return callback(Boom.unauthorized('Stale timestamp', 'Hawk', { ts: fresh, tsm: tsm }), credentials, artifacts);
+            }
+
+            // Successful authentication
+
+            return callback(null, credentials, artifacts);
+        });
+    });
+};
+
+
+// Authenticate payload hash - used when payload cannot be provided during authenticate()
+
+/*
+    payload:        raw request payload
+    credentials:    from authenticate callback
+    artifacts:      from authenticate callback
+    contentType:    req.headers['content-type']
+*/
+
+exports.authenticatePayload = function (payload, credentials, artifacts, contentType) {
+
+    var calculatedHash = Crypto.calculatePayloadHash(payload, credentials.algorithm, contentType);
+    return Cryptiles.fixedTimeComparison(calculatedHash, artifacts.hash);
+};
+
+
+// Generate a Server-Authorization header for a given response
+
+/*
+    credentials: {},                                        // Object received from authenticate()
+    artifacts: {}                                           // Object received from authenticate(); 'mac', 'hash', and 'ext' - ignored
+    options: {
+        ext: 'application-specific',                        // Application specific data sent via the ext attribute
+        payload: '{"some":"payload"}',                      // UTF-8 encoded string for body hash generation (ignored if hash provided)
+        contentType: 'application/json',                    // Payload content-type (ignored if hash provided)
+        hash: 'U4MKKSmiVxk37JCCrAVIjV='                     // Pre-calculated payload hash
+    }
+*/
+
+exports.header = function (credentials, artifacts, options) {
+
+    // Prepare inputs
+
+    options = options || {};
+
+    if (!artifacts ||
+        typeof artifacts !== 'object' ||
+        typeof options !== 'object') {
+
+        return '';
+    }
+
+    artifacts = Hoek.clone(artifacts);
+    delete artifacts.mac;
+    artifacts.hash = options.hash;
+    artifacts.ext = options.ext;
+
+    // Validate credentials
+
+    if (!credentials ||
+        !credentials.key ||
+        !credentials.algorithm) {
+
+        // Invalid credential object
+        return '';
+    }
+
+    if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+        return '';
+    }
+
+    // Calculate payload hash
+
+    if (!artifacts.hash &&
+        options.hasOwnProperty('payload')) {
+
+        artifacts.hash = Crypto.calculatePayloadHash(options.payload, credentials.algorithm, options.contentType);
+    }
+
+    var mac = Crypto.calculateMac('response', credentials, artifacts);
+
+    // Construct header
+
+    var header = 'Hawk mac="' + mac + '"' +
+                 (artifacts.hash ? ', hash="' + artifacts.hash + '"' : '');
+
+    if (artifacts.ext !== null &&
+        artifacts.ext !== undefined &&
+        artifacts.ext !== '') {                       // Other falsey values allowed
+
+        header += ', ext="' + Utils.escapeHeaderAttribute(artifacts.ext) + '"';
+    }
+
+    return header;
+};
+
+
+/*
+ * Arguments and options are the same as authenticate() with the exception that the only supported options are:
+ * 'hostHeaderName', 'localtimeOffsetMsec', 'host', 'port'
+ */
+
+exports.authenticateBewit = function (req, credentialsFunc, options, callback) {
+
+    callback = Utils.nextTick(callback);
+
+    // Application time
+
+    var now = Utils.now() + (options.localtimeOffsetMsec || 0);
+
+    // Convert node Http request object to a request configuration object
+
+    var request = Utils.parseRequest(req, options);
+    if (request instanceof Error) {
+        return callback(Boom.badRequest(request.message));
+    }
+
+    // Extract bewit
+
+    //                                 1     2             3           4     
+    var resource = request.url.match(/^(\/.*)([\?&])bewit\=([^&$]*)(?:&(.+))?$/);
+    if (!resource) {
+        return callback(Boom.unauthorized(null, 'Hawk'));
+    }
+
+    // Bewit not empty
+
+    if (!resource[3]) {
+        return callback(Boom.unauthorized('Empty bewit', 'Hawk'));
+    }
+
+    // Verify method is GET
+
+    if (request.method !== 'GET' &&
+        request.method !== 'HEAD') {
+
+        return callback(Boom.unauthorized('Invalid method', 'Hawk'));
+    }
+
+    // No other authentication
+
+    if (request.authorization) {
+        return callback(Boom.badRequest('Multiple authentications', 'Hawk'));
+    }
+
+    // Parse bewit
+
+    var bewitString = Utils.base64urlDecode(resource[3]);
+    if (bewitString instanceof Error) {
+        return callback(Boom.badRequest('Invalid bewit encoding'));
+    }
+
+    // Bewit format: id\exp\mac\ext ('\' is used because it is a reserved header attribute character)
+
+    var bewitParts = bewitString.split('\\');
+    if (!bewitParts ||
+        bewitParts.length !== 4) {
+
+        return callback(Boom.badRequest('Invalid bewit structure'));
+    }
+
+    var bewit = {
+        id: bewitParts[0],
+        exp: parseInt(bewitParts[1], 10),
+        mac: bewitParts[2],
+        ext: bewitParts[3] || ''
+    };
+
+    if (!bewit.id ||
+        !bewit.exp ||
+        !bewit.mac) {
+
+        return callback(Boom.badRequest('Missing bewit attributes'));
+    }
+
+    // Construct URL without bewit
+
+    var url = resource[1];
+    if (resource[4]) {
+        url += resource[2] + resource[4];
+    }
+
+    // Check expiration
+
+    if (bewit.exp * 1000 <= now) {
+        return callback(Boom.unauthorized('Access expired', 'Hawk'), null, bewit);
+    }
+
+    // Fetch Hawk credentials
+
+    credentialsFunc(bewit.id, function (err, credentials) {
+
+        if (err) {
+            return callback(err, credentials || null, bewit.ext);
+        }
+
+        if (!credentials) {
+            return callback(Boom.unauthorized('Unknown credentials', 'Hawk'), null, bewit);
+        }
+
+        if (!credentials.key ||
+            !credentials.algorithm) {
+
+            return callback(Boom.internal('Invalid credentials'), credentials, bewit);
+        }
+
+        if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+            return callback(Boom.internal('Unknown algorithm'), credentials, bewit);
+        }
+
+        // Calculate MAC
+
+        var mac = Crypto.calculateMac('bewit', credentials, {
+            ts: bewit.exp,
+            nonce: '',
+            method: 'GET',
+            resource: url,
+            host: request.host,
+            port: request.port,
+            ext: bewit.ext
+        });
+
+        if (!Cryptiles.fixedTimeComparison(mac, bewit.mac)) {
+            return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials, bewit);
+        }
+
+        // Successful authentication
+
+        return callback(null, credentials, bewit);
+    });
+};
+
+
+/*
+ *  options are the same as authenticate() with the exception that the only supported options are:
+ * 'nonceFunc', 'timestampSkewSec', 'localtimeOffsetMsec'
+ */
+
+exports.authenticateMessage = function (host, port, message, authorization, credentialsFunc, options, callback) {
+
+    callback = Utils.nextTick(callback);
+    
+    // Default options
+
+    options.nonceFunc = options.nonceFunc || function (nonce, ts, nonceCallback) { return nonceCallback(); };   // No validation
+    options.timestampSkewSec = options.timestampSkewSec || 60;                                                  // 60 seconds
+
+    // Application time
+
+    var now = Utils.now() + (options.localtimeOffsetMsec || 0);                 // Measure now before any other processing
+
+    // Validate authorization
+    
+    if (!authorization.id ||
+        !authorization.ts ||
+        !authorization.nonce ||
+        !authorization.hash ||
+        !authorization.mac) {
+        
+            return callback(Boom.badRequest('Invalid authorization'))
+    }
+
+    // Fetch Hawk credentials
+
+    credentialsFunc(authorization.id, function (err, credentials) {
+
+        if (err) {
+            return callback(err, credentials || null);
+        }
+
+        if (!credentials) {
+            return callback(Boom.unauthorized('Unknown credentials', 'Hawk'));
+        }
+
+        if (!credentials.key ||
+            !credentials.algorithm) {
+
+            return callback(Boom.internal('Invalid credentials'), credentials);
+        }
+
+        if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+            return callback(Boom.internal('Unknown algorithm'), credentials);
+        }
+
+        // Construct artifacts container
+
+        var artifacts = {
+            ts: authorization.ts,
+            nonce: authorization.nonce,
+            host: host,
+            port: port,
+            hash: authorization.hash
+        };
+
+        // Calculate MAC
+
+        var mac = Crypto.calculateMac('message', credentials, artifacts);
+        if (!Cryptiles.fixedTimeComparison(mac, authorization.mac)) {
+            return callback(Boom.unauthorized('Bad mac', 'Hawk'), credentials);
+        }
+
+        // Check payload hash
+
+        var hash = Crypto.calculatePayloadHash(message, credentials.algorithm);
+        if (!Cryptiles.fixedTimeComparison(hash, authorization.hash)) {
+            return callback(Boom.unauthorized('Bad message hash', 'Hawk'), credentials);
+        }
+
+        // Check nonce
+
+        options.nonceFunc(authorization.nonce, authorization.ts, function (err) {
+
+            if (err) {
+                return callback(Boom.unauthorized('Invalid nonce', 'Hawk'), credentials);
+            }
+
+            // Check timestamp staleness
+
+            if (Math.abs((authorization.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
+                return callback(Boom.unauthorized('Stale timestamp'), credentials);
+            }
+
+            // Successful authentication
+
+            return callback(null, credentials);
+        });
+    });
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/utils.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/lib/utils.js
new file mode 100755 (executable)
index 0000000..c8938fe
--- /dev/null
@@ -0,0 +1,183 @@
+// Load modules
+
+var Hoek = require('hoek');
+var Sntp = require('sntp');
+var Boom = require('boom');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Import Hoek Utilities
+
+internals.import = function () {
+
+    for (var i in Hoek) {
+        if (Hoek.hasOwnProperty(i)) {
+            exports[i] = Hoek[i];
+        }
+    }
+};
+
+internals.import();
+
+
+// Hawk version
+
+exports.version = function () {
+
+    return exports.loadPackage(__dirname + '/..').version;
+};
+
+
+// Extract host and port from request
+
+exports.parseHost = function (req, hostHeaderName) {
+
+    hostHeaderName = (hostHeaderName ? hostHeaderName.toLowerCase() : 'host');
+    var hostHeader = req.headers[hostHeaderName];
+    if (!hostHeader) {
+        return null;
+    }
+
+    var hostHeaderRegex;
+    if (hostHeader[0] === '[') {
+        hostHeaderRegex = /^(?:(?:\r\n)?\s)*(\[[^\]]+\])(?::(\d+))?(?:(?:\r\n)?\s)*$/;      // IPv6
+    }
+    else {
+        hostHeaderRegex = /^(?:(?:\r\n)?\s)*([^:]+)(?::(\d+))?(?:(?:\r\n)?\s)*$/;           // IPv4, hostname
+    }
+    
+    var hostParts = hostHeader.match(hostHeaderRegex);
+
+    if (!hostParts ||
+        hostParts.length !== 3 ||
+        !hostParts[1]) {
+
+        return null;
+    }
+
+    return {
+        name: hostParts[1],
+        port: (hostParts[2] ? hostParts[2] : (req.connection && req.connection.encrypted ? 443 : 80))
+    };
+};
+
+
+// Parse Content-Type header content
+
+exports.parseContentType = function (header) {
+
+    if (!header) {
+        return '';
+    }
+
+    return header.split(';')[0].trim().toLowerCase();
+};
+
+
+// Convert node's  to request configuration object
+
+exports.parseRequest = function (req, options) {
+
+    if (!req.headers) {
+        return req;
+    }
+    
+    // Obtain host and port information
+
+    if (!options.host || !options.port) {
+        var host = exports.parseHost(req, options.hostHeaderName);
+        if (!host) {
+            return new Error('Invalid Host header');
+        }
+    }
+
+    var request = {
+        method: req.method,
+        url: req.url,
+        host: options.host || host.name,
+        port: options.port || host.port,
+        authorization: req.headers.authorization,
+        contentType: req.headers['content-type'] || ''
+    };
+
+    return request;
+};
+
+
+exports.now = function () {
+
+    return Sntp.now();
+};
+
+
+// Parse Hawk HTTP Authorization header
+
+exports.parseAuthorizationHeader = function (header, keys) {
+
+    keys = keys || ['id', 'ts', 'nonce', 'hash', 'ext', 'mac', 'app', 'dlg'];
+
+    if (!header) {
+        return Boom.unauthorized(null, 'Hawk');
+    }
+
+    var headerParts = header.match(/^(\w+)(?:\s+(.*))?$/);       // Header: scheme[ something]
+    if (!headerParts) {
+        return Boom.badRequest('Invalid header syntax');
+    }
+
+    var scheme = headerParts[1];
+    if (scheme.toLowerCase() !== 'hawk') {
+        return Boom.unauthorized(null, 'Hawk');
+    }
+
+    var attributesString = headerParts[2];
+    if (!attributesString) {
+        return Boom.badRequest('Invalid header syntax');
+    }
+
+    var attributes = {};
+    var errorMessage = '';
+    var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) {
+
+        // Check valid attribute names
+
+        if (keys.indexOf($1) === -1) {
+            errorMessage = 'Unknown attribute: ' + $1;
+            return;
+        }
+
+        // Allowed attribute value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9
+
+        if ($2.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/) === null) {
+            errorMessage = 'Bad attribute value: ' + $1;
+            return;
+        }
+
+        // Check for duplicates
+
+        if (attributes.hasOwnProperty($1)) {
+            errorMessage = 'Duplicate attribute: ' + $1;
+            return;
+        }
+
+        attributes[$1] = $2;
+        return '';
+    });
+
+    if (verify !== '') {
+        return Boom.badRequest(errorMessage || 'Bad header format');
+    }
+
+    return attributes;
+};
+
+
+exports.unauthorized = function (message) {
+
+    return Boom.unauthorized(message, 'Hawk');
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE
new file mode 100755 (executable)
index 0000000..911b97e
--- /dev/null
@@ -0,0 +1,24 @@
+Copyright (c) 2012-2013, Walmart.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Walmart nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL WALMART BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/Makefile
new file mode 100755 (executable)
index 0000000..884ec6d
--- /dev/null
@@ -0,0 +1,11 @@
+test:
+       @node node_modules/lab/bin/lab
+test-cov: 
+       @node node_modules/lab/bin/lab -r threshold -t 100
+test-cov-html:
+       @node node_modules/lab/bin/lab -r html -o coverage.html
+complexity:
+       @node node_modules/complexity-report/src/cli.js -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/README.md
new file mode 100755 (executable)
index 0000000..1970b1c
--- /dev/null
@@ -0,0 +1,6 @@
+<a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>
+![boom Logo](https://raw.github.com/spumko/boom/master/images/boom.png)
+
+HTTP-friendly error objects
+
+[![Build Status](https://secure.travis-ci.org/spumko/boom.png)](http://travis-ci.org/spumko/boom)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png
new file mode 100755 (executable)
index 0000000..373bc13
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/index.js
new file mode 100755 (executable)
index 0000000..4cc88b3
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js
new file mode 100755 (executable)
index 0000000..0bbeed9
--- /dev/null
@@ -0,0 +1,207 @@
+// Load modules
+
+var Http = require('http');
+var NodeUtil = require('util');
+var Hoek = require('hoek');
+
+
+// Declare internals
+
+var internals = {};
+
+
+exports = module.exports = internals.Boom = function (/* (new Error) or (code, message) */) {
+
+    var self = this;
+
+    Hoek.assert(this.constructor === internals.Boom, 'Error must be instantiated using new');
+
+    Error.call(this);
+    this.isBoom = true;
+
+    this.response = {
+        code: 0,
+        payload: {},
+        headers: {}
+        // type: 'content-type'
+    };
+
+    if (arguments[0] instanceof Error) {
+
+        // Error
+
+        var error = arguments[0];
+
+        this.data = error;
+        this.response.code = error.code || 500;
+        if (error.message) {
+            this.message = error.message;
+        }
+    }
+    else {
+
+        // code, message
+
+        var code = arguments[0];
+        var message = arguments[1];
+
+        Hoek.assert(!isNaN(parseFloat(code)) && isFinite(code) && code >= 400, 'First argument must be a number (400+)');
+
+        this.response.code = code;
+        if (message) {
+            this.message = message;
+        }
+    }
+
+    // Response format
+
+    this.reformat();
+
+    return this;
+};
+
+NodeUtil.inherits(internals.Boom, Error);
+
+
+internals.Boom.prototype.reformat = function () {
+
+    this.response.payload.code = this.response.code;
+    this.response.payload.error = Http.STATUS_CODES[this.response.code] || 'Unknown';
+    if (this.message) {
+        this.response.payload.message = Hoek.escapeHtml(this.message);         // Prevent XSS from error message
+    }
+};
+
+
+// Utilities
+
+internals.Boom.badRequest = function (message) {
+
+    return new internals.Boom(400, message);
+};
+
+
+internals.Boom.unauthorized = function (message, scheme, attributes) {          // Or function (message, wwwAuthenticate[])
+
+    var err = new internals.Boom(401, message);
+
+    if (!scheme) {
+        return err;
+    }
+
+    var wwwAuthenticate = '';
+
+    if (typeof scheme === 'string') {
+
+        // function (message, scheme, attributes)
+
+        wwwAuthenticate = scheme;
+        if (attributes) {
+            var names = Object.keys(attributes);
+            for (var i = 0, il = names.length; i < il; ++i) {
+                if (i) {
+                    wwwAuthenticate += ',';
+                }
+
+                var value = attributes[names[i]];
+                if (value === null ||
+                    value === undefined) {              // Value can be zero
+
+                    value = '';
+                }
+                wwwAuthenticate += ' ' + names[i] + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
+            }
+        }
+
+        if (message) {
+            if (attributes) {
+                wwwAuthenticate += ',';
+            }
+            wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(message) + '"';
+        }
+        else {
+            err.isMissing = true;
+        }
+    }
+    else {
+
+        // function (message, wwwAuthenticate[])
+
+        var wwwArray = scheme;
+        for (var i = 0, il = wwwArray.length; i < il; ++i) {
+            if (i) {
+                wwwAuthenticate += ', ';
+            }
+
+            wwwAuthenticate += wwwArray[i];
+        }
+    }
+
+    err.response.headers['WWW-Authenticate'] = wwwAuthenticate;
+
+    return err;
+};
+
+
+internals.Boom.clientTimeout = function (message) {
+
+    return new internals.Boom(408, message);
+};
+
+
+internals.Boom.serverTimeout = function (message) {
+
+    return new internals.Boom(503, message);
+};
+
+
+internals.Boom.forbidden = function (message) {
+
+    return new internals.Boom(403, message);
+};
+
+
+internals.Boom.notFound = function (message) {
+
+    return new internals.Boom(404, message);
+};
+
+
+internals.Boom.internal = function (message, data) {
+
+    var err = new internals.Boom(500, message);
+
+    if (data && data.stack) {
+        err.trace = data.stack.split('\n');
+        err.outterTrace = Hoek.displayStack(1);
+    }
+    else {
+        err.trace = Hoek.displayStack(1);
+    }
+
+    err.data = data;
+    err.response.payload.message = 'An internal server error occurred';                     // Hide actual error from user
+
+    return err;
+};
+
+
+internals.Boom.passThrough = function (code, payload, contentType, headers) {
+
+    var err = new internals.Boom(500, 'Pass-through');                                      // 500 code is only used to initialize
+
+    err.data = {
+        code: code,
+        payload: payload,
+        type: contentType
+    };
+
+    err.response.code = code;
+    err.response.type = contentType;
+    err.response.headers = headers;
+    err.response.payload = payload;
+
+    return err;
+};
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/package.json
new file mode 100755 (executable)
index 0000000..2406a49
--- /dev/null
@@ -0,0 +1,64 @@
+{
+  "name": "boom",
+  "description": "HTTP-friendly error objects",
+  "version": "0.4.2",
+  "author": {
+    "name": "Eran Hammer",
+    "email": "eran@hueniverse.com",
+    "url": "http://hueniverse.com"
+  },
+  "contributors": [],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/spumko/boom"
+  },
+  "main": "index",
+  "keywords": [
+    "error",
+    "http"
+  ],
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "dependencies": {
+    "hoek": "0.9.x"
+  },
+  "devDependencies": {
+    "lab": "0.1.x",
+    "complexity-report": "0.x.x"
+  },
+  "scripts": {
+    "test": "make test-cov"
+  },
+  "licenses": [
+    {
+      "type": "BSD",
+      "url": "http://github.com/spumko/boom/raw/master/LICENSE"
+    }
+  ],
+  "_id": "boom@0.4.2",
+  "dist": {
+    "shasum": "7a636e9ded4efcefb19cef4947a3c67dfaee911b",
+    "tarball": "http://registry.npmjs.org/boom/-/boom-0.4.2.tgz"
+  },
+  "_from": "boom@0.4.x",
+  "_npmVersion": "1.2.18",
+  "_npmUser": {
+    "name": "hueniverse",
+    "email": "eran@hueniverse.com"
+  },
+  "maintainers": [
+    {
+      "name": "hueniverse",
+      "email": "eran@hueniverse.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "7a636e9ded4efcefb19cef4947a3c67dfaee911b",
+  "_resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz",
+  "bugs": {
+    "url": "https://github.com/spumko/boom/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/spumko/boom"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js
new file mode 100755 (executable)
index 0000000..a20c1c3
--- /dev/null
@@ -0,0 +1,245 @@
+// Load modules
+
+var Lab = require('lab');
+var Boom = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Boom', function () {
+
+    it('returns an error with info when constructed using another error', function (done) {
+
+        var error = new Error('ka-boom');
+        error.xyz = 123;
+        var err = new Boom(error);
+        expect(err.data.xyz).to.equal(123);
+        expect(err.message).to.equal('ka-boom');
+        expect(err.response).to.deep.equal({
+            code: 500,
+            payload: {
+                code: 500,
+                error: 'Internal Server Error',
+                message: 'ka-boom'
+            },
+            headers: {}
+        });
+        done();
+    });
+
+    describe('#isBoom', function () {
+
+        it('returns true for Boom object', function (done) {
+
+            expect(Boom.badRequest().isBoom).to.equal(true);
+            done();
+        });
+
+        it('returns false for Error object', function (done) {
+
+            expect(new Error().isBoom).to.not.exist;
+            done();
+        });
+    });
+
+    describe('#badRequest', function () {
+
+        it('returns a 400 error code', function (done) {
+
+            expect(Boom.badRequest().response.code).to.equal(400);
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            expect(Boom.badRequest('my message').message).to.equal('my message');
+            done();
+        });
+    });
+
+    describe('#unauthorized', function () {
+
+        it('returns a 401 error code', function (done) {
+
+            var err = Boom.unauthorized();
+            expect(err.response.code).to.equal(401);
+            expect(err.response.headers).to.deep.equal({});
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            expect(Boom.unauthorized('my message').message).to.equal('my message');
+            done();
+        });
+
+        it('returns a WWW-Authenticate header when passed a scheme', function (done) {
+
+            var err = Boom.unauthorized('boom', 'Test');
+            expect(err.response.code).to.equal(401);
+            expect(err.response.headers['WWW-Authenticate']).to.equal('Test error="boom"');
+            done();
+        });
+
+        it('returns a WWW-Authenticate header when passed a scheme and attributes', function (done) {
+
+            var err = Boom.unauthorized('boom', 'Test', { a: 1, b: 'something', c: null, d: 0 });
+            expect(err.response.code).to.equal(401);
+            expect(err.response.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0", error="boom"');
+            done();
+        });
+
+        it('sets the isMissing flag when error message is empty', function (done) {
+
+            var err = Boom.unauthorized('', 'Basic');
+            expect(err.isMissing).to.equal(true);
+            done();
+        });
+
+        it('does not set the isMissing flag when error message is not empty', function (done) {
+
+            var err = Boom.unauthorized('message', 'Basic');
+            expect(err.isMissing).to.equal(undefined);
+            done();
+        });
+
+        it('sets a WWW-Authenticate when passed as an array', function (done) {
+
+            var err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']);
+            expect(err.response.headers['WWW-Authenticate']).to.equal('Basic, Example e="1", Another x="3", y="4"');
+            done();
+        });
+    });
+
+    describe('#clientTimeout', function () {
+
+        it('returns a 408 error code', function (done) {
+
+            expect(Boom.clientTimeout().response.code).to.equal(408);
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            expect(Boom.clientTimeout('my message').message).to.equal('my message');
+            done();
+        });
+    });
+
+    describe('#serverTimeout', function () {
+
+        it('returns a 503 error code', function (done) {
+
+            expect(Boom.serverTimeout().response.code).to.equal(503);
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            expect(Boom.serverTimeout('my message').message).to.equal('my message');
+            done();
+        });
+    });
+
+    describe('#forbidden', function () {
+
+        it('returns a 403 error code', function (done) {
+
+            expect(Boom.forbidden().response.code).to.equal(403);
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            expect(Boom.forbidden('my message').message).to.equal('my message');
+            done();
+        });
+    });
+
+    describe('#notFound', function () {
+
+        it('returns a 404 error code', function (done) {
+
+            expect(Boom.notFound().response.code).to.equal(404);
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            expect(Boom.notFound('my message').message).to.equal('my message');
+            done();
+        });
+    });
+
+    describe('#internal', function () {
+
+        it('returns a 500 error code', function (done) {
+
+            expect(Boom.internal().response.code).to.equal(500);
+            done();
+        });
+
+        it('sets the message with the passed in message', function (done) {
+
+            var err = Boom.internal('my message');
+            expect(err.message).to.equal('my message');
+            expect(err.response.payload.message).to.equal('An internal server error occurred');
+            done();
+        });
+
+        it('passes data on the callback if its passed in', function (done) {
+
+            expect(Boom.internal('my message', { my: 'data' }).data.my).to.equal('data');
+            done();
+        });
+
+        it('uses passed in stack if its available', function (done) {
+
+            var error = new Error();
+            error.stack = 'my stack line\nmy second stack line';
+            expect(Boom.internal('my message', error).trace[0]).to.equal('my stack line');
+            done();
+        });
+    });
+
+    describe('#passThrough', function () {
+
+        it('returns a pass-through error', function (done) {
+
+            var err = Boom.passThrough(499, { a: 1 }, 'application/text', { 'X-Test': 'Boom' });
+            expect(err.response.code).to.equal(499);
+            expect(err.message).to.equal('Pass-through');
+            expect(err.response).to.deep.equal({
+                code: 499,
+                payload: { a: 1 },
+                headers: { 'X-Test': 'Boom' },
+                type: 'application/text'
+            });
+            done();
+        });
+    });
+
+    describe('#reformat', function () {
+
+        it('encodes any HTML markup in the response payload', function (done) {
+
+            var boom = new Boom(new Error('<script>alert(1)</script>'));
+            expect(boom.response.payload.message).to.not.contain('<script>');
+            done();
+        });
+    });
+});
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE
new file mode 100755 (executable)
index 0000000..e699a7b
--- /dev/null
@@ -0,0 +1,24 @@
+Copyright (c) 2012-2013, Eran Hammer.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Eran Hammer nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL ERAN HAMMER BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile
new file mode 100755 (executable)
index 0000000..9e7138c
--- /dev/null
@@ -0,0 +1,11 @@
+test:
+       @./node_modules/.bin/lab
+test-cov: 
+       @./node_modules/.bin/lab -r threshold -t 100
+test-cov-html:
+       @./node_modules/.bin/lab -r html -o coverage.html
+complexity:
+       @./node_modules/.bin/cr -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md
new file mode 100755 (executable)
index 0000000..6a900a4
--- /dev/null
@@ -0,0 +1,6 @@
+cryptiles
+=========
+
+General purpose crypto utilities
+
+[![Build Status](https://secure.travis-ci.org/hueniverse/cryptiles.png)](http://travis-ci.org/hueniverse/cryptiles)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js
new file mode 100755 (executable)
index 0000000..4cc88b3
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js
new file mode 100755 (executable)
index 0000000..dcf2bc3
--- /dev/null
@@ -0,0 +1,68 @@
+// Load modules
+
+var Crypto = require('crypto');
+var Boom = require('boom');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Generate a cryptographically strong pseudo-random data
+
+exports.randomString = function (size) {
+
+    var buffer = exports.randomBits((size + 1) * 6);
+    if (buffer instanceof Error) {
+        return buffer;
+    }
+
+    var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');
+    return string.slice(0, size);
+};
+
+
+exports.randomBits = function (bits) {
+
+    if (!bits ||
+        bits < 0) {
+
+        return Boom.internal('Invalid random bits count');
+    }
+
+    var bytes = Math.ceil(bits / 8);
+    try {
+        return Crypto.randomBytes(bytes);
+    }
+    catch (err) {
+        return Boom.internal('Failed generating random bits: ' + err.message);
+    }
+};
+
+
+// Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match)
+
+exports.fixedTimeComparison = function (a, b) {
+
+    if (typeof a !== 'string' ||
+        typeof b !== 'string') {
+
+        return false;
+    }
+
+    var mismatch = (a.length === b.length ? 0 : 1);
+    if (mismatch) {
+        b = a;
+    }
+
+    for (var i = 0, il = a.length; i < il; ++i) {
+        var ac = a.charCodeAt(i);
+        var bc = b.charCodeAt(i);
+        mismatch += (ac === bc ? 0 : 1);
+    }
+
+    return (mismatch === 0);
+};
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json
new file mode 100755 (executable)
index 0000000..c4cd1b2
--- /dev/null
@@ -0,0 +1,65 @@
+{
+  "name": "cryptiles",
+  "description": "General purpose crypto utilities",
+  "version": "0.2.2",
+  "author": {
+    "name": "Eran Hammer",
+    "email": "eran@hueniverse.com",
+    "url": "http://hueniverse.com"
+  },
+  "contributors": [],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/hueniverse/cryptiles"
+  },
+  "main": "index",
+  "keywords": [
+    "cryptography",
+    "security",
+    "utilites"
+  ],
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "dependencies": {
+    "boom": "0.4.x"
+  },
+  "devDependencies": {
+    "lab": "0.1.x",
+    "complexity-report": "0.x.x"
+  },
+  "scripts": {
+    "test": "make test-cov"
+  },
+  "licenses": [
+    {
+      "type": "BSD",
+      "url": "http://github.com/hueniverse/cryptiles/raw/master/LICENSE"
+    }
+  ],
+  "bugs": {
+    "url": "https://github.com/hueniverse/cryptiles/issues"
+  },
+  "_id": "cryptiles@0.2.2",
+  "dist": {
+    "shasum": "ed91ff1f17ad13d3748288594f8a48a0d26f325c",
+    "tarball": "http://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz"
+  },
+  "_from": "cryptiles@0.2.x",
+  "_npmVersion": "1.2.24",
+  "_npmUser": {
+    "name": "hueniverse",
+    "email": "eran@hueniverse.com"
+  },
+  "maintainers": [
+    {
+      "name": "hueniverse",
+      "email": "eran@hueniverse.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "ed91ff1f17ad13d3748288594f8a48a0d26f325c",
+  "_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/hueniverse/cryptiles"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js
new file mode 100755 (executable)
index 0000000..58aaa70
--- /dev/null
@@ -0,0 +1,101 @@
+// Load modules
+
+var Lab = require('lab');
+var Cryptiles = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Cryptiles', function () {
+
+    describe('#randomString', function () {
+
+        it('should generate the right length string', function (done) {
+
+            for (var i = 1; i <= 1000; ++i) {
+                expect(Cryptiles.randomString(i).length).to.equal(i);
+            }
+
+            done();
+        });
+
+        it('returns an error on invalid bits size', function (done) {
+
+            expect(Cryptiles.randomString(99999999999999999999).message).to.equal('Failed generating random bits: Argument #1 must be number > 0');
+            done();
+        });
+    });
+
+    describe('#randomBits', function () {
+
+        it('returns an error on invalid input', function (done) {
+
+            expect(Cryptiles.randomBits(0).message).to.equal('Invalid random bits count');
+            done();
+        });
+    });
+
+    describe('#fixedTimeComparison', function () {
+
+        var a = Cryptiles.randomString(50000);
+        var b = Cryptiles.randomString(150000);
+
+        it('should take the same amount of time comparing different string sizes', function (done) {
+
+            var now = Date.now();
+            Cryptiles.fixedTimeComparison(b, a);
+            var t1 = Date.now() - now;
+
+            now = Date.now();
+            Cryptiles.fixedTimeComparison(b, b);
+            var t2 = Date.now() - now;
+
+            expect(t2 - t1).to.be.within(-20, 20);
+            done();
+        });
+
+        it('should return true for equal strings', function (done) {
+
+            expect(Cryptiles.fixedTimeComparison(a, a)).to.equal(true);
+            done();
+        });
+
+        it('should return false for different strings (size, a < b)', function (done) {
+
+            expect(Cryptiles.fixedTimeComparison(a, a + 'x')).to.equal(false);
+            done();
+        });
+
+        it('should return false for different strings (size, a > b)', function (done) {
+
+            expect(Cryptiles.fixedTimeComparison(a + 'x', a)).to.equal(false);
+            done();
+        });
+
+        it('should return false for different strings (size, a = b)', function (done) {
+
+            expect(Cryptiles.fixedTimeComparison(a + 'x', a + 'y')).to.equal(false);
+            done();
+        });
+
+        it('should return false when not a string', function (done) {
+
+            expect(Cryptiles.fixedTimeComparison('x', null)).to.equal(false);
+            done();
+        });
+    });
+});
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE
new file mode 100755 (executable)
index 0000000..394adcf
--- /dev/null
@@ -0,0 +1,33 @@
+Copyright (c) 2011-2013, Walmart.\r
+All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+    * Redistributions of source code must retain the above copyright\r
+      notice, this list of conditions and the following disclaimer.\r
+    * Redistributions in binary form must reproduce the above copyright\r
+      notice, this list of conditions and the following disclaimer in the\r
+      documentation and/or other materials provided with the distribution.\r
+    * Neither the name of Walmart nor the\r
+      names of its contributors may be used to endorse or promote products\r
+      derived from this software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+DISCLAIMED. IN NO EVENT SHALL WALMART BE LIABLE FOR ANY\r
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+\r
+                                  *   *   *\r
+\r
+\r
+Portions of this project were initially based on Postmile, Copyright (c) 2011, Yahoo Inc.\r
+Postmile is published at https://github.com/yahoo/postmile and its licensing terms are\r
+published at https://github.com/yahoo/postmile/blob/master/LICENSE.\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile
new file mode 100755 (executable)
index 0000000..e605d6c
--- /dev/null
@@ -0,0 +1,10 @@
+test:\r
+       @node node_modules/lab/bin/lab\r
+test-cov: \r
+       @node node_modules/lab/bin/lab -r threshold -t 100\r
+test-cov-html:\r
+       @node node_modules/lab/bin/lab -r html -o coverage.html\r
+complexity:\r
+       @node node_modules/complexity-report/src/cli.js -o complexity.md -f markdown lib\r
+\r
+.PHONY: test test-cov test-cov-html complexity\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/README.md
new file mode 100755 (executable)
index 0000000..ac64e2f
--- /dev/null
@@ -0,0 +1,436 @@
+<a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>\r
+![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)\r
+\r
+General purpose node utilities\r
+\r
+[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)\r
+\r
+# Table of Contents\r
+\r
+* [Introduction](#introduction "Introduction")\r
+* [Object](#object "Object")\r
+  * [clone](#cloneobj "clone")\r
+  * [merge](#mergetarget-source-isnulloverride-ismergearrays "merge")\r
+  * [applyToDefaults](#applytodefaultsdefaults-options "applyToDefaults")\r
+  * [unique](#uniquearray-key "unique")\r
+  * [mapToObject](#maptoobjectarray-key "mapToObject")\r
+  * [intersect](#intersectarray1-array2 "intersect")\r
+  * [matchKeys](#matchkeysobj-keys "matchKeys")\r
+  * [flatten](#flattenarray-target "flatten")\r
+  * [removeKeys](#removekeysobject-keys "removeKeys")\r
+  * [reach](#reachobj-chain "reach")\r
+  * [inheritAsync](#inheritasyncself-obj-keys "inheritAsync")\r
+  * [rename](#renameobj-from-to "rename")\r
+* [Timer](#timer "Timer")\r
+* [Binary Encoding/Decoding](#binary "Binary Encoding/Decoding")\r
+  * [base64urlEncode](#binary64urlEncodevalue "binary64urlEncode")\r
+  * [base64urlDecode](#binary64urlDecodevalue "binary64urlDecode")\r
+* [Escaping Characters](#escaped "Escaping Characters")\r
+  * [escapeHtml](#escapeHtmlstring "escapeHtml")\r
+  * [escapeHeaderAttribute](#escapeHeaderAttributeattribute "escapeHeaderAttribute")\r
+  * [escapeRegex](#escapeRegexstring "escapeRegex")\r
+* [Errors](#errors "Errors")\r
+  * [assert](#assertmessage "assert")\r
+  * [abort](#abortmessage "abort")\r
+  * [displayStack](#displayStackslice "displayStack")\r
+  * [callStack](#callStackslice "callStack")\r
+  * [toss](#tosscondition "toss")\r
+* [Load files](#load-files "Load Files")\r
+  * [loadPackage](#loadPackagedir "loadpackage")\r
+  * [loadDirModules](#loadDirModulespath-excludefiles-target "loaddirmodules")\r
+\r
+\r
+\r
+# Introduction\r
+\r
+The *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more. \r
+\r
+For example, to use Hoek to set configuration with default options:\r
+```javascript\r
+var Hoek = require('hoek');\r
+\r
+var default = {url : "www.github.com", port : "8000", debug : true}\r
+\r
+var config = Hoek.applyToDefaults(default, {port : "3000", admin : true});\r
+\r
+// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }\r
+```\r
+\r
+Under each of the sections (such as Array), there are subsections which correspond to Hoek methods. Each subsection will explain how to use the corresponding method. In each js excerpt below, the var Hoek = require('hoek') is omitted for brevity.\r
+\r
+## Object\r
+\r
+Hoek provides several helpful methods for objects and arrays.\r
+\r
+### clone(obj)\r
+\r
+This method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects). \r
+\r
+```javascript\r
+\r
+var nestedObj = {\r
+        w: /^something$/ig,\r
+        x: {\r
+            a: [1, 2, 3],\r
+            b: 123456,\r
+            c: new Date()\r
+        },\r
+        y: 'y',\r
+        z: new Date()\r
+    };\r
+\r
+var copy = Hoek.clone(nestedObj);\r
+\r
+copy.x.b = 100;\r
+\r
+console.log(copy.y)        // results in 'y'\r
+console.log(nestedObj.x.b) // results in 123456\r
+console.log(copy.x.b)      // results in 100\r
+```\r
+\r
+### merge(target, source, isNullOverride, isMergeArrays)\r
+isNullOverride, isMergeArrays default to true\r
+\r
+Merge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied\r
+\r
+\r
+```javascript\r
+\r
+var target = {a: 1, b : 2}\r
+var source = {a: 0, c: 5}\r
+var source2 = {a: null, c: 5}\r
+\r
+var targetArray = [1, 2, 3];\r
+var sourceArray = [4, 5];\r
+\r
+var newTarget = Hoek.merge(target, source);     // results in {a: 0, b: 2, c: 5}\r
+newTarget = Hoek.merge(target, source2);        // results in {a: null, b: 2, c: 5}\r
+newTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}\r
+\r
+newTarget = Hoek.merge(targetArray, sourceArray)              // results in [1, 2, 3, 4, 5]\r
+newTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]\r
+\r
+\r
+\r
+\r
+```\r
+\r
+### applyToDefaults(defaults, options)\r
+\r
+Apply options to a copy of the defaults\r
+\r
+```javascript\r
+\r
+var defaults = {host: "localhost", port: 8000};\r
+var options = {port: 8080};\r
+\r
+var config = Hoek.applyToDefaults(defaults, options); // results in {host: "localhost", port: 8080};\r
+\r
+\r
+```\r
+\r
+### unique(array, key)\r
+\r
+Remove duplicate items from Array\r
+\r
+```javascript\r
+\r
+var array = [1, 2, 2, 3, 3, 4, 5, 6];\r
+\r
+var newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];\r
+\r
+array = [{id: 1}, {id: 1}, {id: 2}];\r
+\r
+newArray = Hoek.unique(array, "id") // results in [{id: 1}, {id: 2}]\r
+\r
+```\r
+\r
+### mapToObject(array, key)\r
+\r
+Convert an Array into an Object\r
+\r
+```javascript\r
+\r
+var array = [1,2,3];\r
+var newObject = Hoek.mapToObject(array); // results in [{"1": true}, {"2": true}, {"3": true}]\r
+\r
+array = [{id: 1}, {id: 2}];\r
+newObject = Hoek.mapToObject(array, "id") // results in [{"id": 1}, {"id": 2}]\r
+\r
+```\r
+### intersect(array1, array2)\r
+\r
+Find the common unique items in two arrays\r
+\r
+```javascript\r
+\r
+var array1 = [1, 2, 3];\r
+var array2 = [1, 4, 5];\r
+\r
+var newArray = Hoek.intersect(array1, array2) // results in [1]\r
+\r
+```\r
+\r
+### matchKeys(obj, keys) \r
+\r
+Find which keys are present\r
+\r
+```javascript\r
+\r
+var obj = {a: 1, b: 2, c: 3};\r
+var keys = ["a", "e"];\r
+\r
+Hoek.matchKeys(obj, keys) // returns ["a"]\r
+\r
+```\r
+\r
+### flatten(array, target)\r
+\r
+Flatten an array\r
+\r
+```javascript\r
+\r
+var array = [1, 2, 3];\r
+var target = [4, 5]; \r
+\r
+var flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];\r
+\r
+```\r
+\r
+### removeKeys(object, keys)\r
+\r
+Remove keys\r
+\r
+```javascript\r
+\r
+var object = {a: 1, b: 2, c: 3, d: 4};\r
+\r
+var keys = ["a", "b"];\r
+\r
+Hoek.removeKeys(object, keys) // object is now {c: 3, d: 4}\r
+\r
+```\r
+\r
+### reach(obj, chain)\r
+\r
+Converts an object key chain string to reference\r
+\r
+```javascript\r
+\r
+var chain = 'a.b.c';\r
+var obj = {a : {b : { c : 1}}};\r
+\r
+Hoek.reach(obj, chain) // returns 1\r
+\r
+```\r
+\r
+### inheritAsync(self, obj, keys) \r
+\r
+Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors\r
+\r
+```javascript\r
+\r
+var targetFunc = function () { };\r
+\r
+var proto = {\r
+                a: function () {\r
+                    return 'a!';\r
+                },\r
+                b: function () {\r
+                    return 'b!';\r
+                },\r
+                c: function () {\r
+                    throw new Error('c!');\r
+                }\r
+            };\r
+\r
+var keys = ['a', 'c'];\r
+\r
+Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);\r
+\r
+var target = new targetFunc();\r
+\r
+target.a(function(err, result){console.log(result)}         // returns 'a!'       \r
+\r
+target.c(function(err, result){console.log(result)}         // returns undefined\r
+\r
+target.b(function(err, result){console.log(result)}         // gives error: Object [object Object] has no method 'b'\r
+\r
+```\r
+\r
+### rename(obj, from, to)\r
+\r
+Rename a key of an object\r
+\r
+```javascript\r
+\r
+var obj = {a : 1, b : 2};\r
+\r
+Hoek.rename(obj, "a", "c");     // obj is now {c : 1, b : 2}\r
+\r
+```\r
+\r
+\r
+# Timer\r
+\r
+A Timer object. Initializing a new timer object sets the ts to the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.\r
+\r
+```javascript\r
+\r
+\r
+example : \r
+\r
+\r
+var timerObj = new Hoek.Timer();\r
+console.log("Time is now: " + timerObj.ts)\r
+console.log("Elapsed time from initialization: " + timerObj.elapsed() + 'milliseconds')\r
+\r
+```\r
+\r
+# Binary Encoding/Decoding\r
+\r
+### base64urlEncode(value)\r
+\r
+Encodes value in Base64 or URL encoding\r
+\r
+### base64urlDecode(value)\r
+\r
+Decodes data in Base64 or URL encoding.\r
+# Escaping Characters\r
+\r
+Hoek provides convenient methods for escaping html characters. The escaped characters are as followed:\r
+\r
+```javascript\r
+\r
+internals.htmlEscaped = {\r
+    '&': '&amp;',\r
+    '<': '&lt;',\r
+    '>': '&gt;',\r
+    '"': '&quot;',\r
+    "'": '&#x27;',\r
+    '`': '&#x60;'\r
+};\r
+\r
+```\r
+\r
+### escapeHtml(string)\r
+\r
+```javascript\r
+\r
+var string = '<html> hey </html>';\r
+var escapedString = Hoek.escapeHtml(string); // returns &lt;html&gt; hey &lt;/html&gt;\r
+\r
+```\r
+\r
+### escapeHeaderAttribute(attribute)\r
+\r
+Escape attribute value for use in HTTP header\r
+\r
+```javascript\r
+\r
+var a = Hoek.escapeHeaderAttribute('I said "go w\\o me"');  //returns I said \"go w\\o me\"\r
+\r
+\r
+```\r
+\r
+\r
+### escapeRegex(string)\r
+\r
+Escape string for Regex construction\r
+\r
+```javascript\r
+\r
+var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,');  // returns 4\^f\$s\.4\*5\+\-_\?%\=#\!\:@\|~\\\/`"\(>\)\[<\]d\{\}s\,\r
+\r
+\r
+\r
+```\r
+\r
+# Errors\r
+\r
+### assert(message)\r
+\r
+```javascript\r
+\r
+var a = 1, b =2;\r
+\r
+Hoek.assert(a === b, 'a should equal b');  // ABORT: a should equal b\r
+\r
+```\r
+\r
+### abort(message)\r
+\r
+First checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,\r
+displays most recent stack and then exits process.\r
+\r
+\r
+\r
+### displayStack(slice)\r
+\r
+Displays the trace stack\r
+\r
+```javascript\r
+\r
+var stack = Hoek.displayStack();\r
+console.log(stack) // returns something like:\r
+\r
+[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',\r
+  'Module._compile (module.js:449:26)',\r
+  'Module._extensions..js (module.js:467:10)',\r
+  'Module.load (module.js:356:32)',\r
+  'Module._load (module.js:312:12)',\r
+  'Module.runMain (module.js:492:10)',\r
+  'startup.processNextTick.process._tickCallback (node.js:244:9)' ]\r
+\r
+```\r
+\r
+### callStack(slice)\r
+\r
+Returns a trace stack array.\r
+\r
+```javascript\r
+\r
+var stack = Hoek.callStack();\r
+console.log(stack)  // returns something like:\r
+\r
+[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],\r
+  [ 'module.js', 449, 26, 'Module._compile', false ],\r
+  [ 'module.js', 467, 10, 'Module._extensions..js', false ],\r
+  [ 'module.js', 356, 32, 'Module.load', false ],\r
+  [ 'module.js', 312, 12, 'Module._load', false ],\r
+  [ 'module.js', 492, 10, 'Module.runMain', false ],\r
+  [ 'node.js',\r
+    244,\r
+    9,\r
+    'startup.processNextTick.process._tickCallback',\r
+    false ] ]\r
+\r
+\r
+```\r
+\r
+### toss(condition)\r
+\r
+toss(condition /*, [message], callback */)\r
+\r
+Return an error as first argument of a callback\r
+\r
+\r
+# Load Files\r
+\r
+### loadPackage(dir)\r
+\r
+Load and parse package.json process root or given directory\r
+\r
+```javascript\r
+\r
+var pack = Hoek.loadPackage();  // pack.name === 'hoek'\r
+\r
+```\r
+\r
+### loadDirModules(path, excludeFiles, target) \r
+\r
+Loads modules from a given path; option to exclude files (array).\r
+\r
+\r
+\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png
new file mode 100755 (executable)
index 0000000..6ccfcb1
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/index.js
new file mode 100755 (executable)
index 0000000..4cc88b3
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js
new file mode 100755 (executable)
index 0000000..666b3dc
--- /dev/null
@@ -0,0 +1,132 @@
+// Declare internals\r
+\r
+var internals = {};\r
+\r
+\r
+exports.escapeJavaScript = function (input) {\r
+\r
+    if (!input) {\r
+        return '';\r
+    }\r
+\r
+    var escaped = '';\r
+\r
+    for (var i = 0, il = input.length; i < il; ++i) {\r
+\r
+        var charCode = input.charCodeAt(i);\r
+\r
+        if (internals.isSafe(charCode)) {\r
+            escaped += input[i];\r
+        }\r
+        else {\r
+            escaped += internals.escapeJavaScriptChar(charCode);\r
+        }\r
+    }\r
+\r
+    return escaped;\r
+};\r
+\r
+\r
+exports.escapeHtml = function (input) {\r
+\r
+    if (!input) {\r
+        return '';\r
+    }\r
+\r
+    var escaped = '';\r
+\r
+    for (var i = 0, il = input.length; i < il; ++i) {\r
+\r
+        var charCode = input.charCodeAt(i);\r
+\r
+        if (internals.isSafe(charCode)) {\r
+            escaped += input[i];\r
+        }\r
+        else {\r
+            escaped += internals.escapeHtmlChar(charCode);\r
+        }\r
+    }\r
+\r
+    return escaped;\r
+};\r
+\r
+\r
+internals.escapeJavaScriptChar = function (charCode) {\r
+\r
+    if (charCode >= 256) {\r
+        return '\\u' + internals.padLeft('' + charCode, 4);\r
+    }\r
+\r
+    var hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex');\r
+    return '\\x' + internals.padLeft(hexValue, 2);\r
+};\r
+\r
+\r
+internals.escapeHtmlChar = function (charCode) {\r
+\r
+    var namedEscape = internals.namedHtml[charCode];\r
+    if (typeof namedEscape !== 'undefined') {\r
+        return namedEscape;\r
+    }\r
+\r
+    if (charCode >= 256) {\r
+        return '&#' + charCode + ';';\r
+    }\r
+\r
+    var hexValue = new Buffer(String.fromCharCode(charCode), 'ascii').toString('hex');\r
+    return '&#x' + internals.padLeft(hexValue, 2) + ';';\r
+};\r
+\r
+\r
+internals.padLeft = function (str, len) {\r
+\r
+    while (str.length < len) {\r
+        str = '0' + str;\r
+    }\r
+\r
+    return str;\r
+};\r
+\r
+\r
+internals.isSafe = function (charCode) {\r
+\r
+    return (typeof internals.safeCharCodes[charCode] !== 'undefined');\r
+};\r
+\r
+\r
+internals.namedHtml = {\r
+    '38': '&amp;',\r
+    '60': '&lt;',\r
+    '62': '&gt;',\r
+    '34': '&quot;',\r
+    '160': '&nbsp;',\r
+    '162': '&cent;',\r
+    '163': '&pound;',\r
+    '164': '&curren;',\r
+    '169': '&copy;',\r
+    '174': '&reg;'\r
+};\r
+\r
+\r
+internals.safeCharCodes = (function () {\r
+\r
+    var safe = {};\r
+\r
+    for (var i = 32; i < 123; ++i) {\r
+\r
+        if ((i >= 97 && i <= 122) ||         // a-z\r
+            (i >= 65 && i <= 90) ||          // A-Z\r
+            (i >= 48 && i <= 57) ||          // 0-9\r
+            i === 32 ||                      // space\r
+            i === 46 ||                      // .\r
+            i === 44 ||                      // ,\r
+            i === 45 ||                      // -\r
+            i === 58 ||                      // :\r
+            i === 95) {                      // _\r
+\r
+            safe[i] = null;\r
+        }\r
+    }\r
+\r
+    return safe;\r
+}());
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js
new file mode 100755 (executable)
index 0000000..806260d
--- /dev/null
@@ -0,0 +1,585 @@
+// Load modules\r
+\r
+var Fs = require('fs');\r
+var Escape = require('./escape');\r
+\r
+\r
+// Declare internals\r
+\r
+var internals = {};\r
+\r
+\r
+// Clone object or array\r
+\r
+exports.clone = function (obj, seen) {\r
+\r
+    if (typeof obj !== 'object' ||\r
+        obj === null) {\r
+\r
+        return obj;\r
+    }\r
+\r
+    seen = seen || { orig: [], copy: [] };\r
+\r
+    var lookup = seen.orig.indexOf(obj);\r
+    if (lookup !== -1) {\r
+        return seen.copy[lookup];\r
+    }\r
+\r
+    var newObj = (obj instanceof Array) ? [] : {};\r
+\r
+    seen.orig.push(obj);\r
+    seen.copy.push(newObj);\r
+\r
+    for (var i in obj) {\r
+        if (obj.hasOwnProperty(i)) {\r
+            if (obj[i] instanceof Buffer) {\r
+                newObj[i] = new Buffer(obj[i]);\r
+            }\r
+            else if (obj[i] instanceof Date) {\r
+                newObj[i] = new Date(obj[i].getTime());\r
+            }\r
+            else if (obj[i] instanceof RegExp) {\r
+                var flags = '' + (obj[i].global ? 'g' : '') + (obj[i].ignoreCase ? 'i' : '') + (obj[i].multiline ? 'm' : '');\r
+                newObj[i] = new RegExp(obj[i].source, flags);\r
+            }\r
+            else {\r
+                newObj[i] = exports.clone(obj[i], seen);\r
+            }\r
+        }\r
+    }\r
+\r
+    return newObj;\r
+};\r
+\r
+\r
+// Merge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied\r
+\r
+exports.merge = function (target, source, isNullOverride /* = true */, isMergeArrays /* = true */) {\r
+\r
+    exports.assert(target && typeof target == 'object', 'Invalid target value: must be an object');\r
+    exports.assert(source === null || source === undefined || typeof source === 'object', 'Invalid source value: must be null, undefined, or an object');\r
+\r
+    if (!source) {\r
+        return target;\r
+    }\r
+\r
+    if (source instanceof Array) {\r
+        exports.assert(target instanceof Array, 'Cannot merge array onto an object');\r
+        if (isMergeArrays === false) {                                                  // isMergeArrays defaults to true\r
+            target.length = 0;                                                          // Must not change target assignment\r
+        }\r
+\r
+        for (var i = 0, il = source.length; i < il; ++i) {\r
+            target.push(source[i]);\r
+        }\r
+\r
+        return target;\r
+    }\r
+\r
+    var keys = Object.keys(source);\r
+    for (var k = 0, kl = keys.length; k < kl; ++k) {\r
+        var key = keys[k];\r
+        var value = source[key];\r
+        if (value &&\r
+            typeof value === 'object') {\r
+\r
+            if (!target[key] ||\r
+                typeof target[key] !== 'object') {\r
+\r
+                target[key] = exports.clone(value);\r
+            }\r
+            else {\r
+                exports.merge(target[key], source[key], isNullOverride, isMergeArrays);\r
+            }\r
+        }\r
+        else {\r
+            if (value !== null && value !== undefined) {            // Explicit to preserve empty strings\r
+                target[key] = value;\r
+            }\r
+            else if (isNullOverride !== false) {                    // Defaults to true\r
+                target[key] = value;\r
+            }\r
+        }\r
+    }\r
+\r
+    return target;\r
+};\r
+\r
+\r
+// Apply options to a copy of the defaults\r
+\r
+exports.applyToDefaults = function (defaults, options) {\r
+\r
+    exports.assert(defaults && typeof defaults == 'object', 'Invalid defaults value: must be an object');\r
+    exports.assert(!options || options === true || typeof options === 'object', 'Invalid options value: must be true, falsy or an object');\r
+\r
+    if (!options) {                                                 // If no options, return null\r
+        return null;\r
+    }\r
+\r
+    var copy = exports.clone(defaults);\r
+\r
+    if (options === true) {                                         // If options is set to true, use defaults\r
+        return copy;\r
+    }\r
+\r
+    return exports.merge(copy, options, false, false);\r
+};\r
+\r
+\r
+// Remove duplicate items from array\r
+\r
+exports.unique = function (array, key) {\r
+\r
+    var index = {};\r
+    var result = [];\r
+\r
+    for (var i = 0, il = array.length; i < il; ++i) {\r
+        var id = (key ? array[i][key] : array[i]);\r
+        if (index[id] !== true) {\r
+\r
+            result.push(array[i]);\r
+            index[id] = true;\r
+        }\r
+    }\r
+\r
+    return result;\r
+};\r
+\r
+\r
+// Convert array into object\r
+\r
+exports.mapToObject = function (array, key) {\r
+\r
+    if (!array) {\r
+        return null;\r
+    }\r
+\r
+    var obj = {};\r
+    for (var i = 0, il = array.length; i < il; ++i) {\r
+        if (key) {\r
+            if (array[i][key]) {\r
+                obj[array[i][key]] = true;\r
+            }\r
+        }\r
+        else {\r
+            obj[array[i]] = true;\r
+        }\r
+    }\r
+\r
+    return obj;\r
+};\r
+\r
+\r
+// Find the common unique items in two arrays\r
+\r
+exports.intersect = function (array1, array2, justFirst) {\r
+\r
+    if (!array1 || !array2) {\r
+        return [];\r
+    }\r
+\r
+    var common = [];\r
+    var hash = (array1 instanceof Array ? exports.mapToObject(array1) : array1);\r
+    var found = {};\r
+    for (var i = 0, il = array2.length; i < il; ++i) {\r
+        if (hash[array2[i]] && !found[array2[i]]) {\r
+            if (justFirst) {\r
+                return array2[i];\r
+            }\r
+\r
+            common.push(array2[i]);\r
+            found[array2[i]] = true;\r
+        }\r
+    }\r
+\r
+    return (justFirst ? null : common);\r
+};\r
+\r
+\r
+// Find which keys are present\r
+\r
+exports.matchKeys = function (obj, keys) {\r
+\r
+    var matched = [];\r
+    for (var i = 0, il = keys.length; i < il; ++i) {\r
+        if (obj.hasOwnProperty(keys[i])) {\r
+            matched.push(keys[i]);\r
+        }\r
+    }\r
+    return matched;\r
+};\r
+\r
+\r
+// Flatten array\r
+\r
+exports.flatten = function (array, target) {\r
+\r
+    var result = target || [];\r
+\r
+    for (var i = 0, il = array.length; i < il; ++i) {\r
+        if (Array.isArray(array[i])) {\r
+            exports.flatten(array[i], result);\r
+        }\r
+        else {\r
+            result.push(array[i]);\r
+        }\r
+    }\r
+\r
+    return result;\r
+};\r
+\r
+\r
+// Remove keys\r
+\r
+exports.removeKeys = function (object, keys) {\r
+\r
+    for (var i = 0, il = keys.length; i < il; i++) {\r
+        delete object[keys[i]];\r
+    }\r
+};\r
+\r
+\r
+// Convert an object key chain string ('a.b.c') to reference (object[a][b][c])\r
+\r
+exports.reach = function (obj, chain) {\r
+\r
+    var path = chain.split('.');\r
+    var ref = obj;\r
+    for (var i = 0, il = path.length; i < il; ++i) {\r
+        if (ref) {\r
+            ref = ref[path[i]];\r
+        }\r
+    }\r
+\r
+    return ref;\r
+};\r
+\r
+\r
+// Inherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors\r
+\r
+exports.inheritAsync = function (self, obj, keys) {\r
+\r
+    keys = keys || null;\r
+\r
+    for (var i in obj) {\r
+        if (obj.hasOwnProperty(i)) {\r
+            if (keys instanceof Array &&\r
+                keys.indexOf(i) < 0) {\r
+\r
+                continue;\r
+            }\r
+\r
+            self.prototype[i] = (function (fn) {\r
+\r
+                return function (next) {\r
+\r
+                    var result = null;\r
+                    try {\r
+                        result = fn();\r
+                    }\r
+                    catch (err) {\r
+                        return next(err);\r
+                    }\r
+\r
+                    return next(null, result);\r
+                };\r
+            })(obj[i]);\r
+        }\r
+    }\r
+};\r
+\r
+\r
+exports.formatStack = function (stack) {\r
+\r
+    var trace = [];\r
+    for (var i = 0, il = stack.length; i < il; ++i) {\r
+        var item = stack[i];\r
+        trace.push([item.getFileName(), item.getLineNumber(), item.getColumnNumber(), item.getFunctionName(), item.isConstructor()]);\r
+    }\r
+\r
+    return trace;\r
+};\r
+\r
+\r
+exports.formatTrace = function (trace) {\r
+\r
+    var display = [];\r
+\r
+    for (var i = 0, il = trace.length; i < il; ++i) {\r
+        var row = trace[i];\r
+        display.push((row[4] ? 'new ' : '') + row[3] + ' (' + row[0] + ':' + row[1] + ':' + row[2] + ')');\r
+    }\r
+\r
+    return display;\r
+};\r
+\r
+\r
+exports.callStack = function (slice) {\r
+\r
+    // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi\r
+\r
+    var v8 = Error.prepareStackTrace;\r
+    Error.prepareStackTrace = function (err, stack) {\r
+\r
+        return stack;\r
+    };\r
+\r
+    var capture = {};\r
+    Error.captureStackTrace(capture, arguments.callee);\r
+    var stack = capture.stack;\r
+\r
+    Error.prepareStackTrace = v8;\r
+\r
+    var trace = exports.formatStack(stack);\r
+\r
+    if (slice) {\r
+        return trace.slice(slice);\r
+    }\r
+\r
+    return trace;\r
+};\r
+\r
+\r
+exports.displayStack = function (slice) {\r
+\r
+    var trace = exports.callStack(slice === undefined ? 1 : slice + 1);\r
+\r
+    return exports.formatTrace(trace);\r
+};\r
+\r
+\r
+exports.abortThrow = false;\r
+\r
+\r
+exports.abort = function (message, hideStack) {\r
+\r
+    if (process.env.NODE_ENV === 'test' || exports.abortThrow === true) {\r
+        throw new Error(message || 'Unknown error');\r
+    }\r
+\r
+    var stack = '';\r
+    if (!hideStack) {\r
+        stack = exports.displayStack(1).join('\n\t');\r
+    }\r
+    console.log('ABORT: ' + message + '\n\t' + stack);\r
+    process.exit(1);\r
+};\r
+\r
+\r
+exports.assert = function (condition /*, msg1, msg2, msg3 */) {\r
+\r
+    if (condition) {\r
+        return;\r
+    }\r
+\r
+    var msgs = Array.prototype.slice.call(arguments, 1);\r
+    msgs = msgs.map(function (msg) {\r
+\r
+        return typeof msg === 'string' ? msg : msg instanceof Error ? msg.message : JSON.stringify(msg);\r
+    });\r
+    throw new Error(msgs.join(' ') || 'Unknown error');\r
+};\r
+\r
+\r
+exports.loadDirModules = function (path, excludeFiles, target) {      // target(filename, name, capName)\r
+\r
+    var exclude = {};\r
+    for (var i = 0, il = excludeFiles.length; i < il; ++i) {\r
+        exclude[excludeFiles[i] + '.js'] = true;\r
+    }\r
+\r
+    var files = Fs.readdirSync(path);\r
+    for (i = 0, il = files.length; i < il; ++i) {\r
+        var filename = files[i];\r
+        if (/\.js$/.test(filename) &&\r
+            !exclude[filename]) {\r
+\r
+            var name = filename.substr(0, filename.lastIndexOf('.'));\r
+            var capName = name.charAt(0).toUpperCase() + name.substr(1).toLowerCase();\r
+\r
+            if (typeof target !== 'function') {\r
+                target[capName] = require(path + '/' + name);\r
+            }\r
+            else {\r
+                target(path + '/' + name, name, capName);\r
+            }\r
+        }\r
+    }\r
+};\r
+\r
+\r
+exports.rename = function (obj, from, to) {\r
+\r
+    obj[to] = obj[from];\r
+    delete obj[from];\r
+};\r
+\r
+\r
+exports.Timer = function () {\r
+\r
+    this.reset();\r
+};\r
+\r
+\r
+exports.Timer.prototype.reset = function () {\r
+\r
+    this.ts = Date.now();\r
+};\r
+\r
+\r
+exports.Timer.prototype.elapsed = function () {\r
+\r
+    return Date.now() - this.ts;\r
+};\r
+\r
+\r
+// Load and parse package.json process root or given directory\r
+\r
+exports.loadPackage = function (dir) {\r
+\r
+    var result = {};\r
+    var filepath = (dir || process.env.PWD) + '/package.json';\r
+    if (Fs.existsSync(filepath)) {\r
+        try {\r
+            result = JSON.parse(Fs.readFileSync(filepath));\r
+        }\r
+        catch (e) { }\r
+    }\r
+\r
+    return result;\r
+};\r
+\r
+\r
+// Escape string for Regex construction\r
+\r
+exports.escapeRegex = function (string) {\r
+\r
+    // Escape ^$.*+-?=!:|\/()[]{},\r
+    return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');\r
+};\r
+\r
+\r
+// Return an error as first argument of a callback\r
+\r
+exports.toss = function (condition /*, [message], next */) {\r
+\r
+    var message = (arguments.length === 3 ? arguments[1] : '');\r
+    var next = (arguments.length === 3 ? arguments[2] : arguments[1]);\r
+\r
+    var err = (message instanceof Error ? message : (message ? new Error(message) : (condition instanceof Error ? condition : new Error())));\r
+\r
+    if (condition instanceof Error ||\r
+        !condition) {\r
+\r
+        return next(err);\r
+    }\r
+};\r
+\r
+\r
+// Base64url (RFC 4648) encode\r
+\r
+exports.base64urlEncode = function (value) {\r
+\r
+    return (new Buffer(value, 'binary')).toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');\r
+};\r
+\r
+\r
+// Base64url (RFC 4648) decode\r
+\r
+exports.base64urlDecode = function (encoded) {\r
+\r
+    if (encoded &&\r
+        !encoded.match(/^[\w\-]*$/)) {\r
+\r
+        return new Error('Invalid character');\r
+    }\r
+\r
+    try {\r
+        return (new Buffer(encoded.replace(/-/g, '+').replace(/:/g, '/'), 'base64')).toString('binary');\r
+    }\r
+    catch (err) {\r
+        return err;\r
+    }\r
+};\r
+\r
+\r
+// Escape attribute value for use in HTTP header\r
+\r
+exports.escapeHeaderAttribute = function (attribute) {\r
+\r
+    // Allowed value characters: !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9, \, "\r
+\r
+    exports.assert(attribute.match(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/), 'Bad attribute value (' + attribute + ')');\r
+\r
+    return attribute.replace(/\\/g, '\\\\').replace(/\"/g, '\\"');                             // Escape quotes and slash\r
+};\r
+\r
+\r
+exports.escapeHtml = function (string) {\r
+\r
+    return Escape.escapeHtml(string);\r
+};\r
+\r
+\r
+exports.escapeJavaScript = function (string) {\r
+\r
+    return Escape.escapeJavaScript(string);\r
+};\r
+\r
+\r
+/*\r
+var event = {\r
+    timestamp: now.getTime(),\r
+    tags: ['tag'],\r
+    data: { some: 'data' }\r
+};\r
+*/\r
+\r
+exports.consoleFunc = console.log;\r
+\r
+exports.printEvent = function (event) {\r
+\r
+    var pad = function (value) {\r
+\r
+        return (value < 10 ? '0' : '') + value;\r
+    };\r
+\r
+    var now = new Date(event.timestamp);\r
+    var timestring = (now.getYear() - 100).toString() +\r
+        pad(now.getMonth() + 1) +\r
+        pad(now.getDate()) +\r
+        '/' +\r
+        pad(now.getHours()) +\r
+        pad(now.getMinutes()) +\r
+        pad(now.getSeconds()) +\r
+        '.' +\r
+        now.getMilliseconds();\r
+\r
+    var data = event.data;\r
+    if (typeof event.data !== 'string') {\r
+        try {\r
+            data = JSON.stringify(event.data);\r
+        }\r
+        catch (e) {\r
+            data = 'JSON Error: ' + e.message;\r
+        }\r
+    }\r
+\r
+    var output = timestring + ', ' + event.tags[0] + ', ' + data;\r
+    exports.consoleFunc(output);\r
+};\r
+\r
+\r
+exports.nextTick = function (callback) {\r
+\r
+    return function () {\r
+\r
+        var args = arguments;\r
+        process.nextTick(function () {\r
+\r
+            callback.apply(null, args);\r
+        });\r
+    };\r
+};\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/package.json
new file mode 100755 (executable)
index 0000000..4e4eb74
--- /dev/null
@@ -0,0 +1,70 @@
+{
+  "name": "hoek",
+  "description": "General purpose node utilities",
+  "version": "0.9.1",
+  "author": {
+    "name": "Eran Hammer",
+    "email": "eran@hueniverse.com",
+    "url": "http://hueniverse.com"
+  },
+  "contributors": [
+    {
+      "name": "Van Nguyen",
+      "email": "the.gol.effect@gmail.com"
+    }
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/spumko/hoek"
+  },
+  "main": "index",
+  "keywords": [
+    "utilities"
+  ],
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "lab": "0.1.x",
+    "complexity-report": "0.x.x"
+  },
+  "scripts": {
+    "test": "make test-cov"
+  },
+  "licenses": [
+    {
+      "type": "BSD",
+      "url": "http://github.com/spumko/hoek/raw/master/LICENSE"
+    }
+  ],
+  "_id": "hoek@0.9.1",
+  "dist": {
+    "shasum": "3d322462badf07716ea7eb85baf88079cddce505",
+    "tarball": "http://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
+  },
+  "_from": "hoek@0.9.x",
+  "_npmVersion": "1.2.18",
+  "_npmUser": {
+    "name": "hueniverse",
+    "email": "eran@hueniverse.com"
+  },
+  "maintainers": [
+    {
+      "name": "hueniverse",
+      "email": "eran@hueniverse.com"
+    },
+    {
+      "name": "thegoleffect",
+      "email": "thegoleffect@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "3d322462badf07716ea7eb85baf88079cddce505",
+  "_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz",
+  "bugs": {
+    "url": "https://github.com/spumko/hoek/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/spumko/hoek"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js
new file mode 100755 (executable)
index 0000000..4dddd77
--- /dev/null
@@ -0,0 +1,86 @@
+// Load modules\r
+\r
+var Lab = require('lab');\r
+var Hoek = require('../lib');\r
+\r
+\r
+// Declare internals\r
+\r
+var internals = {};\r
+\r
+\r
+// Test shortcuts\r
+\r
+var expect = Lab.expect;\r
+var before = Lab.before;\r
+var after = Lab.after;\r
+var describe = Lab.experiment;\r
+var it = Lab.test;\r
+\r
+\r
+describe('Hoek', function () {\r
+\r
+    describe('#escapeJavaScript', function () {\r
+\r
+        it('encodes / characters', function (done) {\r
+\r
+            var encoded = Hoek.escapeJavaScript('<script>alert(1)</script>');\r
+            expect(encoded).to.equal('\\x3cscript\\x3ealert\\x281\\x29\\x3c\\x2fscript\\x3e');\r
+            done();\r
+        });\r
+\r
+        it('encodes \' characters', function (done) {\r
+\r
+            var encoded = Hoek.escapeJavaScript('something(\'param\')');\r
+            expect(encoded).to.equal('something\\x28\\x27param\\x27\\x29');\r
+            done();\r
+        });\r
+\r
+        it('encodes large unicode characters with the correct padding', function (done) {\r
+\r
+            var encoded = Hoek.escapeJavaScript(String.fromCharCode(500) + String.fromCharCode(1000));\r
+            expect(encoded).to.equal('\\u0500\\u1000');\r
+            done();\r
+        });\r
+\r
+        it('doesn\'t throw an exception when passed null', function (done) {\r
+\r
+            var encoded = Hoek.escapeJavaScript(null);\r
+            expect(encoded).to.equal('');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#escapeHtml', function () {\r
+\r
+        it('encodes / characters', function (done) {\r
+\r
+            var encoded = Hoek.escapeHtml('<script>alert(1)</script>');\r
+            expect(encoded).to.equal('&lt;script&gt;alert&#x28;1&#x29;&lt;&#x2f;script&gt;');\r
+            done();\r
+        });\r
+\r
+        it('encodes < and > as named characters', function (done) {\r
+\r
+            var encoded = Hoek.escapeHtml('<script><>');\r
+            expect(encoded).to.equal('&lt;script&gt;&lt;&gt;');\r
+            done();\r
+        });\r
+\r
+        it('encodes large unicode characters', function (done) {\r
+\r
+            var encoded = Hoek.escapeHtml(String.fromCharCode(500) + String.fromCharCode(1000));\r
+            expect(encoded).to.equal('&#500;&#1000;');\r
+            done();\r
+        });\r
+\r
+        it('doesn\'t throw an exception when passed null', function (done) {\r
+\r
+            var encoded = Hoek.escapeHtml(null);\r
+            expect(encoded).to.equal('');\r
+            done();\r
+        });\r
+    });\r
+});\r
+\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js
new file mode 100755 (executable)
index 0000000..c40e3ad
--- /dev/null
@@ -0,0 +1,1078 @@
+// Load modules\r
+\r
+var Lab = require('lab');\r
+var Hoek = require('../lib');\r
+\r
+\r
+// Declare internals\r
+\r
+var internals = {};\r
+\r
+\r
+// Test shortcuts\r
+\r
+var expect = Lab.expect;\r
+var before = Lab.before;\r
+var after = Lab.after;\r
+var describe = Lab.experiment;\r
+var it = Lab.test;\r
+\r
+\r
+describe('Hoek', function () {\r
+\r
+    var nestedObj = {\r
+        v: [7,8,9],\r
+        w: /^something$/igm,\r
+        x: {\r
+            a: [1, 2, 3],\r
+            b: 123456,\r
+            c: new Date(),\r
+            d: /hi/igm,\r
+            e: /hello/\r
+        },\r
+        y: 'y',\r
+        z: new Date()\r
+    };\r
+\r
+    var dupsArray = [nestedObj, { z: 'z' }, nestedObj];\r
+    var reducedDupsArray = [nestedObj, { z: 'z' }];\r
+\r
+    describe('#clone', function () {\r
+\r
+        it('should clone a nested object', function (done) {\r
+\r
+            var a = nestedObj;\r
+            var b = Hoek.clone(a);\r
+\r
+            expect(a).to.deep.equal(b);\r
+            expect(a.z.getTime()).to.equal(b.z.getTime());\r
+            done();\r
+        });\r
+\r
+        it('should clone a null object', function (done) {\r
+\r
+            var b = Hoek.clone(null);\r
+\r
+            expect(b).to.equal(null);\r
+            done();\r
+        });\r
+\r
+        it('should not convert undefined properties to null', function (done) {\r
+\r
+            var obj = { something: undefined };\r
+            var b = Hoek.clone(obj);\r
+\r
+            expect(typeof b.something).to.equal('undefined');\r
+            done();\r
+        });\r
+\r
+        it('should not throw on circular reference', function (done) {\r
+\r
+            var a = {};\r
+            a.x = a;\r
+\r
+            var test = (function () {\r
+\r
+                var b = Hoek.clone(a);\r
+            });\r
+\r
+            expect(test).to.not.throw();\r
+            done();\r
+        });\r
+\r
+        it('should properly clone circular reference', function (done) {\r
+\r
+            var x = {\r
+                'z': new Date()\r
+            };\r
+            x.y = x;\r
+\r
+            var b = Hoek.clone(x);\r
+            expect(Object.keys(b.y)).to.deep.equal(Object.keys(x))\r
+            expect(b.z).to.not.equal(x.z);\r
+            expect(b.y).to.not.equal(x.y);\r
+            expect(b.y.z).to.not.equal(x.y.z);\r
+            expect(b.y).to.equal(b);\r
+            expect(b.y.y.y.y).to.equal(b);\r
+            done();\r
+        });\r
+\r
+        it('should properly clone deeply nested object', function (done) {\r
+\r
+            var a = {\r
+                x: {\r
+                    y: {\r
+                        a: [1, 2, 3],\r
+                        b: 123456,\r
+                        c: new Date(),\r
+                        d: /hi/igm,\r
+                        e: /hello/\r
+                    },\r
+                }\r
+            };\r
+\r
+            var b = Hoek.clone(a);\r
+\r
+            expect(a).to.deep.equal(b);\r
+            expect(a.x.y.c.getTime()).to.equal(b.x.y.c.getTime());\r
+            done();\r
+        });\r
+\r
+        it('should properly clone arrays', function (done) {\r
+\r
+            var a = [1,2,3];\r
+\r
+            var b = Hoek.clone(a);\r
+\r
+            expect(a).to.deep.equal(b);\r
+            done();\r
+        });\r
+\r
+        it('should perform actual copy for shallow keys (no pass by reference)', function (done) {\r
+\r
+            var x = Hoek.clone(nestedObj);\r
+            var y = Hoek.clone(nestedObj);\r
+\r
+            // Date\r
+            expect(x.z).to.not.equal(nestedObj.z);\r
+            expect(x.z).to.not.equal(y.z);\r
+\r
+            // Regex\r
+            expect(x.w).to.not.equal(nestedObj.w);\r
+            expect(x.w).to.not.equal(y.w);\r
+\r
+            // Array\r
+            expect(x.v).to.not.equal(nestedObj.v);\r
+            expect(x.v).to.not.equal(y.v);\r
+\r
+            // Immutable(s)\r
+            x.y = 5;\r
+            expect(x.y).to.not.equal(nestedObj.y);\r
+            expect(x.y).to.not.equal(y.y);\r
+\r
+            done();\r
+        });\r
+\r
+        it('should perform actual copy for deep keys (no pass by reference)', function (done) {\r
+\r
+            var x = Hoek.clone(nestedObj);\r
+            var y = Hoek.clone(nestedObj);\r
+\r
+            expect(x.x.c).to.not.equal(nestedObj.x.c);\r
+            expect(x.x.c).to.not.equal(y.x.c);\r
+\r
+            expect(x.x.c.getTime()).to.equal(nestedObj.x.c.getTime());\r
+            expect(x.x.c.getTime()).to.equal(y.x.c.getTime());\r
+            done();\r
+        });\r
+\r
+        it('copies functions with properties', function (done) {\r
+\r
+            var a = {\r
+                x: function () { return 1; },\r
+                y: {}\r
+            };\r
+            a.x.z = 'string in function';\r
+            a.x.v = function () { return 2; };\r
+            a.y.u = a.x;\r
+\r
+            var b = Hoek.clone(a);\r
+            expect(b.x()).to.equal(1);\r
+            expect(b.x.v()).to.equal(2);\r
+            expect(b.y.u).to.equal(b.x);\r
+            expect(b.x.z).to.equal('string in function');\r
+            done();\r
+        });\r
+\r
+        it('should copy a buffer', function(done){\r
+            var tls = {\r
+                key: new Buffer([1,2,3,4,5]),\r
+                cert: new Buffer([1,2,3,4,5,6,10])\r
+            }\r
+\r
+            copiedTls = Hoek.clone(tls);\r
+            expect(Buffer.isBuffer(copiedTls.key)).to.equal(true);\r
+            expect(JSON.stringify(copiedTls.key)).to.equal(JSON.stringify(tls.key))\r
+            expect(Buffer.isBuffer(copiedTls.cert)).to.equal(true);\r
+            expect(JSON.stringify(copiedTls.cert)).to.equal(JSON.stringify(tls.cert))\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#merge', function () {\r
+\r
+        it('does not throw if source is null', function (done) {\r
+\r
+            var a = {};\r
+            var b = null;\r
+            var c = null;\r
+\r
+            expect(function () {\r
+\r
+                c = Hoek.merge(a, b);\r
+            }).to.not.throw();\r
+\r
+            expect(c).to.equal(a);\r
+            done();\r
+        });\r
+\r
+        it('does not throw if source is undefined', function (done) {\r
+\r
+            var a = {};\r
+            var b = undefined;\r
+            var c = null;\r
+\r
+            expect(function () {\r
+\r
+                c = Hoek.merge(a, b);\r
+            }).to.not.throw();\r
+\r
+            expect(c).to.equal(a);\r
+            done();\r
+        });\r
+\r
+        it('throws if source is not an object', function (done) {\r
+\r
+            expect(function () {\r
+\r
+                var a = {};\r
+                var b = 0;\r
+\r
+                Hoek.merge(a, b);\r
+            }).to.throw('Invalid source value: must be null, undefined, or an object');\r
+            done();\r
+        });\r
+\r
+        it('throws if target is not an object', function (done) {\r
+\r
+            expect(function () {\r
+\r
+                var a = 0;\r
+                var b = {};\r
+\r
+                Hoek.merge(a, b);\r
+            }).to.throw('Invalid target value: must be an object');\r
+            done();\r
+        });\r
+\r
+        it('throws if target is not an array and source is', function (done) {\r
+\r
+            expect(function () {\r
+\r
+                var a = {};\r
+                var b = [1, 2];\r
+\r
+                Hoek.merge(a, b);\r
+            }).to.throw('Cannot merge array onto an object');\r
+            done();\r
+        });\r
+\r
+        it('returns the same object when merging arrays', function (done) {\r
+\r
+            var a = [];\r
+            var b = [1, 2];\r
+\r
+            expect(Hoek.merge(a, b)).to.equal(a);\r
+            done();\r
+        });\r
+\r
+        it('should combine an empty object with a non-empty object', function (done) {\r
+\r
+            var a = {};\r
+            var b = nestedObj;\r
+\r
+            var c = Hoek.merge(a, b);\r
+            expect(a).to.deep.equal(b);\r
+            expect(c).to.deep.equal(b);\r
+            done();\r
+        });\r
+\r
+        it('should override values in target', function (done) {\r
+\r
+            var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };\r
+            var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };\r
+\r
+            var c = Hoek.merge(a, b);\r
+            expect(c.x).to.equal(null);\r
+            expect(c.y).to.equal(2);\r
+            expect(c.z).to.equal(4);\r
+            expect(c.v).to.equal(0);\r
+            expect(c.m).to.equal('123');\r
+            expect(c.t).to.deep.equal({ u: 6 });\r
+            done();\r
+        });\r
+\r
+        it('should override values in target (flip)', function (done) {\r
+\r
+            var a = { x: 1, y: 2, z: 3, v: 5, t: 'test', m: 'abc' };\r
+            var b = { x: null, z: 4, v: 0, t: { u: 6 }, m: '123' };\r
+\r
+            var d = Hoek.merge(b, a);\r
+            expect(d.x).to.equal(1);\r
+            expect(d.y).to.equal(2);\r
+            expect(d.z).to.equal(3);\r
+            expect(d.v).to.equal(5);\r
+            expect(d.m).to.equal('abc');\r
+            expect(d.t).to.deep.equal('test');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#applyToDefaults', function () {\r
+\r
+        var defaults = {\r
+            a: 1,\r
+            b: 2,\r
+            c: {\r
+                d: 3,\r
+                e: [5, 6]\r
+            },\r
+            f: 6,\r
+            g: 'test'\r
+        };\r
+\r
+        it('should return null if options is false', function (done) {\r
+\r
+            var result = Hoek.applyToDefaults(defaults, false);\r
+            expect(result).to.equal(null);\r
+            done();\r
+        });\r
+\r
+        it('should return a copy of defaults if options is true', function (done) {\r
+\r
+            var result = Hoek.applyToDefaults(defaults, true);\r
+            expect(result).to.deep.equal(result);\r
+            done();\r
+        });\r
+\r
+        it('should apply object to defaults', function (done) {\r
+\r
+            var obj = {\r
+                a: null,\r
+                c: {\r
+                    e: [4]\r
+                },\r
+                f: 0,\r
+                g: {\r
+                    h: 5\r
+                }\r
+            };\r
+\r
+            var result = Hoek.applyToDefaults(defaults, obj);\r
+            expect(result.c.e).to.deep.equal([4]);\r
+            expect(result.a).to.equal(1);\r
+            expect(result.b).to.equal(2);\r
+            expect(result.f).to.equal(0);\r
+            expect(result.g).to.deep.equal({ h: 5 });\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#unique', function () {\r
+\r
+        it('should ensure uniqueness within array of objects based on subkey', function (done) {\r
+\r
+            var a = Hoek.unique(dupsArray, 'x');\r
+            expect(a).to.deep.equal(reducedDupsArray);\r
+            done();\r
+        });\r
+\r
+        it('removes duplicated without key', function (done) {\r
+\r
+            expect(Hoek.unique([1, 2, 3, 4, 2, 1, 5])).to.deep.equal([1, 2, 3, 4, 5]);\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#mapToObject', function () {\r
+\r
+        it('should return null on null array', function (done) {\r
+\r
+            var a = Hoek.mapToObject(null);\r
+            expect(a).to.equal(null);\r
+            done();\r
+        });\r
+\r
+        it('should convert basic array to existential object', function (done) {\r
+\r
+            var keys = [1, 2, 3, 4];\r
+            var a = Hoek.mapToObject(keys);\r
+            for (var i in keys) {\r
+                expect(a[keys[i]]).to.equal(true);\r
+            }\r
+            done();\r
+        });\r
+\r
+        it('should convert array of objects to existential object', function (done) {\r
+\r
+            var keys = [{ x: 1 }, { x: 2 }, { x: 3 }];\r
+            var subkey = 'x';\r
+            var a = Hoek.mapToObject(keys, subkey);\r
+            for (var i in keys) {\r
+                expect(a[keys[i][subkey]]).to.equal(true);\r
+            }\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#intersect', function () {\r
+\r
+        it('should return the common objects of two arrays', function (done) {\r
+\r
+            var array1 = [1, 2, 3, 4, 4, 5, 5];\r
+            var array2 = [5, 4, 5, 6, 7];\r
+            var common = Hoek.intersect(array1, array2);\r
+            expect(common.length).to.equal(2);\r
+            done();\r
+        });\r
+\r
+        it('should return just the first common object of two arrays', function (done) {\r
+\r
+            var array1 = [1, 2, 3, 4, 4, 5, 5];\r
+            var array2 = [5, 4, 5, 6, 7];\r
+            var common = Hoek.intersect(array1, array2, true);\r
+            expect(common).to.equal(5);\r
+            done();\r
+        });\r
+\r
+        it('should return an empty array if either input is null', function (done) {\r
+\r
+            expect(Hoek.intersect([1], null).length).to.equal(0);\r
+            expect(Hoek.intersect(null, [1]).length).to.equal(0);\r
+            done();\r
+        });\r
+\r
+        it('should return the common objects of object and array', function (done) {\r
+\r
+            var array1 = [1, 2, 3, 4, 4, 5, 5];\r
+            var array2 = [5, 4, 5, 6, 7];\r
+            var common = Hoek.intersect(Hoek.mapToObject(array1), array2);\r
+            expect(common.length).to.equal(2);\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#matchKeys', function () {\r
+\r
+        it('should match the existing object keys', function (done) {\r
+\r
+            var obj = {\r
+                a: 1,\r
+                b: 2,\r
+                c: 3,\r
+                d: null\r
+            };\r
+\r
+            expect(Hoek.matchKeys(obj, ['b', 'c', 'd', 'e'])).to.deep.equal(['b', 'c', 'd']);\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#flatten', function () {\r
+\r
+        it('should return a flat array', function (done) {\r
+\r
+            var result = Hoek.flatten([1, 2, [3, 4, [5, 6], [7], 8], [9], [10, [11, 12]], 13]);\r
+            expect(result.length).to.equal(13);\r
+            expect(result).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#removeKeys', function () {\r
+\r
+        var objWithHiddenKeys = {\r
+            location: {\r
+                name: 'San Bruno'\r
+            },\r
+            company: {\r
+                name: '@WalmartLabs'\r
+            }\r
+        };\r
+\r
+        it('should delete params with definition\'s hide set to true', function (done) {\r
+\r
+            var a = Hoek.removeKeys(objWithHiddenKeys, ['location']);\r
+            expect(objWithHiddenKeys.location).to.not.exist;\r
+            expect(objWithHiddenKeys.company).to.exist;\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#reach', function () {\r
+\r
+        var obj = {\r
+            a: {\r
+                b: {\r
+                    c: {\r
+                        d: 1,\r
+                        e: 2\r
+                    },\r
+                    f: 'hello'\r
+                },\r
+                g: {\r
+                    h: 3\r
+                }\r
+            },\r
+            i: function () { }\r
+        };\r
+\r
+        it('returns a valid member', function (done) {\r
+\r
+            expect(Hoek.reach(obj, 'a.b.c.d')).to.equal(1);\r
+            done();\r
+        });\r
+\r
+        it('returns null on null object', function (done) {\r
+\r
+            expect(Hoek.reach(null, 'a.b.c.d')).to.not.exist;\r
+            done();\r
+        });\r
+\r
+        it('returns null on missing member', function (done) {\r
+\r
+            expect(Hoek.reach(obj, 'a.b.c.d.x')).to.not.exist;\r
+            done();\r
+        });\r
+\r
+        it('returns null on invalid member', function (done) {\r
+\r
+            expect(Hoek.reach(obj, 'a.b.c.d-.x')).to.not.exist;\r
+            done();\r
+        });\r
+\r
+        it('returns function member', function (done) {\r
+\r
+            expect(typeof Hoek.reach(obj, 'i')).to.equal('function');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#inheritAsync', function () {\r
+\r
+        it('should inherit selected methods and wrap in async call', function (done) {\r
+\r
+            var proto = {\r
+                a: function () {\r
+                    return 'a!';\r
+                },\r
+                b: function () {\r
+                    return 'b!';\r
+                },\r
+                c: function () {\r
+                    throw new Error('c!');\r
+                }\r
+            };\r
+\r
+            var targetFunc = function () { };\r
+            targetFunc.prototype.c = function () {\r
+\r
+                return 'oops';\r
+            };\r
+\r
+            Hoek.inheritAsync(targetFunc, proto, ['a', 'c']);\r
+            var target = new targetFunc();\r
+\r
+            expect(typeof target.a).to.equal('function');\r
+            expect(typeof target.c).to.equal('function');\r
+            expect(target.b).to.not.exist;\r
+\r
+            target.a(function (err, result) {\r
+\r
+                expect(err).to.not.exist;\r
+                expect(result).to.equal('a!');\r
+\r
+                target.c(function (err, result) {\r
+\r
+                    expect(result).to.not.exist;\r
+                    expect(err.message).to.equal('c!');\r
+                    done();\r
+                });\r
+            });\r
+        });\r
+    });\r
+\r
+    describe('#callStack', function () {\r
+\r
+        it('should return the full call stack', function (done) {\r
+\r
+            var stack = Hoek.callStack();\r
+            expect(stack[0][0]).to.contain('index.js');\r
+            expect(stack[0][2]).to.equal(30);\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#displayStack ', function () {\r
+\r
+        it('should return the full call stack for display', function (done) {\r
+\r
+            var stack = Hoek.displayStack();\r
+            expect(stack[0]).to.contain('test/index.js:');\r
+            done();\r
+        });\r
+\r
+        it('should include constructor functions correctly', function (done) {\r
+\r
+            var Something = function (next) {\r
+\r
+                next();\r
+            };\r
+\r
+            var something = new Something(function () {\r
+\r
+                var stack = Hoek.displayStack();\r
+                expect(stack[1]).to.contain('new Something');\r
+                done();\r
+            });\r
+        });\r
+    });\r
+\r
+    describe('#abort', function () {\r
+\r
+        it('should exit process when not in test mode', function (done) {\r
+\r
+            var env = process.env.NODE_ENV;\r
+            var write = process.stdout.write;\r
+            var exit = process.exit;\r
+\r
+            process.env.NODE_ENV = 'nottatest';\r
+            process.stdout.write = function () { };\r
+            process.exit = function (state) {\r
+\r
+                process.exit = exit;\r
+                process.env.NODE_ENV = env;\r
+                process.stdout.write = write;\r
+\r
+                expect(state).to.equal(1);\r
+                done();\r
+            };\r
+\r
+            Hoek.abort('Boom');\r
+        });\r
+\r
+        it('should throw when not in test mode and abortThrow is true', function (done) {\r
+\r
+            var env = process.env.NODE_ENV;\r
+            process.env.NODE_ENV = 'nottatest';\r
+            Hoek.abortThrow = true;\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.abort('my error message');\r
+            };\r
+\r
+            expect(fn).to.throw('my error message');\r
+            Hoek.abortThrow = false;\r
+            process.env.NODE_ENV = env;\r
+\r
+            done();\r
+        });\r
+\r
+\r
+        it('should respect hideStack argument', function (done) {\r
+\r
+            var env = process.env.NODE_ENV;\r
+            var write = process.stdout.write;\r
+            var exit = process.exit;\r
+            var output = '';\r
+\r
+            process.exit = function () { };\r
+            process.env.NODE_ENV = '';\r
+            process.stdout.write = function (message) {\r
+\r
+                output = message;\r
+            };\r
+\r
+            Hoek.abort('my error message', true);\r
+\r
+            process.env.NODE_ENV = env;\r
+            process.stdout.write = write;\r
+            process.exit = exit;\r
+\r
+            expect(output).to.equal('ABORT: my error message\n\t\n');\r
+\r
+            done();\r
+        });\r
+\r
+        it('should default to showing stack', function (done) {\r
+\r
+            var env = process.env.NODE_ENV;\r
+            var write = process.stdout.write;\r
+            var exit = process.exit;\r
+            var output = '';\r
+\r
+            process.exit = function () { };\r
+            process.env.NODE_ENV = '';\r
+            process.stdout.write = function (message) {\r
+\r
+                output = message;\r
+            };\r
+\r
+            Hoek.abort('my error message');\r
+\r
+            process.env.NODE_ENV = env;\r
+            process.stdout.write = write;\r
+            process.exit = exit;\r
+\r
+            expect(output).to.contain('index.js');\r
+\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#assert', function () {\r
+\r
+        it('should throw an Error when using assert in a test', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.assert(false, 'my error message');\r
+            };\r
+\r
+            expect(fn).to.throw('my error message');\r
+            done();\r
+        });\r
+\r
+        it('should throw an Error when using assert in a test with no message', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.assert(false);\r
+            };\r
+\r
+            expect(fn).to.throw('Unknown error');\r
+            done();\r
+        });\r
+\r
+        it('should throw an Error when using assert in a test with multipart message', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.assert(false, 'This', 'is', 'my message');\r
+            };\r
+\r
+            expect(fn).to.throw('This is my message');\r
+            done();\r
+        });\r
+\r
+        it('should throw an Error when using assert in a test with object message', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.assert(false, 'This', 'is', { spinal: 'tap' });\r
+            };\r
+\r
+            expect(fn).to.throw('This is {"spinal":"tap"}');\r
+            done();\r
+        });\r
+\r
+        it('should throw an Error when using assert in a test with error object message', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.assert(false, new Error('This is spinal tap'));\r
+            };\r
+\r
+            expect(fn).to.throw('This is spinal tap');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#loadDirModules', function () {\r
+\r
+        it('should load modules from directory', function (done) {\r
+\r
+            var target = {};\r
+            Hoek.loadDirModules(__dirname + '/modules', ['test2'], target);\r
+            expect(target.Test1.x).to.equal(1);\r
+            expect(target.Test2).to.not.exist;\r
+            expect(target.Test3.z).to.equal(3);\r
+            done();\r
+        });\r
+\r
+        it('should list modules from directory into function', function (done) {\r
+\r
+            var target = {};\r
+            Hoek.loadDirModules(__dirname + '/modules', ['test2'], function (path, name, capName) {\r
+\r
+                target[name] = capName;\r
+            });\r
+\r
+            expect(target.test1).to.equal('Test1');\r
+            expect(target.test2).to.not.exist;\r
+            expect(target.test3).to.equal('Test3');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#rename', function () {\r
+\r
+        it('should rename object key', function (done) {\r
+\r
+            var a = { b: 'c' };\r
+            Hoek.rename(a, 'b', 'x');\r
+            expect(a.b).to.not.exist;\r
+            expect(a.x).to.equal('c');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('Timer', function () {\r
+\r
+        it('should return time elapsed', function (done) {\r
+\r
+            var timer = new Hoek.Timer();\r
+            setTimeout(function () {\r
+\r
+                expect(timer.elapsed()).to.be.above(9);\r
+                done();\r
+            }, 12);\r
+        });\r
+    });\r
+\r
+    describe('#loadPackage', function () {\r
+\r
+        it('should', function (done) {\r
+\r
+            var pack = Hoek.loadPackage();\r
+            expect(pack.name).to.equal('hoek');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#escapeRegex', function () {\r
+\r
+        it('should escape all special regular expression characters', function (done) {\r
+\r
+            var a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,');\r
+            expect(a).to.equal('4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`"\\(>\\)\\[<\\]d\\{\\}s\\,');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#toss', function () {\r
+\r
+        it('should call callback with new error', function (done) {\r
+\r
+            var callback = function (err) {\r
+\r
+                expect(err).to.exist;\r
+                expect(err.message).to.equal('bug');\r
+                done();\r
+            };\r
+\r
+            Hoek.toss(true, 'feature', callback);\r
+            Hoek.toss(false, 'bug', callback);\r
+        });\r
+\r
+        it('should call callback with new error and no message', function (done) {\r
+\r
+            Hoek.toss(false, function (err) {\r
+\r
+                expect(err).to.exist;\r
+                expect(err.message).to.equal('');\r
+                done();\r
+            });\r
+        });\r
+\r
+        it('should call callback with error condition', function (done) {\r
+\r
+            Hoek.toss(new Error('boom'), function (err) {\r
+\r
+                expect(err).to.exist;\r
+                expect(err.message).to.equal('boom');\r
+                done();\r
+            });\r
+        });\r
+\r
+        it('should call callback with new error using message with error condition', function (done) {\r
+\r
+            Hoek.toss(new Error('ka'), 'boom', function (err) {\r
+\r
+                expect(err).to.exist;\r
+                expect(err.message).to.equal('boom');\r
+                done();\r
+            });\r
+        });\r
+\r
+        it('should call callback with new error using passed error with error condition', function (done) {\r
+\r
+            Hoek.toss(new Error('ka'), new Error('boom'), function (err) {\r
+\r
+                expect(err).to.exist;\r
+                expect(err.message).to.equal('boom');\r
+                done();\r
+            });\r
+        });\r
+    });\r
+\r
+    describe('Base64Url', function () {\r
+\r
+        var base64str = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn-AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq-wsbKztLW2t7i5uru8vb6_wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t_g4eLj5OXm5-jp6uvs7e7v8PHy8_T19vf4-fr7_P3-_w';\r
+        var str = unescape('%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF');\r
+\r
+        describe('#base64urlEncode', function () {\r
+\r
+            it('should base64 URL-safe a string', function (done) {\r
+\r
+                expect(Hoek.base64urlEncode(str)).to.equal(base64str);\r
+                done();\r
+            });\r
+        });\r
+\r
+        describe('#base64urlDecode', function () {\r
+\r
+            it('should un-base64 URL-safe a string', function (done) {\r
+\r
+                expect(Hoek.base64urlDecode(base64str)).to.equal(str);\r
+                done();\r
+            });\r
+\r
+            it('should return error on undefined input', function (done) {\r
+\r
+                expect(Hoek.base64urlDecode().message).to.exist;\r
+                done();\r
+            });\r
+\r
+            it('should return error on invalid input', function (done) {\r
+\r
+                expect(Hoek.base64urlDecode('*').message).to.exist;\r
+                done();\r
+            });\r
+        });\r
+    });\r
+\r
+    describe('#escapeHeaderAttribute', function () {\r
+\r
+        it('should not alter ascii values', function (done) {\r
+\r
+            var a = Hoek.escapeHeaderAttribute('My Value');\r
+            expect(a).to.equal('My Value');\r
+            done();\r
+        });\r
+\r
+        it('should escape all special HTTP header attribute characters', function (done) {\r
+\r
+            var a = Hoek.escapeHeaderAttribute('I said go!!!#"' + String.fromCharCode(92));\r
+            expect(a).to.equal('I said go!!!#\\"\\\\');\r
+            done();\r
+        });\r
+\r
+        it('should throw on large unicode characters', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.escapeHeaderAttribute('this is a test' + String.fromCharCode(500) + String.fromCharCode(300));\r
+            };\r
+\r
+            expect(fn).to.throw(Error);\r
+            done();\r
+        });\r
+\r
+        it('should throw on CRLF to prevent response splitting', function (done) {\r
+\r
+            var fn = function () {\r
+\r
+                Hoek.escapeHeaderAttribute('this is a test\r\n');\r
+            };\r
+\r
+            expect(fn).to.throw(Error);\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#escapeHtml', function () {\r
+\r
+        it('should escape all special HTML characters', function (done) {\r
+\r
+            var a = Hoek.escapeHtml('&<>"\'`');\r
+            expect(a).to.equal('&amp;&lt;&gt;&quot;&#x27;&#x60;');\r
+            done();\r
+        });\r
+\r
+        it('should return empty string on falsy input', function (done) {\r
+\r
+            var a = Hoek.escapeHtml('');\r
+            expect(a).to.equal('');\r
+            done();\r
+        });\r
+\r
+        it('should return unchanged string on no reserved input', function (done) {\r
+\r
+            var a = Hoek.escapeHtml('abc');\r
+            expect(a).to.equal('abc');\r
+            done();\r
+        });\r
+    });\r
+\r
+    describe('#printEvent', function () {\r
+\r
+        it('outputs event as string', function (done) {\r
+\r
+            var event = {\r
+                timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),\r
+                tags: ['a', 'b', 'c'],\r
+                data: { some: 'data' }\r
+            };\r
+\r
+            Hoek.consoleFunc = function (string) {\r
+\r
+                Hoek.consoleFunc = console.log;\r
+                expect(string).to.equal('130201/063045.123, a, {"some":"data"}');\r
+                done();\r
+            };\r
+\r
+            Hoek.printEvent(event);\r
+        });\r
+\r
+        it('outputs JSON error', function (done) {\r
+\r
+            var event = {\r
+                timestamp: (new Date(2013, 1, 1, 6, 30, 45, 123)).getTime(),\r
+                tags: ['a', 'b', 'c'],\r
+                data: { some: 'data' }\r
+            };\r
+\r
+            event.data.a = event.data;\r
+\r
+            Hoek.consoleFunc = function (string) {\r
+\r
+                Hoek.consoleFunc = console.log;\r
+                expect(string).to.equal('130201/063045.123, a, JSON Error: Converting circular structure to JSON');\r
+                done();\r
+            };\r
+\r
+            Hoek.printEvent(event);\r
+        });\r
+    });\r
+\r
+    describe('#nextTick', function () {\r
+\r
+        it('calls the provided callback on nextTick', function (done) {\r
+\r
+            var a = 0;\r
+\r
+            var inc = function (step, next) {\r
+\r
+                a += step;\r
+                next();\r
+            };\r
+\r
+            var ticked = Hoek.nextTick(inc);\r
+\r
+            ticked(5, function () {\r
+\r
+                expect(a).to.equal(6);\r
+                done();\r
+            });\r
+\r
+            expect(a).to.equal(0);\r
+            inc(1, function () {\r
+\r
+                expect(a).to.equal(1);\r
+            });\r
+        });\r
+    });\r
+});\r
+\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js
new file mode 100755 (executable)
index 0000000..3f41e60
--- /dev/null
@@ -0,0 +1 @@
+exports.x = 1;\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js
new file mode 100755 (executable)
index 0000000..38556b2
--- /dev/null
@@ -0,0 +1 @@
+exports.y = 2;\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js
new file mode 100755 (executable)
index 0000000..436b860
--- /dev/null
@@ -0,0 +1 @@
+exports.z = 3;\r
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE
new file mode 100755 (executable)
index 0000000..e699a7b
--- /dev/null
@@ -0,0 +1,24 @@
+Copyright (c) 2012-2013, Eran Hammer.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Eran Hammer nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL ERAN HAMMER BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile
new file mode 100755 (executable)
index 0000000..9e7138c
--- /dev/null
@@ -0,0 +1,11 @@
+test:
+       @./node_modules/.bin/lab
+test-cov: 
+       @./node_modules/.bin/lab -r threshold -t 100
+test-cov-html:
+       @./node_modules/.bin/lab -r html -o coverage.html
+complexity:
+       @./node_modules/.bin/cr -o complexity.md -f markdown lib
+
+.PHONY: test test-cov test-cov-html complexity
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/README.md
new file mode 100755 (executable)
index 0000000..98a6e02
--- /dev/null
@@ -0,0 +1,68 @@
+# sntp
+
+An SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time
+along with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset
+to the local time.
+
+[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)
+
+# Usage
+
+```javascript
+var Sntp = require('sntp');
+
+// All options are optional
+
+var options = {
+    host: 'nist1-sj.ustiming.org',  // Defaults to pool.ntp.org
+    port: 123,                      // Defaults to 123 (NTP)
+    resolveReference: true,         // Default to false (not resolving)
+    timeout: 1000                   // Defaults to zero (no timeout)
+};
+
+// Request server time
+
+Sntp.time(options, function (err, time) {
+
+    if (err) {
+        console.log('Failed: ' + err.message);
+        process.exit(1);
+    }
+
+    console.log('Local clock is off by: ' + time.t + ' milliseconds');
+    process.exit(0);
+});
+```
+
+If an application needs to maintain continuous time synchronization, the module provides a stateful method for
+querying the current offset only when the last one is too old (defaults to daily).
+
+```javascript
+// Request offset once
+
+Sntp.offset(function (err, offset) {
+
+    console.log(offset);                    // New (served fresh)
+
+    // Request offset again
+
+    Sntp.offset(function (err, offset) {
+
+        console.log(offset);                // Identical (served from cache)
+    });
+});
+```
+
+To set a background offset refresh, start the interval and use the provided now() method. If for any reason the
+client fails to obtain an up-to-date offset, the current system clock is used.
+
+```javascript
+var before = Sntp.now();                    // System time without offset
+
+Sntp.start(function () {
+
+    var now = Sntp.now();                   // With offset
+    Sntp.stop();
+});
+```
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js
new file mode 100755 (executable)
index 0000000..0303f6d
--- /dev/null
@@ -0,0 +1,16 @@
+var Sntp = require('../lib');
+
+// Request offset once
+
+Sntp.offset(function (err, offset) {
+
+    console.log(offset);                    // New (served fresh)
+
+    // Request offset again
+
+    Sntp.offset(function (err, offset) {
+
+        console.log(offset);                // Identical (served from cache)
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js
new file mode 100755 (executable)
index 0000000..bd70d0e
--- /dev/null
@@ -0,0 +1,25 @@
+var Sntp = require('../lib');
+
+// All options are optional
+
+var options = {
+    host: 'nist1-sj.ustiming.org',  // Defaults to pool.ntp.org
+    port: 123,                      // Defaults to 123 (NTP)
+    resolveReference: true,         // Default to false (not resolving)
+    timeout: 1000                   // Defaults to zero (no timeout)
+};
+
+// Request server time
+
+Sntp.time(options, function (err, time) {
+
+    if (err) {
+        console.log('Failed: ' + err.message);
+        process.exit(1);
+    }
+
+    console.log(time);
+    console.log('Local clock is off by: ' + time.t + ' milliseconds');
+    process.exit(0);
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/index.js
new file mode 100755 (executable)
index 0000000..4cc88b3
--- /dev/null
@@ -0,0 +1 @@
+module.exports = require('./lib');
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js
new file mode 100755 (executable)
index 0000000..e492cd9
--- /dev/null
@@ -0,0 +1,409 @@
+// Load modules
+
+var Dgram = require('dgram');
+var Dns = require('dns');
+var Hoek = require('hoek');
+
+
+// Declare internals
+
+var internals = {};
+
+
+exports.time = function (options, callback) {
+
+    if (arguments.length !== 2) {
+        callback = arguments[0];
+        options = {};
+    }
+
+    var settings = Hoek.clone(options);
+    settings.host = settings.host || 'pool.ntp.org';
+    settings.port = settings.port || 123;
+    settings.resolveReference = settings.resolveReference || false;
+
+    // Declare variables used by callback
+
+    var timeoutId = 0;
+    var sent = 0;
+
+    // Ensure callback is only called once
+
+    var isFinished = false;
+    var finish = function (err, result) {
+
+        if (timeoutId) {
+            clearTimeout(timeoutId);
+            timeoutId = 0;
+        }
+
+        if (!isFinished) {
+            isFinished = true;
+            socket.removeAllListeners();
+            socket.close();
+            return callback(err, result);
+        }
+    };
+
+    // Create UDP socket
+
+    var socket = Dgram.createSocket('udp4');
+
+    socket.once('error', function (err) {
+
+        return finish(err);
+    });
+
+    // Listen to incoming messages
+
+    socket.on('message', function (buffer, rinfo) {
+
+        var received = Date.now();
+
+        var message = new internals.NtpMessage(buffer);
+        if (!message.isValid) {
+            return finish(new Error('Invalid server response'), message);
+        }
+
+        if (message.originateTimestamp !== sent) {
+            return finish(new Error('Wrong originate timestamp'), message);
+        }
+
+        // Timestamp Name          ID   When Generated
+        // ------------------------------------------------------------
+        // Originate Timestamp     T1   time request sent by client
+        // Receive Timestamp       T2   time request received by server
+        // Transmit Timestamp      T3   time reply sent by server
+        // Destination Timestamp   T4   time reply received by client
+        //
+        // The roundtrip delay d and system clock offset t are defined as:
+        //
+        // d = (T4 - T1) - (T3 - T2)     t = ((T2 - T1) + (T3 - T4)) / 2
+
+        var T1 = message.originateTimestamp;
+        var T2 = message.receiveTimestamp;
+        var T3 = message.transmitTimestamp;
+        var T4 = received;
+
+        message.d = (T4 - T1) - (T3 - T2);
+        message.t = ((T2 - T1) + (T3 - T4)) / 2;
+        message.receivedLocally = received;
+
+        if (!settings.resolveReference ||
+            message.stratum !== 'secondary') {
+
+            return finish(null, message);
+        }
+
+        // Resolve reference IP address
+
+        Dns.reverse(message.referenceId, function (err, domains) {
+
+            if (!err) {
+                message.referenceHost = domains[0];
+            }
+
+            return finish(null, message);
+        });
+    });
+
+    // Set timeout
+
+    if (settings.timeout) {
+        timeoutId = setTimeout(function () {
+
+            timeoutId = 0;
+            return finish(new Error('Timeout'));
+        }, settings.timeout);
+    }
+
+    // Construct NTP message
+
+    var message = new Buffer(48);
+    for (var i = 0; i < 48; i++) {                      // Zero message
+        message[i] = 0;
+    }
+
+    message[0] = (0 << 6) + (4 << 3) + (3 << 0)         // Set version number to 4 and Mode to 3 (client)
+    sent = Date.now();
+    internals.fromMsecs(sent, message, 40);               // Set transmit timestamp (returns as originate)
+
+    // Send NTP request
+
+    socket.send(message, 0, message.length, settings.port, settings.host, function (err, bytes) {
+
+        if (err ||
+            bytes !== 48) {
+
+            return finish(err || new Error('Could not send entire message'));
+        }
+    });
+};
+
+
+internals.NtpMessage = function (buffer) {
+
+    this.isValid = false;
+
+    // Validate
+
+    if (buffer.length !== 48) {
+        return;
+    }
+
+    // Leap indicator
+
+    var li = (buffer[0] >> 6);
+    switch (li) {
+        case 0: this.leapIndicator = 'no-warning'; break;
+        case 1: this.leapIndicator = 'last-minute-61'; break;
+        case 2: this.leapIndicator = 'last-minute-59'; break;
+        case 3: this.leapIndicator = 'alarm'; break;
+    }
+
+    // Version
+
+    var vn = ((buffer[0] & 0x38) >> 3);
+    this.version = vn;
+
+    // Mode
+
+    var mode = (buffer[0] & 0x7);
+    switch (mode) {
+        case 1: this.mode = 'symmetric-active'; break;
+        case 2: this.mode = 'symmetric-passive'; break;
+        case 3: this.mode = 'client'; break;
+        case 4: this.mode = 'server'; break;
+        case 5: this.mode = 'broadcast'; break;
+        case 0:
+        case 6:
+        case 7: this.mode = 'reserved'; break;
+    }
+
+    // Stratum
+
+    var stratum = buffer[1];
+    if (stratum === 0) {
+        this.stratum = 'death';
+    }
+    else if (stratum === 1) {
+        this.stratum = 'primary';
+    }
+    else if (stratum <= 15) {
+        this.stratum = 'secondary';
+    }
+    else {
+        this.stratum = 'reserved';
+    }
+
+    // Poll interval (msec)
+
+    this.pollInterval = Math.round(Math.pow(2, buffer[2])) * 1000;
+
+    // Precision (msecs)
+
+    this.precision = Math.pow(2, buffer[3]) * 1000;
+
+    // Root delay (msecs)
+
+    var rootDelay = 256 * (256 * (256 * buffer[4] + buffer[5]) + buffer[6]) + buffer[7];
+    this.rootDelay = 1000 * (rootDelay / 0x10000);
+
+    // Root dispersion (msecs)
+
+    this.rootDispersion = ((buffer[8] << 8) + buffer[9] + ((buffer[10] << 8) + buffer[11]) / Math.pow(2, 16)) * 1000;
+
+    // Reference identifier
+
+    this.referenceId = '';
+    switch (this.stratum) {
+        case 'death':
+        case 'primary':
+            this.referenceId = String.fromCharCode(buffer[12]) + String.fromCharCode(buffer[13]) + String.fromCharCode(buffer[14]) + String.fromCharCode(buffer[15]);
+            break;
+        case 'secondary':
+            this.referenceId = '' + buffer[12] + '.' + buffer[13] + '.' + buffer[14] + '.' + buffer[15];
+            break;
+    }
+
+    // Reference timestamp
+
+    this.referenceTimestamp = internals.toMsecs(buffer, 16);
+
+    // Originate timestamp
+
+    this.originateTimestamp = internals.toMsecs(buffer, 24);
+
+    // Receive timestamp
+
+    this.receiveTimestamp = internals.toMsecs(buffer, 32);
+
+    // Transmit timestamp
+
+    this.transmitTimestamp = internals.toMsecs(buffer, 40);
+
+    // Validate
+
+    if (this.version === 4 &&
+        this.stratum !== 'reserved' &&
+        this.mode === 'server' &&
+        this.originateTimestamp &&
+        this.receiveTimestamp &&
+        this.transmitTimestamp) {
+
+        this.isValid = true;
+    }
+
+    return this;
+};
+
+
+internals.toMsecs = function (buffer, offset) {
+
+    var seconds = 0;
+    var fraction = 0;
+
+    for (var i = 0; i < 4; ++i) {
+        seconds = (seconds * 256) + buffer[offset + i];
+    }
+
+    for (i = 4; i < 8; ++i) {
+        fraction = (fraction * 256) + buffer[offset + i];
+    }
+
+    return ((seconds - 2208988800 + (fraction / Math.pow(2, 32))) * 1000);
+};
+
+
+internals.fromMsecs = function (ts, buffer, offset) {
+
+    var seconds = Math.floor(ts / 1000) + 2208988800;
+    var fraction = Math.round((ts % 1000) / 1000 * Math.pow(2, 32));
+
+    buffer[offset + 0] = (seconds & 0xFF000000) >> 24;
+    buffer[offset + 1] = (seconds & 0x00FF0000) >> 16;
+    buffer[offset + 2] = (seconds & 0x0000FF00) >> 8;
+    buffer[offset + 3] = (seconds & 0x000000FF);
+
+    buffer[offset + 4] = (fraction & 0xFF000000) >> 24;
+    buffer[offset + 5] = (fraction & 0x00FF0000) >> 16;
+    buffer[offset + 6] = (fraction & 0x0000FF00) >> 8;
+    buffer[offset + 7] = (fraction & 0x000000FF);
+};
+
+
+// Offset singleton
+
+internals.last = {
+    offset: 0,
+    expires: 0,
+    host: '',
+    port: 0
+};
+
+
+exports.offset = function (options, callback) {
+
+    if (arguments.length !== 2) {
+        callback = arguments[0];
+        options = {};
+    }
+
+    var now = Date.now();
+    var clockSyncRefresh = options.clockSyncRefresh || 24 * 60 * 60 * 1000;                    // Daily
+
+    if (internals.last.offset &&
+        internals.last.host === options.host &&
+        internals.last.port === options.port &&
+        now < internals.last.expires) {
+
+        process.nextTick(function () {
+                
+            callback(null, internals.last.offset);
+        });
+
+        return;
+    }
+
+    exports.time(options, function (err, time) {
+
+        if (err) {
+            return callback(err, 0);
+        }
+
+        internals.last = {
+            offset: Math.round(time.t),
+            expires: now + clockSyncRefresh,
+            host: options.host,
+            port: options.port
+        };
+
+        return callback(null, internals.last.offset);
+    });
+};
+
+
+// Now singleton
+
+internals.now = {
+    intervalId: 0
+};
+
+
+exports.start = function (options, callback) {
+
+    if (arguments.length !== 2) {
+        callback = arguments[0];
+        options = {};
+    }
+
+    if (internals.now.intervalId) {
+        process.nextTick(function () {
+            
+            callback();
+        });
+        
+        return;
+    }
+
+    exports.offset(options, function (err, offset) {
+
+        internals.now.intervalId = setInterval(function () {
+
+            exports.offset(options, function () { });
+        }, options.clockSyncRefresh || 24 * 60 * 60 * 1000);                                // Daily
+
+        return callback();
+    });
+};
+
+
+exports.stop = function () {
+
+    if (!internals.now.intervalId) {
+        return;
+    }
+
+    clearInterval(internals.now.intervalId);
+    internals.now.intervalId = 0;
+};
+
+
+exports.isLive = function () {
+
+    return !!internals.now.intervalId;
+};
+
+
+exports.now = function () {
+
+    var now = Date.now();
+    if (!exports.isLive() ||
+        now >= internals.last.expires) {
+
+        return now;
+    }
+
+    return now + internals.last.offset;
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/package.json
new file mode 100755 (executable)
index 0000000..c96e848
--- /dev/null
@@ -0,0 +1,65 @@
+{
+  "name": "sntp",
+  "description": "SNTP Client",
+  "version": "0.2.4",
+  "author": {
+    "name": "Eran Hammer",
+    "email": "eran@hueniverse.com",
+    "url": "http://hueniverse.com"
+  },
+  "contributors": [],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/hueniverse/sntp"
+  },
+  "main": "index",
+  "keywords": [
+    "sntp",
+    "ntp",
+    "time"
+  ],
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "dependencies": {
+    "hoek": "0.9.x"
+  },
+  "devDependencies": {
+    "lab": "0.1.x",
+    "complexity-report": "0.x.x"
+  },
+  "scripts": {
+    "test": "make test-cov"
+  },
+  "licenses": [
+    {
+      "type": "BSD",
+      "url": "http://github.com/hueniverse/sntp/raw/master/LICENSE"
+    }
+  ],
+  "_id": "sntp@0.2.4",
+  "dist": {
+    "shasum": "fb885f18b0f3aad189f824862536bceeec750900",
+    "tarball": "http://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz"
+  },
+  "_from": "sntp@0.2.x",
+  "_npmVersion": "1.2.18",
+  "_npmUser": {
+    "name": "hueniverse",
+    "email": "eran@hueniverse.com"
+  },
+  "maintainers": [
+    {
+      "name": "hueniverse",
+      "email": "eran@hueniverse.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "fb885f18b0f3aad189f824862536bceeec750900",
+  "_resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz",
+  "bugs": {
+    "url": "https://github.com/hueniverse/sntp/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/hueniverse/sntp"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js
new file mode 100755 (executable)
index 0000000..38a5534
--- /dev/null
@@ -0,0 +1,359 @@
+// Load modules
+
+var Dgram = require('dgram');
+var Lab = require('lab');
+var Sntp = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('SNTP', function () {
+
+    describe('#time', function () {
+
+        it('returns consistent result over multiple tries', function (done) {
+
+            Sntp.time(function (err, time) {
+
+                expect(err).to.not.exist;
+                expect(time).to.exist;
+                var t1 = time.t;
+
+                Sntp.time(function (err, time) {
+
+                    expect(err).to.not.exist;
+                    expect(time).to.exist;
+                    var t2 = time.t;
+                    expect(Math.abs(t1 - t2)).is.below(200);
+                    done();
+                });
+            });
+        });
+
+        it('resolves reference IP', function (done) {
+
+            Sntp.time({ host: 'ntp.exnet.com', resolveReference: true }, function (err, time) {
+
+                expect(err).to.not.exist;
+                expect(time).to.exist;
+                expect(time.referenceHost).to.exist;
+                done();
+            });
+        });
+
+        it('times out on no response', function (done) {
+
+            Sntp.time({ port: 124, timeout: 100 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time).to.not.exist;
+                expect(err.message).to.equal('Timeout');
+                done();
+            });
+        });
+
+        it('errors on error event', function (done) {
+
+            var orig = Dgram.createSocket;
+            Dgram.createSocket = function (type) {
+
+                Dgram.createSocket = orig;
+                var socket = Dgram.createSocket(type);
+                process.nextTick(function () { socket.emit('error', new Error('Fake')) });
+                return socket;
+            };
+
+            Sntp.time(function (err, time) {
+
+                expect(err).to.exist;
+                expect(time).to.not.exist;
+                expect(err.message).to.equal('Fake');
+                done();
+            });
+        });
+
+        it('times out on invalid host', function (done) {
+
+            Sntp.time({ host: 'error', timeout: 10000 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time).to.not.exist;
+                expect(err.message).to.equal('getaddrinfo ENOTFOUND');
+                done();
+            });
+        });
+
+        it('fails on bad response buffer size', function (done) {
+
+            var server = Dgram.createSocket('udp4');
+            server.on('message', function (message, remote) {
+                var message = new Buffer(10);
+                server.send(message, 0, message.length, remote.port, remote.address, function (err, bytes) {
+
+                    server.close();
+                });
+            });
+
+            server.bind(49123);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Invalid server response');
+                done();
+            });
+        });
+
+        var messup = function (bytes) {
+
+            var server = Dgram.createSocket('udp4');
+            server.on('message', function (message, remote) {
+
+                var message = new Buffer([
+                    0x24, 0x01, 0x00, 0xe3,
+                    0x00, 0x00, 0x00, 0x00,
+                    0x00, 0x00, 0x00, 0x00,
+                    0x41, 0x43, 0x54, 0x53,
+                    0xd4, 0xa8, 0x2d, 0xc7,
+                    0x1c, 0x5d, 0x49, 0x1b,
+                    0xd4, 0xa8, 0x2d, 0xe6,
+                    0x67, 0xef, 0x9d, 0xb2,
+                    0xd4, 0xa8, 0x2d, 0xe6,
+                    0x71, 0xed, 0xb5, 0xfb,
+                    0xd4, 0xa8, 0x2d, 0xe6,
+                    0x71, 0xee, 0x6c, 0xc5
+                ]);
+
+                for (var i = 0, il = bytes.length; i < il; ++i) {
+                    message[bytes[i][0]] = bytes[i][1];
+                }
+
+                server.send(message, 0, message.length, remote.port, remote.address, function (err, bytes) {
+
+                    server.close();
+                });
+            });
+
+            server.bind(49123);
+        };
+
+        it('fails on bad version', function (done) {
+
+            messup([[0, (0 << 6) + (3 << 3) + (4 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time.version).to.equal(3);
+                expect(err.message).to.equal('Invalid server response');
+                done();
+            });
+        });
+
+        it('fails on bad originate timestamp and alarm li', function (done) {
+
+            messup([[0, (3 << 6) + (4 << 3) + (4 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Wrong originate timestamp');
+                expect(time.leapIndicator).to.equal('alarm');
+                done();
+            });
+        });
+
+        it('returns time with death stratum and last61 li', function (done) {
+
+            messup([[0, (1 << 6) + (4 << 3) + (4 << 0)], [1, 0]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(time.stratum).to.equal('death');
+                expect(time.leapIndicator).to.equal('last-minute-61');
+                done();
+            });
+        });
+
+        it('returns time with reserved stratum and last59 li', function (done) {
+
+            messup([[0, (2 << 6) + (4 << 3) + (4 << 0)], [1, 0x1f]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(time.stratum).to.equal('reserved');
+                expect(time.leapIndicator).to.equal('last-minute-59');
+                done();
+            });
+        });
+
+        it('fails on bad mode (symmetric-active)', function (done) {
+
+            messup([[0, (0 << 6) + (4 << 3) + (1 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time.mode).to.equal('symmetric-active');
+                done();
+            });
+        });
+
+        it('fails on bad mode (symmetric-passive)', function (done) {
+
+            messup([[0, (0 << 6) + (4 << 3) + (2 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time.mode).to.equal('symmetric-passive');
+                done();
+            });
+        });
+
+        it('fails on bad mode (client)', function (done) {
+
+            messup([[0, (0 << 6) + (4 << 3) + (3 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time.mode).to.equal('client');
+                done();
+            });
+        });
+
+        it('fails on bad mode (broadcast)', function (done) {
+
+            messup([[0, (0 << 6) + (4 << 3) + (5 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time.mode).to.equal('broadcast');
+                done();
+            });
+        });
+
+        it('fails on bad mode (reserved)', function (done) {
+
+            messup([[0, (0 << 6) + (4 << 3) + (6 << 0)]]);
+
+            Sntp.time({ host: 'localhost', port: 49123 }, function (err, time) {
+
+                expect(err).to.exist;
+                expect(time.mode).to.equal('reserved');
+                done();
+            });
+        });
+    });
+
+    describe('#offset', function () {
+
+        it('gets the current offset', function (done) {
+
+            Sntp.offset(function (err, offset) {
+
+                expect(err).to.not.exist;
+                expect(offset).to.not.equal(0);
+                done();
+            });
+        });
+
+        it('gets the current offset from cache', function (done) {
+
+            Sntp.offset(function (err, offset) {
+
+                expect(err).to.not.exist;
+                expect(offset).to.not.equal(0);
+                var offset1 = offset;
+                Sntp.offset({}, function (err, offset) {
+
+                    expect(err).to.not.exist;
+                    expect(offset).to.equal(offset1);
+                    done();
+                });
+            });
+        });
+
+        it('fails getting the current offset on invalid server', function (done) {
+
+            Sntp.offset({ host: 'error' }, function (err, offset) {
+
+                expect(err).to.exist;
+                expect(offset).to.equal(0);
+                done();
+            });
+        });
+    });
+
+    describe('#now', function () {
+
+        it('starts auto-sync, gets now, then stops', function (done) {
+
+            Sntp.stop();
+
+            var before = Sntp.now();
+            expect(before).to.equal(Date.now());
+
+            Sntp.start(function () {
+
+                var now = Sntp.now();
+                expect(now).to.not.equal(Date.now());
+                Sntp.stop();
+
+                done();
+            });
+        });
+
+        it('starts twice', function (done) {
+
+            Sntp.start(function () {
+
+                Sntp.start(function () {
+
+                    var now = Sntp.now();
+                    expect(now).to.not.equal(Date.now());
+                    Sntp.stop();
+
+                    done();
+                });
+            });
+        });
+
+        it('starts auto-sync, gets now, waits, gets again after timeout', function (done) {
+
+            Sntp.stop();
+
+            var before = Sntp.now();
+            expect(before).to.equal(Date.now());
+
+            Sntp.start({ clockSyncRefresh: 100 }, function () {
+
+                var now = Sntp.now();
+                expect(now).to.not.equal(Date.now());
+                expect(now).to.equal(Sntp.now());
+
+                setTimeout(function () {
+
+                    expect(Sntp.now()).to.not.equal(now);
+                    Sntp.stop();
+                    done();
+                }, 110);
+            });
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/package.json
new file mode 100755 (executable)
index 0000000..1355ece
--- /dev/null
@@ -0,0 +1,70 @@
+{
+  "name": "hawk",
+  "description": "HTTP Hawk Authentication Scheme",
+  "version": "1.0.0",
+  "author": {
+    "name": "Eran Hammer",
+    "email": "eran@hueniverse.com",
+    "url": "http://hueniverse.com"
+  },
+  "contributors": [],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/hueniverse/hawk"
+  },
+  "main": "index",
+  "keywords": [
+    "http",
+    "authentication",
+    "scheme",
+    "hawk"
+  ],
+  "engines": {
+    "node": ">=0.8.0"
+  },
+  "dependencies": {
+    "hoek": "0.9.x",
+    "boom": "0.4.x",
+    "cryptiles": "0.2.x",
+    "sntp": "0.2.x"
+  },
+  "devDependencies": {
+    "lab": "0.1.x",
+    "complexity-report": "0.x.x",
+    "localStorage": "1.0.x"
+  },
+  "scripts": {
+    "test": "make test-cov"
+  },
+  "licenses": [
+    {
+      "type": "BSD",
+      "url": "http://github.com/hueniverse/hawk/raw/master/LICENSE"
+    }
+  ],
+  "bugs": {
+    "url": "https://github.com/hueniverse/hawk/issues"
+  },
+  "_id": "hawk@1.0.0",
+  "dist": {
+    "shasum": "b90bb169807285411da7ffcb8dd2598502d3b52d",
+    "tarball": "http://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz"
+  },
+  "_from": "hawk@~1.0.0",
+  "_npmVersion": "1.2.32",
+  "_npmUser": {
+    "name": "hueniverse",
+    "email": "eran@hueniverse.com"
+  },
+  "maintainers": [
+    {
+      "name": "hueniverse",
+      "email": "eran@hueniverse.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "b90bb169807285411da7ffcb8dd2598502d3b52d",
+  "_resolved": "https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/hueniverse/hawk"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/browser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/browser.js
new file mode 100755 (executable)
index 0000000..b25a10f
--- /dev/null
@@ -0,0 +1,771 @@
+// Load modules
+
+var Lab = require('lab');
+var Hoek = require('hoek');
+var Hawk = require('../lib');
+var Browser = require('../lib/browser');
+var LocalStorage = require('localStorage');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Browser', function () {
+
+    var credentialsFunc = function (id, callback) {
+
+        var credentials = {
+            id: id,
+            key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+            algorithm: (id === '1' ? 'sha1' : 'sha256'),
+            user: 'steve'
+        };
+
+        return callback(null, credentials);
+    };
+
+    it('should generate a header then successfully parse it (configuration)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+            expect(req.authorization).to.exist;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (node request)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+                expect(res.headers['server-authorization']).to.exist;
+
+                expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (no server header options)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+                expect(res.headers['server-authorization']).to.exist;
+
+                expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (no server header)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header with stale ts and successfully authenticate on second call', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            Browser.utils.setNtpOffset(60 * 60 * 1000);
+            var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
+            req.authorization = header.field;
+            expect(req.authorization).to.exist;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Stale timestamp');
+
+                var res = {
+                    headers: {
+                        'www-authenticate': err.response.headers['WWW-Authenticate']
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
+                expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
+                expect(Browser.utils.getNtpOffset()).to.equal(0);
+
+                req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+                expect(req.authorization).to.exist;
+
+                Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    expect(artifacts.ext).to.equal('some-app-data');
+                    done();
+                });
+            });
+        });
+    });
+
+    it('should generate a header with stale ts and successfully authenticate on second call (manual localStorage)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+            Browser.utils.setStorage(LocalStorage)
+
+            Browser.utils.setNtpOffset(60 * 60 * 1000);
+            var header = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' });
+            req.authorization = header.field;
+            expect(req.authorization).to.exist;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Stale timestamp');
+
+                var res = {
+                    headers: {
+                        'www-authenticate': err.response.headers['WWW-Authenticate']
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                expect(parseInt(LocalStorage.getItem('hawk_ntp_offset'))).to.equal(60 * 60 * 1000);
+                expect(Browser.utils.getNtpOffset()).to.equal(60 * 60 * 1000);
+                expect(Browser.client.authenticate(res, credentials, header.artifacts)).to.equal(true);
+                expect(Browser.utils.getNtpOffset()).to.equal(0);
+                expect(parseInt(LocalStorage.getItem('hawk_ntp_offset'))).to.equal(0);
+
+                req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+                expect(req.authorization).to.exist;
+
+                Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    expect(artifacts.ext).to.equal('some-app-data');
+                    done();
+                });
+            });
+        });
+    });
+
+    it('should generate a header then fails to parse it (missing server header hash)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+                expect(res.headers['server-authorization']).to.exist;
+
+                expect(Browser.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (with hash)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it then validate payload', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true;
+                expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false;
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (app)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(artifacts.app).to.equal('asd23ased');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (app, dlg)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(artifacts.app).to.equal('asd23ased');
+                expect(artifacts.dlg).to.equal('23434szr3q4d');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then fail authentication due to bad hash', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials, artifacts) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Bad payload hash');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header for one resource then fail to authenticate another', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Browser.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+            req.url = '/something/else';
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.exist;
+                expect(credentials).to.exist;
+                done();
+            });
+        });
+    });
+
+    describe('client', function () {
+
+        describe('#header', function () {
+
+            it('should return a valid authorization header (sha1)', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'sha1'
+                };
+
+                var header = Browser.client.header('http://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about' }).field;
+                expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="bsvY3IfUllw6V5rvk4tStEvpBhE=", ext="Bazinga!", mac="qbf1ZPG/r/e06F4ht+T77LXi5vw="');
+                done();
+            });
+
+            it('should return a valid authorization header (sha256)', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'sha256'
+                };
+
+                var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
+                expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", ext="Bazinga!", mac="q1CwFoSHzPZSkbIvl0oYlD+91rBUEvFk763nMjMndj8="');
+                done();
+            });
+
+            it('should return a valid authorization header (no ext)', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'sha256'
+                };
+
+                var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
+                expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", mac="HTgtd0jPI6E4izx8e4OHdO36q00xFCU0FolNq3RiCYs="');
+                done();
+            });
+
+            it('should return an empty authorization header on missing options', function (done) {
+
+                var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST').field;
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on invalid credentials', function (done) {
+
+                var credentials = {
+                    key: '2983d45yun89q',
+                    algorithm: 'sha256'
+                };
+
+                var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207 }).field;
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on invalid algorithm', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'hmac-sha-0'
+                };
+
+                var header = Browser.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, payload: 'something, anything!', ext: 'Bazinga!', timestamp: 1353809207 }).field;
+                expect(header).to.equal('');
+                done();
+            });
+        });
+
+        describe('#authenticate', function () {
+
+            it('should return false on invalid header', function (done) {
+
+                var res = {
+                    headers: {
+                        'server-authorization': 'Hawk mac="abc", bad="xyz"'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                expect(Browser.client.authenticate(res, {})).to.equal(false);
+                done();
+            });
+
+            it('should return false on invalid mac', function (done) {
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain',
+                        'server-authorization': 'Hawk mac="_IJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                var artifacts = {
+                    method: 'POST',
+                    host: 'example.com',
+                    port: '8080',
+                    resource: '/resource/4?filter=a',
+                    ts: '1362336900',
+                    nonce: 'eb5S_L',
+                    hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
+                    ext: 'some-app-data',
+                    app: undefined,
+                    dlg: undefined,
+                    mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+                    id: '123456'
+                };
+
+                var credentials = {
+                    id: '123456',
+                    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                    algorithm: 'sha256',
+                    user: 'steve'
+                };
+
+                expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(false);
+                done();
+            });
+
+            it('should return true on ignoring hash', function (done) {
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain',
+                        'server-authorization': 'Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                var artifacts = {
+                    method: 'POST',
+                    host: 'example.com',
+                    port: '8080',
+                    resource: '/resource/4?filter=a',
+                    ts: '1362336900',
+                    nonce: 'eb5S_L',
+                    hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
+                    ext: 'some-app-data',
+                    app: undefined,
+                    dlg: undefined,
+                    mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+                    id: '123456'
+                };
+
+                var credentials = {
+                    id: '123456',
+                    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                    algorithm: 'sha256',
+                    user: 'steve'
+                };
+
+                expect(Browser.client.authenticate(res, credentials, artifacts)).to.equal(true);
+                done();
+            });
+
+            it('should fail on invalid WWW-Authenticate header format', function (done) {
+
+                var res = {
+                    headers: {
+                        'www-authenticate': 'Hawk ts="1362346425875", tsm="PhwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", x="Stale timestamp"'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                expect(Browser.client.authenticate(res, {})).to.equal(false);
+                done();
+            });
+
+            it('should fail on invalid WWW-Authenticate header format', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                    algorithm: 'sha256',
+                    user: 'steve'
+                };
+
+                var res = {
+                    headers: {
+                        'www-authenticate': 'Hawk ts="1362346425875", tsm="hwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", error="Stale timestamp"'
+                    },
+                    getResponseHeader: function (header) {
+
+                        return res.headers[header.toLowerCase()];
+                    }
+                };
+
+                expect(Browser.client.authenticate(res, credentials)).to.equal(false);
+                done();
+            });
+        });
+
+        describe('#message', function () {
+            it('should generate an authorization then successfully parse it', function (done) {
+
+                credentialsFunc('123456', function (err, credentials) {
+
+                    var auth = Browser.client.message('example.com', 8080, 'some message', { credentials: credentials });
+                    expect(auth).to.exist;
+
+                    Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+
+                        expect(err).to.not.exist;
+                        expect(credentials.user).to.equal('steve');
+                        done();
+                    });
+                });
+            });
+
+            it('should fail on missing host', function (done) {
+
+                credentialsFunc('123456', function (err, credentials) {
+
+                    var auth = Browser.client.message(null, 8080, 'some message', { credentials: credentials });
+                    expect(auth).to.not.exist;
+                    done();
+                });
+            });
+
+            it('should fail on missing credentials', function (done) {
+
+                var auth = Browser.client.message('example.com', 8080, 'some message', {});
+                expect(auth).to.not.exist;
+                done();
+            });
+
+            it('should fail on invalid algorithm', function (done) {
+
+                credentialsFunc('123456', function (err, credentials) {
+
+                    var creds = Hoek.clone(credentials);
+                    creds.algorithm = 'blah';
+                    var auth = Browser.client.message('example.com', 8080, 'some message', { credentials: creds });
+                    expect(auth).to.not.exist;
+                    done();
+                });
+            });
+        });
+    });
+
+    describe('#parseAuthorizationHeader', function (done) {
+
+        it('returns null on missing header', function (done) {
+
+            expect(Browser.utils.parseAuthorizationHeader()).to.equal(null);
+            done();
+        });
+
+        it('returns null on bad header syntax (structure)', function (done) {
+
+            expect(Browser.utils.parseAuthorizationHeader('Hawk')).to.equal(null);
+            done();
+        });
+
+        it('returns null on bad header syntax (parts)', function (done) {
+
+            expect(Browser.utils.parseAuthorizationHeader(' ')).to.equal(null);
+            done();
+        });
+
+        it('returns null on bad scheme name', function (done) {
+
+            expect(Browser.utils.parseAuthorizationHeader('Basic asdasd')).to.equal(null);
+            done();
+        });
+
+        it('returns null on bad attribute value', function (done) {
+
+            expect(Browser.utils.parseAuthorizationHeader('Hawk test="\t"', ['test'])).to.equal(null);
+            done();
+        });
+
+        it('returns null on duplicated attribute', function (done) {
+
+            expect(Browser.utils.parseAuthorizationHeader('Hawk test="a", test="b"', ['test'])).to.equal(null);
+            done();
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/client.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/client.js
new file mode 100755 (executable)
index 0000000..bcc4222
--- /dev/null
@@ -0,0 +1,206 @@
+// Load modules
+
+var Url = require('url');
+var Lab = require('lab');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    describe('client', function () {
+
+        describe('#header', function () {
+
+            it('should return a valid authorization header (sha1)', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'sha1'
+                };
+
+                var header = Hawk.client.header('http://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about' }).field;
+                expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="bsvY3IfUllw6V5rvk4tStEvpBhE=", ext="Bazinga!", mac="qbf1ZPG/r/e06F4ht+T77LXi5vw="');
+                done();
+            });
+
+            it('should return a valid authorization header (sha256)', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'sha256'
+                };
+
+                var header = Hawk.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
+                expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", ext="Bazinga!", mac="q1CwFoSHzPZSkbIvl0oYlD+91rBUEvFk763nMjMndj8="');
+                done();
+            });
+
+            it('should return a valid authorization header (no ext)', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'sha256'
+                };
+
+                var header = Hawk.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, timestamp: 1353809207, nonce: 'Ygvqdz', payload: 'something to write about', contentType: 'text/plain' }).field;
+                expect(header).to.equal('Hawk id="123456", ts="1353809207", nonce="Ygvqdz", hash="2QfCt3GuY9HQnHWyWD3wX68ZOKbynqlfYmuO2ZBRqtY=", mac="HTgtd0jPI6E4izx8e4OHdO36q00xFCU0FolNq3RiCYs="');
+                done();
+            });
+
+            it('should return an empty authorization header on missing options', function (done) {
+
+                var header = Hawk.client.header('https://example.net/somewhere/over/the/rainbow', 'POST').field;
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on invalid credentials', function (done) {
+
+                var credentials = {
+                    key: '2983d45yun89q',
+                    algorithm: 'sha256'
+                };
+
+                var header = Hawk.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, ext: 'Bazinga!', timestamp: 1353809207 }).field;
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on invalid algorithm', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: '2983d45yun89q',
+                    algorithm: 'hmac-sha-0'
+                };
+
+                var header = Hawk.client.header('https://example.net/somewhere/over/the/rainbow', 'POST', { credentials: credentials, payload: 'something, anything!', ext: 'Bazinga!', timestamp: 1353809207 }).field;
+                expect(header).to.equal('');
+                done();
+            });
+        });
+
+        describe('#authenticate', function () {
+
+            it('should return false on invalid header', function (done) {
+
+                var res = {
+                    headers: {
+                        'server-authorization': 'Hawk mac="abc", bad="xyz"'
+                    }
+                };
+
+                expect(Hawk.client.authenticate(res, {})).to.equal(false);
+                done();
+            });
+
+            it('should return false on invalid mac', function (done) {
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain',
+                        'server-authorization': 'Hawk mac="_IJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
+                    }
+                };
+
+                var artifacts = {
+                    method: 'POST',
+                    host: 'example.com',
+                    port: '8080',
+                    resource: '/resource/4?filter=a',
+                    ts: '1362336900',
+                    nonce: 'eb5S_L',
+                    hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
+                    ext: 'some-app-data',
+                    app: undefined,
+                    dlg: undefined,
+                    mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+                    id: '123456'
+                };
+
+                var credentials = {
+                    id: '123456',
+                    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                    algorithm: 'sha256',
+                    user: 'steve'
+                };
+
+                expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(false);
+                done();
+            });
+
+            it('should return true on ignoring hash', function (done) {
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain',
+                        'server-authorization': 'Hawk mac="XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=", hash="f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=", ext="response-specific"'
+                    }
+                };
+
+                var artifacts = {
+                    method: 'POST',
+                    host: 'example.com',
+                    port: '8080',
+                    resource: '/resource/4?filter=a',
+                    ts: '1362336900',
+                    nonce: 'eb5S_L',
+                    hash: 'nJjkVtBE5Y/Bk38Aiokwn0jiJxt/0S2WRSUwWLCf5xk=',
+                    ext: 'some-app-data',
+                    app: undefined,
+                    dlg: undefined,
+                    mac: 'BlmSe8K+pbKIb6YsZCnt4E1GrYvY1AaYayNR82dGpIk=',
+                    id: '123456'
+                };
+
+                var credentials = {
+                    id: '123456',
+                    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                    algorithm: 'sha256',
+                    user: 'steve'
+                };
+
+                expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
+                done();
+            });
+
+            it('should fail on invalid WWW-Authenticate header format', function (done) {
+
+                var header = 'Hawk ts="1362346425875", tsm="PhwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", x="Stale timestamp"';
+                expect(Hawk.client.authenticate({ headers: { 'www-authenticate': header } }, {})).to.equal(false);
+                done();
+            });
+
+            it('should fail on invalid WWW-Authenticate header format', function (done) {
+
+                var credentials = {
+                    id: '123456',
+                    key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                    algorithm: 'sha256',
+                    user: 'steve'
+                };
+
+                var header = 'Hawk ts="1362346425875", tsm="hwayS28vtnn3qbv0mqRBYSXebN/zggEtucfeZ620Zo=", error="Stale timestamp"';
+                expect(Hawk.client.authenticate({ headers: { 'www-authenticate': header } }, credentials)).to.equal(false);
+                done();
+            });
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/crypto.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/crypto.js
new file mode 100755 (executable)
index 0000000..b62c217
--- /dev/null
@@ -0,0 +1,86 @@
+// Load modules
+
+var Lab = require('lab');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    describe('Crypto', function () {
+
+        describe('#generateNormalizedString', function () {
+
+            it('should return a valid normalized string', function (done) {
+
+                expect(Hawk.crypto.generateNormalizedString('header', {
+                    credentials: {
+                        key: 'dasdfasdf',
+                        algorithm: 'sha256'
+                    },
+                    ts: 1357747017,
+                    nonce: 'k3k4j5',
+                    method: 'GET',
+                    resource: '/resource/something',
+                    host: 'example.com',
+                    port: 8080
+                })).to.equal('hawk.1.header\n1357747017\nk3k4j5\nGET\n/resource/something\nexample.com\n8080\n\n\n');
+
+                done();
+            });
+
+            it('should return a valid normalized string (ext)', function (done) {
+
+                expect(Hawk.crypto.generateNormalizedString('header', {
+                    credentials: {
+                        key: 'dasdfasdf',
+                        algorithm: 'sha256'
+                    },
+                    ts: 1357747017,
+                    nonce: 'k3k4j5',
+                    method: 'GET',
+                    resource: '/resource/something',
+                    host: 'example.com',
+                    port: 8080,
+                    ext: 'this is some app data'
+                })).to.equal('hawk.1.header\n1357747017\nk3k4j5\nGET\n/resource/something\nexample.com\n8080\n\nthis is some app data\n');
+
+                done();
+            });
+
+            it('should return a valid normalized string (payload + ext)', function (done) {
+
+                expect(Hawk.crypto.generateNormalizedString('header', {
+                    credentials: {
+                        key: 'dasdfasdf',
+                        algorithm: 'sha256'
+                    },
+                    ts: 1357747017,
+                    nonce: 'k3k4j5',
+                    method: 'GET',
+                    resource: '/resource/something',
+                    host: 'example.com',
+                    port: 8080,
+                    hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=',
+                    ext: 'this is some app data'
+                })).to.equal('hawk.1.header\n1357747017\nk3k4j5\nGET\n/resource/something\nexample.com\n8080\nU4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=\nthis is some app data\n');
+
+                done();
+            });
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/index.js
new file mode 100755 (executable)
index 0000000..ba83738
--- /dev/null
@@ -0,0 +1,316 @@
+// Load modules
+
+var Url = require('url');
+var Lab = require('lab');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    var credentialsFunc = function (id, callback) {
+
+        var credentials = {
+            id: id,
+            key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+            algorithm: (id === '1' ? 'sha1' : 'sha256'),
+            user: 'steve'
+        };
+
+        return callback(null, credentials);
+    };
+
+    it('should generate a header then successfully parse it (configuration)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header(Url.parse('http://example.com:8080/resource/4?filter=a'), req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+            expect(req.authorization).to.exist;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (node request)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    }
+                };
+
+                res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts, { payload: 'some reply', contentType: 'text/plain', ext: 'response-specific' });
+                expect(res.headers['server-authorization']).to.exist;
+
+                expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(true);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (no server header options)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    }
+                };
+
+                res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+                expect(res.headers['server-authorization']).to.exist;
+
+                expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then fails to parse it (missing server header hash)', function (done) {
+
+        var req = {
+            method: 'POST',
+            url: '/resource/4?filter=a',
+            headers: {
+                host: 'example.com:8080',
+                'content-type': 'text/plain;x=y'
+            }
+        };
+
+        var payload = 'some not so random text';
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var reqHeader = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', payload: payload, contentType: req.headers['content-type'] });
+            req.headers.authorization = reqHeader.field;
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload(payload, credentials, artifacts, req.headers['content-type'])).to.equal(true);
+
+                var res = {
+                    headers: {
+                        'content-type': 'text/plain'
+                    }
+                };
+
+                res.headers['server-authorization'] = Hawk.server.header(credentials, artifacts);
+                expect(res.headers['server-authorization']).to.exist;
+
+                expect(Hawk.client.authenticate(res, credentials, artifacts, { payload: 'some reply' })).to.equal(false);
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (with hash)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it then validate payload', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(Hawk.server.authenticatePayload('hola!', credentials, artifacts)).to.be.true;
+                expect(Hawk.server.authenticatePayload('hello!', credentials, artifacts)).to.be.false;
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (app)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(artifacts.app).to.equal('asd23ased');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then successfully parse it (app, dlg)', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data', app: 'asd23ased', dlg: '23434szr3q4d' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(artifacts.ext).to.equal('some-app-data');
+                expect(artifacts.app).to.equal('asd23ased');
+                expect(artifacts.dlg).to.equal('23434szr3q4d');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header then fail authentication due to bad hash', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, payload: 'hola!', ext: 'some-app-data' }).field;
+            Hawk.server.authenticate(req, credentialsFunc, { payload: 'byebye!' }, function (err, credentials, artifacts) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Bad payload hash');
+                done();
+            });
+        });
+    });
+
+    it('should generate a header for one resource then fail to authenticate another', function (done) {
+
+        var req = {
+            method: 'GET',
+            url: '/resource/4?filter=a',
+            host: 'example.com',
+            port: 8080
+        };
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            req.authorization = Hawk.client.header('http://example.com:8080/resource/4?filter=a', req.method, { credentials: credentials, ext: 'some-app-data' }).field;
+            req.url = '/something/else';
+
+            Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                expect(err).to.exist;
+                expect(credentials).to.exist;
+                done();
+            });
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/message.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/message.js
new file mode 100755 (executable)
index 0000000..04b91d4
--- /dev/null
@@ -0,0 +1,246 @@
+// Load modules
+
+var Url = require('url');
+var Lab = require('lab');
+var Hoek = require('hoek');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    var credentialsFunc = function (id, callback) {
+
+        var credentials = {
+            id: id,
+            key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+            algorithm: (id === '1' ? 'sha1' : 'sha256'),
+            user: 'steve'
+        };
+
+        return callback(null, credentials);
+    };
+
+    it('should generate an authorization then successfully parse it', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on mismatching host', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            Hawk.server.authenticateMessage('example1.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Bad mac');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on stale timestamp', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { localtimeOffsetMsec: 100000 }, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Stale timestamp');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on invalid authorization', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+            delete auth.id;
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Invalid authorization');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on bad hash', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message1', auth, credentialsFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Bad message hash');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on nonce error', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, credentialsFunc, { nonceFunc: function (nonce, ts, callback) { callback (new Error('kaboom')); } }, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Invalid nonce');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on credentials error', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            var errFunc = function (id, callback) {
+
+                callback(new Error('kablooey'));
+            };
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('kablooey');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on missing credentials', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            var errFunc = function (id, callback) {
+
+                callback();
+            };
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Unknown credentials');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on invalid credentials', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            var errFunc = function (id, callback) {
+
+                callback(null, {});
+            };
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Invalid credentials');
+                done();
+            });
+        });
+    });
+
+    it('should fail authorization on invalid credentials algorithm', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: credentials });
+            expect(auth).to.exist;
+
+            var errFunc = function (id, callback) {
+
+                callback(null, { key: '123', algorithm: '456' });
+            };
+
+            Hawk.server.authenticateMessage('example.com', 8080, 'some message', auth, errFunc, {}, function (err, credentials) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Unknown algorithm');
+                done();
+            });
+        });
+    });
+
+    it('should fail on missing host', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var auth = Hawk.client.message(null, 8080, 'some message', { credentials: credentials });
+            expect(auth).to.not.exist;
+            done();
+        });
+    });
+
+    it('should fail on missing credentials', function (done) {
+
+        var auth = Hawk.client.message('example.com', 8080, 'some message', {});
+        expect(auth).to.not.exist;
+        done();
+    });
+
+    it('should fail on invalid algorithm', function (done) {
+
+        credentialsFunc('123456', function (err, credentials) {
+
+            var creds = Hoek.clone(credentials);
+            creds.algorithm = 'blah';
+            var auth = Hawk.client.message('example.com', 8080, 'some message', { credentials: creds });
+            expect(auth).to.not.exist;
+            done();
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/readme.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/readme.js
new file mode 100755 (executable)
index 0000000..f39e033
--- /dev/null
@@ -0,0 +1,98 @@
+// Load modules
+
+var Lab = require('lab');
+var Hoek = require('hoek');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    describe('README', function () {
+
+        describe('core', function () {
+
+            var credentials = {
+                id: 'dh37fgj492je',
+                key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                algorithm: 'sha256'
+            };
+
+            var options = {
+                credentials: credentials,
+                timestamp: 1353832234,
+                nonce: 'j4h3g2',
+                ext: 'some-app-ext-data'
+            };
+
+            it('should generate a header protocol example', function (done) {
+
+                var header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'GET', options).field;
+
+                expect(header).to.equal('Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", ext="some-app-ext-data", mac="6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE="');
+                done();
+            });
+
+            it('should generate a normalized string protocol example', function (done) {
+
+                var normalized = Hawk.crypto.generateNormalizedString('header', {
+                    credentials: credentials,
+                    ts: options.timestamp,
+                    nonce: options.nonce,
+                    method: 'GET',
+                    resource: '/resource?a=1&b=2',
+                    host: 'example.com',
+                    port: 8000,
+                    ext: options.ext
+                });
+
+                expect(normalized).to.equal('hawk.1.header\n1353832234\nj4h3g2\nGET\n/resource?a=1&b=2\nexample.com\n8000\n\nsome-app-ext-data\n');
+                done();
+            });
+
+            var payloadOptions = Hoek.clone(options);
+            payloadOptions.payload = 'Thank you for flying Hawk';
+            payloadOptions.contentType = 'text/plain';
+
+            it('should generate a header protocol example (with payload)', function (done) {
+
+                var header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'POST', payloadOptions).field;
+
+                expect(header).to.equal('Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", hash="Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=", ext="some-app-ext-data", mac="aSe1DERmZuRl3pI36/9BdZmnErTw3sNzOOAUlfeKjVw="');
+                done();
+            });
+
+            it('should generate a normalized string protocol example (with payload)', function (done) {
+
+                var normalized = Hawk.crypto.generateNormalizedString('header', {
+                    credentials: credentials,
+                    ts: options.timestamp,
+                    nonce: options.nonce,
+                    method: 'POST',
+                    resource: '/resource?a=1&b=2',
+                    host: 'example.com',
+                    port: 8000,
+                    hash: Hawk.crypto.calculatePayloadHash(payloadOptions.payload, credentials.algorithm, payloadOptions.contentType),
+                    ext: options.ext
+                });
+
+                expect(normalized).to.equal('hawk.1.header\n1353832234\nj4h3g2\nPOST\n/resource?a=1&b=2\nexample.com\n8000\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\nsome-app-ext-data\n');
+                done();
+            });
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/server.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/server.js
new file mode 100755 (executable)
index 0000000..3e92427
--- /dev/null
@@ -0,0 +1,686 @@
+// Load modules
+
+var Url = require('url');
+var Lab = require('lab');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    describe('server', function () {
+
+        var credentialsFunc = function (id, callback) {
+
+            var credentials = {
+                id: id,
+                key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                algorithm: (id === '1' ? 'sha1' : 'sha256'),
+                user: 'steve'
+            };
+
+            return callback(null, credentials);
+        };
+
+        describe('#authenticate', function () {
+
+            it('should parse a valid authentication header (sha1)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    done();
+                });
+            });
+
+            it('should parse a valid authentication header (sha256)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/1?b=1&a=2',
+                    host: 'example.com',
+                    port: 8000,
+                    authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", mac="m8r1rHbXN6NgO+KIIhjO7sFRyd78RNGVUwehe8Cp2dU=", ext="some-app-data"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353832234000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    done();
+                });
+            });
+
+            it('should parse a valid authentication header (host override)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: 'example1.com:8080',
+                        authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"'
+                    }
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { host: 'example.com', localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    done();
+                });
+            });
+
+            it('should parse a valid authentication header (host port override)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: 'example1.com:80',
+                        authorization: 'Hawk id="1", ts="1353788437", nonce="k3j4h2", mac="zy79QQ5/EYFmQqutVnYb73gAc/U=", ext="hello"'
+                    }
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { host: 'example.com', port: 8080, localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    done();
+                });
+            });
+
+            it('should parse a valid authentication header (POST with payload)', function (done) {
+
+                var req = {
+                    method: 'POST',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123456", ts="1357926341", nonce="1AwuJD", hash="qAiXIVv+yjDATneWxZP2YCTa9aHRgQdnH9b3Wc+o3dg=", ext="some-app-data", mac="UeYcj5UoTVaAWXNvJfLVia7kU3VabxCqrccXP8sUGC4="'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1357926341000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    done();
+                });
+            });
+
+            it('should fail on missing hash', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/1?b=1&a=2',
+                    host: 'example.com',
+                    port: 8000,
+                    authorization: 'Hawk id="dh37fgj492je", ts="1353832234", nonce="j4h3g2", mac="m8r1rHbXN6NgO+KIIhjO7sFRyd78RNGVUwehe8Cp2dU=", ext="some-app-data"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { payload: 'body', localtimeOffsetMsec: 1353832234000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Missing required payload hash');
+                    done();
+                });
+            });
+
+            it('should fail on a stale timestamp', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123456", ts="1362337299", nonce="UzmxSs", ext="some-app-data", mac="wnNUxchvvryMH2RxckTdZ/gY3ijzvccx4keVvELC61w="'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Stale timestamp');
+                    var header = err.response.headers['WWW-Authenticate'];
+                    var ts = header.match(/^Hawk ts\=\"(\d+)\"\, tsm\=\"([^\"]+)\"\, error=\"Stale timestamp\"$/);
+                    var now = Hawk.utils.now();
+                    expect(parseInt(ts[1], 10) * 1000).to.be.within(now - 1000, now + 1000);
+
+                    var res = {
+                        headers: {
+                            'www-authenticate': header
+                        }
+                    };
+
+                    expect(Hawk.client.authenticate(res, credentials, artifacts)).to.equal(true);
+                    done();
+                });
+            });
+
+            it('should fail on a replay', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="bXx7a7p1h9QYQNZ8x7QhvDQym8ACgab4m3lVSFn4DBw=", ext="hello"'
+                };
+
+                var memoryCache = {};
+                var options = {
+                    localtimeOffsetMsec: 1353788437000 - Hawk.utils.now(),
+                    nonceFunc: function (nonce, ts, callback) {
+
+                        if (memoryCache[nonce]) {
+                            return callback(new Error());
+                        }
+
+                        memoryCache[nonce] = true;
+                        return callback();
+                    }
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, options, function (err, credentials, artifacts) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+
+                    Hawk.server.authenticate(req, credentialsFunc, options, function (err, credentials, artifacts) {
+
+                        expect(err).to.exist;
+                        expect(err.response.payload.message).to.equal('Invalid nonce');
+                        done();
+                    });
+                });
+            });
+
+            it('should fail on an invalid authentication header: wrong scheme', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Basic asdasdasdasd'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.not.exist;
+                    done();
+                });
+            });
+
+            it('should fail on an invalid authentication header: no scheme', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: '!@#'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Invalid header syntax');
+                    done();
+                });
+            });
+
+            it('should fail on an missing authorization header', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.isMissing).to.equal(true);
+                    done();
+                });
+            });
+
+            it('should fail on an missing host header', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                    }
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Invalid Host header');
+                    done();
+                });
+            });
+
+            it('should fail on an missing authorization attribute (id)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Missing attributes');
+                    done();
+                });
+            });
+
+            it('should fail on an missing authorization attribute (ts)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Missing attributes');
+                    done();
+                });
+            });
+
+            it('should fail on an missing authorization attribute (nonce)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Missing attributes');
+                    done();
+                });
+            });
+
+            it('should fail on an missing authorization attribute (mac)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Missing attributes');
+                    done();
+                });
+            });
+
+            it('should fail on an unknown authorization attribute', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", x="3", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Unknown attribute: x');
+                    done();
+                });
+            });
+
+            it('should fail on an bad authorization header format', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123\\", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Bad header format');
+                    done();
+                });
+            });
+
+            it('should fail on an bad authorization attribute value', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="\t", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Bad attribute value: id');
+                    done();
+                });
+            });
+
+            it('should fail on an empty authorization attribute value', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Bad attribute value: id');
+                    done();
+                });
+            });
+
+            it('should fail on duplicated authorization attribute key', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", id="456", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Duplicate attribute: id');
+                    done();
+                });
+            });
+
+            it('should fail on an invalid authorization header format', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk'
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Invalid header syntax');
+                    done();
+                });
+            });
+
+            it('should fail on an bad host header (missing host)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: ':8080',
+                        authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                    }
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Invalid Host header');
+                    done();
+                });
+            });
+
+            it('should fail on an bad host header (pad port)', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: 'example.com:something',
+                        authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                    }
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Invalid Host header');
+                    done();
+                });
+            });
+
+            it('should fail on credentialsFunc error', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                var credentialsFunc = function (id, callback) {
+
+                    return callback(new Error('Unknown user'));
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.message).to.equal('Unknown user');
+                    done();
+                });
+            });
+
+            it('should fail on missing credentials', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                var credentialsFunc = function (id, callback) {
+
+                    return callback(null, null);
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Unknown credentials');
+                    done();
+                });
+            });
+
+            it('should fail on invalid credentials', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                var credentialsFunc = function (id, callback) {
+
+                    var credentials = {
+                        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                        user: 'steve'
+                    };
+
+                    return callback(null, credentials);
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.message).to.equal('Invalid credentials');
+                    expect(err.response.payload.message).to.equal('An internal server error occurred');
+                    done();
+                });
+            });
+
+            it('should fail on unknown credentials algorithm', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcUyW6EEgUH4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                var credentialsFunc = function (id, callback) {
+
+                    var credentials = {
+                        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                        algorithm: 'hmac-sha-0',
+                        user: 'steve'
+                    };
+
+                    return callback(null, credentials);
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.message).to.equal('Unknown algorithm');
+                    expect(err.response.payload.message).to.equal('An internal server error occurred');
+                    done();
+                });
+            });
+
+            it('should fail on unknown bad mac', function (done) {
+
+                var req = {
+                    method: 'GET',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080,
+                    authorization: 'Hawk id="123", ts="1353788437", nonce="k3j4h2", mac="/qwS4UjfVWMcU4jlr7T/wuKe3dKijvTvSos=", ext="hello"'
+                };
+
+                var credentialsFunc = function (id, callback) {
+
+                    var credentials = {
+                        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                        algorithm: 'sha256',
+                        user: 'steve'
+                    };
+
+                    return callback(null, credentials);
+                };
+
+                Hawk.server.authenticate(req, credentialsFunc, { localtimeOffsetMsec: 1353788437000 - Hawk.utils.now() }, function (err, credentials, artifacts) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Bad mac');
+                    done();
+                });
+            });
+        });
+
+        describe('#header', function () {
+
+            it('should return an empty authorization header on missing options', function (done) {
+
+                var header = Hawk.server.header();
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on missing credentials', function (done) {
+
+                var header = Hawk.server.header(null, {});
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on invalid credentials', function (done) {
+
+                var credentials = {
+                    key: '2983d45yun89q'
+                };
+
+                var header = Hawk.server.header(credentials);
+                expect(header).to.equal('');
+                done();
+            });
+
+            it('should return an empty authorization header on invalid algorithm', function (done) {
+
+                var artifacts = {
+                    id: '123456'
+                };
+
+                var credentials = {
+                    key: '2983d45yun89q',
+                    algorithm: 'hmac-sha-0'
+                };
+
+                var header = Hawk.server.header(credentials, artifacts);
+                expect(header).to.equal('');
+                done();
+            });
+        });
+    });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/uri.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/uri.js
new file mode 100755 (executable)
index 0000000..44ffd7f
--- /dev/null
@@ -0,0 +1,456 @@
+// Load modules
+
+var Http = require('http');
+var Lab = require('lab');
+var Hawk = require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    describe('Uri', function () {
+
+        var credentialsFunc = function (id, callback) {
+
+            var credentials = {
+                id: id,
+                key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
+                algorithm: 'sha256',
+                user: 'steve'
+            };
+
+            return callback(null, credentials);
+        };
+
+        it('should generate a bewit then successfully authenticate it', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?a=1&b=2',
+                host: 'example.com',
+                port: 80
+            };
+
+            credentialsFunc('123456', function (err, credentials) {
+
+                var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100, ext: 'some-app-data' });
+                req.url += '&bewit=' + bewit;
+
+                Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    expect(attributes.ext).to.equal('some-app-data');
+                    done();
+                });
+            });
+        });
+
+        it('should generate a bewit then successfully authenticate it (no ext)', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?a=1&b=2',
+                host: 'example.com',
+                port: 80
+            };
+
+            credentialsFunc('123456', function (err, credentials) {
+
+                var bewit = Hawk.uri.getBewit('http://example.com/resource/4?a=1&b=2', { credentials: credentials, ttlSec: 60 * 60 * 24 * 365 * 100 });
+                req.url += '&bewit=' + bewit;
+
+                Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                    expect(err).to.not.exist;
+                    expect(credentials.user).to.equal('steve');
+                    done();
+                });
+            });
+        });
+
+        it('should successfully authenticate a request (last param)', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?a=1&b=2&bewit=MTIzNDU2XDQ1MTE0ODQ2MjFcMzFjMmNkbUJFd1NJRVZDOVkva1NFb2c3d3YrdEVNWjZ3RXNmOGNHU2FXQT1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(attributes.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+
+        it('should successfully authenticate a request (first param)', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MTE0ODQ2MjFcMzFjMmNkbUJFd1NJRVZDOVkva1NFb2c3d3YrdEVNWjZ3RXNmOGNHU2FXQT1cc29tZS1hcHAtZGF0YQ&a=1&b=2',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(attributes.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+
+        it('should successfully authenticate a request (only param)', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MTE0ODQ2NDFcZm1CdkNWT3MvcElOTUUxSTIwbWhrejQ3UnBwTmo4Y1VrSHpQd3Q5OXJ1cz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.not.exist;
+                expect(credentials.user).to.equal('steve');
+                expect(attributes.ext).to.equal('some-app-data');
+                done();
+            });
+        });
+
+        it('should fail on multiple authentication', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MTE0ODQ2NDFcZm1CdkNWT3MvcElOTUUxSTIwbWhrejQ3UnBwTmo4Y1VrSHpQd3Q5OXJ1cz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080,
+                authorization: 'Basic asdasdasdasd'
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Multiple authentications');
+                done();
+            });
+        });
+
+        it('should fail on method other than GET', function (done) {
+
+            credentialsFunc('123456', function (err, credentials) {
+
+                var req = {
+                    method: 'POST',
+                    url: '/resource/4?filter=a',
+                    host: 'example.com',
+                    port: 8080
+                };
+
+                var exp = Math.floor(Hawk.utils.now() / 1000) + 60;
+                var ext = 'some-app-data';
+                var mac = Hawk.crypto.calculateMac('bewit', credentials, {
+                    timestamp: exp,
+                    nonce: '',
+                    method: req.method,
+                    resource: req.url,
+                    host: req.host,
+                    port: req.port,
+                    ext: ext
+                });
+
+                var bewit = credentials.id + '\\' + exp + '\\' + mac + '\\' + ext;
+
+                req.url += '&bewit=' + Hawk.utils.base64urlEncode(bewit);
+
+                Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                    expect(err).to.exist;
+                    expect(err.response.payload.message).to.equal('Invalid method');
+                    done();
+                });
+            });
+        });
+
+        it('should fail on invalid host header', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MDk5OTE3MTlcTUE2eWkwRWRwR0pEcWRwb0JkYVdvVDJrL0hDSzA1T0Y3MkhuZlVmVy96Zz1cc29tZS1hcHAtZGF0YQ',
+                headers: {
+                    host: 'example.com:something'
+                }
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Invalid Host header');
+                done();
+            });
+        });
+
+        it('should fail on empty bewit', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Empty bewit');
+                expect(err.isMissing).to.not.exist;
+                done();
+            });
+        });
+
+        it('should fail on invalid bewit', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=*',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Invalid bewit encoding');
+                expect(err.isMissing).to.not.exist;
+                done();
+            });
+        });
+
+        it('should fail on missing bewit', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.not.exist;
+                expect(err.isMissing).to.equal(true);
+                done();
+            });
+        });
+
+        it('should fail on invalid bewit structure', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=abc',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Invalid bewit structure');
+                done();
+            });
+        });
+
+        it('should fail on empty bewit attribute', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=YVxcY1xk',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Missing bewit attributes');
+                done();
+            });
+        });
+
+        it('should fail on expired access', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?a=1&b=2&bewit=MTIzNDU2XDEzNTY0MTg1ODNcWk1wZlMwWU5KNHV0WHpOMmRucTRydEk3NXNXTjFjeWVITTcrL0tNZFdVQT1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Access expired');
+                done();
+            });
+        });
+
+        it('should fail on credentials function error', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MDk5OTE3MTlcTUE2eWkwRWRwR0pEcWRwb0JkYVdvVDJrL0hDSzA1T0Y3MkhuZlVmVy96Zz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, function (id, callback) { callback(Hawk.error.badRequest('Boom')); }, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Boom');
+                done();
+            });
+        });
+
+        it('should fail on null credentials function response', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MDk5OTE3MTlcTUE2eWkwRWRwR0pEcWRwb0JkYVdvVDJrL0hDSzA1T0Y3MkhuZlVmVy96Zz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, function (id, callback) { callback(null, null); }, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Unknown credentials');
+                done();
+            });
+        });
+
+        it('should fail on invalid credentials function response', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MDk5OTE3MTlcTUE2eWkwRWRwR0pEcWRwb0JkYVdvVDJrL0hDSzA1T0Y3MkhuZlVmVy96Zz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, function (id, callback) { callback(null, {}); }, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Invalid credentials');
+                done();
+            });
+        });
+
+        it('should fail on invalid credentials function response (unknown algorithm)', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MDk5OTE3MTlcTUE2eWkwRWRwR0pEcWRwb0JkYVdvVDJrL0hDSzA1T0Y3MkhuZlVmVy96Zz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, function (id, callback) { callback(null, { key: 'xxx', algorithm: 'xxx' }); }, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.message).to.equal('Unknown algorithm');
+                done();
+            });
+        });
+
+        it('should fail on expired access', function (done) {
+
+            var req = {
+                method: 'GET',
+                url: '/resource/4?bewit=MTIzNDU2XDQ1MDk5OTE3MTlcTUE2eWkwRWRwR0pEcWRwb0JkYVdvVDJrL0hDSzA1T0Y3MkhuZlVmVy96Zz1cc29tZS1hcHAtZGF0YQ',
+                host: 'example.com',
+                port: 8080
+            };
+
+            Hawk.uri.authenticate(req, function (id, callback) { callback(null, { key: 'xxx', algorithm: 'sha256' }); }, {}, function (err, credentials, attributes) {
+
+                expect(err).to.exist;
+                expect(err.response.payload.message).to.equal('Bad mac');
+                done();
+            });
+        });
+    });
+
+    describe('#getBewit', function () {
+
+        it('should return a valid bewit value', function (done) {
+
+            var credentials = {
+                id: '123456',
+                key: '2983d45yun89q',
+                algorithm: 'sha256'
+            };
+
+            var bewit = Hawk.uri.getBewit('https://example.com/somewhere/over/the/rainbow', { credentials: credentials, ttlSec: 300, localtimeOffsetMsec: 1356420407232 - Hawk.utils.now(), ext: 'xandyandz' });
+            expect(bewit).to.equal('MTIzNDU2XDEzNTY0MjA3MDdca3NjeHdOUjJ0SnBQMVQxekRMTlBiQjVVaUtJVTl0T1NKWFRVZEc3WDloOD1ceGFuZHlhbmR6');
+            done();
+        });
+
+        it('should return an empty bewit on invalid credentials', function (done) {
+
+            var credentials = {
+                key: '2983d45yun89q',
+                algorithm: 'sha256'
+            };
+
+            var bewit = Hawk.uri.getBewit('https://example.com/somewhere/over/the/rainbow', { credentials: credentials, ttlSec: 3000, ext: 'xandyandz' });
+            expect(bewit).to.equal('');
+            done();
+        });
+
+        it('should return an empty bewit on invalid algorithm', function (done) {
+
+            var credentials = {
+                id: '123456',
+                key: '2983d45yun89q',
+                algorithm: 'hmac-sha-0'
+            };
+
+            var bewit = Hawk.uri.getBewit('https://example.com/somewhere/over/the/rainbow', { credentials: credentials, ttlSec: 300, ext: 'xandyandz' });
+            expect(bewit).to.equal('');
+            done();
+        });
+
+        it('should return an empty bewit on missing options', function (done) {
+
+            var credentials = {
+                id: '123456',
+                key: '2983d45yun89q',
+                algorithm: 'hmac-sha-0'
+            };
+
+            var bewit = Hawk.uri.getBewit('https://example.com/somewhere/over/the/rainbow');
+            expect(bewit).to.equal('');
+            done();
+        });
+    });
+});
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/utils.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/hawk/test/utils.js
new file mode 100755 (executable)
index 0000000..0f5fef7
--- /dev/null
@@ -0,0 +1,120 @@
+// Load modules
+
+var Lab = require('lab');
+var Hawk = require('../lib');
+var Package = require('../package.json');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('Hawk', function () {
+
+    describe('Utils', function () {
+
+        describe('#parseHost', function () {
+
+            it('returns port 80 for non tls node request', function (done) {
+
+                var req = {
+                    method: 'POST',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: 'example.com',
+                        'content-type': 'text/plain;x=y'
+                    }
+                };
+
+                expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(80);
+                done();
+            });
+
+            it('returns port 443 for non tls node request', function (done) {
+
+                var req = {
+                    method: 'POST',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: 'example.com',
+                        'content-type': 'text/plain;x=y'
+                    },
+                    connection: {
+                        encrypted: true
+                    }
+                };
+
+                expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(443);
+                done();
+            });
+
+            it('returns port 443 for non tls node request (IPv6)', function (done) {
+
+                var req = {
+                    method: 'POST',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: '[123:123:123]',
+                        'content-type': 'text/plain;x=y'
+                    },
+                    connection: {
+                        encrypted: true
+                    }
+                };
+
+                expect(Hawk.utils.parseHost(req, 'Host').port).to.equal(443);
+                done();
+            });
+
+            it('parses IPv6 headers', function (done) {
+
+                var req = {
+                    method: 'POST',
+                    url: '/resource/4?filter=a',
+                    headers: {
+                        host: '[123:123:123]:8000',
+                        'content-type': 'text/plain;x=y'
+                    },
+                    connection: {
+                        encrypted: true
+                    }
+                };
+
+                var host = Hawk.utils.parseHost(req, 'Host');
+                expect(host.port).to.equal('8000');
+                expect(host.name).to.equal('[123:123:123]');
+                done();
+            });
+        });
+
+        describe('#version', function () {
+
+            it('returns the correct package version number', function (done) {
+
+                expect(Hawk.utils.version()).to.equal(Package.version);
+                done();
+            });
+        });
+
+        describe('#unauthorized', function () {
+
+            it('returns a hawk 401', function (done) {
+
+                expect(Hawk.utils.unauthorized('kaboom').response.headers['WWW-Authenticate']).to.equal('Hawk error="kaboom"');
+                done();
+            });
+        });
+    });
+});
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/LICENSE
new file mode 100755 (executable)
index 0000000..f6d947d
--- /dev/null
@@ -0,0 +1,18 @@
+Copyright Joyent, Inc. All rights reserved.
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/README.md
new file mode 100755 (executable)
index 0000000..de487d3
--- /dev/null
@@ -0,0 +1,79 @@
+# node-http-signature
+
+node-http-signature is a node.js library that has client and server components
+for Joyent's [HTTP Signature Scheme](http_signing.md).
+
+## Usage
+
+Note the example below signs a request with the same key/cert used to start an
+HTTP server. This is almost certainly not what you actually want, but is just
+used to illustrate the API calls; you will need to provide your own key
+management in addition to this library.
+
+### Client
+
+```js
+var fs = require('fs');
+var https = require('https');
+var httpSignature = require('http-signature');
+
+var key = fs.readFileSync('./key.pem', 'ascii');
+
+var options = {
+  host: 'localhost',
+  port: 8443,
+  path: '/',
+  method: 'GET',
+  headers: {}
+};
+
+// Adds a 'Date' header in, signs it, and adds the
+// 'Authorization' header in.
+var req = https.request(options, function(res) {
+  console.log(res.statusCode);
+});
+
+
+httpSignature.sign(req, {
+  key: key,
+  keyId: './cert.pem'
+});
+
+req.end();
+```
+
+### Server
+
+```js
+var fs = require('fs');
+var https = require('https');
+var httpSignature = require('http-signature');
+
+var options = {
+  key: fs.readFileSync('./key.pem'),
+  cert: fs.readFileSync('./cert.pem')
+};
+
+https.createServer(options, function (req, res) {
+  var rc = 200;
+  var parsed = httpSignature.parseRequest(req);
+  var pub = fs.readFileSync(parsed.keyId, 'ascii');
+  if (!httpSignature.verifySignature(parsed, pub))
+    rc = 401;
+
+  res.writeHead(rc);
+  res.end();
+}).listen(8443);
+```
+
+## Installation
+
+    npm install http-signature
+
+## License
+
+MIT.
+
+## Bugs
+
+See <https://github.com/joyent/node-http-signature/issues>.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/http_signing.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/http_signing.md
new file mode 100755 (executable)
index 0000000..dd81ee5
--- /dev/null
@@ -0,0 +1,296 @@
+# Abstract
+
+This document describes a way to add origin authentication, message integrity,
+and replay resistance to HTTP REST requests.  It is intended to be used over
+the HTTPS protocol.
+
+# Copyright Notice
+
+Copyright (c) 2011 Joyent, Inc. and the persons identified as document authors.
+All rights reserved.
+
+Code Components extracted from this document must include MIT License text.
+
+# Introduction
+
+This protocol is intended to provide a standard way for clients to sign HTTP
+requests.  RFC2617 (HTTP Authentication) defines Basic and Digest authentication
+mechanisms, and RFC5246 (TLS 1.2) defines client-auth, both of which are widely
+employed on the Internet today.  However, it is common place that the burdens of
+PKI prevent web service operators from deploying that methodology, and so many
+fall back to Basic authentication, which has poor security characteristics.
+
+Additionally, OAuth provides a fully-specified alternative for authorization
+of web service requests, but is not (always) ideal for machine to machine
+communication, as the key acquisition steps (generally) imply a fixed
+infrastructure that may not make sense to a service provider (e.g., symmetric
+keys).
+
+Several web service providers have invented their own schemes for signing
+HTTP requests, but to date, none have been placed in the public domain as a
+standard.  This document serves that purpose.  There are no techniques in this
+proposal that are novel beyond previous art, however, this aims to be a simple
+mechanism for signing these requests.
+
+# Signature Authentication Scheme
+
+The "signature" authentication scheme is based on the model that the client must
+authenticate itself with a digital signature produced by either a private
+asymmetric key (e.g., RSA) or a shared symmetric key (e.g., HMAC).  The scheme
+is parameterized enough such that it is not bound to any particular key type or
+signing algorithm.  However, it does explicitly assume that clients can send an
+HTTP `Date` header.
+
+## Authorization Header
+
+The client is expected to send an Authorization header (as defined in RFC 2617)
+with the following parameterization:
+
+    credentials := "Signature" params
+    params := 1#(keyId | algorithm | [headers] | [ext] | signature)
+    digitalSignature := plain-string
+
+    keyId := "keyId" "=" <"> plain-string <">
+    algorithm := "algorithm" "=" <"> plain-string <">
+    headers := "headers" "=" <"> 1#headers-value <">
+    ext := "ext" "=" <"> plain-string <">
+    signature := "signature" "=" <"> plain-string <">
+
+    headers-value := plain-string
+    plain-string   = 1*( %x20-21 / %x23-5B / %x5D-7E )
+
+### Signature Parameters
+
+#### keyId
+
+REQUIRED.  The `keyId` field is an opaque string that the server can use to look
+up the component they need to validate the signature.  It could be an SSH key
+fingerprint, an LDAP DN, etc.  Management of keys and assignment of `keyId` is
+out of scope for this document.
+
+#### algorithm
+
+REQUIRED. The `algorithm` parameter is used if the client and server agree on a
+non-standard digital signature algorithm.  The full list of supported signature
+mechanisms is listed below.
+
+#### headers
+
+OPTIONAL.  The `headers` parameter is used to specify the list of HTTP headers
+used to sign the request.  If specified, it should be a quoted list of HTTP
+header names, separated by a single space character.  By default, only one
+HTTP header is signed, which is the `Date` header.  Note that the list MUST be
+specified in the order the values are concatenated together during signing. To
+include the HTTP request line in the signature calculation, use the special
+`request-line` value.  While this is overloading the definition of `headers` in
+HTTP linguism, the request-line is defined in RFC 2616, and as the outlier from
+headers in useful signature calculation, it is deemed simpler to simply use
+`request-line` than to add a separate parameter for it.
+
+#### extensions
+
+OPTIONAL.  The `extensions` parameter is used to include additional information
+which is covered by the request.  The content and format of the string is out of
+scope for this document, and expected to be specified by implementors.
+
+#### signature
+
+REQUIRED.  The `signature` parameter is a `Base64` encoded digital signature
+generated by the client. The client uses the `algorithm` and `headers` request
+parameters to form a canonicalized `signing string`.  This `signing string` is
+then signed with the key associated with `keyId` and the algorithm
+corresponding to `algorithm`.  The `signature` parameter is then set to the
+`Base64` encoding of the signature.
+
+### Signing String Composition
+
+In order to generate the string that is signed with a key, the client MUST take
+the values of each HTTP header specified by `headers` in the order they appear.
+
+1. If the header name is not `request-line` then append the lowercased header
+   name followed with an ASCII colon `:` and an ASCII space ` `.
+2. If the header name is `request-line` then append the HTTP request line,
+   otherwise append the header value.
+3. If value is not the last value then append an ASCII newline `\n`. The string
+   MUST NOT include a trailing ASCII newline.
+
+# Example Requests
+
+All requests refer to the following request (body omitted):
+
+    POST /foo HTTP/1.1
+    Host: example.org
+    Date: Tue, 07 Jun 2011 20:51:35 GMT
+    Content-Type: application/json
+    Content-MD5: h0auK8hnYJKmHTLhKtMTkQ==
+    Content-Length: 123
+
+The "rsa-key-1" keyId refers to a private key known to the client and a public
+key known to the server. The "hmac-key-1" keyId refers to key known to the
+client and server.
+
+## Default parameterization
+
+The authorization header and signature would be generated as:
+
+    Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",signature="Base64(RSA-SHA256(signing string))"
+
+The client would compose the signing string as:
+
+    date: Tue, 07 Jun 2011 20:51:35 GMT
+
+## Header List
+
+The authorization header and signature would be generated as:
+
+    Authorization: Signature keyId="rsa-key-1",algorithm="rsa-sha256",headers="request-line date content-type content-md5",signature="Base64(RSA-SHA256(signing string))"
+
+The client would compose the signing string as (`+ "\n"` inserted for
+readability):
+
+    POST /foo HTTP/1.1 + "\n"
+    date: Tue, 07 Jun 2011 20:51:35 GMT + "\n"
+    content-type: application/json + "\n"
+    content-md5: h0auK8hnYJKmHTLhKtMTkQ==
+
+## Algorithm
+
+The authorization header and signature would be generated as:
+
+    Authorization: Signature keyId="hmac-key-1",algorithm="hmac-sha1",signature="Base64(HMAC-SHA1(signing string))"
+
+The client would compose the signing string as:
+
+    date: Tue, 07 Jun 2011 20:51:35 GMT
+
+# Signing Algorithms
+
+Currently supported algorithm names are:
+
+* rsa-sha1
+* rsa-sha256
+* rsa-sha512
+* dsa-sha1
+* hmac-sha1
+* hmac-sha256
+* hmac-sha512
+
+# Security Considerations
+
+## Default Parameters
+
+Note the default parameterization of the `Signature` scheme is only safe if all
+requests are carried over a secure transport (i.e., TLS).  Sending the default
+scheme over a non-secure transport will leave the request vulnerable to
+spoofing, tampering, replay/repudiation, and integrity violations (if using the
+STRIDE threat-modeling methodology).
+
+## Insecure Transports
+
+If sending the request over plain HTTP, service providers SHOULD require clients
+to sign ALL HTTP headers, and the `request-line`.  Additionally, service
+providers SHOULD require `Content-MD5` calculations to be performed to ensure
+against any tampering from clients.
+
+## Nonces
+
+Nonces are out of scope for this document simply because many service providers
+fail to implement them correctly, or do not adopt security specifications
+because of the infrastructure complexity.  Given the `header` parameterization,
+a service provider is fully enabled to add nonce semantics into this scheme by
+using something like an `x-request-nonce` header, and ensuring it is signed
+with the `Date` header.
+
+## Clock Skew
+
+As the default scheme is to sign the `Date` header, service providers SHOULD
+protect against logged replay attacks by enforcing a clock skew.  The server
+SHOULD be synchronized with NTP, and the recommendation in this specification
+is to allow 300s of clock skew (in either direction).
+
+## Required Headers to Sign
+
+It is out of scope for this document to dictate what headers a service provider
+will want to enforce, but service providers SHOULD at minimum include the
+`Date` header.
+
+# References
+
+## Normative References
+
+* [RFC2616] Hypertext Transfer Protocol -- HTTP/1.1
+* [RFC2617] HTTP Authentication: Basic and Digest Access Authentication
+* [RFC5246] The Transport Layer Security (TLS) Protocol Version 1.2
+
+## Informative References
+
+    Name: Mark Cavage (editor)
+    Company: Joyent, Inc.
+    Email: mark.cavage@joyent.com
+    URI: http://www.joyent.com
+
+# Appendix A - Test Values
+
+The following test data uses the RSA (2048b) keys, which we will refer
+to as `keyId=Test` in the following samples:
+
+    -----BEGIN PUBLIC KEY-----
+    MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCFENGw33yGihy92pDjZQhl0C3
+    6rPJj+CvfSC8+q28hxA161QFNUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6
+    Z4UMR7EOcpfdUE9Hf3m/hs+FUR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJw
+    oYi+1hqp1fIekaxsyQIDAQAB
+    -----END PUBLIC KEY-----
+
+    -----BEGIN RSA PRIVATE KEY-----
+    MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF
+    NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F
+    UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB
+    AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA
+    QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK
+    kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg
+    f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u
+    412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc
+    mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7
+    kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA
+    gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW
+    G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI
+    7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA==
+    -----END RSA PRIVATE KEY-----
+
+And all examples use this request:
+
+    POST /foo?param=value&pet=dog HTTP/1.1
+    Host: example.com
+    Date: Thu, 05 Jan 2012 21:31:40 GMT
+    Content-Type: application/json
+    Content-MD5: Sd/dVLAcvNLSq16eXua5uQ==
+    Content-Length: 18
+
+    {"hello": "world"}
+
+### Default
+
+The string to sign would be:
+
+    date: Thu, 05 Jan 2012 21:31:40 GMT
+
+The Authorization header would be:
+
+    Authorization: Signature keyId="Test",algorithm="rsa-sha256",signature="ATp0r26dbMIxOopqw0OfABDT7CKMIoENumuruOtarj8n/97Q3htHFYpH8yOSQk3Z5zh8UxUym6FYTb5+A0Nz3NRsXJibnYi7brE/4tx5But9kkFGzG+xpUmimN4c3TMN7OFH//+r8hBf7BT9/GmHDUVZT2JzWGLZES2xDOUuMtA="
+
+### All Headers
+
+Parameterized to include all headers, the string to sign would be (`+ "\n"`
+inserted for readability):
+
+    POST /foo?param=value&pet=dog HTTP/1.1 + "\n"
+    host: example.com + "\n"
+    date: Thu, 05 Jan 2012 21:31:40 GMT + "\n"
+    content-type: application/json + "\n"
+    content-md5: Sd/dVLAcvNLSq16eXua5uQ== + "\n"
+    content-length: 18
+
+The Authorization header would be:
+
+    Authorization: Signature keyId="Test",algorithm="rsa-sha256",headers="request-line host date content-type content-md5 content-length",signature="H/AaTDkJvLELy4i1RujnKlS6dm8QWiJvEpn9cKRMi49kKF+mohZ15z1r+mF+XiKS5kOOscyS83olfBtsVhYjPg2Ei3/D9D4Mvb7bFm9IaLJgYTFFuQCghrKQQFPiqJN320emjHxFowpIm1BkstnEU7lktH/XdXVBo8a6Uteiztw="
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/index.js
new file mode 100755 (executable)
index 0000000..217a5dd
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2011 Joyent, Inc.  All rights reserved.
+
+var parser = require('./parser');
+var signer = require('./signer');
+var verify = require('./verify');
+var util = require('./util');
+
+
+
+///--- API
+
+module.exports = {
+
+  parse: parser.parseRequest,
+  parseRequest: parser.parseRequest,
+
+  sign: signer.signRequest,
+  signRequest: signer.signRequest,
+
+  sshKeyToPEM: util.sshKeyToPEM,
+  sshKeyFingerprint: util.fingerprint,
+  pemToRsaSSHKey: util.pemToRsaSSHKey,
+
+  verify: verify.verifySignature,
+  verifySignature: verify.verifySignature
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/parser.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/parser.js
new file mode 100755 (executable)
index 0000000..fd9ac10
--- /dev/null
@@ -0,0 +1,304 @@
+// Copyright 2012 Joyent, Inc.  All rights reserved.
+
+var assert = require('assert-plus');
+var util = require('util');
+
+
+
+///--- Globals
+
+var Algorithms = {
+  'rsa-sha1': true,
+  'rsa-sha256': true,
+  'rsa-sha512': true,
+  'dsa-sha1': true,
+  'hmac-sha1': true,
+  'hmac-sha256': true,
+  'hmac-sha512': true
+};
+
+var State = {
+  New: 0,
+  Params: 1
+};
+
+var ParamsState = {
+  Name: 0,
+  Quote: 1,
+  Value: 2,
+  Comma: 3
+};
+
+
+
+///--- Specific Errors
+
+function HttpSignatureError(message, caller) {
+  if (Error.captureStackTrace)
+    Error.captureStackTrace(this, caller || HttpSignatureError);
+
+  this.message = message;
+  this.name = caller.name;
+}
+util.inherits(HttpSignatureError, Error);
+
+function ExpiredRequestError(message) {
+  HttpSignatureError.call(this, message, ExpiredRequestError);
+}
+util.inherits(ExpiredRequestError, HttpSignatureError);
+
+
+function InvalidHeaderError(message) {
+  HttpSignatureError.call(this, message, InvalidHeaderError);
+}
+util.inherits(InvalidHeaderError, HttpSignatureError);
+
+
+function InvalidParamsError(message) {
+  HttpSignatureError.call(this, message, InvalidParamsError);
+}
+util.inherits(InvalidParamsError, HttpSignatureError);
+
+
+function MissingHeaderError(message) {
+  HttpSignatureError.call(this, message, MissingHeaderError);
+}
+util.inherits(MissingHeaderError, HttpSignatureError);
+
+
+
+///--- Exported API
+
+module.exports = {
+
+  /**
+   * Parses the 'Authorization' header out of an http.ServerRequest object.
+   *
+   * Note that this API will fully validate the Authorization header, and throw
+   * on any error.  It will not however check the signature, or the keyId format
+   * as those are specific to your environment.  You can use the options object
+   * to pass in extra constraints.
+   *
+   * As a response object you can expect this:
+   *
+   *     {
+   *       "scheme": "Signature",
+   *       "params": {
+   *         "keyId": "foo",
+   *         "algorithm": "rsa-sha256",
+   *         "headers": [
+   *           "date" or "x-date",
+   *           "content-md5"
+   *         ],
+   *         "signature": "base64"
+   *       },
+   *       "signingString": "ready to be passed to crypto.verify()"
+   *     }
+   *
+   * @param {Object} request an http.ServerRequest.
+   * @param {Object} options an optional options object with:
+   *                   - clockSkew: allowed clock skew in seconds (default 300).
+   *                   - headers: required header names (def: date or x-date)
+   *                   - algorithms: algorithms to support (default: all).
+   * @return {Object} parsed out object (see above).
+   * @throws {TypeError} on invalid input.
+   * @throws {InvalidHeaderError} on an invalid Authorization header error.
+   * @throws {InvalidParamsError} if the params in the scheme are invalid.
+   * @throws {MissingHeaderError} if the params indicate a header not present,
+   *                              either in the request headers from the params,
+   *                              or not in the params from a required header
+   *                              in options.
+   * @throws {ExpiredRequestError} if the value of date or x-date exceeds skew.
+   */
+  parseRequest: function parseRequest(request, options) {
+    assert.object(request, 'request');
+    assert.object(request.headers, 'request.headers');
+    if (options === undefined) {
+      options = {};
+    }
+    if (options.headers === undefined) {
+      options.headers = [request.headers['x-date'] ? 'x-date' : 'date'];
+    }
+    assert.object(options, 'options');
+    assert.arrayOfString(options.headers, 'options.headers');
+    assert.optionalNumber(options.clockSkew, 'options.clockSkew');
+
+    if (!request.headers.authorization)
+      throw new MissingHeaderError('no authorization header present in ' +
+                                   'the request');
+
+    options.clockSkew = options.clockSkew || 300;
+
+
+    var i = 0;
+    var state = State.New;
+    var substate = ParamsState.Name;
+    var tmpName = '';
+    var tmpValue = '';
+
+    var parsed = {
+      scheme: '',
+      params: {},
+      signingString: '',
+
+      get algorithm() {
+        return this.params.algorithm.toUpperCase();
+      },
+
+      get keyId() {
+        return this.params.keyId;
+      }
+
+    };
+
+    var authz = request.headers.authorization;
+    for (i = 0; i < authz.length; i++) {
+      var c = authz.charAt(i);
+
+      switch (Number(state)) {
+
+      case State.New:
+        if (c !== ' ') parsed.scheme += c;
+        else state = State.Params;
+        break;
+
+      case State.Params:
+        switch (Number(substate)) {
+
+        case ParamsState.Name:
+          var code = c.charCodeAt(0);
+          // restricted name of A-Z / a-z
+          if ((code >= 0x41 && code <= 0x5a) || // A-Z
+              (code >= 0x61 && code <= 0x7a)) { // a-z
+            tmpName += c;
+          } else if (c === '=') {
+            if (tmpName.length === 0)
+              throw new InvalidHeaderError('bad param format');
+            substate = ParamsState.Quote;
+          } else {
+            throw new InvalidHeaderError('bad param format');
+          }
+          break;
+
+        case ParamsState.Quote:
+          if (c === '"') {
+            tmpValue = '';
+            substate = ParamsState.Value;
+          } else {
+            throw new InvalidHeaderError('bad param format');
+          }
+          break;
+
+        case ParamsState.Value:
+          if (c === '"') {
+            parsed.params[tmpName] = tmpValue;
+            substate = ParamsState.Comma;
+          } else {
+            tmpValue += c;
+          }
+          break;
+
+        case ParamsState.Comma:
+          if (c === ',') {
+            tmpName = '';
+            substate = ParamsState.Name;
+          } else {
+            throw new InvalidHeaderError('bad param format');
+          }
+          break;
+
+        default:
+          throw new Error('Invalid substate');
+        }
+        break;
+
+      default:
+        throw new Error('Invalid substate');
+      }
+
+    }
+
+    if (!parsed.params.headers || parsed.params.headers === '') {
+      if (request.headers['x-date']) {
+        parsed.params.headers = ['x-date'];
+      } else {
+        parsed.params.headers = ['date'];
+      }
+    } else {
+      parsed.params.headers = parsed.params.headers.split(' ');
+    }
+
+    // Minimally validate the parsed object
+    if (!parsed.scheme || parsed.scheme !== 'Signature')
+      throw new InvalidHeaderError('scheme was not "Signature"');
+
+    if (!parsed.params.keyId)
+      throw new InvalidHeaderError('keyId was not specified');
+
+    if (!parsed.params.algorithm)
+      throw new InvalidHeaderError('algorithm was not specified');
+
+    if (!parsed.params.signature)
+      throw new InvalidHeaderError('signature was not specified');
+
+    // Check the algorithm against the official list
+    parsed.params.algorithm = parsed.params.algorithm.toLowerCase();
+    if (!Algorithms[parsed.params.algorithm])
+      throw new InvalidParamsError(parsed.params.algorithm +
+                                   ' is not supported');
+
+    // Build the signingString
+    for (i = 0; i < parsed.params.headers.length; i++) {
+      var h = parsed.params.headers[i].toLowerCase();
+      parsed.params.headers[i] = h;
+
+      if (h !== 'request-line') {
+        var value = request.headers[h];
+        if (!value)
+          throw new MissingHeaderError(h + ' was not in the request');
+        parsed.signingString += h + ': ' + value;
+      } else {
+        parsed.signingString +=
+          request.method + ' ' + request.url + ' HTTP/' + request.httpVersion;
+      }
+
+      if ((i + 1) < parsed.params.headers.length)
+        parsed.signingString += '\n';
+    }
+
+    // Check against the constraints
+    var date;
+    if (request.headers.date || request.headers['x-date']) {
+        if (request.headers['x-date']) {
+          date = new Date(request.headers['x-date']);
+        } else {
+          date = new Date(request.headers.date);
+        }
+      var now = new Date();
+      var skew = Math.abs(now.getTime() - date.getTime());
+
+      if (skew > options.clockSkew * 1000) {
+        throw new ExpiredRequestError('clock skew of ' +
+                                      (skew / 1000) +
+                                      's was greater than ' +
+                                      options.clockSkew + 's');
+      }
+    }
+
+    options.headers.forEach(function (hdr) {
+      // Remember that we already checked any headers in the params
+      // were in the request, so if this passes we're good.
+      if (parsed.params.headers.indexOf(hdr) < 0)
+        throw new MissingHeaderError(hdr + ' was not a signed header');
+    });
+
+    if (options.algorithms) {
+      if (options.algorithms.indexOf(parsed.params.algorithm) === -1)
+        throw new InvalidParamsError(parsed.params.algorithm +
+                                     ' is not a supported algorithm');
+    }
+
+    return parsed;
+  }
+
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/signer.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/signer.js
new file mode 100755 (executable)
index 0000000..3507f4d
--- /dev/null
@@ -0,0 +1,178 @@
+// Copyright 2012 Joyent, Inc.  All rights reserved.
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+var http = require('http');
+
+var sprintf = require('util').format;
+
+
+
+///--- Globals
+
+var Algorithms = {
+  'rsa-sha1': true,
+  'rsa-sha256': true,
+  'rsa-sha512': true,
+  'dsa-sha1': true,
+  'hmac-sha1': true,
+  'hmac-sha256': true,
+  'hmac-sha512': true
+};
+
+var Authorization =
+  'Signature keyId="%s",algorithm="%s",headers="%s",signature="%s"';
+
+
+
+///--- Specific Errors
+
+function MissingHeaderError(message) {
+    this.name = 'MissingHeaderError';
+    this.message = message;
+    this.stack = (new Error()).stack;
+}
+MissingHeaderError.prototype = new Error();
+
+
+function InvalidAlgorithmError(message) {
+    this.name = 'InvalidAlgorithmError';
+    this.message = message;
+    this.stack = (new Error()).stack;
+}
+InvalidAlgorithmError.prototype = new Error();
+
+
+
+///--- Internal Functions
+
+function _pad(val) {
+  if (parseInt(val, 10) < 10) {
+    val = '0' + val;
+  }
+  return val;
+}
+
+
+function _rfc1123() {
+  var date = new Date();
+
+  var months = ['Jan',
+                'Feb',
+                'Mar',
+                'Apr',
+                'May',
+                'Jun',
+                'Jul',
+                'Aug',
+                'Sep',
+                'Oct',
+                'Nov',
+                'Dec'];
+  var days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
+  return days[date.getUTCDay()] + ', ' +
+    _pad(date.getUTCDate()) + ' ' +
+    months[date.getUTCMonth()] + ' ' +
+    date.getUTCFullYear() + ' ' +
+    _pad(date.getUTCHours()) + ':' +
+    _pad(date.getUTCMinutes()) + ':' +
+    _pad(date.getUTCSeconds()) +
+    ' GMT';
+}
+
+
+
+///--- Exported API
+
+module.exports = {
+
+  /**
+   * Adds an 'Authorization' header to an http.ClientRequest object.
+   *
+   * Note that this API will add a Date header if it's not already set. Any
+   * other headers in the options.headers array MUST be present, or this
+   * will throw.
+   *
+   * You shouldn't need to check the return type; it's just there if you want
+   * to be pedantic.
+   *
+   * @param {Object} request an instance of http.ClientRequest.
+   * @param {Object} options signing parameters object:
+   *                   - {String} keyId required.
+   *                   - {String} key required (either a PEM or HMAC key).
+   *                   - {Array} headers optional; defaults to ['date'].
+   *                   - {String} algorithm optional; defaults to 'rsa-sha256'.
+   *                   - {String} httpVersion optional; defaults to '1.1'.
+   * @return {Boolean} true if Authorization (and optionally Date) were added.
+   * @throws {TypeError} on bad parameter types (input).
+   * @throws {InvalidAlgorithmError} if algorithm was bad.
+   * @throws {MissingHeaderError} if a header to be signed was specified but
+   *                              was not present.
+   */
+  signRequest: function signRequest(request, options) {
+    assert.object(request, 'request');
+    assert.object(options, 'options');
+    assert.optionalString(options.algorithm, 'options.algorithm');
+    assert.string(options.keyId, 'options.keyId');
+    assert.optionalArrayOfString(options.headers, 'options.headers');
+    assert.optionalString(options.httpVersion, 'options.httpVersion');
+
+    if (!request.getHeader('Date'))
+      request.setHeader('Date', _rfc1123());
+    if (!options.headers)
+      options.headers = ['date'];
+    if (!options.algorithm)
+      options.algorithm = 'rsa-sha256';
+    if (!options.httpVersion)
+      options.httpVersion = '1.1';
+
+    options.algorithm = options.algorithm.toLowerCase();
+
+    if (!Algorithms[options.algorithm])
+      throw new InvalidAlgorithmError(options.algorithm + ' is not supported');
+
+    var i;
+    var stringToSign = '';
+    for (i = 0; i < options.headers.length; i++) {
+      if (typeof (options.headers[i]) !== 'string')
+        throw new TypeError('options.headers must be an array of Strings');
+
+      var h = options.headers[i].toLowerCase();
+
+      if (h !== 'request-line') {
+        var value = request.getHeader(h);
+        if (!value) {
+          throw new MissingHeaderError(h + ' was not in the request');
+        }
+        stringToSign += h + ': ' + value;
+      } else {
+        stringToSign +=
+          request.method + ' ' + request.path + ' HTTP/' + options.httpVersion;
+      }
+
+      if ((i + 1) < options.headers.length)
+        stringToSign += '\n';
+    }
+
+    var alg = options.algorithm.match(/(hmac|rsa)-(\w+)/);
+    var signature;
+    if (alg[1] === 'hmac') {
+      var hmac = crypto.createHmac(alg[2].toUpperCase(), options.key);
+      hmac.update(stringToSign);
+      signature = hmac.digest('base64');
+    } else {
+      var signer = crypto.createSign(options.algorithm.toUpperCase());
+      signer.update(stringToSign);
+      signature = signer.sign(options.key, 'base64');
+    }
+
+    request.setHeader('Authorization', sprintf(Authorization,
+                                               options.keyId,
+                                               options.algorithm,
+                                               options.headers.join(' '),
+                                               signature));
+
+    return true;
+  }
+
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/util.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/util.js
new file mode 100755 (executable)
index 0000000..e7d915e
--- /dev/null
@@ -0,0 +1,304 @@
+// Copyright 2012 Joyent, Inc.  All rights reserved.
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+
+var asn1 = require('asn1');
+var ctype = require('ctype');
+
+
+
+///--- Helpers
+
+function readNext(buffer, offset) {
+  var len = ctype.ruint32(buffer, 'big', offset);
+  offset += 4;
+
+  var newOffset = offset + len;
+
+  return {
+    data: buffer.slice(offset, newOffset),
+    offset: newOffset
+  };
+}
+
+
+function writeInt(writer, buffer) {
+  writer.writeByte(0x02); // ASN1.Integer
+  writer.writeLength(buffer.length);
+
+  for (var i = 0; i < buffer.length; i++)
+    writer.writeByte(buffer[i]);
+
+  return writer;
+}
+
+
+function rsaToPEM(key) {
+  var buffer;
+  var der;
+  var exponent;
+  var i;
+  var modulus;
+  var newKey = '';
+  var offset = 0;
+  var type;
+  var tmp;
+
+  try {
+    buffer = new Buffer(key.split(' ')[1], 'base64');
+
+    tmp = readNext(buffer, offset);
+    type = tmp.data.toString();
+    offset = tmp.offset;
+
+    if (type !== 'ssh-rsa')
+      throw new Error('Invalid ssh key type: ' + type);
+
+    tmp = readNext(buffer, offset);
+    exponent = tmp.data;
+    offset = tmp.offset;
+
+    tmp = readNext(buffer, offset);
+    modulus = tmp.data;
+  } catch (e) {
+    throw new Error('Invalid ssh key: ' + key);
+  }
+
+  // DER is a subset of BER
+  der = new asn1.BerWriter();
+
+  der.startSequence();
+
+  der.startSequence();
+  der.writeOID('1.2.840.113549.1.1.1');
+  der.writeNull();
+  der.endSequence();
+
+  der.startSequence(0x03); // bit string
+  der.writeByte(0x00);
+
+  // Actual key
+  der.startSequence();
+  writeInt(der, modulus);
+  writeInt(der, exponent);
+  der.endSequence();
+
+  // bit string
+  der.endSequence();
+
+  der.endSequence();
+
+  tmp = der.buffer.toString('base64');
+  for (i = 0; i < tmp.length; i++) {
+    if ((i % 64) === 0)
+      newKey += '\n';
+    newKey += tmp.charAt(i);
+  }
+
+  if (!/\\n$/.test(newKey))
+    newKey += '\n';
+
+  return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
+}
+
+
+function dsaToPEM(key) {
+  var buffer;
+  var offset = 0;
+  var tmp;
+  var der;
+  var newKey = '';
+
+  var type;
+  var p;
+  var q;
+  var g;
+  var y;
+
+  try {
+    buffer = new Buffer(key.split(' ')[1], 'base64');
+
+    tmp = readNext(buffer, offset);
+    type = tmp.data.toString();
+    offset = tmp.offset;
+
+    /* JSSTYLED */
+    if (!/^ssh-ds[as].*/.test(type))
+      throw new Error('Invalid ssh key type: ' + type);
+
+    tmp = readNext(buffer, offset);
+    p = tmp.data;
+    offset = tmp.offset;
+
+    tmp = readNext(buffer, offset);
+    q = tmp.data;
+    offset = tmp.offset;
+
+    tmp = readNext(buffer, offset);
+    g = tmp.data;
+    offset = tmp.offset;
+
+    tmp = readNext(buffer, offset);
+    y = tmp.data;
+  } catch (e) {
+    console.log(e.stack);
+    throw new Error('Invalid ssh key: ' + key);
+  }
+
+  // DER is a subset of BER
+  der = new asn1.BerWriter();
+
+  der.startSequence();
+
+  der.startSequence();
+  der.writeOID('1.2.840.10040.4.1');
+
+  der.startSequence();
+  writeInt(der, p);
+  writeInt(der, q);
+  writeInt(der, g);
+  der.endSequence();
+
+  der.endSequence();
+
+  der.startSequence(0x03); // bit string
+  der.writeByte(0x00);
+  writeInt(der, y);
+  der.endSequence();
+
+  der.endSequence();
+
+  tmp = der.buffer.toString('base64');
+  for (var i = 0; i < tmp.length; i++) {
+    if ((i % 64) === 0)
+      newKey += '\n';
+    newKey += tmp.charAt(i);
+  }
+
+  if (!/\\n$/.test(newKey))
+    newKey += '\n';
+
+  return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
+}
+
+
+///--- API
+
+module.exports = {
+
+  /**
+   * Converts an OpenSSH public key (rsa only) to a PKCS#8 PEM file.
+   *
+   * The intent of this module is to interoperate with OpenSSL only,
+   * specifically the node crypto module's `verify` method.
+   *
+   * @param {String} key an OpenSSH public key.
+   * @return {String} PEM encoded form of the RSA public key.
+   * @throws {TypeError} on bad input.
+   * @throws {Error} on invalid ssh key formatted data.
+   */
+  sshKeyToPEM: function sshKeyToPEM(key) {
+    assert.string(key, 'ssh_key');
+
+    /* JSSTYLED */
+    if (/^ssh-rsa.*/.test(key))
+      return rsaToPEM(key);
+
+    /* JSSTYLED */
+    if (/^ssh-ds[as].*/.test(key))
+      return dsaToPEM(key);
+
+    throw new Error('Only RSA and DSA public keys are allowed');
+  },
+
+
+  /**
+   * Generates an OpenSSH fingerprint from an ssh public key.
+   *
+   * @param {String} key an OpenSSH public key.
+   * @return {String} key fingerprint.
+   * @throws {TypeError} on bad input.
+   * @throws {Error} if what you passed doesn't look like an ssh public key.
+   */
+  fingerprint: function fingerprint(key) {
+    assert.string(key, 'ssh_key');
+
+    var pieces = key.split(' ');
+    if (!pieces || !pieces.length || pieces.length < 2)
+      throw new Error('invalid ssh key');
+
+    var data = new Buffer(pieces[1], 'base64');
+
+    var hash = crypto.createHash('md5');
+    hash.update(data);
+    var digest = hash.digest('hex');
+
+    var fp = '';
+    for (var i = 0; i < digest.length; i++) {
+      if (i && i % 2 === 0)
+        fp += ':';
+
+      fp += digest[i];
+    }
+
+    return fp;
+  },
+
+  /**
+  * Converts a PKGCS#8 PEM file to an OpenSSH public key (rsa)
+  *
+  * The reverse of the above function.
+  */
+  pemToRsaSSHKey: function pemToRsaSSHKey(pem, comment) {
+    assert.equal('string', typeof pem, 'typeof pem');
+
+    // chop off the BEGIN PUBLIC KEY and END PUBLIC KEY portion
+    var cleaned = pem.split('\n').slice(1, -2).join('');
+
+    var buf = new Buffer(cleaned, 'base64');
+
+    var der = new asn1.BerReader(buf);
+
+    der.readSequence();
+    der.readSequence();
+
+    var oid = der.readOID();
+    assert.equal(oid, '1.2.840.113549.1.1.1', 'pem not in RSA format');
+
+    // Null -- XXX this probably isn't good practice
+    der.readByte();
+    der.readByte();
+
+    // bit string sequence
+    der.readSequence(0x03);
+    der.readByte();
+    der.readSequence();
+
+    // modulus
+    assert.equal(der.peek(), asn1.Ber.Integer, 'modulus not an integer');
+    der._offset = der.readLength(der.offset + 1);
+    var modulus = der._buf.slice(der.offset, der.offset + der.length);
+    der._offset += der.length;
+
+    // exponent
+    assert.equal(der.peek(), asn1.Ber.Integer, 'exponent not an integer');
+    der._offset = der.readLength(der.offset + 1);
+    var exponent = der._buf.slice(der.offset, der.offset + der.length);
+    der._offset += der.length;
+
+    // now, make the key
+    var type = new Buffer('ssh-rsa');
+    var buffer = new Buffer(4 + type.length + 4 + modulus.length + 4 + exponent.length);
+    var i = 0;
+    buffer.writeUInt32BE(type.length, i);     i += 4;
+    type.copy(buffer, i);                     i += type.length;
+    buffer.writeUInt32BE(exponent.length, i); i += 4;
+    exponent.copy(buffer, i);                 i += exponent.length;
+    buffer.writeUInt32BE(modulus.length, i);  i += 4;
+    modulus.copy(buffer, i);                  i += modulus.length;
+
+    var s = type.toString() + ' ' + buffer.toString('base64') + ' ' + (comment || '');
+    return s;
+  }
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/verify.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/lib/verify.js
new file mode 100755 (executable)
index 0000000..5bf9589
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright 2011 Joyent, Inc.  All rights reserved.
+
+var assert = require('assert-plus');
+var crypto = require('crypto');
+
+
+
+///--- Exported API
+
+module.exports = {
+
+  /**
+   * Simply wraps up the node crypto operations for you, and returns
+   * true or false.  You are expected to pass in an object that was
+   * returned from `parse()`.
+   *
+   * @param {Object} parsedSignature the object you got from `parse`.
+   * @param {String} key either an RSA private key PEM or HMAC secret.
+   * @return {Boolean} true if valid, false otherwise.
+   * @throws {TypeError} if you pass in bad arguments.
+   */
+  verifySignature: function verifySignature(parsedSignature, key) {
+    assert.object(parsedSignature, 'parsedSignature');
+    assert.string(key, 'key');
+
+    var alg = parsedSignature.algorithm.match(/(HMAC|RSA|DSA)-(\w+)/);
+    if (!alg || alg.length !== 3)
+      throw new TypeError('parsedSignature: unsupported algorithm ' +
+                          parsedSignature.algorithm);
+
+    if (alg[1] === 'HMAC') {
+      var hmac = crypto.createHmac(alg[2].toUpperCase(), key);
+      hmac.update(parsedSignature.signingString);
+      return (hmac.digest('base64') === parsedSignature.params.signature);
+    } else {
+      var verify = crypto.createVerify(alg[0]);
+      verify.update(parsedSignature.signingString);
+      return verify.verify(key, parsedSignature.params.signature, 'base64');
+    }
+  }
+
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
new file mode 100755 (executable)
index 0000000..9b5dcdb
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Mark Cavage, All rights reserved.
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md
new file mode 100755 (executable)
index 0000000..7cebf7a
--- /dev/null
@@ -0,0 +1,50 @@
+node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.
+Currently BER encoding is supported; at some point I'll likely have to do DER.
+
+## Usage
+
+Mostly, if you're *actually* needing to read and write ASN.1, you probably don't
+need this readme to explain what and why.  If you have no idea what ASN.1 is,
+see this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
+
+The source is pretty much self-explanatory, and has read/write methods for the
+common types out there.
+
+### Decoding
+
+The following reads an ASN.1 sequence with a boolean.
+
+    var Ber = require('asn1').Ber;
+
+    var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
+
+    reader.readSequence();
+    console.log('Sequence len: ' + reader.length);
+    if (reader.peek() === Ber.Boolean)
+      console.log(reader.readBoolean());
+
+### Encoding
+
+The following generates the same payload as above.
+
+    var Ber = require('asn1').Ber;
+
+    var writer = new Ber.Writer();
+
+    writer.startSequence();
+    writer.writeBoolean(true);
+    writer.endSequence();
+
+    console.log(writer.buffer);
+
+## Installation
+
+    npm install asn1
+
+## License
+
+MIT.
+
+## Bugs
+
+See <https://github.com/mcavage/node-asn1/issues>.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js
new file mode 100755 (executable)
index 0000000..ff21d4f
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+
+module.exports = {
+
+  newInvalidAsn1Error: function(msg) {
+    var e = new Error();
+    e.name = 'InvalidAsn1Error';
+    e.message = msg || '';
+    return e;
+  }
+
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js
new file mode 100755 (executable)
index 0000000..4fb90ae
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var errors = require('./errors');
+var types = require('./types');
+
+var Reader = require('./reader');
+var Writer = require('./writer');
+
+
+///--- Exports
+
+module.exports = {
+
+  Reader: Reader,
+
+  Writer: Writer
+
+};
+
+for (var t in types) {
+  if (types.hasOwnProperty(t))
+    module.exports[t] = types[t];
+}
+for (var e in errors) {
+  if (errors.hasOwnProperty(e))
+    module.exports[e] = errors[e];
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
new file mode 100755 (executable)
index 0000000..bd3357a
--- /dev/null
@@ -0,0 +1,267 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var assert = require('assert');
+
+var ASN1 = require('./types');
+var errors = require('./errors');
+
+
+///--- Globals
+
+var newInvalidAsn1Error = errors.newInvalidAsn1Error;
+
+
+
+///--- API
+
+function Reader(data) {
+  if (!data || !Buffer.isBuffer(data))
+    throw new TypeError('data must be a node Buffer');
+
+  this._buf = data;
+  this._size = data.length;
+
+  // These hold the "current" state
+  this._len = 0;
+  this._offset = 0;
+
+  var self = this;
+  this.__defineGetter__('length', function() { return self._len; });
+  this.__defineGetter__('offset', function() { return self._offset; });
+  this.__defineGetter__('remain', function() {
+    return self._size - self._offset;
+  });
+  this.__defineGetter__('buffer', function() {
+    return self._buf.slice(self._offset);
+  });
+}
+
+
+/**
+ * Reads a single byte and advances offset; you can pass in `true` to make this
+ * a "peek" operation (i.e., get the byte, but don't advance the offset).
+ *
+ * @param {Boolean} peek true means don't move offset.
+ * @return {Number} the next byte, null if not enough data.
+ */
+Reader.prototype.readByte = function(peek) {
+  if (this._size - this._offset < 1)
+    return null;
+
+  var b = this._buf[this._offset] & 0xff;
+
+  if (!peek)
+    this._offset += 1;
+
+  return b;
+};
+
+
+Reader.prototype.peek = function() {
+  return this.readByte(true);
+};
+
+
+/**
+ * Reads a (potentially) variable length off the BER buffer.  This call is
+ * not really meant to be called directly, as callers have to manipulate
+ * the internal buffer afterwards.
+ *
+ * As a result of this call, you can call `Reader.length`, until the
+ * next thing called that does a readLength.
+ *
+ * @return {Number} the amount of offset to advance the buffer.
+ * @throws {InvalidAsn1Error} on bad ASN.1
+ */
+Reader.prototype.readLength = function(offset) {
+  if (offset === undefined)
+    offset = this._offset;
+
+  if (offset >= this._size)
+    return null;
+
+  var lenB = this._buf[offset++] & 0xff;
+  if (lenB === null)
+    return null;
+
+  if ((lenB & 0x80) == 0x80) {
+    lenB &= 0x7f;
+
+    if (lenB == 0)
+      throw newInvalidAsn1Error('Indefinite length not supported');
+
+    if (lenB > 4)
+      throw newInvalidAsn1Error('encoding too long');
+
+    if (this._size - offset < lenB)
+      return null;
+
+    this._len = 0;
+    for (var i = 0; i < lenB; i++)
+      this._len = (this._len << 8) + (this._buf[offset++] & 0xff);
+
+  } else {
+    // Wasn't a variable length
+    this._len = lenB;
+  }
+
+  return offset;
+};
+
+
+/**
+ * Parses the next sequence in this BER buffer.
+ *
+ * To get the length of the sequence, call `Reader.length`.
+ *
+ * @return {Number} the sequence's tag.
+ */
+Reader.prototype.readSequence = function(tag) {
+  var seq = this.peek();
+  if (seq === null)
+    return null;
+  if (tag !== undefined && tag !== seq)
+    throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+                              ': got 0x' + seq.toString(16));
+
+  var o = this.readLength(this._offset + 1); // stored in `length`
+  if (o === null)
+    return null;
+
+  this._offset = o;
+  return seq;
+};
+
+
+Reader.prototype.readInt = function() {
+  return this._readTag(ASN1.Integer);
+};
+
+
+Reader.prototype.readBoolean = function() {
+  return (this._readTag(ASN1.Boolean) === 0 ? false : true);
+};
+
+
+Reader.prototype.readEnumeration = function() {
+  return this._readTag(ASN1.Enumeration);
+};
+
+
+Reader.prototype.readString = function(tag, retbuf) {
+  if (!tag)
+    tag = ASN1.OctetString;
+
+  var b = this.peek();
+  if (b === null)
+    return null;
+
+  if (b !== tag)
+    throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+                              ': got 0x' + b.toString(16));
+
+  var o = this.readLength(this._offset + 1); // stored in `length`
+
+  if (o === null)
+    return null;
+
+  if (this.length > this._size - o)
+    return null;
+
+  this._offset = o;
+
+  if (this.length === 0)
+    return '';
+
+  var str = this._buf.slice(this._offset, this._offset + this.length);
+  this._offset += this.length;
+
+  return retbuf ? str : str.toString('utf8');
+};
+
+Reader.prototype.readOID = function(tag) {
+  if (!tag)
+    tag = ASN1.OID;
+
+  var b = this.peek();
+  if (b === null)
+    return null;
+
+  if (b !== tag)
+    throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+                              ': got 0x' + b.toString(16));
+
+  var o = this.readLength(this._offset + 1); // stored in `length`
+  if (o === null)
+    return null;
+
+  if (this.length > this._size - o)
+    return null;
+
+  this._offset = o;
+
+  var values = [];
+  var value = 0;
+
+  for (var i = 0; i < this.length; i++) {
+    var byte = this._buf[this._offset++] & 0xff;
+
+    value <<= 7;
+    value += byte & 0x7f;
+    if ((byte & 0x80) == 0) {
+      values.push(value);
+      value = 0;
+    }
+  }
+
+  value = values.shift();
+  values.unshift(value % 40);
+  values.unshift((value / 40) >> 0);
+
+  return values.join('.');
+};
+
+
+Reader.prototype._readTag = function(tag) {
+  assert.ok(tag !== undefined);
+
+  var b = this.peek();
+
+  if (b === null)
+    return null;
+
+  if (b !== tag)
+    throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) +
+                              ': got 0x' + b.toString(16));
+
+  var o = this.readLength(this._offset + 1); // stored in `length`
+  if (o === null)
+    return null;
+
+  if (this.length > 4)
+    throw newInvalidAsn1Error('Integer too long: ' + this.length);
+
+  if (this.length > this._size - o)
+    return null;
+  this._offset = o;
+
+  var fb = this._buf[this._offset++];
+  var value = 0;
+
+  value = fb & 0x7F;
+  for (var i = 1; i < this.length; i++) {
+    value <<= 8;
+    value |= (this._buf[this._offset++] & 0xff);
+  }
+
+  if ((fb & 0x80) == 0x80)
+    value = -value;
+
+  return value;
+};
+
+
+
+///--- Exported API
+
+module.exports = Reader;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js
new file mode 100755 (executable)
index 0000000..8aea000
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+
+module.exports = {
+  EOC: 0,
+  Boolean: 1,
+  Integer: 2,
+  BitString: 3,
+  OctetString: 4,
+  Null: 5,
+  OID: 6,
+  ObjectDescriptor: 7,
+  External: 8,
+  Real: 9, // float
+  Enumeration: 10,
+  PDV: 11,
+  Utf8String: 12,
+  RelativeOID: 13,
+  Sequence: 16,
+  Set: 17,
+  NumericString: 18,
+  PrintableString: 19,
+  T61String: 20,
+  VideotexString: 21,
+  IA5String: 22,
+  UTCTime: 23,
+  GeneralizedTime: 24,
+  GraphicString: 25,
+  VisibleString: 26,
+  GeneralString: 28,
+  UniversalString: 29,
+  CharacterString: 30,
+  BMPString: 31,
+  Constructor: 32,
+  Context: 128
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js
new file mode 100755 (executable)
index 0000000..7b445cc
--- /dev/null
@@ -0,0 +1,317 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var assert = require('assert');
+var ASN1 = require('./types');
+var errors = require('./errors');
+
+
+///--- Globals
+
+var newInvalidAsn1Error = errors.newInvalidAsn1Error;
+
+var DEFAULT_OPTS = {
+  size: 1024,
+  growthFactor: 8
+};
+
+
+///--- Helpers
+
+function merge(from, to) {
+  assert.ok(from);
+  assert.equal(typeof(from), 'object');
+  assert.ok(to);
+  assert.equal(typeof(to), 'object');
+
+  var keys = Object.getOwnPropertyNames(from);
+  keys.forEach(function(key) {
+    if (to[key])
+      return;
+
+    var value = Object.getOwnPropertyDescriptor(from, key);
+    Object.defineProperty(to, key, value);
+  });
+
+  return to;
+}
+
+
+
+///--- API
+
+function Writer(options) {
+  options = merge(DEFAULT_OPTS, options || {});
+
+  this._buf = new Buffer(options.size || 1024);
+  this._size = this._buf.length;
+  this._offset = 0;
+  this._options = options;
+
+  // A list of offsets in the buffer where we need to insert
+  // sequence tag/len pairs.
+  this._seq = [];
+
+  var self = this;
+  this.__defineGetter__('buffer', function() {
+    if (self._seq.length)
+      throw new InvalidAsn1Error(self._seq.length + ' unended sequence(s)');
+
+    return self._buf.slice(0, self._offset);
+  });
+}
+
+
+Writer.prototype.writeByte = function(b) {
+  if (typeof(b) !== 'number')
+    throw new TypeError('argument must be a Number');
+
+  this._ensure(1);
+  this._buf[this._offset++] = b;
+};
+
+
+Writer.prototype.writeInt = function(i, tag) {
+  if (typeof(i) !== 'number')
+    throw new TypeError('argument must be a Number');
+  if (typeof(tag) !== 'number')
+    tag = ASN1.Integer;
+
+  var sz = 4;
+
+  while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000)) &&
+         (sz > 1)) {
+    sz--;
+    i <<= 8;
+  }
+
+  if (sz > 4)
+    throw new InvalidAsn1Error('BER ints cannot be > 0xffffffff');
+
+  this._ensure(2 + sz);
+  this._buf[this._offset++] = tag;
+  this._buf[this._offset++] = sz;
+
+  while (sz-- > 0) {
+    this._buf[this._offset++] = ((i & 0xff000000) >> 24);
+    i <<= 8;
+  }
+
+};
+
+
+Writer.prototype.writeNull = function() {
+  this.writeByte(ASN1.Null);
+  this.writeByte(0x00);
+};
+
+
+Writer.prototype.writeEnumeration = function(i, tag) {
+  if (typeof(i) !== 'number')
+    throw new TypeError('argument must be a Number');
+  if (typeof(tag) !== 'number')
+    tag = ASN1.Enumeration;
+
+  return this.writeInt(i, tag);
+};
+
+
+Writer.prototype.writeBoolean = function(b, tag) {
+  if (typeof(b) !== 'boolean')
+    throw new TypeError('argument must be a Boolean');
+  if (typeof(tag) !== 'number')
+    tag = ASN1.Boolean;
+
+  this._ensure(3);
+  this._buf[this._offset++] = tag;
+  this._buf[this._offset++] = 0x01;
+  this._buf[this._offset++] = b ? 0xff : 0x00;
+};
+
+
+Writer.prototype.writeString = function(s, tag) {
+  if (typeof(s) !== 'string')
+    throw new TypeError('argument must be a string (was: ' + typeof(s) + ')');
+  if (typeof(tag) !== 'number')
+    tag = ASN1.OctetString;
+
+  var len = Buffer.byteLength(s);
+  this.writeByte(tag);
+  this.writeLength(len);
+  if (len) {
+    this._ensure(len);
+    this._buf.write(s, this._offset);
+    this._offset += len;
+  }
+};
+
+
+Writer.prototype.writeBuffer = function(buf, tag) {
+  if (typeof(tag) !== 'number')
+    throw new TypeError('tag must be a number');
+  if (!Buffer.isBuffer(buf))
+    throw new TypeError('argument must be a buffer');
+
+  this.writeByte(tag);
+  this.writeLength(buf.length);
+  this._ensure(buf.length);
+  buf.copy(this._buf, this._offset, 0, buf.length);
+  this._offset += buf.length;
+};
+
+
+Writer.prototype.writeStringArray = function(strings) {
+  if ((!strings instanceof Array))
+    throw new TypeError('argument must be an Array[String]');
+
+  var self = this;
+  strings.forEach(function(s) {
+    self.writeString(s);
+  });
+};
+
+// This is really to solve DER cases, but whatever for now
+Writer.prototype.writeOID = function(s, tag) {
+  if (typeof(s) !== 'string')
+    throw new TypeError('argument must be a string');
+  if (typeof(tag) !== 'number')
+    tag = ASN1.OID;
+
+  if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
+    throw new Error('argument is not a valid OID string');
+
+  function encodeOctet(bytes, octet) {
+    if (octet < 128) {
+        bytes.push(octet);
+    } else if (octet < 16384) {
+        bytes.push((octet >>> 7) | 0x80);
+        bytes.push(octet & 0x7F);
+    } else if (octet < 2097152) {
+      bytes.push((octet >>> 14) | 0x80);
+      bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+      bytes.push(octet & 0x7F);
+    } else if (octet < 268435456) {
+      bytes.push((octet >>> 21) | 0x80);
+      bytes.push(((octet >>> 14) | 0x80) & 0xFF);
+      bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+      bytes.push(octet & 0x7F);
+    } else {
+      bytes.push(((octet >>> 28) | 0x80) & 0xFF);
+      bytes.push(((octet >>> 21) | 0x80) & 0xFF);
+      bytes.push(((octet >>> 14) | 0x80) & 0xFF);
+      bytes.push(((octet >>> 7) | 0x80) & 0xFF);
+      bytes.push(octet & 0x7F);
+    }
+  }
+
+  var tmp = s.split('.');
+  var bytes = [];
+  bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10));
+  tmp.slice(2).forEach(function(b) {
+    encodeOctet(bytes, parseInt(b, 10));
+  });
+
+  var self = this;
+  this._ensure(2 + bytes.length);
+  this.writeByte(tag);
+  this.writeLength(bytes.length);
+  bytes.forEach(function(b) {
+    self.writeByte(b);
+  });
+};
+
+
+Writer.prototype.writeLength = function(len) {
+  if (typeof(len) !== 'number')
+    throw new TypeError('argument must be a Number');
+
+  this._ensure(4);
+
+  if (len <= 0x7f) {
+    this._buf[this._offset++] = len;
+  } else if (len <= 0xff) {
+    this._buf[this._offset++] = 0x81;
+    this._buf[this._offset++] = len;
+  } else if (len <= 0xffff) {
+    this._buf[this._offset++] = 0x82;
+    this._buf[this._offset++] = len >> 8;
+    this._buf[this._offset++] = len;
+  } else if (len <= 0xffffff) {
+    this._shift(start, len, 1);
+    this._buf[this._offset++] = 0x83;
+    this._buf[this._offset++] = len >> 16;
+    this._buf[this._offset++] = len >> 8;
+    this._buf[this._offset++] = len;
+  } else {
+    throw new InvalidAsn1ERror('Length too long (> 4 bytes)');
+  }
+};
+
+Writer.prototype.startSequence = function(tag) {
+  if (typeof(tag) !== 'number')
+    tag = ASN1.Sequence | ASN1.Constructor;
+
+  this.writeByte(tag);
+  this._seq.push(this._offset);
+  this._ensure(3);
+  this._offset += 3;
+};
+
+
+Writer.prototype.endSequence = function() {
+  var seq = this._seq.pop();
+  var start = seq + 3;
+  var len = this._offset - start;
+
+  if (len <= 0x7f) {
+    this._shift(start, len, -2);
+    this._buf[seq] = len;
+  } else if (len <= 0xff) {
+    this._shift(start, len, -1);
+    this._buf[seq] = 0x81;
+    this._buf[seq + 1] = len;
+  } else if (len <= 0xffff) {
+    this._buf[seq] = 0x82;
+    this._buf[seq + 1] = len >> 8;
+    this._buf[seq + 2] = len;
+  } else if (len <= 0xffffff) {
+    this._shift(start, len, 1);
+    this._buf[seq] = 0x83;
+    this._buf[seq + 1] = len >> 16;
+    this._buf[seq + 2] = len >> 8;
+    this._buf[seq + 3] = len;
+  } else {
+    throw new InvalidAsn1Error('Sequence too long');
+  }
+};
+
+
+Writer.prototype._shift = function(start, len, shift) {
+  assert.ok(start !== undefined);
+  assert.ok(len !== undefined);
+  assert.ok(shift);
+
+  this._buf.copy(this._buf, start + shift, start, start + len);
+  this._offset += shift;
+};
+
+Writer.prototype._ensure = function(len) {
+  assert.ok(len);
+
+  if (this._size - this._offset < len) {
+    var sz = this._size * this._options.growthFactor;
+    if (sz - this._offset < len)
+      sz += len;
+
+    var buf = new Buffer(sz);
+
+    this._buf.copy(buf, 0, 0, this._offset);
+    this._buf = buf;
+    this._size = sz;
+  }
+};
+
+
+
+///--- Exported API
+
+module.exports = Writer;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js
new file mode 100755 (executable)
index 0000000..d1766e7
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+// If you have no idea what ASN.1 or BER is, see this:
+// ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc
+
+var Ber = require('./ber/index');
+
+
+
+///--- Exported API
+
+module.exports = {
+
+  Ber: Ber,
+
+  BerReader: Ber.Reader,
+
+  BerWriter: Ber.Writer
+
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json
new file mode 100755 (executable)
index 0000000..ad8294e
--- /dev/null
@@ -0,0 +1,63 @@
+{
+  "author": {
+    "name": "Mark Cavage",
+    "email": "mcavage@gmail.com"
+  },
+  "contributors": [
+    {
+      "name": "David Gwynne",
+      "email": "loki@animata.net"
+    },
+    {
+      "name": "Yunong Xiao",
+      "email": "yunong@joyent.com"
+    }
+  ],
+  "name": "asn1",
+  "description": "Contains parsers and serializers for ASN.1 (currently BER only)",
+  "version": "0.1.11",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/mcavage/node-asn1.git"
+  },
+  "main": "lib/index.js",
+  "engines": {
+    "node": ">=0.4.9"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "tap": "0.1.4"
+  },
+  "scripts": {
+    "pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then  gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
+    "test": "tap ./tst"
+  },
+  "_npmUser": {
+    "name": "mcavage",
+    "email": "mcavage@gmail.com"
+  },
+  "_id": "asn1@0.1.11",
+  "_engineSupported": true,
+  "_npmVersion": "1.1.0-beta-4",
+  "_nodeVersion": "v0.6.6",
+  "_defaultsLoaded": true,
+  "dist": {
+    "shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
+    "tarball": "http://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz"
+  },
+  "maintainers": [
+    {
+      "name": "mcavage",
+      "email": "mcavage@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
+  "_from": "asn1@0.1.11",
+  "_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz",
+  "bugs": {
+    "url": "https://github.com/mcavage/node-asn1/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mcavage/node-asn1"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js
new file mode 100755 (executable)
index 0000000..0b78b47
--- /dev/null
@@ -0,0 +1,172 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var test = require('tap').test;
+
+
+
+///--- Globals
+
+var BerReader;
+
+
+
+///--- Tests
+
+test('load library', function(t) {
+  BerReader = require('../../lib/index').BerReader;
+  t.ok(BerReader);
+  try {
+    new BerReader();
+    t.fail('Should have thrown');
+  } catch (e) {
+    t.ok(e instanceof TypeError, 'Should have been a type error');
+  }
+  t.end();
+});
+
+
+test('read byte', function(t) {
+  var reader = new BerReader(new Buffer([0xde]));
+  t.ok(reader);
+  t.equal(reader.readByte(), 0xde, 'wrong value');
+  t.end();
+});
+
+
+test('read 1 byte int', function(t) {
+  var reader = new BerReader(new Buffer([0x02, 0x01, 0x03]));
+  t.ok(reader);
+  t.equal(reader.readInt(), 0x03, 'wrong value');
+  t.equal(reader.length, 0x01, 'wrong length');
+  t.end();
+});
+
+
+test('read 2 byte int', function(t) {
+  var reader = new BerReader(new Buffer([0x02, 0x02, 0x7e, 0xde]));
+  t.ok(reader);
+  t.equal(reader.readInt(), 0x7ede, 'wrong value');
+  t.equal(reader.length, 0x02, 'wrong length');
+  t.end();
+});
+
+
+test('read 3 byte int', function(t) {
+  var reader = new BerReader(new Buffer([0x02, 0x03, 0x7e, 0xde, 0x03]));
+  t.ok(reader);
+  t.equal(reader.readInt(), 0x7ede03, 'wrong value');
+  t.equal(reader.length, 0x03, 'wrong length');
+  t.end();
+});
+
+
+test('read 4 byte int', function(t) {
+  var reader = new BerReader(new Buffer([0x02, 0x04, 0x7e, 0xde, 0x03, 0x01]));
+  t.ok(reader);
+  t.equal(reader.readInt(), 0x7ede0301, 'wrong value');
+  t.equal(reader.length, 0x04, 'wrong length');
+  t.end();
+});
+
+
+test('read boolean true', function(t) {
+  var reader = new BerReader(new Buffer([0x01, 0x01, 0xff]));
+  t.ok(reader);
+  t.equal(reader.readBoolean(), true, 'wrong value');
+  t.equal(reader.length, 0x01, 'wrong length');
+  t.end();
+});
+
+
+test('read boolean false', function(t) {
+  var reader = new BerReader(new Buffer([0x01, 0x01, 0x00]));
+  t.ok(reader);
+  t.equal(reader.readBoolean(), false, 'wrong value');
+  t.equal(reader.length, 0x01, 'wrong length');
+  t.end();
+});
+
+
+test('read enumeration', function(t) {
+  var reader = new BerReader(new Buffer([0x0a, 0x01, 0x20]));
+  t.ok(reader);
+  t.equal(reader.readEnumeration(), 0x20, 'wrong value');
+  t.equal(reader.length, 0x01, 'wrong length');
+  t.end();
+});
+
+
+test('read string', function(t) {
+  var dn = 'cn=foo,ou=unit,o=test';
+  var buf = new Buffer(dn.length + 2);
+  buf[0] = 0x04;
+  buf[1] = Buffer.byteLength(dn);
+  buf.write(dn, 2);
+  var reader = new BerReader(buf);
+  t.ok(reader);
+  t.equal(reader.readString(), dn, 'wrong value');
+  t.equal(reader.length, dn.length, 'wrong length');
+  t.end();
+});
+
+
+test('read sequence', function(t) {
+  var reader = new BerReader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));
+  t.ok(reader);
+  t.equal(reader.readSequence(), 0x30, 'wrong value');
+  t.equal(reader.length, 0x03, 'wrong length');
+  t.equal(reader.readBoolean(), true, 'wrong value');
+  t.equal(reader.length, 0x01, 'wrong length');
+  t.end();
+});
+
+
+test('anonymous LDAPv3 bind', function(t) {
+  var BIND = new Buffer(14);
+  BIND[0] = 0x30;  // Sequence
+  BIND[1] = 12;    // len
+  BIND[2] = 0x02;  // ASN.1 Integer
+  BIND[3] = 1;     // len
+  BIND[4] = 0x04;  // msgid (make up 4)
+  BIND[5] = 0x60;  // Bind Request
+  BIND[6] = 7;     // len
+  BIND[7] = 0x02;  // ASN.1 Integer
+  BIND[8] = 1;     // len
+  BIND[9] = 0x03;  // v3
+  BIND[10] = 0x04; // String (bind dn)
+  BIND[11] = 0;    // len
+  BIND[12] = 0x80; // ContextSpecific (choice)
+  BIND[13] = 0;    // simple bind
+
+  // Start testing ^^
+  var ber = new BerReader(BIND);
+  t.equal(ber.readSequence(), 48, 'Not an ASN.1 Sequence');
+  t.equal(ber.length, 12, 'Message length should be 12');
+  t.equal(ber.readInt(), 4, 'Message id should have been 4');
+  t.equal(ber.readSequence(), 96, 'Bind Request should have been 96');
+  t.equal(ber.length, 7, 'Bind length should have been 7');
+  t.equal(ber.readInt(), 3, 'LDAP version should have been 3');
+  t.equal(ber.readString(), '', 'Bind DN should have been empty');
+  t.equal(ber.length, 0, 'string length should have been 0');
+  t.equal(ber.readByte(), 0x80, 'Should have been ContextSpecific (choice)');
+  t.equal(ber.readByte(), 0, 'Should have been simple bind');
+  t.equal(null, ber.readByte(), 'Should be out of data');
+  t.end();
+});
+
+
+test('long string', function(t) {
+  var buf = new Buffer(256);
+  var o;
+  var s =
+    '2;649;CN=Red Hat CS 71GA Demo,O=Red Hat CS 71GA Demo,C=US;' +
+    'CN=RHCS Agent - admin01,UID=admin01,O=redhat,C=US [1] This is ' +
+    'Teena Vradmin\'s description.';
+  buf[0] = 0x04;
+  buf[1] = 0x81;
+  buf[2] = 0x94;
+  buf.write(s, 3);
+  var ber = new BerReader(buf.slice(0, 3 + s.length));
+  t.equal(ber.readString(), s);
+  t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js
new file mode 100755 (executable)
index 0000000..add0b9f
--- /dev/null
@@ -0,0 +1,296 @@
+// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
+
+var test = require('tap').test;
+var sys = require('sys');
+
+///--- Globals
+
+var BerWriter;
+
+var BerReader;
+
+
+///--- Tests
+
+test('load library', function(t) {
+  BerWriter = require('../../lib/index').BerWriter;
+  t.ok(BerWriter);
+  t.ok(new BerWriter());
+  t.end();
+});
+
+
+test('write byte', function(t) {
+  var writer = new BerWriter();
+
+  writer.writeByte(0xC2);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 1, 'Wrong length');
+  t.equal(ber[0], 0xC2, 'value wrong');
+
+  t.end();
+});
+
+
+test('write 1 byte int', function(t) {
+  var writer = new BerWriter();
+
+  writer.writeInt(0x7f);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 3, 'Wrong length for an int: ' + ber.length);
+  t.equal(ber[0], 0x02, 'ASN.1 tag wrong (2) -> ' + ber[0]);
+  t.equal(ber[1], 0x01, 'length wrong(1) -> ' + ber[1]);
+  t.equal(ber[2], 0x7f, 'value wrong(3) -> ' + ber[2]);
+
+  t.end();
+});
+
+
+test('write 2 byte int', function(t) {
+  var writer = new BerWriter();
+
+  writer.writeInt(0x7ffe);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 4, 'Wrong length for an int');
+  t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+  t.equal(ber[1], 0x02, 'length wrong');
+  t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
+  t.equal(ber[3], 0xfe, 'value wrong (byte 2)');
+
+  t.end();
+});
+
+
+test('write 3 byte int', function(t) {
+  var writer = new BerWriter();
+
+  writer.writeInt(0x7ffffe);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 5, 'Wrong length for an int');
+  t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+  t.equal(ber[1], 0x03, 'length wrong');
+  t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
+  t.equal(ber[3], 0xff, 'value wrong (byte 2)');
+  t.equal(ber[4], 0xfe, 'value wrong (byte 3)');
+
+  t.end();
+});
+
+
+test('write 4 byte int', function(t) {
+  var writer = new BerWriter();
+
+  writer.writeInt(0x7ffffffe);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+
+  t.equal(ber.length, 6, 'Wrong length for an int');
+  t.equal(ber[0], 0x02, 'ASN.1 tag wrong');
+  t.equal(ber[1], 0x04, 'length wrong');
+  t.equal(ber[2], 0x7f, 'value wrong (byte 1)');
+  t.equal(ber[3], 0xff, 'value wrong (byte 2)');
+  t.equal(ber[4], 0xff, 'value wrong (byte 3)');
+  t.equal(ber[5], 0xfe, 'value wrong (byte 4)');
+
+  t.end();
+});
+
+
+test('write boolean', function(t) {
+  var writer = new BerWriter();
+
+  writer.writeBoolean(true);
+  writer.writeBoolean(false);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 6, 'Wrong length');
+  t.equal(ber[0], 0x01, 'tag wrong');
+  t.equal(ber[1], 0x01, 'length wrong');
+  t.equal(ber[2], 0xff, 'value wrong');
+  t.equal(ber[3], 0x01, 'tag wrong');
+  t.equal(ber[4], 0x01, 'length wrong');
+  t.equal(ber[5], 0x00, 'value wrong');
+
+  t.end();
+});
+
+
+test('write string', function(t) {
+  var writer = new BerWriter();
+  writer.writeString('hello world');
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 13, 'wrong length');
+  t.equal(ber[0], 0x04, 'wrong tag');
+  t.equal(ber[1], 11, 'wrong length');
+  t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value');
+
+  t.end();
+});
+
+test('write buffer', function(t) {
+  var writer = new BerWriter();
+  // write some stuff to start with
+  writer.writeString('hello world');
+  var ber = writer.buffer;
+  var buf = new Buffer([0x04, 0x0b, 0x30, 0x09, 0x02, 0x01, 0x0f, 0x01, 0x01,
+     0xff, 0x01, 0x01, 0xff]);
+  writer.writeBuffer(buf.slice(2, buf.length), 0x04);
+  ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 26, 'wrong length');
+  t.equal(ber[0], 0x04, 'wrong tag');
+  t.equal(ber[1], 11, 'wrong length');
+  t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value');
+  t.equal(ber[13], buf[0], 'wrong tag');
+  t.equal(ber[14], buf[1], 'wrong length');
+  for (var i = 13, j = 0; i < ber.length && j < buf.length; i++, j++) {
+    t.equal(ber[i], buf[j], 'buffer contents not identical');
+  }
+  t.end();
+});
+
+test('write string array', function(t) {
+  var writer = new BerWriter();
+  writer.writeStringArray(['hello world', 'fubar!']);
+  var ber = writer.buffer;
+
+  t.ok(ber);
+
+  t.equal(ber.length, 21, 'wrong length');
+  t.equal(ber[0], 0x04, 'wrong tag');
+  t.equal(ber[1], 11, 'wrong length');
+  t.equal(ber.slice(2, 13).toString('utf8'), 'hello world', 'wrong value');
+
+  t.equal(ber[13], 0x04, 'wrong tag');
+  t.equal(ber[14], 6, 'wrong length');
+  t.equal(ber.slice(15).toString('utf8'), 'fubar!', 'wrong value');
+
+  t.end();
+});
+
+
+test('resize internal buffer', function(t) {
+  var writer = new BerWriter({size: 2});
+  writer.writeString('hello world');
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 13, 'wrong length');
+  t.equal(ber[0], 0x04, 'wrong tag');
+  t.equal(ber[1], 11, 'wrong length');
+  t.equal(ber.slice(2).toString('utf8'), 'hello world', 'wrong value');
+
+  t.end();
+});
+
+
+test('sequence', function(t) {
+  var writer = new BerWriter({size: 25});
+  writer.startSequence();
+  writer.writeString('hello world');
+  writer.endSequence();
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  console.log(ber);
+  t.equal(ber.length, 15, 'wrong length');
+  t.equal(ber[0], 0x30, 'wrong tag');
+  t.equal(ber[1], 13, 'wrong length');
+  t.equal(ber[2], 0x04, 'wrong tag');
+  t.equal(ber[3], 11, 'wrong length');
+  t.equal(ber.slice(4).toString('utf8'), 'hello world', 'wrong value');
+
+  t.end();
+});
+
+
+test('nested sequence', function(t) {
+  var writer = new BerWriter({size: 25});
+  writer.startSequence();
+  writer.writeString('hello world');
+  writer.startSequence();
+  writer.writeString('hello world');
+  writer.endSequence();
+  writer.endSequence();
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 30, 'wrong length');
+  t.equal(ber[0], 0x30, 'wrong tag');
+  t.equal(ber[1], 28, 'wrong length');
+  t.equal(ber[2], 0x04, 'wrong tag');
+  t.equal(ber[3], 11, 'wrong length');
+  t.equal(ber.slice(4, 15).toString('utf8'), 'hello world', 'wrong value');
+  t.equal(ber[15], 0x30, 'wrong tag');
+  t.equal(ber[16], 13, 'wrong length');
+  t.equal(ber[17], 0x04, 'wrong tag');
+  t.equal(ber[18], 11, 'wrong length');
+  t.equal(ber.slice(19, 30).toString('utf8'), 'hello world', 'wrong value');
+
+  t.end();
+});
+
+
+test('LDAP bind message', function(t) {
+  var dn = 'cn=foo,ou=unit,o=test';
+  var writer = new BerWriter();
+  writer.startSequence();
+  writer.writeInt(3);             // msgid = 3
+  writer.startSequence(0x60);     // ldap bind
+  writer.writeInt(3);             // ldap v3
+  writer.writeString(dn);
+  writer.writeByte(0x80);
+  writer.writeByte(0x00);
+  writer.endSequence();
+  writer.endSequence();
+  var ber = writer.buffer;
+
+  t.ok(ber);
+  t.equal(ber.length, 35, 'wrong length (buffer)');
+  t.equal(ber[0], 0x30, 'wrong tag');
+  t.equal(ber[1], 33, 'wrong length');
+  t.equal(ber[2], 0x02, 'wrong tag');
+  t.equal(ber[3], 1, 'wrong length');
+  t.equal(ber[4], 0x03, 'wrong value');
+  t.equal(ber[5], 0x60, 'wrong tag');
+  t.equal(ber[6], 28, 'wrong length');
+  t.equal(ber[7], 0x02, 'wrong tag');
+  t.equal(ber[8], 1, 'wrong length');
+  t.equal(ber[9], 0x03, 'wrong value');
+  t.equal(ber[10], 0x04, 'wrong tag');
+  t.equal(ber[11], dn.length, 'wrong length');
+  t.equal(ber.slice(12, 33).toString('utf8'), dn, 'wrong value');
+  t.equal(ber[33], 0x80, 'wrong tag');
+  t.equal(ber[34], 0x00, 'wrong len');
+
+  t.end();
+});
+
+
+test('Write OID', function(t) {
+  var oid = '1.2.840.113549.1.1.1';
+  var writer = new BerWriter();
+  writer.writeOID(oid);
+
+  var ber = writer.buffer;
+  t.ok(ber);
+  console.log(require('util').inspect(ber));
+  console.log(require('util').inspect(new Buffer([0x06, 0x09, 0x2a, 0x86,
+                                                  0x48, 0x86, 0xf7, 0x0d,
+                                                  0x01, 0x01, 0x01])));
+
+  t.end();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md
new file mode 100755 (executable)
index 0000000..c0c3a53
--- /dev/null
@@ -0,0 +1,126 @@
+# node-assert-plus
+
+This library is a super small wrapper over node's assert module that has two
+things: (1) the ability to disable assertions with the environment variable
+NODE_NDEBUG, and (2) some API wrappers for argument testing.  Like
+`assert.string(myArg, 'myArg')`.  As a simple example, most of my code looks
+like this:
+
+    var assert = require('assert-plus');
+
+    function fooAccount(options, callback) {
+           assert.object(options, 'options');
+               assert.number(options.id, 'options.id);
+               assert.bool(options.isManager, 'options.isManager');
+               assert.string(options.name, 'options.name');
+               assert.arrayOfString(options.email, 'options.email');
+               assert.func(callback, 'callback');
+
+        // Do stuff
+               callback(null, {});
+    }
+
+# API
+
+All methods that *aren't* part of node's core assert API are simply assumed to
+take an argument, and then a string 'name' that's not a message; `AssertionError`
+will be thrown if the assertion fails with a message like:
+
+    AssertionError: foo (string) is required
+       at test (/home/mark/work/foo/foo.js:3:9)
+       at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)
+       at Module._compile (module.js:446:26)
+       at Object..js (module.js:464:10)
+       at Module.load (module.js:353:31)
+       at Function._load (module.js:311:12)
+       at Array.0 (module.js:484:10)
+       at EventEmitter._tickCallback (node.js:190:38)
+
+from:
+
+    function test(foo) {
+           assert.string(foo, 'foo');
+    }
+
+There you go.  You can check that arrays are of a homogenous type with `Arrayof$Type`:
+
+    function test(foo) {
+           assert.arrayOfString(foo, 'foo');
+    }
+
+You can assert IFF an argument is not `undefined` (i.e., an optional arg):
+
+    assert.optionalString(foo, 'foo');
+
+Lastly, you can opt-out of assertion checking altogether by setting the
+environment variable `NODE_NDEBUG=1`.  This is pseudo-useful if you have
+lots of assertions, and don't want to pay `typeof ()` taxes to v8 in
+production.
+
+The complete list of APIs is:
+
+* assert.bool
+* assert.buffer
+* assert.func
+* assert.number
+* assert.object
+* assert.string
+* assert.arrayOfBool
+* assert.arrayOfFunc
+* assert.arrayOfNumber
+* assert.arrayOfObject
+* assert.arrayOfString
+* assert.optionalBool
+* assert.optionalBuffer
+* assert.optionalFunc
+* assert.optionalNumber
+* assert.optionalObject
+* assert.optionalString
+* assert.optionalArrayOfBool
+* assert.optionalArrayOfFunc
+* assert.optionalArrayOfNumber
+* assert.optionalArrayOfObject
+* assert.optionalArrayOfString
+* assert.AssertionError
+* assert.fail
+* assert.ok
+* assert.equal
+* assert.notEqual
+* assert.deepEqual
+* assert.notDeepEqual
+* assert.strictEqual
+* assert.notStrictEqual
+* assert.throws
+* assert.doesNotThrow
+* assert.ifError
+
+# Installation
+
+    npm install assert-plus
+
+## License
+
+The MIT License (MIT)
+Copyright (c) 2012 Mark Cavage
+
+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.
+
+## Bugs
+
+See <https://github.com/mcavage/node-assert-plus/issues>.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
new file mode 100755 (executable)
index 0000000..ff2ba02
--- /dev/null
@@ -0,0 +1,245 @@
+// Copyright (c) 2012, Mark Cavage. All rights reserved.
+
+var assert = require('assert');
+var Stream = require('stream').Stream;
+var util = require('util');
+
+
+
+///--- Globals
+
+var NDEBUG = process.env.NODE_NDEBUG || false;
+var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
+
+
+
+///--- Messages
+
+var ARRAY_TYPE_REQUIRED = '%s ([%s]) required';
+var TYPE_REQUIRED = '%s (%s) is required';
+
+
+
+///--- Internal
+
+function capitalize(str) {
+        return (str.charAt(0).toUpperCase() + str.slice(1));
+}
+
+function uncapitalize(str) {
+        return (str.charAt(0).toLowerCase() + str.slice(1));
+}
+
+function _() {
+        return (util.format.apply(util, arguments));
+}
+
+
+function _assert(arg, type, name, stackFunc) {
+        if (!NDEBUG) {
+                name = name || type;
+                stackFunc = stackFunc || _assert.caller;
+                var t = typeof (arg);
+
+                if (t !== type) {
+                        throw new assert.AssertionError({
+                                message: _(TYPE_REQUIRED, name, type),
+                                actual: t,
+                                expected: type,
+                                operator: '===',
+                                stackStartFunction: stackFunc
+                        });
+                }
+        }
+}
+
+
+function _instanceof(arg, type, name, stackFunc) {
+        if (!NDEBUG) {
+                name = name || type;
+                stackFunc = stackFunc || _instanceof.caller;
+
+                if (!(arg instanceof type)) {
+                        throw new assert.AssertionError({
+                                message: _(TYPE_REQUIRED, name, type.name),
+                                actual: _getClass(arg),
+                                expected: type.name,
+                                operator: 'instanceof',
+                                stackStartFunction: stackFunc
+                        });
+                }
+        }
+}
+
+function _getClass(object) {
+        return (Object.prototype.toString.call(object).slice(8, -1));
+};
+
+
+
+///--- API
+
+function array(arr, type, name) {
+        if (!NDEBUG) {
+                name = name || type;
+
+                if (!Array.isArray(arr)) {
+                        throw new assert.AssertionError({
+                                message: _(ARRAY_TYPE_REQUIRED, name, type),
+                                actual: typeof (arr),
+                                expected: 'array',
+                                operator: 'Array.isArray',
+                                stackStartFunction: array.caller
+                        });
+                }
+
+                for (var i = 0; i < arr.length; i++) {
+                        _assert(arr[i], type, name, array);
+                }
+        }
+}
+
+
+function bool(arg, name) {
+        _assert(arg, 'boolean', name, bool);
+}
+
+
+function buffer(arg, name) {
+        if (!Buffer.isBuffer(arg)) {
+                throw new assert.AssertionError({
+                        message: _(TYPE_REQUIRED, name || '', 'Buffer'),
+                        actual: typeof (arg),
+                        expected: 'buffer',
+                        operator: 'Buffer.isBuffer',
+                        stackStartFunction: buffer
+                });
+        }
+}
+
+
+function func(arg, name) {
+        _assert(arg, 'function', name);
+}
+
+
+function number(arg, name) {
+        _assert(arg, 'number', name);
+        if (!NDEBUG && (isNaN(arg) || !isFinite(arg))) {
+                throw new assert.AssertionError({
+                        message: _(TYPE_REQUIRED, name, 'number'),
+                        actual: arg,
+                        expected: 'number',
+                        operator: 'isNaN',
+                        stackStartFunction: number
+                });
+        }
+}
+
+
+function object(arg, name) {
+        _assert(arg, 'object', name);
+}
+
+
+function stream(arg, name) {
+        _instanceof(arg, Stream, name);
+}
+
+
+function date(arg, name) {
+        _instanceof(arg, Date, name);
+}
+
+function regexp(arg, name) {
+        _instanceof(arg, RegExp, name);
+}
+
+
+function string(arg, name) {
+        _assert(arg, 'string', name);
+}
+
+
+function uuid(arg, name) {
+        string(arg, name);
+        if (!NDEBUG && !UUID_REGEXP.test(arg)) {
+                throw new assert.AssertionError({
+                        message: _(TYPE_REQUIRED, name, 'uuid'),
+                        actual: 'string',
+                        expected: 'uuid',
+                        operator: 'test',
+                        stackStartFunction: uuid
+                });
+        }
+}
+
+
+///--- Exports
+
+module.exports = {
+        bool: bool,
+        buffer: buffer,
+        date: date,
+        func: func,
+        number: number,
+        object: object,
+        regexp: regexp,
+        stream: stream,
+        string: string,
+        uuid: uuid
+};
+
+
+Object.keys(module.exports).forEach(function (k) {
+        if (k === 'buffer')
+                return;
+
+        var name = 'arrayOf' + capitalize(k);
+
+        if (k === 'bool')
+                k = 'boolean';
+        if (k === 'func')
+                k = 'function';
+        module.exports[name] = function (arg, name) {
+                array(arg, k, name);
+        };
+});
+
+Object.keys(module.exports).forEach(function (k) {
+        var _name = 'optional' + capitalize(k);
+        var s = uncapitalize(k.replace('arrayOf', ''));
+        if (s === 'bool')
+                s = 'boolean';
+        if (s === 'func')
+                s = 'function';
+
+        if (k.indexOf('arrayOf') !== -1) {
+          module.exports[_name] = function (arg, name) {
+                  if (!NDEBUG && arg !== undefined) {
+                          array(arg, s, name);
+                  }
+          };
+        } else {
+          module.exports[_name] = function (arg, name) {
+                  if (!NDEBUG && arg !== undefined) {
+                          _assert(arg, s, name);
+                  }
+          };
+        }
+});
+
+
+// Reexport built-in assertions
+Object.keys(assert).forEach(function (k) {
+        if (k === 'AssertionError') {
+                module.exports[k] = assert[k];
+                return;
+        }
+
+        module.exports[k] = function () {
+                if (!NDEBUG) {
+                        assert[k].apply(assert[k], arguments);
+                }
+        };
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json
new file mode 100755 (executable)
index 0000000..1fd6176
--- /dev/null
@@ -0,0 +1,46 @@
+{
+  "author": {
+    "name": "Mark Cavage",
+    "email": "mcavage@gmail.com"
+  },
+  "name": "assert-plus",
+  "description": "Extra assertions on top of node's assert module",
+  "version": "0.1.5",
+  "main": "./assert.js",
+  "devDependencies": {},
+  "optionalDependencies": {},
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/mcavage/node-assert-plus.git"
+  },
+  "engines": {
+    "node": ">=0.8"
+  },
+  "bugs": {
+    "url": "https://github.com/mcavage/node-assert-plus/issues"
+  },
+  "dependencies": {},
+  "_id": "assert-plus@0.1.5",
+  "dist": {
+    "shasum": "ee74009413002d84cec7219c6ac811812e723160",
+    "tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz"
+  },
+  "_from": "assert-plus@^0.1.5",
+  "_npmVersion": "1.3.11",
+  "_npmUser": {
+    "name": "mcavage",
+    "email": "mcavage@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mcavage",
+      "email": "mcavage@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "ee74009413002d84cec7219c6ac811812e723160",
+  "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mcavage/node-assert-plus",
+  "scripts": {}
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG
new file mode 100755 (executable)
index 0000000..426da9e
--- /dev/null
@@ -0,0 +1,78 @@
+This contains tickets fixed in each version release in reverse chronological
+order. There is one ticket per line. Each commits message has the tickets fixed
+in it. The commit message also has the corresponding github issue. i.e. CTYPE-42
+would be issue 42. Each issue can be found at:
+https://github.com/rmustacc/node-ctype/issues/%d.
+
+v0.5.3
+CTYPE-50 Release 0.5.3
+Contributed by Nick Schonning:
+CTYPE-49 Add repository section to package.json
+Contributed by Jonathan Ong:
+CTYPE-48 Create .npmignore
+
+v0.5.2
+CTYPE-46 Release 0.5.2
+CTYPE-45 error in setEndian logic
+
+v0.5.1
+CTYPE-44 Release 0.5.1
+Contributed by Terin Stock:
+CTYPE-41 CTypeParser.writeStruct should return its offset
+Contributed by Terin Stock:
+CTYPE-42 int64_t returns wrong size
+
+v0.5.0
+CTYPE-40 Release 0.5.0
+CTYPE-39 want > 0.6 engine support
+
+v0.4.0
+CTYPE-37 Release v0.4.0
+CTYPE-6 want additional entry point for write
+CTYPE-20 Add 64-bit int support into core parser
+CTYPE-31 Fix bounds errors node/2129
+CTYPE-33 Update copyright holders
+CTYPE-34 ctf.js confuses sign bit.
+CTYPE-35 Make the README more useful for getting started
+CTYPE-36 want manual page on ctio functions
+
+v0.3.1
+CTYPE-29 Release 0.3.1
+CTYPE-28 Want v0.6 npm support
+
+v0.3.0
+CTYPE-27 Release v0.3.0
+CTYPE-26 Want alternate default char behavior
+
+v0.2.1
+CTYPE-25 Release v0.2.1
+CTYPE-24 Writing structs is busted
+
+v0.2.0:
+CTYPE-23 Release v0.2.0
+CTYPE-21 Add support for CTF JSON data
+CTYPE-22 Add Javascriptlint profile
+CTYPE-15 Pull in ctio updates from node/master
+
+v0.1.0:
+CTYPE-18 Bump version to v0.1.0
+CTYPE-17 Fix nested structures
+CTYPE-16 Remove extraneous logging
+CTYPE-14 toAbs64 and toApprox64 are not exported
+
+v0.0.3:
+CTYPE-12 Bump version to v0.0.3
+CTYPE-11 fix typo in wuint64
+CTYPE-10 Integrate jsstyle
+
+v0.0.2:
+CTYPE-8 dump npm version to v0.0.2
+CTYPE-9 want changelog
+CTYPE-7 fix typo in detypes.
+
+v0.0.1:
+CTYPE-5 Missing from NPM registry
+CTYPE-4 int16_t calls wrong read function
+CTYPE-3 API example types are missing quotes as strings
+CTYPE-2 doc missing 64-bit functions
+CTYPE-1 Need license
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE
new file mode 100755 (executable)
index 0000000..22ced3e
--- /dev/null
@@ -0,0 +1,24 @@
+The following license applies to all files unless the file is specified below.
+Each file specified below has its license information embedded in it:
+
+tools/jsstyle
+
+Copyright 2011, Robert Mustacchi. All rights reserved.
+Copyright 2011, Joyent, Inc. All rights reserved.
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/README b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/README
new file mode 100755 (executable)
index 0000000..4efd7ee
--- /dev/null
@@ -0,0 +1,82 @@
+Node-CType is a way to read and write binary data in structured and easy to use
+format. Its name comes from the C header file.
+
+To get started, simply clone the repository or use npm to install it. Once it is
+there, simply require it.
+
+git clone git://github.com/rmustacc/node-ctype
+npm install ctype
+var mod_ctype = require('ctype')
+
+
+There are two APIs that you can use, depending on what abstraction you'd like.
+The low level API let's you read and write individual integers and floats from
+buffers. The higher level API let's you read and write structures of these. To
+illustrate this, let's looks look at how we would read and write a binary
+encoded x,y point.
+
+In C we would define this structure as follows:
+
+typedef struct point {
+       uint16_t        p_x;
+       uint16_t        p_y;
+} point_t;
+
+To read a binary encoded point from a Buffer, we first need to create a CType
+parser (where we specify the endian and other options) and add the typedef.
+
+var parser = new mod_ctype.Parser({ endian: 'big' });
+parser.typedef('point_t', [
+       { x: { type: 'uint16_t' } },
+       { y: { type: 'uint16_t' } }
+]);
+
+From here, given a buffer buf and an offset into it, we can read a point.
+
+var out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);
+console.log(out);
+{ point: { x: 23, y: 42 } }
+
+Another way to get the same information would be to use the low level methods.
+Note that these require you to manually deal with the offset. Here's how we'd
+get the same values of x and y from the buffer.
+
+var x = mod_ctype.ruint16(buf, 'big', 0);
+var y = mod_ctype.ruint16(buf, 'big', 2);
+console.log(x + ', ' + y);
+23, 42
+
+The true power of this API comes from the ability to define and nest typedefs,
+just as you would in C. By default, the following types are defined by default.
+Note that they return a Number, unless indicated otherwise.
+
+    * int8_t
+    * int16_t
+    * int32_t
+    * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
+    * uint8_t
+    * uint16_t
+    * uint32_t
+    * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
+    * float
+    * double
+    * char (either returns a buffer with that character or a uint8_t)
+    * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
+
+
+ctf2json integration:
+
+Node-CType supports consuming the output of ctf2json. Once you read in a JSON file,
+all you have to do to add all the definitions it contains is:
+
+var data, parser;
+data = JSON.parse(parsedJSONData);
+parser = mod_ctype.parseCTF(data, { endian: 'big' });
+
+For more documentation, see the file README.old. Full documentation is in the
+process of being rewritten as a series of manual pages which will be available
+in the repository and online for viewing.
+
+To read the ctio manual page simple run, from the root of the workspace:
+
+man -Mman -s 3ctype ctio
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old
new file mode 100755 (executable)
index 0000000..9326b72
--- /dev/null
@@ -0,0 +1,298 @@
+This library provides a way to read and write binary data.
+
+Node CType is a way to read and write binary data in structured and easy to use
+formats. It's name comes from the header file, though it does not share as much
+with it as it perhaps should.
+
+There are two levels of the API. One is the raw API which everything is built on
+top of, while the other provides a much nicer abstraction and is built entirely
+by using the lower level API. The hope is that the low level API is both clear
+and useful. The low level API gets it's names from stdint.h (a rather
+appropriate source). The lower level API is presented at the end of this
+document.
+
+Standard CType API
+
+The CType interface is presented as a parser object that controls the
+endianness combined with a series of methods to change that value, parse and
+write out buffers, and a way to provide typedefs.  Standard Types
+
+The CType parser supports the following basic types which return Numbers except
+as indicated:
+
+    * int8_t
+    * int16_t
+    * int32_t
+    * int64_t (returns an array where val[0] << 32 + val[1] would be the value)
+    * uint8_t
+    * uint16_t
+    * uint32_t
+    * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)
+    * float
+    * double
+    * char (returns a buffer with just that single character)
+    * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)
+
+Specifying Structs
+
+The CType parser also supports the notion of structs. A struct is an array of
+JSON objects that defines an order of keys which have types and values. One
+would build a struct to represent a point (x,y) as follows:
+
+[
+    { x: { type: 'int16_t' }},
+    { y: { type: 'int16_t' }}
+]
+
+When this is passed into the read routine, it would read the first two bytes
+(as defined by int16_t) to determine the Number to use for X, and then it would
+read the next two bytes to determine the value of Y. When read this could
+return something like:
+
+{
+    x: 42,
+    y: -23
+}
+
+When someone wants to write values, we use the same format as above, but with
+additional value field:
+
+[
+    { x: { type: 'int16_t', value: 42 }},
+    { y: { type: 'int16_t', value: -23 }}
+]
+
+Now, the structure above may be optionally annotated with offsets. This tells
+us to rather than read continuously we should read the given value at the
+specified offset. If an offset is provided, it is is effectively the equivalent
+of lseek(offset, SEEK_SET). Thus, subsequent values will be read from that
+offset and incremented by the appropriate value. As an example:
+
+[
+    { x: { type: 'int16_t' }},
+    { y: { type: 'int16_t', offset: 20 }},
+    { z: { type: 'int16_t' }}
+]
+
+We would read x from the first starting offset given to us, for the sake of
+example, let's assume that's 0. After reading x, the next offset to read from
+would be 2; however, y specifies an offset, thus we jump directly to that
+offset and read y from byte 20. We would then read z from byte 22.
+
+The same offsets may be used when writing values.
+
+Typedef
+
+The basic set of types while covers the basics, is somewhat limiting. To make
+this richer, there is functionality to typedef something like in C. One can use
+typedef to add a new name to an existing type or to define a name to refer to a
+struct. Thus the following are all examples of a typedef:
+
+typedef('size_t', 'uint32_t');
+typedef('ssize_t', 'int32_t');
+typedef('point_t', [
+    { x: { type: 'int16_t' }},
+    { y: { type: 'int16_t' }}
+]);
+
+Once something has been typedef'd it can be used in any of the definitions
+previously shown.
+
+One cannot remove a typedef once created, this is analogous to C.
+
+The set of defined types can be printed with lstypes. The format of this output
+is subject to change, but likely will look something like:
+
+> lstypes();
+{
+    size_t: 'uint32_t',
+    ssize_t: 'int32_t',
+    point_t: [
+        { x: { type: 'int16_t' }},
+        { y: { type: 'int16_t' }}
+    ]
+}
+
+Specifying arrays
+
+Arrays can be specified by appending []s to a type. Arrays must have the size
+specified. The size must be specified and it can be done in one of two ways:
+
+    * An explicit non-zero integer size
+    * A name of a previously declared variable in the struct whose value is a
+      number.
+
+Note, that when using the name of a variable, it should be the string name for
+the key. This is only valid inside structs and the value must be declared
+before the value with the array. The following are examples:
+
+[
+    { ip_addr4: { type: 'uint8_t[4]' }},
+    { len: { type: 'uint32_t' }},
+    { data: { type: 'uint8_t[len]' }}
+]
+
+Arrays are permitted in typedefs; however, they must have a declared integer
+size. The following are examples of valid and invalid arrays:
+
+typedef('path', 'char[1024]'); /* Good */
+typedef('path', 'char[len]');  /* Bad! */
+
+64 bit values:
+
+Unfortunately Javascript represents values with a double, so you lose precision
+and the ability to represent Integers roughly beyond 2^53. To alleviate this, I
+propose the following for returning 64 bit integers when read:
+
+value[2]: Each entry is a 32 bit number which can be reconstructed to the
+original by the following formula:
+
+value[0] << 32 + value[1] (Note this will not work in Javascript)
+
+CTF JSON data:
+
+node-ctype can also handle JSON data that mathces the format described in the
+documentation of the tool ctf2json. Given the JSON data which specifies type
+information, it will transform that into a parser that understands all of the
+types defined inside of it. This is useful for more complicated structures that
+have a lot of typedefs.
+
+Interface overview
+
+The following is the header-file like interface to the parser object:
+
+/*
+ * Create a new instance of the parser. Each parser has its own store of
+ * typedefs and endianness. Conf is an object with the following values:
+ *
+ *      endian          Either 'big' or 'little' do determine the endianness we
+ *                      want to read from or write to.
+ *
+ */
+function CTypeParser(conf);
+
+/*
+ * Parses the CTF JSON data and creates a parser that understands all of those
+ * types.
+ *
+ *     data            Parsed JSON data that maches that CTF JSON
+ *                     specification.
+ *
+ *     conf            The configuration object to create a new CTypeParser
+ *                     from.
+ */
+CTypeParser parseCTF(data, conf);
+
+/*
+ * This is what we were born to do. We read the data from a buffer and return it
+ * in an object whose keys match the values from the object.
+ *
+ *      def             The array definition of the data to read in
+ *
+ *      buffer          The buffer to read data from
+ *
+ *      offset          The offset to start writing to
+ *
+ * Returns an object where each key corresponds to an entry in def and the value
+ * is the read value.
+ */
+Object CTypeParser.readData(<Type Definition>, buffer, offset);
+
+/*
+ * This is the second half of what we were born to do, write out the data
+ * itself.
+ *
+ *      def             The array definition of the data to write out with
+ *                      values
+ *
+ *      buffer          The buffer to write to
+ *
+ *      offset          The offset in the buffer to write to
+ */
+void CTypeParser.writeData(<Type Definition>, buffer, offset);
+
+/*
+ * A user has requested to add a type, let us honor their request. Yet, if their
+ * request doth spurn us, send them unto the Hells which Dante describes.
+ *
+ *      name            The string for the type definition we're adding
+ *
+ *      value           Either a string that is a type/array name or an object
+ *                      that describes a struct.
+ */
+void CTypeParser.prototype.typedef(name, value);
+
+Object CTypeParser.prototype.lstypes();
+
+/*
+ * Get the endian value for the current parser
+ */
+String CTypeParser.prototype.getEndian();
+
+/*
+ * Sets the current endian value for the Parser. If the value is not valid,
+ * throws an Error.
+ *
+ *      endian          Either 'big' or 'little' do determine the endianness we
+ *                      want to read from or write to.
+ *
+ */
+void CTypeParser.protoype.setEndian(String);
+
+/*
+ * Attempts to convert an array of two integers returned from rsint64 / ruint64
+ * into an absolute 64 bit number. If however the value would exceed 2^52 this
+ * will instead throw an error. The mantissa in a double is a 52 bit number and
+ * rather than potentially give you a value that is an approximation this will
+ * error. If you would rather an approximation, please see toApprox64.
+ *
+ *     val             An array of two 32-bit integers
+ */
+Number function toAbs64(val)
+
+/*
+ * Will return the 64 bit value as returned in an array from rsint64 / ruint64
+ * to a value as close as it can. Note that Javascript stores all numbers as a
+ * double and the mantissa only has 52 bits. Thus this version may approximate
+ * the value.
+ *
+ *     val             An array of two 32-bit integers
+ */
+Number function toApprox64(val)
+
+Low Level API
+
+The following function are provided at the low level:
+
+Read unsigned integers from a buffer:
+Number ruint8(buffer, endian, offset);
+Number ruint16(buffer, endian, offset);
+Number ruint32(buffer, endian, offset);
+Number[] ruint64(buffer, endian, offset);
+
+Read signed integers from a buffer:
+Number rsint8(buffer, endian, offset);
+Number rsint16(buffer, endian, offset);
+Number rsint32(buffer, endian, offset);
+Number[] rsint64(buffer, endian, offset);
+
+Read floating point numbers from a buffer:
+Number rfloat(buffer, endian, offset);   /* IEEE-754 Single precision */
+Number rdouble(buffer, endian, offset);  /* IEEE-754 Double precision */
+
+Write unsigned integers to a buffer:
+void wuint8(Number, endian, buffer, offset);
+void wuint16(Number, endian, buffer, offset);
+void wuint32(Number, endian, buffer, offset);
+void wuint64(Number[], endian, buffer, offset);
+
+Write signed integers from a buffer:
+void wsint8(Number, endian, buffer, offset);
+void wsint16(Number, endian, buffer, offset);
+void wsint32(Number, endian, buffer, offset);
+void wsint64(Number[], endian, buffer offset);
+
+Write floating point numbers from a buffer:
+void wfloat(Number, buffer, endian, offset);   /* IEEE-754 Single precision */
+void wdouble(Number, buffer, endian, offset);  /* IEEE-754 Double precision */
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js
new file mode 100755 (executable)
index 0000000..66d5f73
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * ctf.js
+ *
+ * Understand and parse all of the different JSON formats of CTF data and
+ * translate that into a series of node-ctype friendly pieces. The reason for
+ * the abstraction is to handle different changes in the file format.
+ *
+ * We have to be careful here that we don't end up using a name that is already
+ * a built in type.
+ */
+var mod_assert = require('assert');
+var ASSERT = mod_assert.ok;
+
+var ctf_versions = [ '1.0' ];
+var ctf_entries = [ 'integer', 'float', 'typedef', 'struct' ];
+var ctf_deftypes = [ 'int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t',
+    'uint32_t', 'float', 'double' ];
+
+function ctfParseInteger(entry, ctype)
+{
+       var name, sign, len, type;
+
+       name = entry['name'];
+       if (!('signed' in entry['integer']))
+               throw (new Error('Malformed CTF JSON: integer missing ' +
+                   'signed value'));
+
+
+       if (!('length' in entry['integer']))
+               throw (new Error('Malformed CTF JSON: integer missing ' +
+                   'length value'));
+
+       sign = entry['integer']['signed'];
+       len = entry['integer']['length'];
+       type = null;
+
+       if (sign && len == 1)
+               type = 'int8_t';
+       else if (len == 1)
+               type = 'uint8_t';
+       else if (sign && len == 2)
+               type = 'int16_t';
+       else if (len == 2)
+               type = 'uint16_t';
+       else if (sign && len == 4)
+               type = 'int32_t';
+       else if (len == 4)
+               type = 'uint32_t';
+       else if (sign && len == 8)
+               type = 'int64_t';
+       else if (len == 8)
+               type = 'uint64_t';
+
+       if (type === null)
+               throw (new Error('Malformed CTF JSON: integer has ' +
+                   'unsupported length and sign - ' + len + '/' + sign));
+
+       /*
+        * This means that this is the same as one of our built in types. If
+        * that's the case defining it would be an error. So instead of trying
+        * to typedef it, we'll return here.
+        */
+       if (name == type)
+               return;
+
+       if (name == 'char') {
+               ASSERT(type == 'int8_t');
+               return;
+       }
+
+       ctype.typedef(name, type);
+}
+
+function ctfParseFloat(entry, ctype)
+{
+       var name, len;
+
+       name = entry['name'];
+       if (!('length' in entry['float']))
+               throw (new Error('Malformed CTF JSON: float missing ' +
+                   'length value'));
+
+       len = entry['float']['length'];
+       if (len != 4 && len != 8)
+               throw (new Error('Malformed CTF JSON: float has invalid ' +
+                   'length value'));
+
+       if (len == 4) {
+               if (name == 'float')
+                       return;
+               ctype.typedef(name, 'float');
+       } else if (len == 8) {
+               if (name == 'double')
+                       return;
+               ctype.typedef(name, 'double');
+       }
+}
+
+function ctfParseTypedef(entry, ctype)
+{
+       var name, type, ii;
+
+       name = entry['name'];
+       if (typeof (entry['typedef']) != 'string')
+               throw (new Error('Malformed CTF JSON: typedef value in not ' +
+                   'a string'));
+
+       type = entry['typedef'];
+
+       /*
+        * We need to ensure that we're not looking at type that's one of our
+        * built in types. Traditionally in C a uint32_t would be a typedef to
+        * some kind of integer. However, those size types are built ins.
+        */
+       for (ii = 0; ii < ctf_deftypes.length; ii++) {
+               if (name == ctf_deftypes[ii])
+                       return;
+       }
+
+       ctype.typedef(name, type);
+}
+
+function ctfParseStruct(entry, ctype)
+{
+       var name, type, ii, val, index, member, push;
+
+       member = [];
+       if (!Array.isArray(entry['struct']))
+               throw (new Error('Malformed CTF JSON: struct value is not ' +
+                   'an array'));
+
+       for (ii = 0; ii < entry['struct'].length; ii++) {
+               val = entry['struct'][ii];
+               if (!('name' in val))
+                       throw (new Error('Malformed CTF JSON: struct member ' +
+                           'missing name'));
+
+               if (!('type' in val))
+                       throw (new Error('Malformed CTF JSON: struct member ' +
+                           'missing type'));
+
+               if (typeof (val['name']) != 'string')
+                       throw (new Error('Malformed CTF JSON: struct member ' +
+                           'name isn\'t a string'));
+
+               if (typeof (val['type']) != 'string')
+                       throw (new Error('Malformed CTF JSON: struct member ' +
+                           'type isn\'t a string'));
+
+               /*
+                * CTF version 2 specifies array names as <type> [<num>] where
+                * as node-ctype does this as <type>[<num>].
+                */
+               name = val['name'];
+               type = val['type'];
+               index = type.indexOf(' [');
+               if (index != -1) {
+                       type = type.substring(0, index) +
+                           type.substring(index + 1, type.length);
+               }
+               push = {};
+               push[name] = { 'type': type };
+               member.push(push);
+       }
+
+       name = entry['name'];
+       ctype.typedef(name, member);
+}
+
+function ctfParseEntry(entry, ctype)
+{
+       var ii, found;
+
+       if (!('name' in entry))
+               throw (new Error('Malformed CTF JSON: entry missing "name" ' +
+                   'section'));
+
+       for (ii = 0; ii < ctf_entries.length; ii++) {
+               if (ctf_entries[ii] in entry)
+                       found++;
+       }
+
+       if (found === 0)
+               throw (new Error('Malformed CTF JSON: found no entries'));
+
+       if (found >= 2)
+               throw (new Error('Malformed CTF JSON: found more than one ' +
+                   'entry'));
+
+       if ('integer' in entry) {
+               ctfParseInteger(entry, ctype);
+               return;
+       }
+
+       if ('float' in entry) {
+               ctfParseFloat(entry, ctype);
+               return;
+       }
+
+       if ('typedef' in entry) {
+               ctfParseTypedef(entry, ctype);
+               return;
+       }
+
+       if ('struct' in entry) {
+               ctfParseStruct(entry, ctype);
+               return;
+       }
+
+       ASSERT(false, 'shouldn\'t reach here');
+}
+
+function ctfParseJson(json, ctype)
+{
+       var version, ii;
+
+       ASSERT(json);
+       ASSERT(ctype);
+       if (!('metadata' in json))
+               throw (new Error('Invalid CTF JSON: missing metadata section'));
+
+       if (!('ctf2json_version' in json['metadata']))
+               throw (new Error('Invalid CTF JSON: missing ctf2json_version'));
+
+       version = json['metadata']['ctf2json_version'];
+       for (ii = 0; ii < ctf_versions.length; ii++) {
+               if (ctf_versions[ii] == version)
+                       break;
+       }
+
+       if (ii == ctf_versions.length)
+               throw (new Error('Unsuported ctf2json_version: ' + version));
+
+       if (!('data' in json))
+               throw (new Error('Invalid CTF JSON: missing data section'));
+
+       if (!Array.isArray(json['data']))
+               throw (new Error('Malformed CTF JSON: data section is not ' +
+                   'an array'));
+
+       for (ii = 0; ii < json['data'].length; ii++)
+               ctfParseEntry(json['data'][ii], ctype);
+}
+
+exports.ctfParseJson = ctfParseJson;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
new file mode 100755 (executable)
index 0000000..62c5d7b
--- /dev/null
@@ -0,0 +1,1485 @@
+/*
+ * rm - Feb 2011
+ * ctio.js:
+ *
+ * A simple way to read and write simple ctypes. Of course, as you'll find the
+ * code isn't as simple as it might appear. The following types are currently
+ * supported in big and little endian formats:
+ *
+ *     uint8_t                 int8_t
+ *     uint16_t                int16_t
+ *     uint32_t                int32_t
+ *     float (single precision IEEE 754)
+ *     double (double precision IEEE 754)
+ *
+ * This is designed to work in Node and v8. It may in fact work in other
+ * Javascript interpreters (that'd be pretty neat), but it hasn't been tested.
+ * If you find that it does in fact work, that's pretty cool. Try and pass word
+ * back to the original author.
+ *
+ * Note to the reader: If you're tabstop isn't set to 8, parts of this may look
+ * weird.
+ */
+
+/*
+ * Numbers in Javascript have a secret: all numbers must be represented with an
+ * IEEE-754 double. The double has a mantissa with a length of 52 bits with an
+ * implicit one. Thus the range of integers that can be represented is limited
+ * to the size of the mantissa, this makes reading and writing 64-bit integers
+ * difficult, but far from impossible.
+ *
+ * Another side effect of this representation is what happens when you use the
+ * bitwise operators, i.e. shift left, shift right, and, or, etc. In Javascript,
+ * each operand and the result is cast to a signed 32-bit number. However, in
+ * the case of >>> the values are cast to an unsigned number.
+ */
+
+/*
+ * A reminder on endian related issues:
+ *
+ * Big Endian: MSB -> First byte
+ * Little Endian: MSB->Last byte
+ */
+var mod_assert = require('assert');
+
+/*
+ * An 8 bit unsigned integer involves doing no significant work.
+ */
+function ruint8(buffer, endian, offset)
+{
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       return (buffer[offset]);
+}
+
+/*
+ * For 16 bit unsigned numbers we can do all the casting that we want to do.
+ */
+function rgint16(buffer, endian, offset)
+{
+       var val = 0;
+
+       if (endian == 'big') {
+               val = buffer[offset] << 8;
+               val |=  buffer[offset+1];
+       } else {
+               val = buffer[offset];
+               val |= buffer[offset+1] << 8;
+       }
+
+       return (val);
+
+}
+
+function ruint16(buffer, endian, offset)
+{
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 1 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       return (rgint16(buffer, endian, offset));
+}
+
+/*
+ * Because most bitshifting is done using signed numbers, if we would go into
+ * the realm where we use that 32nd bit, we'll end up going into the negative
+ * range. i.e.:
+ * > 200 << 24
+ * -939524096
+ *
+ * Not the value you'd expect. To work around this, we end up having to do some
+ * abuse of the JavaScript standard. in this case, we know that a >>> shift is
+ * defined to cast our value to an *unsigned* 32-bit number. Because of that, we
+ * use that instead to save us some additional math, though it does feel a
+ * little weird and it isn't obvious as to why you woul dwant to do this at
+ * first.
+ */
+function rgint32(buffer, endian, offset)
+{
+       var val = 0;
+
+       if (endian == 'big') {
+               val = buffer[offset+1] << 16;
+               val |= buffer[offset+2] << 8;
+               val |= buffer[offset+3];
+               val = val + (buffer[offset] << 24 >>> 0);
+       } else {
+               val = buffer[offset+2] << 16;
+               val |= buffer[offset+1] << 8;
+               val |= buffer[offset];
+               val = val + (buffer[offset + 3] << 24 >>> 0);
+       }
+
+       return (val);
+}
+
+function ruint32(buffer, endian, offset)
+{
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       return (rgint32(buffer, endian, offset));
+}
+
+/*
+ * Reads a 64-bit unsigned number. The astue observer will note that this
+ * doesn't quite work. Javascript has chosen to only have numbers that can be
+ * represented by a double. A double only has 52 bits of mantissa with an
+ * implicit 1, thus we have up to 53 bits to represent an integer. However, 2^53
+ * doesn't quite give us what we want. Isn't 53 bits enough for anyone? What
+ * could you have possibly wanted to represent that was larger than that? Oh,
+ * maybe a size? You mean we bypassed the 4 GB limit on file sizes, when did
+ * that happen?
+ *
+ * To get around this egregious language issue, we're going to instead construct
+ * an array of two 32 bit unsigned integers. Where arr[0] << 32 + arr[1] would
+ * give the actual number. However, note that the above code probably won't
+ * produce the desired results because of the way Javascript numbers are
+ * doubles.
+ */
+function rgint64(buffer, endian, offset)
+{
+       var val = new Array(2);
+
+       if (endian == 'big') {
+               val[0] = ruint32(buffer, endian, offset);
+               val[1] = ruint32(buffer, endian, offset+4);
+       } else {
+               val[0] = ruint32(buffer, endian, offset+4);
+               val[1] = ruint32(buffer, endian, offset);
+       }
+
+       return (val);
+}
+
+function ruint64(buffer, endian, offset)
+{
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 7 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       return (rgint64(buffer, endian, offset));
+}
+
+
+/*
+ * Signed integer types, yay team! A reminder on how two's complement actually
+ * works. The first bit is the signed bit, i.e. tells us whether or not the
+ * number should be positive or negative. If the two's complement value is
+ * positive, then we're done, as it's equivalent to the unsigned representation.
+ *
+ * Now if the number is positive, you're pretty much done, you can just leverage
+ * the unsigned translations and return those. Unfortunately, negative numbers
+ * aren't quite that straightforward.
+ *
+ * At first glance, one might be inclined to use the traditional formula to
+ * translate binary numbers between the positive and negative values in two's
+ * complement. (Though it doesn't quite work for the most negative value)
+ * Mainly:
+ *  - invert all the bits
+ *  - add one to the result
+ *
+ * Of course, this doesn't quite work in Javascript. Take for example the value
+ * of -128. This could be represented in 16 bits (big-endian) as 0xff80. But of
+ * course, Javascript will do the following:
+ *
+ * > ~0xff80
+ * -65409
+ *
+ * Whoh there, Javascript, that's not quite right. But wait, according to
+ * Javascript that's perfectly correct. When Javascript ends up seeing the
+ * constant 0xff80, it has no notion that it is actually a signed number. It
+ * assumes that we've input the unsigned value 0xff80. Thus, when it does the
+ * binary negation, it casts it into a signed value, (positive 0xff80). Then
+ * when you perform binary negation on that, it turns it into a negative number.
+ *
+ * Instead, we're going to have to use the following general formula, that works
+ * in a rather Javascript friendly way. I'm glad we don't support this kind of
+ * weird numbering scheme in the kernel.
+ *
+ * (BIT-MAX - (unsigned)val + 1) * -1
+ *
+ * The astute observer, may think that this doesn't make sense for 8-bit numbers
+ * (really it isn't necessary for them). However, when you get 16-bit numbers,
+ * you do. Let's go back to our prior example and see how this will look:
+ *
+ * (0xffff - 0xff80 + 1) * -1
+ * (0x007f + 1) * -1
+ * (0x0080) * -1
+ *
+ * Doing it this way ends up allowing us to treat it appropriately in
+ * Javascript. Sigh, that's really quite ugly for what should just be a few bit
+ * shifts, ~ and &.
+ */
+
+/*
+ * Endianness doesn't matter for 8-bit signed values. We could in fact optimize
+ * this case because the more traditional methods work, but for consistency,
+ * we'll keep doing this the same way.
+ */
+function rsint8(buffer, endian, offset)
+{
+       var neg;
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       neg = buffer[offset] & 0x80;
+       if (!neg)
+               return (buffer[offset]);
+
+       return ((0xff - buffer[offset] + 1) * -1);
+}
+
+/*
+ * The 16-bit version requires a bit more effort. In this case, we can leverage
+ * our unsigned code to generate the value we want to return.
+ */
+function rsint16(buffer, endian, offset)
+{
+       var neg, val;
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 1 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = rgint16(buffer, endian, offset);
+       neg = val & 0x8000;
+       if (!neg)
+               return (val);
+
+       return ((0xffff - val + 1) * -1);
+}
+
+/*
+ * We really shouldn't leverage our 32-bit code here and instead utilize the
+ * fact that we know that since these are signed numbers, we can do all the
+ * shifting and binary anding to generate the 32-bit number. But, for
+ * consistency we'll do the same. If we want to do otherwise, we should instead
+ * make the 32 bit unsigned code do the optimization. But as long as there
+ * aren't floats secretly under the hood for that, we /should/ be okay.
+ */
+function rsint32(buffer, endian, offset)
+{
+       var neg, val;
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = rgint32(buffer, endian, offset);
+       neg = val & 0x80000000;
+       if (!neg)
+               return (val);
+
+       return ((0xffffffff - val + 1) * -1);
+}
+
+/*
+ * The signed version of this code suffers from all of the same problems of the
+ * other 64 bit version.
+ */
+function rsint64(buffer, endian, offset)
+{
+       var neg, val;
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = rgint64(buffer, endian, offset);
+       neg = val[0] & 0x80000000;
+
+       if (!neg)
+               return (val);
+
+       val[0] = (0xffffffff - val[0]) * -1;
+       val[1] = (0xffffffff - val[1] + 1) * -1;
+
+       /*
+        * If we had the key 0x8000000000000000, that would leave the lower 32
+        * bits as 0xffffffff, however, since we're goint to add one, that would
+        * actually leave the lower 32-bits as 0x100000000, which would break
+        * our ability to write back a value that we received. To work around
+        * this, if we actually get that value, we're going to bump the upper
+        * portion by 1 and set this to zero.
+        */
+       mod_assert.ok(val[1] <= 0x100000000);
+       if (val[1] == -0x100000000) {
+               val[1] = 0;
+               val[0]--;
+       }
+
+       return (val);
+}
+
+/*
+ * We now move onto IEEE 754: The traditional form for floating point numbers
+ * and what is secretly hiding at the heart of everything in this. I really hope
+ * that someone is actually using this, as otherwise, this effort is probably
+ * going to be more wasted.
+ *
+ * One might be tempted to use parseFloat here, but that wouldn't work at all
+ * for several reasons. Mostly due to the way floats actually work, and
+ * parseFloat only actually works in base 10. I don't see base 10 anywhere near
+ * this file.
+ *
+ * In this case we'll implement the single and double precision versions. The
+ * quadruple precision, while probably useful, wouldn't really be accepted by
+ * Javascript, so let's not even waste our time.
+ *
+ * So let's review how this format looks like. A single precision value is 32
+ * bits and has three parts:
+ *   -  Sign bit
+ *   -  Exponent (Using bias notation)
+ *   -  Mantissa
+ *
+ * |s|eeeeeeee|mmmmmmmmmmmmmmmmmmmmmmmmm|
+ * 31| 30-23  |  22            -       0       |
+ *
+ * The exponent is stored in a biased input. The bias in this case 127.
+ * Therefore, our exponent is equal to the 8-bit value - 127.
+ *
+ * By default, a number is normalized in IEEE, that means that the mantissa has
+ * an implicit one that we don't see. So really the value stored is 1.m.
+ * However, if the exponent is all zeros, then instead we have to shift
+ * everything to the right one and there is no more implicit one.
+ *
+ * Special values:
+ *  - Positive Infinity:
+ *     Sign:           0
+ *     Exponent:       All 1s
+ *     Mantissa:       0
+ *  - Negative Infinity:
+ *     Sign:           1
+ *     Exponent:       All 1s
+ *     Mantissa:       0
+ *  - NaN:
+ *     Sign:           *
+ *     Exponent:       All 1s
+ *     Mantissa:       non-zero
+ *  - Zero:
+ *     Sign:           *
+ *     Exponent:       All 0s
+ *     Mantissa:       0
+ *
+ * In the case of zero, the sign bit determines whether we get a positive or
+ * negative zero. However, since Javascript cannot determine the difference
+ * between the two: i.e. -0 == 0, we just always return 0.
+ *
+ */
+function rfloat(buffer, endian, offset)
+{
+       var bytes = [];
+       var sign, exponent, mantissa, val;
+       var bias = 127;
+       var maxexp = 0xff;
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       /* Normalize the bytes to be in endian order */
+       if (endian == 'big') {
+               bytes[0] = buffer[offset];
+               bytes[1] = buffer[offset+1];
+               bytes[2] = buffer[offset+2];
+               bytes[3] = buffer[offset+3];
+       } else {
+               bytes[3] = buffer[offset];
+               bytes[2] = buffer[offset+1];
+               bytes[1] = buffer[offset+2];
+               bytes[0] = buffer[offset+3];
+       }
+
+       sign = bytes[0] & 0x80;
+       exponent = (bytes[0] & 0x7f) << 1;
+       exponent |= (bytes[1] & 0x80) >>> 7;
+       mantissa = (bytes[1] & 0x7f) << 16;
+       mantissa |= bytes[2] << 8;
+       mantissa |= bytes[3];
+
+       /* Check for special cases before we do general parsing */
+       if (!sign && exponent == maxexp && mantissa === 0)
+               return (Number.POSITIVE_INFINITY);
+
+       if (sign && exponent == maxexp && mantissa === 0)
+               return (Number.NEGATIVE_INFINITY);
+
+       if (exponent == maxexp && mantissa !== 0)
+               return (Number.NaN);
+
+       /*
+        * Javascript really doesn't have support for positive or negative zero.
+        * So we're not going to try and give it to you. That would be just
+        * plain weird. Besides -0 == 0.
+        */
+       if (exponent === 0 && mantissa === 0)
+               return (0);
+
+       /*
+        * Now we can deal with the bias and the determine whether the mantissa
+        * has the implicit one or not.
+        */
+       exponent -= bias;
+       if (exponent == -bias) {
+               exponent++;
+               val = 0;
+       } else {
+               val = 1;
+       }
+
+       val = (val + mantissa * Math.pow(2, -23)) * Math.pow(2, exponent);
+
+       if (sign)
+               val *= -1;
+
+       return (val);
+}
+
+/*
+ * Doubles in IEEE 754 are like their brothers except for a few changes and
+ * increases in size:
+ *   - The exponent is now 11 bits
+ *   - The mantissa is now 52 bits
+ *   - The bias is now 1023
+ *
+ * |s|eeeeeeeeeee|mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm|
+ * 63| 62 - 52   |     51              -                       0     |
+ * 63| 62 - 52   |      51              -                       0     |
+ *
+ * While the size has increased a fair amount, we're going to end up keeping the
+ * same general formula for calculating the final value. As a reminder, this
+ * formula is:
+ *
+ * (-1)^s * (n + m) * 2^(e-b)
+ *
+ * Where:
+ *     s       is the sign bit
+ *     n       is (exponent > 0) ? 1 : 0 -- Determines whether we're normalized
+ *                                          or not
+ *     m       is the mantissa
+ *     e       is the exponent specified
+ *     b       is the bias for the exponent
+ *
+ */
+function rdouble(buffer, endian, offset)
+{
+       var bytes = [];
+       var sign, exponent, mantissa, val, lowmant;
+       var bias = 1023;
+       var maxexp = 0x7ff;
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 7 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       /* Normalize the bytes to be in endian order */
+       if (endian == 'big') {
+               bytes[0] = buffer[offset];
+               bytes[1] = buffer[offset+1];
+               bytes[2] = buffer[offset+2];
+               bytes[3] = buffer[offset+3];
+               bytes[4] = buffer[offset+4];
+               bytes[5] = buffer[offset+5];
+               bytes[6] = buffer[offset+6];
+               bytes[7] = buffer[offset+7];
+       } else {
+               bytes[7] = buffer[offset];
+               bytes[6] = buffer[offset+1];
+               bytes[5] = buffer[offset+2];
+               bytes[4] = buffer[offset+3];
+               bytes[3] = buffer[offset+4];
+               bytes[2] = buffer[offset+5];
+               bytes[1] = buffer[offset+6];
+               bytes[0] = buffer[offset+7];
+       }
+
+       /*
+        * We can construct the exponent and mantissa the same way as we did in
+        * the case of a float, just increase the range of the exponent.
+        */
+       sign = bytes[0] & 0x80;
+       exponent = (bytes[0] & 0x7f) << 4;
+       exponent |= (bytes[1] & 0xf0) >>> 4;
+
+       /*
+        * This is going to be ugly but then again, we're dealing with IEEE 754.
+        * This could probably be done as a node add on in a few lines of C++,
+        * but oh we'll, we've made it this far so let's be native the rest of
+        * the way...
+        *
+        * What we're going to do is break the mantissa into two parts, the
+        * lower 24 bits and the upper 28 bits. We'll multiply the upper 28 bits
+        * by the appropriate power and then add in the lower 24-bits. Not
+        * really that great. It's pretty much a giant kludge to deal with
+        * Javascript eccentricities around numbers.
+        */
+       lowmant = bytes[7];
+       lowmant |= bytes[6] << 8;
+       lowmant |= bytes[5] << 16;
+       mantissa = bytes[4];
+       mantissa |= bytes[3] << 8;
+       mantissa |= bytes[2] << 16;
+       mantissa |= (bytes[1] & 0x0f) << 24;
+       mantissa *= Math.pow(2, 24); /* Equivalent to << 24, but JS compat */
+       mantissa += lowmant;
+
+       /* Check for special cases before we do general parsing */
+       if (!sign && exponent == maxexp && mantissa === 0)
+               return (Number.POSITIVE_INFINITY);
+
+       if (sign && exponent == maxexp && mantissa === 0)
+               return (Number.NEGATIVE_INFINITY);
+
+       if (exponent == maxexp && mantissa !== 0)
+               return (Number.NaN);
+
+       /*
+        * Javascript really doesn't have support for positive or negative zero.
+        * So we're not going to try and give it to you. That would be just
+        * plain weird. Besides -0 == 0.
+        */
+       if (exponent === 0 && mantissa === 0)
+               return (0);
+
+       /*
+        * Now we can deal with the bias and the determine whether the mantissa
+        * has the implicit one or not.
+        */
+       exponent -= bias;
+       if (exponent == -bias) {
+               exponent++;
+               val = 0;
+       } else {
+               val = 1;
+       }
+
+       val = (val + mantissa * Math.pow(2, -52)) * Math.pow(2, exponent);
+
+       if (sign)
+               val *= -1;
+
+       return (val);
+}
+
+/*
+ * Now that we have gone through the pain of reading the individual types, we're
+ * probably going to want some way to write these back. None of this is going to
+ * be good. But since we have Javascript numbers this should certainly be more
+ * interesting. Though we can constrain this end a little bit more in what is
+ * valid. For now, let's go back to our friends the unsigned value.
+ */
+
+/*
+ * Unsigned numbers seem deceptively easy. Here are the general steps and rules
+ * that we are going to take:
+ *   -  If the number is negative, throw an Error
+ *   -  Truncate any floating point portion
+ *   -  Take the modulus of the number in our base
+ *   -  Write it out to the buffer in the endian format requested at the offset
+ */
+
+/*
+ * We have to make sure that the value is a valid integer. This means that it is
+ * non-negative. It has no fractional component and that it does not exceed the
+ * maximum allowed value.
+ *
+ *     value           The number to check for validity
+ *
+ *     max             The maximum value
+ */
+function prepuint(value, max)
+{
+       if (typeof (value) != 'number')
+               throw (new (Error('cannot write a non-number as a number')));
+
+       if (value < 0)
+               throw (new Error('specified a negative value for writing an ' +
+                   'unsigned value'));
+
+       if (value > max)
+               throw (new Error('value is larger than maximum value for ' +
+                   'type'));
+
+       if (Math.floor(value) !== value)
+               throw (new Error('value has a fractional component'));
+
+       return (value);
+}
+
+/*
+ * 8-bit version, classy. We can ignore endianness which is good.
+ */
+function wuint8(value, endian, buffer, offset)
+{
+       var val;
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = prepuint(value, 0xff);
+       buffer[offset] = val;
+}
+
+/*
+ * Pretty much the same as the 8-bit version, just this time we need to worry
+ * about endian related issues.
+ */
+function wgint16(val, endian, buffer, offset)
+{
+       if (endian == 'big') {
+               buffer[offset] = (val & 0xff00) >>> 8;
+               buffer[offset+1] = val & 0x00ff;
+       } else {
+               buffer[offset+1] = (val & 0xff00) >>> 8;
+               buffer[offset] = val & 0x00ff;
+       }
+}
+
+function wuint16(value, endian, buffer, offset)
+{
+       var val;
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 1 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = prepuint(value, 0xffff);
+       wgint16(val, endian, buffer, offset);
+}
+
+/*
+ * The 32-bit version is going to have to be a little different unfortunately.
+ * We can't quite bitshift to get the largest byte, because that would end up
+ * getting us caught by the signed values.
+ *
+ * And yes, we do want to subtract out the lower part by default. This means
+ * that when we do the division, it will be treated as a bit shift and we won't
+ * end up generating a floating point value. If we did generate a floating point
+ * value we'd have to truncate it intelligently, this saves us that problem and
+ * may even be somewhat faster under the hood.
+ */
+function wgint32(val, endian, buffer, offset)
+{
+       if (endian == 'big') {
+               buffer[offset] = (val - (val & 0x00ffffff)) / Math.pow(2, 24);
+               buffer[offset+1] = (val >>> 16) & 0xff;
+               buffer[offset+2] = (val >>> 8) & 0xff;
+               buffer[offset+3] = val & 0xff;
+       } else {
+               buffer[offset+3] = (val - (val & 0x00ffffff)) /
+                   Math.pow(2, 24);
+               buffer[offset+2] = (val >>> 16) & 0xff;
+               buffer[offset+1] = (val >>> 8) & 0xff;
+               buffer[offset] = val & 0xff;
+       }
+}
+
+function wuint32(value, endian, buffer, offset)
+{
+       var val;
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = prepuint(value, 0xffffffff);
+       wgint32(val, endian, buffer, offset);
+}
+
+/*
+ * Unlike the other versions, we expect the value to be in the form of two
+ * arrays where value[0] << 32 + value[1] would result in the value that we
+ * want.
+ */
+function wgint64(value, endian, buffer, offset)
+{
+       if (endian == 'big') {
+               wgint32(value[0], endian, buffer, offset);
+               wgint32(value[1], endian, buffer, offset+4);
+       } else {
+               wgint32(value[0], endian, buffer, offset+4);
+               wgint32(value[1], endian, buffer, offset);
+       }
+}
+
+function wuint64(value, endian, buffer, offset)
+{
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (!(value instanceof Array))
+               throw (new Error('value must be an array'));
+
+       if (value.length != 2)
+               throw (new Error('value must be an array of length 2'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 7 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       prepuint(value[0], 0xffffffff);
+       prepuint(value[1], 0xffffffff);
+       wgint64(value, endian, buffer, offset);
+}
+
+/*
+ * We now move onto our friends in the signed number category. Unlike unsigned
+ * numbers, we're going to have to worry a bit more about how we put values into
+ * arrays. Since we are only worrying about signed 32-bit values, we're in
+ * slightly better shape. Unfortunately, we really can't do our favorite binary
+ * & in this system. It really seems to do the wrong thing. For example:
+ *
+ * > -32 & 0xff
+ * 224
+ *
+ * What's happening above is really: 0xe0 & 0xff = 0xe0. However, the results of
+ * this aren't treated as a signed number. Ultimately a bad thing.
+ *
+ * What we're going to want to do is basically create the unsigned equivalent of
+ * our representation and pass that off to the wuint* functions. To do that
+ * we're going to do the following:
+ *
+ *  - if the value is positive
+ *     we can pass it directly off to the equivalent wuint
+ *  - if the value is negative
+ *     we do the following computation:
+ *     mb + val + 1, where
+ *     mb      is the maximum unsigned value in that byte size
+ *     val     is the Javascript negative integer
+ *
+ *
+ * As a concrete value, take -128. In signed 16 bits this would be 0xff80. If
+ * you do out the computations:
+ *
+ * 0xffff - 128 + 1
+ * 0xffff - 127
+ * 0xff80
+ *
+ * You can then encode this value as the signed version. This is really rather
+ * hacky, but it should work and get the job done which is our goal here.
+ *
+ * Thus the overall flow is:
+ *   -  Truncate the floating point part of the number
+ *   -  We don't have to take the modulus, because the unsigned versions will
+ *     take care of that for us. And we don't have to worry about that
+ *     potentially causing bad things to happen because of sign extension
+ *   -  Pass it off to the appropriate unsigned version, potentially modifying
+ *     the negative portions as necessary.
+ */
+
+/*
+ * A series of checks to make sure we actually have a signed 32-bit number
+ */
+function prepsint(value, max, min)
+{
+       if (typeof (value) != 'number')
+               throw (new (Error('cannot write a non-number as a number')));
+
+       if (value > max)
+               throw (new Error('value larger than maximum allowed value'));
+
+       if (value < min)
+               throw (new Error('value smaller than minimum allowed value'));
+
+       if (Math.floor(value) !== value)
+               throw (new Error('value has a fractional component'));
+
+       return (value);
+}
+
+/*
+ * The 8-bit version of the signed value. Overall, fairly straightforward.
+ */
+function wsint8(value, endian, buffer, offset)
+{
+       var val;
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = prepsint(value, 0x7f, -0x80);
+       if (val >= 0)
+               wuint8(val, endian, buffer, offset);
+       else
+               wuint8(0xff + val + 1, endian, buffer, offset);
+}
+
+/*
+ * The 16-bit version of the signed value. Also, fairly straightforward.
+ */
+function wsint16(value, endian, buffer, offset)
+{
+       var val;
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 1 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = prepsint(value, 0x7fff, -0x8000);
+       if (val >= 0)
+               wgint16(val, endian, buffer, offset);
+       else
+               wgint16(0xffff + val + 1, endian, buffer, offset);
+
+}
+
+/*
+ * We can do this relatively easily by leveraging the code used for 32-bit
+ * unsigned code.
+ */
+function wsint32(value, endian, buffer, offset)
+{
+       var val;
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       val = prepsint(value, 0x7fffffff, -0x80000000);
+       if (val >= 0)
+               wgint32(val, endian, buffer, offset);
+       else
+               wgint32(0xffffffff + val + 1, endian, buffer, offset);
+}
+
+/*
+ * The signed 64 bit integer should by in the same format as when received.
+ * Mainly it should ensure that the value is an array of two integers where
+ * value[0] << 32 + value[1] is the desired number. Furthermore, the two values
+ * need to be equal.
+ */
+function wsint64(value, endian, buffer, offset)
+{
+       var vzpos, vopos;
+       var vals = new Array(2);
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (!(value instanceof Array))
+               throw (new Error('value must be an array'));
+
+       if (value.length != 2)
+               throw (new Error('value must be an array of length 2'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+       if (offset + 7 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       /*
+        * We need to make sure that we have the same sign on both values. The
+        * hokiest way to to do this is to multiply the number by +inf. If we do
+        * this, we'll get either +/-inf depending on the sign of the value.
+        * Once we have this, we can compare it to +inf to see if the number is
+        * positive or not.
+        */
+       vzpos = (value[0] * Number.POSITIVE_INFINITY) ==
+           Number.POSITIVE_INFINITY;
+       vopos = (value[1] * Number.POSITIVE_INFINITY) ==
+           Number.POSITIVE_INFINITY;
+
+       /*
+        * If either of these is zero, then we don't actually need this check.
+        */
+       if (value[0] != 0 && value[1] != 0 && vzpos != vopos)
+               throw (new Error('Both entries in the array must have ' +
+                   'the same sign'));
+
+       /*
+        * Doing verification for a signed 64-bit integer is actually a big
+        * trickier than it appears. We can't quite use our standard techniques
+        * because we need to compare both sets of values. The first value is
+        * pretty straightforward. If the first value is beond the extremes than
+        * we error out. However, the valid range of the second value varies
+        * based on the first one. If the first value is negative, and *not* the
+        * largest negative value, than it can be any integer within the range [
+        * 0, 0xffffffff ]. If it is the largest negative number, it must be
+        * zero.
+        *
+        * If the first number is positive, than it doesn't matter what the
+        * value is. We just simply have to make sure we have a valid positive
+        * integer.
+        */
+       if (vzpos) {
+               prepuint(value[0], 0x7fffffff);
+               prepuint(value[1], 0xffffffff);
+       } else {
+               prepsint(value[0], 0, -0x80000000);
+               prepsint(value[1], 0, -0xffffffff);
+               if (value[0] == -0x80000000 && value[1] != 0)
+                       throw (new Error('value smaller than minimum ' +
+                           'allowed value'));
+       }
+
+       /* Fix negative numbers */
+       if (value[0] < 0 || value[1] < 0) {
+               vals[0] = 0xffffffff - Math.abs(value[0]);
+               vals[1] = 0x100000000 - Math.abs(value[1]);
+               if (vals[1] == 0x100000000) {
+                       vals[1] = 0;
+                       vals[0]++;
+               }
+       } else {
+               vals[0] = value[0];
+               vals[1] = value[1];
+       }
+       wgint64(vals, endian, buffer, offset);
+}
+
+/*
+ * Now we are moving onto the weirder of these, the float and double. For this
+ * we're going to just have to do something that's pretty weird. First off, we
+ * have no way to get at the underlying float representation, at least not
+ * easily. But that doesn't mean we can't figure it out, we just have to use our
+ * heads.
+ *
+ * One might propose to use Number.toString(2). Of course, this is not really
+ * that good, because the ECMAScript 262 v3 Standard says the following Section
+ * 15.7.4.2-Number.prototype.toString (radix):
+ *
+ * If radix is an integer from 2 to 36, but not 10, the result is a string, the
+ * choice of which is implementation-dependent.
+ *
+ * Well that doesn't really help us one bit now does it? We could use the
+ * standard base 10 version of the string, but that's just going to create more
+ * errors as we end up trying to convert it back to a binary value. So, really
+ * this just means we have to be non-lazy and parse the structure intelligently.
+ *
+ * First off, we can do the basic checks: NaN, positive and negative infinity.
+ *
+ * Now that those are done we can work backwards to generate the mantissa and
+ * exponent.
+ *
+ * The first thing we need to do is determine the sign bit, easy to do, check
+ * whether the value is less than 0. And convert the number to its absolute
+ * value representation. Next, we need to determine if the value is less than
+ * one or greater than or equal to one and from there determine what power was
+ * used to get there. What follows is now specific to floats, though the general
+ * ideas behind this will hold for doubles as well, but the exact numbers
+ * involved will change.
+ *
+ * Once we have that power we can determine the exponent and the mantissa. Call
+ * the value that has the number of bits to reach the power ebits. In the
+ * general case they have the following values:
+ *
+ *     exponent        127 + ebits
+ *     mantissa        value * 2^(23 - ebits) & 0x7fffff
+ *
+ * In the case where the value of ebits is <= -127 we are now in the case where
+ * we no longer have normalized numbers. In this case the values take on the
+ * following values:
+ *
+ *     exponent        0
+ *     mantissa        value * 2^149 & 0x7fffff
+ *
+ * Once we have the values for the sign, mantissa, and exponent. We reconstruct
+ * the four bytes as follows:
+ *
+ *     byte0           sign bit and seven most significant bits from the exp
+ *                     sign << 7 | (exponent & 0xfe) >>> 1
+ *
+ *     byte1           lsb from the exponent and 7 top bits from the mantissa
+ *                     (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16
+ *
+ *     byte2           bits 8-15 (zero indexing) from mantissa
+ *                     mantissa & 0xff00 >> 8
+ *
+ *     byte3           bits 0-7 from mantissa
+ *                     mantissa & 0xff
+ *
+ * Once we have this we have to assign them into the buffer in proper endian
+ * order.
+ */
+
+/*
+ * Compute the log base 2 of the value. Now, someone who remembers basic
+ * properties of logarithms will point out that we could use the change of base
+ * formula for logs, and in fact that would be astute, because that's what we'll
+ * do for now. It feels cleaner, albeit it may be less efficient than just
+ * iterating and dividing by 2. We may want to come back and revisit that some
+ * day.
+ */
+function log2(value)
+{
+       return (Math.log(value) / Math.log(2));
+}
+
+/*
+ * Helper to determine the exponent of the number we're looking at.
+ */
+function intexp(value)
+{
+       return (Math.floor(log2(value)));
+}
+
+/*
+ * Helper to determine the exponent of the fractional part of the value.
+ */
+function fracexp(value)
+{
+       return (Math.floor(log2(value)));
+}
+
+function wfloat(value, endian, buffer, offset)
+{
+       var sign, exponent, mantissa, ebits;
+       var bytes = [];
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+
+       if (offset + 3 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       if (isNaN(value)) {
+               sign = 0;
+               exponent = 0xff;
+               mantissa = 23;
+       } else if (value == Number.POSITIVE_INFINITY) {
+               sign = 0;
+               exponent = 0xff;
+               mantissa = 0;
+       } else if (value == Number.NEGATIVE_INFINITY) {
+               sign = 1;
+               exponent = 0xff;
+               mantissa = 0;
+       } else {
+               /* Well we have some work to do */
+
+               /* Thankfully the sign bit is trivial */
+               if (value < 0) {
+                       sign = 1;
+                       value = Math.abs(value);
+               } else {
+                       sign = 0;
+               }
+
+               /* Use the correct function to determine number of bits */
+               if (value < 1)
+                       ebits = fracexp(value);
+               else
+                       ebits = intexp(value);
+
+               /* Time to deal with the issues surrounding normalization */
+               if (ebits <= -127) {
+                       exponent = 0;
+                       mantissa = (value * Math.pow(2, 149)) & 0x7fffff;
+               } else {
+                       exponent = 127 + ebits;
+                       mantissa = value * Math.pow(2, 23 - ebits);
+                       mantissa &= 0x7fffff;
+               }
+       }
+
+       bytes[0] = sign << 7 | (exponent & 0xfe) >>> 1;
+       bytes[1] = (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16;
+       bytes[2] = (mantissa & 0x00ff00) >>> 8;
+       bytes[3] = mantissa & 0x0000ff;
+
+       if (endian == 'big') {
+               buffer[offset] = bytes[0];
+               buffer[offset+1] = bytes[1];
+               buffer[offset+2] = bytes[2];
+               buffer[offset+3] = bytes[3];
+       } else {
+               buffer[offset] = bytes[3];
+               buffer[offset+1] = bytes[2];
+               buffer[offset+2] = bytes[1];
+               buffer[offset+3] = bytes[0];
+       }
+}
+
+/*
+ * Now we move onto doubles. Doubles are similar to floats in pretty much all
+ * ways except that the processing isn't quite as straightforward because we
+ * can't always use shifting, i.e. we have > 32 bit values.
+ *
+ * We're going to proceed in an identical fashion to floats and utilize the same
+ * helper functions. All that really is changing are the specific values that we
+ * use to do the calculations. Thus, to review we have to do the following.
+ *
+ * First get the sign bit and convert the value to its absolute value
+ * representation. Next, we determine the number of bits that we used to get to
+ * the value, branching whether the value is greater than or less than 1. Once
+ * we have that value which we will again call ebits, we have to do the
+ * following in the general case:
+ *
+ *     exponent        1023 + ebits
+ *     mantissa        [value * 2^(52 - ebits)] % 2^52
+ *
+ * In the case where the value of ebits <= -1023 we no longer use normalized
+ * numbers, thus like with floats we have to do slightly different processing:
+ *
+ *     exponent        0
+ *     mantissa        [value * 2^1074] % 2^52
+ *
+ * Once we have determined the sign, exponent and mantissa we can construct the
+ * bytes as follows:
+ *
+ *     byte0           sign bit and seven most significant bits form the exp
+ *                     sign << 7 | (exponent & 0x7f0) >>> 4
+ *
+ *     byte1           Remaining 4 bits from the exponent and the four most
+ *                     significant bits from the mantissa 48-51
+ *                     (exponent & 0x00f) << 4 | mantissa >>> 48
+ *
+ *     byte2           Bits 40-47 from the mantissa
+ *                     (mantissa >>> 40) & 0xff
+ *
+ *     byte3           Bits 32-39 from the mantissa
+ *                     (mantissa >>> 32) & 0xff
+ *
+ *     byte4           Bits 24-31 from the mantissa
+ *                     (mantissa >>> 24) & 0xff
+ *
+ *     byte5           Bits 16-23 from the Mantissa
+ *                     (mantissa >>> 16) & 0xff
+ *
+ *     byte6           Bits 8-15 from the mantissa
+ *                     (mantissa >>> 8) & 0xff
+ *
+ *     byte7           Bits 0-7 from the mantissa
+ *                     mantissa & 0xff
+ *
+ * Now we can't quite do the right shifting that we want in bytes 1 - 3, because
+ * we'll have extended too far and we'll lose those values when we try and do
+ * the shift. Instead we have to use an alternate approach. To try and stay out
+ * of floating point, what we'll do is say that mantissa -= bytes[4-7] and then
+ * divide by 2^32. Once we've done that we can use binary arithmetic. Oof,
+ * that's ugly, but it seems to avoid using floating point (just based on how v8
+ * seems to be optimizing for base 2 arithmetic).
+ */
+function wdouble(value, endian, buffer, offset)
+{
+       var sign, exponent, mantissa, ebits;
+       var bytes = [];
+
+       if (value === undefined)
+               throw (new Error('missing value'));
+
+       if (endian === undefined)
+               throw (new Error('missing endian'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset'));
+
+
+       if (offset + 7 >= buffer.length)
+               throw (new Error('Trying to read beyond buffer length'));
+
+       if (isNaN(value)) {
+               sign = 0;
+               exponent = 0x7ff;
+               mantissa = 23;
+       } else if (value == Number.POSITIVE_INFINITY) {
+               sign = 0;
+               exponent = 0x7ff;
+               mantissa = 0;
+       } else if (value == Number.NEGATIVE_INFINITY) {
+               sign = 1;
+               exponent = 0x7ff;
+               mantissa = 0;
+       } else {
+               /* Well we have some work to do */
+
+               /* Thankfully the sign bit is trivial */
+               if (value < 0) {
+                       sign = 1;
+                       value = Math.abs(value);
+               } else {
+                       sign = 0;
+               }
+
+               /* Use the correct function to determine number of bits */
+               if (value < 1)
+                       ebits = fracexp(value);
+               else
+                       ebits = intexp(value);
+
+               /*
+                * This is a total hack to determine a denormalized value.
+                * Unfortunately, we sometimes do not get a proper value for
+                * ebits, i.e. we lose the values that would get rounded off.
+                *
+                *
+                * The astute observer may wonder why we would be
+                * multiplying by two Math.pows rather than just summing
+                * them. Well, that's to get around a small bug in the
+                * way v8 seems to implement the function. On occasion
+                * doing:
+                *
+                * foo * Math.pow(2, 1023 + 51)
+                *
+                * Causes us to overflow to infinity, where as doing:
+                *
+                * foo * Math.pow(2, 1023) * Math.pow(2, 51)
+                *
+                * Does not cause us to overflow. Go figure.
+                *
+                */
+               if (value <= 2.225073858507201e-308 || ebits <= -1023) {
+                       exponent = 0;
+                       mantissa = value * Math.pow(2, 1023) * Math.pow(2, 51);
+                       mantissa %= Math.pow(2, 52);
+               } else {
+                       /*
+                        * We might have gotten fucked by our floating point
+                        * logarithm magic. This is rather crappy, but that's
+                        * our luck. If we just had a log base 2 or access to
+                        * the stupid underlying representation this would have
+                        * been much easier and we wouldn't have such stupid
+                        * kludges or hacks.
+                        */
+                       if (ebits > 1023)
+                               ebits = 1023;
+                       exponent = 1023 + ebits;
+                       mantissa = value * Math.pow(2, -ebits);
+                       mantissa *= Math.pow(2, 52);
+                       mantissa %= Math.pow(2, 52);
+               }
+       }
+
+       /* Fill the bytes in backwards to deal with the size issues */
+       bytes[7] = mantissa & 0xff;
+       bytes[6] = (mantissa >>> 8) & 0xff;
+       bytes[5] = (mantissa >>> 16) & 0xff;
+       mantissa = (mantissa - (mantissa & 0xffffff)) / Math.pow(2, 24);
+       bytes[4] = mantissa & 0xff;
+       bytes[3] = (mantissa >>> 8) & 0xff;
+       bytes[2] = (mantissa >>> 16) & 0xff;
+       bytes[1] = (exponent & 0x00f) << 4 | mantissa >>> 24;
+       bytes[0] = (sign << 7) | (exponent & 0x7f0) >>> 4;
+
+       if (endian == 'big') {
+               buffer[offset] = bytes[0];
+               buffer[offset+1] = bytes[1];
+               buffer[offset+2] = bytes[2];
+               buffer[offset+3] = bytes[3];
+               buffer[offset+4] = bytes[4];
+               buffer[offset+5] = bytes[5];
+               buffer[offset+6] = bytes[6];
+               buffer[offset+7] = bytes[7];
+       } else {
+               buffer[offset+7] = bytes[0];
+               buffer[offset+6] = bytes[1];
+               buffer[offset+5] = bytes[2];
+               buffer[offset+4] = bytes[3];
+               buffer[offset+3] = bytes[4];
+               buffer[offset+2] = bytes[5];
+               buffer[offset+1] = bytes[6];
+               buffer[offset] = bytes[7];
+       }
+}
+
+/*
+ * Actually export our work above. One might argue that we shouldn't expose
+ * these interfaces and just force people to use the higher level abstractions
+ * around this work. However, unlike say other libraries we've come across, this
+ * interface has several properties: it makes sense, it's simple, and it's
+ * useful.
+ */
+exports.ruint8 = ruint8;
+exports.ruint16 = ruint16;
+exports.ruint32 = ruint32;
+exports.ruint64 = ruint64;
+exports.wuint8 = wuint8;
+exports.wuint16 = wuint16;
+exports.wuint32 = wuint32;
+exports.wuint64 = wuint64;
+
+exports.rsint8 = rsint8;
+exports.rsint16 = rsint16;
+exports.rsint32 = rsint32;
+exports.rsint64 = rsint64;
+exports.wsint8 = wsint8;
+exports.wsint16 = wsint16;
+exports.wsint32 = wsint32;
+exports.wsint64 = wsint64;
+
+exports.rfloat = rfloat;
+exports.rdouble = rdouble;
+exports.wfloat = wfloat;
+exports.wdouble = wdouble;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js
new file mode 100755 (executable)
index 0000000..7d2f4a5
--- /dev/null
@@ -0,0 +1,944 @@
+/*
+ * rm - Feb 2011
+ * ctype.js
+ *
+ * This module provides a simple abstraction towards reading and writing
+ * different types of binary data. It is designed to use ctio.js and provide a
+ * richer and more expressive API on top of it.
+ *
+ * By default we support the following as built in basic types:
+ *     int8_t
+ *     int16_t
+ *     int32_t
+ *     uint8_t
+ *     uint16_t
+ *     uint32_t
+ *     uint64_t
+ *     float
+ *     double
+ *     char
+ *     char[]
+ *
+ * Each type is returned as a Number, with the exception of char and char[]
+ * which are returned as Node Buffers. A char is considered a uint8_t.
+ *
+ * Requests to read and write data are specified as an array of JSON objects.
+ * This is also the same way that one declares structs. Even if just a single
+ * value is requested, it must be done as a struct. The array order determines
+ * the order that we try and read values. Each entry has the following format
+ * with values marked with a * being optional.
+ *
+ * { key: { type: /type/, value*: /value/, offset*: /offset/ }
+ *
+ * If offset is defined, we lseek(offset, SEEK_SET) before reading the next
+ * value. Value is defined when we're writing out data, otherwise it's ignored.
+ *
+ */
+
+var mod_ctf = require('./ctf.js');
+var mod_ctio = require('./ctio.js');
+var mod_assert = require('assert');
+
+/*
+ * This is the set of basic types that we support.
+ *
+ *     read            The function to call to read in a value from a buffer
+ *
+ *     write           The function to call to write a value to a buffer
+ *
+ */
+var deftypes = {
+    'uint8_t':  { read: ctReadUint8, write: ctWriteUint8 },
+    'uint16_t': { read: ctReadUint16, write: ctWriteUint16 },
+    'uint32_t': { read: ctReadUint32, write: ctWriteUint32 },
+    'uint64_t': { read: ctReadUint64, write: ctWriteUint64 },
+    'int8_t': { read: ctReadSint8, write: ctWriteSint8 },
+    'int16_t': { read: ctReadSint16, write: ctWriteSint16 },
+    'int32_t': { read: ctReadSint32, write: ctWriteSint32 },
+    'int64_t': { read: ctReadSint64, write: ctWriteSint64 },
+    'float': { read: ctReadFloat, write: ctWriteFloat },
+    'double': { read: ctReadDouble, write: ctWriteDouble },
+    'char': { read: ctReadChar, write: ctWriteChar },
+    'char[]': { read: ctReadCharArray, write: ctWriteCharArray }
+};
+
+/*
+ * The following are wrappers around the CType IO low level API. They encode
+ * knowledge about the size and return something in the expected format.
+ */
+function ctReadUint8(endian, buffer, offset)
+{
+       var val = mod_ctio.ruint8(buffer, endian, offset);
+       return ({ value: val, size: 1 });
+}
+
+function ctReadUint16(endian, buffer, offset)
+{
+       var val = mod_ctio.ruint16(buffer, endian, offset);
+       return ({ value: val, size: 2 });
+}
+
+function ctReadUint32(endian, buffer, offset)
+{
+       var val = mod_ctio.ruint32(buffer, endian, offset);
+       return ({ value: val, size: 4 });
+}
+
+function ctReadUint64(endian, buffer, offset)
+{
+       var val = mod_ctio.ruint64(buffer, endian, offset);
+       return ({ value: val, size: 8 });
+}
+
+function ctReadSint8(endian, buffer, offset)
+{
+       var val = mod_ctio.rsint8(buffer, endian, offset);
+       return ({ value: val, size: 1 });
+}
+
+function ctReadSint16(endian, buffer, offset)
+{
+       var val = mod_ctio.rsint16(buffer, endian, offset);
+       return ({ value: val, size: 2 });
+}
+
+function ctReadSint32(endian, buffer, offset)
+{
+       var val = mod_ctio.rsint32(buffer, endian, offset);
+       return ({ value: val, size: 4 });
+}
+
+function ctReadSint64(endian, buffer, offset)
+{
+       var val = mod_ctio.rsint64(buffer, endian, offset);
+       return ({ value: val, size: 8 });
+}
+
+function ctReadFloat(endian, buffer, offset)
+{
+       var val = mod_ctio.rfloat(buffer, endian, offset);
+       return ({ value: val, size: 4 });
+}
+
+function ctReadDouble(endian, buffer, offset)
+{
+       var val = mod_ctio.rdouble(buffer, endian, offset);
+       return ({ value: val, size: 8 });
+}
+
+/*
+ * Reads a single character into a node buffer
+ */
+function ctReadChar(endian, buffer, offset)
+{
+       var res = new Buffer(1);
+       res[0] = mod_ctio.ruint8(buffer, endian, offset);
+       return ({ value: res, size: 1 });
+}
+
+function ctReadCharArray(length, endian, buffer, offset)
+{
+       var ii;
+       var res = new Buffer(length);
+
+       for (ii = 0; ii < length; ii++)
+               res[ii] = mod_ctio.ruint8(buffer, endian, offset + ii);
+
+       return ({ value: res, size: length });
+}
+
+function ctWriteUint8(value, endian, buffer, offset)
+{
+       mod_ctio.wuint8(value, endian, buffer, offset);
+       return (1);
+}
+
+function ctWriteUint16(value, endian, buffer, offset)
+{
+       mod_ctio.wuint16(value, endian, buffer, offset);
+       return (2);
+}
+
+function ctWriteUint32(value, endian, buffer, offset)
+{
+       mod_ctio.wuint32(value, endian, buffer, offset);
+       return (4);
+}
+
+function ctWriteUint64(value, endian, buffer, offset)
+{
+       mod_ctio.wuint64(value, endian, buffer, offset);
+       return (8);
+}
+
+function ctWriteSint8(value, endian, buffer, offset)
+{
+       mod_ctio.wsint8(value, endian, buffer, offset);
+       return (1);
+}
+
+function ctWriteSint16(value, endian, buffer, offset)
+{
+       mod_ctio.wsint16(value, endian, buffer, offset);
+       return (2);
+}
+
+function ctWriteSint32(value, endian, buffer, offset)
+{
+       mod_ctio.wsint32(value, endian, buffer, offset);
+       return (4);
+}
+
+function ctWriteSint64(value, endian, buffer, offset)
+{
+       mod_ctio.wsint64(value, endian, buffer, offset);
+       return (8);
+}
+
+function ctWriteFloat(value, endian, buffer, offset)
+{
+       mod_ctio.wfloat(value, endian, buffer, offset);
+       return (4);
+}
+
+function ctWriteDouble(value, endian, buffer, offset)
+{
+       mod_ctio.wdouble(value, endian, buffer, offset);
+       return (8);
+}
+
+/*
+ * Writes a single character into a node buffer
+ */
+function ctWriteChar(value, endian, buffer, offset)
+{
+       if (!(value instanceof Buffer))
+               throw (new Error('Input must be a buffer'));
+
+       mod_ctio.ruint8(value[0], endian, buffer, offset);
+       return (1);
+}
+
+/*
+ * We're going to write 0s into the buffer if the string is shorter than the
+ * length of the array.
+ */
+function ctWriteCharArray(value, length, endian, buffer, offset)
+{
+       var ii;
+
+       if (!(value instanceof Buffer))
+               throw (new Error('Input must be a buffer'));
+
+       if (value.length > length)
+               throw (new Error('value length greater than array length'));
+
+       for (ii = 0; ii < value.length && ii < length; ii++)
+               mod_ctio.wuint8(value[ii], endian, buffer, offset + ii);
+
+       for (; ii < length; ii++)
+               mod_ctio.wuint8(0, endian, offset + ii);
+
+
+       return (length);
+}
+
+/*
+ * Each parser has their own set of types. We want to make sure that they each
+ * get their own copy as they may need to modify it.
+ */
+function ctGetBasicTypes()
+{
+       var ret = {};
+       var key;
+       for (key in deftypes)
+               ret[key] = deftypes[key];
+
+       return (ret);
+}
+
+/*
+ * Given a string in the form of type[length] we want to split this into an
+ * object that extracts that information. We want to note that we could possibly
+ * have nested arrays so this should only check the furthest one. It may also be
+ * the case that we have no [] pieces, in which case we just return the current
+ * type.
+ */
+function ctParseType(str)
+{
+       var begInd, endInd;
+       var type, len;
+       if (typeof (str) != 'string')
+               throw (new Error('type must be a Javascript string'));
+
+       endInd = str.lastIndexOf(']');
+       if (endInd == -1) {
+               if (str.lastIndexOf('[') != -1)
+                       throw (new Error('found invalid type with \'[\' but ' +
+                           'no corresponding \']\''));
+
+               return ({ type: str });
+       }
+
+       begInd = str.lastIndexOf('[');
+       if (begInd == -1)
+               throw (new Error('found invalid type with \']\' but ' +
+                   'no corresponding \'[\''));
+
+       if (begInd >= endInd)
+               throw (new Error('malformed type, \']\' appears before \'[\''));
+
+       type = str.substring(0, begInd);
+       len = str.substring(begInd + 1, endInd);
+
+       return ({ type: type, len: len });
+}
+
+/*
+ * Given a request validate that all of the fields for it are valid and make
+ * sense. This includes verifying the following notions:
+ *  - Each type requested is present in types
+ *  - Only allow a name for a field to be specified once
+ *  - If an array is specified, validate that the requested field exists and
+ *    comes before it.
+ *  - If fields is defined, check that each entry has the occurrence of field
+ */
+function ctCheckReq(def, types, fields)
+{
+       var ii, jj;
+       var req, keys, key;
+       var found = {};
+
+       if (!(def instanceof Array))
+               throw (new Error('definition is not an array'));
+
+       if (def.length === 0)
+               throw (new Error('definition must have at least one element'));
+
+       for (ii = 0; ii < def.length; ii++) {
+               req = def[ii];
+               if (!(req instanceof Object))
+                       throw (new Error('definition must be an array of' +
+                           'objects'));
+
+               keys = Object.keys(req);
+               if (keys.length != 1)
+                       throw (new Error('definition entry must only have ' +
+                           'one key'));
+
+               if (keys[0] in found)
+                       throw (new Error('Specified name already ' +
+                           'specified: ' + keys[0]));
+
+               if (!('type' in req[keys[0]]))
+                       throw (new Error('missing required type definition'));
+
+               key = ctParseType(req[keys[0]]['type']);
+
+               /*
+                * We may have nested arrays, we need to check the validity of
+                * the types until the len field is undefined in key. However,
+                * each time len is defined we need to verify it is either an
+                * integer or corresponds to an already seen key.
+                */
+               while (key['len'] !== undefined) {
+                       if (isNaN(parseInt(key['len'], 10))) {
+                               if (!(key['len'] in found))
+                                       throw (new Error('Given an array ' +
+                                           'length without a matching type'));
+
+                       }
+
+                       key = ctParseType(key['type']);
+               }
+
+               /* Now we can validate if the type is valid */
+               if (!(key['type'] in types))
+                       throw (new Error('type not found or typdefed: ' +
+                           key['type']));
+
+               /* Check for any required fields */
+               if (fields !== undefined) {
+                       for (jj = 0; jj < fields.length; jj++) {
+                               if (!(fields[jj] in req[keys[0]]))
+                                       throw (new Error('Missing required ' +
+                                           'field: ' + fields[jj]));
+                       }
+               }
+
+               found[keys[0]] = true;
+       }
+}
+
+
+/*
+ * Create a new instance of the parser. Each parser has its own store of
+ * typedefs and endianness. Conf is an object with the following required
+ * values:
+ *
+ *     endian          Either 'big' or 'little' do determine the endianness we
+ *                     want to read from or write to.
+ *
+ * And the following optional values:
+ *
+ *     char-type       Valid options here are uint8 and int8. If uint8 is
+ *                     specified this changes the default behavior of a single
+ *                     char from being a buffer of a single character to being
+ *                     a uint8_t. If int8, it becomes an int8_t instead.
+ */
+function CTypeParser(conf)
+{
+       if (!conf) throw (new Error('missing required argument'));
+
+       if (!('endian' in conf))
+               throw (new Error('missing required endian value'));
+
+       if (conf['endian'] != 'big' && conf['endian'] != 'little')
+               throw (new Error('Invalid endian type'));
+
+       if ('char-type' in conf && (conf['char-type'] != 'uint8' &&
+           conf['char-type'] != 'int8'))
+               throw (new Error('invalid option for char-type: ' +
+                   conf['char-type']));
+
+       this.endian = conf['endian'];
+       this.types = ctGetBasicTypes();
+
+       /*
+        * There may be a more graceful way to do this, but this will have to
+        * serve.
+        */
+       if ('char-type' in conf && conf['char-type'] == 'uint8')
+               this.types['char'] = this.types['uint8_t'];
+
+       if ('char-type' in conf && conf['char-type'] == 'int8')
+               this.types['char'] = this.types['int8_t'];
+}
+
+/*
+ * Sets the current endian value for the Parser. If the value is not valid,
+ * throws an Error.
+ *
+ *     endian          Either 'big' or 'little' do determine the endianness we
+ *                     want to read from or write to.
+ *
+ */
+CTypeParser.prototype.setEndian = function (endian)
+{
+       if (endian != 'big' && endian != 'little')
+               throw (new Error('invalid endian type, must be big or ' +
+                   'little'));
+
+       this.endian = endian;
+};
+
+/*
+ * Returns the current value of the endian value for the parser.
+ */
+CTypeParser.prototype.getEndian = function ()
+{
+       return (this.endian);
+};
+
+/*
+ * A user has requested to add a type, let us honor their request. Yet, if their
+ * request doth spurn us, send them unto the Hells which Dante describes.
+ *
+ *     name            The string for the type definition we're adding
+ *
+ *     value           Either a string that is a type/array name or an object
+ *                     that describes a struct.
+ */
+CTypeParser.prototype.typedef = function (name, value)
+{
+       var type;
+
+       if (name === undefined)
+               throw (new (Error('missing required typedef argument: name')));
+
+       if (value === undefined)
+               throw (new (Error('missing required typedef argument: value')));
+
+       if (typeof (name) != 'string')
+               throw (new (Error('the name of a type must be a string')));
+
+       type = ctParseType(name);
+
+       if (type['len'] !== undefined)
+               throw (new Error('Cannot have an array in the typedef name'));
+
+       if (name in this.types)
+               throw (new Error('typedef name already present: ' + name));
+
+       if (typeof (value) != 'string' && !(value instanceof Array))
+               throw (new Error('typedef value must either be a string or ' +
+                   'struct'));
+
+       if (typeof (value) == 'string') {
+               type = ctParseType(value);
+               if (type['len'] !== undefined) {
+                       if (isNaN(parseInt(type['len'], 10)))
+                               throw (new (Error('typedef value must use ' +
+                                   'fixed size array when outside of a ' +
+                                   'struct')));
+               }
+
+               this.types[name] = value;
+       } else {
+               /* We have a struct, validate it */
+               ctCheckReq(value, this.types);
+               this.types[name] = value;
+       }
+};
+
+/*
+ * Include all of the typedefs, but none of the built in types. This should be
+ * treated as read-only.
+ */
+CTypeParser.prototype.lstypes = function ()
+{
+       var key;
+       var ret = {};
+
+       for (key in this.types) {
+               if (key in deftypes)
+                       continue;
+               ret[key] = this.types[key];
+       }
+
+       return (ret);
+};
+
+/*
+ * Given a type string that may have array types that aren't numbers, try and
+ * fill them in from the values object. The object should be of the format where
+ * indexing into it should return a number for that type.
+ *
+ *     str             The type string
+ *
+ *     values          An object that can be used to fulfill type information
+ */
+function ctResolveArray(str, values)
+{
+       var ret = '';
+       var type = ctParseType(str);
+
+       while (type['len'] !== undefined) {
+               if (isNaN(parseInt(type['len'], 10))) {
+                       if (typeof (values[type['len']]) != 'number')
+                               throw (new Error('cannot sawp in non-number ' +
+                                   'for array value'));
+                       ret = '[' + values[type['len']] + ']' + ret;
+               } else {
+                       ret = '[' + type['len'] + ']' + ret;
+               }
+               type = ctParseType(type['type']);
+       }
+
+       ret = type['type'] + ret;
+
+       return (ret);
+}
+
+/*
+ * [private] Either the typedef resolves to another type string or to a struct.
+ * If it resolves to a struct, we just pass it off to read struct. If not, we
+ * can just pass it off to read entry.
+ */
+CTypeParser.prototype.resolveTypedef = function (type, dispatch, buffer,
+    offset, value)
+{
+       var pt;
+
+       mod_assert.ok(type in this.types);
+       if (typeof (this.types[type]) == 'string') {
+               pt = ctParseType(this.types[type]);
+               if (dispatch == 'read')
+                       return (this.readEntry(pt, buffer, offset));
+               else if (dispatch == 'write')
+                       return (this.writeEntry(value, pt, buffer, offset));
+               else
+                       throw (new Error('invalid dispatch type to ' +
+                           'resolveTypedef'));
+       } else {
+               if (dispatch == 'read')
+                       return (this.readStruct(this.types[type], buffer,
+                           offset));
+               else if (dispatch == 'write')
+                       return (this.writeStruct(value, this.types[type],
+                           buffer, offset));
+               else
+                       throw (new Error('invalid dispatch type to ' +
+                           'resolveTypedef'));
+       }
+
+};
+
+/*
+ * [private] Try and read in the specific entry.
+ */
+CTypeParser.prototype.readEntry = function (type, buffer, offset)
+{
+       var parse, len;
+
+       /*
+        * Because we want to special case char[]s this is unfortunately
+        * a bit uglier than it really should be. We want to special
+        * case char[]s so that we return a node buffer, thus they are a
+        * first class type where as all other arrays just call into a
+        * generic array routine which calls their data-specific routine
+        * the specified number of times.
+        *
+        * The valid dispatch options we have are:
+        *  - Array and char => char[] handler
+        *  - Generic array handler
+        *  - Generic typedef handler
+        *  - Basic type handler
+        */
+       if (type['len'] !== undefined) {
+               len = parseInt(type['len'], 10);
+               if (isNaN(len))
+                       throw (new Error('somehow got a non-numeric length'));
+
+               if (type['type'] == 'char')
+                       parse = this.types['char[]']['read'](len,
+                           this.endian, buffer, offset);
+               else
+                       parse = this.readArray(type['type'],
+                           len, buffer, offset);
+       } else {
+               if (type['type'] in deftypes)
+                       parse = this.types[type['type']]['read'](this.endian,
+                           buffer, offset);
+               else
+                       parse = this.resolveTypedef(type['type'], 'read',
+                           buffer, offset);
+       }
+
+       return (parse);
+};
+
+/*
+ * [private] Read an array of data
+ */
+CTypeParser.prototype.readArray = function (type, length, buffer, offset)
+{
+       var ii, ent, pt;
+       var baseOffset = offset;
+       var ret = new Array(length);
+       pt = ctParseType(type);
+
+       for (ii = 0; ii < length; ii++) {
+               ent = this.readEntry(pt, buffer, offset);
+               offset += ent['size'];
+               ret[ii] = ent['value'];
+       }
+
+       return ({ value: ret, size: offset - baseOffset });
+};
+
+/*
+ * [private] Read a single struct in.
+ */
+CTypeParser.prototype.readStruct = function (def, buffer, offset)
+{
+       var parse, ii, type, entry, key;
+       var baseOffset = offset;
+       var ret = {};
+
+       /* Walk it and handle doing what's necessary */
+       for (ii = 0; ii < def.length; ii++) {
+               key = Object.keys(def[ii])[0];
+               entry = def[ii][key];
+
+               /* Resolve all array values */
+               type = ctParseType(ctResolveArray(entry['type'], ret));
+
+               if ('offset' in entry)
+                       offset = baseOffset + entry['offset'];
+
+               parse = this.readEntry(type, buffer, offset);
+
+               offset += parse['size'];
+               ret[key] = parse['value'];
+       }
+
+       return ({ value: ret, size: (offset-baseOffset)});
+};
+
+/*
+ * This is what we were born to do. We read the data from a buffer and return it
+ * in an object whose keys match the values from the object.
+ *
+ *     def             The array definition of the data to read in
+ *
+ *     buffer          The buffer to read data from
+ *
+ *     offset          The offset to start writing to
+ *
+ * Returns an object where each key corresponds to an entry in def and the value
+ * is the read value.
+ */
+CTypeParser.prototype.readData = function (def, buffer, offset)
+{
+       /* Sanity check for arguments */
+       if (def === undefined)
+               throw (new Error('missing definition for what we should be' +
+                   'parsing'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer for what we should be ' +
+                   'parsing'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset for what we should be ' +
+                   'parsing'));
+
+       /* Sanity check the object definition */
+       ctCheckReq(def, this.types);
+
+       return (this.readStruct(def, buffer, offset)['value']);
+};
+
+/*
+ * [private] Write out an array of data
+ */
+CTypeParser.prototype.writeArray = function (value, type, length, buffer,
+    offset)
+{
+       var ii, pt;
+       var baseOffset = offset;
+       if (!(value instanceof Array))
+               throw (new Error('asked to write an array, but value is not ' +
+                   'an array'));
+
+       if (value.length != length)
+               throw (new Error('asked to write array of length ' + length +
+                   ' but that does not match value length: ' + value.length));
+
+       pt = ctParseType(type);
+       for (ii = 0; ii < length; ii++)
+               offset += this.writeEntry(value[ii], pt, buffer, offset);
+
+       return (offset - baseOffset);
+};
+
+/*
+ * [private] Write the specific entry
+ */
+CTypeParser.prototype.writeEntry = function (value, type, buffer, offset)
+{
+       var len, ret;
+
+       if (type['len'] !== undefined) {
+               len = parseInt(type['len'], 10);
+               if (isNaN(len))
+                       throw (new Error('somehow got a non-numeric length'));
+
+               if (type['type'] == 'char')
+                       ret = this.types['char[]']['write'](value, len,
+                           this.endian, buffer, offset);
+               else
+                       ret = this.writeArray(value, type['type'],
+                           len, buffer, offset);
+       } else {
+               if (type['type'] in deftypes)
+                       ret = this.types[type['type']]['write'](value,
+                           this.endian, buffer, offset);
+               else
+                       ret = this.resolveTypedef(type['type'], 'write',
+                           buffer, offset, value);
+       }
+
+       return (ret);
+};
+
+/*
+ * [private] Write a single struct out.
+ */
+CTypeParser.prototype.writeStruct = function (value, def, buffer, offset)
+{
+       var ii, entry, type, key;
+       var baseOffset = offset;
+       var vals = {};
+
+       for (ii = 0; ii < def.length; ii++) {
+               key = Object.keys(def[ii])[0];
+               entry = def[ii][key];
+
+               type = ctParseType(ctResolveArray(entry['type'], vals));
+
+               if ('offset' in entry)
+                       offset = baseOffset + entry['offset'];
+
+               offset += this.writeEntry(value[ii], type, buffer, offset);
+               /* Now that we've written it out, we can use it for arrays */
+               vals[key] = value[ii];
+       }
+
+       return (offset);
+};
+
+/*
+ * Unfortunately, we're stuck with the sins of an initial poor design. Because
+ * of that, we are going to have to support the old way of writing data via
+ * writeData. There we insert the values that you want to write into the
+ * definition. A little baroque. Internally, we use the new model. So we need to
+ * just get those values out of there. But to maintain the principle of least
+ * surprise, we're not going to modify the input data.
+ */
+function getValues(def)
+{
+       var ii, out, key;
+       out = [];
+       for (ii = 0; ii < def.length; ii++) {
+               key = Object.keys(def[ii])[0];
+               mod_assert.ok('value' in def[ii][key]);
+               out.push(def[ii][key]['value']);
+       }
+
+       return (out);
+}
+
+/*
+ * This is the second half of what we were born to do, write out the data
+ * itself. Historically this function required you to put your values in the
+ * definition section. This was not the smartest thing to do and a bit of an
+ * oversight to be honest. As such, this function now takes a values argument.
+ * If values is non-null and non-undefined, it will be used to determine the
+ * values. This means that the old method is still supported, but is no longer
+ * acceptable.
+ *
+ *     def             The array definition of the data to write out with
+ *                     values
+ *
+ *     buffer          The buffer to write to
+ *
+ *     offset          The offset in the buffer to write to
+ *
+ *     values          An array of values to write.
+ */
+CTypeParser.prototype.writeData = function (def, buffer, offset, values)
+{
+       var hv;
+
+       if (def === undefined)
+               throw (new Error('missing definition for what we should be' +
+                   'parsing'));
+
+       if (buffer === undefined)
+               throw (new Error('missing buffer for what we should be ' +
+                   'parsing'));
+
+       if (offset === undefined)
+               throw (new Error('missing offset for what we should be ' +
+                   'parsing'));
+
+       hv = (values != null && values != undefined);
+       if (hv) {
+               if (!Array.isArray(values))
+                       throw (new Error('missing values for writing'));
+               ctCheckReq(def, this.types);
+       } else {
+               ctCheckReq(def, this.types, [ 'value' ]);
+       }
+
+       this.writeStruct(hv ? values : getValues(def), def, buffer, offset);
+};
+
+/*
+ * Functions to go to and from 64 bit numbers in a way that is compatible with
+ * Javascript limitations. There are two sets. One where the user is okay with
+ * an approximation and one where they are definitely not okay with an
+ * approximation.
+ */
+
+/*
+ * Attempts to convert an array of two integers returned from rsint64 / ruint64
+ * into an absolute 64 bit number. If however the value would exceed 2^52 this
+ * will instead throw an error. The mantissa in a double is a 52 bit number and
+ * rather than potentially give you a value that is an approximation this will
+ * error. If you would rather an approximation, please see toApprox64.
+ *
+ *     val             An array of two 32-bit integers
+ */
+function toAbs64(val)
+{
+       if (val === undefined)
+               throw (new Error('missing required arg: value'));
+
+       if (!Array.isArray(val))
+               throw (new Error('value must be an array'));
+
+       if (val.length != 2)
+               throw (new Error('value must be an array of length 2'));
+
+       /* We have 20 bits worth of precision in this range */
+       if (val[0] >= 0x100000)
+               throw (new Error('value would become approximated'));
+
+       return (val[0] * Math.pow(2, 32) + val[1]);
+}
+
+/*
+ * Will return the 64 bit value as returned in an array from rsint64 / ruint64
+ * to a value as close as it can. Note that Javascript stores all numbers as a
+ * double and the mantissa only has 52 bits. Thus this version may approximate
+ * the value.
+ *
+ *     val             An array of two 32-bit integers
+ */
+function toApprox64(val)
+{
+       if (val === undefined)
+               throw (new Error('missing required arg: value'));
+
+       if (!Array.isArray(val))
+               throw (new Error('value must be an array'));
+
+       if (val.length != 2)
+               throw (new Error('value must be an array of length 2'));
+
+       return (Math.pow(2, 32) * val[0] + val[1]);
+}
+
+function parseCTF(json, conf)
+{
+       var ctype = new CTypeParser(conf);
+       mod_ctf.ctfParseJson(json, ctype);
+
+       return (ctype);
+}
+
+/*
+ * Export the few things we actually want to. Currently this is just the CType
+ * Parser and ctio.
+ */
+exports.Parser = CTypeParser;
+exports.toAbs64 = toAbs64;
+exports.toApprox64 = toApprox64;
+
+exports.parseCTF = parseCTF;
+
+exports.ruint8 = mod_ctio.ruint8;
+exports.ruint16 = mod_ctio.ruint16;
+exports.ruint32 = mod_ctio.ruint32;
+exports.ruint64 = mod_ctio.ruint64;
+exports.wuint8 = mod_ctio.wuint8;
+exports.wuint16 = mod_ctio.wuint16;
+exports.wuint32 = mod_ctio.wuint32;
+exports.wuint64 = mod_ctio.wuint64;
+
+exports.rsint8 = mod_ctio.rsint8;
+exports.rsint16 = mod_ctio.rsint16;
+exports.rsint32 = mod_ctio.rsint32;
+exports.rsint64 = mod_ctio.rsint64;
+exports.wsint8 = mod_ctio.wsint8;
+exports.wsint16 = mod_ctio.wsint16;
+exports.wsint32 = mod_ctio.wsint32;
+exports.wsint64 = mod_ctio.wsint64;
+
+exports.rfloat = mod_ctio.rfloat;
+exports.rdouble = mod_ctio.rdouble;
+exports.wfloat = mod_ctio.wfloat;
+exports.wdouble = mod_ctio.wdouble;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype
new file mode 100755 (executable)
index 0000000..3f94986
--- /dev/null
@@ -0,0 +1,241 @@
+'\" te
+.\" Copyright (c) 2011, Robert Mustacchi.  All Rights Reserved.
+.\" Copyright (c) 2011, Joyent, Inc.  All Rights Reserved.
+.\"
+.\" 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.
+.TH CTIO 3CTYPE "December 12, 2011"
+.SH NAME
+ctio, ruint8, ruint16, ruint32, ruint64, wuint8, wuint16, wuint32, wuint64,
+rsint8, rsint16, rsint32, rsint64, wsint8, wsint16, wsint32, wsint64, rfloat,
+rdouble, wfloat, wdouble \- integer and float operations
+.SH SYNOPSIS
+.LP
+.nf
+var mod_ctype = require('ctype');
+
+\fBNumber\fR \fBmod_ctype.ruint8\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.ruint16\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.ruint32\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber[2]\fR \fBmod_ctype.ruint64\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rsint8\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rsint16\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rsint32\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber[2]\fR \fBmod_ctype.rsint64\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rfloat\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBNumber\fR \fBmod_ctype.rdouble\fR(\fBBuffer\fR \fIbuf\fR, \fBString\fR \fIendian\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint8\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint16\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint32\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wuint64\fR(\fBNumber[2]\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint8\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint16\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint32\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wsint64\fR(\fBNumber[2]\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wfloat\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.LP
+.nf
+\fBvoid\fR \fBmod_ctype.wdouble\fR(\fBNumber\fR value, \fBString\fR \fIendian\fR, \fBBuffer\fR \fIbuf\fR, \fBNumber\fR \fIoffset\fR);
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The argument \fIbuf\fR refers to a valid buffer (from calling new Buffer()). The
+argument \fIendian\fR is either the string 'big' or 'little' and controls
+whether the data in the buffer is interpreted as big or little endian. The argument
+\fIoffset\fR indicates the starting index into the buffer to read or write. All
+functions ensure that starting at \fIoffset\fR does not overflow the end of the
+buffer. The argument \fIvalue\fR is a Number that is the valid type for the
+specific function. All functions that take \fIvalue\fR as an argument, verify
+that the passed value is valid.
+
+.SS "\fBruint8()\fR, \fBruint16()\fR, \fBruint32()\fR"
+.sp
+.LP
+The \fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR functions read an 8,
+16, and 32-bit unsigned value from \fIbuf\fR and return it. The value read is
+influenced by the values of \fIoffset\fR and \fRendian\fI.
+
+
+.SS "\fBrsint8()\fR, \fBrsint16()\fR, \fBrsint32()\fR"
+.sp
+.LP
+The \fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR functions work just as
+\fBruint8()\fR, \fBruint16()\fR, and \fBruint32()\fR, except they return signed
+integers.
+
+.SS "\fBruint64()\fR, \fBrsint64()\fR"
+.sp
+.LP
+The \fBruint64()\fR and \fBrsint64()\fR functions read unsigned and signed 64
+bit integers respectively from \fBbuf\fR. Due to the limitations of ECMAScript's
+\fBNumber\fR type, they cannot be stored as one value without a loss of
+precision. Instead of returning the values as a single \fBNumber\fR, the
+functions return an array of two numbers. The first entry always contains the
+upper 32-bits and the second value contains the lower 32-bits. The lossy
+transformation into a number would be \fIres[0]*Math.pow(2,32)+res[1]\fR.
+Note that, unless an entry is zero, both array entries are guaranteed to have
+the same sign.
+
+.SS "\fBwuint8()\fR, \fBwuint16()\fR, \fBwuint32()\fR"
+.sp
+.LP
+The functions \fBwuint8()\fR, \fBwuint16()\fR, and \fBwuint32()\fR modify the
+contents of \fBbuf\fR by writing an 8, 16, and 32-bit unsigned integer
+respectively to \fBbuf\fR. It is illegal to pass a number that is not an integer
+within the domain of the integer size, for example, for \fBwuint8()\fR the valid
+range is \fB[0, 255]\fR. The value will be written in either big or little
+endian format based upon the value of \fBendian\fR.
+
+
+.SS "\fBwsint8()\fR, \fBwsint16()\fR, \fBwsint32()\fR"
+.sp
+.LP
+The functions \fBwsint8()\fR, \fBwsint16()\fR, and \fBwsint32()\fR function
+identically to the functions \fBwuint8()\fR, \fBwuint16()\fR, and
+\fBwuint32()\fR except that they the valid domain for \fBvalue\fR is that of a
+signed number instead of an unsigned number. For example the \fBwsint8()\fR has
+a domain of \fB[-128, 127]\fR.
+
+.SS "\fBwuint64()\fR, \fBwsint64()\fR"
+.sp
+.LP
+The functions \fBwuint64()\fR and \fBswint64()\fR write out 64-bit unsigned and
+signed integers to \fBbuf\fR. The \fBvalue\fR argument must be in the same
+format as described in \fBruint64()\fR and \fBrsint64()\fR.
+
+.SS "\fBrfloat()\fR, \fBrdouble()\fR"
+.sp
+.LP
+The functions "\fBrfloat()\fR and \fBrdouble()\fR" work like the other read
+functions, except that they read a single precision and double precision
+IEEE-754 floating point value instead.
+
+.SS "\fBwfloat()\fR, \fBwdouble()\fR"
+.sp
+.LP
+The functions "\fBrfloat()\fR and \fBrdouble()\fR" work like the other write 
+functions, except that the domain for a float is that of a single precision 4
+byte value. The domain for a double is any \fBNumber\fR in ECMAScript, which is
+defined to be represented by a double.
+
+.SH ATTRIBUTES
+.sp
+.LP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+
+.sp
+.TS
+box;
+c | c
+l | l .
+ATTRIBUTE TYPE ATTRIBUTE VALUE
+_
+Interface Stability    Committed
+_
+MT-Level       See below.
+_
+Standard       Not standardized.
+.TE
+
+.sp
+.LP
+
+All functions are MT-safe in so far as there aren't shared memory MT concerns in
+most node programs. If one where to concoct such an environment, these functions
+wouldn't be MT-safe.
+
+.SH SEE ALSO
+.sp
+.LP
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json
new file mode 100755 (executable)
index 0000000..45efd3f
--- /dev/null
@@ -0,0 +1,43 @@
+{
+  "name": "ctype",
+  "version": "0.5.3",
+  "description": "read and write binary structures and data types",
+  "homepage": "https://github.com/rmustacc/node-ctype",
+  "author": {
+    "name": "Robert Mustacchi",
+    "email": "rm@fingolfin.org"
+  },
+  "engines": {
+    "node": ">= 0.4"
+  },
+  "main": "ctype.js",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/rmustacc/node-ctype.git"
+  },
+  "_id": "ctype@0.5.3",
+  "dist": {
+    "shasum": "82c18c2461f74114ef16c135224ad0b9144ca12f",
+    "tarball": "http://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz"
+  },
+  "_npmVersion": "1.1.59",
+  "_npmUser": {
+    "name": "rm",
+    "email": "rm@fingolfin.org"
+  },
+  "maintainers": [
+    {
+      "name": "rm",
+      "email": "rm@fingolfin.org"
+    }
+  ],
+  "directories": {},
+  "_shasum": "82c18c2461f74114ef16c135224ad0b9144ca12f",
+  "_from": "ctype@0.5.3",
+  "_resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz",
+  "bugs": {
+    "url": "https://github.com/rmustacc/node-ctype/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "scripts": {}
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf
new file mode 100755 (executable)
index 0000000..845f367
--- /dev/null
@@ -0,0 +1,129 @@
+#
+# Configuration File for JavaScript Lint 0.3.0
+# Developed by Matthias Miller (http://www.JavaScriptLint.com)
+#
+# This configuration file can be used to lint a collection of scripts, or to enable
+# or disable warnings for scripts that are linted via the command line.
+#
+
+### Warnings
+# Enable or disable warnings based on requirements.
+# Use "+WarningName" to display or "-WarningName" to suppress.
+#
++no_return_value              # function {0} does not always return a value
++duplicate_formal             # duplicate formal argument {0}
++equal_as_assign              # test for equality (==) mistyped as assignment (=)?{0}
++var_hides_arg                # variable {0} hides argument
++redeclared_var               # redeclaration of {0} {1}
++anon_no_return_value         # anonymous function does not always return a value
++missing_semicolon            # missing semicolon
++meaningless_block            # meaningless block; curly braces have no impact
++comma_separated_stmts        # multiple statements separated by commas (use semicolons?)
++unreachable_code             # unreachable code
++missing_break                # missing break statement
++missing_break_for_last_case  # missing break statement for last case in switch
++comparison_type_conv         # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
+-inc_dec_within_stmt          # increment (++) and decrement (--) operators used as part of greater statement
++useless_void                 # use of the void type may be unnecessary (void is always undefined)
+-useless_quotes                        # quotation marks are unnecessary
++multiple_plus_minus          # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
++use_of_label                 # use of label
+-block_without_braces         # block statement without curly braces
++leading_decimal_point        # leading decimal point may indicate a number or an object member
++trailing_decimal_point       # trailing decimal point may indicate a number or an object member
+-octal_number                 # leading zeros make an octal number
++nested_comment               # nested comment
++misplaced_regex              # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
++ambiguous_newline            # unexpected end of line; it is ambiguous whether these lines are part of the same statement
++empty_statement              # empty statement or extra semicolon
+-missing_option_explicit      # the "option explicit" control comment is missing
++partial_option_explicit      # the "option explicit" control comment, if used, must be in the first script tag
++dup_option_explicit          # duplicate "option explicit" control comment
++useless_assign               # useless assignment
++ambiguous_nested_stmt        # block statements containing block statements should use curly braces to resolve ambiguity
++ambiguous_else_stmt          # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
++missing_default_case         # missing default case in switch statement
++duplicate_case_in_switch     # duplicate case in switch statements
++default_not_at_end           # the default case is not at the end of the switch statement
++legacy_cc_not_understood     # couldn't understand control comment using /*@keyword@*/ syntax
++jsl_cc_not_understood        # couldn't understand control comment using /*jsl:keyword*/ syntax
++useless_comparison           # useless comparison; comparing identical expressions
++with_statement               # with statement hides undeclared variables; use temporary variable instead
++trailing_comma_in_array      # extra comma is not recommended in array initializers
++assign_to_function_call      # assignment to a function call
++parseint_missing_radix       # parseInt missing radix parameter
+-unreferenced_argument        # argument declared but never referenced: {name}
+
+### Output format
+# Customize the format of the error message.
+#    __FILE__ indicates current file path
+#    __FILENAME__ indicates current file name
+#    __LINE__ indicates current line
+#    __ERROR__ indicates error message
+#
+# Visual Studio syntax (default):
++output-format __FILE__(__LINE__): __ERROR__
+# Alternative syntax:
+#+output-format __FILE__:__LINE__: __ERROR__
+
+
+### Context
+# Show the in-line position of the error.
+# Use "+context" to display or "-context" to suppress.
+#
++context
+
+
+### Semicolons
+# By default, assignments of an anonymous function to a variable or
+# property (such as a function prototype) must be followed by a semicolon.
+#
+#+lambda_assign_requires_semicolon # deprecated setting
+
+
+### Control Comments
+# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
+# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
+# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
+# although legacy control comments are enabled by default for backward compatibility.
+#
++legacy_control_comments
+
+
+### JScript Function Extensions
+# JScript allows member functions to be defined like this:
+#     function MyObj() { /*constructor*/ }
+#     function MyObj.prototype.go() { /*member function*/ }
+#
+# It also allows events to be attached like this:
+#     function window::onload() { /*init page*/ }
+#
+# This is a Microsoft-only JavaScript extension. Enable this setting to allow them.
+#
+#-jscript_function_extensions # deprecated setting
+
+
+### Defining identifiers
+# By default, "option explicit" is enabled on a per-file basis.
+# To enable this for all files, use "+always_use_option_explicit"
+-always_use_option_explicit
+
+# Define certain identifiers of which the lint is not aware.
+# (Use this in conjunction with the "undeclared identifier" warning.)
+#
+# Common uses for webpages might be:
+#+define window
+#+define document
++define require
++define exports
++define console
++define Buffer
++define JSON
+
+### Files
+# Specify which files to lint
+# Use "+recurse" to enable recursion (disabled by default).
+# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
+# or "+process Folder\Path\*.htm".
+#
+#+process jsl-test.js
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle
new file mode 100755 (executable)
index 0000000..96c72b6
--- /dev/null
@@ -0,0 +1,839 @@
+#!/usr/bin/env perl
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# Copyright 2011 Joyent, Inc. All rights reserved.
+#
+# jsstyle - check for some common stylistic errors.
+#
+#      jsstyle is a sort of "lint" for Javascript coding style.  This tool is
+#      derived from the cstyle tool, used to check for the style used in the
+#      Solaris kernel, sometimes known as "Bill Joy Normal Form".
+#
+#      There's a lot this can't check for, like proper indentation of code
+#      blocks.  There's also a lot more this could check for.
+#
+#      A note to the non perl literate:
+#
+#              perl regular expressions are pretty much like egrep
+#              regular expressions, with the following special symbols
+#
+#              \s      any space character
+#              \S      any non-space character
+#              \w      any "word" character [a-zA-Z0-9_]
+#              \W      any non-word character
+#              \d      a digit [0-9]
+#              \D      a non-digit
+#              \b      word boundary (between \w and \W)
+#              \B      non-word boundary
+#
+
+require 5.0;
+use IO::File;
+use Getopt::Std;
+use strict;
+
+my $usage =
+"usage: jsstyle [-chvC] [-o constructs] file ...
+       -c      check continuation indentation inside functions
+       -h      perform heuristic checks that are sometimes wrong
+       -v      verbose
+       -C      don't check anything in header block comments
+       -o constructs
+               allow a comma-seperated list of optional constructs:
+                   doxygen     allow doxygen-style block comments (/** /*!)
+                   splint      allow splint-style lint comments (/*@ ... @*/)
+";
+
+my %opts;
+
+if (!getopts("cho:vC", \%opts)) {
+       print $usage;
+       exit 2;
+}
+
+my $check_continuation = $opts{'c'};
+my $heuristic = $opts{'h'};
+my $verbose = $opts{'v'};
+my $ignore_hdr_comment = $opts{'C'};
+
+my $doxygen_comments = 0;
+my $splint_comments = 0;
+
+if (defined($opts{'o'})) {
+       for my $x (split /,/, $opts{'o'}) {
+               if ($x eq "doxygen") {
+                       $doxygen_comments = 1;
+               } elsif ($x eq "splint") {
+                       $splint_comments = 1;
+               } else {
+                       print "jsstyle: unrecognized construct \"$x\"\n";
+                       print $usage;
+                       exit 2;
+               }
+       }
+}
+
+my ($filename, $line, $prev);          # shared globals
+
+my $fmt;
+my $hdr_comment_start;
+
+if ($verbose) {
+       $fmt = "%s: %d: %s\n%s\n";
+} else {
+       $fmt = "%s: %d: %s\n";
+}
+
+if ($doxygen_comments) {
+       # doxygen comments look like "/*!" or "/**"; allow them.
+       $hdr_comment_start = qr/^\s*\/\*[\!\*]?$/;
+} else {
+       $hdr_comment_start = qr/^\s*\/\*$/;
+}
+
+# Note, following must be in single quotes so that \s and \w work right.
+my $lint_re = qr/\/\*(?:
+       jsl:\w+?|ARGSUSED[0-9]*|NOTREACHED|LINTLIBRARY|VARARGS[0-9]*|
+       CONSTCOND|CONSTANTCOND|CONSTANTCONDITION|EMPTY|
+       FALLTHRU|FALLTHROUGH|LINTED.*?|PRINTFLIKE[0-9]*|
+       PROTOLIB[0-9]*|SCANFLIKE[0-9]*|JSSTYLED.*?
+    )\*\//x;
+
+my $splint_re = qr/\/\*@.*?@\*\//x;
+
+my $err_stat = 0;              # exit status
+
+if ($#ARGV >= 0) {
+       foreach my $arg (@ARGV) {
+               my $fh = new IO::File $arg, "r";
+               if (!defined($fh)) {
+                       printf "%s: cannot open\n", $arg;
+               } else {
+                       &jsstyle($arg, $fh);
+                       close $fh;
+               }
+       }
+} else {
+       &jsstyle("<stdin>", *STDIN);
+}
+exit $err_stat;
+
+my $no_errs = 0;               # set for JSSTYLED-protected lines
+
+sub err($) {
+       my ($error) = @_;
+       unless ($no_errs) {
+               printf $fmt, $filename, $., $error, $line;
+               $err_stat = 1;
+       }
+}
+
+sub err_prefix($$) {
+       my ($prevline, $error) = @_;
+       my $out = $prevline."\n".$line;
+       unless ($no_errs) {
+               printf $fmt, $filename, $., $error, $out;
+               $err_stat = 1;
+       }
+}
+
+sub err_prev($) {
+       my ($error) = @_;
+       unless ($no_errs) {
+               printf $fmt, $filename, $. - 1, $error, $prev;
+               $err_stat = 1;
+       }
+}
+
+sub jsstyle($$) {
+
+my ($fn, $filehandle) = @_;
+$filename = $fn;                       # share it globally
+
+my $in_cpp = 0;
+my $next_in_cpp = 0;
+
+my $in_comment = 0;
+my $in_header_comment = 0;
+my $comment_done = 0;
+my $in_function = 0;
+my $in_function_header = 0;
+my $in_declaration = 0;
+my $note_level = 0;
+my $nextok = 0;
+my $nocheck = 0;
+
+my $in_string = 0;
+
+my ($okmsg, $comment_prefix);
+
+$line = '';
+$prev = '';
+reset_indent();
+
+line: while (<$filehandle>) {
+       s/\r?\n$//;     # strip return and newline
+
+       # save the original line, then remove all text from within
+       # double or single quotes, we do not want to check such text.
+
+       $line = $_;
+
+       #
+       # C allows strings to be continued with a backslash at the end of
+       # the line.  We translate that into a quoted string on the previous
+       # line followed by an initial quote on the next line.
+       #
+       # (we assume that no-one will use backslash-continuation with character
+       # constants)
+       #
+       $_ = '"' . $_           if ($in_string && !$nocheck && !$in_comment);
+
+       #
+       # normal strings and characters
+       #
+       s/'([^\\']|\\.)*'/\'\'/g;
+       s/"([^\\"]|\\.)*"/\"\"/g;
+
+       #
+       # detect string continuation
+       #
+       if ($nocheck || $in_comment) {
+               $in_string = 0;
+       } else {
+               #
+               # Now that all full strings are replaced with "", we check
+               # for unfinished strings continuing onto the next line.
+               #
+               $in_string =
+                   (s/([^"](?:"")*)"([^\\"]|\\.)*\\$/$1""/ ||
+                   s/^("")*"([^\\"]|\\.)*\\$/""/);
+       }
+
+       #
+       # figure out if we are in a cpp directive
+       #
+       $in_cpp = $next_in_cpp || /^\s*#/;      # continued or started
+       $next_in_cpp = $in_cpp && /\\$/;        # only if continued
+
+       # strip off trailing backslashes, which appear in long macros
+       s/\s*\\$//;
+
+       # an /* END JSSTYLED */ comment ends a no-check block.
+       if ($nocheck) {
+               if (/\/\* *END *JSSTYLED *\*\//) {
+                       $nocheck = 0;
+               } else {
+                       reset_indent();
+                       next line;
+               }
+       }
+
+       # a /*JSSTYLED*/ comment indicates that the next line is ok.
+       if ($nextok) {
+               if ($okmsg) {
+                       err($okmsg);
+               }
+               $nextok = 0;
+               $okmsg = 0;
+               if (/\/\* *JSSTYLED.*\*\//) {
+                       /^.*\/\* *JSSTYLED *(.*) *\*\/.*$/;
+                       $okmsg = $1;
+                       $nextok = 1;
+               }
+               $no_errs = 1;
+       } elsif ($no_errs) {
+               $no_errs = 0;
+       }
+
+       # check length of line.
+       # first, a quick check to see if there is any chance of being too long.
+       if (($line =~ tr/\t/\t/) * 7 + length($line) > 80) {
+               # yes, there is a chance.
+               # replace tabs with spaces and check again.
+               my $eline = $line;
+               1 while $eline =~
+                   s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
+               if (length($eline) > 80) {
+                       err("line > 80 characters");
+               }
+       }
+
+       # ignore NOTE(...) annotations (assumes NOTE is on lines by itself).
+       if ($note_level || /\b_?NOTE\s*\(/) { # if in NOTE or this is NOTE
+               s/[^()]//g;                       # eliminate all non-parens
+               $note_level += s/\(//g - length;  # update paren nest level
+               next;
+       }
+
+       # a /* BEGIN JSSTYLED */ comment starts a no-check block.
+       if (/\/\* *BEGIN *JSSTYLED *\*\//) {
+               $nocheck = 1;
+       }
+
+       # a /*JSSTYLED*/ comment indicates that the next line is ok.
+       if (/\/\* *JSSTYLED.*\*\//) {
+               /^.*\/\* *JSSTYLED *(.*) *\*\/.*$/;
+               $okmsg = $1;
+               $nextok = 1;
+       }
+       if (/\/\/ *JSSTYLED/) {
+               /^.*\/\/ *JSSTYLED *(.*)$/;
+               $okmsg = $1;
+               $nextok = 1;
+       }
+
+       # universal checks; apply to everything
+       if (/\t +\t/) {
+               err("spaces between tabs");
+       }
+       if (/ \t+ /) {
+               err("tabs between spaces");
+       }
+       if (/\s$/) {
+               err("space or tab at end of line");
+       }
+       if (/[^ \t(]\/\*/ && !/\w\(\/\*.*\*\/\);/) {
+               err("comment preceded by non-blank");
+       }
+
+       # is this the beginning or ending of a function?
+       # (not if "struct foo\n{\n")
+       if (/^{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) {
+               $in_function = 1;
+               $in_declaration = 1;
+               $in_function_header = 0;
+               $prev = $line;
+               next line;
+       }
+       if (/^}\s*(\/\*.*\*\/\s*)*$/) {
+               if ($prev =~ /^\s*return\s*;/) {
+                       err_prev("unneeded return at end of function");
+               }
+               $in_function = 0;
+               reset_indent();         # we don't check between functions
+               $prev = $line;
+               next line;
+       }
+       if (/^\w*\($/) {
+               $in_function_header = 1;
+       }
+
+       # a blank line terminates the declarations within a function.
+       # XXX - but still a problem in sub-blocks.
+       if ($in_declaration && /^$/) {
+               $in_declaration = 0;
+       }
+
+       if ($comment_done) {
+               $in_comment = 0;
+               $in_header_comment = 0;
+               $comment_done = 0;
+       }
+       # does this looks like the start of a block comment?
+       if (/$hdr_comment_start/) {
+               if (!/^\t*\/\*/) {
+                       err("block comment not indented by tabs");
+               }
+               $in_comment = 1;
+               /^(\s*)\//;
+               $comment_prefix = $1;
+               if ($comment_prefix eq "") {
+                       $in_header_comment = 1;
+               }
+               $prev = $line;
+               next line;
+       }
+       # are we still in the block comment?
+       if ($in_comment) {
+               if (/^$comment_prefix \*\/$/) {
+                       $comment_done = 1;
+               } elsif (/\*\//) {
+                       $comment_done = 1;
+                       err("improper block comment close")
+                           unless ($ignore_hdr_comment && $in_header_comment);
+               } elsif (!/^$comment_prefix \*[ \t]/ &&
+                   !/^$comment_prefix \*$/) {
+                       err("improper block comment")
+                           unless ($ignore_hdr_comment && $in_header_comment);
+               }
+       }
+
+       if ($in_header_comment && $ignore_hdr_comment) {
+               $prev = $line;
+               next line;
+       }
+
+       # check for errors that might occur in comments and in code.
+
+       # allow spaces to be used to draw pictures in header comments.
+       #if (/[^ ]     / && !/".*     .*"/ && !$in_header_comment) {
+       #       err("spaces instead of tabs");
+       #}
+       #if (/^ / && !/^ \*[ \t\/]/ && !/^ \*$/ &&
+       #    (!/^    \w/ || $in_function != 0)) {
+       #       err("indent by spaces instead of tabs");
+       #}
+       if (/^ {2,}/ && !/^    [^ ]/) {
+               err("indent by spaces instead of tabs");
+       }
+       if (/^\t+ [^ \t\*]/ || /^\t+  \S/ || /^\t+   \S/) {
+               err("continuation line not indented by 4 spaces");
+       }
+
+       if (/^\s*\/\*./ && !/^\s*\/\*.*\*\// && !/$hdr_comment_start/) {
+               err("improper first line of block comment");
+       }
+
+       if ($in_comment) {      # still in comment, don't do further checks
+               $prev = $line;
+               next line;
+       }
+
+       if ((/[^(]\/\*\S/ || /^\/\*\S/) &&
+           !(/$lint_re/ || ($splint_comments && /$splint_re/))) {
+               err("missing blank after open comment");
+       }
+       if (/\S\*\/[^)]|\S\*\/$/ &&
+           !(/$lint_re/ || ($splint_comments && /$splint_re/))) {
+               err("missing blank before close comment");
+       }
+       if (/\/\/\S/) {         # C++ comments
+               err("missing blank after start comment");
+       }
+       # check for unterminated single line comments, but allow them when
+       # they are used to comment out the argument list of a function
+       # declaration.
+       if (/\S.*\/\*/ && !/\S.*\/\*.*\*\// && !/\(\/\*/) {
+               err("unterminated single line comment");
+       }
+
+       if (/^(#else|#endif|#include)(.*)$/) {
+               $prev = $line;
+               next line;
+       }
+
+       #
+       # delete any comments and check everything else.  Note that
+       # ".*?" is a non-greedy match, so that we don't get confused by
+       # multiple comments on the same line.
+       #
+       s/\/\*.*?\*\//\ 1/g;
+       s/\/\/.*$/\ 1/;           # C++ comments
+
+       # delete any trailing whitespace; we have already checked for that.
+       s/\s*$//;
+
+       # following checks do not apply to text in comments.
+       if (/"/) {
+               err("literal string using double-quote instead of single");
+       }
+
+       if (/[^=!<>\s][!<>=]=/ || /[^<>!=][!<>=]==?[^\s,=]/ ||
+           (/[^->]>[^,=>\s]/ && !/[^->]>$/) ||
+           (/[^<]<[^,=<\s]/ && !/[^<]<$/) ||
+           /[^<\s]<[^<]/ || /[^->\s]>[^>]/) {
+               err("missing space around relational operator");
+       }
+       if (/\S>>=/ || /\S<<=/ || />>=\S/ || /<<=\S/ || /\S[-+*\/&|^%]=/ ||
+           (/[^-+*\/&|^%!<>=\s]=[^=]/ && !/[^-+*\/&|^%!<>=\s]=$/) ||
+           (/[^!<>=]=[^=\s]/ && !/[^!<>=]=$/)) {
+               # XXX - should only check this for C++ code
+               # XXX - there are probably other forms that should be allowed
+               if (!/\soperator=/) {
+                       err("missing space around assignment operator");
+               }
+       }
+       if (/[,;]\S/ && !/\bfor \(;;\)/) {
+               err("comma or semicolon followed by non-blank");
+       }
+       # allow "for" statements to have empty "while" clauses
+       if (/\s[,;]/ && !/^[\t]+;$/ && !/^\s*for \([^;]*; ;[^;]*\)/) {
+               err("comma or semicolon preceded by blank");
+       }
+       if (/^\s*(&&|\|\|)/) {
+               err("improper boolean continuation");
+       }
+       if (/\S   *(&&|\|\|)/ || /(&&|\|\|)   *\S/) {
+               err("more than one space around boolean operator");
+       }
+       if (/\b(delete|typeof|instanceOf|throw|with|catch|new|function|in|for|if|while|switch|return|case)\(/) {
+               err("missing space between keyword and paren");
+       }
+       if (/(\b(catch|for|if|with|while|switch|return)\b.*){2,}/) {
+               # multiple "case" and "sizeof" allowed
+               err("more than one keyword on line");
+       }
+       if (/\b(delete|typeof|instanceOf|with|throw|catch|new|function|in|for|if|while|switch|return|case)\s\s+\(/ &&
+           !/^#if\s+\(/) {
+               err("extra space between keyword and paren");
+       }
+       # try to detect "func (x)" but not "if (x)" or
+       # "#define foo (x)" or "int (*func)();"
+       if (/\w\s\(/) {
+               my $s = $_;
+               # strip off all keywords on the line
+               s/\b(delete|typeof|instanceOf|throw|with|catch|new|function|in|for|if|while|switch|return|case)\s\(/XXX(/g;
+               s/#elif\s\(/XXX(/g;
+               s/^#define\s+\w+\s+\(/XXX(/;
+               # do not match things like "void (*f)();"
+               # or "typedef void (func_t)();"
+               s/\w\s\(+\*/XXX(*/g;
+               s/\b(void)\s+\(+/XXX(/og;
+               if (/\w\s\(/) {
+                       err("extra space between function name and left paren");
+               }
+               $_ = $s;
+       }
+
+       if (/^\s*return\W[^;]*;/ && !/^\s*return\s*\(.*\);/) {
+               err("unparenthesized return expression");
+       }
+       if (/\btypeof\b/ && !/\btypeof\s*\(.*\)/) {
+               err("unparenthesized typeof expression");
+       }
+       if (/\(\s/) {
+               err("whitespace after left paren");
+       }
+       # allow "for" statements to have empty "continue" clauses
+       if (/\s\)/ && !/^\s*for \([^;]*;[^;]*; \)/) {
+               err("whitespace before right paren");
+       }
+       if (/^\s*\(void\)[^ ]/) {
+               err("missing space after (void) cast");
+       }
+       if (/\S{/ && !/({|\(){/) {
+               err("missing space before left brace");
+       }
+       if ($in_function && /^\s+{/ &&
+           ($prev =~ /\)\s*$/ || $prev =~ /\bstruct\s+\w+$/)) {
+               err("left brace starting a line");
+       }
+       if (/}(else|while)/) {
+               err("missing space after right brace");
+       }
+       if (/}\s\s+(else|while)/) {
+               err("extra space after right brace");
+       }
+       if (/^\s+#/) {
+               err("preprocessor statement not in column 1");
+       }
+       if (/^#\s/) {
+               err("blank after preprocessor #");
+       }
+
+       #
+       # We completely ignore, for purposes of indentation:
+       #  * lines outside of functions
+       #  * preprocessor lines
+       #
+       if ($check_continuation && $in_function && !$in_cpp) {
+               process_indent($_);
+       }
+
+       if ($heuristic) {
+               # cannot check this everywhere due to "struct {\n...\n} foo;"
+               if ($in_function && !$in_declaration &&
+                   /}./ && !/}\s+=/ && !/{.*}[;,]$/ && !/}(\s|\ 1)*$/ &&
+                   !/} (else|while)/ && !/}}/) {
+                       err("possible bad text following right brace");
+               }
+               # cannot check this because sub-blocks in
+               # the middle of code are ok
+               if ($in_function && /^\s+{/) {
+                       err("possible left brace starting a line");
+               }
+       }
+       if (/^\s*else\W/) {
+               if ($prev =~ /^\s*}$/) {
+                       err_prefix($prev,
+                           "else and right brace should be on same line");
+               }
+       }
+       $prev = $line;
+}
+
+if ($prev eq "") {
+       err("last line in file is blank");
+}
+
+}
+
+#
+# Continuation-line checking
+#
+# The rest of this file contains the code for the continuation checking
+# engine.  It's a pretty simple state machine which tracks the expression
+# depth (unmatched '('s and '['s).
+#
+# Keep in mind that the argument to process_indent() has already been heavily
+# processed; all comments have been replaced by control-A, and the contents of
+# strings and character constants have been elided.
+#
+
+my $cont_in;           # currently inside of a continuation
+my $cont_off;          # skipping an initializer or definition
+my $cont_noerr;                # suppress cascading errors
+my $cont_start;                # the line being continued
+my $cont_base;         # the base indentation
+my $cont_first;                # this is the first line of a statement
+my $cont_multiseg;     # this continuation has multiple segments
+
+my $cont_special;      # this is a C statement (if, for, etc.)
+my $cont_macro;                # this is a macro
+my $cont_case;         # this is a multi-line case
+
+my @cont_paren;                # the stack of unmatched ( and [s we've seen
+
+sub
+reset_indent()
+{
+       $cont_in = 0;
+       $cont_off = 0;
+}
+
+sub
+delabel($)
+{
+       #
+       # replace labels with tabs.  Note that there may be multiple
+       # labels on a line.
+       #
+       local $_ = $_[0];
+
+       while (/^(\t*)( *(?:(?:\w+\s*)|(?:case\b[^:]*)): *)(.*)$/) {
+               my ($pre_tabs, $label, $rest) = ($1, $2, $3);
+               $_ = $pre_tabs;
+               while ($label =~ s/^([^\t]*)(\t+)//) {
+                       $_ .= "\t" x (length($2) + length($1) / 8);
+               }
+               $_ .= ("\t" x (length($label) / 8)).$rest;
+       }
+
+       return ($_);
+}
+
+sub
+process_indent($)
+{
+       require strict;
+       local $_ = $_[0];                       # preserve the global $_
+
+       s/\ 1//g; # No comments
+       s/\s+$//;       # Strip trailing whitespace
+
+       return                  if (/^$/);      # skip empty lines
+
+       # regexps used below; keywords taking (), macros, and continued cases
+       my $special = '(?:(?:\}\s*)?else\s+)?(?:if|for|while|switch)\b';
+       my $macro = '[A-Z_][A-Z_0-9]*\(';
+       my $case = 'case\b[^:]*$';
+
+       # skip over enumerations, array definitions, initializers, etc.
+       if ($cont_off <= 0 && !/^\s*$special/ &&
+           (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*)){/ ||
+           (/^\s*{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) {
+               $cont_in = 0;
+               $cont_off = tr/{/{/ - tr/}/}/;
+               return;
+       }
+       if ($cont_off) {
+               $cont_off += tr/{/{/ - tr/}/}/;
+               return;
+       }
+
+       if (!$cont_in) {
+               $cont_start = $line;
+
+               if (/^\t* /) {
+                       err("non-continuation indented 4 spaces");
+                       $cont_noerr = 1;                # stop reporting
+               }
+               $_ = delabel($_);       # replace labels with tabs
+
+               # check if the statement is complete
+               return          if (/^\s*\}?$/);
+               return          if (/^\s*\}?\s*else\s*\{?$/);
+               return          if (/^\s*do\s*\{?$/);
+               return          if (/{$/);
+               return          if (/}[,;]?$/);
+
+               # Allow macros on their own lines
+               return          if (/^\s*[A-Z_][A-Z_0-9]*$/);
+
+               # cases we don't deal with, generally non-kosher
+               if (/{/) {
+                       err("stuff after {");
+                       return;
+               }
+
+               # Get the base line, and set up the state machine
+               /^(\t*)/;
+               $cont_base = $1;
+               $cont_in = 1;
+               @cont_paren = ();
+               $cont_first = 1;
+               $cont_multiseg = 0;
+
+               # certain things need special processing
+               $cont_special = /^\s*$special/? 1 : 0;
+               $cont_macro = /^\s*$macro/? 1 : 0;
+               $cont_case = /^\s*$case/? 1 : 0;
+       } else {
+               $cont_first = 0;
+
+               # Strings may be pulled back to an earlier (half-)tabstop
+               unless ($cont_noerr || /^$cont_base    / ||
+                   (/^\t*(?:    )?(?:gettext\()?\"/ && !/^$cont_base\t/)) {
+                       err_prefix($cont_start,
+                           "continuation should be indented 4 spaces");
+               }
+       }
+
+       my $rest = $_;                  # keeps the remainder of the line
+
+       #
+       # The split matches 0 characters, so that each 'special' character
+       # is processed separately.  Parens and brackets are pushed and
+       # popped off the @cont_paren stack.  For normal processing, we wait
+       # until a ; or { terminates the statement.  "special" processing
+       # (if/for/while/switch) is allowed to stop when the stack empties,
+       # as is macro processing.  Case statements are terminated with a :
+       # and an empty paren stack.
+       #
+       foreach $_ (split /[^\(\)\[\]\{\}\;\:]*/) {
+               next            if (length($_) == 0);
+
+               # rest contains the remainder of the line
+               my $rxp = "[^\Q$_\E]*\Q$_\E";
+               $rest =~ s/^$rxp//;
+
+               if (/\(/ || /\[/) {
+                       push @cont_paren, $_;
+               } elsif (/\)/ || /\]/) {
+                       my $cur = $_;
+                       tr/\)\]/\(\[/;
+
+                       my $old = (pop @cont_paren);
+                       if (!defined($old)) {
+                               err("unexpected '$cur'");
+                               $cont_in = 0;
+                               last;
+                       } elsif ($old ne $_) {
+                               err("'$cur' mismatched with '$old'");
+                               $cont_in = 0;
+                               last;
+                       }
+
+                       #
+                       # If the stack is now empty, do special processing
+                       # for if/for/while/switch and macro statements.
+                       #
+                       next            if (@cont_paren != 0);
+                       if ($cont_special) {
+                               if ($rest =~ /^\s*{?$/) {
+                                       $cont_in = 0;
+                                       last;
+                               }
+                               if ($rest =~ /^\s*;$/) {
+                                       err("empty if/for/while body ".
+                                           "not on its own line");
+                                       $cont_in = 0;
+                                       last;
+                               }
+                               if (!$cont_first && $cont_multiseg == 1) {
+                                       err_prefix($cont_start,
+                                           "multiple statements continued ".
+                                           "over multiple lines");
+                                       $cont_multiseg = 2;
+                               } elsif ($cont_multiseg == 0) {
+                                       $cont_multiseg = 1;
+                               }
+                               # We've finished this section, start
+                               # processing the next.
+                               goto section_ended;
+                       }
+                       if ($cont_macro) {
+                               if ($rest =~ /^$/) {
+                                       $cont_in = 0;
+                                       last;
+                               }
+                       }
+               } elsif (/\;/) {
+                       if ($cont_case) {
+                               err("unexpected ;");
+                       } elsif (!$cont_special) {
+                               err("unexpected ;")     if (@cont_paren != 0);
+                               if (!$cont_first && $cont_multiseg == 1) {
+                                       err_prefix($cont_start,
+                                           "multiple statements continued ".
+                                           "over multiple lines");
+                                       $cont_multiseg = 2;
+                               } elsif ($cont_multiseg == 0) {
+                                       $cont_multiseg = 1;
+                               }
+                               if ($rest =~ /^$/) {
+                                       $cont_in = 0;
+                                       last;
+                               }
+                               if ($rest =~ /^\s*special/) {
+                                       err("if/for/while/switch not started ".
+                                           "on its own line");
+                               }
+                               goto section_ended;
+                       }
+               } elsif (/\{/) {
+                       err("{ while in parens/brackets") if (@cont_paren != 0);
+                       err("stuff after {")            if ($rest =~ /[^\s}]/);
+                       $cont_in = 0;
+                       last;
+               } elsif (/\}/) {
+                       err("} while in parens/brackets") if (@cont_paren != 0);
+                       if (!$cont_special && $rest !~ /^\s*(while|else)\b/) {
+                               if ($rest =~ /^$/) {
+                                       err("unexpected }");
+                               } else {
+                                       err("stuff after }");
+                               }
+                               $cont_in = 0;
+                               last;
+                       }
+               } elsif (/\:/ && $cont_case && @cont_paren == 0) {
+                       err("stuff after multi-line case") if ($rest !~ /$^/);
+                       $cont_in = 0;
+                       last;
+               }
+               next;
+section_ended:
+               # End of a statement or if/while/for loop.  Reset
+               # cont_special and cont_macro based on the rest of the
+               # line.
+               $cont_special = ($rest =~ /^\s*$special/)? 1 : 0;
+               $cont_macro = ($rest =~ /^\s*$macro/)? 1 : 0;
+               $cont_case = 0;
+               next;
+       }
+       $cont_noerr = 0                 if (!$cont_in);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/float.json
new file mode 100755 (executable)
index 0000000..29d7bd8
--- /dev/null
@@ -0,0 +1,13 @@
+{ "metadata":
+       {
+               "ctf2json_version": "1.0",
+               "created_at": 1316563626,
+               "derived_from": "/lib/libc.so",
+               "ctf_version": 2,
+               "requested_types": [ "float" ]
+       },
+"data":
+       [
+               { "name": "float", "float": { "length": 4 } }
+       ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/int.json
new file mode 100755 (executable)
index 0000000..f9773a1
--- /dev/null
@@ -0,0 +1,13 @@
+{ "metadata":
+       {
+               "ctf2json_version": "1.0",
+               "created_at": 1316563631,
+               "derived_from": "/lib/libc.so",
+               "ctf_version": 2,
+               "requested_types": [ "int" ]
+       },
+"data":
+       [
+               { "name": "int", "integer": { "length": 4, "signed": true } }
+       ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/psinfo.json
new file mode 100755 (executable)
index 0000000..e0ee5e0
--- /dev/null
@@ -0,0 +1,104 @@
+{ "metadata":
+       {
+               "ctf2json_version": "1.0",
+               "created_at": 1316563573,
+               "derived_from": "/lib/libc.so",
+               "ctf_version": 2,
+               "requested_types": [ "psinfo_t" ]
+       },
+"data":
+       [
+               { "name": "int", "integer": { "length": 4, "signed": true } },
+               { "name": "char", "integer": { "length": 1, "signed": true } },
+               { "name": "unsigned short", "integer": { "length": 2, "signed": false } },
+               { "name": "long", "integer": { "length": 4, "signed": true } },
+               { "name": "unsigned", "integer": { "length": 4, "signed": false } },
+               { "name": "size_t", "typedef": "unsigned" },
+               { "name": "unsigned long", "integer": { "length": 4, "signed": false } },
+               { "name": "time_t", "typedef": "long" },
+               { "name": "struct timespec", "struct": [
+                       { "name": "tv_sec", "type": "time_t" },
+                       { "name": "tv_nsec", "type": "long" }
+               ] },
+               { "name": "zoneid_t", "typedef": "long" },
+               { "name": "taskid_t", "typedef": "long" },
+               { "name": "dev_t", "typedef": "unsigned long" },
+               { "name": "uid_t", "typedef": "unsigned" },
+               { "name": "gid_t", "typedef": "unsigned" },
+               { "name": "timestruc_t", "typedef": "struct timespec" },
+               { "name": "short", "integer": { "length": 2, "signed": true } },
+               { "name": "projid_t", "typedef": "long" },
+               { "name": "ushort_t", "typedef": "unsigned short" },
+               { "name": "poolid_t", "typedef": "long" },
+               { "name": "uintptr_t", "typedef": "unsigned" },
+               { "name": "id_t", "typedef": "long" },
+               { "name": "pid_t", "typedef": "long" },
+               { "name": "processorid_t", "typedef": "int" },
+               { "name": "psetid_t", "typedef": "int" },
+               { "name": "struct lwpsinfo", "struct": [
+                       { "name": "pr_flag", "type": "int" },
+                       { "name": "pr_lwpid", "type": "id_t" },
+                       { "name": "pr_addr", "type": "uintptr_t" },
+                       { "name": "pr_wchan", "type": "uintptr_t" },
+                       { "name": "pr_stype", "type": "char" },
+                       { "name": "pr_state", "type": "char" },
+                       { "name": "pr_sname", "type": "char" },
+                       { "name": "pr_nice", "type": "char" },
+                       { "name": "pr_syscall", "type": "short" },
+                       { "name": "pr_oldpri", "type": "char" },
+                       { "name": "pr_cpu", "type": "char" },
+                       { "name": "pr_pri", "type": "int" },
+                       { "name": "pr_pctcpu", "type": "ushort_t" },
+                       { "name": "pr_pad", "type": "ushort_t" },
+                       { "name": "pr_start", "type": "timestruc_t" },
+                       { "name": "pr_time", "type": "timestruc_t" },
+                       { "name": "pr_clname", "type": "char [8]" },
+                       { "name": "pr_name", "type": "char [16]" },
+                       { "name": "pr_onpro", "type": "processorid_t" },
+                       { "name": "pr_bindpro", "type": "processorid_t" },
+                       { "name": "pr_bindpset", "type": "psetid_t" },
+                       { "name": "pr_lgrp", "type": "int" },
+                       { "name": "pr_filler", "type": "int [4]" }
+               ] },
+               { "name": "lwpsinfo_t", "typedef": "struct lwpsinfo" },
+               { "name": "struct psinfo", "struct": [
+                       { "name": "pr_flag", "type": "int" },
+                       { "name": "pr_nlwp", "type": "int" },
+                       { "name": "pr_pid", "type": "pid_t" },
+                       { "name": "pr_ppid", "type": "pid_t" },
+                       { "name": "pr_pgid", "type": "pid_t" },
+                       { "name": "pr_sid", "type": "pid_t" },
+                       { "name": "pr_uid", "type": "uid_t" },
+                       { "name": "pr_euid", "type": "uid_t" },
+                       { "name": "pr_gid", "type": "gid_t" },
+                       { "name": "pr_egid", "type": "gid_t" },
+                       { "name": "pr_addr", "type": "uintptr_t" },
+                       { "name": "pr_size", "type": "size_t" },
+                       { "name": "pr_rssize", "type": "size_t" },
+                       { "name": "pr_pad1", "type": "size_t" },
+                       { "name": "pr_ttydev", "type": "dev_t" },
+                       { "name": "pr_pctcpu", "type": "ushort_t" },
+                       { "name": "pr_pctmem", "type": "ushort_t" },
+                       { "name": "pr_start", "type": "timestruc_t" },
+                       { "name": "pr_time", "type": "timestruc_t" },
+                       { "name": "pr_ctime", "type": "timestruc_t" },
+                       { "name": "pr_fname", "type": "char [16]" },
+                       { "name": "pr_psargs", "type": "char [80]" },
+                       { "name": "pr_wstat", "type": "int" },
+                       { "name": "pr_argc", "type": "int" },
+                       { "name": "pr_argv", "type": "uintptr_t" },
+                       { "name": "pr_envp", "type": "uintptr_t" },
+                       { "name": "pr_dmodel", "type": "char" },
+                       { "name": "pr_pad2", "type": "char [3]" },
+                       { "name": "pr_taskid", "type": "taskid_t" },
+                       { "name": "pr_projid", "type": "projid_t" },
+                       { "name": "pr_nzomb", "type": "int" },
+                       { "name": "pr_poolid", "type": "poolid_t" },
+                       { "name": "pr_zoneid", "type": "zoneid_t" },
+                       { "name": "pr_contract", "type": "id_t" },
+                       { "name": "pr_filler", "type": "int [1]" },
+                       { "name": "pr_lwp", "type": "lwpsinfo_t" }
+               ] },
+               { "name": "psinfo_t", "typedef": "struct psinfo" }
+       ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/struct.json
new file mode 100755 (executable)
index 0000000..e0542ff
--- /dev/null
@@ -0,0 +1,19 @@
+{ "metadata":
+       {
+               "ctf2json_version": "1.0",
+               "created_at": 1316563648,
+               "derived_from": "/lib/libc.so",
+               "ctf_version": 2,
+               "requested_types": [ "timestruc_t" ]
+       },
+"data":
+       [
+               { "name": "long", "integer": { "length": 4, "signed": true } },
+               { "name": "time_t", "typedef": "long" },
+               { "name": "struct timespec", "struct": [
+                       { "name": "tv_sec", "type": "time_t" },
+                       { "name": "tv_nsec", "type": "long" }
+               ] },
+               { "name": "timestruc_t", "typedef": "struct timespec" }
+       ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.fail.js
new file mode 100755 (executable)
index 0000000..d6a52cb
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Test several conditions that should always cause us to throw.
+ */
+var mod_assert = require('assert');
+var mod_ctype = require('../../ctype.js');
+
+var cases = [
+{ json: { }, msg: 'bad JSON - no metadata or data' },
+{ json: { metadata: {} }, msg: 'bad JSON - bad metadata section' },
+{ json: { metadata: { 'JSON version': [] } },
+    msg: 'bad JSON - bad JSON version' },
+{ json: { metadata: { 'JSON version': 2 } },
+    msg: 'bad JSON - bad JSON version' },
+{ json: { metadata: { 'JSON version': '100.20' } },
+    msg: 'bad JSON - bad JSON version' },
+{ json: { metadata: { 'JSON version': '1.0' } },
+    msg: 'missing data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: 1 },
+    msg: 'invalid data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: 1.1 },
+    msg: 'invalid data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: '1.1' },
+    msg: 'invalid data section' },
+{ json: { metadata: { 'JSON version': '1.0' }, data: {} },
+    msg: 'invalid data section' }
+];
+
+function test()
+{
+       var ii;
+
+       for (ii = 0; ii < cases.length; ii++) {
+               mod_assert.throws(function () {
+                   mod_ctype.parseCTF(cases[ii].json);
+               }, Error, cases[ii].msg);
+       }
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.float.js
new file mode 100755 (executable)
index 0000000..f214499
--- /dev/null
@@ -0,0 +1,14 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var data, parser;
+
+       data = JSON.parse(mod_fs.readFileSync('./float.json').toString());
+       parser = mod_ctype.parseCTF(data, { endian: 'big' });
+       mod_assert.deepEqual(parser.lstypes(), {});
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.int.js
new file mode 100755 (executable)
index 0000000..0ec0f76
--- /dev/null
@@ -0,0 +1,14 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var data, parser;
+
+       data = JSON.parse(mod_fs.readFileSync('./int.json').toString());
+       parser = mod_ctype.parseCTF(data, { endian: 'big' });
+       mod_assert.deepEqual(parser.lstypes(), { 'int': 'int32_t' });
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.psinfo.js
new file mode 100755 (executable)
index 0000000..ca1a544
--- /dev/null
@@ -0,0 +1,17 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+/*
+ * This is too unwieldly to actually write out. Just make sure we can parse it
+ * without errrors.
+ */
+function test()
+{
+       var data;
+
+       data = JSON.parse(mod_fs.readFileSync('./psinfo.json').toString());
+       mod_ctype.parseCTF(data, { endian: 'big' });
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.struct.js
new file mode 100755 (executable)
index 0000000..c62f41f
--- /dev/null
@@ -0,0 +1,18 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var data, parser;
+
+       data = JSON.parse(mod_fs.readFileSync('./struct.json').toString());
+       parser = mod_ctype.parseCTF(data, { endian: 'big' });
+       mod_assert.deepEqual(parser.lstypes(), { 'long': 'int32_t',
+           'time_t': 'long',
+           'timestruc_t': 'struct timespec',
+           'struct timespec': [ { 'tv_sec': { 'type': 'time_t' } },
+               { 'tv_nsec': { 'type': 'long' } } ] });
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/tst.typedef.js
new file mode 100755 (executable)
index 0000000..9006cd1
--- /dev/null
@@ -0,0 +1,15 @@
+var mod_fs = require('fs');
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var data, parser;
+
+       data = JSON.parse(mod_fs.readFileSync('./typedef.json').toString());
+       parser = mod_ctype.parseCTF(data, { endian: 'big' });
+       mod_assert.deepEqual(parser.lstypes(), { 'bar_t': 'int',
+           'int': 'int32_t' });
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctf/typedef.json
new file mode 100755 (executable)
index 0000000..35ddb50
--- /dev/null
@@ -0,0 +1,14 @@
+{ "metadata":
+       {
+               "ctf2json_version": "1.0",
+               "created_at": 1316302348,
+               "derived_from": "/lib/libc.so",
+               "ctf_version": 2,
+               "requested_types": [ "bar_t" ]
+       },
+"data":
+       [
+               { "name": "int", "integer": { "length": 4, "signed": true } },
+               { "name": "bar_t", "typedef": "int" }
+       ]
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.rfloat.js
new file mode 100755 (executable)
index 0000000..2c9504a
--- /dev/null
@@ -0,0 +1,767 @@
+/*
+ * Battery of tests to break our floating point implementation. Oh ho ho.
+ *
+ * There are a few useful ways to generate the expected output. The first is
+ * just write a C program and write raw bytes out and inspect with xxd. Remember
+ * to consider whether or not you're on a big endian or little endian machine.
+ * Another useful site I found to help with some of this was:
+ *
+ * http://babbage.cs.qc.edu/IEEE-754/
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function testfloat()
+{
+       var buffer = new Buffer(4);
+       /* Start off with some of the easy ones: +zero */
+       buffer[0] = 0;
+       buffer[1] = 0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+
+       ASSERT.equal(0, mod_ctype.rfloat(buffer, 'big', 0));
+       ASSERT.equal(0, mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* Test -0 */
+       buffer[0] = 0x80;
+       ASSERT.equal(0, mod_ctype.rfloat(buffer, 'big', 0));
+       buffer[3] = buffer[0];
+       buffer[0] = 0;
+       ASSERT.equal(0, mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* Catch +infin */
+       buffer[0] = 0x7f;
+       buffer[1] = 0x80;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       ASSERT.equal(Number.POSITIVE_INFINITY,
+           mod_ctype.rfloat(buffer, 'big', 0));
+       buffer[3] = 0x7f;
+       buffer[2] = 0x80;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(Number.POSITIVE_INFINITY,
+           mod_ctype.rfloat(buffer, 'litle', 0));
+
+       /* Catch -infin */
+       buffer[0] = 0xff;
+       buffer[1] = 0x80;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       ASSERT.equal(Number.NEGATIVE_INFINITY,
+           mod_ctype.rfloat(buffer, 'big', 0));
+       buffer[3] = 0xff;
+       buffer[2] = 0x80;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(Number.NEGATIVE_INFINITY,
+           mod_ctype.rfloat(buffer, 'litle', 0));
+
+       /* Catch NaN */
+
+       buffer[0] = 0x7f;
+       buffer[1] = 0x80;
+       buffer[2] = 0x00;
+       buffer[3] = 0x23;
+       ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'big', 0)));
+       buffer[3] = 0x7f;
+       buffer[2] = 0x80;
+       buffer[1] = 0x00;
+       buffer[0] = 0x23;
+       ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'little', 0)));
+
+       /* Catch -infin */
+       buffer[0] = 0xff;
+       buffer[1] = 0x80;
+       buffer[2] = 0x00;
+       buffer[3] = 0x23;
+       ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'big', 0)));
+       buffer[3] = 0xff;
+       buffer[2] = 0x80;
+       buffer[1] = 0x00;
+       buffer[0] = 0x23;
+       ASSERT.ok(isNaN(mod_ctype.rfloat(buffer, 'little', 0)));
+
+       /* On to some basic tests */
+       /* 1.125 */
+       buffer[0] = 0x3f;
+       buffer[1] = 0x90;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       ASSERT.equal(1.125, mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x3f;
+       buffer[2] = 0x90;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(1.125, mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* ff34a2b0 -2.4010576103645774e+38 */
+       buffer[0] = 0xff;
+       buffer[1] = 0x34;
+       buffer[2] = 0xa2;
+       buffer[3] = 0xb0;
+       ASSERT.equal(-2.4010576103645774e+38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0xff;
+       buffer[2] = 0x34;
+       buffer[1] = 0xa2;
+       buffer[0] = 0xb0;
+       ASSERT.equal(-2.4010576103645774e+38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* Denormalized tests */
+
+       /* 0003f89a +/- 3.6468792534053364e-40 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x03;
+       buffer[2] = 0xf8;
+       buffer[3] = 0x9a;
+       ASSERT.equal(3.6468792534053364e-40,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x00;
+       buffer[2] = 0x03;
+       buffer[1] = 0xf8;
+       buffer[0] = 0x9a;
+       ASSERT.equal(3.6468792534053364e-40,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x03;
+       buffer[2] = 0xf8;
+       buffer[3] = 0x9a;
+       ASSERT.equal(-3.6468792534053364e-40,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x80;
+       buffer[2] = 0x03;
+       buffer[1] = 0xf8;
+       buffer[0] = 0x9a;
+       ASSERT.equal(-3.6468792534053364e-40,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+
+       /* Maximum and minimum normalized and denormalized values */
+
+       /* Largest normalized number +/- 3.4028234663852886e+38 */
+
+       buffer[0] = 0x7f;
+       buffer[1] = 0x7f;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       ASSERT.equal(3.4028234663852886e+38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x7f;
+       buffer[2] = 0x7f;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(3.4028234663852886e+38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       buffer[0] = 0xff;
+       buffer[1] = 0x7f;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       ASSERT.equal(-3.4028234663852886e+38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0xff;
+       buffer[2] = 0x7f;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(-3.4028234663852886e+38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* Smallest normalied number +/- 1.1754943508222875e-38 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x80;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       ASSERT.equal(1.1754943508222875e-38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x00;
+       buffer[2] = 0x80;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(1.1754943508222875e-38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x80;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       ASSERT.equal(-1.1754943508222875e-38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x80;
+       buffer[2] = 0x80;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(-1.1754943508222875e-38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+
+       /* Smallest denormalized number 1.401298464324817e-45 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x00;
+       buffer[2] = 0x00;
+       buffer[3] = 0x01;
+       ASSERT.equal(1.401298464324817e-45,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x00;
+       buffer[2] = 0x00;
+       buffer[1] = 0x00;
+       buffer[0] = 0x01;
+       ASSERT.equal(1.401298464324817e-45,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x00;
+       buffer[2] = 0x00;
+       buffer[3] = 0x01;
+       ASSERT.equal(-1.401298464324817e-45,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x80;
+       buffer[2] = 0x00;
+       buffer[1] = 0x00;
+       buffer[0] = 0x01;
+       ASSERT.equal(-1.401298464324817e-45,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* Largest denormalized value +/- 1.1754942106924411e-38 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x7f;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       ASSERT.equal(1.1754942106924411e-38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x00;
+       buffer[2] = 0x7f;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(1.1754942106924411e-38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x7f;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       ASSERT.equal(-1.1754942106924411e-38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+
+       buffer[3] = 0x80;
+       buffer[2] = 0x7f;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(-1.1754942106924411e-38,
+           mod_ctype.rfloat(buffer, 'little', 0));
+
+       /* Do some quick offset testing */
+       buffer = new Buffer(6);
+       buffer[0] = 0x7f;
+       buffer[1] = 0x4e;
+       buffer[2] = 0x8a;
+       buffer[3] = 0x79;
+       buffer[4] = 0xcd;
+       buffer[5] = 0x3f;
+
+       ASSERT.equal(2.745399582697325e+38,
+           mod_ctype.rfloat(buffer, 'big', 0));
+       ASSERT.equal(1161619072,
+           mod_ctype.rfloat(buffer, 'big', 1));
+       ASSERT.equal(-1.2027516403607578e-32,
+           mod_ctype.rfloat(buffer, 'big', 2));
+
+       ASSERT.equal(8.97661320504413e+34,
+           mod_ctype.rfloat(buffer, 'little', 0));
+       ASSERT.equal(-261661920,
+           mod_ctype.rfloat(buffer, 'little', 1));
+       ASSERT.equal(1.605271577835083,
+           mod_ctype.rfloat(buffer, 'little', 2));
+
+}
+
+function testdouble()
+{
+       var buffer = new Buffer(10);
+
+       /* Check 0 */
+       buffer[0] = 0;
+       buffer[1] = 0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 0;
+       ASSERT.equal(0,
+           mod_ctype.rdouble(buffer, 'big', 0));
+       ASSERT.equal(0,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 0;
+       ASSERT.equal(0,
+           mod_ctype.rdouble(buffer, 'big', 0));
+       buffer[7] = 0x80;
+       buffer[6] = 0;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 0;
+       ASSERT.equal(0,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Check NaN */
+       buffer[0] = 0x7f;
+       buffer[1] = 0xf0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 23;
+       ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'big', 0)));
+
+       buffer[7] = 0x7f;
+       buffer[6] = 0xf0;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 23;
+       ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'little', 0)));
+
+       buffer[0] = 0xff;
+       buffer[1] = 0xf0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 23;
+       ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'big', 0)));
+
+       buffer[7] = 0xff;
+       buffer[6] = 0xf0;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 23;
+       ASSERT.ok(isNaN(mod_ctype.rdouble(buffer, 'little', 0)));
+
+       /* pos inf */
+       buffer[0] = 0x7f;
+       buffer[1] = 0xf0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 0;
+       ASSERT.equal(Number.POSITIVE_INFINITY,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x7f;
+       buffer[6] = 0xf0;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 0;
+       ASSERT.equal(Number.POSITIVE_INFINITY,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* neg inf */
+       buffer[0] = 0xff;
+       buffer[1] = 0xf0;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 0;
+       ASSERT.equal(Number.NEGATIVE_INFINITY,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0xff;
+       buffer[6] = 0xf0;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 0;
+       ASSERT.equal(Number.NEGATIVE_INFINITY,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Simple normalized values */
+
+       /* +/- 1.125 */
+       buffer[0] = 0x3f;
+       buffer[1] = 0xf2;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 0;
+       ASSERT.equal(1.125,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x3f;
+       buffer[6] = 0xf2;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 0;
+       ASSERT.equal(1.125,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0xbf;
+       buffer[1] = 0xf2;
+       buffer[2] = 0;
+       buffer[3] = 0;
+       buffer[4] = 0;
+       buffer[5] = 0;
+       buffer[6] = 0;
+       buffer[7] = 0;
+       ASSERT.equal(-1.125,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0xbf;
+       buffer[6] = 0xf2;
+       buffer[5] = 0;
+       buffer[4] = 0;
+       buffer[3] = 0;
+       buffer[2] = 0;
+       buffer[1] = 0;
+       buffer[0] = 0;
+       ASSERT.equal(-1.125,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* +/- 1.4397318913736026e+283 */
+       buffer[0] = 0x7a;
+       buffer[1] = 0xb8;
+       buffer[2] = 0xc9;
+       buffer[3] = 0x34;
+       buffer[4] = 0x72;
+       buffer[5] = 0x16;
+       buffer[6] = 0xf9;
+       buffer[7] = 0x0e;
+       ASSERT.equal(1.4397318913736026e+283,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x7a;
+       buffer[6] = 0xb8;
+       buffer[5] = 0xc9;
+       buffer[4] = 0x34;
+       buffer[3] = 0x72;
+       buffer[2] = 0x16;
+       buffer[1] = 0xf9;
+       buffer[0] = 0x0e;
+       ASSERT.equal(1.4397318913736026e+283,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0xfa;
+       buffer[1] = 0xb8;
+       buffer[2] = 0xc9;
+       buffer[3] = 0x34;
+       buffer[4] = 0x72;
+       buffer[5] = 0x16;
+       buffer[6] = 0xf9;
+       buffer[7] = 0x0e;
+       ASSERT.equal(-1.4397318913736026e+283,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0xfa;
+       buffer[6] = 0xb8;
+       buffer[5] = 0xc9;
+       buffer[4] = 0x34;
+       buffer[3] = 0x72;
+       buffer[2] = 0x16;
+       buffer[1] = 0xf9;
+       buffer[0] = 0x0e;
+       ASSERT.equal(-1.4397318913736026e+283,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Denormalized values */
+       /* +/- 8.82521232268344e-309 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x06;
+       buffer[2] = 0x58;
+       buffer[3] = 0x94;
+       buffer[4] = 0x13;
+       buffer[5] = 0x27;
+       buffer[6] = 0x8a;
+       buffer[7] = 0xcd;
+       ASSERT.equal(8.82521232268344e-309,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x00;
+       buffer[6] = 0x06;
+       buffer[5] = 0x58;
+       buffer[4] = 0x94;
+       buffer[3] = 0x13;
+       buffer[2] = 0x27;
+       buffer[1] = 0x8a;
+       buffer[0] = 0xcd;
+       ASSERT.equal(8.82521232268344e-309,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x06;
+       buffer[2] = 0x58;
+       buffer[3] = 0x94;
+       buffer[4] = 0x13;
+       buffer[5] = 0x27;
+       buffer[6] = 0x8a;
+       buffer[7] = 0xcd;
+       ASSERT.equal(-8.82521232268344e-309,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x80;
+       buffer[6] = 0x06;
+       buffer[5] = 0x58;
+       buffer[4] = 0x94;
+       buffer[3] = 0x13;
+       buffer[2] = 0x27;
+       buffer[1] = 0x8a;
+       buffer[0] = 0xcd;
+       ASSERT.equal(-8.82521232268344e-309,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Edge cases, maximum and minimum values */
+
+       /* Smallest denormalized value 5e-324 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x00;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       buffer[4] = 0x00;
+       buffer[5] = 0x00;
+       buffer[6] = 0x00;
+       buffer[7] = 0x01;
+       ASSERT.equal(5e-324,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x00;
+       buffer[6] = 0x00;
+       buffer[5] = 0x00;
+       buffer[4] = 0x00;
+       buffer[3] = 0x00;
+       buffer[2] = 0x00;
+       buffer[1] = 0x00;
+       buffer[0] = 0x01;
+       ASSERT.equal(5e-324,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x00;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       buffer[4] = 0x00;
+       buffer[5] = 0x00;
+       buffer[6] = 0x00;
+       buffer[7] = 0x01;
+       ASSERT.equal(-5e-324,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x80;
+       buffer[6] = 0x00;
+       buffer[5] = 0x00;
+       buffer[4] = 0x00;
+       buffer[3] = 0x00;
+       buffer[2] = 0x00;
+       buffer[1] = 0x00;
+       buffer[0] = 0x01;
+       ASSERT.equal(-5e-324,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Largest denormalized value 2.225073858507201e-308 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x0f;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       buffer[4] = 0xff;
+       buffer[5] = 0xff;
+       buffer[6] = 0xff;
+       buffer[7] = 0xff;
+       ASSERT.equal(2.225073858507201e-308,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x00;
+       buffer[6] = 0x0f;
+       buffer[5] = 0xff;
+       buffer[4] = 0xff;
+       buffer[3] = 0xff;
+       buffer[2] = 0xff;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(2.225073858507201e-308,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x0f;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       buffer[4] = 0xff;
+       buffer[5] = 0xff;
+       buffer[6] = 0xff;
+       buffer[7] = 0xff;
+       ASSERT.equal(-2.225073858507201e-308,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x80;
+       buffer[6] = 0x0f;
+       buffer[5] = 0xff;
+       buffer[4] = 0xff;
+       buffer[3] = 0xff;
+       buffer[2] = 0xff;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(-2.225073858507201e-308,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Smallest normalized value 2.2250738585072014e-308 */
+       buffer[0] = 0x00;
+       buffer[1] = 0x10;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       buffer[4] = 0x00;
+       buffer[5] = 0x00;
+       buffer[6] = 0x00;
+       buffer[7] = 0x00;
+       ASSERT.equal(2.2250738585072014e-308,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x00;
+       buffer[6] = 0x10;
+       buffer[5] = 0x00;
+       buffer[4] = 0x00;
+       buffer[3] = 0x00;
+       buffer[2] = 0x00;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(2.2250738585072014e-308,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0x80;
+       buffer[1] = 0x10;
+       buffer[2] = 0x00;
+       buffer[3] = 0x00;
+       buffer[4] = 0x00;
+       buffer[5] = 0x00;
+       buffer[6] = 0x00;
+       buffer[7] = 0x00;
+       ASSERT.equal(-2.2250738585072014e-308,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x80;
+       buffer[6] = 0x10;
+       buffer[5] = 0x00;
+       buffer[4] = 0x00;
+       buffer[3] = 0x00;
+       buffer[2] = 0x00;
+       buffer[1] = 0x00;
+       buffer[0] = 0x00;
+       ASSERT.equal(-2.2250738585072014e-308,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Largest normalized value 1.7976931348623157e+308 */
+       buffer[0] = 0x7f;
+       buffer[1] = 0xef;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       buffer[4] = 0xff;
+       buffer[5] = 0xff;
+       buffer[6] = 0xff;
+       buffer[7] = 0xff;
+       ASSERT.equal(1.7976931348623157e+308,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0x7f;
+       buffer[6] = 0xef;
+       buffer[5] = 0xff;
+       buffer[4] = 0xff;
+       buffer[3] = 0xff;
+       buffer[2] = 0xff;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(1.7976931348623157e+308,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       buffer[0] = 0xff;
+       buffer[1] = 0xef;
+       buffer[2] = 0xff;
+       buffer[3] = 0xff;
+       buffer[4] = 0xff;
+       buffer[5] = 0xff;
+       buffer[6] = 0xff;
+       buffer[7] = 0xff;
+       ASSERT.equal(-1.7976931348623157e+308,
+           mod_ctype.rdouble(buffer, 'big', 0));
+
+       buffer[7] = 0xff;
+       buffer[6] = 0xef;
+       buffer[5] = 0xff;
+       buffer[4] = 0xff;
+       buffer[3] = 0xff;
+       buffer[2] = 0xff;
+       buffer[1] = 0xff;
+       buffer[0] = 0xff;
+       ASSERT.equal(-1.7976931348623157e+308,
+           mod_ctype.rdouble(buffer, 'little', 0));
+
+       /* Try offsets */
+       buffer[0] = 0xde;
+       buffer[1] = 0xad;
+       buffer[2] = 0xbe;
+       buffer[3] = 0xef;
+       buffer[4] = 0xba;
+       buffer[5] = 0xdd;
+       buffer[6] = 0xca;
+       buffer[7] = 0xfe;
+       buffer[8] = 0x16;
+       buffer[9] = 0x79;
+
+       ASSERT.equal(-1.1885958404126936e+148,
+           mod_ctype.rdouble(buffer, 'big', 0));
+       ASSERT.equal(-2.4299184080448593e-88,
+           mod_ctype.rdouble(buffer, 'big', 1));
+       ASSERT.equal(-0.000015130017658081283,
+           mod_ctype.rdouble(buffer, 'big', 2));
+
+       ASSERT.equal(-5.757458694845505e+302,
+           mod_ctype.rdouble(buffer, 'little', 0));
+       ASSERT.equal(6.436459604192476e-198,
+           mod_ctype.rdouble(buffer, 'little', 1));
+       ASSERT.equal(1.9903745632417286e+275,
+           mod_ctype.rdouble(buffer, 'little', 2));
+}
+
+testfloat();
+testdouble();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/float/tst.wfloat.js
new file mode 100755 (executable)
index 0000000..b5fd95c
--- /dev/null
@@ -0,0 +1,753 @@
+/*
+ * Another place to find bugs that may yet plague us. This time with writing out
+ * floats to arrays. We are lazy and did basically just take the opposite of our
+ * test code to read in values.
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+
+/*
+ *     A useful thing to keep around for debugging
+ *     console.log('buffer[0]: ' + buffer[0].toString(16));
+ *     console.log('buffer[1]: ' + buffer[1].toString(16));
+ *     console.log('buffer[2]: ' + buffer[2].toString(16));
+ *     console.log('buffer[3]: ' + buffer[3].toString(16));
+ *     console.log('buffer[4]: ' + buffer[4].toString(16));
+ *     console.log('buffer[5]: ' + buffer[5].toString(16));
+ *     console.log('buffer[6]: ' + buffer[6].toString(16));
+ *     console.log('buffer[7]: ' + buffer[7].toString(16));
+ */
+
+function testfloat()
+{
+       var buffer = new Buffer(4);
+       mod_ctype.wfloat(0, 'big', buffer, 0);
+       /* Start off with some of the easy ones: +zero */
+       ASSERT.equal(0, buffer[0]);
+       ASSERT.equal(0, buffer[1]);
+       ASSERT.equal(0, buffer[2]);
+       ASSERT.equal(0, buffer[3]);
+       mod_ctype.wfloat(0, 'little', buffer, 0);
+       ASSERT.equal(0, buffer[0]);
+       ASSERT.equal(0, buffer[1]);
+       ASSERT.equal(0, buffer[2]);
+       ASSERT.equal(0, buffer[3]);
+
+       /* Catch +infin */
+       mod_ctype.wfloat(Number.POSITIVE_INFINITY, 'big', buffer, 0);
+       ASSERT.equal(0x7f, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       mod_ctype.wfloat(Number.POSITIVE_INFINITY, 'little', buffer, 0);
+       ASSERT.equal(0x7f, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       /* Catch -infin */
+       mod_ctype.wfloat(Number.NEGATIVE_INFINITY, 'big', buffer, 0);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       mod_ctype.wfloat(Number.NEGATIVE_INFINITY, 'little', buffer, 0);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       /* Catch NaN */
+
+       /*
+        * NaN Is a litle weird in its requirements, so we're going to encode a
+        * bit of how we actually implement it into this test. Probably not the
+        * best, since technically the sign is a don't care and the mantissa
+        * needs to just be non-zero.
+        */
+       mod_ctype.wfloat(NaN, 'big', buffer, 0);
+       ASSERT.equal(0x7f, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x17, buffer[3]);
+       mod_ctype.wfloat(NaN, 'little', buffer, 0);
+       ASSERT.equal(0x7f, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x17, buffer[0]);
+
+       /* On to some basic tests */
+       /* 1.125 */
+       mod_ctype.wfloat(1.125, 'big', buffer, 0);
+       ASSERT.equal(0x3f, buffer[0]);
+       ASSERT.equal(0x90, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       mod_ctype.wfloat(1.125, 'little', buffer, 0);
+       ASSERT.equal(0x3f, buffer[3]);
+       ASSERT.equal(0x90, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       mod_ctype.wfloat(1.0000001192092896, 'big', buffer, 0);
+       ASSERT.equal(0x3f, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x01, buffer[3]);
+       mod_ctype.wfloat(1.0000001192092896, 'little', buffer, 0);
+       ASSERT.equal(0x3f, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+       mod_ctype.wfloat(1.0000001192092896, 'big', buffer, 0);
+       ASSERT.equal(0x3f, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x01, buffer[3]);
+       mod_ctype.wfloat(1.0000001192092896, 'little', buffer, 0);
+       ASSERT.equal(0x3f, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+       mod_ctype.wfloat(2.3283067140944524e-10, 'big', buffer, 0);
+       ASSERT.equal(0x2f, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x01, buffer[3]);
+       mod_ctype.wfloat(2.3283067140944524e-10, 'little', buffer, 0);
+       ASSERT.equal(0x2f, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+       /* ff34a2b0 -2.4010576103645774e+38 */
+       mod_ctype.wfloat(-2.4010576103645774e+38,
+           'big', buffer, 0);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0x34, buffer[1]);
+       ASSERT.equal(0xa2, buffer[2]);
+       ASSERT.equal(0xb0, buffer[3]);
+       mod_ctype.wfloat(-2.4010576103645774e+38,
+           'little', buffer, 0);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0x34, buffer[2]);
+       ASSERT.equal(0xa2, buffer[1]);
+       ASSERT.equal(0xb0, buffer[0]);
+
+       /* Denormalized tests */
+
+       /* 0003f89a +/- 3.6468792534053364e-40 */
+       mod_ctype.wfloat(3.6468792534053364e-40,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x03, buffer[1]);
+       ASSERT.equal(0xf8, buffer[2]);
+       ASSERT.equal(0x9a, buffer[3]);
+       mod_ctype.wfloat(3.6468792534053364e-40,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x03, buffer[2]);
+       ASSERT.equal(0xf8, buffer[1]);
+       ASSERT.equal(0x9a, buffer[0]);
+
+       mod_ctype.wfloat(-3.6468792534053364e-40,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x03, buffer[1]);
+       ASSERT.equal(0xf8, buffer[2]);
+       ASSERT.equal(0x9a, buffer[3]);
+       mod_ctype.wfloat(-3.6468792534053364e-40,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[3]);
+       ASSERT.equal(0x03, buffer[2]);
+       ASSERT.equal(0xf8, buffer[1]);
+       ASSERT.equal(0x9a, buffer[0]);
+
+       /* Maximum and minimum normalized and denormalized values */
+
+       /* Largest normalized number +/- 3.4028234663852886e+38 */
+
+       mod_ctype.wfloat(3.4028234663852886e+38,
+           'big', buffer, 0);
+       ASSERT.equal(0x7f, buffer[0]);
+       ASSERT.equal(0x7f, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       mod_ctype.wfloat(3.4028234663852886e+38,
+           'little', buffer, 0);
+       ASSERT.equal(0x7f, buffer[3]);
+       ASSERT.equal(0x7f, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+       mod_ctype.wfloat(-3.4028234663852886e+38,
+           'big', buffer, 0);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0x7f, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       mod_ctype.wfloat(-3.4028234663852886e+38,
+           'little', buffer, 0);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0x7f, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+       /* Smallest normalied number +/- 1.1754943508222875e-38 */
+
+       mod_ctype.wfloat(1.1754943508222875e-38,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       mod_ctype.wfloat(1.1754943508222875e-38,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       mod_ctype.wfloat(-1.1754943508222875e-38,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x80, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       mod_ctype.wfloat(-1.1754943508222875e-38,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[3]);
+       ASSERT.equal(0x80, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       /* Smallest denormalized number 1.401298464324817e-45 */
+       mod_ctype.wfloat(1.401298464324817e-45,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x01, buffer[3]);
+       mod_ctype.wfloat(1.401298464324817e-45,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+       mod_ctype.wfloat(-1.401298464324817e-45,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x01, buffer[3]);
+       mod_ctype.wfloat(-1.401298464324817e-45,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+       /* Largest denormalized value +/- 1.1754942106924411e-38 */
+
+       mod_ctype.wfloat(1.1754942106924411e-38,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x7f, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       mod_ctype.wfloat(1.1754942106924411e-38,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x7f, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+       mod_ctype.wfloat(-1.1754942106924411e-38,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x7f, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       mod_ctype.wfloat(-1.1754942106924411e-38,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[3]);
+       ASSERT.equal(0x7f, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+       /* Do some quick offset testing */
+       buffer = new Buffer(6);
+       mod_ctype.wfloat(-1.2027516403607578e-32,
+           'big', buffer, 2);
+       ASSERT.equal(0x8a, buffer[2]);
+       ASSERT.equal(0x79, buffer[3]);
+       ASSERT.equal(0xcd, buffer[4]);
+       ASSERT.equal(0x3f, buffer[5]);
+
+       mod_ctype.wfloat(-1.2027516403607578e-32,
+           'little', buffer, 2);
+       ASSERT.equal(0x8a, buffer[5]);
+       ASSERT.equal(0x79, buffer[4]);
+       ASSERT.equal(0xcd, buffer[3]);
+       ASSERT.equal(0x3f, buffer[2]);
+
+}
+
+function testdouble()
+{
+       var buffer = new Buffer(10);
+
+       /* Check 0 */
+       mod_ctype.wdouble(0, 'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+       mod_ctype.wdouble(0, 'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[7]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       /* Check NaN */
+       /* Similar to floats we are only generating a subset of values */
+       mod_ctype.wdouble(NaN, 'big', buffer, 0);
+       ASSERT.equal(0x7f, buffer[0]);
+       ASSERT.equal(0xf0, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x17, buffer[7]);
+       mod_ctype.wdouble(NaN, 'little', buffer, 0);
+       ASSERT.equal(0x7f, buffer[7]);
+       ASSERT.equal(0xf0, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x17, buffer[0]);
+
+       /* pos inf */
+       mod_ctype.wdouble(Number.POSITIVE_INFINITY,
+           'big', buffer, 0);
+       ASSERT.equal(0x7f, buffer[0]);
+       ASSERT.equal(0xf0, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+       mod_ctype.wdouble(Number.POSITIVE_INFINITY,
+           'little', buffer, 0);
+       ASSERT.equal(0x7f, buffer[7]);
+       ASSERT.equal(0xf0, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       /* neg inf */
+       mod_ctype.wdouble(Number.NEGATIVE_INFINITY,
+           'big', buffer, 0);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0xf0, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+       mod_ctype.wdouble(Number.NEGATIVE_INFINITY,
+           'little', buffer, 0);
+       ASSERT.equal(0xff, buffer[7]);
+       ASSERT.equal(0xf0, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       /* Simple normalized values */
+
+       /* +/- 1.125 */
+       mod_ctype.wdouble(1.125,
+           'big', buffer, 0);
+       ASSERT.equal(0x3f, buffer[0]);
+       ASSERT.equal(0xf2, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+
+       mod_ctype.wdouble(1.125,
+           'little', buffer, 0);
+       ASSERT.equal(0x3f, buffer[7]);
+       ASSERT.equal(0xf2, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       mod_ctype.wdouble(-1.125,
+           'big', buffer, 0);
+       ASSERT.equal(0xbf, buffer[0]);
+       ASSERT.equal(0xf2, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+
+       mod_ctype.wdouble(-1.125,
+           'little', buffer, 0);
+       ASSERT.equal(0xbf, buffer[7]);
+       ASSERT.equal(0xf2, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+
+       /* +/- 1.4397318913736026e+283 */
+       mod_ctype.wdouble(1.4397318913736026e+283,
+           'big', buffer, 0);
+       ASSERT.equal(0x7a, buffer[0]);
+       ASSERT.equal(0xb8, buffer[1]);
+       ASSERT.equal(0xc9, buffer[2]);
+       ASSERT.equal(0x34, buffer[3]);
+       ASSERT.equal(0x72, buffer[4]);
+       ASSERT.equal(0x16, buffer[5]);
+       ASSERT.equal(0xf9, buffer[6]);
+       ASSERT.equal(0x0e, buffer[7]);
+
+       mod_ctype.wdouble(1.4397318913736026e+283,
+           'little', buffer, 0);
+       ASSERT.equal(0x7a, buffer[7]);
+       ASSERT.equal(0xb8, buffer[6]);
+       ASSERT.equal(0xc9, buffer[5]);
+       ASSERT.equal(0x34, buffer[4]);
+       ASSERT.equal(0x72, buffer[3]);
+       ASSERT.equal(0x16, buffer[2]);
+       ASSERT.equal(0xf9, buffer[1]);
+       ASSERT.equal(0x0e, buffer[0]);
+
+       mod_ctype.wdouble(-1.4397318913736026e+283,
+           'big', buffer, 0);
+       ASSERT.equal(0xfa, buffer[0]);
+       ASSERT.equal(0xb8, buffer[1]);
+       ASSERT.equal(0xc9, buffer[2]);
+       ASSERT.equal(0x34, buffer[3]);
+       ASSERT.equal(0x72, buffer[4]);
+       ASSERT.equal(0x16, buffer[5]);
+       ASSERT.equal(0xf9, buffer[6]);
+       ASSERT.equal(0x0e, buffer[7]);
+
+       mod_ctype.wdouble(-1.4397318913736026e+283,
+           'little', buffer, 0);
+       ASSERT.equal(0xfa, buffer[7]);
+       ASSERT.equal(0xb8, buffer[6]);
+       ASSERT.equal(0xc9, buffer[5]);
+       ASSERT.equal(0x34, buffer[4]);
+       ASSERT.equal(0x72, buffer[3]);
+       ASSERT.equal(0x16, buffer[2]);
+       ASSERT.equal(0xf9, buffer[1]);
+       ASSERT.equal(0x0e, buffer[0]);
+
+       /* Denormalized values */
+       /* +/- 8.82521232268344e-309 */
+       mod_ctype.wdouble(8.82521232268344e-309,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x06, buffer[1]);
+       ASSERT.equal(0x58, buffer[2]);
+       ASSERT.equal(0x94, buffer[3]);
+       ASSERT.equal(0x13, buffer[4]);
+       ASSERT.equal(0x27, buffer[5]);
+       ASSERT.equal(0x8a, buffer[6]);
+       ASSERT.equal(0xcd, buffer[7]);
+
+       mod_ctype.wdouble(8.82521232268344e-309,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[7]);
+       ASSERT.equal(0x06, buffer[6]);
+       ASSERT.equal(0x58, buffer[5]);
+       ASSERT.equal(0x94, buffer[4]);
+       ASSERT.equal(0x13, buffer[3]);
+       ASSERT.equal(0x27, buffer[2]);
+       ASSERT.equal(0x8a, buffer[1]);
+       ASSERT.equal(0xcd, buffer[0]);
+
+       mod_ctype.wdouble(-8.82521232268344e-309,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x06, buffer[1]);
+       ASSERT.equal(0x58, buffer[2]);
+       ASSERT.equal(0x94, buffer[3]);
+       ASSERT.equal(0x13, buffer[4]);
+       ASSERT.equal(0x27, buffer[5]);
+       ASSERT.equal(0x8a, buffer[6]);
+       ASSERT.equal(0xcd, buffer[7]);
+
+       mod_ctype.wdouble(-8.82521232268344e-309,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[7]);
+       ASSERT.equal(0x06, buffer[6]);
+       ASSERT.equal(0x58, buffer[5]);
+       ASSERT.equal(0x94, buffer[4]);
+       ASSERT.equal(0x13, buffer[3]);
+       ASSERT.equal(0x27, buffer[2]);
+       ASSERT.equal(0x8a, buffer[1]);
+       ASSERT.equal(0xcd, buffer[0]);
+
+
+       /* Edge cases, maximum and minimum values */
+
+       /* Smallest denormalized value 5e-324 */
+       mod_ctype.wdouble(5e-324,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x01, buffer[7]);
+
+       mod_ctype.wdouble(5e-324,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[7]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+       mod_ctype.wdouble(-5e-324,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x01, buffer[7]);
+
+       mod_ctype.wdouble(-5e-324,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[7]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x01, buffer[0]);
+
+
+
+       /* Largest denormalized value 2.225073858507201e-308 */
+       mod_ctype.wdouble(2.225073858507201e-308,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x0f, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[6]);
+       ASSERT.equal(0xff, buffer[7]);
+
+       mod_ctype.wdouble(2.225073858507201e-308,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[7]);
+       ASSERT.equal(0x0f, buffer[6]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+       mod_ctype.wdouble(-2.225073858507201e-308,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x0f, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[6]);
+       ASSERT.equal(0xff, buffer[7]);
+
+       mod_ctype.wdouble(-2.225073858507201e-308,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[7]);
+       ASSERT.equal(0x0f, buffer[6]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+
+       /* Smallest normalized value 2.2250738585072014e-308 */
+       mod_ctype.wdouble(2.2250738585072014e-308,
+           'big', buffer, 0);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x10, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+
+       mod_ctype.wdouble(2.2250738585072014e-308,
+           'little', buffer, 0);
+       ASSERT.equal(0x00, buffer[7]);
+       ASSERT.equal(0x10, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+       mod_ctype.wdouble(-2.2250738585072014e-308,
+           'big', buffer, 0);
+       ASSERT.equal(0x80, buffer[0]);
+       ASSERT.equal(0x10, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+
+       mod_ctype.wdouble(-2.2250738585072014e-308,
+           'little', buffer, 0);
+       ASSERT.equal(0x80, buffer[7]);
+       ASSERT.equal(0x10, buffer[6]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[4]);
+       ASSERT.equal(0x00, buffer[3]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[0]);
+
+
+       /* Largest normalized value 1.7976931348623157e+308 */
+       mod_ctype.wdouble(1.7976931348623157e+308,
+           'big', buffer, 0);
+       ASSERT.equal(0x7f, buffer[0]);
+       ASSERT.equal(0xef, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[6]);
+       ASSERT.equal(0xff, buffer[7]);
+
+       mod_ctype.wdouble(1.7976931348623157e+308,
+           'little', buffer, 0);
+       ASSERT.equal(0x7f, buffer[7]);
+       ASSERT.equal(0xef, buffer[6]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+       mod_ctype.wdouble(-1.7976931348623157e+308,
+           'big', buffer, 0);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0xef, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[6]);
+       ASSERT.equal(0xff, buffer[7]);
+
+       mod_ctype.wdouble(-1.7976931348623157e+308,
+           'little', buffer, 0);
+       ASSERT.equal(0xff, buffer[7]);
+       ASSERT.equal(0xef, buffer[6]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[4]);
+       ASSERT.equal(0xff, buffer[3]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[0]);
+
+
+       /* Try offsets */
+       buffer[0] = 0xde;
+       buffer[1] = 0xad;
+       buffer[2] = 0xbe;
+       buffer[3] = 0xef;
+       buffer[4] = 0xba;
+       buffer[5] = 0xdd;
+       buffer[6] = 0xca;
+       buffer[7] = 0xfe;
+       buffer[8] = 0x16;
+       buffer[9] = 0x79;
+
+       mod_ctype.wdouble(-0.000015130017658081283,
+           'big', buffer, 2);
+       ASSERT.equal(0xbe, buffer[2]);
+       ASSERT.equal(0xef, buffer[3]);
+       ASSERT.equal(0xba, buffer[4]);
+       ASSERT.equal(0xdd, buffer[5]);
+       ASSERT.equal(0xca, buffer[6]);
+       ASSERT.equal(0xfe, buffer[7]);
+       ASSERT.equal(0x16, buffer[8]);
+       ASSERT.equal(0x79, buffer[9]);
+
+       mod_ctype.wdouble(-0.000015130017658081283,
+           'little', buffer, 2);
+       ASSERT.equal(0xbe, buffer[9]);
+       ASSERT.equal(0xef, buffer[8]);
+       ASSERT.equal(0xba, buffer[7]);
+       ASSERT.equal(0xdd, buffer[6]);
+       ASSERT.equal(0xca, buffer[5]);
+       ASSERT.equal(0xfe, buffer[4]);
+       ASSERT.equal(0x16, buffer[3]);
+       ASSERT.equal(0x79, buffer[2]);
+}
+
+testfloat();
+testdouble();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.64.js
new file mode 100755 (executable)
index 0000000..1ffdac0
--- /dev/null
@@ -0,0 +1,638 @@
+/*
+ * Test our ability to read and write signed 64-bit integers.
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function testRead()
+{
+       var res, data;
+       data = new Buffer(10);
+
+       data[0] = 0x32;
+       data[1] = 0x65;
+       data[2] = 0x42;
+       data[3] = 0x56;
+       data[4] = 0x23;
+       data[5] = 0xff;
+       data[6] = 0xff;
+       data[7] = 0xff;
+       data[8] = 0x89;
+       data[9] = 0x11;
+       res = mod_ctype.rsint64(data, 'big', 0);
+       ASSERT.equal(0x32654256, res[0]);
+       ASSERT.equal(0x23ffffff, res[1]);
+       res = mod_ctype.rsint64(data, 'big', 1);
+       ASSERT.equal(0x65425623, res[0]);
+       ASSERT.equal(0xffffff89, res[1]);
+       res = mod_ctype.rsint64(data, 'big', 2);
+       ASSERT.equal(0x425623ff, res[0]);
+       ASSERT.equal(0xffff8911, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 0);
+       ASSERT.equal(-0x000000dc, res[0]);
+       ASSERT.equal(-0xa9bd9ace, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 1);
+       ASSERT.equal(-0x76000000, res[0]);
+       ASSERT.equal(-0xdca9bd9b, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 2);
+       ASSERT.equal(0x1189ffff, res[0]);
+       ASSERT.equal(0xff235642, res[1]);
+
+       data.fill(0x00);
+       res = mod_ctype.rsint64(data, 'big', 0);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(0x00000000, res[1]);
+       res = mod_ctype.rsint64(data, 'big', 1);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(0x00000000, res[1]);
+       res = mod_ctype.rsint64(data, 'big', 2);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(0x00000000, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 0);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(0x00000000, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 1);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(0x00000000, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 2);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(0x00000000, res[1]);
+
+       data.fill(0xff);
+       res = mod_ctype.rsint64(data, 'big', 0);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(-1, res[1]);
+       res = mod_ctype.rsint64(data, 'big', 1);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(-1, res[1]);
+       res = mod_ctype.rsint64(data, 'big', 2);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(-1, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 0);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(-1, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 1);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(-1, res[1]);
+       res = mod_ctype.rsint64(data, 'little', 2);
+       ASSERT.equal(0x00000000, res[0]);
+       ASSERT.equal(-1, res[1]);
+
+       data[0] = 0x80;
+       data[1] = 0x00;
+       data[2] = 0x00;
+       data[3] = 0x00;
+       data[4] = 0x00;
+       data[5] = 0x00;
+       data[6] = 0x00;
+       data[7] = 0x00;
+       res = mod_ctype.rsint64(data, 'big', 0);
+       ASSERT.equal(-0x80000000, res[0]);
+       ASSERT.equal(0, res[1]);
+
+
+       data[7] = 0x80;
+       data[6] = 0x00;
+       data[5] = 0x00;
+       data[4] = 0x00;
+       data[3] = 0x00;
+       data[2] = 0x00;
+       data[1] = 0x00;
+       data[0] = 0x00;
+       res = mod_ctype.rsint64(data, 'little', 0);
+       ASSERT.equal(-0x80000000, res[0]);
+       ASSERT.equal(0, res[1]);
+
+       data[0] = 0x80;
+       data[1] = 0x00;
+       data[2] = 0x00;
+       data[3] = 0x00;
+       data[4] = 0x00;
+       data[5] = 0x00;
+       data[6] = 0x00;
+       data[7] = 0x01;
+       res = mod_ctype.rsint64(data, 'big', 0);
+       ASSERT.equal(-0x7fffffff, res[0]);
+       ASSERT.equal(-0xffffffff, res[1]);
+
+
+}
+
+function testWriteZero()
+{
+       var data, buf;
+       buf = new Buffer(10);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wsint64(data, 'big', buf, 0);
+       ASSERT.equal(0, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wsint64(data, 'big', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wsint64(data, 'big', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0, buf[9]);
+
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wsint64(data, 'little', buf, 0);
+       ASSERT.equal(0, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wsint64(data, 'little', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wsint64(data, 'little', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0, buf[9]);
+}
+
+/*
+ * Also include tests that are going to force us to go into a negative value and
+ * insure that it's written correctly.
+ */
+function testWrite()
+{
+       var data, buf;
+
+       buf = new Buffer(10);
+       data = [ 0x234456, 0x87 ];
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 0);
+       ASSERT.equal(0x00, buf[0]);
+       ASSERT.equal(0x23, buf[1]);
+       ASSERT.equal(0x44, buf[2]);
+       ASSERT.equal(0x56, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x87, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x23, buf[2]);
+       ASSERT.equal(0x44, buf[3]);
+       ASSERT.equal(0x56, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x87, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x23, buf[3]);
+       ASSERT.equal(0x44, buf[4]);
+       ASSERT.equal(0x56, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x00, buf[8]);
+       ASSERT.equal(0x87, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 0);
+       ASSERT.equal(0x87, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x56, buf[4]);
+       ASSERT.equal(0x44, buf[5]);
+       ASSERT.equal(0x23, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x87, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x56, buf[5]);
+       ASSERT.equal(0x44, buf[6]);
+       ASSERT.equal(0x23, buf[7]);
+       ASSERT.equal(0x00, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0x87, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x56, buf[6]);
+       ASSERT.equal(0x44, buf[7]);
+       ASSERT.equal(0x23, buf[8]);
+       ASSERT.equal(0x00, buf[9]);
+
+       data = [0x3421, 0x34abcdba];
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 0);
+       ASSERT.equal(0x00, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x34, buf[2]);
+       ASSERT.equal(0x21, buf[3]);
+       ASSERT.equal(0x34, buf[4]);
+       ASSERT.equal(0xab, buf[5]);
+       ASSERT.equal(0xcd, buf[6]);
+       ASSERT.equal(0xba, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x34, buf[3]);
+       ASSERT.equal(0x21, buf[4]);
+       ASSERT.equal(0x34, buf[5]);
+       ASSERT.equal(0xab, buf[6]);
+       ASSERT.equal(0xcd, buf[7]);
+       ASSERT.equal(0xba, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x34, buf[4]);
+       ASSERT.equal(0x21, buf[5]);
+       ASSERT.equal(0x34, buf[6]);
+       ASSERT.equal(0xab, buf[7]);
+       ASSERT.equal(0xcd, buf[8]);
+       ASSERT.equal(0xba, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 0);
+       ASSERT.equal(0xba, buf[0]);
+       ASSERT.equal(0xcd, buf[1]);
+       ASSERT.equal(0xab, buf[2]);
+       ASSERT.equal(0x34, buf[3]);
+       ASSERT.equal(0x21, buf[4]);
+       ASSERT.equal(0x34, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0xba, buf[1]);
+       ASSERT.equal(0xcd, buf[2]);
+       ASSERT.equal(0xab, buf[3]);
+       ASSERT.equal(0x34, buf[4]);
+       ASSERT.equal(0x21, buf[5]);
+       ASSERT.equal(0x34, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x00, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0xba, buf[2]);
+       ASSERT.equal(0xcd, buf[3]);
+       ASSERT.equal(0xab, buf[4]);
+       ASSERT.equal(0x34, buf[5]);
+       ASSERT.equal(0x21, buf[6]);
+       ASSERT.equal(0x34, buf[7]);
+       ASSERT.equal(0x00, buf[8]);
+       ASSERT.equal(0x00, buf[9]);
+
+
+       data = [ -0x80000000, 0 ];
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 0);
+       ASSERT.equal(0x80, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 0);
+       ASSERT.equal(0x00, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x80, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       data = [ -0x7fffffff, -0xffffffff ];
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 0);
+       ASSERT.equal(0x80, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x01, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 0);
+       ASSERT.equal(0x01, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x80, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       data = [ 0x0, -0x1];
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'big', buf, 0);
+       ASSERT.equal(0xff, buf[0]);
+       ASSERT.equal(0xff, buf[1]);
+       ASSERT.equal(0xff, buf[2]);
+       ASSERT.equal(0xff, buf[3]);
+       ASSERT.equal(0xff, buf[4]);
+       ASSERT.equal(0xff, buf[5]);
+       ASSERT.equal(0xff, buf[6]);
+       ASSERT.equal(0xff, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wsint64(data, 'little', buf, 0);
+       ASSERT.equal(0xff, buf[0]);
+       ASSERT.equal(0xff, buf[1]);
+       ASSERT.equal(0xff, buf[2]);
+       ASSERT.equal(0xff, buf[3]);
+       ASSERT.equal(0xff, buf[4]);
+       ASSERT.equal(0xff, buf[5]);
+       ASSERT.equal(0xff, buf[6]);
+       ASSERT.equal(0xff, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+}
+
+/*
+ * Make sure we catch invalid writes.
+ */
+function testWriteInvalid()
+{
+       var data, buf;
+
+       /* Buffer too small */
+       buf = new Buffer(4);
+       data = [ 0, 0];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 0);
+       }, Error, 'buffer too small');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 0);
+       }, Error, 'buffer too small');
+
+       /* Beyond the end of the buffer */
+       buf = new Buffer(12);
+       data = [ 0, 0];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 11);
+       }, Error, 'write beyond end of buffer');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 11);
+       }, Error, 'write beyond end of buffer');
+
+       /* Write fractional values */
+       buf = new Buffer(12);
+       data = [ 3.33, 0 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ 0, 3.3 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ -3.33, 0 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ 0, -3.3 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ 3.33, 2.42 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ 3.33, -2.42 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ -3.33, -2.42 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ -3.33, 2.42 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       /* Signs don't match */
+       buf = new Buffer(12);
+       data = [ 0x800000, -0x32 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ -0x800000, 0x32 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       /* Write values that are too large */
+       buf = new Buffer(12);
+       data = [ 0x80000000, 0 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ 0x7fffffff, 0x100000000 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ 0x00, 0x800000000 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ 0xffffffffff, 0xffffff238 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ 0x23, 0xffffff238 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ -0x80000000, -0xfff238 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ -0x80000004, -0xfff238 ];
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wsint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+}
+
+
+testRead();
+testWrite();
+testWriteZero();
+testWriteInvalid();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.rint.js
new file mode 100755 (executable)
index 0000000..5236d26
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Tests to verify we're reading in signed integers correctly
+ */
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+/*
+ * Test 8 bit signed integers
+ */
+function test8()
+{
+       var data = new Buffer(4);
+
+       data[0] = 0x23;
+       ASSERT.equal(0x23, mod_ctype.rsint8(data, 'big', 0));
+       ASSERT.equal(0x23, mod_ctype.rsint8(data, 'little', 0));
+
+       data[0] = 0xff;
+       ASSERT.equal(-1, mod_ctype.rsint8(data, 'big', 0));
+       ASSERT.equal(-1, mod_ctype.rsint8(data, 'little', 0));
+
+       data[0] = 0x87;
+       data[1] = 0xab;
+       data[2] = 0x7c;
+       data[3] = 0xef;
+       ASSERT.equal(-121, mod_ctype.rsint8(data, 'big', 0));
+       ASSERT.equal(-85, mod_ctype.rsint8(data, 'big', 1));
+       ASSERT.equal(124, mod_ctype.rsint8(data, 'big', 2));
+       ASSERT.equal(-17, mod_ctype.rsint8(data, 'big', 3));
+       ASSERT.equal(-121, mod_ctype.rsint8(data, 'little', 0));
+       ASSERT.equal(-85, mod_ctype.rsint8(data, 'little', 1));
+       ASSERT.equal(124, mod_ctype.rsint8(data, 'little', 2));
+       ASSERT.equal(-17, mod_ctype.rsint8(data, 'little', 3));
+}
+
+function test16()
+{
+       var buffer = new Buffer(6);
+       buffer[0] = 0x16;
+       buffer[1] = 0x79;
+       ASSERT.equal(0x1679, mod_ctype.rsint16(buffer, 'big', 0));
+       ASSERT.equal(0x7916, mod_ctype.rsint16(buffer, 'little', 0));
+
+       buffer[0] = 0xff;
+       buffer[1] = 0x80;
+       ASSERT.equal(-128, mod_ctype.rsint16(buffer, 'big', 0));
+       ASSERT.equal(-32513, mod_ctype.rsint16(buffer, 'little', 0));
+
+       /* test offset with weenix */
+       buffer[0] = 0x77;
+       buffer[1] = 0x65;
+       buffer[2] = 0x65;
+       buffer[3] = 0x6e;
+       buffer[4] = 0x69;
+       buffer[5] = 0x78;
+       ASSERT.equal(0x7765, mod_ctype.rsint16(buffer, 'big', 0));
+       ASSERT.equal(0x6565, mod_ctype.rsint16(buffer, 'big', 1));
+       ASSERT.equal(0x656e, mod_ctype.rsint16(buffer, 'big', 2));
+       ASSERT.equal(0x6e69, mod_ctype.rsint16(buffer, 'big', 3));
+       ASSERT.equal(0x6978, mod_ctype.rsint16(buffer, 'big', 4));
+       ASSERT.equal(0x6577, mod_ctype.rsint16(buffer, 'little', 0));
+       ASSERT.equal(0x6565, mod_ctype.rsint16(buffer, 'little', 1));
+       ASSERT.equal(0x6e65, mod_ctype.rsint16(buffer, 'little', 2));
+       ASSERT.equal(0x696e, mod_ctype.rsint16(buffer, 'little', 3));
+       ASSERT.equal(0x7869, mod_ctype.rsint16(buffer, 'little', 4));
+}
+
+function test32()
+{
+       var buffer = new Buffer(6);
+       buffer[0] = 0x43;
+       buffer[1] = 0x53;
+       buffer[2] = 0x16;
+       buffer[3] = 0x79;
+       ASSERT.equal(0x43531679, mod_ctype.rsint32(buffer, 'big', 0));
+       ASSERT.equal(0x79165343, mod_ctype.rsint32(buffer, 'little', 0));
+
+       buffer[0] = 0xff;
+       buffer[1] = 0xfe;
+       buffer[2] = 0xef;
+       buffer[3] = 0xfa;
+       ASSERT.equal(-69638, mod_ctype.rsint32(buffer, 'big', 0));
+       ASSERT.equal(-84934913, mod_ctype.rsint32(buffer, 'little', 0));
+
+       buffer[0] = 0x42;
+       buffer[1] = 0xc3;
+       buffer[2] = 0x95;
+       buffer[3] = 0xa9;
+       buffer[4] = 0x36;
+       buffer[5] = 0x17;
+       ASSERT.equal(0x42c395a9, mod_ctype.rsint32(buffer, 'big', 0));
+       ASSERT.equal(-1013601994, mod_ctype.rsint32(buffer, 'big', 1));
+       ASSERT.equal(-1784072681, mod_ctype.rsint32(buffer, 'big', 2));
+       ASSERT.equal(-1449802942, mod_ctype.rsint32(buffer, 'little', 0));
+       ASSERT.equal(917083587, mod_ctype.rsint32(buffer, 'little', 1));
+       ASSERT.equal(389458325, mod_ctype.rsint32(buffer, 'little', 2));
+}
+
+test8();
+test16();
+test32();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wbounds.js
new file mode 100755 (executable)
index 0000000..5488177
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Test to make sure that we properly are erroring whenever we try to write
+ * beyond the size of the integer.
+ */
+
+var mod_ctio = require('../../../ctio.js');
+var mod_assert = require('assert');
+var tb = new Buffer(16); /* Largest buffer we'll need */
+
+var cases = [
+       { func:
+       function () {
+               mod_ctio.wsint8(0x80, 'big', tb, 0);
+       }, test: '+int8_t' },
+       { func:
+       function () {
+               mod_ctio.wsint8(-0x81, 'big', tb, 0);
+       }, test: '-int8_t' },
+
+       { func:
+       function () {
+               mod_ctio.wsint16(0x8000, 'big', tb, 0);
+       }, test: '+int16_t' },
+       { func:
+       function () {
+               mod_ctio.wsint16(-0x8001, 'big', tb, 0);
+       }, test: '-int16_t' },
+       { func:
+       function () {
+               mod_ctio.wsint32(0x80000000, 'big', tb, 0);
+       }, test: '+int32_t' },
+       { func:
+       function () {
+               mod_ctio.wsint32(-0x80000001, 'big', tb, 0);
+       }, test: '-int32_t' },
+       { func:
+       function () {
+               mod_ctio.wsint64([ 0x80000000, 0 ], 'big', tb, 0);
+       }, test: '+int64_t' },
+       { func:
+       function () {
+               mod_ctio.wsint64([ -0x80000000, -1 ], 'big', tb, 0);
+       }, test: '-int64_t' }
+];
+
+function test()
+{
+       var ii;
+       for (ii = 0; ii < cases.length; ii++)
+               mod_assert.throws(cases[ii]['func'], Error, cases[ii]['test']);
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/int/tst.wint.js
new file mode 100755 (executable)
index 0000000..98b6a32
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Tests to verify we're writing signed integers correctly
+ */
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function test8()
+{
+       var buffer = new Buffer(4);
+       mod_ctype.wsint8(0x23, 'big', buffer, 0);
+       mod_ctype.wsint8(0x23, 'little', buffer, 1);
+       mod_ctype.wsint8(-5, 'big', buffer, 2);
+       mod_ctype.wsint8(-5, 'little', buffer, 3);
+
+       ASSERT.equal(0x23, buffer[0]);
+       ASSERT.equal(0x23, buffer[1]);
+       ASSERT.equal(0xfb, buffer[2]);
+       ASSERT.equal(0xfb, buffer[3]);
+
+       /* Make sure we handle truncation correctly */
+       ASSERT.throws(function () {
+            mod_ctype.wsint8(0xabc, 'big', buffer, 0);
+       });
+       ASSERT.throws(function () {
+            mod_ctype.wsint8(0xabc, 'little', buffer, 0);
+       });
+}
+
+function test16()
+{
+       var buffer = new Buffer(6);
+       mod_ctype.wsint16(0x0023, 'big', buffer, 0);
+       mod_ctype.wsint16(0x0023, 'little', buffer, 2);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x23, buffer[1]);
+       ASSERT.equal(0x23, buffer[2]);
+       ASSERT.equal(0x00, buffer[3]);
+       mod_ctype.wsint16(-5, 'big', buffer, 0);
+       mod_ctype.wsint16(-5, 'little', buffer, 2);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0xfb, buffer[1]);
+       ASSERT.equal(0xfb, buffer[2]);
+       ASSERT.equal(0xff, buffer[3]);
+
+       mod_ctype.wsint16(-1679, 'big', buffer, 1);
+       mod_ctype.wsint16(-1679, 'little', buffer, 3);
+       ASSERT.equal(0xf9, buffer[1]);
+       ASSERT.equal(0x71, buffer[2]);
+       ASSERT.equal(0x71, buffer[3]);
+       ASSERT.equal(0xf9, buffer[4]);
+}
+
+function test32()
+{
+       var buffer = new Buffer(8);
+       mod_ctype.wsint32(0x23, 'big', buffer, 0);
+       mod_ctype.wsint32(0x23, 'little', buffer, 4);
+       ASSERT.equal(0x00, buffer[0]);
+       ASSERT.equal(0x00, buffer[1]);
+       ASSERT.equal(0x00, buffer[2]);
+       ASSERT.equal(0x23, buffer[3]);
+       ASSERT.equal(0x23, buffer[4]);
+       ASSERT.equal(0x00, buffer[5]);
+       ASSERT.equal(0x00, buffer[6]);
+       ASSERT.equal(0x00, buffer[7]);
+
+       mod_ctype.wsint32(-5, 'big', buffer, 0);
+       mod_ctype.wsint32(-5, 'little', buffer, 4);
+       ASSERT.equal(0xff, buffer[0]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xff, buffer[2]);
+       ASSERT.equal(0xfb, buffer[3]);
+       ASSERT.equal(0xfb, buffer[4]);
+       ASSERT.equal(0xff, buffer[5]);
+       ASSERT.equal(0xff, buffer[6]);
+       ASSERT.equal(0xff, buffer[7]);
+
+       mod_ctype.wsint32(-805306713, 'big', buffer, 0);
+       mod_ctype.wsint32(-805306713, 'litle', buffer, 4);
+       ASSERT.equal(0xcf, buffer[0]);
+       ASSERT.equal(0xff, buffer[1]);
+       ASSERT.equal(0xfe, buffer[2]);
+       ASSERT.equal(0xa7, buffer[3]);
+       ASSERT.equal(0xa7, buffer[4]);
+       ASSERT.equal(0xfe, buffer[5]);
+       ASSERT.equal(0xff, buffer[6]);
+       ASSERT.equal(0xcf, buffer[7]);
+}
+
+test8();
+test16();
+test32();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.64.js
new file mode 100755 (executable)
index 0000000..cf66ac7
--- /dev/null
@@ -0,0 +1,451 @@
+/*
+ * Test our ability to read and write unsigned 64-bit integers.
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+function testRead()
+{
+       var res, data;
+       data = new Buffer(10);
+
+       data[0] = 0x32;
+       data[1] = 0x65;
+       data[2] = 0x42;
+       data[3] = 0x56;
+       data[4] = 0x23;
+       data[5] = 0xff;
+       data[6] = 0xff;
+       data[7] = 0xff;
+       data[8] = 0x89;
+       data[9] = 0x11;
+       res = mod_ctype.ruint64(data, 'big', 0);
+       ASSERT.equal(0x32654256, res[0]);
+       ASSERT.equal(0x23ffffff, res[1]);
+       res = mod_ctype.ruint64(data, 'big', 1);
+       ASSERT.equal(0x65425623, res[0]);
+       ASSERT.equal(0xffffff89, res[1]);
+       res = mod_ctype.ruint64(data, 'big', 2);
+       ASSERT.equal(0x425623ff, res[0]);
+       ASSERT.equal(0xffff8911, res[1]);
+       res = mod_ctype.ruint64(data, 'little', 0);
+       ASSERT.equal(0xffffff23, res[0]);
+       ASSERT.equal(0x56426532, res[1]);
+       res = mod_ctype.ruint64(data, 'little', 1);
+       ASSERT.equal(0x89ffffff, res[0]);
+       ASSERT.equal(0x23564265, res[1]);
+       res = mod_ctype.ruint64(data, 'little', 2);
+       ASSERT.equal(0x1189ffff, res[0]);
+       ASSERT.equal(0xff235642, res[1]);
+
+}
+
+function testReadOver()
+{
+       var res, data;
+       data = new Buffer(10);
+
+       data[0] = 0x80;
+       data[1] = 0xff;
+       data[2] = 0x80;
+       data[3] = 0xff;
+       data[4] = 0x80;
+       data[5] = 0xff;
+       data[6] = 0x80;
+       data[7] = 0xff;
+       data[8] = 0x80;
+       data[9] = 0xff;
+       res = mod_ctype.ruint64(data, 'big', 0);
+       ASSERT.equal(0x80ff80ff, res[0]);
+       ASSERT.equal(0x80ff80ff, res[1]);
+       res = mod_ctype.ruint64(data, 'big', 1);
+       ASSERT.equal(0xff80ff80, res[0]);
+       ASSERT.equal(0xff80ff80, res[1]);
+       res = mod_ctype.ruint64(data, 'big', 2);
+       ASSERT.equal(0x80ff80ff, res[0]);
+       ASSERT.equal(0x80ff80ff, res[1]);
+       res = mod_ctype.ruint64(data, 'little', 0);
+       ASSERT.equal(0xff80ff80, res[0]);
+       ASSERT.equal(0xff80ff80, res[1]);
+       res = mod_ctype.ruint64(data, 'little', 1);
+       ASSERT.equal(0x80ff80ff, res[0]);
+       ASSERT.equal(0x80ff80ff, res[1]);
+       res = mod_ctype.ruint64(data, 'little', 2);
+       ASSERT.equal(0xff80ff80, res[0]);
+       ASSERT.equal(0xff80ff80, res[1]);
+}
+
+function testWriteZero()
+{
+       var data, buf;
+       buf = new Buffer(10);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wuint64(data, 'big', buf, 0);
+       ASSERT.equal(0, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wuint64(data, 'big', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wuint64(data, 'big', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0, buf[9]);
+
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wuint64(data, 'little', buf, 0);
+       ASSERT.equal(0, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wuint64(data, 'little', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       data = [0, 0];
+       mod_ctype.wuint64(data, 'little', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0, buf[2]);
+       ASSERT.equal(0, buf[3]);
+       ASSERT.equal(0, buf[4]);
+       ASSERT.equal(0, buf[5]);
+       ASSERT.equal(0, buf[6]);
+       ASSERT.equal(0, buf[7]);
+       ASSERT.equal(0, buf[8]);
+       ASSERT.equal(0, buf[9]);
+}
+
+/*
+ * Also include tests that are going to force us to go into a negative value and
+ * insure that it's written correctly.
+ */
+function testWrite()
+{
+       var data, buf;
+
+       buf = new Buffer(10);
+       data = [ 0x234456, 0x87 ];
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'big', buf, 0);
+       ASSERT.equal(0x00, buf[0]);
+       ASSERT.equal(0x23, buf[1]);
+       ASSERT.equal(0x44, buf[2]);
+       ASSERT.equal(0x56, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x87, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'big', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x23, buf[2]);
+       ASSERT.equal(0x44, buf[3]);
+       ASSERT.equal(0x56, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x87, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'big', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x23, buf[3]);
+       ASSERT.equal(0x44, buf[4]);
+       ASSERT.equal(0x56, buf[5]);
+       ASSERT.equal(0x00, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x00, buf[8]);
+       ASSERT.equal(0x87, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'little', buf, 0);
+       ASSERT.equal(0x87, buf[0]);
+       ASSERT.equal(0x00, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x56, buf[4]);
+       ASSERT.equal(0x44, buf[5]);
+       ASSERT.equal(0x23, buf[6]);
+       ASSERT.equal(0x00, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'little', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x87, buf[1]);
+       ASSERT.equal(0x00, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x56, buf[5]);
+       ASSERT.equal(0x44, buf[6]);
+       ASSERT.equal(0x23, buf[7]);
+       ASSERT.equal(0x00, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'little', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0x87, buf[2]);
+       ASSERT.equal(0x00, buf[3]);
+       ASSERT.equal(0x00, buf[4]);
+       ASSERT.equal(0x00, buf[5]);
+       ASSERT.equal(0x56, buf[6]);
+       ASSERT.equal(0x44, buf[7]);
+       ASSERT.equal(0x23, buf[8]);
+       ASSERT.equal(0x00, buf[9]);
+
+       data = [0xffff3421, 0x34abcdba];
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'big', buf, 0);
+       ASSERT.equal(0xff, buf[0]);
+       ASSERT.equal(0xff, buf[1]);
+       ASSERT.equal(0x34, buf[2]);
+       ASSERT.equal(0x21, buf[3]);
+       ASSERT.equal(0x34, buf[4]);
+       ASSERT.equal(0xab, buf[5]);
+       ASSERT.equal(0xcd, buf[6]);
+       ASSERT.equal(0xba, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'big', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0xff, buf[1]);
+       ASSERT.equal(0xff, buf[2]);
+       ASSERT.equal(0x34, buf[3]);
+       ASSERT.equal(0x21, buf[4]);
+       ASSERT.equal(0x34, buf[5]);
+       ASSERT.equal(0xab, buf[6]);
+       ASSERT.equal(0xcd, buf[7]);
+       ASSERT.equal(0xba, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'big', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0xff, buf[2]);
+       ASSERT.equal(0xff, buf[3]);
+       ASSERT.equal(0x34, buf[4]);
+       ASSERT.equal(0x21, buf[5]);
+       ASSERT.equal(0x34, buf[6]);
+       ASSERT.equal(0xab, buf[7]);
+       ASSERT.equal(0xcd, buf[8]);
+       ASSERT.equal(0xba, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'little', buf, 0);
+       ASSERT.equal(0xba, buf[0]);
+       ASSERT.equal(0xcd, buf[1]);
+       ASSERT.equal(0xab, buf[2]);
+       ASSERT.equal(0x34, buf[3]);
+       ASSERT.equal(0x21, buf[4]);
+       ASSERT.equal(0x34, buf[5]);
+       ASSERT.equal(0xff, buf[6]);
+       ASSERT.equal(0xff, buf[7]);
+       ASSERT.equal(0x66, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'little', buf, 1);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0xba, buf[1]);
+       ASSERT.equal(0xcd, buf[2]);
+       ASSERT.equal(0xab, buf[3]);
+       ASSERT.equal(0x34, buf[4]);
+       ASSERT.equal(0x21, buf[5]);
+       ASSERT.equal(0x34, buf[6]);
+       ASSERT.equal(0xff, buf[7]);
+       ASSERT.equal(0xff, buf[8]);
+       ASSERT.equal(0x66, buf[9]);
+
+       buf.fill(0x66);
+       mod_ctype.wuint64(data, 'little', buf, 2);
+       ASSERT.equal(0x66, buf[0]);
+       ASSERT.equal(0x66, buf[1]);
+       ASSERT.equal(0xba, buf[2]);
+       ASSERT.equal(0xcd, buf[3]);
+       ASSERT.equal(0xab, buf[4]);
+       ASSERT.equal(0x34, buf[5]);
+       ASSERT.equal(0x21, buf[6]);
+       ASSERT.equal(0x34, buf[7]);
+       ASSERT.equal(0xff, buf[8]);
+       ASSERT.equal(0xff, buf[9]);
+}
+
+/*
+ * Make sure we catch invalid writes.
+ */
+function testWriteInvalid()
+{
+       var data, buf;
+
+       /* Buffer too small */
+       buf = new Buffer(4);
+       data = [ 0, 0];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 0);
+       }, Error, 'buffer too small');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 0);
+       }, Error, 'buffer too small');
+
+       /* Beyond the end of the buffer */
+       buf = new Buffer(12);
+       data = [ 0, 0];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 11);
+       }, Error, 'write beyond end of buffer');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 11);
+       }, Error, 'write beyond end of buffer');
+
+       /* Write negative values */
+       buf = new Buffer(12);
+       data = [ -3, 0 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write negative number');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write negative number');
+
+       data = [ 0, -3 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write negative number');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write negative number');
+
+       data = [ -3, -3 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write negative number');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write negative number');
+
+
+       /* Write fractional values */
+       buf = new Buffer(12);
+       data = [ 3.33, 0 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ 0, 3.3 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       data = [ 3.33, 2.42 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write fractions');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write fractions');
+
+       /* Write values that are too large */
+       buf = new Buffer(12);
+       data = [ 0xffffffffff, 23 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ 0xffffffffff, 0xffffff238 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+
+       data = [ 0x23, 0xffffff238 ];
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'big', buf, 1);
+       }, Error, 'write too large');
+       ASSERT.throws(function () {
+           mod_ctype.wuint64(data, 'little', buf, 1);
+       }, Error, 'write too large');
+}
+
+
+testRead();
+testReadOver();
+testWriteZero();
+testWrite();
+testWriteInvalid();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.roundtrip.js
new file mode 100755 (executable)
index 0000000..87ae59b
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * A battery of tests for sucessful round-trip between writes and reads
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+
+/*
+ * What the heck, let's just test every value for 8-bits.
+ */
+
+function test8() {
+       var data = new Buffer(1);
+       var i;
+       for (i = 0; i < 256; i++) {
+               mod_ctype.wuint8(i, 'big', data, 0);
+               ASSERT.equal(i, mod_ctype.ruint8(data, 'big', 0));
+               mod_ctype.wuint8(i, 'little', data, 0);
+               ASSERT.equal(i, mod_ctype.ruint8(data, 'little', 0));
+       }
+       ASSERT.ok(true);
+}
+
+/*
+ * Test a random sample of 256 values in the 16-bit unsigned range
+ */
+
+function test16() {
+       var data = new Buffer(2);
+       var i = 0;
+       for (i = 0; i < 256; i++) {
+               var value = Math.round(Math.random() * Math.pow(2, 16));
+               mod_ctype.wuint16(value, 'big', data, 0);
+               ASSERT.equal(value, mod_ctype.ruint16(data, 'big', 0));
+               mod_ctype.wuint16(value, 'little', data, 0);
+               ASSERT.equal(value, mod_ctype.ruint16(data, 'little', 0));
+       }
+}
+
+/*
+ * Test a random sample of 256 values in the 32-bit unsigned range
+ */
+
+function test32() {
+       var data = new Buffer(4);
+       var i = 0;
+       for (i = 0; i < 256; i++) {
+               var value = Math.round(Math.random() * Math.pow(2, 32));
+               mod_ctype.wuint32(value, 'big', data, 0);
+               ASSERT.equal(value, mod_ctype.ruint32(data, 'big', 0));
+               mod_ctype.wuint32(value, 'little', data, 0);
+               ASSERT.equal(value, mod_ctype.ruint32(data, 'little', 0));
+       }
+}
+
+/*
+ * Test a random sample of 256 values in the 64-bit unsigned range
+ */
+
+function test64() {
+       var data = new Buffer(8);
+       var i = 0;
+       for (i = 0; i < 256; i++) {
+               var low = Math.round(Math.random() * Math.pow(2, 32));
+               var high = Math.round(Math.random() * Math.pow(2, 32));
+               mod_ctype.wuint64([high, low], 'big', data, 0);
+               var result = mod_ctype.ruint64(data, 'big', 0);
+               ASSERT.equal(high, result[0]);
+               ASSERT.equal(low, result[1]);
+               mod_ctype.wuint64([high, low], 'little', data, 0);
+               result = mod_ctype.ruint64(data, 'little', 0);
+               ASSERT.equal(high, result[0]);
+               ASSERT.equal(low, result[1]);
+       }
+}
+
+exports.test8 = test8;
+exports.test16 = test16;
+exports.test32 = test32;
+exports.test64 = test64;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.ruint.js
new file mode 100755 (executable)
index 0000000..b67c077
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * A battery of tests to help us read a series of uints
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+/*
+ * We need to check the following things:
+ *  - We are correctly resolving big endian (doesn't mean anything for 8 bit)
+ *  - Correctly resolving little endian (doesn't mean anything for 8 bit)
+ *  - Correctly using the offsets
+ *  - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test8()
+{
+       var data = new Buffer(4);
+       data[0] = 23;
+       data[1] = 23;
+       data[2] = 23;
+       data[3] = 23;
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 0));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 0));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 1));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 1));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 2));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 2));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'big', 3));
+       ASSERT.equal(23, mod_ctype.ruint8(data, 'little', 3));
+       data[0] = 255; /* If it became a signed int, would be -1 */
+       ASSERT.equal(255, mod_ctype.ruint8(data, 'big', 0));
+       ASSERT.equal(255, mod_ctype.ruint8(data, 'little', 0));
+}
+
+/*
+ * Test 16 bit unsigned integers. We need to verify the same set as 8 bit, only
+ * now some of the issues actually matter:
+ *  - We are correctly resolving big endian
+ *  - Correctly resolving little endian
+ *  - Correctly using the offsets
+ *  - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test16()
+{
+       var data = new Buffer(4);
+       /* Test signed values first */
+       data[0] = 0;
+       data[1] = 0x23;
+       data[2] = 0x42;
+       data[3] = 0x3f;
+
+       ASSERT.equal(0x23, mod_ctype.ruint16(data, 'big', 0));
+       ASSERT.equal(0x2342, mod_ctype.ruint16(data, 'big', 1));
+       ASSERT.equal(0x423f, mod_ctype.ruint16(data, 'big', 2));
+
+       ASSERT.equal(0x2300, mod_ctype.ruint16(data, 'little', 0));
+       ASSERT.equal(0x4223, mod_ctype.ruint16(data, 'little', 1));
+       ASSERT.equal(0x3f42, mod_ctype.ruint16(data, 'little', 2));
+
+       data[0] = 0xfe;
+       data[1] = 0xfe;
+
+       ASSERT.equal(0xfefe, mod_ctype.ruint16(data, 'big', 0));
+       ASSERT.equal(0xfefe, mod_ctype.ruint16(data, 'little', 0));
+}
+
+/*
+ * Test 32 bit unsigned integers. We need to verify the same set as 8 bit, only
+ * now some of the issues actually matter:
+ *  - We are correctly resolving big endian
+ *  - Correctly using the offsets
+ *  - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test32()
+{
+       var data = new Buffer(8);
+       data[0] = 0x32;
+       data[1] = 0x65;
+       data[2] = 0x42;
+       data[3] = 0x56;
+       data[4] = 0x23;
+       data[5] = 0xff;
+
+       ASSERT.equal(0x32654256, mod_ctype.ruint32(data, 'big', 0));
+       ASSERT.equal(0x65425623, mod_ctype.ruint32(data, 'big', 1));
+       ASSERT.equal(0x425623ff, mod_ctype.ruint32(data, 'big', 2));
+
+       ASSERT.equal(0x56426532, mod_ctype.ruint32(data, 'little', 0));
+       ASSERT.equal(0x23564265, mod_ctype.ruint32(data, 'little', 1));
+       ASSERT.equal(0xff235642, mod_ctype.ruint32(data, 'little', 2));
+}
+
+test8();
+test16();
+test32();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctio/uint/tst.wuint.js
new file mode 100755 (executable)
index 0000000..d6c4230
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * A battery of tests to help us read a series of uints
+ */
+
+var mod_ctype = require('../../../ctio.js');
+var ASSERT = require('assert');
+
+/*
+ * We need to check the following things:
+ *  - We are correctly resolving big endian (doesn't mean anything for 8 bit)
+ *  - Correctly resolving little endian (doesn't mean anything for 8 bit)
+ *  - Correctly using the offsets
+ *  - Correctly interpreting values that are beyond the signed range as unsigned
+ */
+function test8()
+{
+       var data = new Buffer(4);
+       mod_ctype.wuint8(23, 'big', data, 0);
+       mod_ctype.wuint8(23, 'big', data, 1);
+       mod_ctype.wuint8(23, 'big', data, 2);
+       mod_ctype.wuint8(23, 'big', data, 3);
+       ASSERT.equal(23, data[0]);
+       ASSERT.equal(23, data[1]);
+       ASSERT.equal(23, data[2]);
+       ASSERT.equal(23, data[3]);
+       mod_ctype.wuint8(23, 'little', data, 0);
+       mod_ctype.wuint8(23, 'little', data, 1);
+       mod_ctype.wuint8(23, 'little', data, 2);
+       mod_ctype.wuint8(23, 'little', data, 3);
+       ASSERT.equal(23, data[0]);
+       ASSERT.equal(23, data[1]);
+       ASSERT.equal(23, data[2]);
+       ASSERT.equal(23, data[3]);
+       mod_ctype.wuint8(255, 'big', data, 0);
+       ASSERT.equal(255, data[0]);
+       mod_ctype.wuint8(255, 'little', data, 0);
+       ASSERT.equal(255, data[0]);
+}
+
+function test16()
+{
+       var value = 0x2343;
+       var data = new Buffer(4);
+       mod_ctype.wuint16(value, 'big', data, 0);
+       ASSERT.equal(0x23, data[0]);
+       ASSERT.equal(0x43, data[1]);
+       mod_ctype.wuint16(value, 'big', data, 1);
+       ASSERT.equal(0x23, data[1]);
+       ASSERT.equal(0x43, data[2]);
+       mod_ctype.wuint16(value, 'big', data, 2);
+       ASSERT.equal(0x23, data[2]);
+       ASSERT.equal(0x43, data[3]);
+
+       mod_ctype.wuint16(value, 'little', data, 0);
+       ASSERT.equal(0x23, data[1]);
+       ASSERT.equal(0x43, data[0]);
+
+       mod_ctype.wuint16(value, 'little', data, 1);
+       ASSERT.equal(0x23, data[2]);
+       ASSERT.equal(0x43, data[1]);
+
+       mod_ctype.wuint16(value, 'little', data, 2);
+       ASSERT.equal(0x23, data[3]);
+       ASSERT.equal(0x43, data[2]);
+
+       value = 0xff80;
+       mod_ctype.wuint16(value, 'little', data, 0);
+       ASSERT.equal(0xff, data[1]);
+       ASSERT.equal(0x80, data[0]);
+
+       mod_ctype.wuint16(value, 'big', data, 0);
+       ASSERT.equal(0xff, data[0]);
+       ASSERT.equal(0x80, data[1]);
+}
+
+function test32()
+{
+       var data = new Buffer(6);
+       var value = 0xe7f90a6d;
+
+       mod_ctype.wuint32(value, 'big', data, 0);
+       ASSERT.equal(0xe7, data[0]);
+       ASSERT.equal(0xf9, data[1]);
+       ASSERT.equal(0x0a, data[2]);
+       ASSERT.equal(0x6d, data[3]);
+
+       mod_ctype.wuint32(value, 'big', data, 1);
+       ASSERT.equal(0xe7, data[1]);
+       ASSERT.equal(0xf9, data[2]);
+       ASSERT.equal(0x0a, data[3]);
+       ASSERT.equal(0x6d, data[4]);
+
+       mod_ctype.wuint32(value, 'big', data, 2);
+       ASSERT.equal(0xe7, data[2]);
+       ASSERT.equal(0xf9, data[3]);
+       ASSERT.equal(0x0a, data[4]);
+       ASSERT.equal(0x6d, data[5]);
+
+       mod_ctype.wuint32(value, 'little', data, 0);
+       ASSERT.equal(0xe7, data[3]);
+       ASSERT.equal(0xf9, data[2]);
+       ASSERT.equal(0x0a, data[1]);
+       ASSERT.equal(0x6d, data[0]);
+
+       mod_ctype.wuint32(value, 'little', data, 1);
+       ASSERT.equal(0xe7, data[4]);
+       ASSERT.equal(0xf9, data[3]);
+       ASSERT.equal(0x0a, data[2]);
+       ASSERT.equal(0x6d, data[1]);
+
+       mod_ctype.wuint32(value, 'little', data, 2);
+       ASSERT.equal(0xe7, data[5]);
+       ASSERT.equal(0xf9, data[4]);
+       ASSERT.equal(0x0a, data[3]);
+       ASSERT.equal(0x6d, data[2]);
+}
+
+function test64()
+{
+       var data = new Buffer(10);
+       var value = 0x0007cda8e7f90a6d;
+       var high = Math.floor(value / Math.pow(2, 32));
+       var low = value - (high * Math.pow(2, 32));
+       ASSERT.equal(0x0007cda8, high);
+       ASSERT.equal(0xe7f90a6d, low);
+
+       mod_ctype.wuint64([high, low], 'big', data, 0);
+       ASSERT.equal(0x00, data[0]);
+       ASSERT.equal(0x07, data[1]);
+       ASSERT.equal(0xcd, data[2]);
+       ASSERT.equal(0xa8, data[3]);
+       ASSERT.equal(0xe7, data[4]);
+       ASSERT.equal(0xf9, data[5]);
+       ASSERT.equal(0x0a, data[6]);
+       ASSERT.equal(0x6d, data[7]);
+
+       mod_ctype.wuint64([high, low], 'little', data, 0);
+       ASSERT.equal(0x6d, data[0]);
+       ASSERT.equal(0x0a, data[1]);
+       ASSERT.equal(0xf9, data[2]);
+       ASSERT.equal(0xe7, data[3]);
+       ASSERT.equal(0xa8, data[4]);
+       ASSERT.equal(0xcd, data[5]);
+       ASSERT.equal(0x07, data[6]);
+       ASSERT.equal(0x00, data[7]);
+}
+
+test8();
+test16();
+test32();
+test64();
+
+exports.test8 = test8;
+exports.test16 = test16;
+exports.test32 = test32;
+exports.test64 = test64;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicr.js
new file mode 100755 (executable)
index 0000000..e989515
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Simple does to see if it works at all
+ */
+var mod_ctype = require('../../ctype');
+var ASSERT = require('assert');
+var mod_sys = require('sys');
+
+function test()
+{
+       var ii, p, result, buffer;
+
+       p = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer(4);
+       buffer[0] = 23;
+       buffer[3] = 42;
+       result = p.readData([ { x: { type: 'uint8_t' }},
+           { y: { type: 'uint8_t', offset: 3 }}
+       ], buffer, 0);
+       ASSERT.equal(23, result['x']);
+       ASSERT.equal(42, result['y']);
+
+       buffer = new Buffer(23);
+       for (ii = 0; ii < 23; ii++)
+               buffer[ii] = 0;
+
+       buffer.write('Hello, world!');
+       result = p.readData([ { x: { type: 'char[20]' }} ], buffer, 0);
+
+       /*
+        * This is currently broken behvaior, need to redesign check
+        * ASSERT.equal('Hello, world!', result['x'].toString('utf-8', 0,
+        *  result['x'].length));
+        */
+
+       buffer = new Buffer(4);
+       buffer[0] = 0x03;
+       buffer[1] = 0x24;
+       buffer[2] = 0x25;
+       buffer[3] = 0x26;
+       result = p.readData([ { y: { type: 'uint8_t' }},
+           { x: { type: 'uint8_t[y]' }}], buffer, 0);
+       console.log(mod_sys.inspect(result, true));
+
+       p.typedef('ssize_t', 'int32_t');
+       ASSERT.deepEqual({ 'ssize_t': 'int32_t' }, p.lstypes());
+       result = p.readData([ { x: { type: 'ssize_t' } } ], buffer, 0);
+       ASSERT.equal(0x26252403, result['x']);
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.basicw.js
new file mode 100755 (executable)
index 0000000..89d446f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Simple does it fucking work at all test
+ */
+
+var mod_ctype = require('../../ctype');
+var ASSERT = require('assert');
+var mod_sys = require('sys');
+
+function test()
+{
+       var ii, p, buffer, buf2;
+
+       p = new mod_ctype.Parser({ endian: 'big' });
+       buffer = new Buffer(4);
+       p.writeData([ { x: { type: 'uint8_t', value: 23 }},
+           { y: { type: 'uint8_t', offset: 3, value: 42 }}
+       ], buffer, 0);
+       ASSERT.equal(23, buffer[0]);
+       ASSERT.equal(42, buffer[3]);
+
+       buffer = new Buffer(20);
+       for (ii = 0; ii < 20; ii++)
+               buffer[ii] = 0;
+
+       buffer.write('Hello, world!');
+       buf2 = new Buffer(22);
+       p.writeData([ { x: { type: 'char[20]', value: buffer }} ], buf2, 0);
+       for (ii = 0; ii < 20; ii++)
+               ASSERT.equal(buffer[ii], buf2[ii]);
+       /*
+        * This is currently broken behvaior, need to redesign check
+        * ASSERT.equal('Hello, world!', result['x'].toString('utf-8', 0,
+        *   result['x'].length));
+        */
+
+       buffer = new Buffer(4);
+       p.writeData([ { y: { type: 'uint8_t', value: 3 }},
+           { x: { type: 'uint8_t[y]', value: [ 0x24, 0x25, 0x26] }}],
+           buffer, 0);
+       console.log(mod_sys.inspect(buffer));
+
+       p.typedef('ssize_t', 'int32_t');
+       ASSERT.deepEqual({ 'ssize_t': 'int32_t' }, p.lstypes());
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.char.js
new file mode 100755 (executable)
index 0000000..14d9529
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Test the different forms of reading characters:
+ *
+ *  - the default, a single element buffer
+ *  - uint8, values are uint8_ts
+ *  - int8, values are int8_ts
+ */
+var mod_ctype = require('../../ctype');
+var mod_assert = require('assert');
+
+function test()
+{
+       var p, buf, res;
+
+       buf = new Buffer(1);
+       buf[0] = 255;
+
+       p = new mod_ctype.Parser({ endian: 'little'});
+       res = p.readData([ { c: { type: 'char' }} ], buf, 0);
+       res = res['c'];
+       mod_assert.ok(res instanceof Buffer);
+       mod_assert.equal(255, res[0]);
+
+       p = new mod_ctype.Parser({ endian: 'little',
+           'char-type': 'int8' });
+       res = p.readData([ { c: { type: 'char' }} ], buf, 0);
+       res = res['c'];
+       mod_assert.ok(typeof (res) == 'number', 'got typeof (res): ' +
+           typeof (res));
+       mod_assert.equal(-1, res);
+
+       p = new mod_ctype.Parser({ endian: 'little',
+           'char-type': 'uint8' });
+       res = p.readData([ { c: { type: 'char' }} ], buf, 0);
+       res = res['c'];
+       mod_assert.ok(typeof (res) == 'number', 'got typeof (res): ' +
+           typeof (res));
+       mod_assert.equal(255, res);
+
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.endian.js
new file mode 100755 (executable)
index 0000000..11fc2d2
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Simple test to make sure that the endian setting works.
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var parser, buf;
+
+       parser = new mod_ctype.Parser({
+           endian: 'little'
+       });
+
+       buf = new Buffer(2);
+       parser.writeData([ { key: { type: 'uint16_t' } } ], buf, 0, [ 0x1234 ]);
+       mod_assert.equal(buf[0], 0x34);
+       mod_assert.equal(buf[1], 0x12);
+       parser.setEndian('big');
+
+       parser.writeData([ { key: { type: 'uint16_t' } } ], buf, 0, [ 0x1234 ]);
+       mod_assert.equal(buf[0], 0x12);
+       mod_assert.equal(buf[1], 0x34);
+
+       parser.setEndian('little');
+       parser.writeData([ { key: { type: 'uint16_t' } } ], buf, 0, [ 0x1234 ]);
+       mod_assert.equal(buf[0], 0x34);
+       mod_assert.equal(buf[1], 0x12);
+}
+
+function fail()
+{
+       var parser;
+
+       parser = new mod_ctype.Parser({
+           endian: 'little'
+       });
+       mod_assert.throws(function () {
+               parser.setEndian('littlebigwrong');
+       });
+}
+
+test();
+fail();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.oldwrite.js
new file mode 100755 (executable)
index 0000000..9491cf6
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * A long overdue test to go through and verify that we can read and write
+ * structures as well as nested structures.
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var parser, buf, data;
+       parser = new mod_ctype.Parser({
+           endian: 'little'
+       });
+       parser.typedef('point_t', [
+           { x: { type: 'uint8_t' } },
+           { y: { type: 'uint8_t' } }
+       ]);
+       buf = new Buffer(2);
+       data = [
+           { point: { type: 'point_t', value: [ 23, 42 ] } }
+       ];
+       parser.writeData(data, buf, 0);
+       mod_assert.ok(buf[0] == 23);
+       mod_assert.ok(buf[1] == 42);
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.readSize.js
new file mode 100755 (executable)
index 0000000..6c490a2
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * Testing to ensure we're reading the expected number bytes
+ */
+var mod_ctype = require('../../ctype');
+var ASSERT = require('assert');
+
+function testUint8()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('80', 'hex');
+       result = parser.readStruct([ { item: { type: 'uint8_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 1);
+}
+
+function testSint8()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('80', 'hex');
+       result = parser.readStruct([ { item: { type: 'int8_t' } } ], buffer, 0);
+       ASSERT.equal(result['size'], 1);
+}
+
+function testUint16()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('8000', 'hex');
+       result = parser.readStruct([ { item: { type: 'uint16_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 2);
+}
+
+function testSint16()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('8000', 'hex');
+       result = parser.readStruct([ { item: { type: 'int16_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 2);
+}
+
+function testUint32()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('80000000', 'hex');
+       result = parser.readStruct([ { item: { type: 'uint32_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 4);
+}
+
+function testSint32()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('80000000', 'hex');
+       result = parser.readStruct([ { item: { type: 'int32_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 4);
+}
+
+function testUint64()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('8000000000000000', 'hex');
+       result = parser.readStruct([ { item: { type: 'uint64_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 8);
+}
+
+function testSint64()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('8000000000000000', 'hex');
+       result = parser.readStruct([ { item: { type: 'int64_t' } } ], buffer,
+           0);
+       ASSERT.equal(result['size'], 8);
+}
+
+function testFloat()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('ABAAAA3E', 'hex');
+       result = parser.readStruct([ { item: { type: 'float' } } ], buffer, 0);
+       ASSERT.equal(result['size'], 4);
+}
+
+function testDouble()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('000000000000F03F', 'hex');
+       result = parser.readStruct([ { item: { type: 'double' } } ], buffer, 0);
+       ASSERT.equal(result['size'], 8);
+}
+
+function testChar()
+{
+       var parser, result, buffer;
+       parser = new mod_ctype.Parser({ endian: 'little' });
+       buffer = new Buffer('t');
+       result = parser.readStruct([ { item: { type: 'char' } } ], buffer, 0);
+       ASSERT.equal(result['size'], 1);
+}
+
+function test()
+{
+       testSint8();
+       testUint8();
+       testSint16();
+       testUint16();
+       testSint32();
+       testUint32();
+       testSint64();
+       testUint64();
+       testFloat();
+       testDouble();
+       testChar();
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.structw.js
new file mode 100755 (executable)
index 0000000..09c1a5b
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * A long overdue test to go through and verify that we can read and write
+ * structures as well as nested structures.
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var parser, buf, data;
+       parser = new mod_ctype.Parser({
+           endian: 'little'
+       });
+       parser.typedef('point_t', [
+           { x: { type: 'uint8_t' } },
+           { y: { type: 'uint8_t' } }
+       ]);
+       buf = new Buffer(2);
+       data = [
+           { point: { type: 'point_t' } }
+       ];
+       parser.writeData(data, buf, 0, [ [ 23, 42 ] ]);
+       mod_assert.ok(buf[0] == 23);
+       mod_assert.ok(buf[1] == 42);
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/node_modules/ctype/tst/ctype/tst.writeStruct.js
new file mode 100755 (executable)
index 0000000..4855666
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Test to verify that the offset is incremented when structures are written to.
+ * Hopefully we will not regress issue #41
+ */
+
+var mod_ctype = require('../../ctype.js');
+var mod_assert = require('assert');
+
+function test()
+{
+       var parser, buf, data;
+       parser = new mod_ctype.Parser({
+           endian: 'little'
+       });
+       parser.typedef('point_t', [
+           { x: { type: 'uint8_t' } },
+           { y: { type: 'uint8_t' } }
+       ]);
+       buf = new Buffer(4);
+       data = [
+           { point1: { type: 'point_t' } },
+           { point2: { type: 'point_t' } }
+       ];
+       parser.writeData(data, buf, 0, [ [ 23, 42 ], [ 91, 18 ] ]);
+       mod_assert.ok(buf[0] == 23);
+       mod_assert.ok(buf[1] == 42);
+       mod_assert.ok(buf[2] == 91);
+       mod_assert.ok(buf[3] == 18);
+}
+
+test();
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/http-signature/package.json
new file mode 100755 (executable)
index 0000000..f31e5d7
--- /dev/null
@@ -0,0 +1,72 @@
+{
+  "name": "http-signature",
+  "description": "Reference implementation of Joyent's HTTP Signature scheme.",
+  "version": "0.10.1",
+  "license": "MIT",
+  "author": {
+    "name": "Joyent, Inc"
+  },
+  "contributors": [
+    {
+      "name": "Mark Cavage",
+      "email": "mcavage@gmail.com"
+    },
+    {
+      "name": "David I. Lehn",
+      "email": "dil@lehn.org"
+    }
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/joyent/node-http-signature.git"
+  },
+  "homepage": "https://github.com/joyent/node-http-signature/",
+  "bugs": {
+    "url": "https://github.com/joyent/node-http-signature/issues"
+  },
+  "keywords": [
+    "https",
+    "request"
+  ],
+  "engines": {
+    "node": ">=0.8"
+  },
+  "main": "lib/index.js",
+  "scripts": {
+    "test": "tap test/*.js"
+  },
+  "dependencies": {
+    "assert-plus": "^0.1.5",
+    "asn1": "0.1.11",
+    "ctype": "0.5.3"
+  },
+  "devDependencies": {
+    "node-uuid": "^1.4.1",
+    "tap": "0.4.2"
+  },
+  "_id": "http-signature@0.10.1",
+  "_shasum": "4fbdac132559aa8323121e540779c0a012b27e66",
+  "_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz",
+  "_from": "http-signature@~0.10.0",
+  "_npmVersion": "1.4.28",
+  "_npmUser": {
+    "name": "pfmooney",
+    "email": "patrick.f.mooney@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mcavage",
+      "email": "mcavage@gmail.com"
+    },
+    {
+      "name": "pfmooney",
+      "email": "patrick.f.mooney@gmail.com"
+    }
+  ],
+  "dist": {
+    "shasum": "4fbdac132559aa8323121e540779c0a012b27e66",
+    "tarball": "http://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz"
+  },
+  "directories": {},
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/LICENSE
new file mode 100755 (executable)
index 0000000..0c44ae7
--- /dev/null
@@ -0,0 +1,27 @@
+Copyright (c) Isaac Z. Schlueter ("Author")
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/README.md
new file mode 100755 (executable)
index 0000000..5d764f3
--- /dev/null
@@ -0,0 +1,49 @@
+# json-stringify-safe
+
+Like JSON.stringify, but doesn't throw on circular references.
+
+## Usage
+
+Takes the same arguments as `JSON.stringify`.
+
+```javascript
+var stringify = require('json-stringify-safe');
+var circularObj = {};
+circularObj.circularRef = circularObj;
+circularObj.list = [ circularObj, circularObj ];
+console.log(stringify(circularObj, null, 2));
+```
+
+Output:
+
+```json
+{
+  "circularRef": "[Circular]",
+  "list": [
+    "[Circular]",
+    "[Circular]"
+  ]
+}
+```
+
+## Details
+
+```
+stringify(obj, serializer, indent, decycler)
+```
+
+The first three arguments are the same as to JSON.stringify.  The last
+is an argument that's only used when the object has been seen already.
+
+The default `decycler` function returns the string `'[Circular]'`.
+If, for example, you pass in `function(k,v){}` (return nothing) then it
+will prune cycles.  If you pass in `function(k,v){ return {foo: 'bar'}}`,
+then cyclical objects will always be represented as `{"foo":"bar"}` in
+the result.
+
+```
+stringify.getSerialize(serializer, decycler)
+```
+
+Returns a serializer that can be used elsewhere.  This is the actual
+function that's passed to JSON.stringify.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/package.json
new file mode 100755 (executable)
index 0000000..7c0ac5b
--- /dev/null
@@ -0,0 +1,50 @@
+{
+  "name": "json-stringify-safe",
+  "version": "5.0.0",
+  "description": "Like JSON.stringify, but doesn't blow up on circular refs",
+  "main": "stringify.js",
+  "scripts": {
+    "test": "node test.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/isaacs/json-stringify-safe"
+  },
+  "keywords": [
+    "json",
+    "stringify",
+    "circular",
+    "safe"
+  ],
+  "author": {
+    "name": "Isaac Z. Schlueter",
+    "email": "i@izs.me",
+    "url": "http://blog.izs.me"
+  },
+  "license": "BSD",
+  "bugs": {
+    "url": "https://github.com/isaacs/json-stringify-safe/issues"
+  },
+  "_id": "json-stringify-safe@5.0.0",
+  "dist": {
+    "shasum": "4c1f228b5050837eba9d21f50c2e6e320624566e",
+    "tarball": "http://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz"
+  },
+  "_from": "json-stringify-safe@~5.0.0",
+  "_npmVersion": "1.3.6",
+  "_npmUser": {
+    "name": "isaacs",
+    "email": "i@izs.me"
+  },
+  "maintainers": [
+    {
+      "name": "isaacs",
+      "email": "i@izs.me"
+    }
+  ],
+  "directories": {},
+  "_shasum": "4c1f228b5050837eba9d21f50c2e6e320624566e",
+  "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/isaacs/json-stringify-safe"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/stringify.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/stringify.js
new file mode 100755 (executable)
index 0000000..853ef9b
--- /dev/null
@@ -0,0 +1,39 @@
+module.exports = stringify;
+
+function getSerialize (fn, decycle) {
+  var seen = [], keys = [];
+  decycle = decycle || function(key, value) {
+    return '[Circular ' + getPath(value, seen, keys) + ']'
+  };
+  return function(key, value) {
+    var ret = value;
+    if (typeof value === 'object' && value) {
+      if (seen.indexOf(value) !== -1)
+        ret = decycle(key, value);
+      else {
+        seen.push(value);
+        keys.push(key);
+      }
+    }
+    if (fn) ret = fn(key, ret);
+    return ret;
+  }
+}
+
+function getPath (value, seen, keys) {
+  var index = seen.indexOf(value);
+  var path = [ keys[index] ];
+  for (index--; index >= 0; index--) {
+    if (seen[index][ path[0] ] === value) {
+      value = seen[index];
+      path.unshift(keys[index]);
+    }
+  }
+  return '~' + path.join('.');
+}
+
+function stringify(obj, fn, spaces, decycle) {
+  return JSON.stringify(obj, getSerialize(fn, decycle), spaces);
+}
+
+stringify.getSerialize = getSerialize;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/json-stringify-safe/test.js
new file mode 100755 (executable)
index 0000000..991e919
--- /dev/null
@@ -0,0 +1,128 @@
+var stringify = require('./stringify.js');
+
+var circularObj = { a: 'b' };
+circularObj.circularRef = circularObj;
+circularObj.list = [ circularObj, circularObj ];
+
+//////////
+// default
+var testObj = {
+  "a": "b",
+  "circularRef": "[Circular ~]",
+  "list": [
+    "[Circular ~]",
+    "[Circular ~]"
+  ]
+};
+
+var assert = require('assert');
+assert.equal(JSON.stringify(testObj, null, 2),
+             stringify(circularObj, null, 2));
+
+assert.equal(JSON.stringify(testObj, null, 2),
+            JSON.stringify(circularObj, stringify.getSerialize(), 2));
+
+
+////////
+// prune
+testObj = {
+  "a": "b",
+  "list": [
+    null,
+    null
+  ]
+};
+
+function prune(k, v) {}
+
+assert.equal(JSON.stringify(testObj, null, 2),
+             stringify(circularObj, null, 2, prune));
+
+///////////
+// re-cycle
+// (throws)
+function recycle(k, v) {
+  return v;
+}
+
+assert.throws(function() {
+  stringify(circularObj, null, 2, recycle);
+});
+
+////////
+// fancy
+testObj = {
+  "a": "b",
+  "circularRef": "circularRef{a:string,circularRef:Object,list:Array}",
+  "list": [
+    "0{a:string,circularRef:Object,list:Array}",
+    "1{a:string,circularRef:Object,list:Array}"
+  ]
+};
+
+function signer(key, value) {
+  var ret = key + '{';
+  var f = false;
+  for (var i in value) {
+    if (f)
+      ret += ',';
+    f = true;
+    ret += i + ':';
+    var v = value[i];
+    switch (typeof v) {
+      case 'object':
+        if (!v)
+          ret += 'null';
+        else if (Array.isArray(v))
+          ret += 'Array'
+        else
+          ret += v.constructor && v.constructor.name || 'Object';
+        break;
+      default:
+        ret += typeof v;
+        break;
+    }
+  }
+  ret += '}';
+  return ret;
+}
+
+assert.equal(JSON.stringify(testObj, null, 2),
+             stringify(circularObj, null, 2, signer));
+
+
+///////
+//multi
+var a = { x: 1 };
+a.a = a;
+var b = { x: 2 };
+b.a = a;
+
+var c = { a: a, b: b };
+var d = { list: [ a, b, c ] };
+d.d = d;
+
+var multi = {
+  "list": [
+    {
+      "x": 1,
+      "a": "[Circular ~.list.0]"
+    },
+    {
+      "x": 2,
+      "a": "[Circular ~.list.0]"
+    },
+    {
+      "a": "[Circular ~.list.0]",
+      "b": "[Circular ~.list.1]"
+    }
+  ],
+  "d": "[Circular ~]"
+};
+
+assert.equal(JSON.stringify(multi, null, 2),
+             stringify(d, null, 2));
+
+////////
+// pass!
+console.log('ok');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/LICENSE
new file mode 100755 (executable)
index 0000000..451fc45
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/README.md
new file mode 100755 (executable)
index 0000000..6ca19bd
--- /dev/null
@@ -0,0 +1,66 @@
+# mime
+
+Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.
+
+## Install
+
+Install with [npm](http://github.com/isaacs/npm):
+
+    npm install mime
+
+## API - Queries
+
+### mime.lookup(path)
+Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.').  E.g.
+
+    var mime = require('mime');
+
+    mime.lookup('/path/to/file.txt');         // => 'text/plain'
+    mime.lookup('file.txt');                  // => 'text/plain'
+    mime.lookup('.TXT');                      // => 'text/plain'
+    mime.lookup('htm');                       // => 'text/html'
+
+### mime.default_type
+Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
+
+### mime.extension(type)
+Get the default extension for `type`
+
+    mime.extension('text/html');                 // => 'html'
+    mime.extension('application/octet-stream');  // => 'bin'
+
+### mime.charsets.lookup()
+
+Map mime-type to charset
+
+    mime.charsets.lookup('text/plain');        // => 'UTF-8'
+
+(The logic for charset lookups is pretty rudimentary.  Feel free to suggest improvements.)
+
+## API - Defining Custom Types
+
+The following APIs allow you to add your own type mappings within your project.  If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types).
+
+### mime.define()
+
+Add custom mime/extension mappings
+
+    mime.define({
+        'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
+        'application/x-my-type': ['x-mt', 'x-mtt'],
+        // etc ...
+    });
+
+    mime.lookup('x-sft');                 // => 'text/x-some-format'
+
+The first entry in the extensions array is returned by `mime.extension()`. E.g.
+
+    mime.extension('text/x-some-format'); // => 'x-sf'
+
+### mime.load(filepath)
+
+Load mappings from an Apache ".types" format file
+
+    mime.load('./my_project.types');
+
+The .types file format is simple -  See the `types` dir for examples.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/mime.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/mime.js
new file mode 100755 (executable)
index 0000000..48be0c5
--- /dev/null
@@ -0,0 +1,114 @@
+var path = require('path');
+var fs = require('fs');
+
+function Mime() {
+  // Map of extension -> mime type
+  this.types = Object.create(null);
+
+  // Map of mime type -> extension
+  this.extensions = Object.create(null);
+}
+
+/**
+ * Define mimetype -> extension mappings.  Each key is a mime-type that maps
+ * to an array of extensions associated with the type.  The first extension is
+ * used as the default extension for the type.
+ *
+ * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
+ *
+ * @param map (Object) type definitions
+ */
+Mime.prototype.define = function (map) {
+  for (var type in map) {
+    var exts = map[type];
+
+    for (var i = 0; i < exts.length; i++) {
+      if (process.env.DEBUG_MIME && this.types[exts]) {
+        console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
+          this.types[exts] + ' to ' + type);
+      }
+
+      this.types[exts[i]] = type;
+    }
+
+    // Default extension is the first one we encounter
+    if (!this.extensions[type]) {
+      this.extensions[type] = exts[0];
+    }
+  }
+};
+
+/**
+ * Load an Apache2-style ".types" file
+ *
+ * This may be called multiple times (it's expected).  Where files declare
+ * overlapping types/extensions, the last file wins.
+ *
+ * @param file (String) path of file to load.
+ */
+Mime.prototype.load = function(file) {
+
+  this._loading = file;
+  // Read file and split into lines
+  var map = {},
+      content = fs.readFileSync(file, 'ascii'),
+      lines = content.split(/[\r\n]+/);
+
+  lines.forEach(function(line) {
+    // Clean up whitespace/comments, and split into fields
+    var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
+    map[fields.shift()] = fields;
+  });
+
+  this.define(map);
+
+  this._loading = null;
+};
+
+/**
+ * Lookup a mime type based on extension
+ */
+Mime.prototype.lookup = function(path, fallback) {
+  var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase();
+
+  return this.types[ext] || fallback || this.default_type;
+};
+
+/**
+ * Return file extension associated with a mime type
+ */
+Mime.prototype.extension = function(mimeType) {
+  var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
+  return this.extensions[type];
+};
+
+// Default instance
+var mime = new Mime();
+
+// Load local copy of
+// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+mime.load(path.join(__dirname, 'types/mime.types'));
+
+// Load additional types from node.js community
+mime.load(path.join(__dirname, 'types/node.types'));
+
+// Default type
+mime.default_type = mime.lookup('bin');
+
+//
+// Additional API specific to the default instance
+//
+
+mime.Mime = Mime;
+
+/**
+ * Lookup a charset based on mime type.
+ */
+mime.charsets = {
+  lookup: function(mimeType, fallback) {
+    // Assume text types are utf8
+    return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
+  }
+};
+
+module.exports = mime;
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/package.json
new file mode 100755 (executable)
index 0000000..7c8571d
--- /dev/null
@@ -0,0 +1,57 @@
+{
+  "author": {
+    "name": "Robert Kieffer",
+    "email": "robert@broofa.com",
+    "url": "http://github.com/broofa"
+  },
+  "contributors": [
+    {
+      "name": "Benjamin Thomas",
+      "email": "benjamin@benjaminthomas.org",
+      "url": "http://github.com/bentomas"
+    }
+  ],
+  "dependencies": {},
+  "description": "A comprehensive library for mime-type mapping",
+  "devDependencies": {},
+  "keywords": [
+    "util",
+    "mime"
+  ],
+  "main": "mime.js",
+  "name": "mime",
+  "repository": {
+    "url": "https://github.com/broofa/node-mime",
+    "type": "git"
+  },
+  "version": "1.2.11",
+  "bugs": {
+    "url": "https://github.com/broofa/node-mime/issues"
+  },
+  "_id": "mime@1.2.11",
+  "dist": {
+    "shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10",
+    "tarball": "http://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
+  },
+  "_from": "mime@~1.2.9",
+  "_npmVersion": "1.3.6",
+  "_npmUser": {
+    "name": "broofa",
+    "email": "robert@broofa.com"
+  },
+  "maintainers": [
+    {
+      "name": "broofa",
+      "email": "robert@broofa.com"
+    },
+    {
+      "name": "bentomas",
+      "email": "benjamin@benjaminthomas.org"
+    }
+  ],
+  "directories": {},
+  "_shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10",
+  "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/broofa/node-mime"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/test.js
new file mode 100755 (executable)
index 0000000..2cda1c7
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * Usage: node test.js
+ */
+
+var mime = require('./mime');
+var assert = require('assert');
+var path = require('path');
+
+function eq(a, b) {
+  console.log('Test: ' + a + ' === ' + b);
+  assert.strictEqual.apply(null, arguments);
+}
+
+console.log(Object.keys(mime.extensions).length + ' types');
+console.log(Object.keys(mime.types).length + ' extensions\n');
+
+//
+// Test mime lookups
+//
+
+eq('text/plain', mime.lookup('text.txt'));     // normal file
+eq('text/plain', mime.lookup('TEXT.TXT'));     // uppercase
+eq('text/plain', mime.lookup('dir/text.txt')); // dir + file
+eq('text/plain', mime.lookup('.text.txt'));    // hidden file
+eq('text/plain', mime.lookup('.txt'));         // nameless
+eq('text/plain', mime.lookup('txt'));          // extension-only
+eq('text/plain', mime.lookup('/txt'));         // extension-less ()
+eq('text/plain', mime.lookup('\\txt'));        // Windows, extension-less
+eq('application/octet-stream', mime.lookup('text.nope')); // unrecognized
+eq('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
+
+//
+// Test extensions
+//
+
+eq('txt', mime.extension(mime.types.text));
+eq('html', mime.extension(mime.types.htm));
+eq('bin', mime.extension('application/octet-stream'));
+eq('bin', mime.extension('application/octet-stream '));
+eq('html', mime.extension(' text/html; charset=UTF-8'));
+eq('html', mime.extension('text/html; charset=UTF-8 '));
+eq('html', mime.extension('text/html; charset=UTF-8'));
+eq('html', mime.extension('text/html ; charset=UTF-8'));
+eq('html', mime.extension('text/html;charset=UTF-8'));
+eq('html', mime.extension('text/Html;charset=UTF-8'));
+eq(undefined, mime.extension('unrecognized'));
+
+//
+// Test node.types lookups
+//
+
+eq('application/font-woff', mime.lookup('file.woff'));
+eq('application/octet-stream', mime.lookup('file.buffer'));
+eq('audio/mp4', mime.lookup('file.m4a'));
+eq('font/opentype', mime.lookup('file.otf'));
+
+//
+// Test charsets
+//
+
+eq('UTF-8', mime.charsets.lookup('text/plain'));
+eq(undefined, mime.charsets.lookup(mime.types.js));
+eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
+
+//
+// Test for overlaps between mime.types and node.types
+//
+
+var apacheTypes = new mime.Mime(), nodeTypes = new mime.Mime();
+apacheTypes.load(path.join(__dirname, 'types/mime.types'));
+nodeTypes.load(path.join(__dirname, 'types/node.types'));
+
+var keys = [].concat(Object.keys(apacheTypes.types))
+             .concat(Object.keys(nodeTypes.types));
+keys.sort();
+for (var i = 1; i < keys.length; i++) {
+  if (keys[i] == keys[i-1]) {
+    console.warn('Warning: ' +
+      'node.types defines ' + keys[i] + '->' + nodeTypes.types[keys[i]] +
+      ', mime.types defines ' + keys[i] + '->' + apacheTypes.types[keys[i]]);
+  }
+}
+
+console.log('\nOK');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/types/mime.types b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/types/mime.types
new file mode 100755 (executable)
index 0000000..da8cd69
--- /dev/null
@@ -0,0 +1,1588 @@
+# This file maps Internet media types to unique file extension(s).
+# Although created for httpd, this file is used by many software systems
+# and has been placed in the public domain for unlimited redisribution.
+#
+# The table below contains both registered and (common) unregistered types.
+# A type that has no unique extension can be ignored -- they are listed
+# here to guide configurations toward known types and to make it easier to
+# identify "new" types.  File extensions are also commonly used to indicate
+# content languages and encodings, so choose them carefully.
+#
+# Internet media types should be registered as described in RFC 4288.
+# The registry is at <http://www.iana.org/assignments/media-types/>.
+#
+# MIME type (lowercased)                       Extensions
+# ============================================ ==========
+# application/1d-interleaved-parityfec
+# application/3gpp-ims+xml
+# application/activemessage
+application/andrew-inset                       ez
+# application/applefile
+application/applixware                         aw
+application/atom+xml                           atom
+application/atomcat+xml                                atomcat
+# application/atomicmail
+application/atomsvc+xml                                atomsvc
+# application/auth-policy+xml
+# application/batch-smtp
+# application/beep+xml
+# application/calendar+xml
+# application/cals-1840
+# application/ccmp+xml
+application/ccxml+xml                          ccxml
+application/cdmi-capability                    cdmia
+application/cdmi-container                     cdmic
+application/cdmi-domain                                cdmid
+application/cdmi-object                                cdmio
+application/cdmi-queue                         cdmiq
+# application/cea-2018+xml
+# application/cellml+xml
+# application/cfw
+# application/cnrp+xml
+# application/commonground
+# application/conference-info+xml
+# application/cpl+xml
+# application/csta+xml
+# application/cstadata+xml
+application/cu-seeme                           cu
+# application/cybercash
+application/davmount+xml                       davmount
+# application/dca-rft
+# application/dec-dx
+# application/dialog-info+xml
+# application/dicom
+# application/dns
+application/docbook+xml                                dbk
+# application/dskpp+xml
+application/dssc+der                           dssc
+application/dssc+xml                           xdssc
+# application/dvcs
+application/ecmascript                         ecma
+# application/edi-consent
+# application/edi-x12
+# application/edifact
+application/emma+xml                           emma
+# application/epp+xml
+application/epub+zip                           epub
+# application/eshop
+# application/example
+application/exi                                        exi
+# application/fastinfoset
+# application/fastsoap
+# application/fits
+application/font-tdpfr                         pfr
+# application/framework-attributes+xml
+application/gml+xml                            gml
+application/gpx+xml                            gpx
+application/gxf                                        gxf
+# application/h224
+# application/held+xml
+# application/http
+application/hyperstudio                                stk
+# application/ibe-key-request+xml
+# application/ibe-pkg-reply+xml
+# application/ibe-pp-data
+# application/iges
+# application/im-iscomposing+xml
+# application/index
+# application/index.cmd
+# application/index.obj
+# application/index.response
+# application/index.vnd
+application/inkml+xml                          ink inkml
+# application/iotp
+application/ipfix                              ipfix
+# application/ipp
+# application/isup
+application/java-archive                       jar
+application/java-serialized-object             ser
+application/java-vm                            class
+application/javascript                         js
+application/json                               json
+application/jsonml+json                                jsonml
+# application/kpml-request+xml
+# application/kpml-response+xml
+application/lost+xml                           lostxml
+application/mac-binhex40                       hqx
+application/mac-compactpro                     cpt
+# application/macwriteii
+application/mads+xml                           mads
+application/marc                               mrc
+application/marcxml+xml                                mrcx
+application/mathematica                                ma nb mb
+# application/mathml-content+xml
+# application/mathml-presentation+xml
+application/mathml+xml                         mathml
+# application/mbms-associated-procedure-description+xml
+# application/mbms-deregister+xml
+# application/mbms-envelope+xml
+# application/mbms-msk+xml
+# application/mbms-msk-response+xml
+# application/mbms-protection-description+xml
+# application/mbms-reception-report+xml
+# application/mbms-register+xml
+# application/mbms-register-response+xml
+# application/mbms-user-service-description+xml
+application/mbox                               mbox
+# application/media_control+xml
+application/mediaservercontrol+xml             mscml
+application/metalink+xml                       metalink
+application/metalink4+xml                      meta4
+application/mets+xml                           mets
+# application/mikey
+application/mods+xml                           mods
+# application/moss-keys
+# application/moss-signature
+# application/mosskey-data
+# application/mosskey-request
+application/mp21                               m21 mp21
+application/mp4                                        mp4s
+# application/mpeg4-generic
+# application/mpeg4-iod
+# application/mpeg4-iod-xmt
+# application/msc-ivr+xml
+# application/msc-mixer+xml
+application/msword                             doc dot
+application/mxf                                        mxf
+# application/nasdata
+# application/news-checkgroups
+# application/news-groupinfo
+# application/news-transmission
+# application/nss
+# application/ocsp-request
+# application/ocsp-response
+application/octet-stream       bin dms lrf mar so dist distz pkg bpk dump elc deploy
+application/oda                                        oda
+application/oebps-package+xml                  opf
+application/ogg                                        ogx
+application/omdoc+xml                          omdoc
+application/onenote                            onetoc onetoc2 onetmp onepkg
+application/oxps                               oxps
+# application/parityfec
+application/patch-ops-error+xml                        xer
+application/pdf                                        pdf
+application/pgp-encrypted                      pgp
+# application/pgp-keys
+application/pgp-signature                      asc sig
+application/pics-rules                         prf
+# application/pidf+xml
+# application/pidf-diff+xml
+application/pkcs10                             p10
+application/pkcs7-mime                         p7m p7c
+application/pkcs7-signature                    p7s
+application/pkcs8                              p8
+application/pkix-attr-cert                     ac
+application/pkix-cert                          cer
+application/pkix-crl                           crl
+application/pkix-pkipath                       pkipath
+application/pkixcmp                            pki
+application/pls+xml                            pls
+# application/poc-settings+xml
+application/postscript                         ai eps ps
+# application/prs.alvestrand.titrax-sheet
+application/prs.cww                            cww
+# application/prs.nprend
+# application/prs.plucker
+# application/prs.rdf-xml-crypt
+# application/prs.xsf+xml
+application/pskc+xml                           pskcxml
+# application/qsig
+application/rdf+xml                            rdf
+application/reginfo+xml                                rif
+application/relax-ng-compact-syntax            rnc
+# application/remote-printing
+application/resource-lists+xml                 rl
+application/resource-lists-diff+xml            rld
+# application/riscos
+# application/rlmi+xml
+application/rls-services+xml                   rs
+application/rpki-ghostbusters                  gbr
+application/rpki-manifest                      mft
+application/rpki-roa                           roa
+# application/rpki-updown
+application/rsd+xml                            rsd
+application/rss+xml                            rss
+application/rtf                                        rtf
+# application/rtx
+# application/samlassertion+xml
+# application/samlmetadata+xml
+application/sbml+xml                           sbml
+application/scvp-cv-request                    scq
+application/scvp-cv-response                   scs
+application/scvp-vp-request                    spq
+application/scvp-vp-response                   spp
+application/sdp                                        sdp
+# application/set-payment
+application/set-payment-initiation             setpay
+# application/set-registration
+application/set-registration-initiation                setreg
+# application/sgml
+# application/sgml-open-catalog
+application/shf+xml                            shf
+# application/sieve
+# application/simple-filter+xml
+# application/simple-message-summary
+# application/simplesymbolcontainer
+# application/slate
+# application/smil
+application/smil+xml                           smi smil
+# application/soap+fastinfoset
+# application/soap+xml
+application/sparql-query                       rq
+application/sparql-results+xml                 srx
+# application/spirits-event+xml
+application/srgs                               gram
+application/srgs+xml                           grxml
+application/sru+xml                            sru
+application/ssdl+xml                           ssdl
+application/ssml+xml                           ssml
+# application/tamp-apex-update
+# application/tamp-apex-update-confirm
+# application/tamp-community-update
+# application/tamp-community-update-confirm
+# application/tamp-error
+# application/tamp-sequence-adjust
+# application/tamp-sequence-adjust-confirm
+# application/tamp-status-query
+# application/tamp-status-response
+# application/tamp-update
+# application/tamp-update-confirm
+application/tei+xml                            tei teicorpus
+application/thraud+xml                         tfi
+# application/timestamp-query
+# application/timestamp-reply
+application/timestamped-data                   tsd
+# application/tve-trigger
+# application/ulpfec
+# application/vcard+xml
+# application/vemmi
+# application/vividence.scriptfile
+# application/vnd.3gpp.bsf+xml
+application/vnd.3gpp.pic-bw-large              plb
+application/vnd.3gpp.pic-bw-small              psb
+application/vnd.3gpp.pic-bw-var                        pvb
+# application/vnd.3gpp.sms
+# application/vnd.3gpp2.bcmcsinfo+xml
+# application/vnd.3gpp2.sms
+application/vnd.3gpp2.tcap                     tcap
+application/vnd.3m.post-it-notes               pwn
+application/vnd.accpac.simply.aso              aso
+application/vnd.accpac.simply.imp              imp
+application/vnd.acucobol                       acu
+application/vnd.acucorp                                atc acutc
+application/vnd.adobe.air-application-installer-package+zip    air
+application/vnd.adobe.formscentral.fcdt                fcdt
+application/vnd.adobe.fxp                      fxp fxpl
+# application/vnd.adobe.partial-upload
+application/vnd.adobe.xdp+xml                  xdp
+application/vnd.adobe.xfdf                     xfdf
+# application/vnd.aether.imp
+# application/vnd.ah-barcode
+application/vnd.ahead.space                    ahead
+application/vnd.airzip.filesecure.azf          azf
+application/vnd.airzip.filesecure.azs          azs
+application/vnd.amazon.ebook                   azw
+application/vnd.americandynamics.acc           acc
+application/vnd.amiga.ami                      ami
+# application/vnd.amundsen.maze+xml
+application/vnd.android.package-archive                apk
+application/vnd.anser-web-certificate-issue-initiation cii
+application/vnd.anser-web-funds-transfer-initiation    fti
+application/vnd.antix.game-component           atx
+application/vnd.apple.installer+xml            mpkg
+application/vnd.apple.mpegurl                  m3u8
+# application/vnd.arastra.swi
+application/vnd.aristanetworks.swi             swi
+application/vnd.astraea-software.iota          iota
+application/vnd.audiograph                     aep
+# application/vnd.autopackage
+# application/vnd.avistar+xml
+application/vnd.blueice.multipass              mpm
+# application/vnd.bluetooth.ep.oob
+application/vnd.bmi                            bmi
+application/vnd.businessobjects                        rep
+# application/vnd.cab-jscript
+# application/vnd.canon-cpdl
+# application/vnd.canon-lips
+# application/vnd.cendio.thinlinc.clientconf
+application/vnd.chemdraw+xml                   cdxml
+application/vnd.chipnuts.karaoke-mmd           mmd
+application/vnd.cinderella                     cdy
+# application/vnd.cirpack.isdn-ext
+application/vnd.claymore                       cla
+application/vnd.cloanto.rp9                    rp9
+application/vnd.clonk.c4group                  c4g c4d c4f c4p c4u
+application/vnd.cluetrust.cartomobile-config           c11amc
+application/vnd.cluetrust.cartomobile-config-pkg       c11amz
+# application/vnd.collection+json
+# application/vnd.commerce-battelle
+application/vnd.commonspace                    csp
+application/vnd.contact.cmsg                   cdbcmsg
+application/vnd.cosmocaller                    cmc
+application/vnd.crick.clicker                  clkx
+application/vnd.crick.clicker.keyboard         clkk
+application/vnd.crick.clicker.palette          clkp
+application/vnd.crick.clicker.template         clkt
+application/vnd.crick.clicker.wordbank         clkw
+application/vnd.criticaltools.wbs+xml          wbs
+application/vnd.ctc-posml                      pml
+# application/vnd.ctct.ws+xml
+# application/vnd.cups-pdf
+# application/vnd.cups-postscript
+application/vnd.cups-ppd                       ppd
+# application/vnd.cups-raster
+# application/vnd.cups-raw
+# application/vnd.curl
+application/vnd.curl.car                       car
+application/vnd.curl.pcurl                     pcurl
+# application/vnd.cybank
+application/vnd.dart                           dart
+application/vnd.data-vision.rdz                        rdz
+application/vnd.dece.data                      uvf uvvf uvd uvvd
+application/vnd.dece.ttml+xml                  uvt uvvt
+application/vnd.dece.unspecified               uvx uvvx
+application/vnd.dece.zip                       uvz uvvz
+application/vnd.denovo.fcselayout-link         fe_launch
+# application/vnd.dir-bi.plate-dl-nosuffix
+application/vnd.dna                            dna
+application/vnd.dolby.mlp                      mlp
+# application/vnd.dolby.mobile.1
+# application/vnd.dolby.mobile.2
+application/vnd.dpgraph                                dpg
+application/vnd.dreamfactory                   dfac
+application/vnd.ds-keypoint                    kpxx
+application/vnd.dvb.ait                                ait
+# application/vnd.dvb.dvbj
+# application/vnd.dvb.esgcontainer
+# application/vnd.dvb.ipdcdftnotifaccess
+# application/vnd.dvb.ipdcesgaccess
+# application/vnd.dvb.ipdcesgaccess2
+# application/vnd.dvb.ipdcesgpdd
+# application/vnd.dvb.ipdcroaming
+# application/vnd.dvb.iptv.alfec-base
+# application/vnd.dvb.iptv.alfec-enhancement
+# application/vnd.dvb.notif-aggregate-root+xml
+# application/vnd.dvb.notif-container+xml
+# application/vnd.dvb.notif-generic+xml
+# application/vnd.dvb.notif-ia-msglist+xml
+# application/vnd.dvb.notif-ia-registration-request+xml
+# application/vnd.dvb.notif-ia-registration-response+xml
+# application/vnd.dvb.notif-init+xml
+# application/vnd.dvb.pfr
+application/vnd.dvb.service                    svc
+# application/vnd.dxr
+application/vnd.dynageo                                geo
+# application/vnd.easykaraoke.cdgdownload
+# application/vnd.ecdis-update
+application/vnd.ecowin.chart                   mag
+# application/vnd.ecowin.filerequest
+# application/vnd.ecowin.fileupdate
+# application/vnd.ecowin.series
+# application/vnd.ecowin.seriesrequest
+# application/vnd.ecowin.seriesupdate
+# application/vnd.emclient.accessrequest+xml
+application/vnd.enliven                                nml
+# application/vnd.eprints.data+xml
+application/vnd.epson.esf                      esf
+application/vnd.epson.msf                      msf
+application/vnd.epson.quickanime               qam
+application/vnd.epson.salt                     slt
+application/vnd.epson.ssf                      ssf
+# application/vnd.ericsson.quickcall
+application/vnd.eszigno3+xml                   es3 et3
+# application/vnd.etsi.aoc+xml
+# application/vnd.etsi.cug+xml
+# application/vnd.etsi.iptvcommand+xml
+# application/vnd.etsi.iptvdiscovery+xml
+# application/vnd.etsi.iptvprofile+xml
+# application/vnd.etsi.iptvsad-bc+xml
+# application/vnd.etsi.iptvsad-cod+xml
+# application/vnd.etsi.iptvsad-npvr+xml
+# application/vnd.etsi.iptvservice+xml
+# application/vnd.etsi.iptvsync+xml
+# application/vnd.etsi.iptvueprofile+xml
+# application/vnd.etsi.mcid+xml
+# application/vnd.etsi.overload-control-policy-dataset+xml
+# application/vnd.etsi.sci+xml
+# application/vnd.etsi.simservs+xml
+# application/vnd.etsi.tsl+xml
+# application/vnd.etsi.tsl.der
+# application/vnd.eudora.data
+application/vnd.ezpix-album                    ez2
+application/vnd.ezpix-package                  ez3
+# application/vnd.f-secure.mobile
+application/vnd.fdf                            fdf
+application/vnd.fdsn.mseed                     mseed
+application/vnd.fdsn.seed                      seed dataless
+# application/vnd.ffsns
+# application/vnd.fints
+application/vnd.flographit                     gph
+application/vnd.fluxtime.clip                  ftc
+# application/vnd.font-fontforge-sfd
+application/vnd.framemaker                     fm frame maker book
+application/vnd.frogans.fnc                    fnc
+application/vnd.frogans.ltf                    ltf
+application/vnd.fsc.weblaunch                  fsc
+application/vnd.fujitsu.oasys                  oas
+application/vnd.fujitsu.oasys2                 oa2
+application/vnd.fujitsu.oasys3                 oa3
+application/vnd.fujitsu.oasysgp                        fg5
+application/vnd.fujitsu.oasysprs               bh2
+# application/vnd.fujixerox.art-ex
+# application/vnd.fujixerox.art4
+# application/vnd.fujixerox.hbpl
+application/vnd.fujixerox.ddd                  ddd
+application/vnd.fujixerox.docuworks            xdw
+application/vnd.fujixerox.docuworks.binder     xbd
+# application/vnd.fut-misnet
+application/vnd.fuzzysheet                     fzs
+application/vnd.genomatix.tuxedo               txd
+# application/vnd.geocube+xml
+application/vnd.geogebra.file                  ggb
+application/vnd.geogebra.tool                  ggt
+application/vnd.geometry-explorer              gex gre
+application/vnd.geonext                                gxt
+application/vnd.geoplan                                g2w
+application/vnd.geospace                       g3w
+# application/vnd.globalplatform.card-content-mgt
+# application/vnd.globalplatform.card-content-mgt-response
+application/vnd.gmx                            gmx
+application/vnd.google-earth.kml+xml           kml
+application/vnd.google-earth.kmz               kmz
+application/vnd.grafeq                         gqf gqs
+# application/vnd.gridmp
+application/vnd.groove-account                 gac
+application/vnd.groove-help                    ghf
+application/vnd.groove-identity-message                gim
+application/vnd.groove-injector                        grv
+application/vnd.groove-tool-message            gtm
+application/vnd.groove-tool-template           tpl
+application/vnd.groove-vcard                   vcg
+# application/vnd.hal+json
+application/vnd.hal+xml                                hal
+application/vnd.handheld-entertainment+xml     zmm
+application/vnd.hbci                           hbci
+# application/vnd.hcl-bireports
+application/vnd.hhe.lesson-player              les
+application/vnd.hp-hpgl                                hpgl
+application/vnd.hp-hpid                                hpid
+application/vnd.hp-hps                         hps
+application/vnd.hp-jlyt                                jlt
+application/vnd.hp-pcl                         pcl
+application/vnd.hp-pclxl                       pclxl
+# application/vnd.httphone
+application/vnd.hydrostatix.sof-data           sfd-hdstx
+# application/vnd.hzn-3d-crossword
+# application/vnd.ibm.afplinedata
+# application/vnd.ibm.electronic-media
+application/vnd.ibm.minipay                    mpy
+application/vnd.ibm.modcap                     afp listafp list3820
+application/vnd.ibm.rights-management          irm
+application/vnd.ibm.secure-container           sc
+application/vnd.iccprofile                     icc icm
+application/vnd.igloader                       igl
+application/vnd.immervision-ivp                        ivp
+application/vnd.immervision-ivu                        ivu
+# application/vnd.informedcontrol.rms+xml
+# application/vnd.informix-visionary
+# application/vnd.infotech.project
+# application/vnd.infotech.project+xml
+# application/vnd.innopath.wamp.notification
+application/vnd.insors.igm                     igm
+application/vnd.intercon.formnet               xpw xpx
+application/vnd.intergeo                       i2g
+# application/vnd.intertrust.digibox
+# application/vnd.intertrust.nncp
+application/vnd.intu.qbo                       qbo
+application/vnd.intu.qfx                       qfx
+# application/vnd.iptc.g2.conceptitem+xml
+# application/vnd.iptc.g2.knowledgeitem+xml
+# application/vnd.iptc.g2.newsitem+xml
+# application/vnd.iptc.g2.newsmessage+xml
+# application/vnd.iptc.g2.packageitem+xml
+# application/vnd.iptc.g2.planningitem+xml
+application/vnd.ipunplugged.rcprofile          rcprofile
+application/vnd.irepository.package+xml                irp
+application/vnd.is-xpr                         xpr
+application/vnd.isac.fcs                       fcs
+application/vnd.jam                            jam
+# application/vnd.japannet-directory-service
+# application/vnd.japannet-jpnstore-wakeup
+# application/vnd.japannet-payment-wakeup
+# application/vnd.japannet-registration
+# application/vnd.japannet-registration-wakeup
+# application/vnd.japannet-setstore-wakeup
+# application/vnd.japannet-verification
+# application/vnd.japannet-verification-wakeup
+application/vnd.jcp.javame.midlet-rms          rms
+application/vnd.jisp                           jisp
+application/vnd.joost.joda-archive             joda
+application/vnd.kahootz                                ktz ktr
+application/vnd.kde.karbon                     karbon
+application/vnd.kde.kchart                     chrt
+application/vnd.kde.kformula                   kfo
+application/vnd.kde.kivio                      flw
+application/vnd.kde.kontour                    kon
+application/vnd.kde.kpresenter                 kpr kpt
+application/vnd.kde.kspread                    ksp
+application/vnd.kde.kword                      kwd kwt
+application/vnd.kenameaapp                     htke
+application/vnd.kidspiration                   kia
+application/vnd.kinar                          kne knp
+application/vnd.koan                           skp skd skt skm
+application/vnd.kodak-descriptor               sse
+application/vnd.las.las+xml                    lasxml
+# application/vnd.liberty-request+xml
+application/vnd.llamagraphics.life-balance.desktop     lbd
+application/vnd.llamagraphics.life-balance.exchange+xml        lbe
+application/vnd.lotus-1-2-3                    123
+application/vnd.lotus-approach                 apr
+application/vnd.lotus-freelance                        pre
+application/vnd.lotus-notes                    nsf
+application/vnd.lotus-organizer                        org
+application/vnd.lotus-screencam                        scm
+application/vnd.lotus-wordpro                  lwp
+application/vnd.macports.portpkg               portpkg
+# application/vnd.marlin.drm.actiontoken+xml
+# application/vnd.marlin.drm.conftoken+xml
+# application/vnd.marlin.drm.license+xml
+# application/vnd.marlin.drm.mdcf
+application/vnd.mcd                            mcd
+application/vnd.medcalcdata                    mc1
+application/vnd.mediastation.cdkey             cdkey
+# application/vnd.meridian-slingshot
+application/vnd.mfer                           mwf
+application/vnd.mfmp                           mfm
+application/vnd.micrografx.flo                 flo
+application/vnd.micrografx.igx                 igx
+application/vnd.mif                            mif
+# application/vnd.minisoft-hp3000-save
+# application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.mobius.daf                     daf
+application/vnd.mobius.dis                     dis
+application/vnd.mobius.mbk                     mbk
+application/vnd.mobius.mqy                     mqy
+application/vnd.mobius.msl                     msl
+application/vnd.mobius.plc                     plc
+application/vnd.mobius.txf                     txf
+application/vnd.mophun.application             mpn
+application/vnd.mophun.certificate             mpc
+# application/vnd.motorola.flexsuite
+# application/vnd.motorola.flexsuite.adsi
+# application/vnd.motorola.flexsuite.fis
+# application/vnd.motorola.flexsuite.gotap
+# application/vnd.motorola.flexsuite.kmr
+# application/vnd.motorola.flexsuite.ttc
+# application/vnd.motorola.flexsuite.wem
+# application/vnd.motorola.iprm
+application/vnd.mozilla.xul+xml                        xul
+application/vnd.ms-artgalry                    cil
+# application/vnd.ms-asf
+application/vnd.ms-cab-compressed              cab
+# application/vnd.ms-color.iccprofile
+application/vnd.ms-excel                       xls xlm xla xlc xlt xlw
+application/vnd.ms-excel.addin.macroenabled.12         xlam
+application/vnd.ms-excel.sheet.binary.macroenabled.12  xlsb
+application/vnd.ms-excel.sheet.macroenabled.12         xlsm
+application/vnd.ms-excel.template.macroenabled.12      xltm
+application/vnd.ms-fontobject                  eot
+application/vnd.ms-htmlhelp                    chm
+application/vnd.ms-ims                         ims
+application/vnd.ms-lrm                         lrm
+# application/vnd.ms-office.activex+xml
+application/vnd.ms-officetheme                 thmx
+# application/vnd.ms-opentype
+# application/vnd.ms-package.obfuscated-opentype
+application/vnd.ms-pki.seccat                  cat
+application/vnd.ms-pki.stl                     stl
+# application/vnd.ms-playready.initiator+xml
+application/vnd.ms-powerpoint                  ppt pps pot
+application/vnd.ms-powerpoint.addin.macroenabled.12            ppam
+application/vnd.ms-powerpoint.presentation.macroenabled.12     pptm
+application/vnd.ms-powerpoint.slide.macroenabled.12            sldm
+application/vnd.ms-powerpoint.slideshow.macroenabled.12                ppsm
+application/vnd.ms-powerpoint.template.macroenabled.12         potm
+# application/vnd.ms-printing.printticket+xml
+application/vnd.ms-project                     mpp mpt
+# application/vnd.ms-tnef
+# application/vnd.ms-wmdrm.lic-chlg-req
+# application/vnd.ms-wmdrm.lic-resp
+# application/vnd.ms-wmdrm.meter-chlg-req
+# application/vnd.ms-wmdrm.meter-resp
+application/vnd.ms-word.document.macroenabled.12       docm
+application/vnd.ms-word.template.macroenabled.12       dotm
+application/vnd.ms-works                       wps wks wcm wdb
+application/vnd.ms-wpl                         wpl
+application/vnd.ms-xpsdocument                 xps
+application/vnd.mseq                           mseq
+# application/vnd.msign
+# application/vnd.multiad.creator
+# application/vnd.multiad.creator.cif
+# application/vnd.music-niff
+application/vnd.musician                       mus
+application/vnd.muvee.style                    msty
+application/vnd.mynfc                          taglet
+# application/vnd.ncd.control
+# application/vnd.ncd.reference
+# application/vnd.nervana
+# application/vnd.netfpx
+application/vnd.neurolanguage.nlu              nlu
+application/vnd.nitf                           ntf nitf
+application/vnd.noblenet-directory             nnd
+application/vnd.noblenet-sealer                        nns
+application/vnd.noblenet-web                   nnw
+# application/vnd.nokia.catalogs
+# application/vnd.nokia.conml+wbxml
+# application/vnd.nokia.conml+xml
+# application/vnd.nokia.isds-radio-presets
+# application/vnd.nokia.iptv.config+xml
+# application/vnd.nokia.landmark+wbxml
+# application/vnd.nokia.landmark+xml
+# application/vnd.nokia.landmarkcollection+xml
+# application/vnd.nokia.n-gage.ac+xml
+application/vnd.nokia.n-gage.data              ngdat
+application/vnd.nokia.n-gage.symbian.install   n-gage
+# application/vnd.nokia.ncd
+# application/vnd.nokia.pcd+wbxml
+# application/vnd.nokia.pcd+xml
+application/vnd.nokia.radio-preset             rpst
+application/vnd.nokia.radio-presets            rpss
+application/vnd.novadigm.edm                   edm
+application/vnd.novadigm.edx                   edx
+application/vnd.novadigm.ext                   ext
+# application/vnd.ntt-local.file-transfer
+# application/vnd.ntt-local.sip-ta_remote
+# application/vnd.ntt-local.sip-ta_tcp_stream
+application/vnd.oasis.opendocument.chart               odc
+application/vnd.oasis.opendocument.chart-template      otc
+application/vnd.oasis.opendocument.database            odb
+application/vnd.oasis.opendocument.formula             odf
+application/vnd.oasis.opendocument.formula-template    odft
+application/vnd.oasis.opendocument.graphics            odg
+application/vnd.oasis.opendocument.graphics-template   otg
+application/vnd.oasis.opendocument.image               odi
+application/vnd.oasis.opendocument.image-template      oti
+application/vnd.oasis.opendocument.presentation                odp
+application/vnd.oasis.opendocument.presentation-template       otp
+application/vnd.oasis.opendocument.spreadsheet         ods
+application/vnd.oasis.opendocument.spreadsheet-template        ots
+application/vnd.oasis.opendocument.text                        odt
+application/vnd.oasis.opendocument.text-master         odm
+application/vnd.oasis.opendocument.text-template       ott
+application/vnd.oasis.opendocument.text-web            oth
+# application/vnd.obn
+# application/vnd.oftn.l10n+json
+# application/vnd.oipf.contentaccessdownload+xml
+# application/vnd.oipf.contentaccessstreaming+xml
+# application/vnd.oipf.cspg-hexbinary
+# application/vnd.oipf.dae.svg+xml
+# application/vnd.oipf.dae.xhtml+xml
+# application/vnd.oipf.mippvcontrolmessage+xml
+# application/vnd.oipf.pae.gem
+# application/vnd.oipf.spdiscovery+xml
+# application/vnd.oipf.spdlist+xml
+# application/vnd.oipf.ueprofile+xml
+# application/vnd.oipf.userprofile+xml
+application/vnd.olpc-sugar                     xo
+# application/vnd.oma-scws-config
+# application/vnd.oma-scws-http-request
+# application/vnd.oma-scws-http-response
+# application/vnd.oma.bcast.associated-procedure-parameter+xml
+# application/vnd.oma.bcast.drm-trigger+xml
+# application/vnd.oma.bcast.imd+xml
+# application/vnd.oma.bcast.ltkm
+# application/vnd.oma.bcast.notification+xml
+# application/vnd.oma.bcast.provisioningtrigger
+# application/vnd.oma.bcast.sgboot
+# application/vnd.oma.bcast.sgdd+xml
+# application/vnd.oma.bcast.sgdu
+# application/vnd.oma.bcast.simple-symbol-container
+# application/vnd.oma.bcast.smartcard-trigger+xml
+# application/vnd.oma.bcast.sprov+xml
+# application/vnd.oma.bcast.stkm
+# application/vnd.oma.cab-address-book+xml
+# application/vnd.oma.cab-feature-handler+xml
+# application/vnd.oma.cab-pcc+xml
+# application/vnd.oma.cab-user-prefs+xml
+# application/vnd.oma.dcd
+# application/vnd.oma.dcdc
+application/vnd.oma.dd2+xml                    dd2
+# application/vnd.oma.drm.risd+xml
+# application/vnd.oma.group-usage-list+xml
+# application/vnd.oma.pal+xml
+# application/vnd.oma.poc.detailed-progress-report+xml
+# application/vnd.oma.poc.final-report+xml
+# application/vnd.oma.poc.groups+xml
+# application/vnd.oma.poc.invocation-descriptor+xml
+# application/vnd.oma.poc.optimized-progress-report+xml
+# application/vnd.oma.push
+# application/vnd.oma.scidm.messages+xml
+# application/vnd.oma.xcap-directory+xml
+# application/vnd.omads-email+xml
+# application/vnd.omads-file+xml
+# application/vnd.omads-folder+xml
+# application/vnd.omaloc-supl-init
+application/vnd.openofficeorg.extension                oxt
+# application/vnd.openxmlformats-officedocument.custom-properties+xml
+# application/vnd.openxmlformats-officedocument.customxmlproperties+xml
+# application/vnd.openxmlformats-officedocument.drawing+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chart+xml
+# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml
+# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml
+# application/vnd.openxmlformats-officedocument.extended-properties+xml
+# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml
+# application/vnd.openxmlformats-officedocument.presentationml.comments+xml
+# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml
+# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml
+application/vnd.openxmlformats-officedocument.presentationml.presentation      pptx
+# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml
+application/vnd.openxmlformats-officedocument.presentationml.slide     sldx
+# application/vnd.openxmlformats-officedocument.presentationml.slide+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml
+application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
+# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml
+# application/vnd.openxmlformats-officedocument.presentationml.tags+xml
+application/vnd.openxmlformats-officedocument.presentationml.template  potx
+# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml
+# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet      xlsx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml
+application/vnd.openxmlformats-officedocument.spreadsheetml.template   xltx
+# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml
+# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml
+# application/vnd.openxmlformats-officedocument.theme+xml
+# application/vnd.openxmlformats-officedocument.themeoverride+xml
+# application/vnd.openxmlformats-officedocument.vmldrawing
+# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.document        docx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml
+application/vnd.openxmlformats-officedocument.wordprocessingml.template        dotx
+# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml
+# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml
+# application/vnd.openxmlformats-package.core-properties+xml
+# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml
+# application/vnd.openxmlformats-package.relationships+xml
+# application/vnd.quobject-quoxdocument
+# application/vnd.osa.netdeploy
+application/vnd.osgeo.mapguide.package         mgp
+# application/vnd.osgi.bundle
+application/vnd.osgi.dp                                dp
+application/vnd.osgi.subsystem                 esa
+# application/vnd.otps.ct-kip+xml
+application/vnd.palm                           pdb pqa oprc
+# application/vnd.paos.xml
+application/vnd.pawaafile                      paw
+application/vnd.pg.format                      str
+application/vnd.pg.osasli                      ei6
+# application/vnd.piaccess.application-licence
+application/vnd.picsel                         efif
+application/vnd.pmi.widget                     wg
+# application/vnd.poc.group-advertisement+xml
+application/vnd.pocketlearn                    plf
+application/vnd.powerbuilder6                  pbd
+# application/vnd.powerbuilder6-s
+# application/vnd.powerbuilder7
+# application/vnd.powerbuilder7-s
+# application/vnd.powerbuilder75
+# application/vnd.powerbuilder75-s
+# application/vnd.preminet
+application/vnd.previewsystems.box             box
+application/vnd.proteus.magazine               mgz
+application/vnd.publishare-delta-tree          qps
+application/vnd.pvi.ptid1                      ptid
+# application/vnd.pwg-multiplexed
+# application/vnd.pwg-xhtml-print+xml
+# application/vnd.qualcomm.brew-app-res
+application/vnd.quark.quarkxpress              qxd qxt qwd qwt qxl qxb
+# application/vnd.radisys.moml+xml
+# application/vnd.radisys.msml+xml
+# application/vnd.radisys.msml-audit+xml
+# application/vnd.radisys.msml-audit-conf+xml
+# application/vnd.radisys.msml-audit-conn+xml
+# application/vnd.radisys.msml-audit-dialog+xml
+# application/vnd.radisys.msml-audit-stream+xml
+# application/vnd.radisys.msml-conf+xml
+# application/vnd.radisys.msml-dialog+xml
+# application/vnd.radisys.msml-dialog-base+xml
+# application/vnd.radisys.msml-dialog-fax-detect+xml
+# application/vnd.radisys.msml-dialog-fax-sendrecv+xml
+# application/vnd.radisys.msml-dialog-group+xml
+# application/vnd.radisys.msml-dialog-speech+xml
+# application/vnd.radisys.msml-dialog-transform+xml
+# application/vnd.rainstor.data
+# application/vnd.rapid
+application/vnd.realvnc.bed                    bed
+application/vnd.recordare.musicxml             mxl
+application/vnd.recordare.musicxml+xml         musicxml
+# application/vnd.renlearn.rlprint
+application/vnd.rig.cryptonote                 cryptonote
+application/vnd.rim.cod                                cod
+application/vnd.rn-realmedia                   rm
+application/vnd.rn-realmedia-vbr               rmvb
+application/vnd.route66.link66+xml             link66
+# application/vnd.rs-274x
+# application/vnd.ruckus.download
+# application/vnd.s3sms
+application/vnd.sailingtracker.track           st
+# application/vnd.sbm.cid
+# application/vnd.sbm.mid2
+# application/vnd.scribus
+# application/vnd.sealed.3df
+# application/vnd.sealed.csf
+# application/vnd.sealed.doc
+# application/vnd.sealed.eml
+# application/vnd.sealed.mht
+# application/vnd.sealed.net
+# application/vnd.sealed.ppt
+# application/vnd.sealed.tiff
+# application/vnd.sealed.xls
+# application/vnd.sealedmedia.softseal.html
+# application/vnd.sealedmedia.softseal.pdf
+application/vnd.seemail                                see
+application/vnd.sema                           sema
+application/vnd.semd                           semd
+application/vnd.semf                           semf
+application/vnd.shana.informed.formdata                ifm
+application/vnd.shana.informed.formtemplate    itp
+application/vnd.shana.informed.interchange     iif
+application/vnd.shana.informed.package         ipk
+application/vnd.simtech-mindmapper             twd twds
+application/vnd.smaf                           mmf
+# application/vnd.smart.notebook
+application/vnd.smart.teacher                  teacher
+# application/vnd.software602.filler.form+xml
+# application/vnd.software602.filler.form-xml-zip
+application/vnd.solent.sdkm+xml                        sdkm sdkd
+application/vnd.spotfire.dxp                   dxp
+application/vnd.spotfire.sfs                   sfs
+# application/vnd.sss-cod
+# application/vnd.sss-dtf
+# application/vnd.sss-ntf
+application/vnd.stardivision.calc              sdc
+application/vnd.stardivision.draw              sda
+application/vnd.stardivision.impress           sdd
+application/vnd.stardivision.math              smf
+application/vnd.stardivision.writer            sdw vor
+application/vnd.stardivision.writer-global     sgl
+application/vnd.stepmania.package              smzip
+application/vnd.stepmania.stepchart            sm
+# application/vnd.street-stream
+application/vnd.sun.xml.calc                   sxc
+application/vnd.sun.xml.calc.template          stc
+application/vnd.sun.xml.draw                   sxd
+application/vnd.sun.xml.draw.template          std
+application/vnd.sun.xml.impress                        sxi
+application/vnd.sun.xml.impress.template       sti
+application/vnd.sun.xml.math                   sxm
+application/vnd.sun.xml.writer                 sxw
+application/vnd.sun.xml.writer.global          sxg
+application/vnd.sun.xml.writer.template                stw
+# application/vnd.sun.wadl+xml
+application/vnd.sus-calendar                   sus susp
+application/vnd.svd                            svd
+# application/vnd.swiftview-ics
+application/vnd.symbian.install                        sis sisx
+application/vnd.syncml+xml                     xsm
+application/vnd.syncml.dm+wbxml                        bdm
+application/vnd.syncml.dm+xml                  xdm
+# application/vnd.syncml.dm.notification
+# application/vnd.syncml.ds.notification
+application/vnd.tao.intent-module-archive      tao
+application/vnd.tcpdump.pcap                   pcap cap dmp
+application/vnd.tmobile-livetv                 tmo
+application/vnd.trid.tpt                       tpt
+application/vnd.triscape.mxs                   mxs
+application/vnd.trueapp                                tra
+# application/vnd.truedoc
+# application/vnd.ubisoft.webplayer
+application/vnd.ufdl                           ufd ufdl
+application/vnd.uiq.theme                      utz
+application/vnd.umajin                         umj
+application/vnd.unity                          unityweb
+application/vnd.uoml+xml                       uoml
+# application/vnd.uplanet.alert
+# application/vnd.uplanet.alert-wbxml
+# application/vnd.uplanet.bearer-choice
+# application/vnd.uplanet.bearer-choice-wbxml
+# application/vnd.uplanet.cacheop
+# application/vnd.uplanet.cacheop-wbxml
+# application/vnd.uplanet.channel
+# application/vnd.uplanet.channel-wbxml
+# application/vnd.uplanet.list
+# application/vnd.uplanet.list-wbxml
+# application/vnd.uplanet.listcmd
+# application/vnd.uplanet.listcmd-wbxml
+# application/vnd.uplanet.signal
+application/vnd.vcx                            vcx
+# application/vnd.vd-study
+# application/vnd.vectorworks
+# application/vnd.verimatrix.vcas
+# application/vnd.vidsoft.vidconference
+application/vnd.visio                          vsd vst vss vsw
+application/vnd.visionary                      vis
+# application/vnd.vividence.scriptfile
+application/vnd.vsf                            vsf
+# application/vnd.wap.sic
+# application/vnd.wap.slc
+application/vnd.wap.wbxml                      wbxml
+application/vnd.wap.wmlc                       wmlc
+application/vnd.wap.wmlscriptc                 wmlsc
+application/vnd.webturbo                       wtb
+# application/vnd.wfa.wsc
+# application/vnd.wmc
+# application/vnd.wmf.bootstrap
+# application/vnd.wolfram.mathematica
+# application/vnd.wolfram.mathematica.package
+application/vnd.wolfram.player                 nbp
+application/vnd.wordperfect                    wpd
+application/vnd.wqd                            wqd
+# application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf                         stf
+# application/vnd.wv.csp+wbxml
+# application/vnd.wv.csp+xml
+# application/vnd.wv.ssp+xml
+application/vnd.xara                           xar
+application/vnd.xfdl                           xfdl
+# application/vnd.xfdl.webform
+# application/vnd.xmi+xml
+# application/vnd.xmpie.cpkg
+# application/vnd.xmpie.dpkg
+# application/vnd.xmpie.plan
+# application/vnd.xmpie.ppkg
+# application/vnd.xmpie.xlim
+application/vnd.yamaha.hv-dic                  hvd
+application/vnd.yamaha.hv-script               hvs
+application/vnd.yamaha.hv-voice                        hvp
+application/vnd.yamaha.openscoreformat                 osf
+application/vnd.yamaha.openscoreformat.osfpvg+xml      osfpvg
+# application/vnd.yamaha.remote-setup
+application/vnd.yamaha.smaf-audio              saf
+application/vnd.yamaha.smaf-phrase             spf
+# application/vnd.yamaha.through-ngn
+# application/vnd.yamaha.tunnel-udpencap
+application/vnd.yellowriver-custom-menu                cmp
+application/vnd.zul                            zir zirz
+application/vnd.zzazz.deck+xml                 zaz
+application/voicexml+xml                       vxml
+# application/vq-rtcpxr
+# application/watcherinfo+xml
+# application/whoispp-query
+# application/whoispp-response
+application/widget                             wgt
+application/winhlp                             hlp
+# application/wita
+# application/wordperfect5.1
+application/wsdl+xml                           wsdl
+application/wspolicy+xml                       wspolicy
+application/x-7z-compressed                    7z
+application/x-abiword                          abw
+application/x-ace-compressed                   ace
+# application/x-amf
+application/x-apple-diskimage                  dmg
+application/x-authorware-bin                   aab x32 u32 vox
+application/x-authorware-map                   aam
+application/x-authorware-seg                   aas
+application/x-bcpio                            bcpio
+application/x-bittorrent                       torrent
+application/x-blorb                            blb blorb
+application/x-bzip                             bz
+application/x-bzip2                            bz2 boz
+application/x-cbr                              cbr cba cbt cbz cb7
+application/x-cdlink                           vcd
+application/x-cfs-compressed                   cfs
+application/x-chat                             chat
+application/x-chess-pgn                                pgn
+application/x-conference                       nsc
+# application/x-compress
+application/x-cpio                             cpio
+application/x-csh                              csh
+application/x-debian-package                   deb udeb
+application/x-dgc-compressed                   dgc
+application/x-director                 dir dcr dxr cst cct cxt w3d fgd swa
+application/x-doom                             wad
+application/x-dtbncx+xml                       ncx
+application/x-dtbook+xml                       dtb
+application/x-dtbresource+xml                  res
+application/x-dvi                              dvi
+application/x-envoy                            evy
+application/x-eva                              eva
+application/x-font-bdf                         bdf
+# application/x-font-dos
+# application/x-font-framemaker
+application/x-font-ghostscript                 gsf
+# application/x-font-libgrx
+application/x-font-linux-psf                   psf
+application/x-font-otf                         otf
+application/x-font-pcf                         pcf
+application/x-font-snf                         snf
+# application/x-font-speedo
+# application/x-font-sunos-news
+application/x-font-ttf                         ttf ttc
+application/x-font-type1                       pfa pfb pfm afm
+application/font-woff                          woff
+# application/x-font-vfont
+application/x-freearc                          arc
+application/x-futuresplash                     spl
+application/x-gca-compressed                   gca
+application/x-glulx                            ulx
+application/x-gnumeric                         gnumeric
+application/x-gramps-xml                       gramps
+application/x-gtar                             gtar
+# application/x-gzip
+application/x-hdf                              hdf
+application/x-install-instructions             install
+application/x-iso9660-image                    iso
+application/x-java-jnlp-file                   jnlp
+application/x-latex                            latex
+application/x-lzh-compressed                   lzh lha
+application/x-mie                              mie
+application/x-mobipocket-ebook                 prc mobi
+application/x-ms-application                   application
+application/x-ms-shortcut                      lnk
+application/x-ms-wmd                           wmd
+application/x-ms-wmz                           wmz
+application/x-ms-xbap                          xbap
+application/x-msaccess                         mdb
+application/x-msbinder                         obd
+application/x-mscardfile                       crd
+application/x-msclip                           clp
+application/x-msdownload                       exe dll com bat msi
+application/x-msmediaview                      mvb m13 m14
+application/x-msmetafile                       wmf wmz emf emz
+application/x-msmoney                          mny
+application/x-mspublisher                      pub
+application/x-msschedule                       scd
+application/x-msterminal                       trm
+application/x-mswrite                          wri
+application/x-netcdf                           nc cdf
+application/x-nzb                              nzb
+application/x-pkcs12                           p12 pfx
+application/x-pkcs7-certificates               p7b spc
+application/x-pkcs7-certreqresp                        p7r
+application/x-rar-compressed                   rar
+application/x-research-info-systems            ris
+application/x-sh                               sh
+application/x-shar                             shar
+application/x-shockwave-flash                  swf
+application/x-silverlight-app                  xap
+application/x-sql                              sql
+application/x-stuffit                          sit
+application/x-stuffitx                         sitx
+application/x-subrip                           srt
+application/x-sv4cpio                          sv4cpio
+application/x-sv4crc                           sv4crc
+application/x-t3vm-image                       t3
+application/x-tads                             gam
+application/x-tar                              tar
+application/x-tcl                              tcl
+application/x-tex                              tex
+application/x-tex-tfm                          tfm
+application/x-texinfo                          texinfo texi
+application/x-tgif                             obj
+application/x-ustar                            ustar
+application/x-wais-source                      src
+application/x-x509-ca-cert                     der crt
+application/x-xfig                             fig
+application/x-xliff+xml                                xlf
+application/x-xpinstall                                xpi
+application/x-xz                               xz
+application/x-zmachine                         z1 z2 z3 z4 z5 z6 z7 z8
+# application/x400-bp
+application/xaml+xml                           xaml
+# application/xcap-att+xml
+# application/xcap-caps+xml
+application/xcap-diff+xml                      xdf
+# application/xcap-el+xml
+# application/xcap-error+xml
+# application/xcap-ns+xml
+# application/xcon-conference-info-diff+xml
+# application/xcon-conference-info+xml
+application/xenc+xml                           xenc
+application/xhtml+xml                          xhtml xht
+# application/xhtml-voice+xml
+application/xml                                        xml xsl
+application/xml-dtd                            dtd
+# application/xml-external-parsed-entity
+# application/xmpp+xml
+application/xop+xml                            xop
+application/xproc+xml                          xpl
+application/xslt+xml                           xslt
+application/xspf+xml                           xspf
+application/xv+xml                             mxml xhvml xvml xvm
+application/yang                               yang
+application/yin+xml                            yin
+application/zip                                        zip
+# audio/1d-interleaved-parityfec
+# audio/32kadpcm
+# audio/3gpp
+# audio/3gpp2
+# audio/ac3
+audio/adpcm                                    adp
+# audio/amr
+# audio/amr-wb
+# audio/amr-wb+
+# audio/asc
+# audio/atrac-advanced-lossless
+# audio/atrac-x
+# audio/atrac3
+audio/basic                                    au snd
+# audio/bv16
+# audio/bv32
+# audio/clearmode
+# audio/cn
+# audio/dat12
+# audio/dls
+# audio/dsr-es201108
+# audio/dsr-es202050
+# audio/dsr-es202211
+# audio/dsr-es202212
+# audio/dv
+# audio/dvi4
+# audio/eac3
+# audio/evrc
+# audio/evrc-qcp
+# audio/evrc0
+# audio/evrc1
+# audio/evrcb
+# audio/evrcb0
+# audio/evrcb1
+# audio/evrcwb
+# audio/evrcwb0
+# audio/evrcwb1
+# audio/example
+# audio/fwdred
+# audio/g719
+# audio/g722
+# audio/g7221
+# audio/g723
+# audio/g726-16
+# audio/g726-24
+# audio/g726-32
+# audio/g726-40
+# audio/g728
+# audio/g729
+# audio/g7291
+# audio/g729d
+# audio/g729e
+# audio/gsm
+# audio/gsm-efr
+# audio/gsm-hr-08
+# audio/ilbc
+# audio/ip-mr_v2.5
+# audio/isac
+# audio/l16
+# audio/l20
+# audio/l24
+# audio/l8
+# audio/lpc
+audio/midi                                     mid midi kar rmi
+# audio/mobile-xmf
+audio/mp4                                      mp4a
+# audio/mp4a-latm
+# audio/mpa
+# audio/mpa-robust
+audio/mpeg                                     mpga mp2 mp2a mp3 m2a m3a
+# audio/mpeg4-generic
+# audio/musepack
+audio/ogg                                      oga ogg spx
+# audio/opus
+# audio/parityfec
+# audio/pcma
+# audio/pcma-wb
+# audio/pcmu-wb
+# audio/pcmu
+# audio/prs.sid
+# audio/qcelp
+# audio/red
+# audio/rtp-enc-aescm128
+# audio/rtp-midi
+# audio/rtx
+audio/s3m                                      s3m
+audio/silk                                     sil
+# audio/smv
+# audio/smv0
+# audio/smv-qcp
+# audio/sp-midi
+# audio/speex
+# audio/t140c
+# audio/t38
+# audio/telephone-event
+# audio/tone
+# audio/uemclip
+# audio/ulpfec
+# audio/vdvi
+# audio/vmr-wb
+# audio/vnd.3gpp.iufp
+# audio/vnd.4sb
+# audio/vnd.audiokoz
+# audio/vnd.celp
+# audio/vnd.cisco.nse
+# audio/vnd.cmles.radio-events
+# audio/vnd.cns.anp1
+# audio/vnd.cns.inf1
+audio/vnd.dece.audio                           uva uvva
+audio/vnd.digital-winds                                eol
+# audio/vnd.dlna.adts
+# audio/vnd.dolby.heaac.1
+# audio/vnd.dolby.heaac.2
+# audio/vnd.dolby.mlp
+# audio/vnd.dolby.mps
+# audio/vnd.dolby.pl2
+# audio/vnd.dolby.pl2x
+# audio/vnd.dolby.pl2z
+# audio/vnd.dolby.pulse.1
+audio/vnd.dra                                  dra
+audio/vnd.dts                                  dts
+audio/vnd.dts.hd                               dtshd
+# audio/vnd.dvb.file
+# audio/vnd.everad.plj
+# audio/vnd.hns.audio
+audio/vnd.lucent.voice                         lvp
+audio/vnd.ms-playready.media.pya               pya
+# audio/vnd.nokia.mobile-xmf
+# audio/vnd.nortel.vbk
+audio/vnd.nuera.ecelp4800                      ecelp4800
+audio/vnd.nuera.ecelp7470                      ecelp7470
+audio/vnd.nuera.ecelp9600                      ecelp9600
+# audio/vnd.octel.sbc
+# audio/vnd.qcelp
+# audio/vnd.rhetorex.32kadpcm
+audio/vnd.rip                                  rip
+# audio/vnd.sealedmedia.softseal.mpeg
+# audio/vnd.vmx.cvsd
+# audio/vorbis
+# audio/vorbis-config
+audio/webm                                     weba
+audio/x-aac                                    aac
+audio/x-aiff                                   aif aiff aifc
+audio/x-caf                                    caf
+audio/x-flac                                   flac
+audio/x-matroska                               mka
+audio/x-mpegurl                                        m3u
+audio/x-ms-wax                                 wax
+audio/x-ms-wma                                 wma
+audio/x-pn-realaudio                           ram ra
+audio/x-pn-realaudio-plugin                    rmp
+# audio/x-tta
+audio/x-wav                                    wav
+audio/xm                                       xm
+chemical/x-cdx                                 cdx
+chemical/x-cif                                 cif
+chemical/x-cmdf                                        cmdf
+chemical/x-cml                                 cml
+chemical/x-csml                                        csml
+# chemical/x-pdb
+chemical/x-xyz                                 xyz
+image/bmp                                      bmp
+image/cgm                                      cgm
+# image/example
+# image/fits
+image/g3fax                                    g3
+image/gif                                      gif
+image/ief                                      ief
+# image/jp2
+image/jpeg                                     jpeg jpg jpe
+# image/jpm
+# image/jpx
+image/ktx                                      ktx
+# image/naplps
+image/png                                      png
+image/prs.btif                                 btif
+# image/prs.pti
+image/sgi                                      sgi
+image/svg+xml                                  svg svgz
+# image/t38
+image/tiff                                     tiff tif
+# image/tiff-fx
+image/vnd.adobe.photoshop                      psd
+# image/vnd.cns.inf2
+image/vnd.dece.graphic                         uvi uvvi uvg uvvg
+image/vnd.dvb.subtitle                         sub
+image/vnd.djvu                                 djvu djv
+image/vnd.dwg                                  dwg
+image/vnd.dxf                                  dxf
+image/vnd.fastbidsheet                         fbs
+image/vnd.fpx                                  fpx
+image/vnd.fst                                  fst
+image/vnd.fujixerox.edmics-mmr                 mmr
+image/vnd.fujixerox.edmics-rlc                 rlc
+# image/vnd.globalgraphics.pgb
+# image/vnd.microsoft.icon
+# image/vnd.mix
+image/vnd.ms-modi                              mdi
+image/vnd.ms-photo                             wdp
+image/vnd.net-fpx                              npx
+# image/vnd.radiance
+# image/vnd.sealed.png
+# image/vnd.sealedmedia.softseal.gif
+# image/vnd.sealedmedia.softseal.jpg
+# image/vnd.svf
+image/vnd.wap.wbmp                             wbmp
+image/vnd.xiff                                 xif
+image/webp                                     webp
+image/x-3ds                                    3ds
+image/x-cmu-raster                             ras
+image/x-cmx                                    cmx
+image/x-freehand                               fh fhc fh4 fh5 fh7
+image/x-icon                                   ico
+image/x-mrsid-image                            sid
+image/x-pcx                                    pcx
+image/x-pict                                   pic pct
+image/x-portable-anymap                                pnm
+image/x-portable-bitmap                                pbm
+image/x-portable-graymap                       pgm
+image/x-portable-pixmap                                ppm
+image/x-rgb                                    rgb
+image/x-tga                                    tga
+image/x-xbitmap                                        xbm
+image/x-xpixmap                                        xpm
+image/x-xwindowdump                            xwd
+# message/cpim
+# message/delivery-status
+# message/disposition-notification
+# message/example
+# message/external-body
+# message/feedback-report
+# message/global
+# message/global-delivery-status
+# message/global-disposition-notification
+# message/global-headers
+# message/http
+# message/imdn+xml
+# message/news
+# message/partial
+message/rfc822                                 eml mime
+# message/s-http
+# message/sip
+# message/sipfrag
+# message/tracking-status
+# message/vnd.si.simp
+# model/example
+model/iges                                     igs iges
+model/mesh                                     msh mesh silo
+model/vnd.collada+xml                          dae
+model/vnd.dwf                                  dwf
+# model/vnd.flatland.3dml
+model/vnd.gdl                                  gdl
+# model/vnd.gs-gdl
+# model/vnd.gs.gdl
+model/vnd.gtw                                  gtw
+# model/vnd.moml+xml
+model/vnd.mts                                  mts
+# model/vnd.parasolid.transmit.binary
+# model/vnd.parasolid.transmit.text
+model/vnd.vtu                                  vtu
+model/vrml                                     wrl vrml
+model/x3d+binary                               x3db x3dbz
+model/x3d+vrml                                 x3dv x3dvz
+model/x3d+xml                                  x3d x3dz
+# multipart/alternative
+# multipart/appledouble
+# multipart/byteranges
+# multipart/digest
+# multipart/encrypted
+# multipart/example
+# multipart/form-data
+# multipart/header-set
+# multipart/mixed
+# multipart/parallel
+# multipart/related
+# multipart/report
+# multipart/signed
+# multipart/voice-message
+# text/1d-interleaved-parityfec
+text/cache-manifest                            appcache
+text/calendar                                  ics ifb
+text/css                                       css
+text/csv                                       csv
+# text/directory
+# text/dns
+# text/ecmascript
+# text/enriched
+# text/example
+# text/fwdred
+text/html                                      html htm
+# text/javascript
+text/n3                                                n3
+# text/parityfec
+text/plain                                     txt text conf def list log in
+# text/prs.fallenstein.rst
+text/prs.lines.tag                             dsc
+# text/vnd.radisys.msml-basic-layout
+# text/red
+# text/rfc822-headers
+text/richtext                                  rtx
+# text/rtf
+# text/rtp-enc-aescm128
+# text/rtx
+text/sgml                                      sgml sgm
+# text/t140
+text/tab-separated-values                      tsv
+text/troff                                     t tr roff man me ms
+text/turtle                                    ttl
+# text/ulpfec
+text/uri-list                                  uri uris urls
+text/vcard                                     vcard
+# text/vnd.abc
+text/vnd.curl                                  curl
+text/vnd.curl.dcurl                            dcurl
+text/vnd.curl.scurl                            scurl
+text/vnd.curl.mcurl                            mcurl
+# text/vnd.dmclientscript
+text/vnd.dvb.subtitle                          sub
+# text/vnd.esmertec.theme-descriptor
+text/vnd.fly                                   fly
+text/vnd.fmi.flexstor                          flx
+text/vnd.graphviz                              gv
+text/vnd.in3d.3dml                             3dml
+text/vnd.in3d.spot                             spot
+# text/vnd.iptc.newsml
+# text/vnd.iptc.nitf
+# text/vnd.latex-z
+# text/vnd.motorola.reflex
+# text/vnd.ms-mediapackage
+# text/vnd.net2phone.commcenter.command
+# text/vnd.si.uricatalogue
+text/vnd.sun.j2me.app-descriptor               jad
+# text/vnd.trolltech.linguist
+# text/vnd.wap.si
+# text/vnd.wap.sl
+text/vnd.wap.wml                               wml
+text/vnd.wap.wmlscript                         wmls
+text/x-asm                                     s asm
+text/x-c                                       c cc cxx cpp h hh dic
+text/x-fortran                                 f for f77 f90
+text/x-java-source                             java
+text/x-opml                                    opml
+text/x-pascal                                  p pas
+text/x-nfo                                     nfo
+text/x-setext                                  etx
+text/x-sfv                                     sfv
+text/x-uuencode                                        uu
+text/x-vcalendar                               vcs
+text/x-vcard                                   vcf
+# text/xml
+# text/xml-external-parsed-entity
+# video/1d-interleaved-parityfec
+video/3gpp                                     3gp
+# video/3gpp-tt
+video/3gpp2                                    3g2
+# video/bmpeg
+# video/bt656
+# video/celb
+# video/dv
+# video/example
+video/h261                                     h261
+video/h263                                     h263
+# video/h263-1998
+# video/h263-2000
+video/h264                                     h264
+# video/h264-rcdo
+# video/h264-svc
+video/jpeg                                     jpgv
+# video/jpeg2000
+video/jpm                                      jpm jpgm
+video/mj2                                      mj2 mjp2
+# video/mp1s
+# video/mp2p
+# video/mp2t
+video/mp4                                      mp4 mp4v mpg4
+# video/mp4v-es
+video/mpeg                                     mpeg mpg mpe m1v m2v
+# video/mpeg4-generic
+# video/mpv
+# video/nv
+video/ogg                                      ogv
+# video/parityfec
+# video/pointer
+video/quicktime                                        qt mov
+# video/raw
+# video/rtp-enc-aescm128
+# video/rtx
+# video/smpte292m
+# video/ulpfec
+# video/vc1
+# video/vnd.cctv
+video/vnd.dece.hd                              uvh uvvh
+video/vnd.dece.mobile                          uvm uvvm
+# video/vnd.dece.mp4
+video/vnd.dece.pd                              uvp uvvp
+video/vnd.dece.sd                              uvs uvvs
+video/vnd.dece.video                           uvv uvvv
+# video/vnd.directv.mpeg
+# video/vnd.directv.mpeg-tts
+# video/vnd.dlna.mpeg-tts
+video/vnd.dvb.file                             dvb
+video/vnd.fvt                                  fvt
+# video/vnd.hns.video
+# video/vnd.iptvforum.1dparityfec-1010
+# video/vnd.iptvforum.1dparityfec-2005
+# video/vnd.iptvforum.2dparityfec-1010
+# video/vnd.iptvforum.2dparityfec-2005
+# video/vnd.iptvforum.ttsavc
+# video/vnd.iptvforum.ttsmpeg2
+# video/vnd.motorola.video
+# video/vnd.motorola.videop
+video/vnd.mpegurl                              mxu m4u
+video/vnd.ms-playready.media.pyv               pyv
+# video/vnd.nokia.interleaved-multimedia
+# video/vnd.nokia.videovoip
+# video/vnd.objectvideo
+# video/vnd.sealed.mpeg1
+# video/vnd.sealed.mpeg4
+# video/vnd.sealed.swf
+# video/vnd.sealedmedia.softseal.mov
+video/vnd.uvvu.mp4                             uvu uvvu
+video/vnd.vivo                                 viv
+video/webm                                     webm
+video/x-f4v                                    f4v
+video/x-fli                                    fli
+video/x-flv                                    flv
+video/x-m4v                                    m4v
+video/x-matroska                               mkv mk3d mks
+video/x-mng                                    mng
+video/x-ms-asf                                 asf asx
+video/x-ms-vob                                 vob
+video/x-ms-wm                                  wm
+video/x-ms-wmv                                 wmv
+video/x-ms-wmx                                 wmx
+video/x-ms-wvx                                 wvx
+video/x-msvideo                                        avi
+video/x-sgi-movie                              movie
+video/x-smv                                    smv
+x-conference/x-cooltalk                                ice
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/types/node.types b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/mime/types/node.types
new file mode 100755 (executable)
index 0000000..55b2cf7
--- /dev/null
@@ -0,0 +1,77 @@
+# What: WebVTT
+# Why: To allow formats intended for marking up external text track resources.
+# http://dev.w3.org/html5/webvtt/
+# Added by: niftylettuce
+text/vtt  vtt
+
+# What: Google Chrome Extension
+# Why: To allow apps to (work) be served with the right content type header.
+# http://codereview.chromium.org/2830017
+# Added by: niftylettuce
+application/x-chrome-extension  crx
+
+# What: HTC support
+# Why: To properly render .htc files such as CSS3PIE
+# Added by: niftylettuce
+text/x-component  htc
+
+# What: HTML5 application cache manifes ('.manifest' extension)
+# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
+# per https://developer.mozilla.org/en/offline_resources_in_firefox
+# Added by: louisremi
+text/cache-manifest  manifest
+
+# What: node binary buffer format
+# Why: semi-standard extension w/in the node community
+# Added by: tootallnate
+application/octet-stream  buffer
+
+# What: The "protected" MP-4 formats used by iTunes.
+# Why: Required for streaming music to browsers (?)
+# Added by: broofa
+application/mp4  m4p
+audio/mp4  m4a
+
+# What: Video format, Part of RFC1890
+# Why: See https://github.com/bentomas/node-mime/pull/6
+# Added by: mjrusso
+video/MP2T  ts
+
+# What: EventSource mime type
+# Why: mime type of Server-Sent Events stream
+# http://www.w3.org/TR/eventsource/#text-event-stream
+# Added by: francois2metz
+text/event-stream  event-stream
+
+# What: Mozilla App manifest mime type
+# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests
+# Added by: ednapiranha
+application/x-web-app-manifest+json   webapp
+
+# What: Lua file types
+# Why: Googling around shows de-facto consensus on these
+# Added by: creationix (Issue #45)
+text/x-lua  lua
+application/x-lua-bytecode  luac
+
+# What: Markdown files, as per http://daringfireball.net/projects/markdown/syntax
+# Why: http://stackoverflow.com/questions/10701983/what-is-the-mime-type-for-markdown
+# Added by: avoidwork
+text/x-markdown  markdown md mkd
+
+# What: ini files
+# Why: because they're just text files
+# Added by: Matthew Kastor
+text/plain  ini
+
+# What: DASH Adaptive Streaming manifest
+# Why: https://developer.mozilla.org/en-US/docs/DASH_Adaptive_Streaming_for_HTML_5_Video
+# Added by: eelcocramer
+application/dash+xml mdp
+
+# What: OpenType font files - http://www.microsoft.com/typography/otspec/
+# Why:  Browsers usually ignore the font MIME types and sniff the content,
+#       but Chrome, shows a warning if OpenType fonts aren't served with
+#       the `font/opentype` MIME type: http://i.imgur.com/8c5RN8M.png.
+# Added by: alrra
+font/opentype  otf
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/LICENSE
new file mode 100755 (executable)
index 0000000..a4a9aee
--- /dev/null
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/README.md
new file mode 100755 (executable)
index 0000000..34c4a85
--- /dev/null
@@ -0,0 +1,4 @@
+oauth-sign
+==========
+
+OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module. 
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/index.js
new file mode 100755 (executable)
index 0000000..e35bfa6
--- /dev/null
@@ -0,0 +1,43 @@
+var crypto = require('crypto')
+  , qs = require('querystring')
+  ;
+
+function sha1 (key, body) {
+  return crypto.createHmac('sha1', key).update(body).digest('base64')
+}
+
+function rfc3986 (str) {
+  return encodeURIComponent(str)
+    .replace(/!/g,'%21')
+    .replace(/\*/g,'%2A')
+    .replace(/\(/g,'%28')
+    .replace(/\)/g,'%29')
+    .replace(/'/g,'%27')
+    ;
+}
+
+function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret) {
+  // adapted from https://dev.twitter.com/docs/auth/oauth and 
+  // https://dev.twitter.com/docs/auth/creating-signature
+
+  var querystring = Object.keys(params).sort().map(function(key){
+    // big WTF here with the escape + encoding but it's what twitter wants
+    return escape(rfc3986(key)) + "%3D" + escape(rfc3986(params[key]))
+  }).join('%26')
+
+  var base = [
+    httpMethod ? httpMethod.toUpperCase() : 'GET',
+    rfc3986(base_uri),
+    querystring
+  ].join('&')
+
+  var key = [
+    consumer_secret,
+    token_secret || ''
+  ].map(rfc3986).join('&')
+
+  return sha1(key, base)
+}
+
+exports.hmacsign = hmacsign
+exports.rfc3986 = rfc3986
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/package.json
new file mode 100755 (executable)
index 0000000..33fa3b5
--- /dev/null
@@ -0,0 +1,48 @@
+{
+  "author": {
+    "name": "Mikeal Rogers",
+    "email": "mikeal.rogers@gmail.com",
+    "url": "http://www.futurealoof.com"
+  },
+  "name": "oauth-sign",
+  "description": "OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.",
+  "version": "0.3.0",
+  "repository": {
+    "url": "https://github.com/mikeal/oauth-sign"
+  },
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {},
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "scripts": {
+    "test": "node test.js"
+  },
+  "_id": "oauth-sign@0.3.0",
+  "dist": {
+    "shasum": "cb540f93bb2b22a7d5941691a288d60e8ea9386e",
+    "tarball": "http://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz"
+  },
+  "_from": "oauth-sign@~0.3.0",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "mikeal",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mikeal",
+      "email": "mikeal.rogers@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "cb540f93bb2b22a7d5941691a288d60e8ea9386e",
+  "_resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz",
+  "bugs": {
+    "url": "https://github.com/mikeal/oauth-sign/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mikeal/oauth-sign"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/oauth-sign/test.js
new file mode 100755 (executable)
index 0000000..46955ff
--- /dev/null
@@ -0,0 +1,49 @@
+var hmacsign = require('./index').hmacsign
+  , assert = require('assert')
+  , qs = require('querystring')
+  ;
+
+// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth
+
+var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', 
+  { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
+  , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
+  , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
+  , oauth_signature_method: 'HMAC-SHA1'
+  , oauth_timestamp: '1272323042'
+  , oauth_version: '1.0'
+  }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98")
+
+console.log(reqsign)
+console.log('8wUi7m5HFQy76nowoCThusfgB+Q=')
+assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=')
+
+var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token',
+  { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
+  , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
+  , oauth_signature_method: 'HMAC-SHA1'
+  , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
+  , oauth_timestamp: '1272323047'
+  , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
+  , oauth_version: '1.0'
+  }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA")
+  
+console.log(accsign)
+console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
+assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
+
+var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', 
+  { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g"
+  , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
+  , oauth_signature_method: "HMAC-SHA1"
+  , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
+  , oauth_timestamp: "1272325550"
+  , oauth_version: "1.0"
+  , status: 'setting up my twitter 私のさえずりを設定する'
+  }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA")
+
+console.log(upsign)
+console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/Readme.md
new file mode 100755 (executable)
index 0000000..27e54a4
--- /dev/null
@@ -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 &lt;tj@vision-media.ca&gt;
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/index.js
new file mode 100755 (executable)
index 0000000..b05938a
--- /dev/null
@@ -0,0 +1,366 @@
+/**
+ * Object#toString() ref for stringify().
+ */
+
+var toString = Object.prototype.toString;
+
+/**
+ * Object#hasOwnProperty ref
+ */
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Array#indexOf shim.
+ */
+
+var indexOf = typeof Array.prototype.indexOf === 'function'
+  ? function(arr, el) { return arr.indexOf(el); }
+  : function(arr, el) {
+      for (var i = 0; i < arr.length; i++) {
+        if (arr[i] === el) return i;
+      }
+      return -1;
+    };
+
+/**
+ * Array.isArray shim.
+ */
+
+var isArray = Array.isArray || function(arr) {
+  return toString.call(arr) == '[object Array]';
+};
+
+/**
+ * Object.keys shim.
+ */
+
+var objectKeys = Object.keys || function(obj) {
+  var ret = [];
+  for (var key in obj) {
+    if (obj.hasOwnProperty(key)) {
+      ret.push(key);
+    }
+  }
+  return ret;
+};
+
+/**
+ * Array#forEach shim.
+ */
+
+var forEach = typeof Array.prototype.forEach === 'function'
+  ? function(arr, fn) { return arr.forEach(fn); }
+  : function(arr, fn) {
+      for (var i = 0; i < arr.length; i++) fn(arr[i]);
+    };
+
+/**
+ * Array#reduce shim.
+ */
+
+var reduce = function(arr, fn, initial) {
+  if (typeof arr.reduce === 'function') return arr.reduce(fn, initial);
+  var res = initial;
+  for (var i = 0; i < arr.length; i++) res = fn(res, arr[i]);
+  return res;
+};
+
+/**
+ * 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]) {
+    if (hasOwnProperty.call(parent[key], i)) {
+      t[i] = parent[key][i];
+    }
+  }
+  parent[key] = t;
+  return t;
+}
+
+function parse(parts, parent, key, val) {
+  var part = parts.shift();
+  
+  // illegal
+  if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
+  
+  // end
+  if (!part) {
+    if (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 (isArray(obj)) {
+        if ('' != val) obj.push(val);
+      } else if ('object' == typeof obj) {
+        obj[objectKeys(obj).length] = val;
+      } else {
+        obj = parent[key] = [parent[key], val];
+      }
+      // prop
+    } else if (~indexOf(part, ']')) {
+      part = part.substr(0, part.length - 1);
+      if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
+      parse(parts, obj, part, val);
+      // key
+    } else {
+      if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
+      parse(parts, obj, part, val);
+    }
+  }
+}
+
+/**
+ * Merge parent key/val pair.
+ */
+
+function merge(parent, key, val){
+  if (~indexOf(key, ']')) {
+    var parts = key.split('[')
+      , len = parts.length
+      , last = len - 1;
+    parse(parts, parent, 'base', val);
+    // optimize
+  } else {
+    if (!isint.test(key) && 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;
+}
+
+/**
+ * Compact sparse arrays.
+ */
+
+function compact(obj) {
+  if ('object' != typeof obj) return obj;
+
+  if (isArray(obj)) {
+    var ret = [];
+
+    for (var i in obj) {
+      if (hasOwnProperty.call(obj, i)) {
+        ret.push(obj[i]);
+      }
+    }
+
+    return ret;
+  }
+
+  for (var key in obj) {
+    obj[key] = compact(obj[key]);
+  }
+
+  return obj;
+}
+
+/**
+ * Parse the given obj.
+ */
+
+function parseObject(obj){
+  var ret = { base: {} };
+
+  forEach(objectKeys(obj), function(name){
+    merge(ret, name, obj[name]);
+  });
+
+  return compact(ret.base);
+}
+
+/**
+ * Parse the given str.
+ */
+
+function parseString(str){
+  var ret = reduce(String(str).split('&'), function(ret, pair){
+    var eql = indexOf(pair, '=')
+      , brace = lastBraceInKey(pair)
+      , key = pair.substr(0, brace || eql)
+      , val = pair.substr(brace || eql, pair.length)
+      , val = val.substr(indexOf(val, '=') + 1, val.length);
+
+    // ?foo
+    if ('' == key) key = pair, val = '';
+    if ('' == key) return ret;
+
+    return merge(ret, decode(key), decode(val));
+  }, { base: {} }).base;
+
+  return compact(ret);
+}
+
+/**
+ * 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 (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 + '=' + encodeURIComponent(String(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 = objectKeys(obj)
+    , key;
+
+  for (var i = 0, len = keys.length; i < len; ++i) {
+    key = keys[i];
+    if ('' == key) continue;
+    if (null == obj[key]) {
+      ret.push(encodeURIComponent(key) + '=');
+    } else {
+      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 (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
+  if (undefined === v) {
+    obj[key] = val;
+  } else if (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/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/qs/package.json
new file mode 100755 (executable)
index 0000000..3fa54b6
--- /dev/null
@@ -0,0 +1,55 @@
+{
+  "name": "qs",
+  "description": "querystring parser",
+  "version": "0.6.6",
+  "keywords": [
+    "query string",
+    "parser",
+    "component"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/visionmedia/node-querystring.git"
+  },
+  "devDependencies": {
+    "mocha": "*",
+    "expect.js": "*"
+  },
+  "scripts": {
+    "test": "make test"
+  },
+  "author": {
+    "name": "TJ Holowaychuk",
+    "email": "tj@vision-media.ca",
+    "url": "http://tjholowaychuk.com"
+  },
+  "main": "index",
+  "engines": {
+    "node": "*"
+  },
+  "bugs": {
+    "url": "https://github.com/visionmedia/node-querystring/issues"
+  },
+  "_id": "qs@0.6.6",
+  "dist": {
+    "shasum": "6e015098ff51968b8a3c819001d5f2c89bc4b107",
+    "tarball": "http://registry.npmjs.org/qs/-/qs-0.6.6.tgz"
+  },
+  "_from": "qs@~0.6.0",
+  "_npmVersion": "1.2.30",
+  "_npmUser": {
+    "name": "tjholowaychuk",
+    "email": "tj@vision-media.ca"
+  },
+  "maintainers": [
+    {
+      "name": "tjholowaychuk",
+      "email": "tj@vision-media.ca"
+    }
+  ],
+  "directories": {},
+  "_shasum": "6e015098ff51968b8a3c819001d5f2c89bc4b107",
+  "_resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/visionmedia/node-querystring"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/LICENSE
new file mode 100755 (executable)
index 0000000..a4a9aee
--- /dev/null
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/README.md
new file mode 100755 (executable)
index 0000000..bb533d5
--- /dev/null
@@ -0,0 +1,4 @@
+tunnel-agent
+============
+
+HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/index.js
new file mode 100755 (executable)
index 0000000..3f7bbb9
--- /dev/null
@@ -0,0 +1,227 @@
+'use strict'
+
+var net = require('net')
+  , tls = require('tls')
+  , http = require('http')
+  , https = require('https')
+  , events = require('events')
+  , assert = require('assert')
+  , util = require('util')
+  ;
+
+exports.httpOverHttp = httpOverHttp
+exports.httpsOverHttp = httpsOverHttp
+exports.httpOverHttps = httpOverHttps
+exports.httpsOverHttps = httpsOverHttps
+
+
+function httpOverHttp(options) {
+  var agent = new TunnelingAgent(options)
+  agent.request = http.request
+  return agent
+}
+
+function httpsOverHttp(options) {
+  var agent = new TunnelingAgent(options)
+  agent.request = http.request
+  agent.createSocket = createSecureSocket
+  return agent
+}
+
+function httpOverHttps(options) {
+  var agent = new TunnelingAgent(options)
+  agent.request = https.request
+  return agent
+}
+
+function httpsOverHttps(options) {
+  var agent = new TunnelingAgent(options)
+  agent.request = https.request
+  agent.createSocket = createSecureSocket
+  return agent
+}
+
+
+function TunnelingAgent(options) {
+  var self = this
+  self.options = options || {}
+  self.proxyOptions = self.options.proxy || {}
+  self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets
+  self.requests = []
+  self.sockets = []
+
+  self.on('free', function onFree(socket, host, port) {
+    for (var i = 0, len = self.requests.length; i < len; ++i) {
+      var pending = self.requests[i]
+      if (pending.host === host && pending.port === port) {
+        // Detect the request to connect same origin server,
+        // reuse the connection.
+        self.requests.splice(i, 1)
+        pending.request.onSocket(socket)
+        return
+      }
+    }
+    socket.destroy()
+    self.removeSocket(socket)
+  })
+}
+util.inherits(TunnelingAgent, events.EventEmitter)
+
+TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) {
+  var self = this
+
+  if (self.sockets.length >= this.maxSockets) {
+    // We are over limit so we'll add it to the queue.
+    self.requests.push({host: host, port: port, request: req})
+    return
+  }
+
+  // If we are under maxSockets create a new one.
+  self.createSocket({host: host, port: port, request: req}, function(socket) {
+    socket.on('free', onFree)
+    socket.on('close', onCloseOrRemove)
+    socket.on('agentRemove', onCloseOrRemove)
+    req.onSocket(socket)
+
+    function onFree() {
+      self.emit('free', socket, host, port)
+    }
+
+    function onCloseOrRemove(err) {
+      self.removeSocket()
+      socket.removeListener('free', onFree)
+      socket.removeListener('close', onCloseOrRemove)
+      socket.removeListener('agentRemove', onCloseOrRemove)
+    }
+  })
+}
+
+TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
+  var self = this
+  var placeholder = {}
+  self.sockets.push(placeholder)
+
+  var connectOptions = mergeOptions({}, self.proxyOptions, 
+    { method: 'CONNECT'
+    , path: options.host + ':' + options.port
+    , agent: false
+    }
+  )
+  if (connectOptions.proxyAuth) {
+    connectOptions.headers = connectOptions.headers || {}
+    connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
+        new Buffer(connectOptions.proxyAuth).toString('base64')
+  }
+
+  debug('making CONNECT request')
+  var connectReq = self.request(connectOptions)
+  connectReq.useChunkedEncodingByDefault = false // for v0.6
+  connectReq.once('response', onResponse) // for v0.6
+  connectReq.once('upgrade', onUpgrade)   // for v0.6
+  connectReq.once('connect', onConnect)   // for v0.7 or later
+  connectReq.once('error', onError)
+  connectReq.end()
+
+  function onResponse(res) {
+    // Very hacky. This is necessary to avoid http-parser leaks.
+    res.upgrade = true
+  }
+
+  function onUpgrade(res, socket, head) {
+    // Hacky.
+    process.nextTick(function() {
+      onConnect(res, socket, head)
+    })
+  }
+
+  function onConnect(res, socket, head) {
+    connectReq.removeAllListeners()
+    socket.removeAllListeners()
+
+    if (res.statusCode === 200) {
+      assert.equal(head.length, 0)
+      debug('tunneling connection has established')
+      self.sockets[self.sockets.indexOf(placeholder)] = socket
+      cb(socket)
+    } else {
+      debug('tunneling socket could not be established, statusCode=%d', res.statusCode)
+      var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode)
+      error.code = 'ECONNRESET'
+      options.request.emit('error', error)
+      self.removeSocket(placeholder)
+    }
+  }
+
+  function onError(cause) {
+    connectReq.removeAllListeners()
+
+    debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack)
+    var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message)
+    error.code = 'ECONNRESET'
+    options.request.emit('error', error)
+    self.removeSocket(placeholder)
+  }
+}
+
+TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
+  var pos = this.sockets.indexOf(socket)
+  if (pos === -1) return
+  
+  this.sockets.splice(pos, 1)
+
+  var pending = this.requests.shift()
+  if (pending) {
+    // If we have pending requests and a socket gets closed a new one
+    // needs to be created to take over in the pool for the one that closed.
+    this.createSocket(pending, function(socket) {
+      pending.request.onSocket(socket)
+    })
+  }
+}
+
+function createSecureSocket(options, cb) {
+  var self = this
+  TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
+    // 0 is dummy port for v0.6
+    var secureSocket = tls.connect(0, mergeOptions({}, self.options, 
+      { servername: options.host
+      , socket: socket
+      }
+    ))
+    cb(secureSocket)
+  })
+}
+
+
+function mergeOptions(target) {
+  for (var i = 1, len = arguments.length; i < len; ++i) {
+    var overrides = arguments[i]
+    if (typeof overrides === 'object') {
+      var keys = Object.keys(overrides)
+      for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
+        var k = keys[j]
+        if (overrides[k] !== undefined) {
+          target[k] = overrides[k]
+        }
+      }
+    }
+  }
+  return target
+}
+
+
+var debug
+if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
+  debug = function() {
+    var args = Array.prototype.slice.call(arguments)
+    if (typeof args[0] === 'string') {
+      args[0] = 'TUNNEL: ' + args[0]
+    } else {
+      args.unshift('TUNNEL:')
+    }
+    console.error.apply(console, args)
+  }
+} else {
+  debug = function() {}
+}
+exports.debug = debug // for test
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/node_modules/tunnel-agent/package.json
new file mode 100755 (executable)
index 0000000..cbf3fa0
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "author": {
+    "name": "Mikeal Rogers",
+    "email": "mikeal.rogers@gmail.com",
+    "url": "http://www.futurealoof.com"
+  },
+  "name": "tunnel-agent",
+  "description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.",
+  "version": "0.3.0",
+  "repository": {
+    "url": "https://github.com/mikeal/tunnel-agent"
+  },
+  "main": "index.js",
+  "dependencies": {},
+  "devDependencies": {},
+  "optionalDependencies": {},
+  "engines": {
+    "node": "*"
+  },
+  "_id": "tunnel-agent@0.3.0",
+  "dist": {
+    "shasum": "ad681b68f5321ad2827c4cfb1b7d5df2cfe942ee",
+    "tarball": "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz"
+  },
+  "_from": "tunnel-agent@~0.3.0",
+  "_npmVersion": "1.2.14",
+  "_npmUser": {
+    "name": "mikeal",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mikeal",
+      "email": "mikeal.rogers@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "ad681b68f5321ad2827c4cfb1b7d5df2cfe942ee",
+  "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz",
+  "bugs": {
+    "url": "https://github.com/mikeal/tunnel-agent/issues"
+  },
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mikeal/tunnel-agent"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/package.json
new file mode 100755 (executable)
index 0000000..c222bf3
--- /dev/null
@@ -0,0 +1,65 @@
+{
+  "name": "request",
+  "description": "Simplified HTTP request client.",
+  "tags": [
+    "http",
+    "simple",
+    "util",
+    "utility"
+  ],
+  "version": "2.27.0",
+  "author": {
+    "name": "Mikeal Rogers",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/mikeal/request.git"
+  },
+  "bugs": {
+    "url": "http://github.com/mikeal/request/issues"
+  },
+  "engines": [
+    "node >= 0.8.0"
+  ],
+  "main": "index.js",
+  "dependencies": {
+    "qs": "~0.6.0",
+    "json-stringify-safe": "~5.0.0",
+    "forever-agent": "~0.5.0",
+    "tunnel-agent": "~0.3.0",
+    "http-signature": "~0.10.0",
+    "hawk": "~1.0.0",
+    "aws-sign": "~0.3.0",
+    "oauth-sign": "~0.3.0",
+    "cookie-jar": "~0.3.0",
+    "node-uuid": "~1.4.0",
+    "mime": "~1.2.9",
+    "form-data": "~0.1.0"
+  },
+  "scripts": {
+    "test": "node tests/run.js"
+  },
+  "_id": "request@2.27.0",
+  "dist": {
+    "shasum": "dfb1a224dd3a5a9bade4337012503d710e538668",
+    "tarball": "http://registry.npmjs.org/request/-/request-2.27.0.tgz"
+  },
+  "_from": "request@~2.27.0",
+  "_npmVersion": "1.3.2",
+  "_npmUser": {
+    "name": "mikeal",
+    "email": "mikeal.rogers@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "mikeal",
+      "email": "mikeal.rogers@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "dfb1a224dd3a5a9bade4337012503d710e538668",
+  "_resolved": "https://registry.npmjs.org/request/-/request-2.27.0.tgz",
+  "readme": "ERROR: No README data found!",
+  "homepage": "https://github.com/mikeal/request"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/request.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/request.js
new file mode 100755 (executable)
index 0000000..0311f74
--- /dev/null
@@ -0,0 +1,1235 @@
+var http = require('http')
+  , https = false
+  , tls = false
+  , url = require('url')
+  , util = require('util')
+  , stream = require('stream')
+  , qs = require('qs')
+  , querystring = require('querystring')
+  , crypto = require('crypto')
+
+  , oauth = require('oauth-sign')
+  , hawk = require('hawk')
+  , aws = require('aws-sign')
+  , httpSignature = require('http-signature')
+  , uuid = require('node-uuid')
+  , mime = require('mime')
+  , tunnel = require('tunnel-agent')
+  , _safeStringify = require('json-stringify-safe')
+
+  , ForeverAgent = require('forever-agent')
+  , FormData = require('form-data')
+
+  , Cookie = require('cookie-jar')
+  , CookieJar = Cookie.Jar
+  , cookieJar = new CookieJar
+
+  , copy = require('./lib/copy')
+  , debug = require('./lib/debug')
+  , getSafe = require('./lib/getSafe')
+  ;
+
+function safeStringify (obj) {
+  var ret
+  try { ret = JSON.stringify(obj) }
+  catch (e) { ret = _safeStringify(obj) }
+  return ret
+}
+
+var globalPool = {}
+var isUrl = /^https?:/i
+
+try {
+  https = require('https')
+} catch (e) {}
+
+try {
+  tls = require('tls')
+} catch (e) {}
+
+
+
+// Hacky fix for pre-0.4.4 https
+if (https && !https.Agent) {
+  https.Agent = function (options) {
+    http.Agent.call(this, options)
+  }
+  util.inherits(https.Agent, http.Agent)
+  https.Agent.prototype._getConnection = function (host, port, cb) {
+    var s = tls.connect(port, host, this.options, function () {
+      // do other checks here?
+      if (cb) cb()
+    })
+    return s
+  }
+}
+
+function isReadStream (rs) {
+  if (rs.readable && rs.path && rs.mode) {
+    return true
+  }
+}
+
+function toBase64 (str) {
+  return (new Buffer(str || "", "ascii")).toString("base64")
+}
+
+function md5 (str) {
+  return crypto.createHash('md5').update(str).digest('hex')
+}
+
+function Request (options) {
+  stream.Stream.call(this)
+  this.readable = true
+  this.writable = true
+
+  if (typeof options === 'string') {
+    options = {uri:options}
+  }
+
+  var reserved = Object.keys(Request.prototype)
+  for (var i in options) {
+    if (reserved.indexOf(i) === -1) {
+      this[i] = options[i]
+    } else {
+      if (typeof options[i] === 'function') {
+        delete options[i]
+      }
+    }
+  }
+
+  if (options.method) {
+    this.explicitMethod = true
+  }
+
+  this.init(options)
+}
+util.inherits(Request, stream.Stream)
+Request.prototype.init = function (options) {
+  // init() contains all the code to setup the request object.
+  // the actual outgoing request is not started until start() is called
+  // this function is called from both the constructor and on redirect.
+  var self = this
+  if (!options) options = {}
+
+  if (!self.method) self.method = options.method || 'GET'
+  self.localAddress = options.localAddress
+
+  debug(options)
+  if (!self.pool && self.pool !== false) self.pool = globalPool
+  self.dests = self.dests || []
+  self.__isRequestRequest = true
+
+  // Protect against double callback
+  if (!self._callback && self.callback) {
+    self._callback = self.callback
+    self.callback = function () {
+      if (self._callbackCalled) return // Print a warning maybe?
+      self._callbackCalled = true
+      self._callback.apply(self, arguments)
+    }
+    self.on('error', self.callback.bind())
+    self.on('complete', self.callback.bind(self, null))
+  }
+
+  if (self.url && !self.uri) {
+    // People use this property instead all the time so why not just support it.
+    self.uri = self.url
+    delete self.url
+  }
+
+  if (!self.uri) {
+    // this will throw if unhandled but is handleable when in a redirect
+    return self.emit('error', new Error("options.uri is a required argument"))
+  } else {
+    if (typeof self.uri == "string") self.uri = url.parse(self.uri)
+  }
+
+  if (self.strictSSL === false) {
+    self.rejectUnauthorized = false
+  }
+
+  if (self.proxy) {
+    if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)
+
+    // do the HTTP CONNECT dance using koichik/node-tunnel
+    if (http.globalAgent && self.uri.protocol === "https:") {
+      var tunnelFn = self.proxy.protocol === "http:"
+                   ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
+
+      var tunnelOptions = { proxy: { host: self.proxy.hostname
+                                   , port: +self.proxy.port
+                                   , proxyAuth: self.proxy.auth
+                                   , headers: { Host: self.uri.hostname + ':' +
+                                        (self.uri.port || self.uri.protocol === 'https:' ? 443 : 80) }}
+                          , rejectUnauthorized: self.rejectUnauthorized
+                          , ca: this.ca }
+
+      self.agent = tunnelFn(tunnelOptions)
+      self.tunnel = true
+    }
+  }
+
+  if (!self.uri.pathname) {self.uri.pathname = '/'}
+
+  if (!self.uri.host) {
+    // Invalid URI: it may generate lot of bad errors, like "TypeError: Cannot call method 'indexOf' of undefined" in CookieJar
+    // Detect and reject it as soon as possible
+    var faultyUri = url.format(self.uri)
+    var message = 'Invalid URI "' + faultyUri + '"'
+    if (Object.keys(options).length === 0) {
+      // No option ? This can be the sign of a redirect
+      // As this is a case where the user cannot do anything (he didn't call request directly with this URL)
+      // he should be warned that it can be caused by a redirection (can save some hair)
+      message += '. This can be caused by a crappy redirection.'
+    }
+    self.emit('error', new Error(message))
+    return // This error was fatal
+  }
+
+  self._redirectsFollowed = self._redirectsFollowed || 0
+  self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10
+  self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true
+  self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false
+  if (self.followRedirect || self.followAllRedirects)
+    self.redirects = self.redirects || []
+
+  self.headers = self.headers ? copy(self.headers) : {}
+
+  self.setHost = false
+  if (!self.hasHeader('host')) {
+    self.setHeader('host', self.uri.hostname)
+    if (self.uri.port) {
+      if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') &&
+           !(self.uri.port === 443 && self.uri.protocol === 'https:') )
+      self.setHeader('host', self.getHeader('host') + (':'+self.uri.port) )
+    }
+    self.setHost = true
+  }
+
+  self.jar(self._jar || options.jar)
+
+  if (!self.uri.port) {
+    if (self.uri.protocol == 'http:') {self.uri.port = 80}
+    else if (self.uri.protocol == 'https:') {self.uri.port = 443}
+  }
+
+  if (self.proxy && !self.tunnel) {
+    self.port = self.proxy.port
+    self.host = self.proxy.hostname
+  } else {
+    self.port = self.uri.port
+    self.host = self.uri.hostname
+  }
+
+  self.clientErrorHandler = function (error) {
+    if (self._aborted) return
+
+    if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET'
+        && self.agent.addRequestNoreuse) {
+      self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) }
+      self.start()
+      self.req.end()
+      return
+    }
+    if (self.timeout && self.timeoutTimer) {
+      clearTimeout(self.timeoutTimer)
+      self.timeoutTimer = null
+    }
+    self.emit('error', error)
+  }
+
+  self._parserErrorHandler = function (error) {
+    if (this.res) {
+      if (this.res.request) {
+        this.res.request.emit('error', error)
+      } else {
+        this.res.emit('error', error)
+      }
+    } else {
+      this._httpMessage.emit('error', error)
+    }
+  }
+
+  if (options.form) {
+    self.form(options.form)
+  }
+
+  if (options.qs) self.qs(options.qs)
+
+  if (self.uri.path) {
+    self.path = self.uri.path
+  } else {
+    self.path = self.uri.pathname + (self.uri.search || "")
+  }
+
+  if (self.path.length === 0) self.path = '/'
+
+
+  // Auth must happen last in case signing is dependent on other headers
+  if (options.oauth) {
+    self.oauth(options.oauth)
+  }
+
+  if (options.aws) {
+    self.aws(options.aws)
+  }
+
+  if (options.hawk) {
+    self.hawk(options.hawk)
+  }
+
+  if (options.httpSignature) {
+    self.httpSignature(options.httpSignature)
+  }
+
+  if (options.auth) {
+    self.auth(
+      (options.auth.user==="") ? options.auth.user : (options.auth.user || options.auth.username ),
+      options.auth.pass || options.auth.password,
+      options.auth.sendImmediately)
+  }
+
+  if (self.uri.auth && !self.hasHeader('authorization')) {
+    var authPieces = self.uri.auth.split(':').map(function(item){ return querystring.unescape(item) })
+    self.auth(authPieces[0], authPieces.slice(1).join(':'), true)
+  }
+  if (self.proxy && self.proxy.auth && !self.hasHeader('proxy-authorization') && !self.tunnel) {
+    self.setHeader('proxy-authorization', "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return querystring.unescape(item)}).join(':')))
+  }
+
+
+  if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)
+
+  if (options.json) {
+    self.json(options.json)
+  } else if (options.multipart) {
+    self.boundary = uuid()
+    self.multipart(options.multipart)
+  }
+
+  if (self.body) {
+    var length = 0
+    if (!Buffer.isBuffer(self.body)) {
+      if (Array.isArray(self.body)) {
+        for (var i = 0; i < self.body.length; i++) {
+          length += self.body[i].length
+        }
+      } else {
+        self.body = new Buffer(self.body)
+        length = self.body.length
+      }
+    } else {
+      length = self.body.length
+    }
+    if (length) {
+      if (!self.hasHeader('content-length')) self.setHeader('content-length', length)
+    } else {
+      throw new Error('Argument error, options.body.')
+    }
+  }
+
+  var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol
+    , defaultModules = {'http:':http, 'https:':https}
+    , httpModules = self.httpModules || {}
+    ;
+  self.httpModule = httpModules[protocol] || defaultModules[protocol]
+
+  if (!self.httpModule) return this.emit('error', new Error("Invalid protocol"))
+
+  if (options.ca) self.ca = options.ca
+
+  if (!self.agent) {
+    if (options.agentOptions) self.agentOptions = options.agentOptions
+
+    if (options.agentClass) {
+      self.agentClass = options.agentClass
+    } else if (options.forever) {
+      self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL
+    } else {
+      self.agentClass = self.httpModule.Agent
+    }
+  }
+
+  if (self.pool === false) {
+    self.agent = false
+  } else {
+    self.agent = self.agent || self.getAgent()
+    if (self.maxSockets) {
+      // Don't use our pooling if node has the refactored client
+      self.agent.maxSockets = self.maxSockets
+    }
+    if (self.pool.maxSockets) {
+      // Don't use our pooling if node has the refactored client
+      self.agent.maxSockets = self.pool.maxSockets
+    }
+  }
+
+  self.on('pipe', function (src) {
+    if (self.ntick && self._started) throw new Error("You cannot pipe to this stream after the outbound request has started.")
+    self.src = src
+    if (isReadStream(src)) {
+      if (!self.hasHeader('content-type')) self.setHeader('content-type', mime.lookup(src.path))
+    } else {
+      if (src.headers) {
+        for (var i in src.headers) {
+          if (!self.hasHeader(i)) {
+            self.setHeader(i, src.headers[i])
+          }
+        }
+      }
+      if (self._json && !self.hasHeader('content-type'))
+        self.setHeader('content-type', 'application/json')
+      if (src.method && !self.explicitMethod) {
+        self.method = src.method
+      }
+    }
+
+    // self.on('pipe', function () {
+    //   console.error("You have already piped to this stream. Pipeing twice is likely to break the request.")
+    // })
+  })
+
+  process.nextTick(function () {
+    if (self._aborted) return
+
+    if (self._form) {
+      self.setHeaders(self._form.getHeaders())
+      self._form.pipe(self)
+    }
+    if (self.body) {
+      if (Array.isArray(self.body)) {
+        self.body.forEach(function (part) {
+          self.write(part)
+        })
+      } else {
+        self.write(self.body)
+      }
+      self.end()
+    } else if (self.requestBodyStream) {
+      console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.")
+      self.requestBodyStream.pipe(self)
+    } else if (!self.src) {
+      if (self.method !== 'GET' && typeof self.method !== 'undefined') {
+        self.setHeader('content-length', 0)
+      }
+      self.end()
+    }
+    self.ntick = true
+  })
+}
+
+// Must call this when following a redirect from https to http or vice versa
+// Attempts to keep everything as identical as possible, but update the
+// httpModule, Tunneling agent, and/or Forever Agent in use.
+Request.prototype._updateProtocol = function () {
+  var self = this
+  var protocol = self.uri.protocol
+
+  if (protocol === 'https:') {
+    // previously was doing http, now doing https
+    // if it's https, then we might need to tunnel now.
+    if (self.proxy) {
+      self.tunnel = true
+      var tunnelFn = self.proxy.protocol === 'http:'
+                   ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
+      var tunnelOptions = { proxy: { host: self.proxy.hostname
+                                   , port: +self.proxy.port
+                                   , proxyAuth: self.proxy.auth }
+                          , rejectUnauthorized: self.rejectUnauthorized
+                          , ca: self.ca }
+      self.agent = tunnelFn(tunnelOptions)
+      return
+    }
+
+    self.httpModule = https
+    switch (self.agentClass) {
+      case ForeverAgent:
+        self.agentClass = ForeverAgent.SSL
+        break
+      case http.Agent:
+        self.agentClass = https.Agent
+        break
+      default:
+        // nothing we can do.  Just hope for the best.
+        return
+    }
+
+    // if there's an agent, we need to get a new one.
+    if (self.agent) self.agent = self.getAgent()
+
+  } else {
+    // previously was doing https, now doing http
+    // stop any tunneling.
+    if (self.tunnel) self.tunnel = false
+    self.httpModule = http
+    switch (self.agentClass) {
+      case ForeverAgent.SSL:
+        self.agentClass = ForeverAgent
+        break
+      case https.Agent:
+        self.agentClass = http.Agent
+        break
+      default:
+        // nothing we can do.  just hope for the best
+        return
+    }
+
+    // if there's an agent, then get a new one.
+    if (self.agent) {
+      self.agent = null
+      self.agent = self.getAgent()
+    }
+  }
+}
+
+Request.prototype.getAgent = function () {
+  var Agent = this.agentClass
+  var options = {}
+  if (this.agentOptions) {
+    for (var i in this.agentOptions) {
+      options[i] = this.agentOptions[i]
+    }
+  }
+  if (this.ca) options.ca = this.ca
+  if (typeof this.rejectUnauthorized !== 'undefined') options.rejectUnauthorized = this.rejectUnauthorized
+
+  if (this.cert && this.key) {
+    options.key = this.key
+    options.cert = this.cert
+  }
+
+  var poolKey = ''
+
+  // different types of agents are in different pools
+  if (Agent !== this.httpModule.Agent) {
+    poolKey += Agent.name
+  }
+
+  if (!this.httpModule.globalAgent) {
+    // node 0.4.x
+    options.host = this.host
+    options.port = this.port
+    if (poolKey) poolKey += ':'
+    poolKey += this.host + ':' + this.port
+  }
+
+  // ca option is only relevant if proxy or destination are https
+  var proxy = this.proxy
+  if (typeof proxy === 'string') proxy = url.parse(proxy)
+  var isHttps = (proxy && proxy.protocol === 'https:') || this.uri.protocol === 'https:'
+  if (isHttps) {
+    if (options.ca) {
+      if (poolKey) poolKey += ':'
+      poolKey += options.ca
+    }
+
+    if (typeof options.rejectUnauthorized !== 'undefined') {
+      if (poolKey) poolKey += ':'
+      poolKey += options.rejectUnauthorized
+    }
+
+    if (options.cert)
+      poolKey += options.cert.toString('ascii') + options.key.toString('ascii')
+
+    if (options.ciphers) {
+      if (poolKey) poolKey += ':'
+      poolKey += options.ciphers
+    }
+
+    if (options.secureOptions) {
+      if (poolKey) poolKey += ':'
+      poolKey += options.secureOptions
+    }
+  }
+
+  if (this.pool === globalPool && !poolKey && Object.keys(options).length === 0 && this.httpModule.globalAgent) {
+    // not doing anything special.  Use the globalAgent
+    return this.httpModule.globalAgent
+  }
+
+  // we're using a stored agent.  Make sure it's protocol-specific
+  poolKey = this.uri.protocol + poolKey
+
+  // already generated an agent for this setting
+  if (this.pool[poolKey]) return this.pool[poolKey]
+
+  return this.pool[poolKey] = new Agent(options)
+}
+
+Request.prototype.start = function () {
+  // start() is called once we are ready to send the outgoing HTTP request.
+  // this is usually called on the first write(), end() or on nextTick()
+  var self = this
+
+  if (self._aborted) return
+
+  self._started = true
+  self.method = self.method || 'GET'
+  self.href = self.uri.href
+
+  if (self.src && self.src.stat && self.src.stat.size && !self.hasHeader('content-length')) {
+    self.setHeader('content-length', self.src.stat.size)
+  }
+  if (self._aws) {
+    self.aws(self._aws, true)
+  }
+
+  // We have a method named auth, which is completely different from the http.request
+  // auth option.  If we don't remove it, we're gonna have a bad time.
+  var reqOptions = copy(self)
+  delete reqOptions.auth
+
+  debug('make request', self.uri.href)
+  self.req = self.httpModule.request(reqOptions, self.onResponse.bind(self))
+
+  if (self.timeout && !self.timeoutTimer) {
+    self.timeoutTimer = setTimeout(function () {
+      self.req.abort()
+      var e = new Error("ETIMEDOUT")
+      e.code = "ETIMEDOUT"
+      self.emit("error", e)
+    }, self.timeout)
+
+    // Set additional timeout on socket - in case if remote
+    // server freeze after sending headers
+    if (self.req.setTimeout) { // only works on node 0.6+
+      self.req.setTimeout(self.timeout, function () {
+        if (self.req) {
+          self.req.abort()
+          var e = new Error("ESOCKETTIMEDOUT")
+          e.code = "ESOCKETTIMEDOUT"
+          self.emit("error", e)
+        }
+      })
+    }
+  }
+
+  self.req.on('error', self.clientErrorHandler)
+  self.req.on('drain', function() {
+    self.emit('drain')
+  })
+  self.on('end', function() {
+    if ( self.req.connection ) self.req.connection.removeListener('error', self._parserErrorHandler)
+  })
+  self.emit('request', self.req)
+}
+Request.prototype.onResponse = function (response) {
+  var self = this
+  debug('onResponse', self.uri.href, response.statusCode, response.headers)
+  response.on('end', function() {
+    debug('response end', self.uri.href, response.statusCode, response.headers)
+  });
+
+  if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
+    response.connection.once('error', self._parserErrorHandler)
+  }
+  if (self._aborted) {
+    debug('aborted', self.uri.href)
+    response.resume()
+    return
+  }
+  if (self._paused) response.pause()
+  else response.resume()
+
+  self.response = response
+  response.request = self
+  response.toJSON = toJSON
+
+  // XXX This is different on 0.10, because SSL is strict by default
+  if (self.httpModule === https &&
+      self.strictSSL &&
+      !response.client.authorized) {
+    debug('strict ssl error', self.uri.href)
+    var sslErr = response.client.authorizationError
+    self.emit('error', new Error('SSL Error: '+ sslErr))
+    return
+  }
+
+  if (self.setHost && self.hasHeader('host')) delete self.headers[self.hasHeader('host')]
+  if (self.timeout && self.timeoutTimer) {
+    clearTimeout(self.timeoutTimer)
+    self.timeoutTimer = null
+  }
+
+  var addCookie = function (cookie) {
+    if (self._jar){
+      if(self._jar.add){
+        self._jar.add(new Cookie(cookie))
+      }
+      else cookieJar.add(new Cookie(cookie))
+    }
+
+  }
+
+  if (hasHeader('set-cookie', response.headers) && (!self._disableCookies)) {
+    var headerName = hasHeader('set-cookie', response.headers)
+    if (Array.isArray(response.headers[headerName])) response.headers[headerName].forEach(addCookie)
+    else addCookie(response.headers[headerName])
+  }
+
+  var redirectTo = null
+  if (response.statusCode >= 300 && response.statusCode < 400 && hasHeader('location', response.headers)) {
+    var location = response.headers[hasHeader('location', response.headers)]
+    debug('redirect', location)
+
+    if (self.followAllRedirects) {
+      redirectTo = location
+    } else if (self.followRedirect) {
+      switch (self.method) {
+        case 'PATCH':
+        case 'PUT':
+        case 'POST':
+        case 'DELETE':
+          // Do not follow redirects
+          break
+        default:
+          redirectTo = location
+          break
+      }
+    }
+  } else if (response.statusCode == 401 && self._hasAuth && !self._sentAuth) {
+    var authHeader = response.headers[hasHeader('www-authenticate', response.headers)]
+    var authVerb = authHeader && authHeader.split(' ')[0]
+    debug('reauth', authVerb)
+
+    switch (authVerb) {
+      case 'Basic':
+        self.auth(self._user, self._pass, true)
+        redirectTo = self.uri
+        break
+
+      case 'Digest':
+        // TODO: More complete implementation of RFC 2617.  For reference:
+        // http://tools.ietf.org/html/rfc2617#section-3
+        // https://github.com/bagder/curl/blob/master/lib/http_digest.c
+
+        var matches = authHeader.match(/([a-z0-9_-]+)="([^"]+)"/gi)
+        var challenge = {}
+
+        for (var i = 0; i < matches.length; i++) {
+          var eqPos = matches[i].indexOf('=')
+          var key = matches[i].substring(0, eqPos)
+          var quotedValue = matches[i].substring(eqPos + 1)
+          challenge[key] = quotedValue.substring(1, quotedValue.length - 1)
+        }
+
+        var ha1 = md5(self._user + ':' + challenge.realm + ':' + self._pass)
+        var ha2 = md5(self.method + ':' + self.uri.path)
+        var digestResponse = md5(ha1 + ':' + challenge.nonce + ':1::auth:' + ha2)
+        var authValues = {
+          username: self._user,
+          realm: challenge.realm,
+          nonce: challenge.nonce,
+          uri: self.uri.path,
+          qop: challenge.qop,
+          response: digestResponse,
+          nc: 1,
+          cnonce: ''
+        }
+
+        authHeader = []
+        for (var k in authValues) {
+          authHeader.push(k + '="' + authValues[k] + '"')
+        }
+        authHeader = 'Digest ' + authHeader.join(', ')
+        self.setHeader('authorization', authHeader)
+        self._sentAuth = true
+
+        redirectTo = self.uri
+        break
+    }
+  }
+
+  if (redirectTo) {
+    debug('redirect to', redirectTo)
+
+    // ignore any potential response body.  it cannot possibly be useful
+    // to us at this point.
+    if (self._paused) response.resume()
+
+    if (self._redirectsFollowed >= self.maxRedirects) {
+      self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+self.uri.href))
+      return
+    }
+    self._redirectsFollowed += 1
+
+    if (!isUrl.test(redirectTo)) {
+      redirectTo = url.resolve(self.uri.href, redirectTo)
+    }
+
+    var uriPrev = self.uri
+    self.uri = url.parse(redirectTo)
+
+    // handle the case where we change protocol from https to http or vice versa
+    if (self.uri.protocol !== uriPrev.protocol) {
+      self._updateProtocol()
+    }
+
+    self.redirects.push(
+      { statusCode : response.statusCode
+      , redirectUri: redirectTo
+      }
+    )
+    if (self.followAllRedirects && response.statusCode != 401) self.method = 'GET'
+    // self.method = 'GET' // Force all redirects to use GET || commented out fixes #215
+    delete self.src
+    delete self.req
+    delete self.agent
+    delete self._started
+    if (response.statusCode != 401) {
+      // Remove parameters from the previous response, unless this is the second request
+      // for a server that requires digest authentication.
+      delete self.body
+      delete self._form
+      if (self.headers) {
+        if (self.hasHeader('host')) delete self.headers[self.hasHeader('host')]
+        if (self.hasHeader('content-type')) delete self.headers[self.hasHeader('content-type')]
+        if (self.hasHeader('content-length')) delete self.headers[self.hasHeader('content-length')]
+      }
+    }
+
+    self.emit('redirect');
+
+    self.init()
+    return // Ignore the rest of the response
+  } else {
+    self._redirectsFollowed = self._redirectsFollowed || 0
+    // Be a good stream and emit end when the response is finished.
+    // Hack to emit end on close because of a core bug that never fires end
+    response.on('close', function () {
+      if (!self._ended) self.response.emit('end')
+    })
+
+    if (self.encoding) {
+      if (self.dests.length !== 0) {
+        console.error("Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.")
+      } else {
+        response.setEncoding(self.encoding)
+      }
+    }
+
+    self.emit('response', response)
+
+    self.dests.forEach(function (dest) {
+      self.pipeDest(dest)
+    })
+
+    response.on("data", function (chunk) {
+      self._destdata = true
+      self.emit("data", chunk)
+    })
+    response.on("end", function (chunk) {
+      self._ended = true
+      self.emit("end", chunk)
+    })
+    response.on("close", function () {self.emit("close")})
+
+    if (self.callback) {
+      var buffer = []
+      var bodyLen = 0
+      self.on("data", function (chunk) {
+        buffer.push(chunk)
+        bodyLen += chunk.length
+      })
+      self.on("end", function () {
+        debug('end event', self.uri.href)
+        if (self._aborted) {
+          debug('aborted', self.uri.href)
+          return
+        }
+
+        if (buffer.length && Buffer.isBuffer(buffer[0])) {
+          debug('has body', self.uri.href, bodyLen)
+          var body = new Buffer(bodyLen)
+          var i = 0
+          buffer.forEach(function (chunk) {
+            chunk.copy(body, i, 0, chunk.length)
+            i += chunk.length
+          })
+          if (self.encoding === null) {
+            response.body = body
+          } else {
+            response.body = body.toString(self.encoding)
+          }
+        } else if (buffer.length) {
+          // The UTF8 BOM [0xEF,0xBB,0xBF] is converted to [0xFE,0xFF] in the JS UTC16/UCS2 representation.
+          // Strip this value out when the encoding is set to 'utf8', as upstream consumers won't expect it and it breaks JSON.parse().
+          if (self.encoding === 'utf8' && buffer[0].length > 0 && buffer[0][0] === "\uFEFF") {
+            buffer[0] = buffer[0].substring(1)
+          }
+          response.body = buffer.join('')
+        }
+
+        if (self._json) {
+          try {
+            response.body = JSON.parse(response.body)
+          } catch (e) {}
+        }
+        debug('emitting complete', self.uri.href)
+        if(response.body == undefined && !self._json) {
+          response.body = "";
+        }
+        self.emit('complete', response, response.body)
+      })
+    }
+    //if no callback
+    else{
+      self.on("end", function () {
+        if (self._aborted) {
+          debug('aborted', self.uri.href)
+          return
+        }
+        self.emit('complete', response);
+      });
+    }
+  }
+  debug('finish init function', self.uri.href)
+}
+
+Request.prototype.abort = function () {
+  this._aborted = true
+
+  if (this.req) {
+    this.req.abort()
+  }
+  else if (this.response) {
+    this.response.abort()
+  }
+
+  this.emit("abort")
+}
+
+Request.prototype.pipeDest = function (dest) {
+  var response = this.response
+  // Called after the response is received
+  if (dest.headers && !dest.headersSent) {
+    if (hasHeader('content-type', response.headers)) {
+      var ctname = hasHeader('content-type', response.headers)
+      if (dest.setHeader) dest.setHeader(ctname, response.headers[ctname])
+      else dest.headers[ctname] = response.headers[ctname]
+    }
+
+    if (hasHeader('content-length', response.headers)) {
+      var clname = hasHeader('content-length', response.headers)
+      if (dest.setHeader) dest.setHeader(clname, response.headers[clname])
+      else dest.headers[clname] = response.headers[clname]
+    }
+  }
+  if (dest.setHeader && !dest.headersSent) {
+    for (var i in response.headers) {
+      dest.setHeader(i, response.headers[i])
+    }
+    dest.statusCode = response.statusCode
+  }
+  if (this.pipefilter) this.pipefilter(response, dest)
+}
+
+// Composable API
+Request.prototype.setHeader = function (name, value, clobber) {
+  if (clobber === undefined) clobber = true
+  if (clobber || !this.hasHeader(name)) this.headers[name] = value
+  else this.headers[this.hasHeader(name)] += ',' + value
+  return this
+}
+Request.prototype.setHeaders = function (headers) {
+  for (var i in headers) {this.setHeader(i, headers[i])}
+  return this
+}
+Request.prototype.hasHeader = function (header, headers) {
+  var headers = Object.keys(headers || this.headers)
+    , lheaders = headers.map(function (h) {return h.toLowerCase()})
+    ;
+  header = header.toLowerCase()
+  for (var i=0;i<lheaders.length;i++) {
+    if (lheaders[i] === header) return headers[i]
+  }
+  return false
+}
+
+var hasHeader = Request.prototype.hasHeader
+
+Request.prototype.qs = function (q, clobber) {
+  var base
+  if (!clobber && this.uri.query) base = qs.parse(this.uri.query)
+  else base = {}
+
+  for (var i in q) {
+    base[i] = q[i]
+  }
+
+  if (qs.stringify(base) === ''){
+    return this
+  }
+
+  this.uri = url.parse(this.uri.href.split('?')[0] + '?' + qs.stringify(base))
+  this.url = this.uri
+  this.path = this.uri.path
+
+  return this
+}
+Request.prototype.form = function (form) {
+  if (form) {
+    this.setHeader('content-type', 'application/x-www-form-urlencoded; charset=utf-8')
+    this.body = qs.stringify(form).toString('utf8')
+    return this
+  }
+  // create form-data object
+  this._form = new FormData()
+  return this._form
+}
+Request.prototype.multipart = function (multipart) {
+  var self = this
+  self.body = []
+
+  if (!self.hasHeader('content-type')) {
+    self.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
+  } else {
+    self.setHeader('content-type', self.headers['content-type'].split(';')[0] + '; boundary=' + self.boundary)
+  }
+
+  if (!multipart.forEach) throw new Error('Argument error, options.multipart.')
+
+  if (self.preambleCRLF) {
+    self.body.push(new Buffer('\r\n'))
+  }
+
+  multipart.forEach(function (part) {
+    var body = part.body
+    if(body == null) throw Error('Body attribute missing in multipart.')
+    delete part.body
+    var preamble = '--' + self.boundary + '\r\n'
+    Object.keys(part).forEach(function (key) {
+      preamble += key + ': ' + part[key] + '\r\n'
+    })
+    preamble += '\r\n'
+    self.body.push(new Buffer(preamble))
+    self.body.push(new Buffer(body))
+    self.body.push(new Buffer('\r\n'))
+  })
+  self.body.push(new Buffer('--' + self.boundary + '--'))
+  return self
+}
+Request.prototype.json = function (val) {
+  var self = this
+
+  if (!self.hasHeader('accept')) self.setHeader('accept', 'application/json')
+
+  this._json = true
+  if (typeof val === 'boolean') {
+    if (typeof this.body === 'object') {
+      this.body = safeStringify(this.body)
+      self.setHeader('content-type', 'application/json')
+    }
+  } else {
+    this.body = safeStringify(val)
+    self.setHeader('content-type', 'application/json')
+  }
+  return this
+}
+Request.prototype.getHeader = function (name, headers) {
+  var result, re, match
+  if (!headers) headers = this.headers
+  Object.keys(headers).forEach(function (key) {
+    re = new RegExp(name, 'i')
+    match = key.match(re)
+    if (match) result = headers[key]
+  })
+  return result
+}
+var getHeader = Request.prototype.getHeader
+
+Request.prototype.auth = function (user, pass, sendImmediately) {
+  if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
+    throw new Error('auth() received invalid user or password')
+  }
+  this._user = user
+  this._pass = pass
+  this._hasAuth = true
+  var header = typeof pass !== 'undefined' ? user + ':' + pass : user
+  if (sendImmediately || typeof sendImmediately == 'undefined') {
+    this.setHeader('authorization', 'Basic ' + toBase64(header))
+    this._sentAuth = true
+  }
+  return this
+}
+Request.prototype.aws = function (opts, now) {
+  if (!now) {
+    this._aws = opts
+    return this
+  }
+  var date = new Date()
+  this.setHeader('date', date.toUTCString())
+  var auth =
+    { key: opts.key
+    , secret: opts.secret
+    , verb: this.method.toUpperCase()
+    , date: date
+    , contentType: this.getHeader('content-type') || ''
+    , md5: this.getHeader('content-md5') || ''
+    , amazonHeaders: aws.canonicalizeHeaders(this.headers)
+    }
+  if (opts.bucket && this.path) {
+    auth.resource = '/' + opts.bucket + this.path
+  } else if (opts.bucket && !this.path) {
+    auth.resource = '/' + opts.bucket
+  } else if (!opts.bucket && this.path) {
+    auth.resource = this.path
+  } else if (!opts.bucket && !this.path) {
+    auth.resource = '/'
+  }
+  auth.resource = aws.canonicalizeResource(auth.resource)
+  this.setHeader('authorization', aws.authorization(auth))
+
+  return this
+}
+Request.prototype.httpSignature = function (opts) {
+  var req = this
+  httpSignature.signRequest({
+    getHeader: function(header) {
+      return getHeader(header, req.headers)
+    },
+    setHeader: function(header, value) {
+      req.setHeader(header, value)
+    },
+    method: this.method,
+    path: this.path
+  }, opts)
+  debug('httpSignature authorization', this.getHeader('authorization'))
+
+  return this
+}
+
+Request.prototype.hawk = function (opts) {
+  this.setHeader('Authorization', hawk.client.header(this.uri, this.method, opts).field)
+}
+
+Request.prototype.oauth = function (_oauth) {
+  var form
+  if (this.hasHeader('content-type') &&
+      this.getHeader('content-type').slice(0, 'application/x-www-form-urlencoded'.length) ===
+        'application/x-www-form-urlencoded'
+     ) {
+    form = qs.parse(this.body)
+  }
+  if (this.uri.query) {
+    form = qs.parse(this.uri.query)
+  }
+  if (!form) form = {}
+  var oa = {}
+  for (var i in form) oa[i] = form[i]
+  for (var i in _oauth) oa['oauth_'+i] = _oauth[i]
+  if (!oa.oauth_version) oa.oauth_version = '1.0'
+  if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString()
+  if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '')
+
+  oa.oauth_signature_method = 'HMAC-SHA1'
+
+  var consumer_secret = oa.oauth_consumer_secret
+  delete oa.oauth_consumer_secret
+  var token_secret = oa.oauth_token_secret
+  delete oa.oauth_token_secret
+  var timestamp = oa.oauth_timestamp
+
+  var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname
+  var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret)
+
+  // oa.oauth_signature = signature
+  for (var i in form) {
+    if ( i.slice(0, 'oauth_') in _oauth) {
+      // skip
+    } else {
+      delete oa['oauth_'+i]
+      if (i !== 'x_auth_mode') delete oa[i]
+    }
+  }
+  oa.oauth_timestamp = timestamp
+  var authHeader = 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',')
+  authHeader += ',oauth_signature="' + oauth.rfc3986(signature) + '"'
+  this.setHeader('Authorization', authHeader)
+  return this
+}
+Request.prototype.jar = function (jar) {
+  var cookies
+
+  if (this._redirectsFollowed === 0) {
+    this.originalCookieHeader = this.getHeader('cookie')
+  }
+
+  if (!jar) {
+    // disable cookies
+    cookies = false
+    this._disableCookies = true
+  } else if (jar && jar.get) {
+    // fetch cookie from the user defined cookie jar
+    cookies = jar.get({ url: this.uri.href })
+  } else {
+    // fetch cookie from the global cookie jar
+    cookies = cookieJar.get({ url: this.uri.href })
+  }
+
+  if (cookies && cookies.length) {
+    var cookieString = cookies.map(function (c) {
+      return c.name + "=" + c.value
+    }).join("; ")
+
+    if (this.originalCookieHeader) {
+      // Don't overwrite existing Cookie header
+      this.setHeader('cookie', this.originalCookieHeader + '; ' + cookieString)
+    } else {
+      this.setHeader('cookie', cookieString)
+    }
+  }
+  this._jar = jar
+  return this
+}
+
+
+// Stream API
+Request.prototype.pipe = function (dest, opts) {
+  if (this.response) {
+    if (this._destdata) {
+      throw new Error("You cannot pipe after data has been emitted from the response.")
+    } else if (this._ended) {
+      throw new Error("You cannot pipe after the response has been ended.")
+    } else {
+      stream.Stream.prototype.pipe.call(this, dest, opts)
+      this.pipeDest(dest)
+      return dest
+    }
+  } else {
+    this.dests.push(dest)
+    stream.Stream.prototype.pipe.call(this, dest, opts)
+    return dest
+  }
+}
+Request.prototype.write = function () {
+  if (!this._started) this.start()
+  return this.req.write.apply(this.req, arguments)
+}
+Request.prototype.end = function (chunk) {
+  if (chunk) this.write(chunk)
+  if (!this._started) this.start()
+  this.req.end()
+}
+Request.prototype.pause = function () {
+  if (!this.response) this._paused = true
+  else this.response.pause.apply(this.response, arguments)
+}
+Request.prototype.resume = function () {
+  if (!this.response) this._paused = false
+  else this.response.resume.apply(this.response, arguments)
+}
+Request.prototype.destroy = function () {
+  if (!this._ended) this.end()
+  else if (this.response) this.response.destroy()
+}
+
+function toJSON () {
+  return getSafe(this, '__' + (((1+Math.random())*0x10000)|0).toString(16))
+}
+
+Request.prototype.toJSON = toJSON
+
+
+module.exports = Request
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/googledoodle.jpg b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/googledoodle.jpg
new file mode 100755 (executable)
index 0000000..f80c9c5
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/googledoodle.jpg differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/run.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/run.js
new file mode 100755 (executable)
index 0000000..e717f02
--- /dev/null
@@ -0,0 +1,40 @@
+var spawn = require('child_process').spawn
+  , exitCode = 0
+  , timeout = 10000
+  , fs = require('fs')
+  ;
+
+fs.readdir(__dirname, function (e, files) {
+  if (e) throw e
+
+  var tests = files.filter(function (f) {return f.slice(0, 'test-'.length) === 'test-'})
+
+  var next = function () {
+    if (tests.length === 0) process.exit(exitCode);
+
+    var file = tests.shift()
+    console.log(file)
+    var proc = spawn('node', [ 'tests/' + file ])
+
+    var killed = false
+    var t = setTimeout(function () {
+      proc.kill()
+      exitCode += 1
+      console.error(file + ' timeout')
+      killed = true
+    }, timeout)
+
+    proc.stdout.pipe(process.stdout)
+    proc.stderr.pipe(process.stderr)
+    proc.on('exit', function (code) {
+      if (code && !killed) console.error(file + ' failed')
+      exitCode += code || 0
+      clearTimeout(t)
+      next()
+    })
+  }
+  next()
+    
+})
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/server.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/server.js
new file mode 100755 (executable)
index 0000000..b6eacba
--- /dev/null
@@ -0,0 +1,90 @@
+var fs = require('fs')
+  , http = require('http')
+  , path = require('path')
+  , https = require('https')
+  , events = require('events')
+  , stream = require('stream')
+  , assert = require('assert')
+  ;
+
+exports.createServer =  function (port) {
+  port = port || 6767
+  var s = http.createServer(function (req, resp) {
+    s.emit(req.url, req, resp);
+  })
+  s.port = port
+  s.url = 'http://localhost:'+port
+  return s;
+}
+
+exports.createSSLServer = function(port, opts) {
+  port = port || 16767
+
+  var options = { 'key' : path.join(__dirname, 'ssl', 'test.key')
+                , 'cert': path.join(__dirname, 'ssl', 'test.crt')
+                }
+  if (opts) {
+    for (var i in opts) options[i] = opts[i]
+  }
+
+  for (var i in options) {
+    options[i] = fs.readFileSync(options[i])
+  }
+
+  var s = https.createServer(options, function (req, resp) {
+    s.emit(req.url, req, resp);
+  })
+  s.port = port
+  s.url = 'https://localhost:'+port
+  return s;
+}
+
+exports.createPostStream = function (text) {
+  var postStream = new stream.Stream();
+  postStream.writeable = true;
+  postStream.readable = true;
+  setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0);
+  return postStream;
+}
+exports.createPostValidator = function (text, reqContentType) {
+  var l = function (req, resp) {
+    var r = '';
+    req.on('data', function (chunk) {r += chunk})
+    req.on('end', function () {
+      if (req.headers['content-type'] && req.headers['content-type'].indexOf('boundary=') >= 0) {
+        var boundary = req.headers['content-type'].split('boundary=')[1];
+        text = text.replace(/__BOUNDARY__/g, boundary);
+      }
+      if (r !== text) console.log(r, text);
+      assert.equal(r, text)
+      if (reqContentType) {
+        assert.ok(req.headers['content-type'])
+        assert.ok(~req.headers['content-type'].indexOf(reqContentType))
+      }
+      resp.writeHead(200, {'content-type':'text/plain'})
+      resp.write('OK')
+      resp.end()
+    })
+  }
+  return l;
+}
+exports.createGetResponse = function (text, contentType) {
+  var l = function (req, resp) {
+    contentType = contentType || 'text/plain'
+    resp.writeHead(200, {'content-type':contentType})
+    resp.write(text)
+    resp.end()
+  }
+  return l;
+}
+exports.createChunkResponse = function (chunks, contentType) {
+  var l = function (req, resp) {
+    contentType = contentType || 'text/plain'
+    resp.writeHead(200, {'content-type':contentType})
+    chunks.forEach(function (chunk) {
+      resp.write(chunk)
+    })
+    resp.end()
+  }
+  return l;
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/squid.conf b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/squid.conf
new file mode 100755 (executable)
index 0000000..0d4a3b6
--- /dev/null
@@ -0,0 +1,77 @@
+#
+# Recommended minimum configuration:
+#
+acl manager proto cache_object
+acl localhost src 127.0.0.1/32 ::1
+acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
+
+# Example rule allowing access from your local networks.
+# Adapt to list your (internal) IP networks from where browsing
+# should be allowed
+acl localnet src 10.0.0.0/8    # RFC1918 possible internal network
+acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
+acl localnet src 192.168.0.0/16        # RFC1918 possible internal network
+acl localnet src fc00::/7       # RFC 4193 local private network range
+acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
+
+acl SSL_ports port 443
+acl Safe_ports port 80         # http
+acl Safe_ports port 21         # ftp
+acl Safe_ports port 443                # https
+acl Safe_ports port 70         # gopher
+acl Safe_ports port 210                # wais
+acl Safe_ports port 1025-65535 # unregistered ports
+acl Safe_ports port 280                # http-mgmt
+acl Safe_ports port 488                # gss-http
+acl Safe_ports port 591                # filemaker
+acl Safe_ports port 777                # multiling http
+acl CONNECT method CONNECT
+
+#
+# Recommended minimum Access Permission configuration:
+#
+# Only allow cachemgr access from localhost
+http_access allow manager localhost
+http_access deny manager
+
+# Deny requests to certain unsafe ports
+http_access deny !Safe_ports
+
+# Deny CONNECT to other than secure SSL ports
+#http_access deny CONNECT !SSL_ports
+
+# We strongly recommend the following be uncommented to protect innocent
+# web applications running on the proxy server who think the only
+# one who can access services on "localhost" is a local user
+#http_access deny to_localhost
+
+#
+# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
+#
+
+# Example rule allowing access from your local networks.
+# Adapt localnet in the ACL section to list your (internal) IP networks
+# from where browsing should be allowed
+http_access allow localnet
+http_access allow localhost
+
+# And finally deny all other access to this proxy
+http_access deny all
+
+# Squid normally listens to port 3128
+http_port 3128
+
+# We recommend you to use at least the following line.
+hierarchy_stoplist cgi-bin ?
+
+# Uncomment and adjust the following to add a disk cache directory.
+#cache_dir ufs /usr/local/var/cache 100 16 256
+
+# Leave coredumps in the first cache dir
+coredump_dir /usr/local/var/cache
+
+# Add any of your own refresh_pattern entries above these.
+refresh_pattern ^ftp:          1440    20%     10080
+refresh_pattern ^gopher:       1440    0%      1440
+refresh_pattern -i (/cgi-bin/|\?) 0    0%      0
+refresh_pattern .              0       20%     4320
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.cnf b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.cnf
new file mode 100755 (executable)
index 0000000..425a889
--- /dev/null
@@ -0,0 +1,20 @@
+[ req ]
+default_bits           = 1024
+days                   = 3650
+distinguished_name     = req_distinguished_name
+attributes             = req_attributes
+prompt                 = no
+output_password        = password
+
+[ req_distinguished_name ]
+C                      = US
+ST                     = CA
+L                      = Oakland
+O                      = request
+OU                     = request Certificate Authority
+CN                     = requestCA
+emailAddress           = mikeal@mikealrogers.com
+
+[ req_attributes ]
+challengePassword              = password challenge
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.crl b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.crl
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.crt b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.crt
new file mode 100755 (executable)
index 0000000..b4524e4
--- /dev/null
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC
+VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1
+ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG
+A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n
+ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD
+VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT
+B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
+MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl
+YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4
+5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ
+5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD
+xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB
+ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm
+D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo
+88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj
+-----END CERTIFICATE-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.csr b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.csr
new file mode 100755 (executable)
index 0000000..e48c56e
--- /dev/null
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE
+BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD
+ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG
+SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB
+BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0
+deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br
+44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB
+AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3
+DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj
+bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia
+SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X
+-----END CERTIFICATE REQUEST-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.key b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.key
new file mode 100755 (executable)
index 0000000..a53e7f7
--- /dev/null
@@ -0,0 +1,18 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,C8B5887048377F02
+
+nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q
+nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+
+GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH
+gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38
+VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3
+/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb
+4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U
+gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR
+Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh
+FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf
+dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC
+uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb
+EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w==
+-----END RSA PRIVATE KEY-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.srl b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/ca.srl
new file mode 100755 (executable)
index 0000000..17128db
--- /dev/null
@@ -0,0 +1 @@
+ADF62016AA40C9C3
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.cnf b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.cnf
new file mode 100755 (executable)
index 0000000..cd1fd1e
--- /dev/null
@@ -0,0 +1,19 @@
+[ req ]
+default_bits           = 1024
+days                   = 3650
+distinguished_name     = req_distinguished_name
+attributes             = req_attributes
+prompt                 = no
+
+[ req_distinguished_name ]
+C                      = US
+ST                     = CA
+L                      = Oakland
+O                      = request
+OU                     = testing
+CN                     = testing.request.mikealrogers.com
+emailAddress           = mikeal@mikealrogers.com
+
+[ req_attributes ]
+challengePassword              = password challenge
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.crt b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.crt
new file mode 100755 (executable)
index 0000000..efe96ce
--- /dev/null
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC
+VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1
+ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG
+A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n
+ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD
+VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT
+B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx
+dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr
+ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM
+20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh
+DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj
+7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB
+kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC
+yapjN3RxZbInGhWR+jA=
+-----END CERTIFICATE-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.csr b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.csr
new file mode 100755 (executable)
index 0000000..a8e7595
--- /dev/null
@@ -0,0 +1,11 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE
+BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp
+MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq
+hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB
+BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg
+cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU
+ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw
+7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A
+HidVJ/3u
+-----END CERTIFICATE REQUEST-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.js
new file mode 100755 (executable)
index 0000000..05e21c1
--- /dev/null
@@ -0,0 +1,28 @@
+var fs = require("fs")
+var https = require("https")
+var options = { key: fs.readFileSync("./server.key")
+              , cert: fs.readFileSync("./server.crt") }
+
+var server = https.createServer(options, function (req, res) {
+  res.writeHead(200)
+  res.end()
+  server.close()
+})
+server.listen(1337)
+
+var ca = fs.readFileSync("./ca.crt")
+var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca })
+
+https.request({ host: "localhost"
+              , method: "HEAD"
+              , port: 1337
+              , headers: { host: "testing.request.mikealrogers.com" }
+              , agent: agent
+              , ca: [ ca ]
+              , path: "/" }, function (res) {
+  if (res.client.authorized) {
+    console.log("node test: OK")
+  } else {
+    throw new Error(res.client.authorizationError)
+  }
+}).end()
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.key b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/ca/server.key
new file mode 100755 (executable)
index 0000000..72d8698
--- /dev/null
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg
+cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB
+iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW
+gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0
+JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ
+rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ
+0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw==
+-----END RSA PRIVATE KEY-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/npm-ca.crt b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/npm-ca.crt
new file mode 100755 (executable)
index 0000000..fde2fe9
--- /dev/null
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC
+VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x
+IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w
+bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y
+MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV
+BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj
+YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA
+aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE
+OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz
+Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl
+y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC
+l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv
+yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl
+ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op
+-----END CERTIFICATE-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/test.crt b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/test.crt
new file mode 100755 (executable)
index 0000000..b357f86
--- /dev/null
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE-----
+MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU
+SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo
+ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx
+MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV
+BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz
+dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B
+AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto
+wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj
+eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC
+AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV
+l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4
+L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE
+c7U8F6MWLQ==
+-----END CERTIFICATE-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/test.key b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/ssl/test.key
new file mode 100755 (executable)
index 0000000..b85810d
--- /dev/null
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt
+NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE
+mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB
+AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt
+Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ
+fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb
+rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6
+V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF
++WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb
+G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf
+Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ
+fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w
+kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w==
+-----END RSA PRIVATE KEY-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-agentOptions.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-agentOptions.js
new file mode 100755 (executable)
index 0000000..47fe3aa
--- /dev/null
@@ -0,0 +1,23 @@
+var request = require('../index')
+  , http = require('http')
+  , server = require('./server')
+  , assert = require('assert')
+  ;
+
+var s = http.createServer(function (req, resp) {
+  resp.statusCode = 200
+  resp.end('')
+}).listen(6767, function () {
+  // requests without agentOptions should use global agent
+  var r = request('http://localhost:6767', function (e, resp, body) {
+    assert.deepEqual(r.agent, http.globalAgent);
+    assert.equal(Object.keys(r.pool).length, 0);
+
+    // requests with agentOptions should apply agentOptions to new agent in pool
+    var r2 = request('http://localhost:6767', { agentOptions: { foo: 'bar' } }, function (e, resp, body) {
+      assert.deepEqual(r2.agent.options, { foo: 'bar' });
+      assert.equal(Object.keys(r2.pool).length, 1);
+           s.close()
+        });
+  })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-basic-auth.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-basic-auth.js
new file mode 100755 (executable)
index 0000000..7cf1d6d
--- /dev/null
@@ -0,0 +1,163 @@
+var assert = require('assert')
+  , http = require('http')
+  , request = require('../index')
+  ;
+
+var numBasicRequests = 0;
+
+var basicServer = http.createServer(function (req, res) {
+  console.error('Basic auth server: ', req.method, req.url);
+  numBasicRequests++;
+
+  var ok;
+
+  if (req.headers.authorization) {
+    if (req.headers.authorization == 'Basic ' + new Buffer('test:testing2').toString('base64')) {
+      ok = true;
+    } else if ( req.headers.authorization == 'Basic ' + new Buffer(':apassword').toString('base64')) {
+      ok = true;
+    } else if ( req.headers.authorization == 'Basic ' + new Buffer('justauser').toString('base64')) {
+      ok = true;
+    } else {
+      // Bad auth header, don't send back WWW-Authenticate header
+      ok = false;
+    }
+  } else {
+    // No auth header, send back WWW-Authenticate header
+    ok = false;
+    res.setHeader('www-authenticate', 'Basic realm="Private"');
+  }
+
+  if (req.url == '/post/') {
+    var expectedContent = 'data_key=data_value';
+    req.on('data', function(data) {
+      assert.equal(data, expectedContent);
+      console.log('received request data: ' + data);
+    });
+    assert.equal(req.method, 'POST');
+    assert.equal(req.headers['content-length'], '' + expectedContent.length);
+    assert.equal(req.headers['content-type'], 'application/x-www-form-urlencoded; charset=utf-8');
+  }
+
+  if (ok) {
+    console.log('request ok');
+    res.end('ok');
+  } else {
+    console.log('status=401');
+    res.statusCode = 401;
+    res.end('401');
+  }
+});
+
+basicServer.listen(6767);
+
+var tests = [
+  function(next) {
+    request({
+      'method': 'GET',
+      'uri': 'http://localhost:6767/test/',
+      'auth': {
+        'user': 'test',
+        'pass': 'testing2',
+        'sendImmediately': false
+      }
+    }, function(error, res, body) {
+      assert.equal(res.statusCode, 200);
+      assert.equal(numBasicRequests, 2);
+      next();
+    });
+  },
+
+  function(next) {
+    // If we don't set sendImmediately = false, request will send basic auth
+    request({
+      'method': 'GET',
+      'uri': 'http://localhost:6767/test2/',
+      'auth': {
+        'user': 'test',
+        'pass': 'testing2'
+      }
+    }, function(error, res, body) {
+      assert.equal(res.statusCode, 200);
+      assert.equal(numBasicRequests, 3);
+      next();
+    });
+  },
+
+  function(next) {
+    request({
+      'method': 'GET',
+      'uri': 'http://test:testing2@localhost:6767/test2/'
+    }, function(error, res, body) {
+      assert.equal(res.statusCode, 200);
+      assert.equal(numBasicRequests, 4);
+      next();
+    });
+  },
+
+  function(next) {
+    request({
+      'method': 'POST',
+      'form': { 'data_key': 'data_value' },
+      'uri': 'http://localhost:6767/post/',
+      'auth': {
+        'user': 'test',
+        'pass': 'testing2',
+        'sendImmediately': false
+      }
+    }, function(error, res, body) {
+      assert.equal(res.statusCode, 200);
+      assert.equal(numBasicRequests, 6);
+      next();
+    });
+  },
+
+  function(next) {
+    assert.doesNotThrow( function() {
+      request({
+        'method': 'GET',
+        'uri': 'http://localhost:6767/allow_empty_user/',
+        'auth': {
+          'user': '',
+          'pass': 'apassword',
+          'sendImmediately': false
+        }
+      }, function(error, res, body ) {
+        assert.equal(res.statusCode, 200);
+        assert.equal(numBasicRequests, 8);
+        next();
+      });
+    })
+  },
+
+  function(next) {
+    assert.doesNotThrow( function() {
+      request({
+        'method': 'GET',
+        'uri': 'http://localhost:6767/allow_undefined_password/',
+        'auth': {
+          'user': 'justauser',
+          'pass': undefined,
+          'sendImmediately': false
+        }
+      }, function(error, res, body ) {
+        assert.equal(res.statusCode, 200);
+        assert.equal(numBasicRequests, 10);
+        next();
+      });
+    })
+  }
+];
+
+function runTest(i) {
+  if (i < tests.length) {
+    tests[i](function() {
+      runTest(i + 1);
+    });
+  } else {
+    console.log('All tests passed');
+    basicServer.close();
+  }
+}
+
+runTest(0);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-body.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-body.js
new file mode 100755 (executable)
index 0000000..186de12
--- /dev/null
@@ -0,0 +1,122 @@
+var server = require('./server')
+  , events = require('events')
+  , stream = require('stream')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var s = server.createServer();
+
+var tests =
+  { testGet :
+    { resp : server.createGetResponse("TESTING!")
+    , expectBody: "TESTING!"
+    }
+  , testGetChunkBreak :
+    { resp : server.createChunkResponse(
+      [ new Buffer([239])
+      , new Buffer([163])
+      , new Buffer([191])
+      , new Buffer([206])
+      , new Buffer([169])
+      , new Buffer([226])
+      , new Buffer([152])
+      , new Buffer([131])
+      ])
+    , expectBody: "Ω☃"
+    }
+  , testGetBuffer :
+    { resp : server.createGetResponse(new Buffer("TESTING!"))
+    , encoding: null
+    , expectBody: new Buffer("TESTING!")
+    }
+  , testGetEncoding :
+    { resp : server.createGetResponse(new Buffer('efa3bfcea9e29883', 'hex'))
+    , encoding: 'hex'
+    , expectBody: "efa3bfcea9e29883"
+    }
+  , testGetUTF8:
+     { resp: server.createGetResponse(new Buffer([0xEF, 0xBB, 0xBF, 226, 152, 131]))
+     , encoding: "utf8"
+     , expectBody: "☃"
+     }
+  , testGetJSON :
+     { resp : server.createGetResponse('{"test":true}', 'application/json')
+     , json : true
+     , expectBody: {"test":true}
+     }
+  , testPutString :
+    { resp : server.createPostValidator("PUTTINGDATA")
+    , method : "PUT"
+    , body : "PUTTINGDATA"
+    }
+  , testPutBuffer :
+    { resp : server.createPostValidator("PUTTINGDATA")
+    , method : "PUT"
+    , body : new Buffer("PUTTINGDATA")
+    }
+  , testPutJSON :
+    { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+    , method: "PUT"
+    , json: {foo: 'bar'}
+    }
+  , testPutMultipart :
+    { resp: server.createPostValidator(
+        '--__BOUNDARY__\r\n' +
+        'content-type: text/html\r\n' +
+        '\r\n' +
+        '<html><body>Oh hi.</body></html>' +
+        '\r\n--__BOUNDARY__\r\n\r\n' +
+        'Oh hi.' +
+        '\r\n--__BOUNDARY__--'
+        )
+    , method: "PUT"
+    , multipart:
+      [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+      , {'body': 'Oh hi.'}
+      ]
+    }
+  , testPutMultipartPreambleCRLF :
+    { resp: server.createPostValidator(
+        '\r\n--__BOUNDARY__\r\n' +
+        'content-type: text/html\r\n' +
+        '\r\n' +
+        '<html><body>Oh hi.</body></html>' +
+        '\r\n--__BOUNDARY__\r\n\r\n' +
+        'Oh hi.' +
+        '\r\n--__BOUNDARY__--'
+        )
+    , method: "PUT"
+    , preambleCRLF: true
+    , multipart:
+      [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+      , {'body': 'Oh hi.'}
+      ]
+    }
+  }
+
+s.listen(s.port, function () {
+
+  var counter = 0
+
+  for (i in tests) {
+    (function () {
+      var test = tests[i]
+      s.on('/'+i, test.resp)
+      test.uri = s.url + '/' + i
+      request(test, function (err, resp, body) {
+        if (err) throw err
+        if (test.expectBody) {
+          assert.deepEqual(test.expectBody, body)
+        }
+        counter = counter - 1;
+        if (counter === 0) {
+          console.log(Object.keys(tests).length+" tests passed.")
+          s.close()
+        }
+      })
+      counter++
+    })()
+  }
+})
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-defaults.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-defaults.js
new file mode 100755 (executable)
index 0000000..f6c4024
--- /dev/null
@@ -0,0 +1,129 @@
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var s = server.createServer();
+
+s.listen(s.port, function () {
+  var counter = 0;
+  s.on('/get', function (req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.method, 'GET')
+    resp.writeHead(200, {'Content-Type': 'text/plain'});
+    resp.end('TESTING!');
+  });
+
+  // test get(string, function)
+  request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){
+    if (e) throw e;
+    assert.deepEqual("TESTING!", b);
+    counter += 1;
+  });
+
+  s.on('/post', function (req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.headers['content-type'], null);
+    assert.equal(req.method, 'POST')
+    resp.writeHead(200, {'Content-Type': 'application/json'});
+    resp.end(JSON.stringify({foo:'bar'}));
+  });
+
+  // test post(string, object, function)
+  request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){
+    if (e) throw e;
+    assert.deepEqual('bar', b.foo);
+    counter += 1;
+  });
+
+  s.on('/patch', function (req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.headers['content-type'], null);
+    assert.equal(req.method, 'PATCH')
+    resp.writeHead(200, {'Content-Type': 'application/json'});
+    resp.end(JSON.stringify({foo:'bar'}));
+  });
+
+  // test post(string, object, function)
+  request.defaults({headers:{foo:"bar"}}).patch(s.url + '/patch', {json: true}, function (e, r, b){
+    if (e) throw e;
+    assert.deepEqual('bar', b.foo);
+    counter += 1;
+  });
+
+  s.on('/post-body', function (req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.headers['content-type'], 'application/json');
+    assert.equal(req.method, 'POST')
+    resp.writeHead(200, {'Content-Type': 'application/json'});
+    resp.end(JSON.stringify({foo:'bar'}));
+  });
+
+  // test post(string, object, function) with body
+  request.defaults({headers:{foo:"bar"}}).post(s.url + '/post-body', {json: true, body:{bar:"baz"}}, function (e, r, b){
+    if (e) throw e;
+    assert.deepEqual('bar', b.foo);
+    counter += 1;
+  });
+
+  s.on('/del', function (req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.method, 'DELETE')
+    resp.writeHead(200, {'Content-Type': 'application/json'});
+    resp.end(JSON.stringify({foo:'bar'}));
+  });
+
+  // test .del(string, function)
+  request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){
+    if (e) throw e;
+    assert.deepEqual('bar', b.foo);
+    counter += 1;
+  });
+
+  s.on('/head', function (req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.method, 'HEAD')
+    resp.writeHead(200, {'Content-Type': 'text/plain'});
+    resp.end();
+  });
+
+  // test head.(object, function)
+  request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){
+    if (e) throw e;
+    counter += 1;
+  });
+
+  s.on('/get_custom', function(req, resp) {
+    assert.equal(req.headers.foo, 'bar');
+    assert.equal(req.headers.x, 'y');
+    resp.writeHead(200, {'Content-Type': 'text/plain'});
+    resp.end();
+  });
+
+  // test custom request handler function
+  var defaultRequest = request.defaults({
+    headers:{foo:"bar"}
+    , body: 'TESTING!'
+  }, function(uri, options, callback) {
+    var params = request.initParams(uri, options, callback);
+    options = params.options;
+    options.headers.x = 'y';
+
+    return request(params.uri, params.options, params.callback);
+  });
+
+  var msg = 'defaults test failed. head request should throw earlier';
+  assert.throws(function() {
+    defaultRequest.head(s.url + '/get_custom', function(e, r, b) {
+      throw new Error(msg);
+    });
+    counter+=1;
+  }, msg);
+
+  defaultRequest.get(s.url + '/get_custom', function(e, r, b) {
+    if(e) throw e;
+    counter += 1;
+    console.log(counter.toString() + " tests passed.");
+    s.close();
+  });
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-digest-auth.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-digest-auth.js
new file mode 100755 (executable)
index 0000000..5f2d6eb
--- /dev/null
@@ -0,0 +1,69 @@
+var assert = require('assert')
+  , http = require('http')
+  , request = require('../index')
+  ;
+
+// Test digest auth
+// Using header values captured from interaction with Apache
+
+var numDigestRequests = 0;
+
+var digestServer = http.createServer(function (req, res) {
+  console.error('Digest auth server: ', req.method, req.url);
+  numDigestRequests++;
+
+  var ok;
+
+  if (req.headers.authorization) {
+    if (req.headers.authorization == 'Digest username="test", realm="Private", nonce="WpcHS2/TBAA=dffcc0dbd5f96d49a5477166649b7c0ae3866a93", uri="/test/", qop="auth", response="54753ce37c10cb20b09b769f0bed730e", nc="1", cnonce=""') {
+      ok = true;
+    } else {
+      // Bad auth header, don't send back WWW-Authenticate header
+      ok = false;
+    }
+  } else {
+    // No auth header, send back WWW-Authenticate header
+    ok = false;
+    res.setHeader('www-authenticate', 'Digest realm="Private", nonce="WpcHS2/TBAA=dffcc0dbd5f96d49a5477166649b7c0ae3866a93", algorithm=MD5, qop="auth"');
+  }
+
+  if (ok) {
+    console.log('request ok');
+    res.end('ok');
+  } else {
+    console.log('status=401');
+    res.statusCode = 401;
+    res.end('401');
+  }
+});
+
+digestServer.listen(6767);
+
+request({
+  'method': 'GET',
+  'uri': 'http://localhost:6767/test/',
+  'auth': {
+    'user': 'test',
+    'pass': 'testing',
+    'sendImmediately': false
+  }
+}, function(error, response, body) {
+  assert.equal(response.statusCode, 200);
+  assert.equal(numDigestRequests, 2);
+
+  // If we don't set sendImmediately = false, request will send basic auth
+  request({
+    'method': 'GET',
+    'uri': 'http://localhost:6767/test/',
+    'auth': {
+      'user': 'test',
+      'pass': 'testing'
+    }
+  }, function(error, response, body) {
+    assert.equal(response.statusCode, 401);
+    assert.equal(numDigestRequests, 3);
+
+    console.log('All tests passed');
+    digestServer.close();
+  });
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-emptyBody.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-emptyBody.js
new file mode 100755 (executable)
index 0000000..338c92e
--- /dev/null
@@ -0,0 +1,20 @@
+var request = require('../index')
+  , http = require('http')
+  , assert = require('assert')
+  ;
+
+var s = http.createServer(function (req, resp) {
+  resp.statusCode = 200
+  resp.end('')
+}).listen(8080, function () {
+  var r = request('http://localhost:8080', function (e, resp, body) {
+    assert.equal(resp.statusCode, 200)
+    assert.equal(body, "")
+
+    var r2 = request({ url: 'http://localhost:8080', json: {} }, function (e, resp, body) {
+           assert.equal(resp.statusCode, 200)
+           assert.equal(body, undefined)
+           s.close()
+        });
+  })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-errors.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-errors.js
new file mode 100755 (executable)
index 0000000..4df1302
--- /dev/null
@@ -0,0 +1,37 @@
+var server = require('./server')
+  , events = require('events')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var local = 'http://localhost:8888/asdf'
+
+try {
+  request({uri:local, body:{}})
+  assert.fail("Should have throw") 
+} catch(e) {
+  assert.equal(e.message, 'Argument error, options.body.')
+}
+
+try {
+  request({uri:local, multipart: 'foo'})
+  assert.fail("Should have throw")
+} catch(e) {
+  assert.equal(e.message, 'Argument error, options.multipart.')
+}
+
+try {
+  request({uri:local, multipart: [{}]})
+  assert.fail("Should have throw")
+} catch(e) {
+  assert.equal(e.message, 'Body attribute missing in multipart.')
+}
+
+try {
+  request(local, {multipart: [{}]})
+  assert.fail("Should have throw")
+} catch(e) {
+  assert.equal(e.message, 'Body attribute missing in multipart.')
+}
+
+console.log("All tests passed.")
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-follow-all-303.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-follow-all-303.js
new file mode 100755 (executable)
index 0000000..956e386
--- /dev/null
@@ -0,0 +1,30 @@
+var request = require('../index');
+var http = require('http');
+var requests = 0;
+var assert = require('assert');
+
+var server = http.createServer(function (req, res) {
+  console.error(req.method, req.url);
+  requests ++;
+
+  if (req.method === 'POST') {
+    console.error('send 303');
+    res.setHeader('location', req.url);
+    res.statusCode = 303;
+    res.end('try again, i guess\n');
+  } else {
+    console.error('send 200')
+    res.end('ok: ' + requests);
+  }
+});
+server.listen(6767);
+
+request.post({ url: 'http://localhost:6767/foo',
+               followAllRedirects: true,
+               form: { foo: 'bar' } }, function (er, req, body) {
+  if (er) throw er;
+  assert.equal(body, 'ok: 2');
+  assert.equal(requests, 2);
+  console.error('ok - ' + process.version);
+  server.close();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-follow-all.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-follow-all.js
new file mode 100755 (executable)
index 0000000..f2e51ff
--- /dev/null
@@ -0,0 +1,36 @@
+var request = require('../index');
+var http = require('http');
+var requests = 0;
+var assert = require('assert');
+
+var server = http.createServer(function (req, res) {
+  requests ++;
+
+  // redirect everything 3 times, no matter what.
+  var c = req.headers.cookie;
+
+  if (!c) c = 0;
+  else c = +c.split('=')[1] || 0;
+
+  if (c > 3) {
+    res.end('ok: '+requests);
+    return;
+  }
+
+  res.setHeader('set-cookie', 'c=' + (c + 1));
+  res.setHeader('location', req.url);
+  res.statusCode = 302;
+  res.end('try again, i guess\n');
+});
+server.listen(6767);
+
+request.post({ url: 'http://localhost:6767/foo',
+               followAllRedirects: true,
+               jar: true,
+               form: { foo: 'bar' } }, function (er, req, body) {
+  if (er) throw er;
+  assert.equal(body, 'ok: 5');
+  assert.equal(requests, 5);
+  console.error('ok - ' + process.version);
+  server.close();
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-form.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-form.js
new file mode 100755 (executable)
index 0000000..91b9230
--- /dev/null
@@ -0,0 +1,79 @@
+var assert = require('assert')
+var http = require('http');
+var path = require('path');
+var mime = require('mime');
+var request = require('../index');
+var fs = require('fs');
+
+var remoteFile = 'http://nodejs.org/images/logo.png';
+
+var FIELDS = [
+  {name: 'my_field', value: 'my_value'},
+  {name: 'my_buffer', value: new Buffer([1, 2, 3])},
+  {name: 'my_file', value: fs.createReadStream(__dirname + '/unicycle.jpg')},
+  {name: 'remote_file', value: request(remoteFile) }
+];
+
+var server = http.createServer(function(req, res) {
+
+  // temp workaround
+  var data = '';
+  req.setEncoding('utf8');
+
+  req.on('data', function(d) {
+    data += d;
+  });
+
+  req.on('end', function() {
+    // check for the fields' traces
+
+    // 1st field : my_field
+    var field = FIELDS.shift();
+    assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+    assert.ok( data.indexOf(field.value) != -1 );
+
+    // 2nd field : my_buffer
+    var field = FIELDS.shift();
+    assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+    assert.ok( data.indexOf(field.value) != -1 );
+
+    // 3rd field : my_file
+    var field = FIELDS.shift();
+    assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+    assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+    // check for unicycle.jpg traces
+    assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 );
+    assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 );
+
+    // 4th field : remote_file
+    var field = FIELDS.shift();
+    assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 );
+    assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 );
+    // check for http://nodejs.org/images/logo.png traces
+    assert.ok( data.indexOf('ImageReady') != -1 );
+    assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 );
+
+    res.writeHead(200);
+    res.end('done');
+
+  });
+
+
+});
+
+server.listen(8080, function() {
+
+  var req = request.post('http://localhost:8080/upload', function () {
+    server.close();
+  })
+  var form = req.form()
+  
+  FIELDS.forEach(function(field) {
+    form.append(field.name, field.value);
+  });
+
+});
+
+process.on('exit', function() {
+  assert.strictEqual(FIELDS.length, 0);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-hawk.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-hawk.js
new file mode 100755 (executable)
index 0000000..8454625
--- /dev/null
@@ -0,0 +1,33 @@
+var createServer = require('http').createServer
+  , request = require('../index')
+  , hawk = require('hawk')
+  , assert = require('assert')
+  ;
+
+var server = createServer(function (req, resp) {
+  
+  var getCred = function (id, callback) {
+    assert.equal(id, 'dh37fgj492je')
+    var credentials = 
+      { key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn'
+      , algorithm: 'sha256'
+      , user: 'Steve'
+      }
+    return callback(null, credentials)
+  }
+
+  hawk.server.authenticate(req, getCred, {}, function (err, credentials, attributes) {
+    resp.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' })
+    resp.end(!err ? 'Hello ' + credentials.user : 'Shoosh!')
+  })
+  
+})
+
+server.listen(8080, function () {
+  var creds = {key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', algorithm: 'sha256', id:'dh37fgj492je'}
+  request('http://localhost:8080', {hawk:{credentials:creds}}, function (e, r, b) {
+    assert.equal(200, r.statusCode)
+    assert.equal(b, 'Hello Steve')
+    server.close()
+  })
+})
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-headers.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-headers.js
new file mode 100755 (executable)
index 0000000..3982b9b
--- /dev/null
@@ -0,0 +1,52 @@
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+  , Cookie = require('cookie-jar')
+  , Jar = Cookie.Jar
+  , s = server.createServer()
+
+s.listen(s.port, function () {
+  var serverUri = 'http://localhost:' + s.port
+    , numTests = 0
+    , numOutstandingTests = 0
+
+  function createTest(requestObj, serverAssertFn) {
+    var testNumber = numTests;
+    numTests += 1;
+    numOutstandingTests += 1;
+    s.on('/' + testNumber, function (req, res) {
+      serverAssertFn(req, res);
+      res.writeHead(200);
+      res.end();
+    });
+    requestObj.url = serverUri + '/' + testNumber
+    request(requestObj, function (err, res, body) {
+      assert.ok(!err)
+      assert.equal(res.statusCode, 200)
+      numOutstandingTests -= 1
+      if (numOutstandingTests === 0) {
+        console.log(numTests + ' tests passed.')
+        s.close()
+      }
+    })
+  }
+
+  // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified
+  createTest({headers: {cookie: 'foo=bar'}}, function (req, res) {
+    assert.ok(req.headers.cookie)
+    assert.equal(req.headers.cookie, 'foo=bar')
+  })
+
+  // Issue #125: headers.cookie + cookie jar
+  var jar = new Jar()
+  jar.add(new Cookie('quux=baz'));
+  createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) {
+    assert.ok(req.headers.cookie)
+    assert.equal(req.headers.cookie, 'foo=bar; quux=baz')
+  })
+
+  // There should be no cookie header when neither headers.cookie nor a cookie jar is specified
+  createTest({}, function (req, res) {
+    assert.ok(!req.headers.cookie)
+  })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-http-signature.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-http-signature.js
new file mode 100755 (executable)
index 0000000..9300473
--- /dev/null
@@ -0,0 +1,106 @@
+var createServer = require('http').createServer
+  , request = require('../index')
+  , httpSignature = require('http-signature')
+  , assert = require('assert')
+  ;
+
+var privateKeyPEMs = {}
+
+privateKeyPEMs['key-1'] =
+  '-----BEGIN RSA PRIVATE KEY-----\n' +
+  'MIIEpAIBAAKCAQEAzWSJl+Z9Bqv00FVL5N3+JCUoqmQPjIlya1BbeqQroNQ5yG1i\n' +
+  'VbYTTnMRa1zQtR6r2fNvWeg94DvxivxIG9diDMnrzijAnYlTLOl84CK2vOxkj5b6\n' +
+  '8zrLH9b/Gd6NOHsywo8IjvXvCeTfca5WUHcuVi2lT9VjygFs1ILG4RyeX1BXUumu\n' +
+  'Y8fzmposxLYdMxCqUTzAn0u9Saq2H2OVj5u114wS7OQPigu6G99dpn/iPHa3zBm8\n' +
+  '7baBWDbqZWRW0BP3K6eqq8sut1+NLhNW8ADPTdnO/SO+kvXy7fqd8atSn+HlQcx6\n' +
+  'tW42dhXf3E9uE7K78eZtW0KvfyNGAjsI1Fft2QIDAQABAoIBAG1exe3/LEBrPLfb\n' +
+  'U8iRdY0lxFvHYIhDgIwohC3wUdMYb5SMurpNdEZn+7Sh/fkUVgp/GKJViu1mvh52\n' +
+  'bKd2r52DwG9NQBQjVgkqY/auRYSglIPpr8PpYNSZlcneunCDGeqEY9hMmXc5Ssqs\n' +
+  'PQYoEKKPN+IlDTg6PguDgAfLR4IUvt9KXVvmB/SSgV9tSeTy35LECt1Lq3ozbUgu\n' +
+  '30HZI3U6/7H+X22Pxxf8vzBtzkg5rRCLgv+OeNPo16xMnqbutt4TeqEkxRv5rtOo\n' +
+  '/A1i9khBeki0OJAFJsE82qnaSZodaRsxic59VnN8sWBwEKAt87tEu5A3K3j4XSDU\n' +
+  '/avZxAECgYEA+pS3DvpiQLtHlaO3nAH6MxHRrREOARXWRDe5nUQuUNpS1xq9wte6\n' +
+  'DkFtba0UCvDLic08xvReTCbo9kH0y6zEy3zMpZuJlKbcWCkZf4S5miYPI0RTZtF8\n' +
+  'yps6hWqzYFSiO9hMYws9k4OJLxX0x3sLK7iNZ32ujcSrkPBSiBr0gxkCgYEA0dWl\n' +
+  '637K41AJ/zy0FP0syq+r4eIkfqv+/t6y2aQVUBvxJYrj9ci6XHBqoxpDV8lufVYj\n' +
+  'fUAfeI9/MZaWvQJRbnYLre0I6PJfLuCBIL5eflO77BGso165AF7QJZ+fwtgKv3zv\n' +
+  'ZX75eudCSS/cFo0po9hlbcLMT4B82zEkgT8E2MECgYEAnz+3/wrdOmpLGiyL2dff\n' +
+  '3GjsqmJ2VfY8z+niSrI0BSpbD11tT9Ct67VlCBjA7hsOH6uRfpd6/kaUMzzDiFVq\n' +
+  'VDAiFvV8QD6zNkwYalQ9aFvbrvwTTPrBpjl0vamMCiJ/YC0cjq1sGr2zh3sar1Ph\n' +
+  'S43kP+s97dcZeelhaiJHVrECgYEAsx61q/loJ/LDFeYzs1cLTVn4V7I7hQY9fkOM\n' +
+  'WM0AhInVqD6PqdfXfeFYpjJdGisQ7l0BnoGGW9vir+nkcyPvb2PFRIr6+B8tsU5j\n' +
+  '7BeVgjDoUfQkcrEBK5fEBtnj/ud9BUkY8oMZZBjVNLRuI7IMwZiPvMp0rcj4zAN/\n' +
+  'LfUlpgECgYArBvFcBxSkNAzR3Rtteud1YDboSKluRM37Ey5plrn4BS0DD0jm++aD\n' +
+  '0pG2Hsik000hibw92lCkzvvBVAqF8BuAcnPlAeYfsOaa97PGEjSKEN5bJVWZ9/om\n' +
+  '9FV1axotRN2XWlwrhixZLEaagkREXhgQc540FS5O8IaI2Vpa80Atzg==\n' +
+  '-----END RSA PRIVATE KEY-----'
+
+var publicKeyPEMs = {}
+
+publicKeyPEMs['key-1'] =
+  '-----BEGIN PUBLIC KEY-----\n' +
+  'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzWSJl+Z9Bqv00FVL5N3+\n' +
+  'JCUoqmQPjIlya1BbeqQroNQ5yG1iVbYTTnMRa1zQtR6r2fNvWeg94DvxivxIG9di\n' +
+  'DMnrzijAnYlTLOl84CK2vOxkj5b68zrLH9b/Gd6NOHsywo8IjvXvCeTfca5WUHcu\n' +
+  'Vi2lT9VjygFs1ILG4RyeX1BXUumuY8fzmposxLYdMxCqUTzAn0u9Saq2H2OVj5u1\n' +
+  '14wS7OQPigu6G99dpn/iPHa3zBm87baBWDbqZWRW0BP3K6eqq8sut1+NLhNW8ADP\n' +
+  'TdnO/SO+kvXy7fqd8atSn+HlQcx6tW42dhXf3E9uE7K78eZtW0KvfyNGAjsI1Fft\n' +
+  '2QIDAQAB\n' +
+  '-----END PUBLIC KEY-----'
+
+publicKeyPEMs['key-2'] =
+  '-----BEGIN PUBLIC KEY-----\n' +
+  'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqp04VVr9OThli9b35Omz\n' +
+  'VqSfWbsoQuRrgyWsrNRn3XkFmbWw4FzZwQ42OgGMzQ84Ta4d9zGKKQyFriTiPjPf\n' +
+  'xhhrsaJnDuybcpVhcr7UNKjSZ0S59tU3hpRiEz6hO+Nc/OSSLkvalG0VKrxOln7J\n' +
+  'LK/h3rNS/l6wDZ5S/KqsI6CYtV2ZLpn3ahLrizvEYNY038Qcm38qMWx+VJAvZ4di\n' +
+  'qqmW7RLIsLT59SWmpXdhFKnkYYGhxrk1Mwl22dBTJNY5SbriU5G3gWgzYkm8pgHr\n' +
+  '6CtrXch9ciJAcDJehPrKXNvNDOdUh8EW3fekNJerF1lWcwQg44/12v8sDPyfbaKB\n' +
+  'dQIDAQAB\n' +
+  '-----END PUBLIC KEY-----'
+
+var server = createServer(function (req, res) {
+  var parsed = httpSignature.parseRequest(req)
+  var publicKeyPEM = publicKeyPEMs[parsed.keyId]
+  var verified = httpSignature.verifySignature(parsed, publicKeyPEM)
+  res.writeHead(verified ? 200 : 400)
+  res.end()
+})
+
+server.listen(8080, function () {
+  function correctKeyTest(callback) {
+    var options = {
+      httpSignature: {
+        keyId: 'key-1',
+        key: privateKeyPEMs['key-1']
+      }
+    }
+    request('http://localhost:8080', options, function (e, r, b) {
+      assert.equal(200, r.statusCode)
+      callback()
+    })
+  }
+
+  function incorrectKeyTest(callback) {
+    var options = {
+      httpSignature: {
+        keyId: 'key-2',
+        key: privateKeyPEMs['key-1']
+      }
+    }
+    request('http://localhost:8080', options, function (e, r, b) {
+      assert.equal(400, r.statusCode)
+      callback()
+    })
+  }
+
+  var tests = [correctKeyTest, incorrectKeyTest]
+  var todo = tests.length;
+  for(var i = 0; i < tests.length; ++i) {
+    tests[i](function() {
+      if(!--todo) {
+        server.close()
+      }
+    })
+  }
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-httpModule.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-httpModule.js
new file mode 100755 (executable)
index 0000000..2c19615
--- /dev/null
@@ -0,0 +1,94 @@
+var http = require('http')
+  , https = require('https')
+  , server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+
+
+var faux_requests_made = {'http':0, 'https':0}
+function wrap_request(name, module) {
+  // Just like the http or https module, but note when a request is made.
+  var wrapped = {}
+  Object.keys(module).forEach(function(key) {
+    var value = module[key];
+
+    if(key != 'request')
+      wrapped[key] = value;
+    else
+      wrapped[key] = function(options, callback) {
+        faux_requests_made[name] += 1
+        return value.apply(this, arguments)
+      }
+  })
+
+  return wrapped;
+}
+
+
+var faux_http = wrap_request('http', http)
+  , faux_https = wrap_request('https', https)
+  , plain_server = server.createServer()
+  , https_server = server.createSSLServer()
+
+
+plain_server.listen(plain_server.port, function() {
+  plain_server.on('/plain', function (req, res) {
+    res.writeHead(200)
+    res.end('plain')
+  })
+  plain_server.on('/to_https', function (req, res) {
+    res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'})
+    res.end()
+  })
+
+  https_server.listen(https_server.port, function() {
+    https_server.on('/https', function (req, res) {
+      res.writeHead(200)
+      res.end('https')
+    })
+    https_server.on('/to_plain', function (req, res) {
+      res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'})
+      res.end()
+    })
+
+    run_tests()
+    run_tests({})
+    run_tests({'http:':faux_http})
+    run_tests({'https:':faux_https})
+    run_tests({'http:':faux_http, 'https:':faux_https})
+  })
+})
+
+function run_tests(httpModules) {
+  var to_https = 'http://localhost:'+plain_server.port+'/to_https'
+  var to_plain = 'https://localhost:'+https_server.port+'/to_plain'
+
+  request(to_https, {'httpModules':httpModules, strictSSL:false}, function (er, res, body) {
+    if (er) throw er
+    assert.equal(body, 'https', 'Received HTTPS server body')
+    done()
+  })
+
+  request(to_plain, {'httpModules':httpModules, strictSSL:false}, function (er, res, body) {
+    if (er) throw er
+    assert.equal(body, 'plain', 'Received HTTPS server body')
+    done()
+  })
+}
+
+
+var passed = 0;
+function done() {
+  passed += 1
+  var expected = 10
+
+  if(passed == expected) {
+    plain_server.close()
+    https_server.close()
+
+    assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately')
+    assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately')
+
+    console.log((expected+2) + ' tests passed.')
+  }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-https-strict.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-https-strict.js
new file mode 100755 (executable)
index 0000000..d49a9af
--- /dev/null
@@ -0,0 +1,97 @@
+// a test where we validate the siguature of the keys
+// otherwise exactly the same as the ssl test
+
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+  , fs = require('fs')
+  , path = require('path')
+  , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key')
+           , cert: path.resolve(__dirname, 'ssl/ca/server.crt') }
+  , s = server.createSSLServer(null, opts)
+  , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt')
+  , ca = fs.readFileSync(caFile)
+
+var tests =
+  { testGet :
+    { resp : server.createGetResponse("TESTING!")
+    , expectBody: "TESTING!"
+    }
+  , testGetChunkBreak :
+    { resp : server.createChunkResponse(
+      [ new Buffer([239])
+      , new Buffer([163])
+      , new Buffer([191])
+      , new Buffer([206])
+      , new Buffer([169])
+      , new Buffer([226])
+      , new Buffer([152])
+      , new Buffer([131])
+      ])
+    , expectBody: "Ω☃"
+    }
+  , testGetJSON :
+    { resp : server.createGetResponse('{"test":true}', 'application/json')
+    , json : true
+    , expectBody: {"test":true}
+    }
+  , testPutString :
+    { resp : server.createPostValidator("PUTTINGDATA")
+    , method : "PUT"
+    , body : "PUTTINGDATA"
+    }
+  , testPutBuffer :
+    { resp : server.createPostValidator("PUTTINGDATA")
+    , method : "PUT"
+    , body : new Buffer("PUTTINGDATA")
+    }
+  , testPutJSON :
+    { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+    , method: "PUT"
+    , json: {foo: 'bar'}
+    }
+  , testPutMultipart :
+    { resp: server.createPostValidator(
+        '--__BOUNDARY__\r\n' +
+        'content-type: text/html\r\n' +
+        '\r\n' +
+        '<html><body>Oh hi.</body></html>' +
+        '\r\n--__BOUNDARY__\r\n\r\n' +
+        'Oh hi.' +
+        '\r\n--__BOUNDARY__--'
+        )
+    , method: "PUT"
+    , multipart:
+      [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+      , {'body': 'Oh hi.'}
+      ]
+    }
+  }
+
+s.listen(s.port, function () {
+
+  var counter = 0
+
+  for (i in tests) {
+    (function () {
+      var test = tests[i]
+      s.on('/'+i, test.resp)
+      test.uri = s.url + '/' + i
+      test.strictSSL = true
+      test.ca = ca
+      test.headers = { host: 'testing.request.mikealrogers.com' }
+      request(test, function (err, resp, body) {
+        if (err) throw err
+        if (test.expectBody) {
+          assert.deepEqual(test.expectBody, body)
+        }
+        counter = counter - 1;
+        if (counter === 0) {
+          console.log(Object.keys(tests).length+" tests passed.")
+          s.close()
+        }
+      })
+      counter++
+    })()
+  }
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-https.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-https.js
new file mode 100755 (executable)
index 0000000..b6858d4
--- /dev/null
@@ -0,0 +1,87 @@
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+
+var s = server.createSSLServer();
+
+var tests =
+  { testGet :
+    { resp : server.createGetResponse("TESTING!")
+    , expectBody: "TESTING!"
+    }
+  , testGetChunkBreak :
+    { resp : server.createChunkResponse(
+      [ new Buffer([239])
+      , new Buffer([163])
+      , new Buffer([191])
+      , new Buffer([206])
+      , new Buffer([169])
+      , new Buffer([226])
+      , new Buffer([152])
+      , new Buffer([131])
+      ])
+    , expectBody: "Ω☃"
+    }
+  , testGetJSON :
+    { resp : server.createGetResponse('{"test":true}', 'application/json')
+    , json : true
+    , expectBody: {"test":true}
+    }
+  , testPutString :
+    { resp : server.createPostValidator("PUTTINGDATA")
+    , method : "PUT"
+    , body : "PUTTINGDATA"
+    }
+  , testPutBuffer :
+    { resp : server.createPostValidator("PUTTINGDATA")
+    , method : "PUT"
+    , body : new Buffer("PUTTINGDATA")
+    }
+  , testPutJSON :
+    { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+    , method: "PUT"
+    , json: {foo: 'bar'}
+    }
+  , testPutMultipart :
+    { resp: server.createPostValidator(
+        '--__BOUNDARY__\r\n' +
+        'content-type: text/html\r\n' +
+        '\r\n' +
+        '<html><body>Oh hi.</body></html>' +
+        '\r\n--__BOUNDARY__\r\n\r\n' +
+        'Oh hi.' +
+        '\r\n--__BOUNDARY__--'
+        )
+    , method: "PUT"
+    , multipart:
+      [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+      , {'body': 'Oh hi.'}
+      ]
+    }
+  }
+
+s.listen(s.port, function () {
+
+  var counter = 0
+
+  for (i in tests) {
+    (function () {
+      var test = tests[i]
+      s.on('/'+i, test.resp)
+      test.uri = s.url + '/' + i
+      test.rejectUnauthorized = false
+      request(test, function (err, resp, body) {
+        if (err) throw err
+        if (test.expectBody) {
+          assert.deepEqual(test.expectBody, body)
+        }
+        counter = counter - 1;
+        if (counter === 0) {
+          console.log(Object.keys(tests).length+" tests passed.")
+          s.close()
+        }
+      })
+      counter++
+    })()
+  }
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-isUrl.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-isUrl.js
new file mode 100755 (executable)
index 0000000..4a51ad0
--- /dev/null
@@ -0,0 +1,28 @@
+var assert = require('assert')
+  , request = require('../index')
+  , http = require('http')
+  ;
+
+var s = http.createServer(function(req, res) {
+  res.statusCode = 200;
+  res.end('');
+}).listen(6767, function () {
+
+  // Test lowercase
+  request('http://localhost:6767', function (err, resp, body) {
+    // just need to get here without throwing an error
+    assert.equal(true, true);
+  })
+
+  // Test uppercase
+  request('HTTP://localhost:6767', function (err, resp, body) {
+    assert.equal(true, true);
+  })
+
+  // Test mixedcase
+  request('HtTp://localhost:6767', function (err, resp, body) {
+    assert.equal(true, true);
+    // clean up
+    s.close();
+  })
+})
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-localAddress.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-localAddress.js
new file mode 100755 (executable)
index 0000000..11a1bd1
--- /dev/null
@@ -0,0 +1,15 @@
+var request = require('../index')
+  , assert = require('assert')
+  ;
+
+request.get({
+  uri: 'http://www.google.com', localAddress: '1.2.3.4' // some invalid address
+}, function(err, res) {
+  assert(!res) // asserting that no response received
+})
+
+request.get({
+  uri: 'http://www.google.com', localAddress: '127.0.0.1'
+}, function(err, res) {
+  assert(!res) // asserting that no response received
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-oauth.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-oauth.js
new file mode 100755 (executable)
index 0000000..3269483
--- /dev/null
@@ -0,0 +1,117 @@
+var hmacsign = require('oauth-sign').hmacsign
+  , assert = require('assert')
+  , qs = require('querystring')
+  , request = require('../index')
+  ;
+
+function getsignature (r) {
+  var sign
+  r.headers.Authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) {
+    if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1)
+  })
+  return decodeURIComponent(sign)
+}
+
+// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth
+
+var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', 
+  { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
+  , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
+  , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
+  , oauth_signature_method: 'HMAC-SHA1'
+  , oauth_timestamp: '1272323042'
+  , oauth_version: '1.0'
+  }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98")
+
+console.log(reqsign)
+console.log('8wUi7m5HFQy76nowoCThusfgB+Q=')
+assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=')
+
+var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token',
+  { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g'
+  , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
+  , oauth_signature_method: 'HMAC-SHA1'
+  , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
+  , oauth_timestamp: '1272323047'
+  , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
+  , oauth_version: '1.0'
+  }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA")
+  
+console.log(accsign)
+console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
+assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=')
+
+var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', 
+  { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g"
+  , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
+  , oauth_signature_method: "HMAC-SHA1"
+  , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
+  , oauth_timestamp: "1272325550"
+  , oauth_version: "1.0"
+  , status: 'setting up my twitter 私のさえずりを設定する'
+  }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA")
+
+console.log(upsign)
+console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+
+
+var rsign = request.post(
+  { url: 'https://api.twitter.com/oauth/request_token'
+  , oauth: 
+    { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11'
+    , consumer_key: 'GDdmIQH6jhtmLUypg82g'
+    , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk'
+    , timestamp: '1272323042'
+    , version: '1.0'
+    , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
+    }
+  })
+
+setTimeout(function () {
+  console.log(getsignature(rsign))
+  assert.equal(reqsign, getsignature(rsign))
+})
+
+var raccsign = request.post(
+  { url: 'https://api.twitter.com/oauth/access_token'
+  , oauth:  
+    { consumer_key: 'GDdmIQH6jhtmLUypg82g'
+    , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8'
+    , signature_method: 'HMAC-SHA1'
+    , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc'
+    , timestamp: '1272323047'
+    , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY'
+    , version: '1.0'
+    , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
+    , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" 
+    }
+  })
+
+setTimeout(function () {
+  console.log(getsignature(raccsign))
+  assert.equal(accsign, getsignature(raccsign))
+}, 1) 
+
+var rupsign = request.post(
+  { url: 'http://api.twitter.com/1/statuses/update.json' 
+  , oauth: 
+    { consumer_key: "GDdmIQH6jhtmLUypg82g"
+    , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y"
+    , signature_method: "HMAC-SHA1"
+    , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw"
+    , timestamp: "1272325550"
+    , version: "1.0"
+    , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98"
+    , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA"
+    }
+  , form: {status: 'setting up my twitter 私のさえずりを設定する'} 
+  })
+setTimeout(function () {
+  console.log(getsignature(rupsign))
+  assert.equal(upsign, getsignature(rupsign))
+}, 1)
+
+
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-onelineproxy.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-onelineproxy.js
new file mode 100755 (executable)
index 0000000..c239f89
--- /dev/null
@@ -0,0 +1,46 @@
+var http = require('http')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var server = http.createServer(function (req, resp) {
+  resp.statusCode = 200
+  if (req.url === '/get') {
+    assert.equal(req.method, 'GET')
+    resp.write('content')
+    resp.end()
+    return
+  }
+  if (req.url === '/put') {
+    var x = ''
+    assert.equal(req.method, 'PUT')
+    req.on('data', function (chunk) {
+      x += chunk
+    })
+    req.on('end', function () {
+      assert.equal(x, 'content')
+      resp.write('success')
+      resp.end()
+    })
+    return
+  }
+  if (req.url === '/proxy') {
+    assert.equal(req.method, 'PUT')
+    return req.pipe(request('http://localhost:8080/put')).pipe(resp)
+  }
+
+  if (req.url === '/test') {
+    return request('http://localhost:8080/get').pipe(request.put('http://localhost:8080/proxy')).pipe(resp)
+  }
+  throw new Error('Unknown url', req.url)
+}).listen(8080, function () {
+  request('http://localhost:8080/test', function (e, resp, body) {
+    if (e) throw e
+    if (resp.statusCode !== 200) throw new Error('statusCode not 200 ' + resp.statusCode)
+    assert.equal(body, 'success')
+    server.close()
+  })
+})
+
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-params.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-params.js
new file mode 100755 (executable)
index 0000000..a5831a1
--- /dev/null
@@ -0,0 +1,93 @@
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var s = server.createServer();
+
+var tests =
+  { testGet :
+    { resp : server.createGetResponse("TESTING!")
+    , expectBody: "TESTING!"
+    }
+    , testGetChunkBreak :
+      { resp : server.createChunkResponse(
+        [ new Buffer([239])
+        , new Buffer([163])
+        , new Buffer([191])
+        , new Buffer([206])
+        , new Buffer([169])
+        , new Buffer([226])
+        , new Buffer([152])
+        , new Buffer([131])
+        ])
+      , expectBody: "Ω☃"
+      }
+    , testGetBuffer :
+      { resp : server.createGetResponse(new Buffer("TESTING!"))
+      , encoding: null
+      , expectBody: new Buffer("TESTING!")
+      }
+    , testGetJSON :
+       { resp : server.createGetResponse('{"test":true}', 'application/json')
+       , json : true
+       , expectBody: {"test":true}
+       }
+    , testPutString :
+      { resp : server.createPostValidator("PUTTINGDATA")
+      , method : "PUT"
+      , body : "PUTTINGDATA"
+      }
+    , testPutBuffer :
+      { resp : server.createPostValidator("PUTTINGDATA")
+      , method : "PUT"
+      , body : new Buffer("PUTTINGDATA")
+      }
+    , testPutJSON :
+      { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
+      , method: "PUT"
+      , json: {foo: 'bar'}
+      }
+    , testPutMultipart :
+      { resp: server.createPostValidator(
+          '--__BOUNDARY__\r\n' +
+          'content-type: text/html\r\n' +
+          '\r\n' +
+          '<html><body>Oh hi.</body></html>' +
+          '\r\n--__BOUNDARY__\r\n\r\n' +
+          'Oh hi.' +
+          '\r\n--__BOUNDARY__--'
+          )
+      , method: "PUT"
+      , multipart:
+        [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+        , {'body': 'Oh hi.'}
+        ]
+      }
+  }
+
+s.listen(s.port, function () {
+
+  var counter = 0
+
+  for (i in tests) {
+    (function () {
+      var test = tests[i]
+      s.on('/'+i, test.resp)
+      //test.uri = s.url + '/' + i
+      request(s.url + '/' + i, test, function (err, resp, body) {
+        if (err) throw err
+        if (test.expectBody) {
+          assert.deepEqual(test.expectBody, body)
+        }
+        counter = counter - 1;
+        if (counter === 0) {
+          assert.notEqual(typeof test.callback, 'function')
+          console.log(1 + Object.keys(tests).length+" tests passed.")
+          s.close()
+        }
+      })
+      counter++
+    })()
+  }
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-piped-redirect.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-piped-redirect.js
new file mode 100755 (executable)
index 0000000..e295ec7
--- /dev/null
@@ -0,0 +1,42 @@
+var http = require('http')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var portOne = 8968
+  , portTwo = 8969
+  ;
+
+
+// server one
+var s1 = http.createServer(function (req, resp) {
+  if (req.url == '/original') {
+    resp.writeHeader(302, {'location': '/redirected'})
+    resp.end()
+  } else if (req.url == '/redirected') {
+    resp.writeHeader(200, {'content-type': 'text/plain'})
+    resp.write('OK')
+    resp.end()
+  }
+
+}).listen(portOne);
+
+
+// server two
+var s2 = http.createServer(function (req, resp) {
+  var x = request('http://localhost:'+portOne+'/original')
+  req.pipe(x)
+  x.pipe(resp)
+
+}).listen(portTwo, function () {
+  var r = request('http://localhost:'+portTwo+'/original', function (err, res, body) {
+    assert.equal(body, 'OK')
+
+    s1.close()
+    s2.close()
+  });
+
+  // it hangs, so wait a second :)
+  r.timeout = 1000;
+
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-pipes.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-pipes.js
new file mode 100755 (executable)
index 0000000..52a15cc
--- /dev/null
@@ -0,0 +1,216 @@
+var server = require('./server')
+  , events = require('events')
+  , stream = require('stream')
+  , assert = require('assert')
+  , fs = require('fs')
+  , request = require('../index')
+  , path = require('path')
+  , util = require('util')
+  ;
+
+var s = server.createServer(3453);
+
+function ValidationStream(str) {
+  this.str = str
+  this.buf = ''
+  this.on('data', function (data) {
+    this.buf += data
+  })
+  this.on('end', function () {
+    assert.equal(this.str, this.buf)
+  })
+  this.writable = true
+}
+util.inherits(ValidationStream, stream.Stream)
+ValidationStream.prototype.write = function (chunk) {
+  this.emit('data', chunk)
+}
+ValidationStream.prototype.end = function (chunk) {
+  if (chunk) emit('data', chunk)
+  this.emit('end')
+}
+
+s.listen(s.port, function () {
+  counter = 0;
+
+  var check = function () {
+    counter = counter - 1
+    if (counter === 0) {
+      console.log('All tests passed.')
+      setTimeout(function () {
+        process.exit();
+      }, 500)
+    }
+  }
+
+  // Test pipeing to a request object
+  s.once('/push', server.createPostValidator("mydata"));
+
+  var mydata = new stream.Stream();
+  mydata.readable = true
+
+  counter++
+  var r1 = request.put({url:'http://localhost:3453/push'}, function () {
+    check();
+  })
+  mydata.pipe(r1)
+
+  mydata.emit('data', 'mydata');
+  mydata.emit('end');
+
+  // Test pipeing to a request object with a json body
+  s.once('/push-json', server.createPostValidator("{\"foo\":\"bar\"}", "application/json"));
+
+  var mybodydata = new stream.Stream();
+  mybodydata.readable = true
+
+  counter++
+  var r2 = request.put({url:'http://localhost:3453/push-json',json:true}, function () {
+    check();
+  })
+  mybodydata.pipe(r2)
+
+  mybodydata.emit('data', JSON.stringify({foo:"bar"}));
+  mybodydata.emit('end');
+
+  // Test pipeing from a request object.
+  s.once('/pull', server.createGetResponse("mypulldata"));
+
+  var mypulldata = new stream.Stream();
+  mypulldata.writable = true
+
+  counter++
+  request({url:'http://localhost:3453/pull'}).pipe(mypulldata)
+
+  var d = '';
+
+  mypulldata.write = function (chunk) {
+    d += chunk;
+  }
+  mypulldata.end = function () {
+    assert.equal(d, 'mypulldata');
+    check();
+  };
+
+
+  s.on('/cat', function (req, resp) {
+    if (req.method === "GET") {
+      resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4});
+      resp.end('asdf')
+    } else if (req.method === "PUT") {
+      assert.equal(req.headers['content-type'], 'text/plain-test');
+      assert.equal(req.headers['content-length'], 4)
+      var validate = '';
+
+      req.on('data', function (chunk) {validate += chunk})
+      req.on('end', function () {
+        resp.writeHead(201);
+        resp.end();
+        assert.equal(validate, 'asdf');
+        check();
+      })
+    }
+  })
+  s.on('/pushjs', function (req, resp) {
+    if (req.method === "PUT") {
+      assert.equal(req.headers['content-type'], 'application/javascript');
+      check();
+    }
+  })
+  s.on('/catresp', function (req, resp) {
+    request.get('http://localhost:3453/cat').pipe(resp)
+  })
+  s.on('/doodle', function (req, resp) {
+    if (req.headers['x-oneline-proxy']) {
+      resp.setHeader('x-oneline-proxy', 'yup')
+    }
+    resp.writeHead('200', {'content-type':'image/jpeg'})
+    fs.createReadStream(path.join(__dirname, 'googledoodle.jpg')).pipe(resp)
+  })
+  s.on('/onelineproxy', function (req, resp) {
+    var x = request('http://localhost:3453/doodle')
+    req.pipe(x)
+    x.pipe(resp)
+  })
+
+  counter++
+  fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs'))
+
+  counter++
+  request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat'))
+
+  counter++
+  request.get('http://localhost:3453/catresp', function (e, resp, body) {
+    assert.equal(resp.headers['content-type'], 'text/plain-test');
+    assert.equal(resp.headers['content-length'], 4)
+    check();
+  })
+
+  var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.jpg'))
+
+  counter++
+  request.get('http://localhost:3453/doodle').pipe(doodleWrite)
+
+  doodleWrite.on('close', function () {
+    assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.jpg')), fs.readFileSync(path.join(__dirname, 'test.jpg')))
+    check()
+  })
+
+  process.on('exit', function () {
+    fs.unlinkSync(path.join(__dirname, 'test.jpg'))
+  })
+
+  counter++
+  request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) {
+    assert.equal(resp.headers['x-oneline-proxy'], 'yup')
+    check()
+  })
+
+  s.on('/afterresponse', function (req, resp) {
+    resp.write('d')
+    resp.end()
+  })
+
+  counter++
+  var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () {
+    var v = new ValidationStream('d')
+    afterresp.pipe(v)
+    v.on('end', check)
+  })
+  
+  s.on('/forward1', function (req, resp) {
+   resp.writeHead(302, {location:'/forward2'})
+    resp.end()
+  })
+  s.on('/forward2', function (req, resp) {
+    resp.writeHead('200', {'content-type':'image/png'})
+    resp.write('d')
+    resp.end()
+  })
+  
+  counter++
+  var validateForward = new ValidationStream('d')
+  validateForward.on('end', check)
+  request.get('http://localhost:3453/forward1').pipe(validateForward)
+
+  // Test pipe options
+  s.once('/opts', server.createGetResponse('opts response'));
+
+  var optsStream = new stream.Stream();
+  optsStream.writable = true
+  
+  var optsData = '';
+  optsStream.write = function (buf) {
+    optsData += buf;
+    if (optsData === 'opts response') {
+      setTimeout(check, 10);
+    }
+  }
+
+  optsStream.end = function () {
+    assert.fail('end called')
+  };
+
+  counter++
+  request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false })
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-pool.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-pool.js
new file mode 100755 (executable)
index 0000000..791ee8b
--- /dev/null
@@ -0,0 +1,16 @@
+var request = require('../index')
+  , http = require('http')
+  , assert = require('assert')
+  ;
+
+var s = http.createServer(function (req, resp) {
+  resp.statusCode = 200;
+  resp.end('asdf');
+}).listen(8080, function () {
+  request({'url': 'http://localhost:8080', 'pool': false}, function (e, resp) {
+    var agent = resp.request.agent;
+    assert.strictEqual(typeof agent, 'boolean');
+    assert.strictEqual(agent, false);
+    s.close();
+  });
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-protocol-changing-redirect.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-protocol-changing-redirect.js
new file mode 100755 (executable)
index 0000000..7e83a41
--- /dev/null
@@ -0,0 +1,61 @@
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+
+
+var s = server.createServer()
+var ss = server.createSSLServer()
+var sUrl = 'http://localhost:' + s.port
+var ssUrl = 'https://localhost:' + ss.port
+
+s.listen(s.port, bouncy(s, ssUrl))
+ss.listen(ss.port, bouncy(ss, sUrl))
+
+var hits = {}
+var expect = {}
+var pending = 0
+function bouncy (s, server) { return function () {
+
+  var redirs = { a: 'b'
+               , b: 'c'
+               , c: 'd'
+               , d: 'e'
+               , e: 'f'
+               , f: 'g'
+               , g: 'h'
+               , h: 'end' }
+
+  var perm = true
+  Object.keys(redirs).forEach(function (p) {
+    var t = redirs[p]
+
+    // switch type each time
+    var type = perm ? 301 : 302
+    perm = !perm
+    s.on('/' + p, function (req, res) {
+      res.writeHead(type, { location: server + '/' + t })
+      res.end()
+    })
+  })
+
+  s.on('/end', function (req, res) {
+    var h = req.headers['x-test-key']
+    hits[h] = true
+    pending --
+    if (pending === 0) done()
+  })
+}}
+
+for (var i = 0; i < 5; i ++) {
+  pending ++
+  var val = 'test_' + i
+  expect[val] = true
+  request({ url: (i % 2 ? sUrl : ssUrl) + '/a'
+          , headers: { 'x-test-key': val }
+          , rejectUnauthorized: false })
+}
+
+function done () {
+  assert.deepEqual(hits, expect)
+  process.exit(0)
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-proxy.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-proxy.js
new file mode 100755 (executable)
index 0000000..e183d68
--- /dev/null
@@ -0,0 +1,39 @@
+var server = require('./server')
+  , events = require('events')
+  , stream = require('stream')
+  , assert = require('assert')
+  , fs = require('fs')
+  , request = require('../index')
+  , path = require('path')
+  , util = require('util')
+  ;
+
+var port = 6768
+  , called = false
+  , proxiedHost = 'google.com'
+  ;
+
+var s = server.createServer(port)
+s.listen(port, function () {
+  s.on('http://google.com/', function (req, res) {
+    called = true
+    assert.equal(req.headers.host, proxiedHost)
+    res.writeHeader(200)
+    res.end()
+  })
+  request ({
+    url: 'http://'+proxiedHost,
+    proxy: 'http://localhost:'+port
+    /*
+    //should behave as if these arguments where passed:
+    url: 'http://localhost:'+port,
+    headers: {host: proxiedHost}
+    //*/
+  }, function (err, res, body) {
+    s.close()
+  })
+})
+
+process.on('exit', function () {
+  assert.ok(called, 'the request must be made to the proxy server')
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-qs.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-qs.js
new file mode 100755 (executable)
index 0000000..65958e6
--- /dev/null
@@ -0,0 +1,42 @@
+var request = request = require('../index')
+  , assert = require('assert')
+  ;
+
+// Test adding a querystring
+var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }})
+setTimeout(function() {
+       assert.equal('/?q=search', req1.path)
+}, 1)
+
+// Test replacing a querystring value
+var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }})
+setTimeout(function() {
+       assert.equal('/?q=search', req2.path)
+}, 1)
+
+// Test appending a querystring value to the ones present in the uri
+var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }})
+setTimeout(function() {
+       assert.equal('/?x=y&q=search', req3.path)
+}, 1)
+
+// Test leaving a querystring alone
+var req4 = request.get({ uri: 'http://www.google.com?x=y'})
+setTimeout(function() {
+       assert.equal('/?x=y', req4.path)
+}, 1)
+
+// Test giving empty qs property
+var req5 = request.get({ uri: 'http://www.google.com', qs: {}})
+setTimeout(function(){
+       assert.equal('/', req5.path)
+}, 1)
+
+
+// Test modifying the qs after creating the request
+var req6 = request.get({ uri: 'http://www.google.com', qs: {}});
+req6.qs({ q: "test" });
+process.nextTick(function() {
+    assert.equal('/?q=test', req6.path);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-redirect.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-redirect.js
new file mode 100755 (executable)
index 0000000..cdd4606
--- /dev/null
@@ -0,0 +1,155 @@
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+  , Cookie = require('cookie-jar')
+  , Jar = Cookie.Jar
+  ;
+
+var s = server.createServer()
+
+s.listen(s.port, function () {
+  var server = 'http://localhost:' + s.port;
+  var hits = {}
+  var passed = 0;
+
+  bouncer(301, 'temp')
+  bouncer(302, 'perm')
+  bouncer(302, 'nope')
+
+  function bouncer(code, label) {
+    var landing = label+'_landing';
+
+    s.on('/'+label, function (req, res) {
+      hits[label] = true;
+      res.writeHead(code, {
+        'location':server + '/'+landing,
+        'set-cookie': 'ham=eggs'
+      })
+      res.end()
+    })
+
+    s.on('/'+landing, function (req, res) {
+      if (req.method !== 'GET') { // We should only accept GET redirects
+        console.error("Got a non-GET request to the redirect destination URL");
+        res.writeHead(400);
+        res.end();
+        return;
+      }
+      // Make sure the cookie doesn't get included twice, see #139:
+      // Make sure cookies are set properly after redirect
+      assert.equal(req.headers.cookie, 'foo=bar; quux=baz; ham=eggs');
+      hits[landing] = true;
+      res.writeHead(200)
+      res.end(landing)
+    })
+  }
+
+  // Permanent bounce
+  var jar = new Jar()
+  jar.add(new Cookie('quux=baz'))
+  request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+    assert.ok(hits.perm, 'Original request is to /perm')
+    assert.ok(hits.perm_landing, 'Forward to permanent landing URL')
+    assert.equal(body, 'perm_landing', 'Got permanent landing content')
+    passed += 1
+    done()
+  })
+  
+  // Temporary bounce
+  request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
+    assert.equal(body, 'temp_landing', 'Got temporary landing content')
+    passed += 1
+    done()
+  })
+  
+  // Prevent bouncing.
+  request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 302) throw new Error('Status is not 302: '+res.statusCode)
+    assert.ok(hits.nope, 'Original request to /nope')
+    assert.ok(!hits.nope_landing, 'No chasing the redirect')
+    assert.equal(res.statusCode, 302, 'Response is the bounce itself')
+    passed += 1
+    done()
+  })
+  
+  // Should not follow post redirects by default
+  request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(!hits.temp_landing, 'No chasing the redirect when post')
+    assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+    passed += 1
+    done()
+  })
+  
+  // Should follow post redirects when followAllRedirects true
+  request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
+    assert.equal(body, 'temp_landing', 'Got temporary landing content')
+    passed += 1
+    done()
+  })
+  
+  request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(!hits.temp_landing, 'No chasing the redirect')
+    assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+    passed += 1
+    done()
+  })
+
+  // Should not follow delete redirects by default
+  request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode < 301) throw new Error('Status is not a redirect.')
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(!hits.temp_landing, 'No chasing the redirect when delete')
+    assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+    passed += 1
+    done()
+  })
+  
+  // Should not follow delete redirects even if followRedirect is set to true
+  request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode)
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(!hits.temp_landing, 'No chasing the redirect when delete')
+    assert.equal(res.statusCode, 301, 'Response is the bounce itself')
+    passed += 1
+    done()
+  })
+  
+  // Should follow delete redirects when followAllRedirects true
+  request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) {
+    if (er) throw er
+    if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode)
+    assert.ok(hits.temp, 'Original request is to /temp')
+    assert.ok(hits.temp_landing, 'Forward to temporary landing URL')
+    assert.equal(body, 'temp_landing', 'Got temporary landing content')
+    passed += 1
+    done()
+  })
+
+  var reqs_done = 0;
+  function done() {
+    reqs_done += 1;
+    if(reqs_done == 9) {
+      console.log(passed + ' tests passed.')
+      s.close()
+    }
+  }
+})
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-s3.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-s3.js
new file mode 100755 (executable)
index 0000000..0f6a832
--- /dev/null
@@ -0,0 +1,13 @@
+var request = require('../index')
+
+var r = request.get('https://log.curlybracecast.com.s3.amazonaws.com/', 
+  { aws: 
+    { key: 'AKIAI6KIQRRVMGK3WK5Q'
+    , secret: 'j4kaxM7TUiN7Ou0//v1ZqOVn3Aq7y1ccPh/tHTna'
+    , bucket: 'log.curlybracecast.com'
+    }
+  }, function (e, resp, body) {
+    console.log(r.headers)
+    console.log(body)
+  }
+)
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-timeout.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-timeout.js
new file mode 100755 (executable)
index 0000000..7036367
--- /dev/null
@@ -0,0 +1,87 @@
+var server = require('./server')
+  , events = require('events')
+  , stream = require('stream')
+  , assert = require('assert')
+  , request = require('../index')
+  ;
+
+var s = server.createServer();
+var expectedBody = "waited";
+var remainingTests = 5;
+
+s.listen(s.port, function () {
+  // Request that waits for 200ms
+  s.on('/timeout', function (req, resp) {
+    setTimeout(function(){
+      resp.writeHead(200, {'content-type':'text/plain'})
+      resp.write(expectedBody)
+      resp.end()
+    }, 200);
+  });
+
+  // Scenario that should timeout
+  var shouldTimeout = {
+    url: s.url + "/timeout",
+    timeout:100
+  }
+
+
+  request(shouldTimeout, function (err, resp, body) {
+    assert.equal(err.code, "ETIMEDOUT");
+    checkDone();
+  })
+
+
+  // Scenario that shouldn't timeout
+  var shouldntTimeout = {
+    url: s.url + "/timeout",
+    timeout:300
+  }
+
+  request(shouldntTimeout, function (err, resp, body) {
+    assert.equal(err, null);
+    assert.equal(expectedBody, body)
+    checkDone();
+  })
+
+  // Scenario with no timeout set, so shouldn't timeout
+  var noTimeout = {
+    url: s.url + "/timeout"
+  }
+
+  request(noTimeout, function (err, resp, body) {
+    assert.equal(err);
+    assert.equal(expectedBody, body)
+    checkDone();
+  })
+
+  // Scenario with a negative timeout value, should be treated a zero or the minimum delay
+  var negativeTimeout = {
+    url: s.url + "/timeout",
+    timeout:-1000
+  }
+
+  request(negativeTimeout, function (err, resp, body) {
+    assert.equal(err.code, "ETIMEDOUT");
+    checkDone();
+  })
+
+  // Scenario with a float timeout value, should be rounded by setTimeout anyway
+  var floatTimeout = {
+    url: s.url + "/timeout",
+    timeout: 100.76
+  }
+
+  request(floatTimeout, function (err, resp, body) {
+    assert.equal(err.code, "ETIMEDOUT");
+    checkDone();
+  })
+
+  function checkDone() {
+    if(--remainingTests == 0) {
+      s.close();
+      console.log("All tests passed.");
+    }
+  }
+})
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-toJSON.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-toJSON.js
new file mode 100755 (executable)
index 0000000..6d5f92a
--- /dev/null
@@ -0,0 +1,14 @@
+var request = require('../index')
+  , http = require('http')
+  , assert = require('assert')
+  ;
+
+var s = http.createServer(function (req, resp) {
+  resp.statusCode = 200
+  resp.end('asdf')
+}).listen(8080, function () {
+  var r = request('http://localhost:8080', function (e, resp) {
+    assert.equal(JSON.parse(JSON.stringify(r)).response.statusCode, 200)
+    s.close()
+  })
+})
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-tunnel.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/test-tunnel.js
new file mode 100755 (executable)
index 0000000..2ee3f39
--- /dev/null
@@ -0,0 +1,75 @@
+// test that we can tunnel a https request over an http proxy
+// keeping all the CA and whatnot intact.
+//
+// Note: this requires that squid is installed.
+// If the proxy fails to start, we'll just log a warning and assume success.
+
+var server = require('./server')
+  , assert = require('assert')
+  , request = require('../index')
+  , fs = require('fs')
+  , path = require('path')
+  , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt')
+  , ca = fs.readFileSync(caFile)
+  , child_process = require('child_process')
+  , sqConf = path.resolve(__dirname, 'squid.conf')
+  , sqArgs = ['-f', sqConf, '-N', '-d', '5']
+  , proxy = 'http://localhost:3128'
+  , hadError = null
+
+var squid = child_process.spawn('squid', sqArgs);
+var ready = false
+
+squid.stderr.on('data', function (c) {
+  console.error('SQUIDERR ' + c.toString().trim().split('\n')
+               .join('\nSQUIDERR '))
+  ready = c.toString().match(/ready to serve requests|Accepting HTTP Socket connections/i)
+})
+
+squid.stdout.on('data', function (c) {
+  console.error('SQUIDOUT ' + c.toString().trim().split('\n')
+               .join('\nSQUIDOUT '))
+})
+
+squid.on('error', function (c) {
+  console.error('squid: error '+c)
+  if (c && !ready) {
+    notInstalled()
+    return
+  }
+})
+
+squid.on('exit', function (c) {
+  console.error('squid: exit '+c)
+  if (c && !ready) {
+    notInstalled()
+    return
+  }
+
+  if (c) {
+    hadError = hadError || new Error('Squid exited with '+c)
+  }
+  if (hadError) throw hadError
+})
+
+setTimeout(function F () {
+  if (!ready) return setTimeout(F, 100)
+  request({ uri: 'https://registry.npmjs.org/'
+          , proxy: 'http://localhost:3128'
+          , strictSSL: true
+          , ca: ca
+          , json: true }, function (er, body) {
+    hadError = er
+    console.log(er || typeof body)
+    if (!er) console.log("ok")
+    squid.kill('SIGKILL')
+  })
+}, 100)
+
+function notInstalled() {
+  console.error('squid must be installed to run this test.')
+  console.error('skipping this test. please install squid and run again if you need to test tunneling.')
+  c = null
+  hadError = null
+  process.exit(0)
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/unicycle.jpg b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/unicycle.jpg
new file mode 100755 (executable)
index 0000000..7cea4dd
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/node_modules/request/tests/unicycle.jpg differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/CHANGELOG.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/CHANGELOG.md
new file mode 100755 (executable)
index 0000000..85dc5bb
--- /dev/null
@@ -0,0 +1,46 @@
+## 0.8.2 / 2014-11-04
+
+* [Full fix for #296 with proper streams2 detection with `isstream` for file transport (`jcrugzz`)](https://github.com/flatiron/winston/commit/5c4bd4191468570e46805ed399cad63cfb1856cc)
+* [Add isstream module (`jcrugzz`)](https://github.com/flatiron/winston/commit/498b216d0199aebaef72ee4d8659a00fb737b9ae)
+* [Partially fix #296 with streams2 detection for file transport (`indexzero`)](https://github.com/flatiron/winston/commit/b0227b6c27cf651ffa8b8192ef79ab24296362e3)
+* [add stress test for issue #288 (`indexzero`)](https://github.com/flatiron/winston/commit/e08e504b5b3a00f0acaade75c5ba69e6439c84a6)
+* [lessen timeouts to check test sanity (`indexzero`)](https://github.com/flatiron/winston/commit/e925f5bc398a88464f3e796545ff88912aff7568)
+* [update winston-graylog2 documentation (`unlucio`)](https://github.com/flatiron/winston/commit/49fa86c31baf12c8ac3adced3bdba6deeea2e363)
+* [fix test formatting (`indexzero`)](https://github.com/flatiron/winston/commit/8e2225799520a4598044cdf93006d216812a27f9)
+* [fix so options are not redefined (`indexzero`)](https://github.com/flatiron/winston/commit/d1d146e8a5bb73dcb01579ad433f6d4f70b668ea)
+* [fix self/this issue that broke `http` transport (`indexzero`)](https://github.com/flatiron/winston/commit/d10cbc07755c853b60729ab0cd14aa665da2a63b)
+
+
+## 0.8.1 / 2014-10-06
+
+* [Add label option for DailyRotateFile transport (`francoisTemasys`)](https://github.com/flatiron/winston/pull/459)
+* [fix Logger#transports length check upon Logger#log (`adriano-di-giovanni`, `indexzero`)](https://github.com/flatiron/winston/pull/404)
+* [err can be a string. (`gdw2`, `indexzero`)](https://github.com/flatiron/winston/pull/396)
+* [Added color for pre-defined cli set. (`danilo1105`, `indexzero`)](https://github.com/flatiron/winston/pull/365)
+* [Fix dates on transport test (`revington`)](https://github.com/flatiron/winston/pull/346)
+* [Included the label from options to the output in JSON mode. (`arxony`)](https://github.com/flatiron/winston/pull/326)
+* [Allow using logstash option with the File transport (`gmajoulet`)](https://github.com/flatiron/winston/pull/299)
+* [Be more defensive when working with `query` methods from Transports. Fixes #356. (indexzero)](https://github.com/flatiron/winston/commit/b80638974057f74b521dbe6f43fef2105110afa2)
+* [Catch exceptions for file transport unlinkSync (`calvinfo`)](https://github.com/flatiron/winston/pull/266)
+* [Adding the 'addRewriter' to winston (`machadogj`)](https://github.com/flatiron/winston/pull/258)
+* [Updates to transport documentation (`pose`)](https://github.com/flatiron/winston/pull/262)
+* [fix typo in "Extending another object with Logging" section.](https://github.com/flatiron/winston/pull/281)
+* [Updated README.md - Replaced properties with those listed in winston-mongodb module](https://github.com/flatiron/winston/pull/264)
+
+## 0.8.0 / 2014-09-15
+  * [Fixes for HTTP Transport](https://github.com/flatiron/winston/commit/a876a012641f8eba1a976eada15b6687d4a03f82)
+  * Removing [jsonquest](https://github.com/flatiron/winston/commit/4f088382aeda28012b7a0498829ceb243ed74ac1) and [request](https://github.com/flatiron/winston/commit/a5676313b4e9744802cc3b8e1468e4af48830876) dependencies.
+  * Configuration is now [shalow cloned](https://github.com/flatiron/winston/commit/08fccc81d18536d33050496102d98bde648853f2).
+  * [Added logstash support](https://github.com/flatiron/winston/pull/445/files)
+  * Fix for ["flush" event should always fire after "flush" call bug](https://github.com/flatiron/winston/pull/446/files)
+  * Added tests for file: [open and stress](https://github.com/flatiron/winston/commit/47d885797a2dd0d3cd879305ca813a0bd951c378).
+  * [Test fixes](https://github.com/flatiron/winston/commit/9e39150e0018f43d198ca4c160acef2af9860bf4)
+  * [Fix ")" on string interpolation](https://github.com/flatiron/winston/pull/394/files)
+
+## 0.6.2 / 2012-07-08
+
+  * Added prettyPrint option for console logging
+  * Multi-line values for conditional returns are not allowed
+  * Added acceptance of `stringify` option
+  * Fixed padding for log levels
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/LICENSE
new file mode 100755 (executable)
index 0000000..948d80d
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Charlie Robbins
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/README.md
new file mode 100755 (executable)
index 0000000..9503151
--- /dev/null
@@ -0,0 +1,901 @@
+# winston [![Build Status](https://secure.travis-ci.org/flatiron/winston.png?branch=master)](http://travis-ci.org/flatiron/winston)
+
+A multi-transport async logging library for node.js. <span style="font-size:28px; font-weight:bold;">&quot;CHILL WINSTON! ... I put it in the logs.&quot;</span>
+
+## Motivation
+Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.
+
+There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible.
+
+## Installation
+
+```bash
+npm install winston
+```
+
+## Usage
+There are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose.
+
+* [Logging](#logging)
+  * [Using the Default Logger](#using-the-default-logger)
+  * [Instantiating your own Logger](#instantiating-your-own-logger)
+  * [Logging with Metadata](#logging-with-metadata)
+  * [String interpolation ](#string-interpolation)
+* [Transports](https://github.com/flatiron/winston/blob/master/docs/transports.md)
+* [Profiling](#profiling)
+* [Streaming Logs](#streaming-logs)
+* [Querying Logs](#querying-logs)
+* [Exceptions](#exceptions)
+  * [Handling Uncaught Exceptions with winston](#handling-uncaught-exceptions-with-winston)
+  * [To Exit or Not to Exit](#to-exit-or-not-to-exit)
+* [Logging Levels](#logging-levels)
+  * [Using Logging Levels](#using-logging-levels)
+  * [Using Custom Logging Levels](#using-custom-logging-levels)
+* [Further Reading](#further-reading)
+  * [Events and Callbacks in Winston](#events-and-callbacks-in-winston)
+  * [Working with multiple Loggers in winston](#working-with-multiple-loggers-in-winston)
+  * [Using winston in a CLI tool](#using-winston-in-a-cli-tool)
+  * [Extending another object with Logging](#extending-another-object-with-logging)
+* [Working with transports](#working-with-transports)
+       * [Adding Custom Transports](#adding-custom-transports)
+* [Installation](#installation)
+* [Run Tests](#run-tests)
+
+
+## Logging
+
+### Using the Default Logger
+The default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger:
+
+``` js
+  var winston = require('winston');
+
+  winston.log('info', 'Hello distributed log files!');
+  winston.info('Hello again distributed logs');
+```
+
+By default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods:
+
+``` js
+  winston.add(winston.transports.File, { filename: 'somefile.log' });
+  winston.remove(winston.transports.Console);
+```
+
+For more documentation about working with each individual transport supported by Winston see the [Working with transports](#working-with-transports) section below.
+
+### Instantiating your own Logger
+If you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself:
+
+``` js
+  var logger = new (winston.Logger)({
+    transports: [
+      new (winston.transports.Console)(),
+      new (winston.transports.File)({ filename: 'somefile.log' })
+    ]
+  });
+```
+
+You can work with this logger in the same way that you work with the default logger:
+
+``` js
+  //
+  // Logging
+  //
+  logger.log('info', 'Hello distributed log files!');
+  logger.info('Hello again distributed logs');
+
+  //
+  // Adding / Removing Transports
+  //   (Yes It's chainable)
+  //
+  logger.add(winston.transports.File)
+        .remove(winston.transports.Console);
+```
+
+### Logging with Metadata
+In addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple:
+
+``` js
+  winston.log('info', 'Test Log Message', { anything: 'This is metadata' });
+```
+
+The way these objects are stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata:
+
+1. __Console:__ Logged via util.inspect(meta)
+2. __File:__ Logged via util.inspect(meta)
+
+## Profiling
+In addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger:
+
+``` js
+  //
+  // Start profile of 'test'
+  // Remark: Consider using Date.now() with async operations
+  //
+  winston.profile('test');
+
+  setTimeout(function () {
+    //
+    // Stop profile of 'test'. Logging will now take place:
+    //   "17 Jan 21:00:00 - info: test duration=1000ms"
+    //
+    winston.profile('test');
+  }, 1000);
+```
+
+All profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues.
+
+### String interpolation
+The `log` method provides the same string interpolation methods like [`util.format`][10].
+
+This allows for the following log messages.
+``` js
+logger.log('info', 'test message %s', 'my string');
+// info: test message my string
+
+logger.log('info', 'test message %d', 123);
+// info: test message 123
+
+logger.log('info', 'test message %j', {number: 123}, {});
+// info: test message {"number":123}
+// meta = {}
+
+logger.log('info', 'test message %s, %s', 'first', 'second', {number: 123});
+// info: test message first, second
+// meta = {number: 123}
+
+logger.log('info', 'test message', 'first', 'second', {number: 123});
+// info: test message first second
+// meta = {number: 123}
+
+logger.log('info', 'test message %s, %s', 'first', 'second', {number: 123}, function(){});
+// info: test message first, second
+// meta = {numer: 123}
+// callback = function(){}
+
+logger.log('info', 'test message', 'first', 'second', {number: 123}, function(){});
+// info: test message first second
+// meta = {numer: 123}
+// callback = function(){}
+```
+
+
+
+
+
+## Querying Logs
+Winston supports querying of logs with Loggly-like options. [See Loggly Search API](http://wiki.loggly.com/retrieve_events#optional).
+Specifically: `File`, `Couchdb`, `Redis`, `Loggly`, `Nssocket`, and `Http`.
+
+``` js
+  var options = {
+    from: new Date - 24 * 60 * 60 * 1000,
+    until: new Date,
+    limit: 10,
+    start: 0,
+    order: 'desc',
+    fields: ['message']
+  };
+
+  //
+  // Find items logged between today and yesterday.
+  //
+  winston.query(options, function (err, results) {
+    if (err) {
+      throw err;
+    }
+
+    console.log(results);
+  });
+```
+
+## Streaming Logs
+Streaming allows you to stream your logs back from your chosen transport.
+
+``` js
+  //
+  // Start at the end.
+  //
+  winston.stream({ start: -1 }).on('log', function(log) {
+    console.log(log);
+  });
+```
+
+## Exceptions
+
+### Handling Uncaught Exceptions with winston
+
+With `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance.
+
+If you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance.
+
+``` js
+  //
+  // You can add a separate exception logger by passing it to `.handleExceptions`
+  //
+  winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' }))
+
+  //
+  // Alternatively you can set `.handleExceptions` to true when adding transports to winston
+  //
+  winston.add(winston.transports.File, {
+    filename: 'path/to/all-logs.log',
+    handleExceptions: true
+  });
+```
+
+### To Exit or Not to Exit
+
+By default, winston will exit after logging an uncaughtException. if this is not the behavior you want,
+set `exitOnError = false`
+
+``` js
+  var logger = new (winston.Logger)({ exitOnError: false });
+
+  //
+  // or, like this:
+  //
+  logger.exitOnError = false;
+```
+
+When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport.
+
+Example 1
+
+``` js
+  var logger = new (winston.Logger)({
+    transports: [
+      new winston.transports.File({ filename: 'path/to/all-logs.log' })
+    ],
+    exceptionHandlers: [
+      new winston.transports.File({ filename: 'path/to/exceptions.log' })
+    ]
+  });
+```
+
+Example 2
+
+```
+var logger = new winston.Logger({
+  transports: [
+    new winston.transports.Console({
+      handleExceptions: true,
+      json: true
+    })
+  ],
+  exitOnError: false
+});
+```
+
+The `exitOnError` option can also be a function to prevent exit on only certain types of errors:
+
+``` js
+  function ignoreEpipe(err) {
+    return err.code !== 'EPIPE';
+  }
+
+  var logger = new (winston.Logger)({ exitOnError: ignoreEpipe });
+
+  //
+  // or, like this:
+  //
+  logger.exitOnError = ignoreEpipe;
+```
+
+## Logging Levels
+
+### Using Logging Levels
+Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger.
+
+``` js
+  //
+  // Any logger instance
+  //
+  logger.log('silly', "127.0.0.1 - there's no place like home");
+  logger.log('debug', "127.0.0.1 - there's no place like home");
+  logger.log('verbose', "127.0.0.1 - there's no place like home");
+  logger.log('info', "127.0.0.1 - there's no place like home");
+  logger.log('warn', "127.0.0.1 - there's no place like home");
+  logger.log('error', "127.0.0.1 - there's no place like home");
+  logger.info("127.0.0.1 - there's no place like home");
+  logger.warn("127.0.0.1 - there's no place like home");
+  logger.error("127.0.0.1 - there's no place like home");
+
+  //
+  // Default logger
+  //
+  winston.log('info', "127.0.0.1 - there's no place like home");
+  winston.info("127.0.0.1 - there's no place like home");
+```
+
+Winston allows you to set a `level` on each transport that specifies the level of messages this transport should log. For example, you could log only errors to the console, with the full logs in a file (note that the default level of a transport is `info`):
+
+``` js
+  var logger = new (winston.Logger)({
+    transports: [
+      new (winston.transports.Console)({ level: 'error' }),
+      new (winston.transports.File)({ filename: 'somefile.log' })
+    ]
+  });
+```
+
+You may also dynamically change the log level of a transport:
+
+``` js
+  var logger = new (winston.Logger)({
+    transports: [
+      new (winston.transports.Console)({ level: 'warn' }),
+      new (winston.transports.File)({ filename: 'somefile.log', level: 'error' })
+    ]
+  });
+  logger.debug("Will not be logged in either transport!");
+  logger.transports.console.level = 'debug';
+  logger.transports.file.level = 'verbose';
+  logger.verbose("Will be logged in both transports!");
+```
+
+As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy:
+
+``` js
+  //
+  // Change levels on the default winston logger
+  //
+  winston.setLevels(winston.config.syslog.levels);
+
+  //
+  // Change levels on an instance of a logger
+  //
+  logger.setLevels(winston.config.syslog.levels);
+```
+
+Calling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels:
+
+``` js
+  //
+  // Logger does not have 'silly' defined since that level is not in the syslog levels
+  //
+  logger.silly('some silly message');
+```
+
+### Using Custom Logging Levels
+In addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own:
+
+``` js
+  var myCustomLevels = {
+    levels: {
+      foo: 0,
+      bar: 1,
+      baz: 2,
+      foobar: 3
+    },
+    colors: {
+      foo: 'blue',
+      bar: 'green',
+      baz: 'yellow',
+      foobar: 'red'
+    }
+  };
+
+  var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels });
+  customLevelLogger.foobar('some foobar level-ed message');
+```
+
+Although there is slight repetition in this data structure, it enables simple encapsulation if you not to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them:
+
+``` js
+  //
+  // Make winston aware of these colors
+  //
+  winston.addColors(myCustomLevels.colors);
+```
+
+This enables transports with the 'colorize' option set to appropriately color the output of custom levels.
+
+## Further Reading
+
+### Events and Callbacks in Winston
+Each instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message:
+
+``` js
+  logger.on('logging', function (transport, level, msg, meta) {
+    // [msg] and [meta] have now been logged at [level] to [transport]
+  });
+
+  logger.info('CHILL WINSTON!', { seriously: true });
+```
+
+It is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions:
+
+``` js
+  //
+  // Handle errors
+  //
+  logger.on('error', function (err) { /* Do Something */ });
+
+  //
+  // Or just suppress them.
+  //
+  logger.emitErrs = false;
+```
+
+Every logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message.
+
+``` js
+  logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) {
+    // [msg] and [meta] have now been logged at [level] to **every** transport.
+  });
+```
+
+### Working with multiple Loggers in winston
+
+Often in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`:
+
+``` js
+  var winston = require('winston');
+
+  //
+  // Configure the logger for `category1`
+  //
+  winston.loggers.add('category1', {
+    console: {
+      level: 'silly',
+      colorize: 'true',
+      label: 'category one'
+    },
+    file: {
+      filename: '/path/to/some/file'
+    }
+  });
+
+  //
+  // Configure the logger for `category2`
+  //
+  winston.loggers.add('category2', {
+    couchdb: {
+      host: '127.0.0.1',
+      port: 5984
+    }
+  });
+```
+
+Now that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers:
+
+``` js
+  var winston = require('winston');
+
+  //
+  // Grab your preconfigured logger
+  //
+  var category1 = winston.loggers.get('category1');
+
+  category1.info('logging from your IoC container-based logger');
+```
+
+If you prefer to manage the `Container` yourself you can simply instantiate one:
+
+``` js
+  var winston = require('winston'),
+      container = new winston.Container();
+
+  container.add('category1', {
+    console: {
+      level: 'silly',
+      colorize: 'true'
+    },
+    file: {
+      filename: '/path/to/some/file'
+    }
+  });
+```
+
+### Sharing transports between Loggers in winston
+
+``` js
+  var winston = require('winston');
+
+  //
+  // Setup transports to be shared across all loggers
+  // in three ways:
+  //
+  // 1. By setting it on the default Container
+  // 2. By passing `transports` into the constructor function of winston.Container
+  // 3. By passing `transports` into the `.get()` or `.add()` methods
+  //
+
+  //
+  // 1. By setting it on the default Container
+  //
+  winston.loggers.options.transports = [
+    // Setup your shared transports here
+  ];
+
+  //
+  // 2. By passing `transports` into the constructor function of winston.Container
+  //
+  var container = new winston.Container({
+    transports: [
+      // Setup your shared transports here
+    ]
+  });
+
+  //
+  // 3. By passing `transports` into the `.get()` or `.add()` methods
+  //
+  winston.loggers.add('some-category', {
+    transports: [
+      // Setup your shared transports here
+    ]
+  });
+
+  container.add('some-category', {
+    transports: [
+      // Setup your shared transports here
+    ]
+  });
+```
+
+### Using winston in a CLI tool
+A common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][2] written by [Nodejitsu][3]:
+
+```
+  info:   require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer
+  info:   Found existing dependencies
+  data:   {
+  data:     colors: '0.x.x',
+  data:     eyes: '0.1.x',
+  data:     findit: '0.0.x',
+  data:     npm: '1.0.x',
+  data:     optimist: '0.2.x',
+  data:     semver: '1.0.x',
+  data:     winston: '0.2.x'
+  data:   }
+  info:   Analyzing dependencies...
+  info:   Done analyzing raw dependencies
+  info:   Retrieved packages from npm
+  warn:   No additional dependencies found
+```
+
+Configuring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`:
+
+``` js
+  var winston = require('winston');
+
+  //
+  // Configure CLI output on the default logger
+  //
+  winston.cli();
+
+  //
+  // Configure CLI on an instance of winston.Logger
+  //
+  var logger = new winston.Logger({
+    transports: [
+      new (winston.transports.Console)()
+    ]
+  });
+
+  logger.cli();
+```
+
+### Extending another object with Logging
+Often in a given code base with lots of Loggers it is useful to add logging methods to a different object so that these methods can be called with less syntax. Winston exposes this functionality via the 'extend' method:
+
+``` js
+  var myObject = {};
+
+  logger.extend(myObject);
+
+  //
+  // You can now call logger methods on 'myObject'
+  //
+  myObject.info("127.0.0.1 - there's no place like home");
+```
+
+## Working with Transports
+There are many transports supported by winston core. If you have a transport you would like to add either open an issue or fork and submit a pull request. Commits are welcome, but I'll give you extra street cred if you __add tests too :D__
+
+
+### Console Transport
+``` js
+  winston.add(winston.transports.Console, options)
+```
+
+The Console transport takes a few simple options:
+
+* __level:__ Level of messages that this transport should log (default 'info').
+* __silent:__ Boolean flag indicating whether to suppress output (default false).
+* __colorize:__ Boolean flag indicating if we should colorize output (default false).
+* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps.
+
+*Metadata:* Logged via util.inspect(meta);
+
+### File Transport
+``` js
+  winston.add(winston.transports.File, options)
+```
+
+The File transport should really be the 'Stream' transport since it will accept any [WritableStream][14]. It is named such because it will also accept filenames via the 'filename' option:
+
+* __level:__ Level of messages that this transport should log.
+* __silent:__ Boolean flag indicating whether to suppress output.
+* __colorize:__ Boolean flag indicating if we should colorize output.
+* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default true). If function is specified, its return value will be used instead of timestamps.
+* __filename:__ The filename of the logfile to write output to.
+* __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created.
+* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
+* __stream:__ The WriteableStream to write output to.
+* __json:__ If true, messages will be logged as JSON (default true).
+* __logstash:__ If true, messages will be logged as JSON and formatted for logstash (default false).
+
+*Metadata:* Logged via util.inspect(meta);
+
+### Loggly Transport
+``` js
+  var Loggly = require('winston-loggly').Loggly
+  winston.add(Loggly, options);
+```
+
+The Loggly transport is based on [Nodejitsu's][3] [node-loggly][6] implementation of the [Loggly][7] API. If you haven't heard of Loggly before, you should probably read their [value proposition][8]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required:
+
+* __level:__ Level of messages that this transport should log.
+* __subdomain:__ The subdomain of your Loggly account. *[required]*
+* __auth__: The authentication information for your Loggly account. *[required with inputName]*
+* __inputName:__ The name of the input this instance should log to.
+* __inputToken:__ The input token of the input this instance should log to.
+* __json:__ If true, messages will be sent to Loggly as JSON.
+
+*Metadata:* Logged in suggested [Loggly format][2]
+
+### Riak Transport
+As of `0.3.0` the Riak transport has been broken out into a new module: [winston-riak][17]. Using it is just as easy:
+
+``` js
+  var Riak = require('winston-riak').Riak;
+  winston.add(Riak, options);
+```
+
+In addition to the options accepted by the [riak-js][3] [client][4], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default:
+
+* __level:__ Level of messages that this transport should log.
+* __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically.
+
+``` js
+  // Use a single bucket for all your logs
+  var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' });
+
+  // Generate a dynamic bucket based on the date and level
+  var dynamicBucketTransport = new (Riak)({
+    bucket: function (level, msg, meta, now) {
+      var d = new Date(now);
+      return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-');
+    }
+  });
+```
+
+*Metadata:* Logged as JSON literal in Riak
+
+### MongoDB Transport
+As of `0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][16]. Using it is just as easy:
+
+``` js
+  var MongoDB = require('winston-mongodb').MongoDB;
+  winston.add(MongoDB, options);
+```
+
+For more information about its arguments, check [winston-mongodb's README][16].
+
+### SimpleDB Transport
+
+The [winston-simpledb][18] transport is just as easy:
+
+``` js
+  var SimpleDB = require('winston-simpledb').SimpleDB;
+  winston.add(SimpleDB, options);
+```
+
+The SimpleDB transport takes the following options. All items marked with an asterisk are required:
+
+* __awsAccessKey__:* your AWS Access Key
+* __secretAccessKey__:* your AWS Secret Access Key
+* __awsAccountId__:* your AWS Account Id
+* __domainName__:* a string or function that returns the domain name to log to
+* __region__:* the region your domain resides in
+* __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log
+
+*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.
+
+### Mail Transport
+
+The [winston-mail][19] is an email transport:
+
+``` js
+  var Mail = require('winston-mail').Mail;
+  winston.add(Mail, options);
+```
+
+The Mail transport uses [emailjs](https://github.com/eleith/emailjs) behind the scenes.  Options are the following:
+
+* __to:__ The address(es) you want to send to. *[required]*
+* __from:__ The address you want to send from. (default: `winston@[server-host-name]`)
+* __host:__ SMTP server hostname (default: localhost)
+* __port:__ SMTP port (default: 587 or 25)
+* __username__ User for server auth
+* __password__ Password for server auth
+* __ssl:__ Use SSL (boolean or object { key, ca, cert })
+* __tls:__ Boolean (if true, use starttls)
+* __level:__ Level of messages that this transport should log.
+* __silent:__ Boolean flag indicating whether to suppress output.
+
+*Metadata:* Stringified as JSON in email.
+
+### Amazon SNS (Simple Notification System) Transport
+
+The [winston-sns][21] transport uses amazon SNS to send emails, texts, or a bunch of other notifications.
+
+``` js
+  require('winston-sns').SNS;
+  winston.add(winston.transports.SNS, options);
+```
+
+Options:
+
+* __aws_key:__ Your Amazon Web Services Key. *[required]*
+* __aws_secret:__ Your Amazon Web Services Secret. *[required]*
+* __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]*
+* __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]*
+* __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`)
+* __subject:__ Subject for notifications. (default: "Winston Error Report")
+* __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m")
+* __level:__ lowest level this transport will log. (default: `info`)
+
+### Graylog2 Transport
+
+[winston-graylog2][22] is a Graylog2 transport:
+
+``` js
+  var Graylog2 = require('winston-graylog2').Graylog2;
+  winston.add(Graylog2, options);
+```
+
+The Graylog2 transport connects to a Graylog2 server over UDP using the following options:
+
+* __level:__ Level of messages this transport should log. (default: info)
+* __silent:__ Boolean flag indicating whether to suppress output. (default: false)
+
+* __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost)
+* __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201)
+* __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname())
+* __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs)
+
+*Metadata:* Stringified as JSON in the full message GELF field.
+
+### Papertrail Transport
+
+[winston-papertrail][23] is a Papertrail transport:
+
+``` js
+  var Papertrail = require('winston-papertrail').Papertrail;
+  winston.add(Papertrail, options);
+```
+
+The Papertrail transport connects to a [PapertrailApp log destination](https://papertrailapp.com) over TCP (TLS) using the following options:
+
+* __level:__ Level of messages this transport should log. (default: info)
+* __host:__ FQDN or IP address of the Papertrail endpoint.
+* __port:__ Port for the Papertrail log destination.
+* __hostname:__ The hostname associated with messages. (default: require('os').hostname())
+* __program:__ The facility to send log messages.. (default: default)
+* __logFormat:__ a log formatting function with the signature `function(level, message)`, which allows custom formatting of the level or message prior to delivery
+
+*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.
+
+### Cassandra Transport
+
+[winston-cassandra][24] is a Cassandra transport:
+
+``` js
+  var Cassandra = require('winston-cassandra').Cassandra;
+  winston.add(Cassandra, options);
+```
+
+The Cassandra transport connects to a cluster using the native protocol with the following options:
+
+* __level:__ Level of messages that this transport should log (default: `'info'`).
+* __table:__ The name of the Cassandra column family you want to store log messages in (default: `'logs'`).
+* __partitionBy:__ How you want the logs to be partitioned. Possible values `'hour'` and `'day'`(Default).
+* __consistency:__ The consistency of the insert query (default: `quorum`).
+
+In addition to the options accepted by the [Node.js Cassandra driver](https://github.com/jorgebay/node-cassandra-cql) Client.
+
+* __hosts:__ Cluster nodes that will handle the write requests:
+Array of strings containing the hosts, for example `['host1', 'host2']` (required).
+* __keyspace:__ The name of the keyspace that will contain the logs table (required). The keyspace should be already created in the cluster.
+
+### Adding Custom Transports
+Adding a custom transport (say for one of the datastore on the Roadmap) is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston.
+
+``` js
+  var util = require('util'),
+      winston = require('winston');
+
+  var CustomLogger = winston.transports.CustomerLogger = function (options) {
+    //
+    // Name this logger
+    //
+    this.name = 'customLogger';
+
+    //
+    // Set the level from your options
+    //
+    this.level = options.level || 'info';
+
+    //
+    // Configure your storage backing as you see fit
+    //
+  };
+
+  //
+  // Inherit from `winston.Transport` so you can take advantage
+  // of the base functionality and `.handleExceptions()`.
+  //
+  util.inherits(CustomLogger, winston.Transport);
+
+  CustomLogger.prototype.log = function (level, msg, meta, callback) {
+    //
+    // Store this message and metadata, maybe use some custom logic
+    // then callback indicating success.
+    //
+    callback(null, true);
+  };
+```
+
+### Inspirations
+1. [npm][0]
+2. [log.js][4]
+3. [socket.io][5]
+4. [node-rlog][6]
+5. [BigBrother][7]
+6. [Loggly][8]
+
+## Installation
+
+### Installing npm (node package manager)
+```
+  curl http://npmjs.org/install.sh | sh
+```
+
+### Installing winston
+```
+  [sudo] npm install winston
+```
+
+## Run Tests
+All of the winston tests are written in [vows][9], and designed to be run with npm.
+
+``` bash
+  $ npm test
+```
+
+#### Author: [Charlie Robbins](http://twitter.com/indexzero)
+#### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak)
+
+[0]: https://github.com/npm/npmlog/blob/master/log.js
+[1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter
+[2]: http://github.com/nodejitsu/require-analyzer
+[3]: http://nodejitsu.com
+[4]: https://github.com/visionmedia/log.js
+[5]: http://socket.io
+[6]: https://github.com/jbrisbin/node-rlog
+[7]: https://github.com/feisty/BigBrother
+[8]: http://loggly.com
+[9]: http://vowsjs.org
+[10]: http://nodejs.org/api/util.html#util_util_format_format
+[14]: http://nodejs.org/api/stream.html#stream_class_stream_writable
+[16]: https://github.com/indexzero/winston-mongodb
+[17]: https://github.com/indexzero/winston-riak
+[18]: https://github.com/appsattic/winston-simpledb
+[19]: https://github.com/wavded/winston-mail
+[21]: https://github.com/jesseditson/winston-sns
+[22]: https://github.com/flite/winston-graylog2
+[23]: https://github.com/kenperkins/winston-papertrail
+[24]: https://github.com/jorgebay/winston-cassandra
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/docs/transports.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/docs/transports.md
new file mode 100755 (executable)
index 0000000..2737efc
--- /dev/null
@@ -0,0 +1,399 @@
+# Winston Transports
+
+In `winston` a transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.
+
+There are several [core transports](#winston-core) included in `winston`, which leverage the built-in networking and file I/O offered by node.js core. In addition, there are [third-party transports which are supported by the winston core team](#winston-more). And last (but not least) there are [additional transports written by members of the community](#additional-transports).
+
+* **[Winston Core](#winston-core)**
+  * [Console](#console-transport)
+  * [File](#file-transport)
+  * [DailyRotateFile](#dailyrotatefile-transport)
+  * [Http](#http-transport)
+  * [Webhook](#webhook-transport)
+
+* **[Winston More](#winston-more)**
+  * [CouchDB](#couchdb-transport)
+  * [Loggly](#loggly-transport)
+  * [MongoDB](#mongodb-transport)
+  * [Redis](#redis-transport)
+  * [Riak](#riak-transport)
+  
+* **[Additional Transports](#additional-transports)**
+  * [SimpleDB](#simpledb-transport)
+  * [Mail](#mail-transport)
+  * [Amazon SNS](#amazon-sns-simple-notification-system-transport)
+  * [Graylog2](#graylog2-transport)
+
+## Winston Core
+
+There are several core transports included in `winston`, which leverage the built-in networking and file I/O offered by node.js core.  
+
+* [Console](#console-transport)
+* [File](#file-transport)
+* [DailyRotateFile](#dailyrotatefile-transport)
+* [Http](#http-transport)
+* [Webhook](#webhook-transport)
+
+### Console Transport
+
+``` js
+  winston.add(winston.transports.Console, options)
+```
+
+The Console transport takes four simple options:
+
+* __level:__ Level of messages that this transport should log (default 'debug').
+* __silent:__ Boolean flag indicating whether to suppress output (default false).
+* __colorize:__ Boolean flag indicating if we should colorize output (default false).
+* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps.
+
+*Metadata:* Logged via util.inspect(meta);
+
+### File Transport
+
+``` js
+  winston.add(winston.transports.File, options)
+```
+
+The File transport should really be the 'Stream' transport since it will accept any [WritableStream][0]. It is named such because it will also accept filenames via the 'filename' option:
+
+* __level:__ Level of messages that this transport should log.
+* __silent:__ Boolean flag indicating whether to suppress output.
+* __colorize:__ Boolean flag indicating if we should colorize output.
+* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps.
+* __filename:__ The filename of the logfile to write output to.
+* __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created.
+* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
+* __stream:__ The WriteableStream to write output to.
+* __json:__ If true, messages will be logged as JSON (default true).
+
+*Metadata:* Logged via util.inspect(meta);
+
+### DailyRotateFile Transport
+
+``` js
+  winston.add(winston.transports.DailyRotateFile, options)
+```
+
+The DailyRotateFile transport can rotate files by minute, hour, day, month or year. Its options are identical to the File transport with the lone addition of the 'datePattern' option:
+
+* __datePattern:__ A string representing the pattern to be used when appending the date to the filename (default '.yyyy-MM-dd'). The meta characters used in this string will dictate the frequency of the file rotation. For example if your datePattern is simply '.HH' you will end up with 24 log files that are picked up and appended to every day.
+
+Valid meta characters in the datePattern are:
+
+* __yy:__ Last two digits of the year.
+* __yyyy:__ Full year.
+* __M:__ The month.
+* __MM:__ The zero padded month.
+* __d:__ The day.
+* __dd:__ The zero padded day.
+* __H:__ The hour.
+* __HH:__ The zero padded hour.
+* __m:__ The minute.
+* __mm:__ The zero padded minute.
+
+*Metadata:* Logged via util.inspect(meta);
+
+### Http Transport
+
+``` js
+  winston.add(winston.transports.Http, options)
+```
+
+The `Http` transport is a generic way to log, query, and stream logs from an arbitrary Http endpoint, preferably [winstond][1]. It takes options that are passed to the node.js `http` or `https` request:
+
+* __host:__ (Default: **localhost**) Remote host of the HTTP logging endpoint
+* __port:__ (Default: **80 or 443**) Remote port of the HTTP logging endpoint
+* __path:__ (Default: **/**) Remote URI of the HTTP logging endpoint 
+* __auth:__ (Default: **None**) An object representing the `username` and `password` for HTTP Basic Auth
+* __ssl:__ (Default: **false**) Value indicating if we should us HTTPS
+
+## Winston More
+
+Starting with `winston@0.3.0` an effort was made to remove any transport which added additional dependencies to `winston`. At the time there were several transports already in `winston` which will **always be supported by the winston core team.**
+
+* [CouchDB](#couchdb-transport)
+* [Redis](#redis-transport)
+* [MongoDB](#mongodb-transport)
+* [Riak](#riak-transport)
+* [Loggly](#loggly-transport)
+
+### CouchDB Transport
+
+_As of `winston@0.6.0` the CouchDB transport has been broken out into a new module: [winston-couchdb][2]._
+
+``` js
+  winston.add(winston.transports.Couchdb, options)
+```
+
+The `Couchdb` will place your logs in a remote CouchDB database. It will also create a [Design Document][3], `_design/Logs` for later querying and streaming your logs from CouchDB. The transport takes the following options:
+
+* __host:__ (Default: **localhost**) Remote host of the HTTP logging endpoint
+* __port:__ (Default: **5984**) Remote port of the HTTP logging endpoint
+* __db:__ (Default: **winston**) Remote URI of the HTTP logging endpoint 
+* __auth:__ (Default: **None**) An object representing the `username` and `password` for HTTP Basic Auth
+* __ssl:__ (Default: **false**) Value indicating if we should us HTTPS
+
+### Redis Transport
+
+``` js
+  winston.add(winston.transports.Redis, options)
+```
+
+This transport accepts the options accepted by the [node-redis][4] client:
+
+* __host:__ (Default **localhost**) Remote host of the Redis server
+* __port:__ (Default **6379**) Port the Redis server is running on.
+* __auth:__ (Default **None**) Password set on the Redis server
+
+In addition to these, the Redis transport also accepts the following options.
+
+* __length:__ (Default **200**) Number of log messages to store.
+* __container:__ (Default **winston**) Name of the Redis container you wish your logs to be in.
+* __channel:__ (Default **None**) Name of the Redis channel to stream logs from. 
+
+*Metadata:* Logged as JSON literal in Redis
+
+### Loggly Transport
+
+_As of `winston@0.6.0` the Loggly transport has been broken out into a new module: [winston-loggly][5]._
+
+``` js
+  winston.add(winston.transports.Loggly, options);
+```
+
+The Loggly transport is based on [Nodejitsu's][6] [node-loggly][7] implementation of the [Loggly][8] API. If you haven't heard of Loggly before, you should probably read their [value proposition][9]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required:
+
+* __level:__ Level of messages that this transport should log.
+* __subdomain:__ The subdomain of your Loggly account. *[required]*
+* __auth__: The authentication information for your Loggly account. *[required with inputName]*
+* __inputName:__ The name of the input this instance should log to.
+* __inputToken:__ The input token of the input this instance should log to.
+* __json:__ If true, messages will be sent to Loggly as JSON.
+
+*Metadata:* Logged in suggested [Loggly format][10]
+
+### Riak Transport
+
+_As of `winston@0.3.0` the Riak transport has been broken out into a new module: [winston-riak][11]._ Using it is just as easy:
+
+``` js
+  var Riak = require('winston-riak').Riak;
+  winston.add(Riak, options);
+```
+
+In addition to the options accepted by the [riak-js][12] [client][13], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default:
+
+* __level:__ Level of messages that this transport should log.
+* __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically.
+
+``` js
+  // Use a single bucket for all your logs
+  var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' });
+
+  // Generate a dynamic bucket based on the date and level
+  var dynamicBucketTransport = new (Riak)({
+    bucket: function (level, msg, meta, now) {
+      var d = new Date(now);
+      return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-');
+    }
+  });
+```
+
+*Metadata:* Logged as JSON literal in Riak
+
+### MongoDB Transport
+
+As of `winston@0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][14]. Using it is just as easy:
+
+``` js
+  var MongoDB = require('winston-mongodb').MongoDB;
+  winston.add(MongoDB, options);
+```
+
+The MongoDB transport takes the following options. 'db' is required:
+
+* __level:__ Level of messages that this transport should log.
+* __silent:__ Boolean flag indicating whether to suppress output.
+* __db:__ The name of the database you want to log to. *[required]*
+* __collection__: The name of the collection you want to store log messages in, defaults to 'log'.
+* __safe:__ Boolean indicating if you want eventual consistency on your log messages, if set to true it requires an extra round trip to the server to ensure the write was committed, defaults to true.
+* __host:__ The host running MongoDB, defaults to localhost.
+* __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port.
+
+*Metadata:* Logged as a native JSON object.
+
+## Additional Transports
+
+The community has truly embraced `winston`; there are over **23** winston transports and over half of them are maintained by authors external to the winston core team. If you want to check them all out, just search `npm`:
+
+``` bash
+  $ npm search winston
+```
+
+**If you have an issue using one of these modules you should contact the module author directly**
+
+### SimpleDB Transport
+
+The [winston-simpledb][15] transport is just as easy:
+
+``` js
+  var SimpleDB = require('winston-simpledb').SimpleDB;
+  winston.add(SimpleDB, options);
+```
+
+The SimpleDB transport takes the following options. All items marked with an asterisk are required:
+
+* __awsAccessKey__:* your AWS Access Key
+* __secretAccessKey__:* your AWS Secret Access Key
+* __awsAccountId__:* your AWS Account Id
+* __domainName__:* a string or function that returns the domain name to log to
+* __region__:* the region your domain resides in
+* __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log
+
+*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.
+
+### Mail Transport
+
+The [winston-mail][16] is an email transport:
+
+``` js
+  var Mail = require('winston-mail').Mail;
+  winston.add(Mail, options);
+```
+
+The Mail transport uses [node-mail][17] behind the scenes.  Options are the following, `to` and `host` are required:
+
+* __to:__ The address(es) you want to send to. *[required]*
+* __from:__ The address you want to send from. (default: `winston@[server-host-name]`)
+* __host:__ SMTP server hostname
+* __port:__ SMTP port (default: 587 or 25)
+* __secure:__ Use secure
+* __username__ User for server auth
+* __password__ Password for server auth
+* __level:__ Level of messages that this transport should log.
+* __silent:__ Boolean flag indicating whether to suppress output.
+
+*Metadata:* Stringified as JSON in email.
+
+### Amazon SNS (Simple Notification System) Transport
+
+The [winston-sns][18] transport uses amazon SNS to send emails, texts, or a bunch of other notifications.
+
+``` js
+  require('winston-sns').SNS;
+  winston.add(winston.transports.SNS, options);
+```
+
+Options:
+
+* __aws_key:__ Your Amazon Web Services Key. *[required]*
+* __aws_secret:__ Your Amazon Web Services Secret. *[required]*
+* __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]*
+* __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]*
+* __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`)
+* __subject:__ Subject for notifications. (default: "Winston Error Report")
+* __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m")
+* __level:__ lowest level this transport will log. (default: `info`)
+
+### Graylog2 Transport
+
+[winston-graylog2][19] is a Graylog2 transport:
+
+``` js
+  var winston = require('winston');
+  winston.add(require('winston-graylog2'), options);
+```
+
+The Graylog2 transport connects to a Graylog2 server over UDP using the following options:
+
+* __name__:  Transport name
+* __level__: Level of messages this transport should log. (default: info)
+* __silent__: Boolean flag indicating whether to suppress output. (default: false)
+* __handleExceptions__: Boolean flag, whenever to handle uncaught exceptions. (default: false)
+* __graylog__:
+  - __servers__; list of graylog2 servers
+    * __host__: your server address (default: localhost)
+    * __port__: your server port (default: 12201)
+  - __hostname__: the name of this host (default: os.hostname())
+  - __facility__: the facility for these log messages (default: "Node.js")
+  - __bufferSize__: max UDP packet size, should never exceed the MTU of your system (default: 1400)
+  
+
+### Cassandra Transport
+
+[winston-cassandra][20] is a Cassandra transport:
+
+``` js
+  var Cassandra = require('winston-cassandra').Cassandra;
+  winston.add(Cassandra, options);
+```
+
+The Cassandra transport connects to a cluster using the native protocol with the following options:
+
+* __level:__ Level of messages that this transport should log (default: `'info'`).
+* __table:__ The name of the Cassandra column family you want to store log messages in (default: `'logs'`).
+* __partitionBy:__ How you want the logs to be partitioned. Possible values `'hour'` and `'day'`(Default).
+* __consistency:__ The consistency of the insert query (default: `quorum`).
+
+In addition to the options accepted by the [Node.js Cassandra driver](https://github.com/jorgebay/node-cassandra-cql) Client.
+
+* __hosts:__ Cluster nodes that will handle the write requests:
+Array of strings containing the hosts, for example `['host1', 'host2']` (required).
+* __keyspace:__ The name of the keyspace that will contain the logs table (required). The keyspace should be already created in the cluster.
+
+
+## Find more Transports
+
+``` bash
+  $ npm search winston
+  (...)
+  winston-amon         Winston transport for Amon logging                            =zoramite    
+  winston-amqp         An AMQP transport for winston                                 =kr1sp1n     
+  winston-cassandra    A Cassandra transport for winston                             =jorgebay    
+  winston-couchdb      a couchdb transport for winston                               =alz         
+  winston-express      Express middleware to let you use winston from the browser.   =regality    
+  winston-graylog2     A graylog2 transport for winston                              =smithclay   
+  winston-hbase        A HBase transport for winston                                 =ddude       
+  winston-loggly       A Loggly transport for winston                                =indexzero   
+  winston-mail         A mail transport for winston                                  =wavded      
+  winston-mail2        A mail transport for winston                                  =ivolo       
+  winston-mongodb      A MongoDB transport for winston                               =indexzero   
+  winston-nodemail     A mail transport for winston                                  =reinpk      
+  winston-nssocket     nssocket transport for winston                                =mmalecki    
+  winston-papertrail   A Papertrail transport for winston                            =kenperkins  
+  winston-redis        A fixed-length Redis transport for winston                    =indexzero   
+  winston-riak         A Riak transport for winston                                  =indexzero   
+  winston-scribe       A scribe transport for winston                                =wnoronha    
+  winston-simpledb     A Winston transport for Amazon SimpleDB                       =chilts      
+  winston-skywriter    A Windows Azure table storage transport for winston           =pofallon    
+  winston-sns          A Simple Notification System Transport for winston            =jesseditson
+  winston-syslog       A syslog transport for winston                                =indexzero   
+  winston-syslog-ain2  An ain2 based syslog transport for winston                    =lamtha      
+  winston-winlog       Windows Event Log logger for Winston                          =jfromaniello
+  winston-zmq          A 0MQ transport for winston                                   =dhendo
+  winston-growl        A growl transport for winston                                 =pgherveou
+
+```
+
+[0]: http://nodejs.org/docs/v0.3.5/api/streams.html#writable_Stream
+[1]: https://github.com/flatiron/winstond
+[2]: https://github.com/indexzero/winston-couchdb
+[3]: http://guide.couchdb.org/draft/design.html
+[4]: https://github.com/mranney/node_redis
+[5]: https://github.com/indexzero/winston-loggly
+[6]: http://nodejitsu.com
+[7]: https://github.com/nodejitsu/node-loggly
+[8]: http://loggly.com
+[9]: http://www.loggly.com/product/
+[10]: http://wiki.loggly.com/loggingfromcode
+[11]: https://github.com/indexzero/winston-riak
+[12]: http://riakjs.org
+[13]: https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L10
+[14]: http://github.com/indexzero/winston-mongodb
+[15]: http://github.com/appsattic/winston-simpledb
+[16]: http://github.com/wavded/winston-mail
+[17]: https://github.com/weaver/node-mail
+[18]: https://github.com/jesseditson/winston-sns
+[19]: https://github.com/namshi/winston-graylog2
+[20]: https://github.com/jorgebay/winston-cassandra
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/couchdb.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/couchdb.js
new file mode 100755 (executable)
index 0000000..ce2d960
--- /dev/null
@@ -0,0 +1,18 @@
+var winston = require('../lib/winston');
+
+//
+// Create a new winston logger instance with two tranports: Console, and Couchdb
+//
+//
+// The Console transport will simply output to the console screen
+// The Couchdb tranport will perform an HTTP POST request to the specified CouchDB instance
+//
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.Console)(),
+    new (winston.transports.Couchdb)({ 'host': 'localhost', 'db': 'logs' })
+    // if you need auth do this: new (winston.transports.Couchdb)({ 'user': 'admin', 'pass': 'admin', 'host': 'localhost', 'db': 'logs' })
+  ]
+});
+
+logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' });
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/custom-levels.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/custom-levels.js
new file mode 100755 (executable)
index 0000000..e425ecc
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * custom-levels.js: Custom logger and color levels in winston
+ *
+ * (C) 2012, Nodejitsu Inc.
+ *
+ */
+
+var winston = require('../lib/winston');
+
+//
+// Logging levels
+//
+var config = {
+  levels: {
+    silly: 0,
+    verbose: 1,
+    info: 2,
+    data: 3,
+    warn: 4,
+    debug: 5,
+    error: 6
+  },
+  colors: {
+    silly: 'magenta',
+    verbose: 'cyan',
+    info: 'green',
+    data: 'grey',
+    warn: 'yellow',
+    debug: 'blue',
+    error: 'red'
+  }
+};
+
+var logger = module.exports = new (winston.Logger)({
+  transports: [
+    new (winston.transports.Console)({
+      colorize: true
+    })
+  ],
+  levels: config.levels,
+  colors: config.colors
+});
+
+logger.data('hello')
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/exception.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/exception.js
new file mode 100755 (executable)
index 0000000..99f605b
--- /dev/null
@@ -0,0 +1,4 @@
+var winston = require('../');
+winston.handleExceptions(new winston.transports.Console({ colorize: true, json: true }));
+
+throw new Error('Hello, winston!');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/raw-mode.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/raw-mode.js
new file mode 100755 (executable)
index 0000000..89e070d
--- /dev/null
@@ -0,0 +1,10 @@
+var winston = require('../lib/winston');
+
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.Console)({ raw: true }),
+  ]
+});
+
+logger.log('info', 'Hello, this is a raw logging event',   { 'foo': 'bar' });
+logger.log('info', 'Hello, this is a raw logging event 2', { 'foo': 'bar' });
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/webhook-post.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/examples/webhook-post.js
new file mode 100755 (executable)
index 0000000..0fa1c8d
--- /dev/null
@@ -0,0 +1,17 @@
+var winston = require('../lib/winston');
+
+//
+// Create a new winston logger instance with two tranports: Console, and Webhook
+//
+//
+// The Console transport will simply output to the console screen
+// The Webhook tranports will perform an HTTP POST request to an abritrary end-point ( for post/recieve webhooks )
+//
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.Console)(),
+    new (winston.transports.Webhook)({ 'host': 'localhost', 'port': 8080, 'path': '/collectdata' })
+  ]
+});
+
+logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' });
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston.js
new file mode 100755 (executable)
index 0000000..040078f
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * winston.js: Top-level include defining Winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var winston = exports;
+
+//
+// Expose version using `pkginfo`
+//
+require('pkginfo')(module, 'version');
+
+//
+// Include transports defined by default by winston
+//
+winston.transports = require('./winston/transports');
+
+//
+// Expose utility methods
+//
+var common             = require('./winston/common');
+winston.hash           = common.hash;
+winston.clone          = common.clone;
+winston.longestElement = common.longestElement;
+winston.exception      = require('./winston/exception');
+winston.config         = require('./winston/config');
+winston.addColors      = winston.config.addColors;
+
+//
+// Expose core Logging-related prototypes.
+//
+winston.Container      = require('./winston/container').Container;
+winston.Logger         = require('./winston/logger').Logger;
+winston.Transport      = require('./winston/transports/transport').Transport;
+
+//
+// We create and expose a default `Container` to `winston.loggers` so that the
+// programmer may manage multiple `winston.Logger` instances without any additional overhead.
+//
+// ### some-file1.js
+//
+//     var logger = require('winston').loggers.get('something');
+//
+// ### some-file2.js
+//
+//     var logger = require('winston').loggers.get('something');
+//
+winston.loggers = new winston.Container();
+
+//
+// We create and expose a 'defaultLogger' so that the programmer may do the
+// following without the need to create an instance of winston.Logger directly:
+//
+//     var winston = require('winston');
+//     winston.log('info', 'some message');
+//     winston.error('some error');
+//
+var defaultLogger = new winston.Logger({
+  transports: [new winston.transports.Console()]
+});
+
+//
+// Pass through the target methods onto `winston.
+//
+var methods = [
+  'log',
+  'query',
+  'stream',
+  'add',
+  'remove',
+  'clear',
+  'profile',
+  'startTimer',
+  'extend',
+  'cli',
+  'handleExceptions',
+  'unhandleExceptions',
+  'addRewriter'
+];
+common.setLevels(winston, null, defaultLogger.levels);
+methods.forEach(function (method) {
+  winston[method] = function () {
+    return defaultLogger[method].apply(defaultLogger, arguments);
+  };
+});
+
+//
+// ### function cli ()
+// Configures the default winston logger to have the
+// settings for command-line interfaces: no timestamp,
+// colors enabled, padded output, and additional levels.
+//
+winston.cli = function () {
+  winston.padLevels = true;
+  common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels);
+  defaultLogger.setLevels(winston.config.cli.levels);
+  winston.config.addColors(winston.config.cli.colors);
+
+  if (defaultLogger.transports.console) {
+    defaultLogger.transports.console.colorize = true;
+    defaultLogger.transports.console.timestamp = false;
+  }
+
+  return winston;
+};
+
+//
+// ### function setLevels (target)
+// #### @target {Object} Target levels to use
+// Sets the `target` levels specified on the default winston logger.
+//
+winston.setLevels = function (target) {
+  common.setLevels(winston, defaultLogger.levels, target);
+  defaultLogger.setLevels(target);
+};
+
+//
+// Define getter / setter for the default logger level
+// which need to be exposed by winston.
+//
+Object.defineProperty(winston, 'level', {
+  get: function () {
+    return defaultLogger.level;
+  },
+  set: function (val) {
+    defaultLogger.level = val;
+
+    Object.keys(defaultLogger.transports).forEach(function(key) {
+      defaultLogger.transports[key].level = val;
+    });
+  }
+});
+
+//
+// Define getters / setters for appropriate properties of the
+// default logger which need to be exposed by winston.
+//
+['emitErrs', 'exitOnError', 'padLevels', 'levelLength', 'stripColors'].forEach(function (prop) {
+  Object.defineProperty(winston, prop, {
+    get: function () {
+      return defaultLogger[prop];
+    },
+    set: function (val) {
+      defaultLogger[prop] = val;
+    }
+  });
+});
+
+//
+// @default {Object}
+// The default transports and exceptionHandlers for
+// the default winston logger.
+//
+Object.defineProperty(winston, 'default', {
+  get: function () {
+    return {
+      transports: defaultLogger.transports,
+      exceptionHandlers: defaultLogger.exceptionHandlers
+    };
+  }
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/common.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/common.js
new file mode 100755 (executable)
index 0000000..fc210bb
--- /dev/null
@@ -0,0 +1,349 @@
+/*
+ * common.js: Internal helper and utility functions for winston
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var util = require('util'),
+    crypto = require('crypto'),
+    cycle = require('cycle'),
+    fs = require('fs'),
+    config = require('./config');
+
+//
+// ### function setLevels (target, past, current)
+// #### @target {Object} Object on which to set levels.
+// #### @past {Object} Previous levels set on target.
+// #### @current {Object} Current levels to set on target.
+// Create functions on the target objects for each level
+// in current.levels. If past is defined, remove functions
+// for each of those levels.
+//
+exports.setLevels = function (target, past, current, isDefault) {
+  if (past) {
+    Object.keys(past).forEach(function (level) {
+      delete target[level];
+    });
+  }
+
+  target.levels = current || config.npm.levels;
+  if (target.padLevels) {
+    target.levelLength = exports.longestElement(Object.keys(target.levels));
+  }
+
+  //
+  //  Define prototype methods for each log level
+  //  e.g. target.log('info', msg) <=> target.info(msg)
+  //
+  Object.keys(target.levels).forEach(function (level) {
+    target[level] = function (msg) {
+      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
+      var args = [level].concat(Array.prototype.slice.call(arguments));
+      target.log.apply(target, args);
+    };
+  });
+
+  return target;
+};
+
+//
+// ### function longestElement
+// #### @xs {Array} Array to calculate against
+// Returns the longest element in the `xs` array.
+//
+exports.longestElement = function (xs) {
+  return Math.max.apply(
+    null,
+    xs.map(function (x) { return x.length; })
+  );
+};
+
+//
+// ### function clone (obj)
+// #### @obj {Object} Object to clone.
+// Helper method for deep cloning pure JSON objects
+// i.e. JSON objects that are either literals or objects (no Arrays, etc)
+//
+exports.clone = function (obj) {
+  // we only need to clone refrence types (Object)
+  if (!(obj instanceof Object)) {
+    return obj;
+  }
+  else if (obj instanceof Date) {
+    return obj;
+  }
+
+  var copy = {};
+  for (var i in obj) {
+    if (Array.isArray(obj[i])) {
+      copy[i] = obj[i].slice(0);
+    }
+    else if (obj[i] instanceof Buffer) {
+        copy[i] = obj[i].slice(0);
+    }
+    else if (typeof obj[i] != 'function') {
+      copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i];
+    }
+    else if (typeof obj[i] === 'function') {
+      copy[i] = obj[i];
+    }
+  }
+
+  return copy;
+};
+
+//
+// ### function log (options)
+// #### @options {Object} All information about the log serialization.
+// Generic logging function for returning timestamped strings
+// with the following options:
+//
+//    {
+//      level:     'level to add to serialized message',
+//      message:   'message to serialize',
+//      meta:      'additional logging metadata to serialize',
+//      colorize:  false, // Colorizes output (only if `.json` is false)
+//      timestamp: true   // Adds a timestamp to the serialized message
+//      label:     'label to prepend the message'
+//    }
+//
+exports.log = function (options) {
+  var timestampFn = typeof options.timestamp === 'function'
+                  ? options.timestamp
+                  : exports.timestamp,
+      timestamp   = options.timestamp ? timestampFn() : null,
+      meta        = options.meta !== undefined || options.meta !== null ? exports.clone(cycle.decycle(options.meta)) : null,
+      output;
+
+  //
+  // raw mode is intended for outputing winston as streaming JSON to STDOUT
+  //
+  if (options.raw) {
+    if (typeof meta !== 'object' && meta != null) {
+      meta = { meta: meta };
+    }
+    output         = exports.clone(meta) || {};
+    output.level   = options.level;
+    output.message = options.message.stripColors;
+    return JSON.stringify(output);
+  }
+
+  //
+  // json mode is intended for pretty printing multi-line json to the terminal
+  //
+  if (options.json || true === options.logstash) {
+    if (typeof meta !== 'object' && meta != null) {
+      meta = { meta: meta };
+    }
+
+    output         = exports.clone(meta) || {};
+    output.level   = options.level;
+    output.message = options.message;
+    if (options.label) {
+      output.label = options.label;
+    }
+    if (timestamp) {
+      output.timestamp = timestamp;
+    }
+    
+    if (options.logstash === true) {
+      // use logstash format
+      var logstashOutput = {};
+      if (output.message !== undefined) {
+        logstashOutput['@message'] = output.message;
+        delete output.message;
+      }
+
+      if (output.timestamp !== undefined) {
+        logstashOutput['@timestamp'] = output.timestamp;
+        delete output.timestamp;
+      }
+
+      logstashOutput['@fields'] = exports.clone(output);
+      output = logstashOutput;
+    }
+
+    if (typeof options.stringify === 'function') {
+      return options.stringify(output);
+    }
+
+    return JSON.stringify(output, function (key, value) {
+      return value instanceof Buffer
+        ? value.toString('base64')
+        : value;
+    });
+  }
+
+  output = timestamp ? timestamp + ' - ' : '';
+  output += options.colorize ? config.colorize(options.level) : options.level;
+  output += ': ';
+  output += options.label ? ('[' + options.label + '] ') : '';
+  output += options.message;
+
+  if (meta !== null && meta !== undefined) {
+    if (meta && meta instanceof Error && meta.stack) {
+      meta = meta.stack;
+    }
+
+    if (typeof meta !== 'object') {
+      output += ' ' + meta;
+    }
+    else if (Object.keys(meta).length > 0) {
+      output += ' ' + (
+        options.prettyPrint
+          ? ('\n' + util.inspect(meta, false, null, options.colorize))
+          : exports.serialize(meta)
+      );
+    }
+  }
+
+  return output;
+};
+
+exports.capitalize = function (str) {
+  return str && str[0].toUpperCase() + str.slice(1);
+};
+
+//
+// ### function hash (str)
+// #### @str {string} String to hash.
+// Utility function for creating unique ids
+// e.g. Profiling incoming HTTP requests on the same tick
+//
+exports.hash = function (str) {
+  return crypto.createHash('sha1').update(str).digest('hex');
+};
+
+//
+// ### function pad (n)
+// Returns a padded string if `n < 10`.
+//
+exports.pad = function (n) {
+  return n < 10 ? '0' + n.toString(10) : n.toString(10);
+};
+
+//
+// ### function timestamp ()
+// Returns a timestamp string for the current time.
+//
+exports.timestamp = function () {
+  return new Date().toISOString();
+};
+
+//
+// ### function serialize (obj, key)
+// #### @obj {Object|literal} Object to serialize
+// #### @key {string} **Optional** Optional key represented by obj in a larger object
+// Performs simple comma-separated, `key=value` serialization for Loggly when
+// logging to non-JSON inputs.
+//
+exports.serialize = function (obj, key) {
+  if (obj === null) {
+    obj = 'null';
+  }
+  else if (obj === undefined) {
+    obj = 'undefined';
+  }
+  else if (obj === false) {
+    obj = 'false';
+  }
+
+  if (typeof obj !== 'object') {
+    return key ? key + '=' + obj : obj;
+  }
+
+  if (obj instanceof Buffer) {
+    return key ? key + '=' + obj.toString('base64') : obj.toString('base64');
+  }
+
+  var msg = '',
+      keys = Object.keys(obj),
+      length = keys.length;
+
+  for (var i = 0; i < length; i++) {
+    if (Array.isArray(obj[keys[i]])) {
+      msg += keys[i] + '=[';
+
+      for (var j = 0, l = obj[keys[i]].length; j < l; j++) {
+        msg += exports.serialize(obj[keys[i]][j]);
+        if (j < l - 1) {
+          msg += ', ';
+        }
+      }
+
+      msg += ']';
+    }
+    else if (obj[keys[i]] instanceof Date) {
+      msg += keys[i] + '=' + obj[keys[i]];
+    }
+    else {
+      msg += exports.serialize(obj[keys[i]], keys[i]);
+    }
+
+    if (i < length - 1) {
+      msg += ', ';
+    }
+  }
+
+  return msg;
+};
+
+
+//
+// ### function tailFile (options, callback)
+// #### @options {Object} Options for tail.
+// #### @callback {function} Callback to execute on every line.
+// `tail -f` a file. Options must include file.
+//
+exports.tailFile = function tail(options, callback) {
+  var stream = fs.createReadStream(options.file, { encoding: 'utf8' }),
+      buff = '',
+      destroy,
+      row = 0;
+
+  destroy = stream.destroy.bind(stream);
+  stream.destroy = function () {};
+
+  if (options.start === -1) {
+    delete options.start;
+  }
+  
+  stream.on('data', function (data) {
+    var data = (buff + data).split(/\n+/),
+        l = data.length - 1,
+        i = 0;
+
+    for (; i < l; i++) {
+      if (options.start == null || row > options.start) {
+        callback(null, data[i]);
+      }
+      row++;
+    }
+
+    buff = data[l];
+  });
+
+  stream.on('error', function (err) {
+    callback(err);
+    destroy();
+  });
+
+  stream.on('end', function () {
+    if (buff) {
+      stream.emit('line', buff);
+      buff = '';
+    }
+
+    resume();
+  });
+
+  function resume() {
+    setTimeout(function () {
+      stream.resume();
+    }, 1000);
+  }
+
+  return destroy;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config.js
new file mode 100755 (executable)
index 0000000..346d3ea
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * config.js: Default settings for all levels that winston knows about
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var colors = require('colors');
+
+var config = exports,
+    allColors = exports.allColors = {};
+
+config.addColors = function (colors) {
+  mixin(allColors, colors);
+};
+
+config.colorize = function (level) {
+  var colorized = level;
+  if (allColors[level] instanceof Array) {
+    for (var i = 0, l = allColors[level].length; i < l; ++i) {
+      colorized = colorized[allColors[level][i]];
+    }
+  } else if (allColors[level].match(/\s/)) {
+    var colorArr = allColors[level].split(/\s+/);
+    for (var i = 0; i < colorArr.length; ++i) {
+      colorized = colorized[colorArr[i]];
+    }
+    allColors[level] = colorArr;
+  } else {
+    colorized = colorized[allColors[level]];
+  }
+  return colorized;
+};
+
+//
+// Export config sets
+//
+config.cli    = require('./config/cli-config');
+config.npm    = require('./config/npm-config');
+config.syslog = require('./config/syslog-config');
+
+//
+// Add colors for pre-defined config sets
+//
+config.addColors(config.cli.colors);
+config.addColors(config.npm.colors);
+config.addColors(config.syslog.colors);
+
+function mixin (target) {
+  var args = Array.prototype.slice.call(arguments, 1);
+
+  args.forEach(function (a) {
+    var keys = Object.keys(a);
+    for (var i = 0; i < keys.length; i++) {
+      target[keys[i]] = a[keys[i]];
+    }
+  });
+  return target;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/cli-config.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/cli-config.js
new file mode 100755 (executable)
index 0000000..ab49942
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * cli-config.js: Config that conform to commonly used CLI logging levels.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var cliConfig = exports;
+
+cliConfig.levels = {
+  silly: 0,
+  input: 1,
+  verbose: 2,
+  prompt: 3,
+  debug: 4,
+  info: 5,
+  data: 6,
+  help: 7,
+  warn: 8,
+  error: 9
+};
+
+cliConfig.colors = {
+  silly: 'magenta',
+  input: 'grey',
+  verbose: 'cyan',
+  prompt: 'grey',
+  debug: 'blue',
+  info: 'green',
+  data: 'grey',
+  help: 'cyan',
+  warn: 'yellow',
+  error: 'red'
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/npm-config.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/npm-config.js
new file mode 100755 (executable)
index 0000000..12161a5
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * npm-config.js: Config that conform to npm logging levels.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var npmConfig = exports;
+
+npmConfig.levels = {
+  silly: 0,
+  debug: 1,
+  verbose: 2,
+  info: 3,
+  warn: 4,
+  error: 5
+};
+
+npmConfig.colors = {
+  silly: 'magenta',
+  verbose: 'cyan',
+  debug: 'blue',
+  info: 'green',
+  warn: 'yellow',
+  error: 'red'
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/syslog-config.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/config/syslog-config.js
new file mode 100755 (executable)
index 0000000..55ed5e4
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * syslog-config.js: Config that conform to syslog logging levels.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var syslogConfig = exports;
+
+syslogConfig.levels = {
+  emerg: 0,
+  alert: 1,
+  crit: 2,
+  error: 3,
+  warning: 4,
+  notice: 5,
+  info: 6,
+  debug: 7,
+};
+
+syslogConfig.colors = {
+  emerg: 'red',
+  alert: 'yellow',
+  crit: 'red',
+  error: 'red',
+  warning: 'red',
+  notice: 'yellow',
+  info: 'green',
+  debug: 'blue',
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/container.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/container.js
new file mode 100755 (executable)
index 0000000..e93f169
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * container.js: Inversion of control container for winston logger instances
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var common = require('./common'),
+    winston = require('../winston'),
+    extend = require('util')._extend;
+
+//
+// ### function Container (options)
+// #### @options {Object} Default pass-thru options for Loggers
+// Constructor function for the Container object responsible for managing
+// a set of `winston.Logger` instances based on string ids.
+//
+var Container = exports.Container = function (options) {
+  this.loggers = {};
+  this.options = options || {};
+  this.default = {
+    transports: [
+      new winston.transports.Console({
+        level: 'silly',
+        colorize: false
+      })
+    ]
+  }
+};
+
+//
+// ### function get / add (id, options)
+// #### @id {string} Id of the Logger to get
+// #### @options {Object} **Optional** Options for the Logger instance
+// Retreives a `winston.Logger` instance for the specified `id`. If
+// an instance does not exist, one is created.
+//
+Container.prototype.get = Container.prototype.add = function (id, options) {
+  var existing;
+  if (!this.loggers[id]) {
+    //
+    // Remark: Simple shallow clone for configuration options in case we pass in
+    // instantiated protoypal objects
+    //
+    options = extend({}, options || this.options || this.default);
+    existing = options.transports || this.options.transports;
+    //
+    // Remark: Make sure if we have an array of transports we slice it to make copies
+    // of those references.
+    //
+    options.transports = existing ? existing.slice() : [];
+
+    if (options.transports.length === 0 && (!options || !options['console'])) {
+      options.transports.push(this.default.transports[0]);
+    }
+
+    Object.keys(options).forEach(function (key) {
+      if (key === 'transports') {
+        return;
+      }
+
+      var name = common.capitalize(key);
+
+      if (!winston.transports[name]) {
+        throw new Error('Cannot add unknown transport: ' + name);
+      }
+
+      var namedOptions = options[key];
+      namedOptions.id = id;
+      options.transports.push(new (winston.transports[name])(namedOptions));
+    });
+
+    this.loggers[id] = new winston.Logger(options);
+  }
+
+  return this.loggers[id];
+};
+
+//
+// ### function close (id)
+// #### @id {string} **Optional** Id of the Logger instance to find
+// Returns a boolean value indicating if this instance
+// has a logger with the specified `id`.
+//
+Container.prototype.has = function (id) {
+  return !!this.loggers[id];
+};
+
+//
+// ### function close (id)
+// #### @id {string} **Optional** Id of the Logger instance to close
+// Closes a `Logger` instance with the specified `id` if it exists.
+// If no `id` is supplied then all Loggers are closed.
+//
+Container.prototype.close = function (id) {
+  var self = this;
+
+  function _close (id) {
+    if (!self.loggers[id]) {
+      return;
+    }
+
+    self.loggers[id].close();
+    delete self.loggers[id];
+  }
+
+  return id ? _close(id) : Object.keys(this.loggers).forEach(function (id) {
+    _close(id);
+  });
+};
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/exception.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/exception.js
new file mode 100755 (executable)
index 0000000..22717dd
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * exception.js: Utility methods for gathing information about uncaughtExceptions.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var os = require('os'),
+    stackTrace = require('stack-trace');
+
+var exception = exports;
+
+exception.getAllInfo = function (err) {
+  return {
+    date:    new Date().toString(),
+    process: exception.getProcessInfo(),
+    os:      exception.getOsInfo(),
+    trace:   exception.getTrace(err),
+    stack:   err.stack && err.stack.split('\n')
+  };
+};
+
+exception.getProcessInfo = function () {
+  return {
+    pid:         process.pid,
+    uid:         process.getuid ? process.getuid() : null,
+    gid:         process.getgid ? process.getgid() : null,
+    cwd:         process.cwd(),
+    execPath:    process.execPath,
+    version:     process.version,
+    argv:        process.argv,
+    memoryUsage: process.memoryUsage()
+  };
+};
+
+exception.getOsInfo = function () {
+  return {
+    loadavg: os.loadavg(),
+    uptime:  os.uptime()
+  };
+};
+
+exception.getTrace = function (err) {
+  var trace = err ? stackTrace.parse(err) : stackTrace.get();
+  return trace.map(function (site) {
+    return {
+      column:   site.getColumnNumber(),
+      file:     site.getFileName(),
+      function: site.getFunctionName(),
+      line:     site.getLineNumber(),
+      method:   site.getMethodName(),
+      native:   site.isNative(),
+    }
+  });
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/logger.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/logger.js
new file mode 100755 (executable)
index 0000000..5934e9e
--- /dev/null
@@ -0,0 +1,670 @@
+/*
+ * logger.js: Core logger object used by winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var events = require('events'),
+    util = require('util'),
+    async = require('async'),
+    config = require('./config'),
+    common = require('./common'),
+    exception = require('./exception'),
+    Stream = require('stream').Stream;
+
+//
+// ### function Logger (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the Logger object responsible
+// for persisting log messages and metadata to one or more transports.
+//
+var Logger = exports.Logger = function (options) {
+  events.EventEmitter.call(this);
+  options = options || {};
+
+  var self = this,
+      handleExceptions = false;
+
+  //
+  // Set Levels and default logging level
+  //
+  this.padLevels = options.padLevels || false;
+  this.setLevels(options.levels);
+  if (options.colors) {
+    config.addColors(options.colors);
+  }
+
+  //
+  // Hoist other options onto this instance.
+  //
+  this.level       = options.level || 'info';
+  this.emitErrs    = options.emitErrs || false;
+  this.stripColors = options.stripColors || false;
+  this.exitOnError = typeof options.exitOnError !== 'undefined'
+    ? options.exitOnError
+    : true;
+
+  //
+  // Setup other intelligent default settings.
+  //
+  this.transports        = {};
+  this.rewriters         = [];
+  this.exceptionHandlers = {};
+  this.profilers         = {};
+  this._names            = [];
+  this._hnames           = [];
+
+  if (options.transports) {
+    options.transports.forEach(function (transport) {
+      self.add(transport, null, true);
+
+      if (transport.handleExceptions) {
+        handleExceptions = true;
+      }
+    });
+  }
+
+  if (options.rewriters) {
+    options.rewriters.forEach(function (rewriter) {
+      self.addRewriter(rewriter);
+    });
+  }
+
+  if (options.exceptionHandlers) {
+    handleExceptions = true;
+    options.exceptionHandlers.forEach(function (handler) {
+      self._hnames.push(handler.name);
+      self.exceptionHandlers[handler.name] = handler;
+    });
+  }
+
+  if (options.handleExceptions || handleExceptions) {
+    this.handleExceptions();
+  }
+};
+
+//
+// Inherit from `events.EventEmitter`.
+//
+util.inherits(Logger, events.EventEmitter);
+
+//
+// ### function extend (target)
+// #### @target {Object} Target to extend.
+// Extends the target object with a 'log' method
+// along with a method for each level in this instance.
+//
+Logger.prototype.extend = function (target) {
+  var self = this;
+  ['log', 'profile', 'startTimer'].concat(Object.keys(this.levels)).forEach(function (method) {
+    target[method] = function () {
+      return self[method].apply(self, arguments);
+    };
+  });
+
+  return this;
+};
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+Logger.prototype.log = function (level) {
+  var self = this,
+      args = Array.prototype.slice.call(arguments, 1);
+
+  while(args[args.length - 1] === null) {
+    args.pop();
+  }
+
+  var callback = typeof args[args.length - 1] === 'function' ? args.pop() : null,
+      meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {},
+      msg      = util.format.apply(null, args);
+
+  // If we should pad for levels, do so
+  if (this.padLevels) {
+    msg = new Array(this.levelLength - level.length + 1).join(' ') + msg;
+  }
+
+  function onError (err) {
+    if (callback) {
+      callback(err);
+    }
+    else if (self.emitErrs) {
+      self.emit('error', err);
+    }
+  }
+
+  
+  if (Object.keys(this.transports).length === 0) {
+    return onError(new Error('Cannot log with no transports.'));
+  }
+  else if (typeof self.levels[level] === 'undefined') {
+    return onError(new Error('Unknown log level: ' + level));
+  }
+
+  this.rewriters.forEach(function (rewriter) {
+    meta = rewriter(level, msg, meta);
+  });
+
+  //
+  // For consideration of terminal 'color" programs like colors.js,
+  // which can add ANSI escape color codes to strings, we destyle the
+  // ANSI color escape codes when `this.stripColors` is set.
+  //
+  // see: http://en.wikipedia.org/wiki/ANSI_escape_code
+  //
+  if (this.stripColors) {
+    var code = /\u001b\[(\d+(;\d+)*)?m/g;
+    msg = ('' + msg).replace(code, '');
+  }
+
+  //
+  // Log for each transport and emit 'logging' event
+  //
+  function emit(name, next) {
+    var transport = self.transports[name];
+    if ((transport.level && self.levels[transport.level] <= self.levels[level])
+      || (!transport.level && self.levels[self.level] <= self.levels[level])) {
+      transport.log(level, msg, meta, function (err) {
+        if (err) {
+          err.transport = transport;
+          cb(err);
+          return next();
+        }
+        self.emit('logging', transport, level, msg, meta);
+        next();
+      });
+    } else {
+      next();
+    }
+  }
+
+  //
+  // Respond to the callback
+  //
+  function cb(err) {
+    if (callback) {
+      if (err) return callback(err);
+      callback(null, level, msg, meta);
+    }
+    callback = null;
+    if (!err) {
+      self.emit('logged', level, msg, meta);
+    }
+  }
+
+  async.forEach(this._names, emit, cb);
+
+  return this;
+};
+
+//
+// ### function query (options, callback)
+// #### @options {Object} Query options for this instance.
+// #### @callback {function} Continuation to respond to when complete.
+// Queries the all transports for this instance with the specified `options`.
+// This will aggregate each transport's results into one object containing
+// a property per transport.
+//
+Logger.prototype.query = function (options, callback) {
+  if (typeof options === 'function') {
+    callback = options;
+    options = {};
+  }
+
+  var self = this,
+      options = options || {},
+      results = {},
+      query = common.clone(options.query) || {},
+      transports;
+
+  //
+  // Helper function to query a single transport
+  //
+  function queryTransport(transport, next) {
+    if (options.query) {
+      options.query = transport.formatQuery(query);
+    }
+
+    transport.query(options, function (err, results) {
+      if (err) {
+        return next(err);
+      }
+
+      next(null, transport.formatResults(results, options.format));
+    });
+  }
+
+  //
+  // Helper function to accumulate the results from
+  // `queryTransport` into the `results`.
+  //
+  function addResults (transport, next) {
+    queryTransport(transport, function (err, result) {
+      //
+      // queryTransport could potentially invoke the callback
+      // multiple times since Transport code can be unpredictable.
+      //
+      if (next) {
+        result = err || result;
+        if (result) {
+          results[transport.name] = result;
+        }
+
+        next();
+      }
+
+      next = null;
+    });
+  }
+
+  //
+  // If an explicit transport is being queried then
+  // respond with the results from only that transport
+  //
+  if (options.transport) {
+    options.transport = options.transport.toLowerCase();
+    return queryTransport(this.transports[options.transport], callback);
+  }
+
+  //
+  // Create a list of all transports for this instance.
+  //
+  transports = this._names.map(function (name) {
+    return self.transports[name];
+  }).filter(function (transport) {
+    return !!transport.query;
+  });
+
+  //
+  // Iterate over the transports in parallel setting the
+  // appropriate key in the `results`
+  //
+  async.forEach(transports, addResults, function () {
+    callback(null, results);
+  });
+};
+
+//
+// ### function stream (options)
+// #### @options {Object} Stream options for this instance.
+// Returns a log stream for all transports. Options object is optional.
+//
+Logger.prototype.stream = function (options) {
+  var self = this,
+      options = options || {},
+      out = new Stream,
+      streams = [],
+      transports;
+
+  if (options.transport) {
+    var transport = this.transports[options.transport];
+    delete options.transport;
+    if (transport && transport.stream) {
+      return transport.stream(options);
+    }
+  }
+
+  out._streams = streams;
+  out.destroy = function () {
+    var i = streams.length;
+    while (i--) streams[i].destroy();
+  };
+
+  //
+  // Create a list of all transports for this instance.
+  //
+  transports = this._names.map(function (name) {
+    return self.transports[name];
+  }).filter(function (transport) {
+    return !!transport.stream;
+  });
+
+  transports.forEach(function (transport) {
+    var stream = transport.stream(options);
+    if (!stream) return;
+
+    streams.push(stream);
+
+    stream.on('log', function (log) {
+      log.transport = log.transport || [];
+      log.transport.push(transport.name);
+      out.emit('log', log);
+    });
+
+    stream.on('error', function (err) {
+      err.transport = err.transport || [];
+      err.transport.push(transport.name);
+      out.emit('error', err);
+    });
+  });
+
+  return out;
+};
+
+//
+// ### function close ()
+// Cleans up resources (streams, event listeners) for all
+// transports associated with this instance (if necessary).
+//
+Logger.prototype.close = function () {
+  var self = this;
+
+  this._names.forEach(function (name) {
+    var transport = self.transports[name];
+    if (transport && transport.close) {
+      transport.close();
+    }
+  });
+};
+
+//
+// ### function handleExceptions ()
+// Handles `uncaughtException` events for the current process
+//
+Logger.prototype.handleExceptions = function () {
+  var args = Array.prototype.slice.call(arguments),
+      handlers = [],
+      self = this;
+
+  args.forEach(function (a) {
+    if (Array.isArray(a)) {
+      handlers = handlers.concat(a);
+    }
+    else {
+      handlers.push(a);
+    }
+  });
+
+  handlers.forEach(function (handler) {
+    self.exceptionHandlers[handler.name] = handler;
+  });
+
+  this._hnames = Object.keys(self.exceptionHandlers);
+
+  if (!this.catchExceptions) {
+    this.catchExceptions = this._uncaughtException.bind(this);
+    process.on('uncaughtException', this.catchExceptions);
+  }
+};
+
+//
+// ### function unhandleExceptions ()
+// Removes any handlers to `uncaughtException` events
+// for the current process
+//
+Logger.prototype.unhandleExceptions = function () {
+  var self = this;
+
+  if (this.catchExceptions) {
+    Object.keys(this.exceptionHandlers).forEach(function (name) {
+      var handler = self.exceptionHandlers[name];
+      if (handler.close) {
+        handler.close();
+      }
+    });
+
+    this.exceptionHandlers = {};
+    Object.keys(this.transports).forEach(function (name) {
+      var transport = self.transports[name];
+      if (transport.handleExceptions) {
+        transport.handleExceptions = false;
+      }
+    })
+
+    process.removeListener('uncaughtException', this.catchExceptions);
+    this.catchExceptions = false;
+  }
+};
+
+//
+// ### function add (transport, [options])
+// #### @transport {Transport} Prototype of the Transport object to add.
+// #### @options {Object} **Optional** Options for the Transport to add.
+// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated.
+// Adds a transport of the specified type to this instance.
+//
+Logger.prototype.add = function (transport, options, created) {
+  var instance = created ? transport : (new (transport)(options));
+
+  if (!instance.name && !instance.log) {
+    throw new Error('Unknown transport with no log() method');
+  }
+  else if (this.transports[instance.name]) {
+    throw new Error('Transport already attached: ' + instance.name);
+  }
+
+  this.transports[instance.name] = instance;
+  this._names = Object.keys(this.transports);
+
+  //
+  // Listen for the `error` event on the new Transport
+  //
+  instance._onError = this._onError.bind(this, instance)
+  instance.on('error', instance._onError);
+
+  //
+  // If this transport has `handleExceptions` set to `true`
+  // and we are not already handling exceptions, do so.
+  //
+  if (instance.handleExceptions && !this.catchExceptions) {
+    this.handleExceptions();
+  }
+
+  return this;
+};
+
+//
+// ### function addRewriter (transport, [options])
+// #### @transport {Transport} Prototype of the Transport object to add.
+// #### @options {Object} **Optional** Options for the Transport to add.
+// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated.
+// Adds a transport of the specified type to this instance.
+//
+Logger.prototype.addRewriter = function (rewriter) {
+  this.rewriters.push(rewriter);
+}
+
+//
+// ### function clear ()
+// Remove all transports from this instance
+//
+Logger.prototype.clear = function () {
+  for (var name in this.transports) {
+    this.remove({ name: name });
+  }
+};
+
+//
+// ### function remove (transport)
+// #### @transport {Transport} Transport to remove.
+// Removes a transport of the specified type from this instance.
+//
+Logger.prototype.remove = function (transport) {
+  var name = transport.name || transport.prototype.name;
+
+  if (!this.transports[name]) {
+    throw new Error('Transport ' + name + ' not attached to this instance');
+  }
+
+  var instance = this.transports[name];
+  delete this.transports[name];
+  this._names = Object.keys(this.transports);
+
+  if (instance.close) {
+    instance.close();
+  }
+
+  instance.removeListener('error', instance._onError);
+  return this;
+};
+
+var ProfileHandler = function (logger) {
+  this.logger = logger;
+
+  this.start = Date.now();
+
+  this.done = function (msg) {
+    var args, callback, meta;
+    args     = Array.prototype.slice.call(arguments);
+    callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
+    meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
+
+    meta.duration = (Date.now()) - this.start + 'ms';
+
+    return this.logger.info(msg, meta, callback);
+  }
+}
+
+Logger.prototype.startTimer = function () {
+  return new ProfileHandler(this);
+}
+
+//
+// ### function profile (id, [msg, meta, callback])
+// #### @id {string} Unique id of the profiler
+// #### @msg {string} **Optional** Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} **Optional** Continuation to respond to when complete.
+// Tracks the time inbetween subsequent calls to this method
+// with the same `id` parameter. The second call to this method
+// will log the difference in milliseconds along with the message.
+//
+Logger.prototype.profile = function (id) {
+  var now = Date.now(), then, args,
+      msg, meta, callback;
+
+  if (this.profilers[id]) {
+    then = this.profilers[id];
+    delete this.profilers[id];
+
+    // Support variable arguments: msg, meta, callback
+    args     = Array.prototype.slice.call(arguments);
+    callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
+    meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
+    msg      = args.length === 2 ? args[1] : id;
+
+    // Set the duration property of the metadata
+    meta.duration = now - then + 'ms';
+    return this.info(msg, meta, callback);
+  }
+  else {
+    this.profilers[id] = now;
+  }
+
+  return this;
+};
+
+//
+// ### function setLevels (target)
+// #### @target {Object} Target levels to use on this instance
+// Sets the `target` levels specified on this instance.
+//
+Logger.prototype.setLevels = function (target) {
+  return common.setLevels(this, this.levels, target);
+};
+
+//
+// ### function cli ()
+// Configures this instance to have the default
+// settings for command-line interfaces: no timestamp,
+// colors enabled, padded output, and additional levels.
+//
+Logger.prototype.cli = function () {
+  this.padLevels = true;
+  this.setLevels(config.cli.levels);
+  config.addColors(config.cli.colors);
+
+  if (this.transports.console) {
+    this.transports.console.colorize = true;
+    this.transports.console.timestamp = false;
+  }
+
+  return this;
+};
+
+//
+// ### @private function _uncaughtException (err)
+// #### @err {Error} Error to handle
+// Logs all relevant information around the `err` and
+// exits the current process.
+//
+Logger.prototype._uncaughtException = function (err) {
+  var self = this,
+      responded = false,
+      info = exception.getAllInfo(err),
+      handlers = this._getExceptionHandlers(),
+      timeout,
+      doExit;
+
+  //
+  // Calculate if we should exit on this error
+  //
+  doExit = typeof this.exitOnError === 'function'
+    ? this.exitOnError(err)
+    : this.exitOnError;
+
+  function logAndWait(transport, next) {
+    transport.logException('uncaughtException: ' + (err.message || err), info, next, err);
+  }
+
+  function gracefulExit() {
+    if (doExit && !responded) {
+      //
+      // Remark: Currently ignoring any exceptions from transports
+      //         when catching uncaught exceptions.
+      //
+      clearTimeout(timeout);
+      responded = true;
+      process.exit(1);
+    }
+  }
+
+  if (!handlers || handlers.length === 0) {
+    return gracefulExit();
+  }
+
+  //
+  // Log to all transports and allow the operation to take
+  // only up to `3000ms`.
+  //
+  async.forEach(handlers, logAndWait, gracefulExit);
+  if (doExit) {
+    timeout = setTimeout(gracefulExit, 3000);
+  }
+};
+
+//
+// ### @private function _getExceptionHandlers ()
+// Returns the list of transports and exceptionHandlers
+// for this instance.
+//
+Logger.prototype._getExceptionHandlers = function () {
+  var self = this;
+
+  return this._hnames.map(function (name) {
+    return self.exceptionHandlers[name];
+  }).concat(this._names.map(function (name) {
+    return self.transports[name].handleExceptions && self.transports[name];
+  })).filter(Boolean);
+};
+
+//
+// ### @private function _onError (transport, err)
+// #### @transport {Object} Transport on which the error occured
+// #### @err {Error} Error that occurred on the transport
+// Bubbles the error, `err`, that occured on the specified `transport`
+// up from this instance if `emitErrs` has been set.
+//
+Logger.prototype._onError = function (transport, err) {
+  if (this.emitErrs) {
+    this.emit('error', err, transport);
+  }
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports.js
new file mode 100755 (executable)
index 0000000..cc7a96b
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * transports.js: Set of all transports Winston knows about
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var fs = require('fs'),
+    path = require('path'),
+    common = require('./common');
+
+var transports = exports;
+
+//
+// Setup all transports as lazy-loaded getters.
+//
+fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) {
+  var transport = file.replace('.js', ''),
+      name  = common.capitalize(transport);
+
+  if (transport === 'transport') {
+    return;
+  }
+  else if (~transport.indexOf('-')) {
+    name = transport.split('-').map(function (part) {
+      return common.capitalize(part);
+    }).join('');
+  }
+
+  transports.__defineGetter__(name, function () {
+    return require('./transports/' + transport)[name];
+  });
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/console.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/console.js
new file mode 100755 (executable)
index 0000000..8b72587
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * console.js: Transport for outputting to the console
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var events = require('events'),
+    util = require('util'),
+    colors = require('colors'),
+    common = require('../common'),
+    Transport = require('./transport').Transport;
+
+//
+// ### function Console (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the Console transport object responsible
+// for persisting log messages and metadata to a terminal or TTY.
+//
+var Console = exports.Console = function (options) {
+  Transport.call(this, options);
+  options = options || {};
+
+  this.json        = options.json        || false;
+  this.colorize    = options.colorize    || false;
+  this.prettyPrint = options.prettyPrint || false;
+  this.timestamp   = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
+  this.label       = options.label       || null;
+
+  if (this.json) {
+    this.stringify = options.stringify || function (obj) {
+      return JSON.stringify(obj, null, 2);
+    };
+  }
+};
+
+//
+// Inherit from `winston.Transport`.
+//
+util.inherits(Console, Transport);
+
+//
+// Expose the name of this Transport on the prototype
+//
+Console.prototype.name = 'console';
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+Console.prototype.log = function (level, msg, meta, callback) {
+  if (this.silent) {
+    return callback(null, true);
+  }
+
+  var self = this,
+      output;
+
+  output = common.log({
+    colorize:    this.colorize,
+    json:        this.json,
+    level:       level,
+    message:     msg,
+    meta:        meta,
+    stringify:   this.stringify,
+    timestamp:   this.timestamp,
+    prettyPrint: this.prettyPrint,
+    raw:         this.raw,
+    label:       this.label
+  });
+
+  if (level === 'error' || level === 'debug') {
+    process.stderr.write(output + '\n');
+  } else {
+    process.stdout.write(output + '\n');
+  }
+
+  //
+  // Emit the `logged` event immediately because the event loop
+  // will not exit until `process.stdout` has drained anyway.
+  //
+  self.emit('logged');
+  callback(null, true);
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/daily-rotate-file.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/daily-rotate-file.js
new file mode 100755 (executable)
index 0000000..f81a016
--- /dev/null
@@ -0,0 +1,571 @@
+/*
+ * daily-rotate-file.js: Transport for outputting to a local log file
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var events = require('events'),
+    fs = require('fs'),
+    path = require('path'),
+    util = require('util'),
+    colors = require('colors'),
+    common = require('../common'),
+    Transport = require('./transport').Transport,
+    Stream = require('stream').Stream;
+
+//
+// ### function DailyRotateFile (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the DailyRotateFile transport object responsible
+// for persisting log messages and metadata to one or more files.
+//
+var DailyRotateFile = exports.DailyRotateFile = function (options) {
+  Transport.call(this, options);
+
+  //
+  // Helper function which throws an `Error` in the event
+  // that any of the rest of the arguments is present in `options`.
+  //
+  function throwIf (target /*, illegal... */) {
+    Array.prototype.slice.call(arguments, 1).forEach(function (name) {
+      if (options[name]) {
+        throw new Error('Cannot set ' + name + ' and ' + target + 'together');
+      }
+    });
+  }
+
+  if (options.filename || options.dirname) {
+    throwIf('filename or dirname', 'stream');
+    this._basename = this.filename = options.filename
+      ? path.basename(options.filename)
+      : 'winston.log';
+
+    this.dirname   = options.dirname || path.dirname(options.filename);
+    this.options   = options.options || { flags: 'a' };
+
+    //
+    // "24 bytes" is maybe a good value for logging lines.
+    //
+    this.options.highWaterMark = this.options.highWaterMark || 24;
+  }
+  else if (options.stream) {
+    throwIf('stream', 'filename', 'maxsize');
+    this._stream = options.stream;
+
+    //
+    // We need to listen for drain events when
+    // write() returns false. This can make node
+    // mad at times.
+    //
+    this._stream.setMaxListeners(Infinity);
+  }
+  else {
+    throw new Error('Cannot log to file without filename or stream.');
+  }
+
+  this.json        = options.json !== false;
+  this.colorize    = options.colorize    || false;
+  this.maxsize     = options.maxsize     || null;
+  this.maxFiles    = options.maxFiles    || null;
+  this.label       = options.label       || null;
+  this.prettyPrint = options.prettyPrint || false;
+  this.timestamp   = options.timestamp != null ? options.timestamp : true;
+  this.datePattern = options.datePattern != null ? options.datePattern : '.yyyy-MM-dd';
+  
+  if (this.json) {
+    this.stringify = options.stringify;
+  }
+
+  //
+  // Internal state variables representing the number
+  // of files this instance has created and the current
+  // size (in bytes) of the current logfile.
+  //
+  this._size     = 0;
+  this._created  = 0;
+  this._buffer   = [];
+  this._draining = false;
+
+  var now = new Date();
+  this._year   = now.getFullYear();
+  this._month  = now.getMonth();
+  this._date   = now.getDate();
+  this._hour   = now.getHours();
+  this._minute = now.getMinutes();
+
+  var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhM])\1?/g,
+      pad = function (val, len) {
+              val = String(val);
+              len = len || 2;
+              while (val.length < len) val = "0" + val;
+              return val;
+      };
+
+  this.getFormattedDate = function() {
+    var flags = {
+      yy:   String(this._year).slice(2),
+      yyyy: this._year,
+      M:    this._month + 1,
+      MM:   pad(this._month + 1),
+      d:    this._date,
+      dd:   pad(this._date),
+      H:    this._hour,
+      HH:   pad(this._hour),
+      m:    this._minute,
+      mm:   pad(this._minute)
+    };
+    return this.datePattern.replace(token, function ($0) {
+      return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
+    });
+  };
+};
+
+//
+// Inherit from `winston.Transport`.
+//
+util.inherits(DailyRotateFile, Transport);
+
+//
+// Expose the name of this Transport on the prototype
+//
+DailyRotateFile.prototype.name = 'dailyRotateFile';
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+DailyRotateFile.prototype.log = function (level, msg, meta, callback) {
+  if (this.silent) {
+    return callback(null, true);
+  }
+
+  var self = this;
+
+  var output = common.log({
+    level:       level,
+    message:     msg,
+    meta:        meta,
+    json:        this.json,
+    colorize:    this.colorize,
+    prettyPrint: this.prettyPrint,
+    timestamp:   this.timestamp,
+    label:       this.label,
+    stringify:   this.stringify
+  }) + '\n';
+
+  this._size += output.length;
+
+  if (!this.filename) {
+    //
+    // If there is no `filename` on this instance then it was configured
+    // with a raw `WriteableStream` instance and we should not perform any
+    // size restrictions.
+    //
+    this._write(output, callback);
+    this._lazyDrain();
+  }
+  else {
+    this.open(function (err) {
+      if (err) {
+        //
+        // If there was an error enqueue the message
+        //
+        return self._buffer.push([output, callback]);
+      }
+
+      self._write(output, callback);
+      self._lazyDrain();
+    });
+  }
+};
+
+//
+// ### function _write (data, cb)
+// #### @data {String|Buffer} Data to write to the instance's stream.
+// #### @cb {function} Continuation to respond to when complete.
+// Write to the stream, ensure execution of a callback on completion.
+//
+DailyRotateFile.prototype._write = function(data, callback) {
+  // If this is a file write stream, we could use the builtin
+  // callback functionality, however, the stream is not guaranteed
+  // to be an fs.WriteStream.
+  var ret = this._stream.write(data);
+  if (!callback) return;
+  if (ret === false) {
+    return this._stream.once('drain', function() {
+      callback(null, true);
+    });
+  }
+  callback(null, true);
+};
+
+//
+// ### function query (options, callback)
+// #### @options {Object} Loggly-like query options for this instance.
+// #### @callback {function} Continuation to respond to when complete.
+// Query the transport. Options object is optional.
+//
+DailyRotateFile.prototype.query = function (options, callback) {
+  if (typeof options === 'function') {
+    callback = options;
+    options = {};
+  }
+
+  // TODO when maxfilesize rotate occurs
+  var file = path.join(this.dirname, this._basename + this.getFormattedDate()),
+      options = this.normalizeQuery(options),
+      buff = '',
+      results = [],
+      row = 0;
+
+  var stream = fs.createReadStream(file, {
+    encoding: 'utf8'
+  });
+
+  stream.on('error', function (err) {
+    if (stream.readable) {
+      stream.destroy();
+    }
+    if (!callback) return;
+    return err.code !== 'ENOENT'
+      ? callback(err)
+      : callback(null, results);
+  });
+
+  stream.on('data', function (data) {
+    var data = (buff + data).split(/\n+/),
+        l = data.length - 1,
+        i = 0;
+
+    for (; i < l; i++) {
+      if (!options.start || row >= options.start) {
+        add(data[i]);
+      }
+      row++;
+    }
+
+    buff = data[l];
+  });
+
+  stream.on('close', function () {
+    if (buff) add(buff, true);
+    if (options.order === 'desc') {
+      results = results.reverse();
+    }
+    if (callback) callback(null, results);
+  });
+
+  function add(buff, attempt) {
+    try {
+      var log = JSON.parse(buff);
+      if (check(log)) push(log);
+    } catch (e) {
+      if (!attempt) {
+        stream.emit('error', e);
+      }
+    }
+  }
+
+  function push(log) {
+    if (options.rows && results.length >= options.rows) {
+      if (stream.readable) {
+        stream.destroy();
+      }
+      return;
+    }
+
+    if (options.fields) {
+      var obj = {};
+      options.fields.forEach(function (key) {
+        obj[key] = log[key];
+      });
+      log = obj;
+    }
+
+    results.push(log);
+  }
+
+  function check(log) {
+    if (!log) return;
+
+    if (typeof log !== 'object') return;
+
+    var time = new Date(log.timestamp);
+    if ((options.from && time < options.from)
+        || (options.until && time > options.until)) {
+      return;
+    }
+
+    return true;
+  }
+};
+
+//
+// ### function stream (options)
+// #### @options {Object} Stream options for this instance.
+// Returns a log stream for this transport. Options object is optional.
+//
+DailyRotateFile.prototype.stream = function (options) {
+  var file = path.join(this.dirname, this._basename + this.getFormattedDate()),
+      options = options || {},
+      stream = new Stream;
+
+  var tail = {
+    file: file,
+    start: options.start
+  };
+
+  stream.destroy = common.tailFile(tail, function (err, line) {
+    
+    if(err){
+      return stream.emit('error',err);
+    }
+    
+    try {
+      stream.emit('data', line);
+      line = JSON.parse(line);
+      stream.emit('log', line);
+    } catch (e) {
+      stream.emit('error', e);
+    }
+  });
+  
+  if(stream.resume){
+    stream.resume();
+  }
+
+  return stream;
+};
+
+//
+// ### function open (callback)
+// #### @callback {function} Continuation to respond to when complete
+// Checks to see if a new file needs to be created based on the `maxsize`
+// (if any) and the current size of the file used.
+//
+DailyRotateFile.prototype.open = function (callback) {
+  var now = new Date();
+  if (this.opening) {
+    //
+    // If we are already attempting to open the next
+    // available file then respond with a value indicating
+    // that the message should be buffered.
+    //
+    return callback(true);
+  }
+  else if (!this._stream || (this.maxsize && this._size >= this.maxsize) ||
+      (this._year < now.getFullYear() || this._month < now.getMonth() || this._date < now.getDate() || this._hour < now.getHours() || this._minute < now.getMinutes())) {
+    //
+    // If we dont have a stream or have exceeded our size, then create
+    // the next stream and respond with a value indicating that
+    // the message should be buffered.
+    //
+    callback(true);
+    return this._createStream();
+  }
+
+  //
+  // Otherwise we have a valid (and ready) stream.
+  //
+  callback();
+};
+
+//
+// ### function close ()
+// Closes the stream associated with this instance.
+//
+DailyRotateFile.prototype.close = function () {
+  var self = this;
+
+  if (this._stream) {
+    this._stream.end();
+    this._stream.destroySoon();
+
+    this._stream.once('drain', function () {
+      self.emit('flush');
+      self.emit('closed');
+    });
+  }
+};
+
+//
+// ### function flush ()
+// Flushes any buffered messages to the current `stream`
+// used by this instance.
+//
+DailyRotateFile.prototype.flush = function () {
+  var self = this;
+
+  //
+  // Iterate over the `_buffer` of enqueued messaged
+  // and then write them to the newly created stream.
+  //
+  this._buffer.forEach(function (item) {
+    var str = item[0],
+        callback = item[1];
+
+    process.nextTick(function () {
+      self._write(str, callback);
+      self._size += str.length;
+    });
+  });
+
+  //
+  // Quickly truncate the `_buffer` once the write operations
+  // have been started
+  //
+  self._buffer.length = 0;
+
+  //
+  // When the stream has drained we have flushed
+  // our buffer.
+  //
+  self._stream.once('drain', function () {
+    self.emit('flush');
+    self.emit('logged');
+  });
+};
+
+//
+// ### @private function _createStream ()
+// Attempts to open the next appropriate file for this instance
+// based on the common state (such as `maxsize` and `_basename`).
+//
+DailyRotateFile.prototype._createStream = function () {
+  var self = this;
+  this.opening = true;
+
+  (function checkFile (target) {
+    var fullname = path.join(self.dirname, target);
+
+    //
+    // Creates the `WriteStream` and then flushes any
+    // buffered messages.
+    //
+    function createAndFlush (size) {
+      if (self._stream) {
+        self._stream.end();
+        self._stream.destroySoon();
+      }
+
+      self._size = size;
+      self.filename = target;
+      self._stream = fs.createWriteStream(fullname, self.options);
+
+      //
+      // We need to listen for drain events when
+      // write() returns false. This can make node
+      // mad at times.
+      //
+      self._stream.setMaxListeners(Infinity);
+
+      //
+      // When the current stream has finished flushing
+      // then we can be sure we have finished opening
+      // and thus can emit the `open` event.
+      //
+      self.once('flush', function () {
+        self.opening = false;
+        self.emit('open', fullname);
+      });
+
+      //
+      // Remark: It is possible that in the time it has taken to find the
+      // next logfile to be written more data than `maxsize` has been buffered,
+      // but for sensible limits (10s - 100s of MB) this seems unlikely in less
+      // than one second.
+      //
+      self.flush();
+    }
+
+    fs.stat(fullname, function (err, stats) {
+      if (err) {
+        if (err.code !== 'ENOENT') {
+          return self.emit('error', err);
+        }
+
+        return createAndFlush(0);
+      }
+
+      if (!stats || (self.maxsize && stats.size >= self.maxsize)) {
+        //
+        // If `stats.size` is greater than the `maxsize` for
+        // this instance then try again
+        //
+        return checkFile(self._getFile(true));
+      }
+
+      var now = new Date();
+      if (self._year < now.getFullYear() || self._month < now.getMonth() || self._date < now.getDate() || self._hour < now.getHours() || self._minute < now.getMinutes()) {
+        self._year   = now.getFullYear();
+        self._month  = now.getMonth();
+        self._date   = now.getDate();
+        self._hour   = now.getHours();
+        self._minute = now.getMinutes();
+        self._created  = 0;
+        return checkFile(self._getFile());
+      }
+
+      createAndFlush(stats.size);
+    });
+  })(this._getFile());
+};
+
+//
+// ### @private function _getFile ()
+// Gets the next filename to use for this instance
+// in the case that log filesizes are being capped.
+//
+DailyRotateFile.prototype._getFile = function (inc) {
+  var self = this,
+      filename = this._basename + this.getFormattedDate(),
+      remaining;
+
+  if (inc) {
+    //
+    // Increment the number of files created or
+    // checked by this instance.
+    //
+    // Check for maxFiles option and delete file
+    if (this.maxFiles && (this._created >= (this.maxFiles - 1))) {
+      remaining = this._created - (this.maxFiles - 1);
+      if (remaining === 0) {
+        fs.unlinkSync(path.join(this.dirname, filename));
+      }
+      else {
+        fs.unlinkSync(path.join(this.dirname, filename + '.' + remaining));
+      }
+    }
+
+    this._created += 1;
+  }
+
+  return this._created
+    ? filename + '.' + this._created
+    : filename;
+};
+
+//
+// ### @private function _lazyDrain ()
+// Lazily attempts to emit the `logged` event when `this.stream` has
+// drained. This is really just a simple mutex that only works because
+// Node.js is single-threaded.
+//
+DailyRotateFile.prototype._lazyDrain = function () {
+  var self = this;
+
+  if (!this._draining && this._stream) {
+    this._draining = true;
+
+    this._stream.once('drain', function () {
+      this._draining = false;
+      self.emit('logged');
+    });
+  }
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/file.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/file.js
new file mode 100755 (executable)
index 0000000..4c19587
--- /dev/null
@@ -0,0 +1,554 @@
+/*
+ * file.js: Transport for outputting to a local log file
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var events = require('events'),
+    fs = require('fs'),
+    path = require('path'),
+    util = require('util'),
+    colors = require('colors'),
+    common = require('../common'),
+    Transport = require('./transport').Transport,
+    isWritable = require('isstream').isWritable,
+    Stream = require('stream').Stream;
+
+//
+// ### function File (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the File transport object responsible
+// for persisting log messages and metadata to one or more files.
+//
+var File = exports.File = function (options) {
+  Transport.call(this, options);
+
+  //
+  // Helper function which throws an `Error` in the event
+  // that any of the rest of the arguments is present in `options`.
+  //
+  function throwIf (target /*, illegal... */) {
+    Array.prototype.slice.call(arguments, 1).forEach(function (name) {
+      if (options[name]) {
+        throw new Error('Cannot set ' + name + ' and ' + target + 'together');
+      }
+    });
+  }
+
+  if (options.filename || options.dirname) {
+    throwIf('filename or dirname', 'stream');
+    this._basename = this.filename = options.filename
+      ? path.basename(options.filename)
+      : 'winston.log';
+
+    this.dirname = options.dirname || path.dirname(options.filename);
+    this.options = options.options || { flags: 'a' };
+
+    //
+    // "24 bytes" is maybe a good value for logging lines.
+    //
+    this.options.highWaterMark = this.options.highWaterMark || 24;
+  }
+  else if (options.stream) {
+    throwIf('stream', 'filename', 'maxsize');
+    this._stream = options.stream;
+    this._isStreams2 = isWritable(this._stream);
+    //
+    // We need to listen for drain events when
+    // write() returns false. This can make node
+    // mad at times.
+    //
+    this._stream.setMaxListeners(Infinity);
+  }
+  else {
+    throw new Error('Cannot log to file without filename or stream.');
+  }
+
+  this.json        = options.json !== false;
+  this.logstash    = options.logstash    || false;
+  this.colorize    = options.colorize    || false;
+  this.maxsize     = options.maxsize     || null;
+  this.maxFiles    = options.maxFiles    || null;
+  this.prettyPrint = options.prettyPrint || false;
+  this.label       = options.label       || null;
+  this.timestamp   = options.timestamp != null ? options.timestamp : true;
+  this.logstash    = options.logstash    || false;
+
+  if (this.json) {
+    this.stringify = options.stringify;
+  }
+
+  //
+  // Internal state variables representing the number
+  // of files this instance has created and the current
+  // size (in bytes) of the current logfile.
+  //
+  this._size     = 0;
+  this._created  = 0;
+  this._buffer   = [];
+  this._draining = false;
+};
+
+//
+// Inherit from `winston.Transport`.
+//
+util.inherits(File, Transport);
+
+//
+// Expose the name of this Transport on the prototype
+//
+File.prototype.name = 'file';
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+File.prototype.log = function (level, msg, meta, callback) {
+  if (this.silent) {
+    return callback(null, true);
+  }
+
+  var self = this;
+
+  if (typeof msg !== 'string') {
+    msg = '' + msg;
+  }
+
+  var output = common.log({
+    level:       level,
+    message:     msg,
+    meta:        meta,
+    json:        this.json,
+    logstash:    this.logstash,
+    colorize:    this.colorize,
+    prettyPrint: this.prettyPrint,
+    timestamp:   this.timestamp,
+    stringify:   this.stringify,
+    label:       this.label,
+    logstash:    this.logstash
+  }) + '\n';
+
+  this._size += output.length;
+
+  if (!this.filename) {
+    //
+    // If there is no `filename` on this instance then it was configured
+    // with a raw `WriteableStream` instance and we should not perform any
+    // size restrictions.
+    //
+    this._write(output, callback);
+    this._lazyDrain();
+  }
+  else {
+    this.open(function (err) {
+      if (err) {
+        //
+        // If there was an error enqueue the message
+        //
+        return self._buffer.push([output, callback]);
+      }
+
+      self._write(output, callback);
+      self._lazyDrain();
+    });
+  }
+};
+
+//
+// ### function _write (data, cb)
+// #### @data {String|Buffer} Data to write to the instance's stream.
+// #### @cb {function} Continuation to respond to when complete.
+// Write to the stream, ensure execution of a callback on completion.
+//
+File.prototype._write = function(data, callback) {
+  if (this._isStreams2) {
+    this._stream.write(data);
+    return callback && process.nextTick(function () {
+      callback(null, true);
+    });
+  }
+
+  // If this is a file write stream, we could use the builtin
+  // callback functionality, however, the stream is not guaranteed
+  // to be an fs.WriteStream.
+  var ret = this._stream.write(data);
+  if (!callback) return;
+  if (ret === false) {
+    return this._stream.once('drain', function() {
+      callback(null, true);
+    });
+  }
+  process.nextTick(function () {
+    callback(null, true);
+  });
+};
+
+//
+// ### function query (options, callback)
+// #### @options {Object} Loggly-like query options for this instance.
+// #### @callback {function} Continuation to respond to when complete.
+// Query the transport. Options object is optional.
+//
+File.prototype.query = function (options, callback) {
+  if (typeof options === 'function') {
+    callback = options;
+    options = {};
+  }
+
+  var file = path.join(this.dirname, this.filename),
+      options = this.normalizeQuery(options),
+      buff = '',
+      results = [],
+      row = 0;
+
+  var stream = fs.createReadStream(file, {
+    encoding: 'utf8'
+  });
+
+  stream.on('error', function (err) {
+    if (stream.readable) {
+      stream.destroy();
+    }
+    if (!callback) return;
+    return err.code !== 'ENOENT'
+      ? callback(err)
+      : callback(null, results);
+  });
+
+  stream.on('data', function (data) {
+    var data = (buff + data).split(/\n+/),
+        l = data.length - 1,
+        i = 0;
+
+    for (; i < l; i++) {
+      if (!options.start || row >= options.start) {
+        add(data[i]);
+      }
+      row++;
+    }
+
+    buff = data[l];
+  });
+
+  stream.on('close', function () {
+    if (buff) add(buff, true);
+    if (options.order === 'desc') {
+      results = results.reverse();
+    }
+    if (callback) callback(null, results);
+  });
+
+  function add(buff, attempt) {
+    try {
+      var log = JSON.parse(buff);
+      if (check(log)) push(log);
+    } catch (e) {
+      if (!attempt) {
+        stream.emit('error', e);
+      }
+    }
+  }
+
+  function push(log) {
+    if (options.rows && results.length >= options.rows) {
+      if (stream.readable) {
+        stream.destroy();
+      }
+      return;
+    }
+
+    if (options.fields) {
+      var obj = {};
+      options.fields.forEach(function (key) {
+        obj[key] = log[key];
+      });
+      log = obj;
+    }
+
+    results.push(log);
+  }
+
+  function check(log) {
+    if (!log) return;
+
+    if (typeof log !== 'object') return;
+
+    var time = new Date(log.timestamp);
+    if ((options.from && time < options.from)
+        || (options.until && time > options.until)) {
+      return;
+    }
+
+    return true;
+  }
+};
+
+//
+// ### function stream (options)
+// #### @options {Object} Stream options for this instance.
+// Returns a log stream for this transport. Options object is optional.
+//
+File.prototype.stream = function (options) {
+  var file = path.join(this.dirname, this.filename),
+      options = options || {},
+      stream = new Stream;
+
+  var tail = {
+    file: file,
+    start: options.start
+  };
+
+  stream.destroy = common.tailFile(tail, function (err, line) {
+
+    if(err){
+      return stream.emit('error',err);
+    }
+
+    try {
+      stream.emit('data', line);
+      line = JSON.parse(line);
+      stream.emit('log', line);
+    } catch (e) {
+      stream.emit('error', e);
+    }
+  });
+
+  return stream;
+};
+
+//
+// ### function open (callback)
+// #### @callback {function} Continuation to respond to when complete
+// Checks to see if a new file needs to be created based on the `maxsize`
+// (if any) and the current size of the file used.
+//
+File.prototype.open = function (callback) {
+  if (this.opening) {
+    //
+    // If we are already attempting to open the next
+    // available file then respond with a value indicating
+    // that the message should be buffered.
+    //
+    return callback(true);
+  }
+  else if (!this._stream || (this.maxsize && this._size >= this.maxsize)) {
+    //
+    // If we dont have a stream or have exceeded our size, then create
+    // the next stream and respond with a value indicating that
+    // the message should be buffered.
+    //
+    callback(true);
+    return this._createStream();
+  }
+
+  //
+  // Otherwise we have a valid (and ready) stream.
+  //
+  callback();
+};
+
+//
+// ### function close ()
+// Closes the stream associated with this instance.
+//
+File.prototype.close = function () {
+  var self = this;
+
+  if (this._stream) {
+    this._stream.end();
+    this._stream.destroySoon();
+
+    this._stream.once('drain', function () {
+      self.emit('flush');
+      self.emit('closed');
+    });
+  }
+};
+
+//
+// ### function flush ()
+// Flushes any buffered messages to the current `stream`
+// used by this instance.
+//
+File.prototype.flush = function () {
+  var self = this;
+
+  // If nothing to flush, there will be no "flush" event from native stream
+  // Thus, the "open" event will never be fired (see _createStream.createAndFlush function)
+  // That means, self.opening will never set to false and no logs will be written to disk
+  if (!this._buffer.length) {
+    return self.emit('flush');
+  }
+
+  //
+  // Iterate over the `_buffer` of enqueued messaged
+  // and then write them to the newly created stream.
+  //
+  this._buffer.forEach(function (item) {
+    var str = item[0],
+        callback = item[1];
+
+    process.nextTick(function () {
+      self._write(str, callback);
+      self._size += str.length;
+    });
+  });
+
+  //
+  // Quickly truncate the `_buffer` once the write operations
+  // have been started
+  //
+  self._buffer.length = 0;
+
+  //
+  // When the stream has drained we have flushed
+  // our buffer.
+  //
+  self._stream.once('drain', function () {
+    self.emit('flush');
+    self.emit('logged');
+  });
+};
+
+//
+// ### @private function _createStream ()
+// Attempts to open the next appropriate file for this instance
+// based on the common state (such as `maxsize` and `_basename`).
+//
+File.prototype._createStream = function () {
+  var self = this;
+  this.opening = true;
+
+  (function checkFile (target) {
+    var fullname = path.join(self.dirname, target);
+
+    //
+    // Creates the `WriteStream` and then flushes any
+    // buffered messages.
+    //
+    function createAndFlush (size) {
+      if (self._stream) {
+        self._stream.end();
+        self._stream.destroySoon();
+      }
+
+      self._size = size;
+      self.filename = target;
+      self._stream = fs.createWriteStream(fullname, self.options);
+      self._isStreams2 = isWritable(self._stream);
+      //
+      // We need to listen for drain events when
+      // write() returns false. This can make node
+      // mad at times.
+      //
+      self._stream.setMaxListeners(Infinity);
+
+      //
+      // When the current stream has finished flushing
+      // then we can be sure we have finished opening
+      // and thus can emit the `open` event.
+      //
+      self.once('flush', function () {
+        // Because "flush" event is based on native stream "drain" event,
+        // logs could be written inbetween "self.flush()" and here
+        // Therefore, we need to flush again to make sure everything is flushed
+        self.flush();
+
+        self.opening = false;
+        self.emit('open', fullname);
+      });
+
+      //
+      // Remark: It is possible that in the time it has taken to find the
+      // next logfile to be written more data than `maxsize` has been buffered,
+      // but for sensible limits (10s - 100s of MB) this seems unlikely in less
+      // than one second.
+      //
+      self.flush();
+    }
+
+    fs.stat(fullname, function (err, stats) {
+      if (err) {
+        if (err.code !== 'ENOENT') {
+          return self.emit('error', err);
+        }
+
+        return createAndFlush(0);
+      }
+
+      if (!stats || (self.maxsize && stats.size >= self.maxsize)) {
+        //
+        // If `stats.size` is greater than the `maxsize` for
+        // this instance then try again
+        //
+        return checkFile(self._getFile(true));
+      }
+
+      createAndFlush(stats.size);
+    });
+  })(this._getFile());
+};
+
+//
+// ### @private function _getFile ()
+// Gets the next filename to use for this instance
+// in the case that log filesizes are being capped.
+//
+File.prototype._getFile = function (inc) {
+  var self = this,
+      ext = path.extname(this._basename),
+      basename = path.basename(this._basename, ext),
+      remaining;
+
+  if (inc) {
+    //
+    // Increment the number of files created or
+    // checked by this instance.
+    //
+    // Check for maxFiles option and delete file
+    if (this.maxFiles && (this._created >= (this.maxFiles - 1))) {
+      remaining = this._created - (this.maxFiles - 1);
+      try {
+        if (remaining === 0) {
+          fs.unlinkSync(path.join(this.dirname, basename + ext));
+        }
+        else {
+          fs.unlinkSync(path.join(this.dirname, basename + remaining + ext));
+        }
+      } catch (e) {
+        // If the file was already removed
+      }
+    }
+
+    this._created += 1;
+  }
+
+  return this._created
+    ? basename + this._created + ext
+    : basename + ext;
+};
+
+//
+// ### @private function _lazyDrain ()
+// Lazily attempts to emit the `logged` event when `this.stream` has
+// drained. This is really just a simple mutex that only works because
+// Node.js is single-threaded.
+//
+File.prototype._lazyDrain = function () {
+  var self = this;
+
+  if (!this._draining && this._stream) {
+    this._draining = true;
+
+    this._stream.once('drain', function () {
+      this._draining = false;
+      self.emit('logged');
+    });
+  }
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/http.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/http.js
new file mode 100755 (executable)
index 0000000..5ddc5a4
--- /dev/null
@@ -0,0 +1,228 @@
+var util = require('util'),
+    winston = require('../../winston'),
+    http = require('http'),
+    https = require('https'),
+    Stream = require('stream').Stream,
+    Transport = require('./transport').Transport;
+
+//
+// ### function Http (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the Http transport object responsible
+// for persisting log messages and metadata to a terminal or TTY.
+//
+var Http = exports.Http = function (options) {
+  Transport.call(this, options);
+  options = options || {};
+
+  this.name = 'http';
+  this.ssl = !!options.ssl;
+  this.host = options.host || 'localhost';
+  this.port = options.port;
+  this.auth = options.auth;
+  this.path = options.path || '';
+
+  if (!this.port) {
+    this.port = this.ssl ? 443 : 80;
+  }
+};
+
+util.inherits(Http, winston.Transport);
+
+//
+// Expose the name of this Transport on the prototype
+//
+Http.prototype.name = 'http';
+
+//
+// ### function _request (options, callback)
+// #### @callback {function} Continuation to respond to when complete.
+// Make a request to a winstond server or any http server which can
+// handle json-rpc.
+//
+Http.prototype._request = function (options, callback) {
+  options = options || {};
+
+  var auth = options.auth || this.auth,
+      path = options.path || this.path || '';
+
+  delete options.auth;
+  delete options.path;
+
+  // Prepare options for outgoing HTTP request
+  req = (this.ssl ? https : http).request({
+    host: this.host,
+    port: this.port,
+    path: path.replace(/^\//, ''),
+    method: 'POST',
+    headers: { 'Content-Type': 'application/json' },
+    auth: (auth) ? auth.username + ':' + auth.password : ''
+  });
+
+  req.end(new Buffer(JSON.stringify(options), 'utf8'));
+
+  req.on('error', callback);
+  req.on('response', function (res) {
+    res.on('end', function () {
+      callback(null, res);
+    });
+  });
+};
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+Http.prototype.log = function (level, msg, meta, callback) {
+  var self = this;
+
+  if (typeof meta === 'function') {
+    callback = meta;
+    meta = {};
+  }
+
+  var options = {
+    method: 'collect',
+    params: {
+      level: level,
+      message: msg,
+      meta: meta
+    }
+  };
+
+  if (meta) {
+    if (meta.path) {
+      options.path = meta.path;
+      delete meta.path;
+    }
+
+    if (meta.auth) {
+      options.auth = meta.auth;
+      delete meta.auth;
+    }
+  }
+
+  this._request(options, function (err, res) {
+    if (res && res.statusCode !== 200) {
+      err = new Error('HTTP Status Code: ' + res.statusCode);
+    }
+
+    if (err) return callback(err);
+
+    // TODO: emit 'logged' correctly,
+    // keep track of pending logs.
+    self.emit('logged');
+
+    if (callback) callback(null, true);
+  });
+};
+
+//
+// ### function query (options, callback)
+// #### @options {Object} Loggly-like query options for this instance.
+// #### @callback {function} Continuation to respond to when complete.
+// Query the transport. Options object is optional.
+//
+Http.prototype.query = function (options, callback) {
+  if (typeof options === 'function') {
+    callback = options;
+    options = {};
+  }
+
+  var self = this,
+      options = this.normalizeQuery(options);
+
+  options = {
+    method: 'query',
+    params: options
+  };
+
+  if (options.params.path) {
+    options.path = options.params.path;
+    delete options.params.path;
+  }
+
+  if (options.params.auth) {
+    options.auth = options.params.auth;
+    delete options.params.auth;
+  }
+
+  this._request(options, function (err, res, body) {
+    if (res && res.statusCode !== 200) {
+      err = new Error('HTTP Status Code: ' + res.statusCode);
+    }
+
+    if (err) return callback(err);
+
+    if (typeof body === 'string') {
+      try {
+        body = JSON.parse(body);
+      } catch (e) {
+        return callback(e);
+      }
+    }
+
+    callback(null, body);
+  });
+};
+
+//
+// ### function stream (options)
+// #### @options {Object} Stream options for this instance.
+// Returns a log stream for this transport. Options object is optional.
+//
+Http.prototype.stream = function (options) {
+  var self = this,
+      options = options || {},
+      stream = new Stream,
+      req,
+      buff;
+
+  stream.destroy = function () {
+    req.destroy();
+  };
+
+  options = {
+    method: 'stream',
+    params: options
+  };
+
+  if (options.params.path) {
+    options.path = options.params.path;
+    delete options.params.path;
+  }
+
+  if (options.params.auth) {
+    options.auth = options.params.auth;
+    delete options.params.auth;
+  }
+
+  req = this._request(options);
+  buff = '';
+
+  req.on('data', function (data) {
+    var data = (buff + data).split(/\n+/),
+        l = data.length - 1,
+        i = 0;
+
+    for (; i < l; i++) {
+      try {
+        stream.emit('log', JSON.parse(data[i]));
+      } catch (e) {
+        stream.emit('error', e);
+      }
+    }
+
+    buff = data[l];
+  });
+
+  req.on('error', function (err) {
+    stream.emit('error', err);
+  });
+
+  return stream;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/memory.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/memory.js
new file mode 100755 (executable)
index 0000000..4c86e1c
--- /dev/null
@@ -0,0 +1,85 @@
+var events = require('events'),
+    util = require('util'),
+    colors = require('colors'),
+    common = require('../common'),
+    Transport = require('./transport').Transport;
+
+//
+// ### function Memory (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the Memory transport object responsible
+// for persisting log messages and metadata to a memory array of messages.
+//
+var Memory = exports.Memory = function (options) {
+  Transport.call(this, options);
+  options = options || {};
+
+  this.errorOutput = [];
+  this.writeOutput = [];
+
+  this.json        = options.json        || false;
+  this.colorize    = options.colorize    || false;
+  this.prettyPrint = options.prettyPrint || false;
+  this.timestamp   = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
+  this.label       = options.label       || null;
+
+  if (this.json) {
+    this.stringify = options.stringify || function (obj) {
+      return JSON.stringify(obj, null, 2);
+    };
+  }
+};
+
+//
+// Inherit from `winston.Transport`.
+//
+util.inherits(Memory, Transport);
+
+//
+// Expose the name of this Transport on the prototype
+//
+Memory.prototype.name = 'memory';
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+Memory.prototype.log = function (level, msg, meta, callback) {
+  if (this.silent) {
+    return callback(null, true);
+  }
+
+  var self = this,
+      output;
+
+  output = common.log({
+    colorize:    this.colorize,
+    json:        this.json,
+    level:       level,
+    message:     msg,
+    meta:        meta,
+    stringify:   this.stringify,
+    timestamp:   this.timestamp,
+    prettyPrint: this.prettyPrint,
+    raw:         this.raw,
+    label:       this.label
+  });
+
+  if (level === 'error' || level === 'debug') {
+    this.errorOutput.push(output);
+  } else {
+    this.writeOutput.push(output);
+  }
+
+  self.emit('logged');
+  callback(null, true);
+};
+
+Memory.prototype.clearLogs = function () {
+  this.errorOutput = [];
+  this.writeOutput = [];
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/transport.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/transport.js
new file mode 100755 (executable)
index 0000000..0be7f57
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * transport.js: Base Transport object for all Winston transports.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var events = require('events'),
+    util = require('util');
+
+//
+// ### function Transport (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the Tranport object responsible
+// base functionality for all winston transports.
+//
+var Transport = exports.Transport = function (options) {
+  events.EventEmitter.call(this);
+
+  options               = options        || {};
+  this.level            = options.level === undefined ? 'info' : options.level;
+  this.silent           = options.silent || false;
+  this.raw              = options.raw    || false;
+  this.name             = options.name   || this.name;
+
+  this.handleExceptions = options.handleExceptions || false;
+};
+
+//
+// Inherit from `events.EventEmitter`.
+//
+util.inherits(Transport, events.EventEmitter);
+
+//
+// ### function formatQuery (query)
+// #### @query {string|Object} Query to format
+// Formats the specified `query` Object (or string) to conform
+// with the underlying implementation of this transport.
+//
+Transport.prototype.formatQuery = function (query) {
+  return query;
+};
+
+//
+// ### function normalizeQuery (query)
+// #### @options {string|Object} Query to normalize
+// Normalize options for query
+//
+Transport.prototype.normalizeQuery = function (options) {
+  //
+  // Use options similar to loggly.
+  // [See Loggly Search API](http://wiki.loggly.com/retrieve_events#optional)
+  //
+
+  options = options || {};
+
+  // limit
+  options.rows = options.rows || options.limit || 10;
+
+  // starting row offset
+  options.start = options.start || 0;
+
+  // now - 24
+  options.from = options.from || new Date - (24 * 60 * 60 * 1000);
+  if (typeof options.from !== 'object') {
+    options.from = new Date(options.from);
+  }
+
+  // now
+  options.until = options.until || new Date;
+  if (typeof options.until !== 'object') {
+    options.until = new Date(options.until);
+  }
+
+  // 'asc' or 'desc'
+  options.order = options.order || 'desc';
+
+  // which fields to select
+  options.fields = options.fields;
+
+  return options;
+};
+
+//
+// ### function formatResults (results, options)
+// #### @results {Object|Array} Results returned from `.query`.
+// #### @options {Object} **Optional** Formatting options
+// Formats the specified `results` with the given `options` accordinging
+// to the implementation of this transport.
+//
+Transport.prototype.formatResults = function (results, options) {
+  return results;
+};
+
+//
+// ### function logException (msg, meta, callback)
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Logs the specified `msg`, `meta` and responds to the callback once the log
+// operation is complete to ensure that the event loop will not exit before
+// all logging has completed.
+//
+Transport.prototype.logException = function (msg, meta, callback) {
+  var self = this;
+
+  function onLogged () {
+    self.removeListener('error', onError);
+    callback();
+  }
+
+  function onError () {
+    self.removeListener('logged', onLogged);
+    callback();
+  }
+
+  this.once('logged', onLogged);
+  this.once('error', onError);
+  this.log('error', msg, meta, function () { });
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/webhook.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/lib/winston/transports/webhook.js
new file mode 100755 (executable)
index 0000000..ab0ca05
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks )
+ *
+ * (C) 2011 Marak Squires
+ * MIT LICENCE
+ *
+ */
+
+var events = require('events'),
+    http = require('http'),
+    https = require('https'),
+    util = require('util'),
+    cycle = require('cycle'),
+    common = require('../common'),
+    Transport = require('./transport').Transport;
+
+//
+// ### function WebHook (options)
+// #### @options {Object} Options for this instance.
+// Constructor function for the Console transport object responsible
+// for making arbitrary HTTP requests whenever log messages and metadata
+// are received.
+//
+var Webhook = exports.Webhook = function (options) {
+  Transport.call(this, options);
+
+  this.name   = 'webhook';
+  this.host   = options.host   || 'localhost';
+  this.port   = options.port   || 8080;
+  this.method = options.method || 'POST';
+  this.path   = options.path   || '/winston-log';
+
+  if (options.auth) {
+    this.auth = {};
+    this.auth.username = options.auth.username || '';
+    this.auth.password = options.auth.password || '';
+  }
+
+  if (options.ssl) {
+    this.port     = options.port || 443;
+    this.ssl      = {
+      key:  options.ssl.key  || null,
+      cert: options.ssl.cert || null,
+      ca:   options.ssl.ca
+    };
+  }
+};
+
+//
+// Inherit from `winston.Transport`.
+//
+util.inherits(Webhook, Transport);
+
+//
+// Expose the name of this Transport on the prototype
+//
+Webhook.prototype.name = 'webhook';
+
+//
+// ### function log (level, msg, [meta], callback)
+// #### @level {string} Level at which to log the message.
+// #### @msg {string} Message to log
+// #### @meta {Object} **Optional** Additional metadata to attach
+// #### @callback {function} Continuation to respond to when complete.
+// Core logging method exposed to Winston. Metadata is optional.
+//
+Webhook.prototype.log = function (level, msg, meta, callback) {
+  if (this.silent) {
+    return callback(null, true);
+  }
+
+  var self = this,
+      meta = cycle.decycle(meta),
+      message = common.clone(meta),
+      options,
+      req;
+
+  // Prepare options for outgoing HTTP request
+  options = {
+    host: this.host,
+    port: this.port,
+    path: this.path,
+    method: this.method,
+    headers: { 'Content-Type': 'application/json' }
+  };
+
+  if (this.ssl) {
+    options.ca = this.ssl.ca;
+    options.key = this.ssl.key;
+    options.cert = this.ssl.cert;
+
+    // Required for the test fixture SSL certificate to be considered valid.
+    options.rejectUnauthorized = false;
+  }
+
+  if (this.auth) {
+    // Encode `Authorization` header used by Basic Auth
+    options.headers['Authorization'] = 'Basic ' + new Buffer(
+      this.auth.username + ':' + this.auth.password, 'utf8'
+    ).toString('base64');
+  }
+
+  // Perform HTTP logging request
+  req = (self.ssl ? https : http).request(options, function (res) {
+    // TODO: emit 'logged' correctly,
+    // keep track of pending logs.
+    res.on('data', function(data) {
+      // Do nothing. We need to read the response, or we run into maxSockets
+      // after 5 requests.
+    });
+
+    self.emit('logged');
+    if (callback) callback(null, true);
+    callback = null;
+  });
+
+  req.on('error', function (err) {
+    //
+    // Propagate the `error` back up to the `Logger` that this
+    // instance belongs to.
+    //
+    self.emit('error', err);
+    if (callback) callback(err, false);
+    callback = null;
+  });
+
+  //
+  // Write logging event to the outgoing request body
+  //
+  // jsonMessage is currently conforming to JSON-RPC v1.0,
+  // but without the unique id since there is no anticipated response
+  // see: http://en.wikipedia.org/wiki/JSON-RPC
+  //
+
+  var params = common.clone(meta) || {};
+  params.timestamp = new Date();
+  params.message = msg;
+  params.level = level;
+
+  req.write(JSON.stringify({
+    method: 'log',
+    params: params
+  }));
+
+  req.end();
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/MIT-LICENSE.txt b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/MIT-LICENSE.txt
new file mode 100755 (executable)
index 0000000..7dca107
--- /dev/null
@@ -0,0 +1,22 @@
+Copyright (c) 2010 
+
+Marak Squires
+Alexis Sellier (cloudhead)
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/ReadMe.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/ReadMe.md
new file mode 100755 (executable)
index 0000000..0eda52d
--- /dev/null
@@ -0,0 +1,77 @@
+# colors.js - get color and style in your node.js console ( and browser ) like what
+
+<img src="http://i.imgur.com/goJdO.png" border = "0"/>
+
+
+## Installation
+
+    npm install colors
+
+## colors and styles!
+
+- bold
+- italic
+- underline
+- inverse
+- yellow
+- cyan
+- white
+- magenta
+- green
+- red
+- grey
+- blue
+- rainbow
+- zebra
+- random
+
+## Usage
+
+``` js
+var colors = require('./colors');
+
+console.log('hello'.green); // outputs green text
+console.log('i like cake and pies'.underline.red) // outputs red underlined text
+console.log('inverse the color'.inverse); // inverses the color
+console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)
+```
+
+# Creating Custom themes
+
+```js
+
+var colors = require('colors');
+
+colors.setTheme({
+  silly: 'rainbow',
+  input: 'grey',
+  verbose: 'cyan',
+  prompt: 'grey',
+  info: 'green',
+  data: 'grey',
+  help: 'cyan',
+  warn: 'yellow',
+  debug: 'blue',
+  error: 'red'
+});
+
+// outputs red text
+console.log("this is an error".error);
+
+// outputs yellow text
+console.log("this is a warning".warn);
+```
+
+
+### Contributors 
+
+Marak (Marak Squires)
+Alexis Sellier (cloudhead)
+mmalecki (Maciej Małecki)
+nicoreed (Nico Reed)
+morganrallen (Morgan Allen)
+JustinCampbell (Justin Campbell)
+ded (Dustin Diaz)
+
+
+####  , Marak Squires , Justin Campbell, Dustin Diaz (@ded)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/colors.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/colors.js
new file mode 100755 (executable)
index 0000000..7a537d8
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+colors.js
+
+Copyright (c) 2010
+
+Marak Squires
+Alexis Sellier (cloudhead)
+
+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.
+
+*/
+
+var isHeadless = false;
+
+if (typeof module !== 'undefined') {
+  isHeadless = true;
+}
+
+if (!isHeadless) {
+  var exports = {};
+  var module = {};
+  var colors = exports;
+  exports.mode = "browser";
+} else {
+  exports.mode = "console";
+}
+
+//
+// Prototypes the string object to have additional method calls that add terminal colors
+//
+var addProperty = function (color, func) {
+  exports[color] = function (str) {
+    return func.apply(str);
+  };
+  String.prototype.__defineGetter__(color, func);
+};
+
+function stylize(str, style) {
+
+  var styles;
+
+  if (exports.mode === 'console') {
+    styles = {
+      //styles
+      'bold'      : ['\x1B[1m',  '\x1B[22m'],
+      'italic'    : ['\x1B[3m',  '\x1B[23m'],
+      'underline' : ['\x1B[4m',  '\x1B[24m'],
+      'inverse'   : ['\x1B[7m',  '\x1B[27m'],
+      'strikethrough' : ['\x1B[9m',  '\x1B[29m'],
+      //text colors
+      //grayscale
+      'white'     : ['\x1B[37m', '\x1B[39m'],
+      'grey'      : ['\x1B[90m', '\x1B[39m'],
+      'black'     : ['\x1B[30m', '\x1B[39m'],
+      //colors
+      'blue'      : ['\x1B[34m', '\x1B[39m'],
+      'cyan'      : ['\x1B[36m', '\x1B[39m'],
+      'green'     : ['\x1B[32m', '\x1B[39m'],
+      'magenta'   : ['\x1B[35m', '\x1B[39m'],
+      'red'       : ['\x1B[31m', '\x1B[39m'],
+      'yellow'    : ['\x1B[33m', '\x1B[39m'],
+      //background colors
+      //grayscale
+      'whiteBG'     : ['\x1B[47m', '\x1B[49m'],
+      'greyBG'      : ['\x1B[49;5;8m', '\x1B[49m'],
+      'blackBG'     : ['\x1B[40m', '\x1B[49m'],
+      //colors
+      'blueBG'      : ['\x1B[44m', '\x1B[49m'],
+      'cyanBG'      : ['\x1B[46m', '\x1B[49m'],
+      'greenBG'     : ['\x1B[42m', '\x1B[49m'],
+      'magentaBG'   : ['\x1B[45m', '\x1B[49m'],
+      'redBG'       : ['\x1B[41m', '\x1B[49m'],
+      'yellowBG'    : ['\x1B[43m', '\x1B[49m']
+    };
+  } else if (exports.mode === 'browser') {
+    styles = {
+      //styles
+      'bold'      : ['<b>',  '</b>'],
+      'italic'    : ['<i>',  '</i>'],
+      'underline' : ['<u>',  '</u>'],
+      'inverse'   : ['<span style="background-color:black;color:white;">',  '</span>'],
+      'strikethrough' : ['<del>',  '</del>'],
+      //text colors
+      //grayscale
+      'white'     : ['<span style="color:white;">',   '</span>'],
+      'grey'      : ['<span style="color:gray;">',    '</span>'],
+      'black'     : ['<span style="color:black;">',   '</span>'],
+      //colors
+      'blue'      : ['<span style="color:blue;">',    '</span>'],
+      'cyan'      : ['<span style="color:cyan;">',    '</span>'],
+      'green'     : ['<span style="color:green;">',   '</span>'],
+      'magenta'   : ['<span style="color:magenta;">', '</span>'],
+      'red'       : ['<span style="color:red;">',     '</span>'],
+      'yellow'    : ['<span style="color:yellow;">',  '</span>'],
+      //background colors
+      //grayscale
+      'whiteBG'     : ['<span style="background-color:white;">',   '</span>'],
+      'greyBG'      : ['<span style="background-color:gray;">',    '</span>'],
+      'blackBG'     : ['<span style="background-color:black;">',   '</span>'],
+      //colors
+      'blueBG'      : ['<span style="background-color:blue;">',    '</span>'],
+      'cyanBG'      : ['<span style="background-color:cyan;">',    '</span>'],
+      'greenBG'     : ['<span style="background-color:green;">',   '</span>'],
+      'magentaBG'   : ['<span style="background-color:magenta;">', '</span>'],
+      'redBG'       : ['<span style="background-color:red;">',     '</span>'],
+      'yellowBG'    : ['<span style="background-color:yellow;">',  '</span>']
+    };
+  } else if (exports.mode === 'none') {
+    return str + '';
+  } else {
+    console.log('unsupported mode, try "browser", "console" or "none"');
+  }
+  return styles[style][0] + str + styles[style][1];
+}
+
+function applyTheme(theme) {
+
+  //
+  // Remark: This is a list of methods that exist
+  // on String that you should not overwrite.
+  //
+  var stringPrototypeBlacklist = [
+    '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor',
+    'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt',
+    'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring',
+    'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight'
+  ];
+
+  Object.keys(theme).forEach(function (prop) {
+    if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
+      console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name');
+    }
+    else {
+      if (typeof(theme[prop]) === 'string') {
+        addProperty(prop, function () {
+          return exports[theme[prop]](this);
+        });
+      }
+      else {
+        addProperty(prop, function () {
+          var ret = this;
+          for (var t = 0; t < theme[prop].length; t++) {
+            ret = exports[theme[prop][t]](ret);
+          }
+          return ret;
+        });
+      }
+    }
+  });
+}
+
+
+//
+// Iterate through all default styles and colors
+//
+var x = ['bold', 'underline', 'strikethrough', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta', 'greyBG', 'blackBG', 'yellowBG', 'redBG', 'greenBG', 'blueBG', 'whiteBG', 'cyanBG', 'magentaBG'];
+x.forEach(function (style) {
+
+  // __defineGetter__ at the least works in more browsers
+  // http://robertnyman.com/javascript/javascript-getters-setters.html
+  // Object.defineProperty only works in Chrome
+  addProperty(style, function () {
+    return stylize(this, style);
+  });
+});
+
+function sequencer(map) {
+  return function () {
+    if (!isHeadless) {
+      return this.replace(/( )/, '$1');
+    }
+    var exploded = this.split(""), i = 0;
+    exploded = exploded.map(map);
+    return exploded.join("");
+  };
+}
+
+var rainbowMap = (function () {
+  var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV
+  return function (letter, i, exploded) {
+    if (letter === " ") {
+      return letter;
+    } else {
+      return stylize(letter, rainbowColors[i++ % rainbowColors.length]);
+    }
+  };
+})();
+
+exports.themes = {};
+
+exports.addSequencer = function (name, map) {
+  addProperty(name, sequencer(map));
+};
+
+exports.addSequencer('rainbow', rainbowMap);
+exports.addSequencer('zebra', function (letter, i, exploded) {
+  return i % 2 === 0 ? letter : letter.inverse;
+});
+
+exports.setTheme = function (theme) {
+  if (typeof theme === 'string') {
+    try {
+      exports.themes[theme] = require(theme);
+      applyTheme(exports.themes[theme]);
+      return exports.themes[theme];
+    } catch (err) {
+      console.log(err);
+      return err;
+    }
+  } else {
+    applyTheme(theme);
+  }
+};
+
+
+addProperty('stripColors', function () {
+  return ("" + this).replace(/\x1B\[\d+m/g, '');
+});
+
+// please no
+function zalgo(text, options) {
+  var soul = {
+    "up" : [
+      '̍', '̎', '̄', '̅',
+      '̿', '̑', '̆', '̐',
+      '͒', '͗', '͑', '̇',
+      '̈', '̊', '͂', '̓',
+      '̈', '͊', '͋', '͌',
+      '̃', '̂', '̌', '͐',
+      '̀', '́', '̋', '̏',
+      '̒', '̓', '̔', '̽',
+      '̉', 'ͣ', 'ͤ', 'ͥ',
+      'ͦ', 'ͧ', 'ͨ', 'ͩ',
+      'ͪ', 'ͫ', 'ͬ', 'ͭ',
+      'ͮ', 'ͯ', '̾', '͛',
+      '͆', '̚'
+    ],
+    "down" : [
+      '̖', '̗', '̘', '̙',
+      '̜', '̝', '̞', '̟',
+      '̠', '̤', '̥', '̦',
+      '̩', '̪', '̫', '̬',
+      '̭', '̮', '̯', '̰',
+      '̱', '̲', '̳', '̹',
+      '̺', '̻', '̼', 'ͅ',
+      '͇', '͈', '͉', '͍',
+      '͎', '͓', '͔', '͕',
+      '͖', '͙', '͚', '̣'
+    ],
+    "mid" : [
+      '̕', '̛', '̀', '́',
+      '͘', '̡', '̢', '̧',
+      '̨', '̴', '̵', '̶',
+      '͜', '͝', '͞',
+      '͟', '͠', '͢', '̸',
+      '̷', '͡', ' ҉'
+    ]
+  },
+  all = [].concat(soul.up, soul.down, soul.mid),
+  zalgo = {};
+
+  function randomNumber(range) {
+    var r = Math.floor(Math.random() * range);
+    return r;
+  }
+
+  function is_char(character) {
+    var bool = false;
+    all.filter(function (i) {
+      bool = (i === character);
+    });
+    return bool;
+  }
+
+  function heComes(text, options) {
+    var result = '', counts, l;
+    options = options || {};
+    options["up"] = options["up"] || true;
+    options["mid"] = options["mid"] || true;
+    options["down"] = options["down"] || true;
+    options["size"] = options["size"] || "maxi";
+    text = text.split('');
+    for (l in text) {
+      if (is_char(l)) {
+        continue;
+      }
+      result = result + text[l];
+      counts = {"up" : 0, "down" : 0, "mid" : 0};
+      switch (options.size) {
+      case 'mini':
+        counts.up = randomNumber(8);
+        counts.min = randomNumber(2);
+        counts.down = randomNumber(8);
+        break;
+      case 'maxi':
+        counts.up = randomNumber(16) + 3;
+        counts.min = randomNumber(4) + 1;
+        counts.down = randomNumber(64) + 3;
+        break;
+      default:
+        counts.up = randomNumber(8) + 1;
+        counts.mid = randomNumber(6) / 2;
+        counts.down = randomNumber(8) + 1;
+        break;
+      }
+
+      var arr = ["up", "mid", "down"];
+      for (var d in arr) {
+        var index = arr[d];
+        for (var i = 0 ; i <= counts[index]; i++) {
+          if (options[index]) {
+            result = result + soul[index][randomNumber(soul[index].length)];
+          }
+        }
+      }
+    }
+    return result;
+  }
+  return heComes(text);
+}
+
+
+// don't summon zalgo
+addProperty('zalgo', function () {
+  return zalgo(this);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/example.html b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/example.html
new file mode 100755 (executable)
index 0000000..7a2ae60
--- /dev/null
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<html lang="en-us">
+  <head>
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+    <title>Colors Example</title>
+    <script src="colors.js"></script>
+  </head>
+  <body>
+    <script>
+
+    var test = colors.red("hopefully colorless output");
+
+    document.write('Rainbows are fun!'.rainbow + '<br/>');
+    document.write('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
+    document.write('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
+    //document.write('zalgo time!'.zalgo);
+    document.write(test.stripColors);
+    document.write("a".grey + " b".black);
+
+    document.write("Zebras are so fun!".zebra);
+
+    document.write(colors.rainbow('Rainbows are fun!'));
+    document.write("This is " + "not".strikethrough + " fun.");
+
+    document.write(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
+    document.write(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
+    //document.write(colors.zalgo('zalgo time!'));
+    document.write(colors.stripColors(test));
+    document.write(colors.grey("a") + colors.black(" b"));
+
+    colors.addSequencer("america", function(letter, i, exploded) {
+      if(letter === " ") return letter;
+      switch(i%3) {
+        case 0: return letter.red;
+        case 1: return letter.white;
+        case 2: return letter.blue;
+      }
+    });
+
+    colors.addSequencer("random", (function() {
+      var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
+
+      return function(letter, i, exploded) {
+        return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
+      };
+    })());
+
+    document.write("AMERICA! F--K YEAH!".america);
+    document.write("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
+
+    //
+    // Custom themes
+    //
+
+    colors.setTheme({
+      silly: 'rainbow',
+      input: 'grey',
+      verbose: 'cyan',
+      prompt: 'grey',
+      info: 'green',
+      data: 'grey',
+      help: 'cyan',
+      warn: 'yellow',
+      debug: 'blue',
+      error: 'red'
+    });
+
+    // outputs red text
+    document.write("this is an error".error);
+
+    // outputs yellow text
+    document.write("this is a warning".warn);
+
+    </script>
+  </body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/example.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/example.js
new file mode 100755 (executable)
index 0000000..b1e03a4
--- /dev/null
@@ -0,0 +1,77 @@
+var colors = require('./colors');
+
+//colors.mode = "browser";
+
+var test = colors.red("hopefully colorless output");
+console.log('Rainbows are fun!'.rainbow);
+console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
+console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
+//console.log('zalgo time!'.zalgo);
+console.log(test.stripColors);
+console.log("a".grey + " b".black);
+console.log("Zebras are so fun!".zebra);
+console.log('background color attack!'.black.whiteBG)
+
+//
+// Remark: .strikethrough may not work with Mac OS Terminal App
+//
+console.log("This is " + "not".strikethrough + " fun.");
+console.log(colors.rainbow('Rainbows are fun!'));
+console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported
+console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported
+//console.log(colors.zalgo('zalgo time!'));
+console.log(colors.stripColors(test));
+console.log(colors.grey("a") + colors.black(" b"));
+
+colors.addSequencer("america", function(letter, i, exploded) {
+  if(letter === " ") return letter;
+  switch(i%3) {
+    case 0: return letter.red;
+    case 1: return letter.white;
+    case 2: return letter.blue;
+  }
+});
+
+colors.addSequencer("random", (function() {
+  var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
+
+  return function(letter, i, exploded) {
+    return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
+  };
+})());
+
+console.log("AMERICA! F--K YEAH!".america);
+console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
+
+//
+// Custom themes
+//
+
+// Load theme with JSON literal
+colors.setTheme({
+  silly: 'rainbow',
+  input: 'grey',
+  verbose: 'cyan',
+  prompt: 'grey',
+  info: 'green',
+  data: 'grey',
+  help: 'cyan',
+  warn: 'yellow',
+  debug: 'blue',
+  error: 'red'
+});
+
+// outputs red text
+console.log("this is an error".error);
+
+// outputs yellow text
+console.log("this is a warning".warn);
+
+// outputs grey text
+console.log("this is an input".input);
+
+// Load a theme from file
+colors.setTheme('./themes/winston-dark.js');
+
+console.log("this is an input".input);
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/package.json
new file mode 100755 (executable)
index 0000000..fcef3d8
--- /dev/null
@@ -0,0 +1,46 @@
+{
+  "name": "colors",
+  "description": "get colors in your node.js console like what",
+  "version": "0.6.2",
+  "author": {
+    "name": "Marak Squires"
+  },
+  "homepage": "https://github.com/Marak/colors.js",
+  "bugs": {
+    "url": "https://github.com/Marak/colors.js/issues"
+  },
+  "keywords": [
+    "ansi",
+    "terminal",
+    "colors"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/Marak/colors.js.git"
+  },
+  "engines": {
+    "node": ">=0.1.90"
+  },
+  "main": "colors",
+  "_id": "colors@0.6.2",
+  "dist": {
+    "shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
+    "tarball": "http://registry.npmjs.org/colors/-/colors-0.6.2.tgz"
+  },
+  "_from": "colors@0.6.x",
+  "_npmVersion": "1.2.30",
+  "_npmUser": {
+    "name": "marak",
+    "email": "marak.squires@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "marak",
+      "email": "marak.squires@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "2423fe6678ac0c5dae8852e5d0e5be08c997abcc",
+  "_resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/test.js
new file mode 100755 (executable)
index 0000000..c32417d
--- /dev/null
@@ -0,0 +1,70 @@
+var assert = require('assert'),
+    colors = require('./colors');
+
+var s = 'string';
+
+function a(s, code) {
+  return '\x1B[' + code.toString() + 'm' + s + '\x1B[39m';
+}
+
+function aE(s, color, code) {
+  assert.equal(s[color], a(s, code));
+  assert.equal(colors[color](s), a(s, code));
+  assert.equal(s[color], colors[color](s));
+  assert.equal(s[color].stripColors, s);
+  assert.equal(s[color].stripColors, colors.stripColors(s));
+}
+
+function h(s, color) {
+  return '<span style="color:' + color + ';">' + s + '</span>';
+}
+
+var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow'];
+var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']);
+
+colors.mode = 'console';
+assert.equal(s.bold, '\x1B[1m' + s + '\x1B[22m');
+assert.equal(s.italic, '\x1B[3m' + s + '\x1B[23m');
+assert.equal(s.underline, '\x1B[4m' + s + '\x1B[24m');
+assert.equal(s.strikethrough, '\x1B[9m' + s + '\x1B[29m');
+assert.equal(s.inverse, '\x1B[7m' + s + '\x1B[27m');
+assert.ok(s.rainbow);
+aE(s, 'white', 37);
+aE(s, 'grey', 90);
+aE(s, 'black', 30);
+aE(s, 'blue', 34);
+aE(s, 'cyan', 36);
+aE(s, 'green', 32);
+aE(s, 'magenta', 35);
+aE(s, 'red', 31);
+aE(s, 'yellow', 33);
+assert.equal(s, 'string');
+
+colors.setTheme({error:'red'});
+
+assert.equal(typeof("astring".red),'string');
+assert.equal(typeof("astring".error),'string');
+
+colors.mode = 'browser';
+assert.equal(s.bold, '<b>' + s + '</b>');
+assert.equal(s.italic, '<i>' + s + '</i>');
+assert.equal(s.underline, '<u>' + s + '</u>');
+assert.equal(s.strikethrough, '<del>' + s + '</del>');
+assert.equal(s.inverse, '<span style="background-color:black;color:white;">' + s + '</span>');
+assert.ok(s.rainbow);
+stylesColors.forEach(function (color) {
+  assert.equal(s[color], h(s, color));
+  assert.equal(colors[color](s), h(s, color));
+});
+
+assert.equal(typeof("astring".red),'string');
+assert.equal(typeof("astring".error),'string');
+
+colors.mode = 'none';
+stylesAll.forEach(function (style) {
+  assert.equal(s[style], s);
+  assert.equal(colors[style](s), s);
+});
+
+assert.equal(typeof("astring".red),'string');
+assert.equal(typeof("astring".error),'string');
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/themes/winston-dark.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/themes/winston-dark.js
new file mode 100755 (executable)
index 0000000..49a905b
--- /dev/null
@@ -0,0 +1,12 @@
+module['exports'] = {
+  silly: 'rainbow',
+  input: 'black',
+  verbose: 'cyan',
+  prompt: 'grey',
+  info: 'green',
+  data: 'grey',
+  help: 'cyan',
+  warn: 'yellow',
+  debug: 'blue',
+  error: 'red'
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/themes/winston-light.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/colors/themes/winston-light.js
new file mode 100755 (executable)
index 0000000..571972c
--- /dev/null
@@ -0,0 +1,12 @@
+module['exports'] = {
+  silly: 'rainbow',
+  input: 'grey',
+  verbose: 'cyan',
+  prompt: 'grey',
+  info: 'green',
+  data: 'grey',
+  help: 'cyan',
+  warn: 'yellow',
+  debug: 'blue',
+  error: 'red'
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/README.md
new file mode 100755 (executable)
index 0000000..de9a06d
--- /dev/null
@@ -0,0 +1,49 @@
+Fork of https://github.com/douglascrockford/JSON-js, maintained in npm as `cycle`.
+
+# Contributors
+
+* Douglas Crockford
+* Nuno Job
+* Justin Warkentin
+
+# JSON in JavaScript
+
+Douglas Crockford
+douglas@crockford.com
+
+2010-11-18
+
+
+JSON is a light-weight, language independent, data interchange format.
+See http://www.JSON.org/
+
+The files in this collection implement JSON encoders/decoders in JavaScript.
+
+JSON became a built-in feature of JavaScript when the ECMAScript Programming
+Language Standard - Fifth Edition was adopted by the ECMA General Assembly
+in December 2009. Most of the files in this collection are for applications
+that are expected to run in obsolete web browsers. For most purposes, json2.js
+is the best choice.
+
+
+json2.js: This file creates a JSON property in the global object, if there
+isn't already one, setting its value to an object containing a stringify
+method and a parse method. The parse method uses the eval method to do the
+parsing, guarding it with several regular expressions to defend against
+accidental code execution hazards. On current browsers, this file does nothing,
+prefering the built-in JSON object.
+
+json.js: This file does everything that json2.js does. It also adds a
+toJSONString method and a parseJSON method to Object.prototype. Use of this
+file is not recommended.
+
+json_parse.js: This file contains an alternative JSON parse function that
+uses recursive descent instead of eval.
+
+json_parse_state.js: This files contains an alternative JSON parse function that
+uses a state machine instead of eval.
+
+cycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,
+which make it possible to encode cyclical structures and dags in JSON, and to
+then recover them. JSONPath is used to represent the links.
+http://GOESSNER.net/articles/JsonPath/
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/cycle.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/cycle.js
new file mode 100755 (executable)
index 0000000..2e776ad
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+    cycle.js
+    2013-02-19
+
+    Public Domain.
+
+    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+    This code should be minified before deployment.
+    See http://javascript.crockford.com/jsmin.html
+
+    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+    NOT CONTROL.
+*/
+
+/*jslint evil: true, regexp: true */
+
+/*members $ref, apply, call, decycle, hasOwnProperty, length, prototype, push,
+    retrocycle, stringify, test, toString
+*/
+
+var cycle = exports;
+
+cycle.decycle = function decycle(object) {
+    'use strict';
+
+// Make a deep copy of an object or array, assuring that there is at most
+// one instance of each object or array in the resulting structure. The
+// duplicate references (which might be forming cycles) are replaced with
+// an object of the form
+//      {$ref: PATH}
+// where the PATH is a JSONPath string that locates the first occurance.
+// So,
+//      var a = [];
+//      a[0] = a;
+//      return JSON.stringify(JSON.decycle(a));
+// produces the string '[{"$ref":"$"}]'.
+
+// JSONPath is used to locate the unique object. $ indicates the top level of
+// the object or array. [NUMBER] or [STRING] indicates a child member or
+// property.
+
+    var objects = [],   // Keep a reference to each unique object or array
+        paths = [];     // Keep the path to each unique object or array
+
+    return (function derez(value, path) {
+
+// The derez recurses through the object, producing the deep copy.
+
+        var i,          // The loop counter
+            name,       // Property name
+            nu;         // The new object or array
+
+// typeof null === 'object', so go on if this value is really an object but not
+// one of the weird builtin objects.
+
+        if (typeof value === 'object' && value !== null &&
+                !(value instanceof Boolean) &&
+                !(value instanceof Date)    &&
+                !(value instanceof Number)  &&
+                !(value instanceof RegExp)  &&
+                !(value instanceof String)) {
+
+// If the value is an object or array, look to see if we have already
+// encountered it. If so, return a $ref/path object. This is a hard way,
+// linear search that will get slower as the number of unique objects grows.
+
+            for (i = 0; i < objects.length; i += 1) {
+                if (objects[i] === value) {
+                    return {$ref: paths[i]};
+                }
+            }
+
+// Otherwise, accumulate the unique value and its path.
+
+            objects.push(value);
+            paths.push(path);
+
+// If it is an array, replicate the array.
+
+            if (Object.prototype.toString.apply(value) === '[object Array]') {
+                nu = [];
+                for (i = 0; i < value.length; i += 1) {
+                    nu[i] = derez(value[i], path + '[' + i + ']');
+                }
+            } else {
+
+// If it is an object, replicate the object.
+
+                nu = {};
+                for (name in value) {
+                    if (Object.prototype.hasOwnProperty.call(value, name)) {
+                        nu[name] = derez(value[name],
+                            path + '[' + JSON.stringify(name) + ']');
+                    }
+                }
+            }
+            return nu;
+        }
+        return value;
+    }(object, '$'));
+};
+
+
+cycle.retrocycle = function retrocycle($) {
+    'use strict';
+
+// Restore an object that was reduced by decycle. Members whose values are
+// objects of the form
+//      {$ref: PATH}
+// are replaced with references to the value found by the PATH. This will
+// restore cycles. The object will be mutated.
+
+// The eval function is used to locate the values described by a PATH. The
+// root object is kept in a $ variable. A regular expression is used to
+// assure that the PATH is extremely well formed. The regexp contains nested
+// * quantifiers. That has been known to have extremely bad performance
+// problems on some browsers for very long strings. A PATH is expected to be
+// reasonably short. A PATH is allowed to belong to a very restricted subset of
+// Goessner's JSONPath.
+
+// So,
+//      var s = '[{"$ref":"$"}]';
+//      return JSON.retrocycle(JSON.parse(s));
+// produces an array containing a single element which is the array itself.
+
+    var px =
+        /^\$(?:\[(?:\d+|\"(?:[^\\\"\u0000-\u001f]|\\([\\\"\/bfnrt]|u[0-9a-zA-Z]{4}))*\")\])*$/;
+
+    (function rez(value) {
+
+// The rez function walks recursively through the object looking for $ref
+// properties. When it finds one that has a value that is a path, then it
+// replaces the $ref object with a reference to the value that is found by
+// the path.
+
+        var i, item, name, path;
+
+        if (value && typeof value === 'object') {
+            if (Object.prototype.toString.apply(value) === '[object Array]') {
+                for (i = 0; i < value.length; i += 1) {
+                    item = value[i];
+                    if (item && typeof item === 'object') {
+                        path = item.$ref;
+                        if (typeof path === 'string' && px.test(path)) {
+                            value[i] = eval(path);
+                        } else {
+                            rez(item);
+                        }
+                    }
+                }
+            } else {
+                for (name in value) {
+                    if (typeof value[name] === 'object') {
+                        item = value[name];
+                        if (item) {
+                            path = item.$ref;
+                            if (typeof path === 'string' && px.test(path)) {
+                                value[name] = eval(path);
+                            } else {
+                                rez(item);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }($));
+    return $;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/cycle/package.json
new file mode 100755 (executable)
index 0000000..fa45ec9
--- /dev/null
@@ -0,0 +1,46 @@
+{
+  "name": "cycle",
+  "description": "decycle your json",
+  "author": "",
+  "version": "1.0.3",
+  "main": "./cycle.js",
+  "homepage": "https://github.com/douglascrockford/JSON-js",
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/dscape/cycle.git"
+  },
+  "bugs": {
+    "url": "http://github.com/douglascrockford/JSON-js/issues"
+  },
+  "keywords": [
+    "json",
+    "cycle",
+    "stringify",
+    "parse"
+  ],
+  "engines": {
+    "node": ">=0.4.0"
+  },
+  "readme": "Fork of https://github.com/douglascrockford/JSON-js, maintained in npm as `cycle`.\n\n# Contributors\n\n* Douglas Crockford\n* Nuno Job\n* Justin Warkentin\n\n# JSON in JavaScript\n\nDouglas Crockford\ndouglas@crockford.com\n\n2010-11-18\n\n\nJSON is a light-weight, language independent, data interchange format.\nSee http://www.JSON.org/\n\nThe files in this collection implement JSON encoders/decoders in JavaScript.\n\nJSON became a built-in feature of JavaScript when the ECMAScript Programming\nLanguage Standard - Fifth Edition was adopted by the ECMA General Assembly\nin December 2009. Most of the files in this collection are for applications\nthat are expected to run in obsolete web browsers. For most purposes, json2.js\nis the best choice.\n\n\njson2.js: This file creates a JSON property in the global object, if there\nisn't already one, setting its value to an object containing a stringify\nmethod and a parse method. The parse method uses the eval method to do the\nparsing, guarding it with several regular expressions to defend against\naccidental code execution hazards. On current browsers, this file does nothing,\nprefering the built-in JSON object.\n\njson.js: This file does everything that json2.js does. It also adds a\ntoJSONString method and a parseJSON method to Object.prototype. Use of this\nfile is not recommended.\n\njson_parse.js: This file contains an alternative JSON parse function that\nuses recursive descent instead of eval.\n\njson_parse_state.js: This files contains an alternative JSON parse function that\nuses a state machine instead of eval.\n\ncycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,\nwhich make it possible to encode cyclical structures and dags in JSON, and to\nthen recover them. JSONPath is used to represent the links.\nhttp://GOESSNER.net/articles/JsonPath/\n",
+  "readmeFilename": "README.md",
+  "_id": "cycle@1.0.3",
+  "dist": {
+    "shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
+    "tarball": "http://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
+  },
+  "_from": "cycle@1.0.x",
+  "_npmVersion": "1.2.32",
+  "_npmUser": {
+    "name": "dscape",
+    "email": "nunojobpinto@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "dscape",
+      "email": "nunojobpinto@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
+  "_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/LICENSE
new file mode 100755 (executable)
index 0000000..a1edd93
--- /dev/null
@@ -0,0 +1,20 @@
+Copyright (c) 2009 cloudhead
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/Makefile
new file mode 100755 (executable)
index 0000000..a121dea
--- /dev/null
@@ -0,0 +1,4 @@
+test:
+       @@node test/eyes-test.js
+
+.PHONY: test
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/README.md
new file mode 100755 (executable)
index 0000000..c4f6f76
--- /dev/null
@@ -0,0 +1,73 @@
+eyes
+====
+
+a customizable value inspector for Node.js
+
+synopsis
+--------
+
+I was tired of looking at cluttered output in the console -- something needed to be done,
+`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. 
+So I decided to have some fun. _eyes_ were born.
+
+![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)
+
+_example of the output of a user-customized eyes.js inspector_
+
+*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.
+
+usage
+-----
+
+    var inspect = require('eyes').inspector({styles: {all: 'magenta'}});
+
+    inspect(something); // inspect with the settings passed to `inspector`
+
+or
+
+    var eyes = require('eyes');
+
+    eyes.inspect(something); // inspect with the default settings
+
+you can pass a _label_ to `inspect()`, to keep track of your inspections:
+
+    eyes.inspect(something, "a random value");
+
+If you want to return the output of eyes without printing it, you can set it up this way:
+
+    var inspect = require('eyes').inspector({ stream: null });
+
+    sys.puts(inspect({ something: 42 }));
+
+customization
+-------------
+
+These are the default styles and settings used by _eyes_.
+
+    styles: {                 // Styles applied to stdout
+        all:     'cyan',      // Overall style applied to everything
+        label:   'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`
+        other:   'inverted',  // Objects which don't have a literal representation, such as functions
+        key:     'bold',      // The keys in object literals, like 'a' in `{a: 1}`
+        special: 'grey',      // null, undefined...
+        string:  'green',
+        number:  'magenta',
+        bool:    'blue',      // true false
+        regexp:  'green',     // /\d+/
+    },
+    
+    pretty: true,             // Indent object literals
+    hideFunctions: false,     // Don't output functions at all
+    stream: process.stdout,   // Stream to write to, or null
+    maxLength: 2048           // Truncate output if longer
+
+You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.
+
+    var inspect = require('eyes').inspector({
+        styles: {
+            all: 'magenta',
+            special: 'bold'
+        },
+        maxLength: 512
+    });
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/lib/eyes.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/lib/eyes.js
new file mode 100755 (executable)
index 0000000..10d964b
--- /dev/null
@@ -0,0 +1,236 @@
+//
+// Eyes.js - a customizable value inspector for Node.js
+//
+//   usage:
+//
+//       var inspect = require('eyes').inspector({styles: {all: 'magenta'}});
+//       inspect(something); // inspect with the settings passed to `inspector`
+//
+//     or
+//
+//       var eyes = require('eyes');
+//       eyes.inspect(something); // inspect with the default settings
+//
+var eyes = exports,
+    stack = [];
+
+eyes.defaults = {
+    styles: {                 // Styles applied to stdout
+        all:     'cyan',      // Overall style applied to everything
+        label:   'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`
+        other:   'inverted',  // Objects which don't have a literal representation, such as functions
+        key:     'bold',      // The keys in object literals, like 'a' in `{a: 1}`
+        special: 'grey',      // null, undefined...
+        string:  'green',
+        number:  'magenta',
+        bool:    'blue',      // true false
+        regexp:  'green',     // /\d+/
+    },
+    pretty: true,             // Indent object literals
+    hideFunctions: false,
+    showHidden: false,
+    stream: process.stdout,
+    maxLength: 2048           // Truncate output if longer
+};
+
+// Return a curried inspect() function, with the `options` argument filled in.
+eyes.inspector = function (options) {
+    var that = this;
+    return function (obj, label, opts) {
+        return that.inspect.call(that, obj, label,
+            merge(options || {}, opts || {}));
+    };
+};
+
+// If we have a `stream` defined, use it to print a styled string,
+// if not, we just return the stringified object.
+eyes.inspect = function (obj, label, options) {
+    options = merge(this.defaults, options || {});
+
+    if (options.stream) {
+        return this.print(stringify(obj, options), label, options);
+    } else {
+        return stringify(obj, options) + (options.styles ? '\033[39m' : '');
+    }
+};
+
+// Output using the 'stream', and an optional label
+// Loop through `str`, and truncate it after `options.maxLength` has been reached.
+// Because escape sequences are, at this point embeded within
+// the output string, we can't measure the length of the string
+// in a useful way, without separating what is an escape sequence,
+// versus a printable character (`c`). So we resort to counting the
+// length manually.
+eyes.print = function (str, label, options) {
+    for (var c = 0, i = 0; i < str.length; i++) {
+        if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5
+        else if (c === options.maxLength) {
+           str = str.slice(0, i - 1) + '…';
+           break;
+        } else { c++ }
+    }
+    return options.stream.write.call(options.stream, (label ?
+        this.stylize(label, options.styles.label, options.styles) + ': ' : '') +
+        this.stylize(str,   options.styles.all, options.styles) + '\033[0m' + "\n");
+};
+
+// Apply a style to a string, eventually,
+// I'd like this to support passing multiple
+// styles.
+eyes.stylize = function (str, style, styles) {
+    var codes = {
+        'bold'      : [1,  22],
+        'underline' : [4,  24],
+        'inverse'   : [7,  27],
+        'cyan'      : [36, 39],
+        'magenta'   : [35, 39],
+        'blue'      : [34, 39],
+        'yellow'    : [33, 39],
+        'green'     : [32, 39],
+        'red'       : [31, 39],
+        'grey'      : [90, 39]
+    }, endCode;
+
+    if (style && codes[style]) {
+        endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0]
+                                                         : codes[style][1];
+        return '\033[' + codes[style][0] + 'm' + str +
+               '\033[' + endCode + 'm';
+    } else { return str }
+};
+
+// Convert any object to a string, ready for output.
+// When an 'array' or an 'object' are encountered, they are
+// passed to specialized functions, which can then recursively call
+// stringify().
+function stringify(obj, options) {
+    var that = this, stylize = function (str, style) {
+        return eyes.stylize(str, options.styles[style], options.styles)
+    }, index, result;
+
+    if ((index = stack.indexOf(obj)) !== -1) {
+        return stylize(new(Array)(stack.length - index + 1).join('.'), 'special');
+    }
+    stack.push(obj);
+
+    result = (function (obj) {
+        switch (typeOf(obj)) {
+            case "string"   : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'"
+                                                                            : '"' + obj + '"');
+                              return stylize(obj, 'string');
+            case "regexp"   : return stylize('/' + obj.source + '/', 'regexp');
+            case "number"   : return stylize(obj + '',    'number');
+            case "function" : return options.stream ? stylize("Function", 'other') : '[Function]';
+            case "null"     : return stylize("null",      'special');
+            case "undefined": return stylize("undefined", 'special');
+            case "boolean"  : return stylize(obj + '',    'bool');
+            case "date"     : return stylize(obj.toUTCString());
+            case "array"    : return stringifyArray(obj,  options, stack.length);
+            case "object"   : return stringifyObject(obj, options, stack.length);
+        }
+    })(obj);
+
+    stack.pop();
+    return result;
+};
+
+// Escape invisible characters in a string
+function stringifyString (str, options) {
+    return str.replace(/\\/g, '\\\\')
+              .replace(/\n/g, '\\n')
+              .replace(/[\u0001-\u001F]/g, function (match) {
+                  return '\\0' + match[0].charCodeAt(0).toString(8);
+              });
+}
+
+// Convert an array to a string, such as [1, 2, 3].
+// This function calls stringify() for each of the elements
+// in the array.
+function stringifyArray(ary, options, level) {
+    var out = [];
+    var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) {
+        return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) ||
+               (Array.isArray(o) && o.length > 0);
+    }));
+    var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' ';
+
+    for (var i = 0; i < ary.length; i++) {
+        out.push(stringify(ary[i], options));
+    }
+
+    if (out.length === 0) {
+        return '[]';
+    } else {
+        return '[' + ws
+                   + out.join(',' + (pretty ? ws : ' '))
+                   + (pretty ? ws.slice(0, -4) : ws) +
+               ']';
+    }
+};
+
+// Convert an object to a string, such as {a: 1}.
+// This function calls stringify() for each of its values,
+// and does not output functions or prototype values.
+function stringifyObject(obj, options, level) {
+    var out = [];
+    var pretty = options.pretty && (Object.keys(obj).length > 2 ||
+                                    Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' }));
+    var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' ';
+
+    var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj);
+    keys.forEach(function (k) {
+        if (Object.prototype.hasOwnProperty.call(obj, k) 
+          && !(obj[k] instanceof Function && options.hideFunctions)) {
+            out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' +
+                     stringify(obj[k], options));
+        }
+    });
+
+    if (out.length === 0) {
+        return '{}';
+    } else {
+        return "{" + ws
+                   + out.join(',' + (pretty ? ws : ' '))
+                   + (pretty ? ws.slice(0, -4) : ws) +
+               "}";
+   }
+};
+
+// A better `typeof`
+function typeOf(value) {
+    var s = typeof(value),
+        types = [Object, Array, String, RegExp, Number, Function, Boolean, Date];
+
+    if (s === 'object' || s === 'function') {
+        if (value) {
+            types.forEach(function (t) {
+                if (value instanceof t) { s = t.name.toLowerCase() }
+            });
+        } else { s = 'null' }
+    }
+    return s;
+}
+
+function merge(/* variable args */) {
+    var objs = Array.prototype.slice.call(arguments);
+    var target = {};
+
+    objs.forEach(function (o) {
+        Object.keys(o).forEach(function (k) {
+            if (k === 'styles') {
+                if (! o.styles) {
+                    target.styles = false;
+                } else {
+                    target.styles = {}
+                    for (var s in o.styles) {
+                        target.styles[s] = o.styles[s];
+                    }
+                }
+            } else {
+                target[k] = o[k];
+            }
+        });
+    });
+    return target;
+}
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/package.json
new file mode 100755 (executable)
index 0000000..5db1dbe
--- /dev/null
@@ -0,0 +1,60 @@
+{
+  "name": "eyes",
+  "description": "a customizable value inspector",
+  "url": "http://github.com/cloudhead/eyes.js",
+  "keywords": [
+    "inspector",
+    "debug",
+    "inspect",
+    "print"
+  ],
+  "author": {
+    "name": "Alexis Sellier",
+    "email": "self@cloudhead.net"
+  },
+  "contributors": [
+    {
+      "name": "Charlie Robbins",
+      "email": "charlie@nodejitsu.com"
+    }
+  ],
+  "licenses": [
+    "MIT"
+  ],
+  "main": "./lib/eyes",
+  "version": "0.1.8",
+  "scripts": {
+    "test": "node test/*-test.js"
+  },
+  "directories": {
+    "lib": "./lib",
+    "test": "./test"
+  },
+  "engines": {
+    "node": "> 0.1.90"
+  },
+  "_id": "eyes@0.1.8",
+  "dist": {
+    "shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
+    "tarball": "http://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
+  },
+  "_npmVersion": "1.1.53",
+  "_npmUser": {
+    "name": "indexzero",
+    "email": "charlie.robbins@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "cloudhead",
+      "email": "self@cloudhead.net"
+    },
+    {
+      "name": "indexzero",
+      "email": "charlie.robbins@gmail.com"
+    }
+  ],
+  "_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
+  "_from": "eyes@0.1.x",
+  "_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/test/eyes-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/eyes/test/eyes-test.js
new file mode 100755 (executable)
index 0000000..1f9606a
--- /dev/null
@@ -0,0 +1,56 @@
+var util = require('util');
+var eyes = require('../lib/eyes');
+
+eyes.inspect({
+    number: 42,
+    string: "John Galt",
+    regexp: /[a-z]+/,
+    array: [99, 168, 'x', {}],
+    func: function () {},
+    bool: false,
+    nil: null,
+    undef: undefined,
+    object: {attr: []}
+}, "native types");
+
+eyes.inspect({
+    number: new(Number)(42),
+    string: new(String)("John Galt"),
+    regexp: new(RegExp)(/[a-z]+/),
+    array: new(Array)(99, 168, 'x', {}),
+    bool: new(Boolean)(false),
+    object: new(Object)({attr: []}),
+    date: new(Date)
+}, "wrapped types");
+
+var obj = {};
+obj.that = { self: obj };
+obj.self = obj;
+
+eyes.inspect(obj, "circular object");
+eyes.inspect({hello: 'moto'}, "small object");
+eyes.inspect({hello: new(Array)(6) }, "big object");
+eyes.inspect(["hello 'world'", 'hello "world"'], "quotes");
+eyes.inspect({
+    recommendations: [{
+        id: 'a7a6576c2c822c8e2bd81a27e41437d8',
+        key: [ 'spree', 3.764316258020699 ],
+        value: {
+            _id: 'a7a6576c2c822c8e2bd81a27e41437d8',
+            _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98',
+            type: 'domain',
+            domain: 'spree',
+            weight: 3.764316258020699,
+            product_id: 30
+        }
+    }]
+}, 'complex');
+
+eyes.inspect([null], "null in array");
+
+var inspect = eyes.inspector({ stream: null });
+
+util.puts(inspect('something', "something"));
+util.puts(inspect("something else"));
+
+util.puts(inspect(["no color"], null, { styles: false }));
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/LICENSE.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/LICENSE.md
new file mode 100755 (executable)
index 0000000..43f7153
--- /dev/null
@@ -0,0 +1,11 @@
+The MIT License (MIT)
+=====================
+
+Copyright (c) 2015 Rod Vagg
+---------------------------
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/README.md
new file mode 100755 (executable)
index 0000000..06770e8
--- /dev/null
@@ -0,0 +1,66 @@
+# isStream
+
+[![Build Status](https://secure.travis-ci.org/rvagg/isstream.png)](http://travis-ci.org/rvagg/isstream)
+
+**Test if an object is a `Stream`**
+
+[![NPM](https://nodei.co/npm/isstream.svg)](https://nodei.co/npm/isstream/)
+
+The missing `Stream.isStream(obj)`: determine if an object is standard Node.js `Stream`. Works for Node-core `Stream` objects (for 0.8, 0.10, 0.11, and in theory, older and newer versions) and all versions of **[readable-stream](https://github.com/isaacs/readable-stream)**.
+
+## Usage:
+
+```js
+var isStream = require('isstream')
+var Stream = require('stream')
+
+isStream(new Stream()) // true
+
+isStream({}) // false
+
+isStream(new Stream.Readable())    // true
+isStream(new Stream.Writable())    // true
+isStream(new Stream.Duplex())      // true
+isStream(new Stream.Transform())   // true
+isStream(new Stream.PassThrough()) // true
+```
+
+## But wait! There's more!
+
+You can also test for `isReadable(obj)`, `isWritable(obj)` and `isDuplex(obj)` to test for implementations of Streams2 (and Streams3) base classes.
+
+```js
+var isReadable = require('isstream').isReadable
+var isWritable = require('isstream').isWritable
+var isDuplex = require('isstream').isDuplex
+var Stream = require('stream')
+
+isReadable(new Stream()) // false
+isWritable(new Stream()) // false
+isDuplex(new Stream())   // false
+
+isReadable(new Stream.Readable())    // true
+isReadable(new Stream.Writable())    // false
+isReadable(new Stream.Duplex())      // true
+isReadable(new Stream.Transform())   // true
+isReadable(new Stream.PassThrough()) // true
+
+isWritable(new Stream.Readable())    // false
+isWritable(new Stream.Writable())    // true
+isWritable(new Stream.Duplex())      // true
+isWritable(new Stream.Transform())   // true
+isWritable(new Stream.PassThrough()) // true
+
+isDuplex(new Stream.Readable())    // false
+isDuplex(new Stream.Writable())    // false
+isDuplex(new Stream.Duplex())      // true
+isDuplex(new Stream.Transform())   // true
+isDuplex(new Stream.PassThrough()) // true
+```
+
+*Reminder: when implementing your own streams, please [use **readable-stream** rather than core streams](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).*
+
+
+## License
+
+**isStream** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/isstream.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/isstream.js
new file mode 100755 (executable)
index 0000000..a1d104a
--- /dev/null
@@ -0,0 +1,27 @@
+var stream = require('stream')
+
+
+function isStream (obj) {
+  return obj instanceof stream.Stream
+}
+
+
+function isReadable (obj) {
+  return isStream(obj) && typeof obj._read == 'function' && typeof obj._readableState == 'object'
+}
+
+
+function isWritable (obj) {
+  return isStream(obj) && typeof obj._write == 'function' && typeof obj._writableState == 'object'
+}
+
+
+function isDuplex (obj) {
+  return isReadable(obj) && isWritable(obj)
+}
+
+
+module.exports            = isStream
+module.exports.isReadable = isReadable
+module.exports.isWritable = isWritable
+module.exports.isDuplex   = isDuplex
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/package.json
new file mode 100755 (executable)
index 0000000..b9a5aa0
--- /dev/null
@@ -0,0 +1,59 @@
+{
+  "name": "isstream",
+  "version": "0.1.2",
+  "description": "Determine if an object is a Stream",
+  "main": "isstream.js",
+  "scripts": {
+    "test": "tar --xform 's/^package/readable-stream-1.0/' -zxf readable-stream-1.0.*.tgz && tar --xform 's/^package/readable-stream-1.1/' -zxf readable-stream-1.1.*.tgz && node test.js; rm -rf readable-stream-1.?/"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/rvagg/isstream.git"
+  },
+  "keywords": [
+    "stream",
+    "type",
+    "streams",
+    "readable-stream",
+    "hippo"
+  ],
+  "devDependencies": {
+    "tape": "~2.12.3",
+    "core-util-is": "~1.0.0",
+    "isarray": "0.0.1",
+    "string_decoder": "~0.10.x",
+    "inherits": "~2.0.1"
+  },
+  "author": {
+    "name": "Rod Vagg",
+    "email": "rod@vagg.org"
+  },
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/rvagg/isstream/issues"
+  },
+  "homepage": "https://github.com/rvagg/isstream",
+  "gitHead": "cd39cba6da939b4fc9110825203adc506422c3dc",
+  "_id": "isstream@0.1.2",
+  "_shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a",
+  "_from": "isstream@0.1.x",
+  "_npmVersion": "2.6.1",
+  "_nodeVersion": "1.4.3",
+  "_npmUser": {
+    "name": "rvagg",
+    "email": "rod@vagg.org"
+  },
+  "maintainers": [
+    {
+      "name": "rvagg",
+      "email": "rod@vagg.org"
+    }
+  ],
+  "dist": {
+    "shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a",
+    "tarball": "http://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/isstream/test.js
new file mode 100755 (executable)
index 0000000..8c950c5
--- /dev/null
@@ -0,0 +1,168 @@
+var tape             = require('tape')
+  , EE               = require('events').EventEmitter
+  , util             = require('util')
+
+
+  , isStream         = require('./')
+  , isReadable       = require('./').isReadable
+  , isWritable       = require('./').isWritable
+  , isDuplex         = require('./').isDuplex
+
+  , CoreStreams      = require('stream')
+  , ReadableStream10 = require('./readable-stream-1.0/')
+  , ReadableStream11 = require('./readable-stream-1.1/')
+
+
+function test (pass, type, stream) {
+  tape('isStream('  + type + ')', function (t) {
+    t.plan(1)
+    t.ok(pass === isStream(stream), type)
+  })
+}
+
+
+function testReadable (pass, type, stream) {
+  tape('isReadable('  + type + ')', function (t) {
+    t.plan(1)
+    t.ok(pass === isReadable(stream), type)
+  })
+}
+
+
+function testWritable (pass, type, stream) {
+  tape('isWritable('  + type + ')', function (t) {
+    t.plan(1)
+    t.ok(pass === isWritable(stream), type)
+  })
+}
+
+
+function testDuplex (pass, type, stream) {
+  tape('isDuplex('  + type + ')', function (t) {
+    t.plan(1)
+    t.ok(pass === isDuplex(stream), type)
+  })
+}
+
+
+[ undefined, null, '', true, false, 0, 1, 1.0, 'string', {}, function foo () {} ].forEach(function (o) {
+  test(false, 'non-stream / primitive: ' + (JSON.stringify(o) || (o && o.toString()) || o), o)
+})
+
+
+test(false, 'fake stream obj', { pipe: function () {} })
+
+
+;(function () {
+
+  // looks like a stream!
+
+  function Stream () {
+    EE.call(this)
+  }
+  util.inherits(Stream, EE)
+  Stream.prototype.pipe = function () {}
+  Stream.Stream = Stream
+
+  test(false, 'fake stream "new Stream()"', new Stream())
+
+}())
+
+
+test(true, 'CoreStreams.Stream', new (CoreStreams.Stream)())
+test(true, 'CoreStreams.Readable', new (CoreStreams.Readable)())
+test(true, 'CoreStreams.Writable', new (CoreStreams.Writable)())
+test(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
+test(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
+test(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
+
+test(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
+test(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
+test(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
+test(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
+test(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
+
+test(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
+test(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
+test(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
+test(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
+test(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
+
+
+testReadable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)())
+testReadable(true, 'CoreStreams.Readable', new (CoreStreams.Readable)())
+testReadable(false, 'CoreStreams.Writable', new (CoreStreams.Writable)())
+testReadable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
+testReadable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
+testReadable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
+
+testReadable(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
+testReadable(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
+testReadable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
+testReadable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
+testReadable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
+
+testReadable(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
+testReadable(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
+testReadable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
+testReadable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
+testReadable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
+
+
+testWritable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)())
+testWritable(false, 'CoreStreams.Readable', new (CoreStreams.Readable)())
+testWritable(true, 'CoreStreams.Writable', new (CoreStreams.Writable)())
+testWritable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
+testWritable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
+testWritable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
+
+testWritable(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
+testWritable(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
+testWritable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
+testWritable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
+testWritable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
+
+testWritable(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
+testWritable(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
+testWritable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
+testWritable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
+testWritable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
+
+
+testDuplex(false, 'CoreStreams.Stream', new (CoreStreams.Stream)())
+testDuplex(false, 'CoreStreams.Readable', new (CoreStreams.Readable)())
+testDuplex(false, 'CoreStreams.Writable', new (CoreStreams.Writable)())
+testDuplex(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)())
+testDuplex(true, 'CoreStreams.Transform', new (CoreStreams.Transform)())
+testDuplex(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)())
+
+testDuplex(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)())
+testDuplex(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)())
+testDuplex(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)())
+testDuplex(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)())
+testDuplex(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)())
+
+testDuplex(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)())
+testDuplex(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)())
+testDuplex(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)())
+testDuplex(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)())
+testDuplex(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)())
+
+
+;[ CoreStreams, ReadableStream10, ReadableStream11 ].forEach(function (p) {
+  [ 'Stream', 'Readable', 'Writable', 'Duplex', 'Transform', 'PassThrough' ].forEach(function (k) {
+    if (!p[k])
+      return
+
+    function SubStream () {
+      p[k].call(this)
+    }
+    util.inherits(SubStream, p[k])
+
+    test(true, 'Stream subclass: ' + p.name + '.' + k, new SubStream())
+
+  })
+})
+
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/LICENSE
new file mode 100755 (executable)
index 0000000..ed4a4e7
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Charlie Robbins.
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/README.md
new file mode 100755 (executable)
index 0000000..332704e
--- /dev/null
@@ -0,0 +1,86 @@
+# node-pkginfo
+
+An easy way to expose properties on a module from a package.json
+
+## Installation
+
+### Installing npm (node package manager)
+```
+  curl http://npmjs.org/install.sh | sh
+```
+
+### Installing pkginfo
+```
+  [sudo] npm install pkginfo
+```
+
+## Motivation
+How often when writing node.js modules have you written the following line(s) of code? 
+
+* Hard code your version string into your code
+
+``` js
+  exports.version = '0.1.0';
+```
+
+* Programmatically expose the version from the package.json
+
+``` js
+  exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;
+```
+
+In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**
+
+## Usage
+
+Using `pkginfo` is idiot-proof, just require and invoke it. 
+
+``` js
+  var pkginfo = require('pkginfo')(module);
+  
+  console.dir(module.exports);
+```
+
+By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). 
+
+Here's a sample of the output:
+
+```
+  { name: 'simple-app',
+    description: 'A test fixture for pkginfo',
+    version: '0.1.0',
+    author: 'Charlie Robbins <charlie.robbins@gmail.com>',
+    keywords: [ 'test', 'fixture' ],
+    main: './index.js',
+    scripts: { test: 'vows test/*-test.js --spec' },
+    engines: { node: '>= 0.4.0' } }
+```
+
+### Expose specific properties
+If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function:
+
+``` js
+  var pkginfo = require('pkginfo')(module, 'version', 'author');
+  
+  console.dir(module.exports);
+```
+
+```
+  { version: '0.1.0',
+    author: 'Charlie Robbins <charlie.robbins@gmail.com>' }
+```
+
+If you're looking for further usage see the [examples][0] included in this repository. 
+
+## Run Tests
+Tests are written in [vows][1] and give complete coverage of all APIs.
+
+```
+  vows test/*-test.js --spec
+```
+
+[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples
+[1]: http://vowsjs.org
+
+#### Author: [Charlie Robbins](http://nodejitsu.com)
+#### License: MIT
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/docs/docco.css b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/docs/docco.css
new file mode 100755 (executable)
index 0000000..bd54134
--- /dev/null
@@ -0,0 +1,194 @@
+/*--------------------- Layout and Typography ----------------------------*/
+body {
+  font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
+  font-size: 15px;
+  line-height: 22px;
+  color: #252519;
+  margin: 0; padding: 0;
+}
+a {
+  color: #261a3b;
+}
+  a:visited {
+    color: #261a3b;
+  }
+p {
+  margin: 0 0 15px 0;
+}
+h4, h5, h6 {
+  color: #333;
+  margin: 6px 0 6px 0;
+  font-size: 13px;
+}
+  h2, h3 {
+    margin-bottom: 0;
+    color: #000;
+  }
+    h1 {
+      margin-top: 40px;
+      margin-bottom: 15px;
+      color: #000;
+    }
+#container {
+  position: relative;
+}
+#background {
+  position: fixed;
+  top: 0; left: 525px; right: 0; bottom: 0;
+  background: #f5f5ff;
+  border-left: 1px solid #e5e5ee;
+  z-index: -1;
+}
+#jump_to, #jump_page {
+  background: white;
+  -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
+  -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
+  font: 10px Arial;
+  text-transform: uppercase;
+  cursor: pointer;
+  text-align: right;
+}
+#jump_to, #jump_wrapper {
+  position: fixed;
+  right: 0; top: 0;
+  padding: 5px 10px;
+}
+  #jump_wrapper {
+    padding: 0;
+    display: none;
+  }
+    #jump_to:hover #jump_wrapper {
+      display: block;
+    }
+    #jump_page {
+      padding: 5px 0 3px;
+      margin: 0 0 25px 25px;
+    }
+      #jump_page .source {
+        display: block;
+        padding: 5px 10px;
+        text-decoration: none;
+        border-top: 1px solid #eee;
+      }
+        #jump_page .source:hover {
+          background: #f5f5ff;
+        }
+        #jump_page .source:first-child {
+        }
+table td {
+  border: 0;
+  outline: 0;
+}
+  td.docs, th.docs {
+    max-width: 450px;
+    min-width: 450px;
+    min-height: 5px;
+    padding: 10px 25px 1px 50px;
+    overflow-x: hidden;
+    vertical-align: top;
+    text-align: left;
+  }
+    .docs pre {
+      margin: 15px 0 15px;
+      padding-left: 15px;
+    }
+    .docs p tt, .docs p code {
+      background: #f8f8ff;
+      border: 1px solid #dedede;
+      font-size: 12px;
+      padding: 0 0.2em;
+    }
+    .pilwrap {
+      position: relative;
+    }
+      .pilcrow {
+        font: 12px Arial;
+        text-decoration: none;
+        color: #454545;
+        position: absolute;
+        top: 3px; left: -20px;
+        padding: 1px 2px;
+        opacity: 0;
+        -webkit-transition: opacity 0.2s linear;
+      }
+        td.docs:hover .pilcrow {
+          opacity: 1;
+        }
+  td.code, th.code {
+    padding: 14px 15px 16px 25px;
+    width: 100%;
+    vertical-align: top;
+    background: #f5f5ff;
+    border-left: 1px solid #e5e5ee;
+  }
+    pre, tt, code {
+      font-size: 12px; line-height: 18px;
+      font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace;
+      margin: 0; padding: 0;
+    }
+
+
+/*---------------------- Syntax Highlighting -----------------------------*/
+td.linenos { background-color: #f0f0f0; padding-right: 10px; }
+span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
+body .hll { background-color: #ffffcc }
+body .c { color: #408080; font-style: italic }  /* Comment */
+body .err { border: 1px solid #FF0000 }         /* Error */
+body .k { color: #954121 }                      /* Keyword */
+body .o { color: #666666 }                      /* Operator */
+body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+body .cp { color: #BC7A00 }                     /* Comment.Preproc */
+body .c1 { color: #408080; font-style: italic } /* Comment.Single */
+body .cs { color: #408080; font-style: italic } /* Comment.Special */
+body .gd { color: #A00000 }                     /* Generic.Deleted */
+body .ge { font-style: italic }                 /* Generic.Emph */
+body .gr { color: #FF0000 }                     /* Generic.Error */
+body .gh { color: #000080; font-weight: bold }  /* Generic.Heading */
+body .gi { color: #00A000 }                     /* Generic.Inserted */
+body .go { color: #808080 }                     /* Generic.Output */
+body .gp { color: #000080; font-weight: bold }  /* Generic.Prompt */
+body .gs { font-weight: bold }                  /* Generic.Strong */
+body .gu { color: #800080; font-weight: bold }  /* Generic.Subheading */
+body .gt { color: #0040D0 }                     /* Generic.Traceback */
+body .kc { color: #954121 }                     /* Keyword.Constant */
+body .kd { color: #954121; font-weight: bold }  /* Keyword.Declaration */
+body .kn { color: #954121; font-weight: bold }  /* Keyword.Namespace */
+body .kp { color: #954121 }                     /* Keyword.Pseudo */
+body .kr { color: #954121; font-weight: bold }  /* Keyword.Reserved */
+body .kt { color: #B00040 }                     /* Keyword.Type */
+body .m { color: #666666 }                      /* Literal.Number */
+body .s { color: #219161 }                      /* Literal.String */
+body .na { color: #7D9029 }                     /* Name.Attribute */
+body .nb { color: #954121 }                     /* Name.Builtin */
+body .nc { color: #0000FF; font-weight: bold }  /* Name.Class */
+body .no { color: #880000 }                     /* Name.Constant */
+body .nd { color: #AA22FF }                     /* Name.Decorator */
+body .ni { color: #999999; font-weight: bold }  /* Name.Entity */
+body .ne { color: #D2413A; font-weight: bold }  /* Name.Exception */
+body .nf { color: #0000FF }                     /* Name.Function */
+body .nl { color: #A0A000 }                     /* Name.Label */
+body .nn { color: #0000FF; font-weight: bold }  /* Name.Namespace */
+body .nt { color: #954121; font-weight: bold }  /* Name.Tag */
+body .nv { color: #19469D }                     /* Name.Variable */
+body .ow { color: #AA22FF; font-weight: bold }  /* Operator.Word */
+body .w { color: #bbbbbb }                      /* Text.Whitespace */
+body .mf { color: #666666 }                     /* Literal.Number.Float */
+body .mh { color: #666666 }                     /* Literal.Number.Hex */
+body .mi { color: #666666 }                     /* Literal.Number.Integer */
+body .mo { color: #666666 }                     /* Literal.Number.Oct */
+body .sb { color: #219161 }                     /* Literal.String.Backtick */
+body .sc { color: #219161 }                     /* Literal.String.Char */
+body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
+body .s2 { color: #219161 }                     /* Literal.String.Double */
+body .se { color: #BB6622; font-weight: bold }  /* Literal.String.Escape */
+body .sh { color: #219161 }                     /* Literal.String.Heredoc */
+body .si { color: #BB6688; font-weight: bold }  /* Literal.String.Interpol */
+body .sx { color: #954121 }                     /* Literal.String.Other */
+body .sr { color: #BB6688 }                     /* Literal.String.Regex */
+body .s1 { color: #219161 }                     /* Literal.String.Single */
+body .ss { color: #19469D }                     /* Literal.String.Symbol */
+body .bp { color: #954121 }                     /* Name.Builtin.Pseudo */
+body .vc { color: #19469D }                     /* Name.Variable.Class */
+body .vg { color: #19469D }                     /* Name.Variable.Global */
+body .vi { color: #19469D }                     /* Name.Variable.Instance */
+body .il { color: #666666 }                     /* Literal.Number.Integer.Long */
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/docs/pkginfo.html b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/docs/pkginfo.html
new file mode 100755 (executable)
index 0000000..bf615fa
--- /dev/null
@@ -0,0 +1,101 @@
+<!DOCTYPE html>  <html> <head>   <title>pkginfo.js</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               pkginfo.js             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>                            </td>             <td class="code">               <div class="highlight"><pre><span class="cm">/*</span>
+<span class="cm"> * pkginfo.js: Top-level include for the pkginfo module</span>
+<span class="cm"> *</span>
+<span class="cm"> * (C) 2011, Charlie Robbins</span>
+<span class="cm"> *</span>
+<span class="cm"> */</span>
+<span class="kd">var</span> <span class="nx">fs</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;fs&#39;</span><span class="p">),</span>
+    <span class="nx">path</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;path&#39;</span><span class="p">);</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <h3>function pkginfo ([options, 'property', 'property' ..])</h3>
+
+<h4>@pmodule {Module} Parent module to read from.</h4>
+
+<h4>@options {Object|Array|string} <strong>Optional</strong> Options used when exposing properties.</h4>
+
+<h4>@arguments {string...} <strong>Optional</strong> Specified properties to expose.</h4>
+
+<p>Exposes properties from the package.json file for the parent module on 
+it's exports. Valid usage:</p>
+
+<p><code>require('pkginfo')()</code></p>
+
+<p><code>require('pkginfo')('version', 'author');</code></p>
+
+<p><code>require('pkginfo')(['version', 'author']);</code></p>
+
+<p><code>require('pkginfo')({ include: ['version', 'author'] });</code></p>             </td>             <td class="code">               <div class="highlight"><pre><span class="kd">var</span> <span class="nx">pkginfo</span> <span class="o">=</span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">pmodule</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
+  <span class="kd">var</span> <span class="nx">args</span> <span class="o">=</span> <span class="p">[].</span><span class="nx">slice</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">arguments</span><span class="p">,</span> <span class="mi">2</span><span class="p">).</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">arg</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="k">typeof</span> <span class="nx">arg</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span><span class="p">;</span>
+  <span class="p">});</span>
+  </pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p><strong>Parse variable arguments</strong></p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="k">if</span> <span class="p">(</span><span class="nb">Array</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="nx">options</span><span class="p">))</span> <span class="p">{</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>If the options passed in is an Array assume that
+it is the Array of properties to expose from the
+on the package.json file on the parent module.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">include</span><span class="o">:</span> <span class="nx">options</span> <span class="p">};</span>
+  <span class="p">}</span>
+  <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">typeof</span> <span class="nx">options</span> <span class="o">===</span> <span class="s1">&#39;string&#39;</span><span class="p">)</span> <span class="p">{</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Otherwise if the first argument is a string, then
+assume that it is the first property to expose from
+the package.json file on the parent module.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">options</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">include</span><span class="o">:</span> <span class="p">[</span><span class="nx">options</span><span class="p">]</span> <span class="p">};</span>
+  <span class="p">}</span>
+  </pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p><strong>Setup default options</strong></p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nx">options</span> <span class="o">=</span> <span class="nx">options</span> <span class="o">||</span> <span class="p">{</span> <span class="nx">include</span><span class="o">:</span> <span class="p">[]</span> <span class="p">};</span>
+  
+  <span class="k">if</span> <span class="p">(</span><span class="nx">args</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>If additional string arguments have been passed in
+then add them to the properties to expose on the 
+parent module. </p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nx">options</span><span class="p">.</span><span class="nx">include</span> <span class="o">=</span> <span class="nx">options</span><span class="p">.</span><span class="nx">include</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">args</span><span class="p">);</span>
+  <span class="p">}</span>
+  
+  <span class="kd">var</span> <span class="nx">pkg</span> <span class="o">=</span> <span class="nx">pkginfo</span><span class="p">.</span><span class="nx">read</span><span class="p">(</span><span class="nx">pmodule</span><span class="p">,</span> <span class="nx">options</span><span class="p">.</span><span class="nx">dir</span><span class="p">).</span><span class="kr">package</span><span class="p">;</span>
+  <span class="nb">Object</span><span class="p">.</span><span class="nx">keys</span><span class="p">(</span><span class="nx">pkg</span><span class="p">).</span><span class="nx">forEach</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">key</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">if</span> <span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">include</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="o">!~</span><span class="nx">options</span><span class="p">.</span><span class="nx">include</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">key</span><span class="p">))</span> <span class="p">{</span>
+      <span class="k">return</span><span class="p">;</span>
+    <span class="p">}</span>
+    
+    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">pmodule</span><span class="p">.</span><span class="nx">exports</span><span class="p">[</span><span class="nx">key</span><span class="p">])</span> <span class="p">{</span>
+      <span class="nx">pmodule</span><span class="p">.</span><span class="nx">exports</span><span class="p">[</span><span class="nx">key</span><span class="p">]</span> <span class="o">=</span> <span class="nx">pkg</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span>
+    <span class="p">}</span>
+  <span class="p">});</span>
+  
+  <span class="k">return</span> <span class="nx">pkginfo</span><span class="p">;</span>
+<span class="p">};</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <h3>function find (dir)</h3>
+
+<h4>@pmodule {Module} Parent module to read from.</h4>
+
+<h4>@dir {string} <strong>Optional</strong> Directory to start search from.</h4>
+
+<p>Searches up the directory tree from <code>dir</code> until it finds a directory
+which contains a <code>package.json</code> file. </p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">pkginfo</span><span class="p">.</span><span class="nx">find</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">pmodule</span><span class="p">,</span> <span class="nx">dir</span><span class="p">)</span> <span class="p">{</span>
+  <span class="nx">dir</span> <span class="o">=</span> <span class="nx">dir</span> <span class="o">||</span> <span class="nx">pmodule</span><span class="p">.</span><span class="nx">filename</span><span class="p">;</span>
+  <span class="nx">dir</span> <span class="o">=</span> <span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">dir</span><span class="p">);</span> 
+  
+  <span class="kd">var</span> <span class="nx">files</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readdirSync</span><span class="p">(</span><span class="nx">dir</span><span class="p">);</span>
+  
+  <span class="k">if</span> <span class="p">(</span><span class="o">~</span><span class="nx">files</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;package.json&#39;</span><span class="p">))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">dir</span><span class="p">,</span> <span class="s1">&#39;package.json&#39;</span><span class="p">);</span>
+  <span class="p">}</span>
+  
+  <span class="k">if</span> <span class="p">(</span><span class="nx">dir</span> <span class="o">===</span> <span class="s1">&#39;/&#39;</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s1">&#39;Could not find package.json up from: &#39;</span> <span class="o">+</span> <span class="nx">dir</span><span class="p">);</span>
+  <span class="p">}</span>
+  
+  <span class="k">return</span> <span class="nx">pkginfo</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span><span class="nx">dir</span><span class="p">);</span>
+<span class="p">};</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <h3>function read (pmodule, dir)</h3>
+
+<h4>@pmodule {Module} Parent module to read from.</h4>
+
+<h4>@dir {string} <strong>Optional</strong> Directory to start search from.</h4>
+
+<p>Searches up the directory tree from <code>dir</code> until it finds a directory
+which contains a <code>package.json</code> file and returns the package information.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">pkginfo</span><span class="p">.</span><span class="nx">read</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">pmodule</span><span class="p">,</span> <span class="nx">dir</span><span class="p">)</span> <span class="p">{</span> 
+  <span class="nx">dir</span> <span class="o">=</span> <span class="nx">pkginfo</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span><span class="nx">pmodule</span><span class="p">,</span> <span class="nx">dir</span><span class="p">);</span>
+  
+  <span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">dir</span><span class="p">).</span><span class="nx">toString</span><span class="p">();</span>
+      
+  <span class="k">return</span> <span class="p">{</span>
+    <span class="nx">dir</span><span class="o">:</span> <span class="nx">dir</span><span class="p">,</span> 
+    <span class="kr">package</span><span class="o">:</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span>
+  <span class="p">};</span>
+<span class="p">};</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Call <code>pkginfo</code> on this module and expose version.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">pkginfo</span><span class="p">(</span><span class="nx">module</span><span class="p">,</span> <span class="p">{</span>
+  <span class="nx">dir</span><span class="o">:</span> <span class="nx">__dirname</span><span class="p">,</span>
+  <span class="nx">include</span><span class="o">:</span> <span class="p">[</span><span class="s1">&#39;version&#39;</span><span class="p">],</span>
+  <span class="nx">target</span><span class="o">:</span> <span class="nx">pkginfo</span>
+<span class="p">});</span>
+
+</pre></div>             </td>           </tr>                </tbody>     </table>   </div> </body> </html> 
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/all-properties.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/all-properties.js
new file mode 100755 (executable)
index 0000000..fd1d831
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * all-properties.js: Sample of including all properties from a package.json file
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+
+var util = require('util'),
+    pkginfo = require('../lib/pkginfo')(module);
+
+exports.someFunction = function () {
+  console.log('some of your custom logic here');
+};
+
+console.log('Inspecting module:');
+console.dir(module.exports);
+
+console.log('\nAll exports exposed:');
+console.error(Object.keys(module.exports));
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/array-argument.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/array-argument.js
new file mode 100755 (executable)
index 0000000..b1b6848
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * array-argument.js: Sample of including specific properties from a package.json file
+ *                    using Array argument syntax.
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+var util = require('util'),
+    pkginfo = require('../lib/pkginfo')(module, ['version', 'author']);
+
+exports.someFunction = function () {
+  console.log('some of your custom logic here');
+};
+
+console.log('Inspecting module:');
+console.dir(module.exports);
+
+console.log('\nAll exports exposed:');
+console.error(Object.keys(module.exports));
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/multiple-properties.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/multiple-properties.js
new file mode 100755 (executable)
index 0000000..b4b5fd6
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * multiple-properties.js: Sample of including multiple properties from a package.json file
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+var util = require('util'),
+    pkginfo = require('../lib/pkginfo')(module, 'version', 'author');
+
+exports.someFunction = function () {
+  console.log('some of your custom logic here');
+};
+
+console.log('Inspecting module:');
+console.dir(module.exports);
+
+console.log('\nAll exports exposed:');
+console.error(Object.keys(module.exports));
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/object-argument.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/object-argument.js
new file mode 100755 (executable)
index 0000000..28420c8
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * object-argument.js: Sample of including specific properties from a package.json file
+ *                     using Object argument syntax.
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+var util = require('util'),
+    pkginfo = require('../lib/pkginfo')(module, {
+      include: ['version', 'author']
+    });
+
+exports.someFunction = function () {
+  console.log('some of your custom logic here');
+};
+
+console.log('Inspecting module:');
+console.dir(module.exports);
+
+console.log('\nAll exports exposed:');
+console.error(Object.keys(module.exports));
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/package.json
new file mode 100755 (executable)
index 0000000..1f2f01c
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "name": "simple-app",
+  "description": "A test fixture for pkginfo",
+  "version": "0.1.0",
+  "author": "Charlie Robbins <charlie.robbins@gmail.com>",
+  "keywords": ["test", "fixture"],
+  "main": "./index.js",
+  "scripts": { "test": "vows test/*-test.js --spec" },
+  "engines": { "node": ">= 0.4.0" }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/single-property.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/single-property.js
new file mode 100755 (executable)
index 0000000..4f44561
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * single-property.js: Sample of including a single specific properties from a package.json file
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+var util = require('util'),
+    pkginfo = require('../lib/pkginfo')(module, 'version');
+
+exports.someFunction = function () {
+  console.log('some of your custom logic here');
+};
+
+console.log('Inspecting module:');
+console.dir(module.exports);
+
+console.log('\nAll exports exposed:');
+console.error(Object.keys(module.exports));
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/subdir/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/subdir/package.json
new file mode 100755 (executable)
index 0000000..aa85410
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "name": "simple-app-subdir",
+  "description": "A test fixture for pkginfo",
+  "version": "0.1.0",
+  "author": "Charlie Robbins <charlie.robbins@gmail.com>",
+  "keywords": ["test", "fixture"],
+  "main": "./index.js",
+  "scripts": { "test": "vows test/*-test.js --spec" },
+  "engines": { "node": ">= 0.4.0" },
+  "subdironly": "true"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/target-dir.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/examples/target-dir.js
new file mode 100755 (executable)
index 0000000..88770e6
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * multiple-properties.js: Sample of including multiple properties from a package.json file
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+var util = require('util'),
+    path = require('path'),
+    pkginfo = require('../lib/pkginfo')(module, { dir: path.resolve(__dirname, 'subdir' )});
+
+exports.someFunction = function () {
+  console.log('some of your custom logic here');
+};
+
+console.log('Inspecting module:');
+console.dir(module.exports);
+
+console.log('\nAll exports exposed:');
+console.error(Object.keys(module.exports));
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js
new file mode 100755 (executable)
index 0000000..c5dc020
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * pkginfo.js: Top-level include for the pkginfo module
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+var fs = require('fs'),
+    path = require('path');
+
+//
+// ### function pkginfo ([options, 'property', 'property' ..])
+// #### @pmodule {Module} Parent module to read from.
+// #### @options {Object|Array|string} **Optional** Options used when exposing properties.
+// #### @arguments {string...} **Optional** Specified properties to expose.
+// Exposes properties from the package.json file for the parent module on 
+// it's exports. Valid usage:
+//
+// `require('pkginfo')()`
+//
+// `require('pkginfo')('version', 'author');`
+//
+// `require('pkginfo')(['version', 'author']);`
+//
+// `require('pkginfo')({ include: ['version', 'author'] });`
+//
+var pkginfo = module.exports = function (pmodule, options) {
+  var args = [].slice.call(arguments, 2).filter(function (arg) {
+    return typeof arg === 'string';
+  });
+  
+  //
+  // **Parse variable arguments**
+  //
+  if (Array.isArray(options)) {
+    //
+    // If the options passed in is an Array assume that
+    // it is the Array of properties to expose from the
+    // on the package.json file on the parent module.
+    //
+    options = { include: options };
+  }
+  else if (typeof options === 'string') {
+    //
+    // Otherwise if the first argument is a string, then
+    // assume that it is the first property to expose from
+    // the package.json file on the parent module.
+    //
+    options = { include: [options] };
+  }
+  
+  //
+  // **Setup default options**
+  //
+  options = options || {};
+  
+  // ensure that includes have been defined
+  options.include = options.include || [];
+  
+  if (args.length > 0) {
+    //
+    // If additional string arguments have been passed in
+    // then add them to the properties to expose on the 
+    // parent module. 
+    //
+    options.include = options.include.concat(args);
+  }
+  
+  var pkg = pkginfo.read(pmodule, options.dir).package;
+  Object.keys(pkg).forEach(function (key) {
+    if (options.include.length > 0 && !~options.include.indexOf(key)) {
+      return;
+    }
+    
+    if (!pmodule.exports[key]) {
+      pmodule.exports[key] = pkg[key];
+    }
+  });
+  
+  return pkginfo;
+};
+
+//
+// ### function find (dir)
+// #### @pmodule {Module} Parent module to read from.
+// #### @dir {string} **Optional** Directory to start search from.
+// Searches up the directory tree from `dir` until it finds a directory
+// which contains a `package.json` file. 
+//
+pkginfo.find = function (pmodule, dir) {
+  if (! dir) {
+    dir = path.dirname(pmodule.filename);
+  }
+  
+  var files = fs.readdirSync(dir);
+  
+  if (~files.indexOf('package.json')) {
+    return path.join(dir, 'package.json');
+  }
+  
+  if (dir === '/') {
+    throw new Error('Could not find package.json up from: ' + dir);
+  }
+  else if (!dir || dir === '.') {
+    throw new Error('Cannot find package.json from unspecified directory');
+  }
+  
+  return pkginfo.find(pmodule, path.dirname(dir));
+};
+
+//
+// ### function read (pmodule, dir)
+// #### @pmodule {Module} Parent module to read from.
+// #### @dir {string} **Optional** Directory to start search from.
+// Searches up the directory tree from `dir` until it finds a directory
+// which contains a `package.json` file and returns the package information.
+//
+pkginfo.read = function (pmodule, dir) { 
+  dir = pkginfo.find(pmodule, dir);
+  
+  var data = fs.readFileSync(dir).toString();
+      
+  return {
+    dir: dir, 
+    package: JSON.parse(data)
+  };
+};
+
+//
+// Call `pkginfo` on this module and expose version.
+//
+pkginfo(module, {
+  dir: __dirname,
+  include: ['version'],
+  target: pkginfo
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/package.json
new file mode 100755 (executable)
index 0000000..af8b95a
--- /dev/null
@@ -0,0 +1,54 @@
+{
+  "name": "pkginfo",
+  "version": "0.3.0",
+  "description": "An easy way to expose properties on a module from a package.json",
+  "author": {
+    "name": "Charlie Robbins",
+    "email": "charlie.robbins@gmail.com"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/indexzero/node-pkginfo.git"
+  },
+  "keywords": [
+    "info",
+    "tools",
+    "package.json"
+  ],
+  "devDependencies": {
+    "vows": "0.7.x"
+  },
+  "main": "./lib/pkginfo",
+  "scripts": {
+    "test": "vows test/*-test.js --spec"
+  },
+  "engines": {
+    "node": ">= 0.4.0"
+  },
+  "readme": "# node-pkginfo\n\nAn easy way to expose properties on a module from a package.json\n\n## Installation\n\n### Installing npm (node package manager)\n```\n  curl http://npmjs.org/install.sh | sh\n```\n\n### Installing pkginfo\n```\n  [sudo] npm install pkginfo\n```\n\n## Motivation\nHow often when writing node.js modules have you written the following line(s) of code? \n\n* Hard code your version string into your code\n\n``` js\n  exports.version = '0.1.0';\n```\n\n* Programmatically expose the version from the package.json\n\n``` js\n  exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version;\n```\n\nIn other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!**\n\n## Usage\n\nUsing `pkginfo` is idiot-proof, just require and invoke it. \n\n``` js\n  var pkginfo = require('pkginfo')(module);\n  \n  console.dir(module.exports);\n```\n\nBy invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). \n\nHere's a sample of the output:\n\n```\n  { name: 'simple-app',\n    description: 'A test fixture for pkginfo',\n    version: '0.1.0',\n    author: 'Charlie Robbins <charlie.robbins@gmail.com>',\n    keywords: [ 'test', 'fixture' ],\n    main: './index.js',\n    scripts: { test: 'vows test/*-test.js --spec' },\n    engines: { node: '>= 0.4.0' } }\n```\n\n### Expose specific properties\nIf you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function:\n\n``` js\n  var pkginfo = require('pkginfo')(module, 'version', 'author');\n  \n  console.dir(module.exports);\n```\n\n```\n  { version: '0.1.0',\n    author: 'Charlie Robbins <charlie.robbins@gmail.com>' }\n```\n\nIf you're looking for further usage see the [examples][0] included in this repository. \n\n## Run Tests\nTests are written in [vows][1] and give complete coverage of all APIs.\n\n```\n  vows test/*-test.js --spec\n```\n\n[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples\n[1]: http://vowsjs.org\n\n#### Author: [Charlie Robbins](http://nodejitsu.com)\n#### License: MIT",
+  "readmeFilename": "README.md",
+  "_id": "pkginfo@0.3.0",
+  "dist": {
+    "shasum": "726411401039fe9b009eea86614295d5f3a54276",
+    "tarball": "http://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz"
+  },
+  "_npmVersion": "1.1.66",
+  "_npmUser": {
+    "name": "indexzero",
+    "email": "charlie.robbins@gmail.com"
+  },
+  "maintainers": [
+    {
+      "name": "indexzero",
+      "email": "charlie.robbins@gmail.com"
+    }
+  ],
+  "directories": {},
+  "_shasum": "726411401039fe9b009eea86614295d5f3a54276",
+  "_from": "pkginfo@0.3.x",
+  "_resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.0.tgz",
+  "bugs": {
+    "url": "https://github.com/indexzero/node-pkginfo/issues"
+  },
+  "homepage": "https://github.com/indexzero/node-pkginfo"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/test/pkginfo-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/pkginfo/test/pkginfo-test.js
new file mode 100755 (executable)
index 0000000..a59f077
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * pkginfo-test.js: Tests for the pkginfo module.
+ *
+ * (C) 2011, Charlie Robbins
+ *
+ */
+
+var assert = require('assert'),
+    exec = require('child_process').exec,
+    fs = require('fs'),
+    path = require('path'),
+    vows = require('vows'),
+    pkginfo = require('../lib/pkginfo');
+
+function assertProperties (source, target) {
+  assert.lengthOf(source, target.length + 1);
+  target.forEach(function (prop) {
+    assert.isTrue(!!~source.indexOf(prop));
+  });
+}
+
+function compareWithExample(targetPath) {
+  var examplePaths = ['package.json'];
+  
+  if (targetPath) {
+    examplePaths.unshift(targetPath);
+  }
+  
+  return function(exposed) {
+    var pkg = fs.readFileSync(path.join.apply(null, [__dirname, '..', 'examples'].concat(examplePaths))).toString(),
+        keys = Object.keys(JSON.parse(pkg));
+    
+    assertProperties(exposed, keys);
+  };
+}
+
+function testExposes (options) {
+  return {
+    topic: function () {
+      exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback);
+    },
+    "should expose that property correctly": function (err, stdout, stderr) {
+      assert.isNull(err);
+      
+      var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { 
+        return p.substring(1, p.length - 1);
+      });
+      
+      return !options.assert 
+        ? assertProperties(exposed, options.properties)
+        : options.assert(exposed);
+    }
+  }
+}
+
+vows.describe('pkginfo').addBatch({
+  "When using the pkginfo module": {
+    "and passed a single `string` argument": testExposes({
+      script: 'single-property.js',
+      properties: ['version']
+    }),
+    "and passed multiple `string` arguments": testExposes({
+      script: 'multiple-properties.js',
+      properties: ['version', 'author']
+    }),
+    "and passed an `object` argument": testExposes({
+      script: 'object-argument.js',
+      properties: ['version', 'author']
+    }),
+    "and passed an `array` argument": testExposes({
+      script: 'array-argument.js',
+      properties: ['version', 'author']
+    }),
+    "and read from a specified directory": testExposes({
+      script: 'target-dir.js',
+      assert: compareWithExample('subdir')
+    }),
+    "and passed no arguments": testExposes({
+      script: 'all-properties.js',
+      assert: compareWithExample()
+    })
+  }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/License b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/License
new file mode 100755 (executable)
index 0000000..11ec094
--- /dev/null
@@ -0,0 +1,19 @@
+Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com)
+
+ 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/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/Makefile b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/Makefile
new file mode 100755 (executable)
index 0000000..a7ce31d
--- /dev/null
@@ -0,0 +1,11 @@
+SHELL := /bin/bash
+
+test:
+       @./test/run.js
+
+release:
+       git push
+       git push --tags
+       npm publish .
+
+.PHONY: test
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/Readme.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/Readme.md
new file mode 100755 (executable)
index 0000000..fcd1b97
--- /dev/null
@@ -0,0 +1,98 @@
+# stack-trace
+
+Get v8 stack traces as an array of CallSite objects.
+
+## Install
+
+``` bash
+npm install stack-trace
+```
+
+## Usage
+
+The stack-trace module makes it easy for you to capture the current stack:
+
+``` javascript
+var stackTrace = require('stack-trace');
+var trace = stackTrace.get();
+
+require('assert').strictEqual(trace[0].getFileName(), __filename);
+```
+
+However, sometimes you have already popped the stack you are interested in,
+and all you have left is an `Error` object. This module can help:
+
+``` javascript
+var stackTrace = require('stack-trace');
+var err = new Error('something went wrong');
+var trace = stackTrace.parse(err);
+
+require('assert').strictEqual(trace[0].getFileName(), __filename);
+```
+
+Please note that parsing the `Error#stack` property is not perfect, only
+certain properties can be retrieved with it as noted in the API docs below.
+
+## Long stack traces
+
+stack-trace works great with [long-stack-traces][], when parsing an `err.stack`
+that has crossed the event loop boundary, a `CallSite` object returning
+`'----------------------------------------'` for `getFileName()` is created.
+All other methods of the event loop boundary call site return `null`.
+
+[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces
+
+## API
+
+### stackTrace.get([belowFn])
+
+Returns an array of `CallSite` objects, where element `0` is the current call
+site.
+
+When passing a function on the current stack as the `belowFn` parameter, the
+returned array will only include `CallSite` objects below this function.
+
+### stackTrace.parse(err)
+
+Parses the `err.stack` property of an `Error` object into an array compatible
+with those returned by `stackTrace.get()`. However, only the following methods
+are implemented on the returned `CallSite` objects.
+
+* getTypeName
+* getFunctionName
+* getMethodName
+* getFileName
+* getLineNumber
+* getColumnNumber
+* isNative
+
+Note: Except `getFunctionName()`, all of the above methods return exactly the
+same values as you would get from `stackTrace.get()`. `getFunctionName()`
+is sometimes a little different, but still useful.
+
+### CallSite
+
+The official v8 CallSite object API can be found [here][v8stackapi]. A quick
+excerpt:
+
+> A CallSite object defines the following methods:
+>
+> * **getThis**: returns the value of this
+> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.
+> * **getFunction**: returns the current function
+> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
+> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function
+> * **getFileName**: if this function was defined in a script returns the name of the script
+> * **getLineNumber**: if this function was defined in a script returns the current line number
+> * **getColumnNumber**: if this function was defined in a script returns the current column number
+> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called
+> * **isToplevel**: is this a toplevel invocation, that is, is this the global object?
+> * **isEval**: does this call take place in code defined by a call to eval?
+> * **isNative**: is this call in native V8 code?
+> * **isConstructor**: is this a constructor call?
+
+[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
+
+## License
+
+stack-trace is licensed under the MIT license.
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js
new file mode 100755 (executable)
index 0000000..a7c38aa
--- /dev/null
@@ -0,0 +1,111 @@
+exports.get = function(belowFn) {
+  var oldLimit = Error.stackTraceLimit;
+  Error.stackTraceLimit = Infinity;
+
+  var dummyObject = {};
+
+  var v8Handler = Error.prepareStackTrace;
+  Error.prepareStackTrace = function(dummyObject, v8StackTrace) {
+    return v8StackTrace;
+  };
+  Error.captureStackTrace(dummyObject, belowFn || exports.get);
+
+  var v8StackTrace = dummyObject.stack;
+  Error.prepareStackTrace = v8Handler;
+  Error.stackTraceLimit = oldLimit;
+
+  return v8StackTrace;
+};
+
+exports.parse = function(err) {
+  if (!err.stack) {
+    return [];
+  }
+
+  var self = this;
+  var lines = err.stack.split('\n').slice(1);
+
+  return lines
+    .map(function(line) {
+      if (line.match(/^\s*[-]{4,}$/)) {
+        return self._createParsedCallSite({
+          fileName: line,
+          lineNumber: null,
+          functionName: null,
+          typeName: null,
+          methodName: null,
+          columnNumber: null,
+          'native': null,
+        });
+      }
+
+      var lineMatch = line.match(/at (?:(.+)\s+)?\(?(?:(.+?):(\d+):(\d+)|([^)]+))\)?/);
+      if (!lineMatch) {
+        return;
+      }
+
+      var object = null;
+      var method = null;
+      var functionName = null;
+      var typeName = null;
+      var methodName = null;
+      var isNative = (lineMatch[5] === 'native');
+
+      if (lineMatch[1]) {
+        var methodMatch = lineMatch[1].match(/([^\.]+)(?:\.(.+))?/);
+        object = methodMatch[1];
+        method = methodMatch[2];
+        functionName = lineMatch[1];
+        typeName = 'Object';
+      }
+
+      if (method) {
+        typeName = object;
+        methodName = method;
+      }
+
+      if (method === '<anonymous>') {
+        methodName = null;
+        functionName = '';
+      }
+
+      var properties = {
+        fileName: lineMatch[2] || null,
+        lineNumber: parseInt(lineMatch[3], 10) || null,
+        functionName: functionName,
+        typeName: typeName,
+        methodName: methodName,
+        columnNumber: parseInt(lineMatch[4], 10) || null,
+        'native': isNative,
+      };
+
+      return self._createParsedCallSite(properties);
+    })
+    .filter(function(callSite) {
+      return !!callSite;
+    });
+};
+
+exports._createParsedCallSite = function(properties) {
+  var methods = {};
+  for (var property in properties) {
+    var prefix = 'get';
+    if (property === 'native') {
+      prefix = 'is';
+    }
+    var method = prefix + property.substr(0, 1).toUpperCase() + property.substr(1);
+
+    (function(property) {
+      methods[method] = function() {
+        return properties[property];
+      }
+    })(property);
+  }
+
+  var callSite = Object.create(methods);
+  for (var property in properties) {
+    callSite[property] = properties[property];
+  }
+
+  return callSite;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/node_modules/stack-trace/package.json
new file mode 100755 (executable)
index 0000000..ea309a1
--- /dev/null
@@ -0,0 +1,56 @@
+{
+  "author": {
+    "name": "Felix Geisendörfer",
+    "email": "felix@debuggable.com",
+    "url": "http://debuggable.com/"
+  },
+  "name": "stack-trace",
+  "description": "Get v8 stack traces as an array of CallSite objects.",
+  "version": "0.0.9",
+  "homepage": "https://github.com/felixge/node-stack-trace",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/felixge/node-stack-trace.git"
+  },
+  "main": "./lib/stack-trace",
+  "engines": {
+    "node": "*"
+  },
+  "dependencies": {},
+  "devDependencies": {
+    "far": "0.0.3",
+    "long-stack-traces": "0.1.2"
+  },
+  "bugs": {
+    "url": "https://github.com/felixge/node-stack-trace/issues"
+  },
+  "_id": "stack-trace@0.0.9",
+  "dist": {
+    "shasum": "a8f6eaeca90674c333e7c43953f275b451510695",
+    "tarball": "http://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz"
+  },
+  "_from": "stack-trace@0.0.x",
+  "_npmVersion": "1.3.24",
+  "_npmUser": {
+    "name": "sebastianhoitz",
+    "email": "hoitz@komola.de"
+  },
+  "maintainers": [
+    {
+      "name": "felixge",
+      "email": "felix@debuggable.com"
+    },
+    {
+      "name": "tim-smart",
+      "email": "tim@fostle.com"
+    },
+    {
+      "name": "sebastianhoitz",
+      "email": "hoitz@komola.de"
+    }
+  ],
+  "directories": {},
+  "_shasum": "a8f6eaeca90674c333e7c43953f275b451510695",
+  "_resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/package.json
new file mode 100755 (executable)
index 0000000..e28c890
--- /dev/null
@@ -0,0 +1,82 @@
+{
+  "name": "winston",
+  "description": "A multi-transport async logging library for Node.js",
+  "version": "0.8.3",
+  "author": {
+    "name": "Nodejitsu Inc.",
+    "email": "info@nodejitsu.com"
+  },
+  "maintainers": [
+    {
+      "name": "indexzero",
+      "email": "charlie.robbins@gmail.com"
+    },
+    {
+      "name": "chjj",
+      "email": "chjjeffrey@gmail.com"
+    },
+    {
+      "name": "V1",
+      "email": "info@3rd-Eden.com"
+    },
+    {
+      "name": "jcrugzz",
+      "email": "jcrugzz@gmail.com"
+    }
+  ],
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/flatiron/winston.git"
+  },
+  "keywords": [
+    "logging",
+    "sysadmin",
+    "tools"
+  ],
+  "dependencies": {
+    "async": "0.2.x",
+    "colors": "0.6.x",
+    "cycle": "1.0.x",
+    "eyes": "0.1.x",
+    "isstream": "0.1.x",
+    "pkginfo": "0.3.x",
+    "stack-trace": "0.0.x"
+  },
+  "devDependencies": {
+    "vows": "0.7.x"
+  },
+  "main": "./lib/winston",
+  "scripts": {
+    "test": "vows --spec --isolate"
+  },
+  "engines": {
+    "node": ">= 0.6.0"
+  },
+  "licenses": [
+    {
+      "type": "MIT",
+      "url": "https://raw.github.com/flatiron/winston/master/LICENSE"
+    }
+  ],
+  "gitHead": "d12b2688d7d82557a5f5d490217e3c516bb661cb",
+  "bugs": {
+    "url": "https://github.com/flatiron/winston/issues"
+  },
+  "homepage": "https://github.com/flatiron/winston",
+  "_id": "winston@0.8.3",
+  "_shasum": "64b6abf4cd01adcaefd5009393b1d8e8bec19db0",
+  "_from": "winston@^0.8.1",
+  "_npmVersion": "2.1.6",
+  "_nodeVersion": "0.10.32",
+  "_npmUser": {
+    "name": "jcrugzz",
+    "email": "jcrugzz@gmail.com"
+  },
+  "dist": {
+    "shasum": "64b6abf4cd01adcaefd5009393b1d8e8bec19db0",
+    "tarball": "http://registry.npmjs.org/winston/-/winston-0.8.3.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/winston/-/winston-0.8.3.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/cli-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/cli-test.js
new file mode 100755 (executable)
index 0000000..67d7ada
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * cli-test.js: Tests for the cli levels available in winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    assert = require('assert'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers');
+
+vows.describe('winston/logger/cli').addBatch({
+  "When an instance of winston.transports.Console()": {
+    "has colorize true": {
+      topic: function () {
+        var transport = new winston.transports.Console({ colorize: true });
+        transport.log('prompt', 'This had better work.', { test: true }, this.callback);
+      },
+      "should function without error": function (err, ok) {
+        assert.isNull(err);
+        assert.isTrue(ok);
+      }
+    }
+  },
+  "When an instance of winston.Logger": {
+    topic: function () {
+      return new winston.Logger({
+        transports: [
+          new winston.transports.Console()
+        ]
+      })
+    },
+    "the cli() method": {
+      "should set the appropriate values on the logger": function (logger) {
+        logger.cli();
+        assert.isTrue(logger.padLevels);
+        assert.isTrue(logger.transports.console.colorize);
+        assert.isFalse(logger.transports.console.timestamp);
+        Object.keys(winston.config.cli.levels).forEach(function (level) {
+          assert.isNumber(logger.levels[level]);
+        });
+
+        Object.keys(winston.config.cli.colors).forEach(function (color) {
+          assert.isString(winston.config.allColors[color]);
+        });
+      }
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/container-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/container-test.js
new file mode 100755 (executable)
index 0000000..2fcc26a
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * container-test.js: Tests for the Container object
+ *
+ * (C) 2011 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    fs = require('fs'),
+    http = require('http'),
+    path = require('path'),
+    vows = require('vows'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers');
+
+vows.describe('winston/container').addBatch({
+  "An instance of winston.Container": {
+    topic: new winston.Container(),
+    "the add() method": {
+      topic: function (container) {
+        return container.add('default-test');
+      },
+      "should correctly instantiate a Logger": function (logger) {
+        assert.instanceOf(logger, winston.Logger);
+      },
+      "the get() method": {
+        topic: function (logger, container) {
+          this.callback.apply(this, arguments);
+        },
+        "should respond with the logger previously created": function (existing, container) {
+          var logger = container.get('default-test');
+          assert.isTrue(existing === logger);
+        }
+      },
+      "the has() method": {
+        topic: function (logger, container) {
+          this.callback.apply(this, arguments);
+        },
+        "should indicate `default-test` logger exists": function (existing, container) {
+          assert.isTrue(container.has('default-test'));
+        },
+        "should indicate `not-has` logger doesnt exists": function (existing, container) {
+          assert.isFalse(container.has('not-has'));
+        }
+      },
+      "the close() method": {
+        topic: function (logger, container) {
+          this.callback.apply(this, arguments);
+        },
+        "should remove the specified logger": function (logger, container) {
+          container.close('default-test');
+          assert.isTrue(!container.loggers['default-test']);
+        }
+      }
+    }
+  },
+  "An instance of winston.Container with explicit transports": {
+    topic: function () {
+      this.port = 9412;
+      this.transports = [
+        new winston.transports.Webhook({
+          port: this.port
+        })
+      ];
+      
+      this.container = new winston.Container({
+        transports: this.transports
+      });
+      
+      return null;
+    },
+    "the get() method": {
+      topic: function (container) {
+        var server = http.createServer(function (req, res) {
+          res.end();
+        });
+
+        server.listen(this.port, this.callback.bind(this, null));
+      },
+      "should add the logger correctly": function () {
+        this.someLogger = this.container.get('some-logger');
+        assert.isObject(this.someLogger.transports);
+        assert.instanceOf(this.someLogger.transports['webhook'], winston.transports.Webhook);
+        assert.strictEqual(this.someLogger.transports['webhook'], this.transports[0]);
+      },
+      "a second call to get()": {
+        "should respond with the same transport object": function () {
+          this.someOtherLogger = this.container.get('some-other-logger');
+
+          assert.isObject(this.someOtherLogger.transports);
+          assert.instanceOf(this.someOtherLogger.transports['webhook'], winston.transports.Webhook);
+          assert.strictEqual(this.someOtherLogger.transports['webhook'], this.transports[0]);
+          assert.strictEqual(this.someOtherLogger.transports['webhook'], this.someLogger.transports['webhook']);
+        }
+      }
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/custom-timestamp-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/custom-timestamp-test.js
new file mode 100755 (executable)
index 0000000..efdc40f
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * custom-timestamp-test.js: Test function as timestamp option for transport `{ timestamp: function () {} }`
+ *
+ * (C) 2011 Charlie Robbins, Tom Shinnick
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    events = require('events'),
+    fs = require('fs'),
+    path = require('path'),
+    vows = require('vows'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers');
+
+function assertTimestamp (basename, options) {
+  var filename = path.join(__dirname, 'fixtures', 'logs', basename + '.log');
+  
+  try { fs.unlinkSync(filename) }
+  catch (ex) { }
+  
+  return {
+    topic: function () {
+      options.filename = filename;
+      var transport = new (winston.transports.File)(options);
+
+      // We must wait until transport file has emitted the 'flush' 
+      // event to be sure the file has been created and written
+      transport.once('flush', this.callback.bind(this, null, filename));
+      transport.log('info', 'When a fake tree falls in the forest...', null, function () {});
+    },
+    "should log with the appropriate timestamp": function (_, filename) {
+      var data = fs.readFileSync(filename, 'utf8');
+      assert.isNotNull(data.match(options.pattern));
+    }
+  }
+}
+
+vows.describe('winston/transport/timestamp').addBatch({
+  "When timestamp option is used": {
+    "with file transport": {
+      "with value set to false": assertTimestamp('noTimestamp', { 
+        pattern: /^info\:/, 
+        json: false,
+        timestamp: false 
+      }),
+      "with value set to true ": assertTimestamp('defaultTimestamp', { 
+        pattern: /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/,
+        json: false,
+        timestamp: true 
+      }),
+      "and function value": assertTimestamp('customTimestamp', {
+        pattern: /^\d{8}\./,
+        json: false,
+        timestamp: function () {
+          return '20110803.171657';
+        }
+      })
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/exception-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/exception-test.js
new file mode 100755 (executable)
index 0000000..3c3178e
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * exception-test.js: Tests for exception data gathering in winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    assert = require('assert'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers');
+
+vows.describe('winston/exception').addBatch({
+  "When using the winston exception module": {
+    "the getProcessInfo() method": {
+      topic: winston.exception.getProcessInfo(),
+      "should respond with the appropriate data": function (info) {
+        helpers.assertProcessInfo(info);
+      }
+    },
+    "the getOsInfo() method": {
+      topic: winston.exception.getOsInfo(),
+      "should respond with the appropriate data": function (info) {
+        helpers.assertOsInfo(info);
+      }
+    },
+    "the getTrace() method": {
+      topic: winston.exception.getTrace(new Error()),
+      "should have the appropriate info": function (trace) {
+        helpers.assertTrace(trace);
+      }
+    },
+    "the getAllInfo() method": {
+      topic: winston.exception.getAllInfo(new Error()),
+      "should have the appropriate info": function (info) {
+        assert.isObject(info);
+        assert.isArray(info.stack);
+        helpers.assertDateInfo(info.date);
+        helpers.assertProcessInfo(info.process);
+        helpers.assertOsInfo(info.os);
+        helpers.assertTrace(info.trace);
+      }
+    }
+  }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/keys/agent2-cert.pem b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/keys/agent2-cert.pem
new file mode 100755 (executable)
index 0000000..8e4354d
--- /dev/null
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE-----
+MIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV
+UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO
+BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR
+cnlAdGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEy
+WjB9MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYD
+VQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEg
+MB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwXDANBgkqhkiG9w0BAQEF
+AANLADBIAkEAyXb8FrRdKbhrKLgLSsn61i1C7w7fVVVd7OQsmV/7p9WB2lWFiDlC
+WKGU9SiIz/A6wNZDUAuc2E+VwtpCT561AQIDAQABMA0GCSqGSIb3DQEBBQUAA0EA
+C8HzpuNhFLCI3A5KkBS5zHAQax6TFUOhbpBCR0aTDbJ6F1liDTK1lmU/BjvPoj+9
+1LHwrmh29rK8kBPEjmymCQ==
+-----END CERTIFICATE-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/keys/agent2-key.pem b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/keys/agent2-key.pem
new file mode 100755 (executable)
index 0000000..522903c
--- /dev/null
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5
+QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAQJBAMT6Bf34+UHKY1ObpsbH
+9u2jsVblFq1rWvs8GPMY6oertzvwm3DpuSUp7PTgOB1nLTLYtCERbQ4ovtN8tn3p
+OHUCIQDzIEGsoCr5vlxXvy2zJwu+fxYuhTZWMVuo1397L0VyhwIhANQh+yzqUgaf
+WRtSB4T2W7ADtJI35ET61jKBty3CqJY3AiAIwju7dVW3A5WeD6Qc1SZGKZvp9yCb
+AFI2BfVwwaY11wIgXF3PeGcvACMyMWsuSv7aPXHfliswAbkWuzcwA4TW01ECIGWa
+cgsDvVFxmfM5NPSuT/UDTa6R5BFISB5ea0N0AR3I
+-----END RSA PRIVATE KEY-----
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/default-exceptions.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/default-exceptions.js
new file mode 100755 (executable)
index 0000000..ab26aa5
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * default-exceptions.js: A test fixture for logging exceptions with the default winston logger.
+ *
+ * (C) 2011 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+var path = require('path'),
+    winston = require('../../../lib/winston');
+
+winston.handleExceptions([
+  new (winston.transports.File)({ 
+    filename: path.join(__dirname, '..', 'logs', 'default-exception.log'),
+    handleExceptions: true
+  })
+]);
+
+setTimeout(function () {
+  throw new Error('OH NOES! It failed!');
+}, 1000);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/exit-on-error.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/exit-on-error.js
new file mode 100755 (executable)
index 0000000..fa3dd65
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * default-exceptions.js: A test fixture for logging exceptions with the default winston logger.
+ *
+ * (C) 2011 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+var path = require('path'),
+    winston = require('../../../lib/winston');
+
+winston.exitOnError = function (err) {
+  return err.message !== 'Ignore this error';
+};
+
+winston.handleExceptions([
+  new (winston.transports.File)({ 
+    filename: path.join(__dirname, '..', 'logs', 'exit-on-error.log'),
+    handleExceptions: true
+  })
+]);
+
+setTimeout(function () {
+  throw new Error('Ignore this error');
+}, 1000);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/log-exceptions.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/log-exceptions.js
new file mode 100755 (executable)
index 0000000..43ce7eb
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * log-exceptions.js: A test fixture for logging exceptions in winston.
+ *
+ * (C) 2011 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+var path = require('path'),
+    winston = require('../../../lib/winston');
+
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.File)({ 
+      filename: path.join(__dirname, '..', 'logs', 'exception.log'),
+      handleExceptions: true
+    })
+  ]
+});
+
+logger.handleExceptions();
+
+setTimeout(function () {
+  throw new Error('OH NOES! It failed!');
+}, 1000);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/log-string-exception.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/log-string-exception.js
new file mode 100755 (executable)
index 0000000..1015a98
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * log-string-exceptions.js: A test fixture for logging string exceptions in winston.
+ *
+ * (C) 2011 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+
+var path = require('path'),
+    winston = require('../../../lib/winston');
+
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.File)({
+      filename: path.join(__dirname, '..', 'logs', 'string-exception.log'),
+      handleExceptions: true
+    })
+  ]
+});
+
+logger.handleExceptions();
+
+setTimeout(function () {
+  throw 'OMG NEVER DO THIS STRING EXCEPTIONS ARE AWFUL';
+}, 1000);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js
new file mode 100755 (executable)
index 0000000..5d722a7
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * unhandle-exceptions.js: A test fixture for using `.unhandleExceptions()` winston.
+ *
+ * (C) 2011 Charlie Robbins
+ * MIT LICENCE
+ *
+ */
+var path = require('path'),
+    winston = require('../../../lib/winston');
+
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.File)({ 
+      filename: path.join(__dirname, '..', 'logs', 'unhandle-exception.log'),
+      handleExceptions: true
+    })
+  ]
+});
+
+logger.handleExceptions();
+logger.unhandleExceptions();
+
+setTimeout(function () {
+  throw new Error('OH NOES! It failed!');
+}, 1000);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/helpers.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/helpers.js
new file mode 100755 (executable)
index 0000000..079d08d
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * helpers.js: Test helpers for winston
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    fs = require('fs'),
+    path = require('path'),
+    spawn = require('child_process').spawn,
+    util = require('util'),
+    vows = require('vows'),
+    winston = require('../lib/winston');
+
+var helpers = exports;
+
+helpers.size = function (obj) {
+  var size = 0, key;
+  for (key in obj) {
+    if (obj.hasOwnProperty(key)) {
+      size++;
+    }
+  }
+
+  return size;
+};
+
+helpers.tryUnlink = function (file) {
+  try { fs.unlinkSync(file) }
+  catch (ex) { }
+};
+
+helpers.assertDateInfo = function (info) {
+  assert.isNumber(Date.parse(info));
+};
+
+helpers.assertProcessInfo = function (info) {
+  assert.isNumber(info.pid);
+  assert.isNumber(info.uid);
+  assert.isNumber(info.gid);
+  assert.isString(info.cwd);
+  assert.isString(info.execPath);
+  assert.isString(info.version);
+  assert.isArray(info.argv);
+  assert.isObject(info.memoryUsage);
+};
+
+helpers.assertOsInfo = function (info) {
+  assert.isArray(info.loadavg);
+  assert.isNumber(info.uptime);
+};
+
+helpers.assertTrace = function (trace) {
+  trace.forEach(function (site) {
+    assert.isTrue(!site.column || typeof site.column === 'number');
+    assert.isTrue(!site.line || typeof site.line === 'number');
+    assert.isTrue(!site.file || typeof site.file === 'string');
+    assert.isTrue(!site.method || typeof site.method === 'string');
+    assert.isTrue(!site.function || typeof site.function === 'string');
+    assert.isTrue(typeof site.native === 'boolean');
+  });
+};
+
+helpers.assertLogger = function (logger, level) {
+  assert.instanceOf(logger, winston.Logger);
+  assert.isFunction(logger.log);
+  assert.isFunction(logger.add);
+  assert.isFunction(logger.remove);
+  assert.equal(logger.level, level || "info");
+  Object.keys(logger.levels).forEach(function (method) {
+    assert.isFunction(logger[method]);
+  });
+};
+
+helpers.assertConsole = function (transport) {
+  assert.instanceOf(transport, winston.transports.Console);
+  assert.isFunction(transport.log);
+};
+
+helpers.assertMemory = function (transport) {
+  assert.instanceOf(transport, winston.transports.Memory);
+  assert.isFunction(transport.log);
+};
+
+helpers.assertFile = function (transport) {
+  assert.instanceOf(transport, winston.transports.File);
+  assert.isFunction(transport.log);
+}
+
+helpers.assertDailyRotateFile = function (transport) {
+  assert.instanceOf(transport, winston.transports.DailyRotateFile);
+  assert.isFunction(transport.log);
+}
+
+helpers.assertWebhook = function (transport) {
+  assert.instanceOf(transport, winston.transports.Webhook);
+  assert.isFunction(transport.log);
+};
+
+helpers.assertCouchdb = function (transport) {
+  assert.instanceOf(transport, winston.transports.Couchdb);
+  assert.isFunction(transport.log);
+};
+
+helpers.assertHandleExceptions = function (options) {
+  return {
+    topic: function () {
+      var that = this,
+          child = spawn('node', [options.script]);
+
+      helpers.tryUnlink(options.logfile);
+      child.on('exit', function () {
+        fs.readFile(options.logfile, that.callback);
+      });
+    },
+    "should save the error information to the specified file": function (err, data) {
+      assert.isTrue(!err);
+      data = JSON.parse(data);
+
+      assert.isObject(data);
+      helpers.assertProcessInfo(data.process);
+      helpers.assertOsInfo(data.os);
+      helpers.assertTrace(data.trace);
+      if (options.message) {
+        assert.equal('uncaughtException: ' + options.message, data.message);
+      }
+    }
+  }
+}
+
+helpers.testNpmLevels = function (transport, assertMsg, assertFn) {
+  return helpers.testLevels(winston.config.npm.levels, transport, assertMsg, assertFn);
+};
+
+helpers.testSyslogLevels = function (transport, assertMsg, assertFn) {
+  return helpers.testLevels(winston.config.syslog.levels, transport, assertMsg, assertFn);
+};
+
+helpers.testLevels = function (levels, transport, assertMsg, assertFn) {
+  var tests = {};
+
+  Object.keys(levels).forEach(function (level) {
+    var test = {
+      topic: function () {
+        transport.log(level, 'test message', {}, this.callback.bind(this, null));
+      }
+    };
+
+    test[assertMsg] = assertFn;
+    tests['with the ' + level + ' level'] = test;
+  });
+
+  var metadatatest = {
+    topic: function () {
+      transport.log('info', 'test message', { metadata: true }, this.callback.bind(this, null));
+    }
+  };
+
+  metadatatest[assertMsg] = assertFn;
+  tests['when passed metadata'] = metadatatest;
+
+  var primmetadatatest = {
+    topic: function () {
+      transport.log('info', 'test message', 'metadata', this.callback.bind(this, null));
+    }
+  };
+
+  primmetadatatest[assertMsg] = assertFn;
+  tests['when passed primitive metadata'] = primmetadatatest;
+
+  var circmetadata = { };
+  circmetadata['metadata'] = circmetadata;
+
+  var circmetadatatest = {
+    topic: function () {
+      transport.log('info', 'test message', circmetadata, this.callback.bind(this, null));
+    }
+  };
+
+  circmetadatatest[assertMsg] = assertFn;
+  tests['when passed circular metadata'] = circmetadatatest;
+
+  return tests;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/log-exception-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/log-exception-test.js
new file mode 100755 (executable)
index 0000000..eafdf40
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * exception-test.js: Tests for exception data gathering in winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    path = require('path'),
+    fs = require('fs'),
+    spawn = require('child_process').spawn,
+    vows = require('vows'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers'),
+    exists = (fs.exists || path.exists);
+
+vows.describe('winston/logger/exceptions').addBatch({
+  "When using winston": {
+    "the handleException() method": {
+      "with a custom winston.Logger instance": helpers.assertHandleExceptions({
+        script: path.join(__dirname, 'fixtures', 'scripts', 'log-exceptions.js'),
+        logfile: path.join(__dirname, 'fixtures', 'logs', 'exception.log')
+      }),
+      "with the default winston logger": helpers.assertHandleExceptions({
+        script: path.join(__dirname, 'fixtures', 'scripts', 'default-exceptions.js'),
+        logfile: path.join(__dirname, 'fixtures', 'logs', 'default-exception.log')
+      }),
+      "when strings are thrown as errors": helpers.assertHandleExceptions({
+        script: path.join(__dirname, 'fixtures', 'scripts', 'log-string-exception.js'),
+        logfile: path.join(__dirname, 'fixtures', 'logs', 'string-exception.log'),
+        message: 'OMG NEVER DO THIS STRING EXCEPTIONS ARE AWFUL'
+      }),
+      "when a custom exitOnError function is set": {
+        topic: function () {
+          var that = this,
+              scriptDir = path.join(__dirname, 'fixtures', 'scripts');
+
+          that.child = spawn('node', [path.join(scriptDir, 'exit-on-error.js')]);
+          setTimeout(this.callback.bind(this), 1500);
+        },
+        "should not exit the process": function () {
+          assert.isFalse(this.child.killed);
+          this.child.kill();
+        }
+      }
+    },
+    "the unhandleException() method": {
+      topic: function () {
+        var that = this,
+            child = spawn('node', [path.join(__dirname, 'fixtures', 'scripts', 'unhandle-exceptions.js')]),
+            exception = path.join(__dirname, 'fixtures', 'logs', 'unhandle-exception.log');
+
+        helpers.tryUnlink(exception);
+        child.on('exit', function () {
+          exists(exception, that.callback.bind(this, null));
+        });
+      },
+      "should not write to the specified error file": function (err, exists) {
+        assert.isTrue(!err);
+        assert.isFalse(exists);
+      }
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/log-rewriter-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/log-rewriter-test.js
new file mode 100755 (executable)
index 0000000..f1deeba
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * log-rewriter-test.js: Tests for rewriting metadata in winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    vows = require('vows'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers');
+
+vows.describe('winston/logger/rewriter').addBatch({
+  "An instance of winston.Logger": {
+    topic: new (winston.Logger)({transports: [
+      new (winston.transports.Console)({ level: 'info' })
+    ]}),
+    "the addRewriter() method": {
+      topic: function (logger) {
+        logger.addRewriter(function (level, msg, meta) {
+          meta.level = level;
+          meta.msg = msg;
+          meta.foo = 'bar';
+          return meta;
+        });
+        return logger;
+      },
+      "should add the rewriter": function (logger) {
+        assert.equal(helpers.size(logger.rewriters), 1);
+      },
+      "the log() method": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message', {"a": "b"});
+        },
+        "should run the rewriter": function (transport, level, msg, meta) {
+          assert.equal(meta.a, 'b');
+          assert.equal(meta.level, 'info');
+          assert.equal(meta.msg, 'test message');
+          assert.equal(meta.foo, 'bar');
+        }
+      }
+    }
+  }
+}).addBatch({
+  "An instance of winston.Logger with explicit rewriter": {
+    topic: new (winston.Logger)({transports: [
+      new (winston.transports.Console)({ level: 'info'})
+    ], rewriters: [
+      function (level, msg, meta) {
+        meta.level = level;
+        meta.msg = msg;
+        meta.foo = 'bar';
+        return meta;
+      }
+    ]}),
+    "should add the rewriter": function (logger) {
+      assert.equal(helpers.size(logger.rewriters), 1);
+    },
+    "the log() method": {
+      topic: function (logger) {
+        logger.once('logging', this.callback);
+        logger.log('info', 'test message', {"a": "b"});
+      },
+      "should run the rewriter": function (transport, level, msg, meta) {
+        assert.equal(meta.a, 'b');
+        assert.equal(meta.level, 'info');
+        assert.equal(meta.msg, 'test message');
+        assert.equal(meta.foo, 'bar');
+      }
+    }
+  }
+}).addBatch({
+  "An instance of winston.Logger with rewriters": {
+    topic: new (winston.Logger)({transports: [
+      new (winston.transports.Console)({ level: 'info' })
+    ], rewriters: [
+      function (level, msg, meta) {
+        meta.numbers.push(1);
+        return meta;
+      },
+      function (level, msg, meta) {
+        meta.numbers.push(2);
+        return meta;
+      }
+    ]}),
+    "the log() method": {
+      topic: function (logger) {
+        logger.once('logging', this.callback);
+        logger.log('info', 'test message', {"numbers": [0]});
+      },
+      "should run the rewriters in correct order": function (transport, level, msg, meta) {
+        assert.deepEqual(meta.numbers, [0, 1, 2]);
+      }
+    }
+  }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/logger-levels-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/logger-levels-test.js
new file mode 100755 (executable)
index 0000000..e165c63
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * log-rewriter-test.js: Tests for rewriting metadata in winston.
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    vows = require('vows'),
+    winston = require('../lib/winston'),
+    util = require('util'),
+    helpers = require('./helpers');
+
+vows.describe('winston/logger/levels').addBatch({
+  "The winston logger": {
+    topic: new (winston.Logger)({
+      transports: [
+        new (winston.transports.Console)()
+      ]
+    }),
+    "the info() method": {
+      "when passed metadata": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message', {foo: 'bar'});
+        },
+        "should have metadata object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message');
+          assert.deepEqual(meta, {foo: 'bar'});
+        }
+         }
+        },
+      "when passed a string placeholder": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message %s', 'my string');
+        },
+        "should interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message my string');
+        },
+      },
+      "when passed a number placeholder": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message %d', 123);
+        },
+        "should interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message 123');
+        },
+      },
+      "when passed a json placholder and an empty object": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message %j', {number: 123}, {});
+        },
+        "should interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message {"number":123}');
+        },
+      },
+      "when passed a escaped percent sign": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message %%', {number: 123});
+        },
+        "should not interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, util.format('test message %%'));
+          assert.deepEqual(meta, {number: 123});          
+        },
+      },
+      "when passed interpolation strings and a meta object": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message %s, %s', 'first', 'second' ,{number: 123});
+        },
+        "should interpolate and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first, second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed multiple strings and a meta object": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.info('test message', 'first', 'second' , {number: 123});
+        },
+        "should join and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed interpolations strings, meta object and a callback": {
+        topic: function (logger) {
+          var that = this;
+          logger.info('test message %s, %s', 'first', 'second' , {number: 123}, function(transport, level, msg, meta){
+            that.callback(transport, level, msg, meta)
+          });
+        },
+        "should interpolate and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first, second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed multiple strings, a meta object and a callback": {
+        topic: function (logger) {
+          var that = this;
+          logger.info('test message', 'first', 'second' , {number: 123}, function(transport, level, msg, meta){
+            that.callback(transport, level, msg, meta)
+          });
+        },
+        "should join and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first second');
+          assert.deepEqual(meta, {number: 123});
+        }    
+      }
+    }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/logger-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/logger-test.js
new file mode 100755 (executable)
index 0000000..2f3079c
--- /dev/null
@@ -0,0 +1,362 @@
+/*
+ * logger-test.js: Tests for instances of the winston Logger
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    assert = require('assert'),
+    util = require('util'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers'),
+    transport = require('./transports/transport');
+
+vows.describe('winton/logger').addBatch({
+  "An instance of winston.Logger": {
+    "with transports": {
+      topic: new (winston.Logger)({ transports: [new (winston.transports.Console)({ level: 'info' })] }),
+      "should have the correct methods / properties defined": function (logger) {
+        helpers.assertLogger(logger);
+      },
+      "the add() with an unsupported transport": {
+        "should throw an error": function () {
+          assert.throws(function () { logger.add('unsupported') }, Error);
+        }
+      }
+    },
+    "with no transports": {
+      topic: new winston.Logger(),
+      "the log method": {
+        topic: function (logger) {
+          var that = this;
+          logger.log('error', 'This should be an error', function (err) {
+            that.callback(null, err);
+          });
+        },
+        "should respond with the appropriate error": function (err) {
+          assert.instanceOf(err, Error);
+        }
+      }
+    }
+  }
+}).addBatch({
+  "An instance of winston.Logger": {
+    topic: new (winston.Logger)({ transports: [new (winston.transports.Console)({ level: 'info' })] }),
+    "the log() method": {
+      "when listening for the 'logging' event": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message');
+        },
+        "should emit the 'log' event with the appropriate transport": function (transport, ign) {
+          helpers.assertConsole(transport);
+        }
+      },
+      "when listening for the 'logged' event": {
+        topic: function (logger) {
+          logger.once('logged', this.callback);
+          logger.log('info', 'test message');
+        },
+        "should emit the 'logged' event": function (level, msg, meta) {
+          assert.equal(level, 'info');
+          assert.equal(msg, 'test message');
+        }
+      },
+    }
+  }
+}).addBatch({
+  "An instance of winston.Logger with no transports": {
+    topic: new (winston.Logger)({ emitErrs: true }),
+    "the log() method should throw an error": function (logger) {
+      assert.throws(function () { logger.log('anything') }, Error);
+    },
+    "the extend() method called on an empty object": {
+      topic: function (logger) {
+        var empty = {};
+        logger.extend(empty);
+        return empty;
+      },
+      "should define the appropriate methods": function (extended) {
+        ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) {
+          assert.isFunction(extended[method]);
+        });
+      }
+    },
+    "the add() method with a supported transport": {
+      topic: function (logger) {
+        return logger.add(winston.transports.Console);
+      },
+      "should add the console Transport onto transports": function (logger) {
+        assert.equal(helpers.size(logger.transports), 1);
+        helpers.assertConsole(logger.transports.console);
+      },
+      "should throw an error when the same Transport is added": function (logger) {
+        assert.throws(function () { logger.add(winston.transports.Console) }, Error);
+      },
+      "the profile() method": {
+        "when passed a callback": {
+          topic: function (logger) {
+            var cb = this.callback;
+            logger.profile('test1');
+            setTimeout(function () {
+              logger.profile('test1', function (err, level, msg, meta) {
+                cb(err, level, msg, meta, logger);
+              });
+            }, 50);
+          },
+          "should respond with the appropriate profile message": function (err, level, msg, meta, logger) {
+            assert.isNull(err);
+            assert.equal(level, 'info');
+            assert.match(meta.duration, /(\d+)ms/);
+            assert.isTrue(typeof logger.profilers['test'] === 'undefined');
+          },
+          "when passed some metadata": {
+            topic: function () {
+              var logger = arguments[arguments.length - 1];
+              var cb = this.callback.bind(null, null);
+              logger.profile('test3');
+              setTimeout(function () {
+                logger.once('logging', cb);
+                logger.profile('test3', {
+                  some: 'data'
+                });
+              }, 50);
+            },
+            "should respond with the right metadata": function (err, transport, level, msg, meta) {
+              assert.equal(msg, 'test3');
+              assert.isNull(err);
+              assert.equal(level, 'info');
+              assert.match(meta.duration, /(\d+)ms/);
+              assert.equal(meta.some, 'data');
+            },
+            "when not passed a callback": {
+              topic: function () {
+                var logger = arguments[arguments.length - 1];
+                var cb = this.callback.bind(null, null);
+                logger.profile('test2');
+                setTimeout(function () {
+                  logger.once('logging', cb);
+                  logger.profile('test2');
+                }, 50);
+              },
+              "should respond with the appropriate profile message": function (err, transport, level, msg, meta) {
+                assert.isNull(err);
+                assert.equal(msg, 'test2');
+                assert.equal(level, 'info');
+                assert.match(meta.duration, /(\d+)ms/);
+              }
+            }
+          }
+        }
+      },
+      "the startTimer() method": {
+        "when passed a callback": {
+          topic: function (logger) {
+            var that = this;
+            var timer = logger.startTimer()
+            setTimeout(function () {
+              timer.done('test', function (err, level, msg, meta) {
+                that.callback(err, level, msg, meta, logger);
+              });
+            }, 500);
+          },
+          "should respond with the appropriate message": function (err, level, msg, meta, logger) {
+            assert.isNull(err);
+            assert.equal(level, 'info');
+            assert.match(meta.duration, /(\d+)ms/);
+          }
+        },
+        "when not passed a callback": {
+          topic: function (logger) {
+            var that = this;
+            var timer = logger.startTimer()
+            logger.once('logging', that.callback.bind(null, null));
+            setTimeout(function () {
+              timer.done();
+            }, 500);
+          },
+          "should respond with the appropriate message": function (err, transport, level, msg, meta) {
+            assert.isNull(err);
+            assert.equal(level, 'info');
+            assert.match(meta.duration, /(\d+)ms/);
+
+            var duration = parseInt(meta.duration);
+            assert.isNumber(duration);
+            assert.isTrue(duration >= 50 && duration < 100);
+          }
+        }
+      },
+      "and adding an additional transport": {
+        topic: function (logger) {
+          return logger.add(winston.transports.File, {
+            filename: path.join(__dirname, 'fixtures', 'logs', 'testfile2.log')
+          });
+        },
+        "should be able to add multiple transports": function (logger) {
+          assert.equal(helpers.size(logger.transports), 2);
+          helpers.assertConsole(logger.transports.console);
+          helpers.assertFile(logger.transports.file);
+        }
+      }
+    }
+  }
+}).addBatch({
+  "The winston logger": {
+    topic: new (winston.Logger)({
+      transports: [
+        new (winston.transports.Console)(),
+        new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )})
+      ]
+    }),
+    "should return have two transports": function (logger) {
+      assert.equal(helpers.size(logger.transports), 2);
+    },
+    "the remove() with an unadded transport": {
+      "should throw an Error": function (logger) {
+        assert.throws(function () { logger.remove(winston.transports.Webhook) }, Error);
+      }
+    },
+    "the remove() method with an added transport": {
+      topic: function (logger) {
+         return logger.remove(winston.transports.Console);
+      },
+      "should remove the Console transport from transports": function (logger) {
+        assert.equal(helpers.size(logger.transports), 1);
+        helpers.assertFile(logger.transports.file);
+      },
+      "and removing an additional transport": {
+        topic: function (logger) {
+           return logger.remove(winston.transports.File);
+        },
+        "should remove File transport from transports": function (logger) {
+          assert.equal(helpers.size(logger.transports), 0);
+        }
+      }
+    }
+  }
+}).addBatch({
+  "The winston logger": {
+    topic: new (winston.Logger)({
+      transports: [
+        new (winston.transports.Console)(),
+        new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )})
+      ]
+    }),
+    "the clear() method": {
+      "should remove all transports": function (logger) {
+        logger.clear();
+        assert.equal(helpers.size(logger.transports), 0);
+      }
+    }
+  }
+}).addBatch({
+  "The winston logger": {
+    topic: new (winston.Logger)({
+      exceptionHandlers: [
+        new (winston.transports.Console)(),
+        new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )})
+      ]
+    }),
+    "the unhandleExceptions() method": {
+      "should remove all transports": function (logger) {
+        assert.equal(helpers.size(logger.exceptionHandlers), 2);
+        logger.unhandleExceptions();
+        assert.equal(helpers.size(logger.exceptionHandlers), 0);
+      }
+    }
+  }
+}).addBatch({
+  "The winston logger": {
+    topic: new (winston.Logger)({
+      transports: [
+        new (winston.transports.Console)()
+      ]
+    }),
+    "the log() method": {
+      "when passed a string placeholder": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message %s', 'my string');
+        },
+        "should interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message my string');
+        },
+      },
+      "when passed a number placeholder": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message %d', 123);
+        },
+        "should interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message 123');
+        },
+      },
+      "when passed a json placholder and an empty object": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message %j', {number: 123}, {});
+        },
+        "should interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message {"number":123}');
+        },
+      },
+      "when passed a escaped percent sign": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message %%', {number: 123});
+        },
+        "should not interpolate": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, util.format('test message %%'));
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed interpolation strings and a meta object": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message %s, %s', 'first', 'second' ,{number: 123});
+        },
+        "should interpolate and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first, second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed multiple strings and a meta object": {
+        topic: function (logger) {
+          logger.once('logging', this.callback);
+          logger.log('info', 'test message', 'first', 'second' , {number: 123});
+        },
+        "should join and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed interpolations strings, meta object and a callback": {
+        topic: function (logger) {
+          var that = this;
+          logger.log('info', 'test message %s, %s', 'first', 'second' , {number: 123}, function(transport, level, msg, meta){
+            that.callback(transport, level, msg, meta)
+          });
+        },
+        "should interpolate and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first, second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      },
+      "when passed multiple strings, a meta object and a callback": {
+        topic: function (logger) {
+          var that = this;
+          logger.log('info', 'test message', 'first', 'second' , {number: 123}, function(transport, level, msg, meta){
+            that.callback(transport, level, msg, meta)
+          });
+        },
+        "should join and have a meta object": function (transport, level, msg, meta) {
+          assert.strictEqual(msg, 'test message first second');
+          assert.deepEqual(meta, {number: 123});
+        },
+      }
+    }
+  }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/stress/http-server.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/stress/http-server.js
new file mode 100755 (executable)
index 0000000..55d8477
--- /dev/null
@@ -0,0 +1,27 @@
+//
+// Run ab -c 10 -n 100 localhost:4444/ | wc - l
+// Nothing is created in http-stress.log
+//
+
+var http = require('http'),
+    path = require('path'),
+    winston = require('../../lib/winston');
+
+var logger = new (winston.Logger)({
+  transports: [
+    new (winston.transports.Console)(),
+    new (winston.transports.File)({ filename: path.join(__dirname, '..', 'fixtures', 'logs', 'http-stress.log') })
+  ]
+});
+
+var server = http.createServer(function(request, response){
+  response.writeHead(200, { 'Content-Type': 'text/plain' });
+  var rd = Math.random() * 500;
+  logger.info("hello " + rd);
+  response.write('hello ');
+  if (Math.floor(rd) == 10) {
+    process.exit(1);
+  }
+
+  response.end();
+}).listen(4444);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/console-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/console-test.js
new file mode 100755 (executable)
index 0000000..07f5a6e
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * console-test.js: Tests for instances of the Console transport
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    assert = require('assert'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var npmTransport = new (winston.transports.Console)(),
+    syslogTransport = new (winston.transports.Console)({ levels: winston.config.syslog.levels });
+
+vows.describe('winston/transports/console').addBatch({
+  "An instance of the Console Transport": {
+    "with npm levels": {
+      "should have the proper methods defined": function () {
+        helpers.assertConsole(npmTransport);
+      },
+      "the log() method": helpers.testNpmLevels(npmTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    },
+    "with syslog levels": {
+      "should have the proper methods defined": function () {
+        helpers.assertConsole(syslogTransport);
+      },
+      "the log() method": helpers.testSyslogLevels(syslogTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/daily-rotate-file-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/daily-rotate-file-test.js
new file mode 100755 (executable)
index 0000000..02681c2
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * file-test.js: Tests for instances of the Daily Rotate File transport
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    fs = require('fs'),
+    assert = require('assert'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var transport = require('./transport');
+
+var stream = fs.createWriteStream(
+      path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log.2012-12-18')
+    ),
+    dailyRotateFileTransport = new (winston.transports.DailyRotateFile)({
+      filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfilename.log'),
+      datePattern: '.yyyy-MM-dd'
+    }),
+    streamTransport = new (winston.transports.DailyRotateFile)({ stream: stream });
+
+vows.describe('winston/transports/daily-rotate-file').addBatch({
+  "An instance of the Daily Rotate File Transport": {
+    "when passed a valid filename": {
+      "should have the proper methods defined": function () {
+        helpers.assertDailyRotateFile(dailyRotateFileTransport);
+      },
+      "the log() method": helpers.testNpmLevels(dailyRotateFileTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    },
+    "when passed a valid file stream": {
+      "should have the proper methods defined": function () {
+        helpers.assertDailyRotateFile(streamTransport);
+      },
+      "the log() method": helpers.testNpmLevels(streamTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  }
+}).addBatch({
+  "These tests have a non-deterministic end": {
+    topic: function () {
+      setTimeout(this.callback, 200);
+    },
+    "and this should be fixed before releasing": function () {
+      assert.isTrue(true);
+    }
+  }
+}).addBatch({
+  "An instance of the Daily Rotate File Transport": transport(winston.transports.DailyRotateFile, {
+    filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log'),
+    datePattern: '.2012-12-18'
+  })
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-maxfiles-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-maxfiles-test.js
new file mode 100755 (executable)
index 0000000..a9fa89e
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * file-maxfiles-test.js: Tests for instances of the File transport setting the max file size,
+ * and setting a number for max files created.
+ * maxSize * maxFiles = total storage used by winston.
+ *
+ * (C) 2011 Daniel Aristizabal
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    exec = require('child_process').exec,
+    fs = require('fs'),
+    path = require('path'),
+    vows = require('vows'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var maxfilesTransport = new winston.transports.File({
+  timestamp: false,
+  json: false,
+  filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles.log'),
+  maxsize: 4096,
+  maxFiles: 3
+});
+    
+vows.describe('winston/transports/file/maxfiles').addBatch({
+  "An instance of the File Transport": {
+    "when passed a valid filename": {
+      topic: maxfilesTransport,
+      "should be a valid transporter": function (transportTest) {
+        helpers.assertFile(transportTest);
+      },
+      "should set the maxFiles option correctly": function (transportTest) {
+        assert.isNumber(transportTest.maxFiles);
+      }
+    },
+    "when delete old test files": {
+      topic: function () {
+        exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles*'), this.callback);
+      },
+      "and when passed more files than the maxFiles": {
+        topic: function () {
+          var that = this,
+              created = 0;
+              
+          function data(ch) {
+            return new Array(1018).join(String.fromCharCode(65 + ch));
+          };
+      
+          function logKbytes(kbytes, txt) {
+            //
+            // With no timestamp and at the info level,
+            // winston adds exactly 7 characters: 
+            // [info](4)[ :](2)[\n](1)
+            //
+            for (var i = 0; i < kbytes; i++) {
+              maxfilesTransport.log('info', data(txt), null, function () { });
+            }
+          }
+          
+          maxfilesTransport.on('logged', function () {
+            if (++created === 6) {
+              return that.callback();
+            }
+            
+            logKbytes(4, created);
+          });
+         
+          logKbytes(4, created);
+        },
+        "should be only 3 files called 5.log, 4.log and 3.log": function () {
+          for (var num = 0; num < 6; num++) {
+            var file = !num ? 'testmaxfiles.log' : 'testmaxfiles' + num + '.log',
+                fullpath = path.join(__dirname, '..', 'fixtures', 'logs', file);
+            
+            // There should be no files with that name
+            if (num >= 0 && num < 3) {
+              return assert.throws(function () {
+                fs.statSync(file);
+              }, Error);
+            } 
+
+            // The other files should be exist
+            assert.doesNotThrow(function () {
+              fs.statSync(file);
+            }, Error);
+          }
+        },
+        "should have the correct content": function () {
+          ['D', 'E', 'F'].forEach(function (name, inx) {
+            var counter = inx + 3,
+                logsDir = path.join(__dirname, '..', 'fixtures', 'logs'),
+                content = fs.readFileSync(path.join(logsDir, 'testmaxfiles' + counter + '.log'), 'utf-8');
+            // The content minus the 7 characters added by winston
+            assert.lengthOf(content.match(new RegExp(name, 'g')), 4068);
+          });
+        }
+      }
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-maxsize-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-maxsize-test.js
new file mode 100755 (executable)
index 0000000..7d20e08
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * file-test.js: Tests for instances of the File transport
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    exec = require('child_process').exec,
+    fs = require('fs'),
+    path = require('path'),
+    vows = require('vows'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var maxsizeTransport = new winston.transports.File({
+  timestamp: false,
+  json: false,
+  filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize.log'),
+  maxsize: 4096
+});
+    
+vows.describe('winston/transports/file/maxsize').addBatch({
+  "An instance of the File Transport": {
+    "when passed a valid filename": {
+      "the log() method": {
+        topic: function () {
+          exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize*'), this.callback);
+        },
+        "when passed more than the maxsize": {
+          topic: function () {
+            var that = this,
+                data = new Array(1018).join('-');
+            
+            //
+            // Setup a list of files which we will later stat.
+            //
+            that.files = [];
+            
+            function logKbytes (kbytes) {
+              //
+              // With no timestamp and at the info level,
+              // winston adds exactly 7 characters: 
+              // [info](4)[ :](2)[\n](1)
+              //
+              for (var i = 0; i < kbytes; i++) {
+                maxsizeTransport.log('info', data, null, function () { });
+              }
+            }
+            
+            maxsizeTransport.on('open', function (file) {
+              var match = file.match(/(\d+)\.log$/),
+                  count = match ? match[1] : 0;
+              
+              that.files.push(file);
+              
+              if (that.files.length === 5) {
+                return that.callback();
+              }
+              
+              logKbytes(4);
+            });
+            
+            logKbytes(4);
+          },
+          "should create multiple files correctly": function () {
+            this.files.forEach(function (file) {
+              try {
+                var stats = fs.statSync(file);
+                assert.equal(stats.size, 4096);
+              }
+              catch (ex) {
+                assert.isNull(ex);
+              }
+            });
+          }
+        }
+      }
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-open-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-open-test.js
new file mode 100755 (executable)
index 0000000..15427a0
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * file-open-test.js: Tests for File transport "open" event
+ *
+ * (C) 2014 William Wong
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    fs = require('fs'),
+    os  = require('os'),
+    path = require('path'),
+    vows = require('vows'),
+    winston = require('../../lib/winston');
+
+vows.describe('winston/transports/file').addBatch({
+    'An instance of the File Transport': {
+        topic: function () {
+            var callback = this.callback.bind(this),
+                logPath = path.resolve(__dirname, '../fixtures/logs/file-open-test.log');
+
+            try {
+                fs.unlinkSync(logPath);
+            } catch (ex) {
+                if (ex && ex.code !== 'ENOENT') { return callback(ex); }
+            }
+
+            var fileTransport = new (winston.transports.File)({
+                    filename: logPath
+                }),
+                logger = new (winston.Logger)({
+                    transports: [fileTransport]
+                }),
+                timeline = {};
+
+            fileTransport.open(function () {
+                timeline.open = Date.now();
+
+                setTimeout(function () {
+                    logger.info('Hello, World!', function () {
+                        timeline.logged = Date.now();
+                    });
+                }, 100);
+
+                setTimeout(function () {
+                    callback(null, timeline);
+                }, 1000);
+            });
+        },
+        'should fire "open" event': function (results) {
+            assert.isTrue(!!results.open);
+        },
+        'should fire "logged" event': function (results) {
+            assert.isTrue(!!results.logged);
+        }
+    }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-stress-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-stress-test.js
new file mode 100755 (executable)
index 0000000..8c4dcb9
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * file-stress-test.js: Tests for stressing File transport
+ *
+ * (C) 2014 William Wong
+ * MIT LICENSE
+ *
+ */
+
+var assert = require('assert'),
+    fs = require('fs'),
+    os  = require('os'),
+    path = require('path'),
+    vows = require('vows'),
+    winston = require('../../lib/winston');
+
+vows.describe('winston/transports/file').addBatch({
+    'A stressed instance of the File Transport': {
+        topic: function () {
+            var callback = this.callback.bind(this),
+                logPath = path.resolve(__dirname, '../fixtures/logs/file-stress-test.log');
+
+            try {
+                fs.unlinkSync(logPath);
+            } catch (ex) {
+                if (ex && ex.code !== 'ENOENT') { return callback(ex); }
+            }
+
+            var fileTransport = new (winston.transports.File)({
+                    filename: logPath
+                }),
+                logger = new (winston.Logger)({
+                    transports: [fileTransport]
+                });
+
+            fileTransport.on('open', function () {
+                setTimeout(function () {
+                    clearInterval(interval);
+
+                    logger.query({ order: 'asc' }, function (err, results) {
+                        callback(null, results);
+                    });
+                }, 100);
+            });
+
+            var logIndex = 0,
+                interval = setInterval(function () {
+                    logger.info(++logIndex);
+                    stress(200);
+                }, 0);
+
+            logger.info(++logIndex);
+            stress(200);
+
+            function stress(duration) {
+                var startTime = Date.now();
+
+                while (Date.now() - startTime < duration) {
+                    Math.sqrt(Math.PI);
+                }
+            }
+        },
+        'should not skip any log lines': function (results) {
+            var testIndex = 0;
+
+            results.file.forEach(function (log) {
+                if (+log.message !== ++testIndex) {
+                    throw new Error('Number skipped');
+                }
+            });
+        }
+    }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/file-test.js
new file mode 100755 (executable)
index 0000000..2039b03
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * file-test.js: Tests for instances of the File transport
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    fs = require('fs'),
+    assert = require('assert'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var transport = require('./transport');
+
+var stream = fs.createWriteStream(
+      path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log')
+    ),
+    fileTransport = new (winston.transports.File)({
+      filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfilename.log')
+    }),
+    streamTransport = new (winston.transports.File)({ stream: stream });
+
+vows.describe('winston/transports/file').addBatch({
+  "An instance of the File Transport": {
+    "when passed a valid filename": {
+      "should have the proper methods defined": function () {
+        helpers.assertFile(fileTransport);
+      },
+      "the log() method": helpers.testNpmLevels(fileTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    },
+    "when passed a valid file stream": {
+      "should have the proper methods defined": function () {
+        helpers.assertFile(streamTransport);
+      },
+      "the log() method": helpers.testNpmLevels(streamTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  }
+}).addBatch({
+  "These tests have a non-deterministic end": {
+    topic: function () {
+      setTimeout(this.callback, 200);
+    },
+    "and this should be fixed before releasing": function () {
+      assert.isTrue(true);
+    }
+  }
+}).addBatch({
+  "An instance of the File Transport": transport(winston.transports.File, {
+    filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log')
+  })
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/memory-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/memory-test.js
new file mode 100755 (executable)
index 0000000..e8e1043
--- /dev/null
@@ -0,0 +1,31 @@
+var path = require('path'),
+    vows = require('vows'),
+    assert = require('assert'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var npmTransport = new (winston.transports.Memory)(),
+    syslogTransport = new (winston.transports.Memory)({ levels: winston.config.syslog.levels });
+
+vows.describe('winston/transports/memory').addBatch({
+  "An instance of the Memory Transport": {
+    "with npm levels": {
+      "should have the proper methods defined": function () {
+        helpers.assertMemory(npmTransport);
+      },
+      "the log() method": helpers.testNpmLevels(npmTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    },
+    "with syslog levels": {
+      "should have the proper methods defined": function () {
+        helpers.assertMemory(syslogTransport);
+      },
+      "the log() method": helpers.testSyslogLevels(syslogTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  }
+}).export(module);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/transport.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/transport.js
new file mode 100755 (executable)
index 0000000..96175f5
--- /dev/null
@@ -0,0 +1,215 @@
+var assert = require('assert'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+module.exports = function (transport, options) {
+  var logger = transport instanceof winston.Logger
+    ? transport
+    : new winston.Logger({
+        transports: [
+          new transport(options)
+        ]
+      });
+
+  // hack to fix transports that don't log
+  // any unit of time smaller than seconds
+  var common = require('../../lib/winston/common');
+  common.timestamp = function() {
+    return new Date().toISOString();
+  };
+
+  var transport = logger.transports[logger._names[0]];
+
+  var out = {
+    'topic': logger,
+    'when passed valid options': {
+      'should have the proper methods defined': function () {
+        switch (transport.name) {
+          case 'console':
+            helpers.assertConsole(transport);
+            break;
+          case 'file':
+            helpers.assertFile(transport);
+            break;
+          case 'webhook':
+            helpers.assertWebhook(transport);
+            break;
+          case 'couchdb':
+            helpers.assertCouchdb(transport);
+            break;
+        }
+        assert.isFunction(transport.log);
+      }
+    },
+    'the log() method': helpers.testNpmLevels(transport,
+      'should respond with true', function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isNotNull(logged);
+      }
+    ),
+    'the stream() method': {
+      'using no options': {
+        'topic': function () {
+          if (!transport.stream) return;
+
+          logger.log('info', 'hello world', {});
+
+          var cb = this.callback,
+              j = 10,
+              i = 10,
+              results = [],
+              stream = logger.stream();
+
+          stream.on('log', function (log) {
+            results.push(log);
+            results.stream = stream;
+            if (!--j) cb(null, results);
+          });
+
+          stream.on('error', function (err) {
+            j = -1; //don't call the callback again
+            cb(err);
+          });
+
+          while (i--) logger.log('info', 'hello world ' + i, {});
+        },
+        'should stream logs': function (err, results) {
+          if (!transport.stream) return;
+          assert.isNull(err);
+          results.forEach(function (log) {
+            assert.ok(log.message.indexOf('hello world') === 0
+                      || log.message.indexOf('test message') === 0);
+          });
+          results.stream.destroy();
+        }
+      },
+      'using the `start` option': {
+        'topic': function () {
+          if (!transport.stream) return;
+
+          var cb = this.callback,
+              stream = logger.stream({ start: 0 });
+
+          stream.on('log', function (log) {
+            log.stream = stream;
+            if (cb) cb(null, log);
+            cb = null;
+          });
+        },
+        'should stream logs': function (err, log) {
+          if (!transport.stream) return;
+          assert.isNull(err);
+          assert.isNotNull(log.message);
+          log.stream.destroy();
+        }
+      }
+    },
+    'after the logs have flushed': {
+      topic: function () {
+        setTimeout(this.callback, 1000);
+      },
+      'the query() method': {
+        'using basic querying': {
+          'topic': function () {
+            if (!transport.query) return;
+            var cb = this.callback;
+            logger.log('info', 'hello world', {}, function () {
+              logger.query(cb);
+            });
+          },
+          'should return matching results': function (err, results) {
+            if (!transport.query) return;
+            assert.isNull(err);
+            results = results[transport.name];
+            while (!Array.isArray(results)) {
+              results = results[Object.keys(results).pop()];
+            }
+            var log = results.pop();
+            assert.ok(log.message.indexOf('hello world') === 0
+                      || log.message.indexOf('test message') === 0);
+          }
+        },
+        'using the `rows` option': {
+          'topic': function () {
+            if (!transport.query) return;
+            var cb = this.callback;
+            logger.log('info', 'hello world', {}, function () {
+              logger.query({ rows: 1 }, cb);
+            });
+          },
+          'should return one result': function (err, results) {
+            if (!transport.query) return;
+            assert.isNull(err);
+            results = results[transport.name];
+            while (!Array.isArray(results)) {
+              results = results[Object.keys(results).pop()];
+            }
+            assert.equal(results.length, 1);
+          }
+        },
+        'using `fields` and `order` option': {
+          'topic': function () {
+            if (!transport.query) return;
+            var cb = this.callback;
+            logger.log('info', 'hello world', {}, function () {
+              logger.query({ order: 'asc', fields: ['timestamp'] }, cb);
+            });
+          },
+          'should return matching results': function (err, results) {
+            if (!transport.query) return;
+            assert.isNull(err);
+            results = results[transport.name];
+            while (!Array.isArray(results)) {
+              results = results[Object.keys(results).pop()];
+            }
+            assert.equal(Object.keys(results[0]).length, 1);
+            assert.ok(new Date(results.shift().timestamp)
+                    < new Date(results.pop().timestamp));
+          }
+        },
+        'using the `from` and `until` option': {
+          'topic': function () {
+            if (!transport.query) return;
+            var cb = this.callback;
+            var start = Date.now() - (100 * 1000);
+            var end = Date.now() + (100 * 1000);
+            logger.query({ from: start, until: end }, cb);
+          },
+          'should return matching results': function (err, results) {
+            if (!transport.query) return;
+            assert.isNull(err);
+            results = results[transport.name];
+            while (!Array.isArray(results)) {
+              results = results[Object.keys(results).pop()];
+            }
+            assert.ok(results.length >= 1);
+          }
+        },
+        'using a bad `from` and `until` option': {
+          'topic': function () {
+            if (!transport.query) return;
+            var cb = this.callback;
+            logger.log('info', 'bad from and until', {}, function () {
+              var now = Date.now() + 1000000;
+              logger.query({ from: now, until: now }, cb);
+            });
+          },
+          'should return no results': function (err, results) {
+            if (!transport.query) return;
+            assert.isNull(err);
+            results = results[transport.name];
+            while (!Array.isArray(results)) {
+              results = results[Object.keys(results).pop()];
+            }
+            results = [results.filter(function(log) {
+              return log.message === 'bad from and until';
+            }).pop()];
+            assert.isUndefined(results[0]);
+          }
+        }
+      }
+    }
+  };
+
+  return out;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/webhook-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/transports/webhook-test.js
new file mode 100755 (executable)
index 0000000..8d40c00
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * webhook-test.js: Tests for instances of the Webhook transport
+ *
+ * (C) 2011 Marak Squires
+ * MIT LICENSE
+ *
+ */
+
+var path = require('path'),
+    vows = require('vows'),
+    fs = require('fs'),
+    http = require('http'),
+    https = require('https'),
+    assert = require('assert'),
+    winston = require('../../lib/winston'),
+    helpers = require('../helpers');
+
+var webhookTransport = new (winston.transports.Webhook)({
+  "host": "localhost",
+  "port": 8080,
+  "path": "/winston-test"
+});
+
+var httpsWebhookTransport = new (winston.transports.Webhook)({
+  "host": "localhost",
+  "port": 8081,
+  "path": "/winston-test",
+  "ssl": true
+});
+
+var authWebhookTransport = new (winston.transports.Webhook)({
+  "host": "localhost",
+  "port": 8080,
+  "path": "/winston-auth-test",
+  "auth": {
+    "username": "winston",
+    "password": "churchill"
+  }
+});
+
+var requestsAuthenticated = true;
+
+var server = http.createServer(function (req, res) {
+  if (req.url == '/winston-auth-test') {
+    //
+    // Test if request has been correctly authenticated
+    //
+    // Strip 'Basic' from Authorization header
+    var signature = req.headers['authorization'].substr(6);
+    requestsAuthenticated = requestsAuthenticated &&
+      new Buffer(signature, 'base64').toString('utf8') == 'winston:churchill';
+  }
+  res.end();
+});
+
+server.listen(8080);
+
+
+var httpsServer = https.createServer({
+  cert: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-cert.pem')),
+  key: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-key.pem'))
+}, function (req, res) {
+  res.end();
+});
+
+httpsServer.listen(8081);
+
+vows.describe('winston/transports/webhook').addBatch({
+  "An instance of the Webhook Transport": {
+    "when passed valid options": {
+      "should have the proper methods defined": function () {
+        helpers.assertWebhook(webhookTransport);
+      },
+      "the log() method": helpers.testNpmLevels(webhookTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  },
+  "An https instance of the Webhook Transport": {
+    "when passed valid options": {
+      "should have the proper methods defined": function () {
+        helpers.assertWebhook(httpsWebhookTransport);
+      },
+      "the log() method": helpers.testNpmLevels(httpsWebhookTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  },
+  "An http Basic Auth instance of the Webhook Transport": {
+    "when passed valid options": {
+      "should have the proper methods defined": function () {
+        helpers.assertWebhook(authWebhookTransport);
+      },
+      "the log() method": helpers.testNpmLevels(authWebhookTransport, "should respond with true", function (ign, err, logged) {
+        assert.isNull(err);
+        assert.isTrue(logged);
+      })
+    }
+  }
+}).addBatch({
+  "When the tests are over": {
+    topic: function () {
+      //
+      // Delay destruction of the server since the
+      // WebHook transport responds before the request
+      // has actually be completed.
+      //
+      setTimeout(this.callback, 1000);
+    },
+    "the server should cleanup": function () {
+      server.close();
+    },
+    "requests have been correctly authenticated": function () {
+      assert.ok(requestsAuthenticated);
+    }
+  }
+}).addBatch({
+  // "An instance of the Webhook Transport": transport(winston.transports.Webhook, {
+  //   "host": "localhost",
+  //   "port": 8080,
+  //   "path": "/winston-test"
+  // })
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/winston-test.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/winston/test/winston-test.js
new file mode 100755 (executable)
index 0000000..5dec373
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * logger-test.js: Tests for instances of the winston Logger
+ *
+ * (C) 2010 Charlie Robbins
+ * MIT LICENSE
+ *
+ */
+
+var fs = require('fs'),
+    path = require('path'),
+    vows = require('vows'),
+    http = require('http'),
+    assert = require('assert'),
+    winston = require('../lib/winston'),
+    helpers = require('./helpers');
+
+vows.describe('winston').addBatch({
+  "The winston module": {
+    topic: function () {
+      winston.default.transports.console.level = 'silly';
+      return null;
+    },
+    "should have the correct methods defined": function () {
+      assert.isObject(winston.transports);
+      assert.isFunction(winston.Transport);
+      assert.isTrue(!winston.transports.Transport);
+      assert.isFunction(winston.transports.Console);
+      assert.isFunction(winston.transports.File);
+      assert.isFunction(winston.transports.Webhook);
+      assert.isObject(winston.default.transports.console);
+      assert.isFalse(winston.emitErrs);
+      assert.isObject(winston.config);
+      ['Logger', 'add', 'remove', 'extend', 'clear']
+        .concat(Object.keys(winston.config.npm.levels))
+        .forEach(function (key) {
+          assert.isFunction(winston[key]);
+        });
+    },
+    "it should": {
+      topic: function () {
+        fs.readFile(path.join(__dirname, '..', 'package.json'), this.callback);
+      },
+      "have the correct version set": function (err, data) {
+        assert.isNull(err);
+        data = JSON.parse(data.toString());
+        assert.equal(winston.version, data.version);
+      }
+    },
+    "the log() method": helpers.testNpmLevels(winston, "should respond without an error", function (err) {
+      assert.isNull(err);
+    }),
+    "the extend() method called on an empty object": {
+      topic: function (logger) {
+        var empty = {};
+        winston.extend(empty);
+        return empty;
+      },
+      "should define the appropriate methods": function (extended) {
+        ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) {
+          assert.isFunction(extended[method]);
+        });
+      }
+    }
+  }
+}).addBatch({
+  "The winston module": {
+    "the setLevels() method": {
+      topic: function () {
+        winston.setLevels(winston.config.syslog.levels);
+        return null;
+      },
+      "should have the proper methods defined": function () {
+        assert.isObject(winston.transports);
+        assert.isFunction(winston.transports.Console);
+        assert.isFunction(winston.transports.Webhook);
+        assert.isObject(winston.default.transports.console);
+        assert.isFalse(winston.emitErrs);
+        assert.isObject(winston.config);
+
+        var newLevels = Object.keys(winston.config.syslog.levels);
+        ['Logger', 'add', 'remove', 'extend', 'clear']
+          .concat(newLevels)
+          .forEach(function (key) {
+            assert.isFunction(winston[key]);
+          });
+
+
+        Object.keys(winston.config.npm.levels)
+          .filter(function (key) {
+            return newLevels.indexOf(key) === -1;
+          })
+          .forEach(function (key) {
+            assert.isTrue(typeof winston[key] === 'undefined');
+          });
+      }
+    }
+  }
+}).export(module);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/LICENSE b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/LICENSE
new file mode 100755 (executable)
index 0000000..432d1ae
--- /dev/null
@@ -0,0 +1,21 @@
+Copyright 2010 James Halliday (mail@substack.net)
+
+This project is free software released under the MIT/X11 license:
+
+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/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/README.md b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/README.md
new file mode 100755 (executable)
index 0000000..d706448
--- /dev/null
@@ -0,0 +1,681 @@
+yargs
+========
+
+Yargs be a node.js library fer hearties tryin' ter parse optstrings.
+
+With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash.
+
+[![Build Status](https://travis-ci.org/chevex/yargs.png)](https://travis-ci.org/chevex/yargs)
+[![Dependency Status](https://gemnasium.com/chevex/yargs.png)](https://gemnasium.com/chevex/yargs)
+[![NPM version](https://badge.fury.io/js/yargs.png)](http://badge.fury.io/js/yargs)
+
+> ~~NOTE: Yargs is a fork of [optimist](https://github.com/substack/node-optimist) by [substack (James Halliday)](https://github.com/substack). It is obvious that substack is stretched pretty thin maintaining over 300 modules on npm at the time of this writing. So rather than complain in the project issue tracker I thought I'd just pick up the torch and maintain a proper fork. Currently the project is totally backward compatible with optimist but this may change in the future (if it does I will update this notice to inform you of this). For now though, enjoy optimist with about 5 months worth of fixes and updates rolled in, most of them pulled from optimist's own [stale pull requests](https://github.com/substack/node-optimist/pulls).~~
+
+> UPDATE: Yargs is now the official successor to optimist. Please feel free to submit issues and pull requests. While I personally don't have the time to pore over all the issues and fix all of them on a regular basis, I'm more than happy to look over pull requests, test them, and merge them in. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/chevex/yargs/issues) :)
+
+examples
+========
+
+With yargs, the options be just a hash!
+-------------------------------------------------------------------
+
+xup.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+
+if (argv.rif - 5 * argv.xup > 7.138) {
+    console.log('Plunder more riffiwobbles!');
+}
+else {
+    console.log('Drop the xupptumblers!');
+}
+````
+
+***
+
+    $ ./xup.js --rif=55 --xup=9.52
+    Plunder more riffiwobbles!
+    
+    $ ./xup.js --rif 12 --xup 8.1
+    Drop the xupptumblers!
+
+![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png)
+
+But don't walk the plank just yet! There be more! You can do short options:
+-------------------------------------------------
+short.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+console.log('(%d,%d)', argv.x, argv.y);
+````
+
+***
+
+    $ ./short.js -x 10 -y 21
+    (10,21)
+
+And booleans, both long, short, and even grouped:
+----------------------------------
+
+bool.js:
+
+````javascript
+#!/usr/bin/env node
+var util = require('util');
+var argv = require('yargs').argv;
+
+if (argv.s) {
+    util.print(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: ');
+}
+console.log(
+    (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '')
+);
+````
+
+***
+
+    $ ./bool.js -s
+    The parrot says: squawk
+    
+    $ ./bool.js -sp
+    The parrot says: squawk!
+
+    $ ./bool.js -sp --fr
+    Le perroquet dit: couac!
+
+And non-hyphenated options too! Just use `argv._`!
+-------------------------------------------------
+nonopt.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+console.log('(%d,%d)', argv.x, argv.y);
+console.log(argv._);
+````
+
+***
+
+    $ ./nonopt.js -x 6.82 -y 3.35 rum
+    (6.82,3.35)
+    [ 'rum' ]
+    
+    $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho
+    (0.54,1.12)
+    [ 'me hearties', 'yo', 'ho' ]
+
+Yargs even counts your booleans!
+----------------------------------------------------------------------
+
+count.js
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .count('verbose')
+    .alias('v', 'verbose')
+    .argv;
+
+VERBOSE_LEVEL = argv.verbose;
+
+function WARN()  { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); }
+function INFO()  { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); }
+function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); }
+
+WARN("Showing only important stuff");
+INFO("Showing semi-mportant stuff too");
+DEBUG("Extra chatty mode");
+````
+
+***
+    $ node count.js
+    Showing only important stuff
+
+    $ node count.js -v
+    Showing only important stuff
+    Showing semi-important stuff too
+
+    $ node count.js -vv
+    Showing only important stuff
+    Showing semi-important stuff too
+    Extra chatty mode
+
+    $ node count.js -v --verbose
+    Showing only important stuff
+    Showing semi-important stuff too
+    Extra chatty mode
+
+Tell users how to use yer options and make demands.
+-------------------------------------------------
+
+divide.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Usage: $0 -x [num] -y [num]')
+    .demand(['x','y'])
+    .argv;
+
+console.log(argv.x / argv.y);
+````
+
+***
+    $ ./divide.js -x 55 -y 11
+    5
+    
+    $ node ./divide.js -x 4.91 -z 2.51
+    Usage: node ./divide.js -x [num] -y [num]
+
+    Options:
+      -x  [required]
+      -y  [required]
+
+    Missing required arguments: y
+
+After yer demands have been met, demand more! Ask for non-hypenated arguments!
+-----------------------------------------
+
+demand_count.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .demand(2)
+    .argv;
+console.dir(argv)
+````
+
+***
+
+       $ ./demand_count.js a
+       Not enough arguments, expected 2, but only found 1
+       $ ./demand_count.js a b
+       { _: [ 'a', 'b' ], '$0': 'node ./demand_count.js' }
+       $ ./demand_count.js a b c
+       { _: [ 'a', 'b', 'c' ], '$0': 'node ./demand_count.js' }
+
+EVEN MORE SHIVER ME TIMBERS!
+------------------
+
+default_singles.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .default('x', 10)
+    .default('y', 10)
+    .argv
+;
+console.log(argv.x + argv.y);
+````
+
+***
+
+    $ ./default_singles.js -x 5
+    15
+
+default_hash.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .default({ x : 10, y : 10 })
+    .argv
+;
+console.log(argv.x + argv.y);
+````
+
+***
+
+    $ ./default_hash.js -y 7
+    17
+
+And if you really want to get all descriptive about it...
+---------------------------------------------------------
+
+boolean_single.js
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .boolean('v')
+    .argv
+;
+console.dir(argv.v);
+console.dir(argv._);
+````
+
+***
+
+    $ ./boolean_single.js -v "me hearties" yo ho
+    true
+    [ 'me hearties', 'yo', 'ho' ]
+    
+
+boolean_double.js
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .boolean(['x','y','z'])
+    .argv
+;
+console.dir([ argv.x, argv.y, argv.z ]);
+console.dir(argv._);
+````
+
+***
+
+    $ ./boolean_double.js -x -z one two three
+    [ true, false, true ]
+    [ 'one', 'two', 'three' ]
+
+Yargs is here to help you...
+---------------------------
+
+Ye can describe parameters fer help messages and set aliases. Yargs figures
+out how ter format a handy help string automatically.
+
+line_count.js
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Count the lines in a file.\nUsage: $0')
+    .example('$0 -f', 'count the lines in the given file')
+    .demand('f')
+    .alias('f', 'file')
+    .describe('f', 'Load a file')
+    .argv
+;
+
+var fs = require('fs');
+var s = fs.createReadStream(argv.file);
+
+var lines = 0;
+s.on('data', function (buf) {
+    lines += buf.toString().match(/\n/g).length;
+});
+
+s.on('end', function () {
+    console.log(lines);
+});
+````
+
+***
+
+    $ node line_count.js
+    Count the lines in a file.
+    Usage: node ./line_count.js
+
+    Examples:
+      node ./line_count.js -f   count the lines in the given file
+
+    Options:
+      -f, --file  Load a file  [required]
+
+    Missing required arguments: f
+
+    $ node line_count.js --file line_count.js 
+    20
+    
+    $ node line_count.js -f line_count.js 
+    20
+
+methods
+=======
+
+By itself,
+
+````javascript
+require('yargs').argv
+`````
+
+will use `process.argv` array to construct the `argv` object.
+
+You can pass in the `process.argv` yourself:
+
+````javascript
+require('yargs')([ '-x', '1', '-y', '2' ]).argv
+````
+
+or use .parse() to do the same thing:
+
+````javascript
+require('yargs').parse([ '-x', '1', '-y', '2' ])
+````
+
+The rest of these methods below come in just before the terminating `.argv`.
+
+.alias(key, alias)
+------------------
+
+Set key names as equivalent such that updates to a key will propagate to aliases
+and vice-versa.
+
+Optionally `.alias()` can take an object that maps keys to aliases.
+Each key of this object should be the canonical version of the option, and each
+value should be a string or an array of strings.
+
+.default(key, value)
+--------------------
+
+Set `argv[key]` to `value` if no option was specified on `process.argv`.
+
+Optionally `.default()` can take an object that maps keys to default values.
+
+.demand(key, [msg | boolean])
+-----------------------------
+.require(key, [msg | boolean])
+------------------------------
+.required(key, [msg | boolean])
+-------------------------------
+
+If `key` is a string, show the usage information and exit if `key` wasn't
+specified in `process.argv`.
+
+If `key` is a number, demand at least as many non-option arguments, which show
+up in `argv._`.
+
+If `key` is an Array, demand each element.
+
+If a `msg` string is given, it will be printed when the argument is missing,
+instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`.
+
+If a `boolean` value is given, it controls whether the option is demanded;
+this is useful when using `.options()` to specify command line parameters.
+
+.requiresArg(key)
+-----------------
+
+Specifies either a single option key (string), or an array of options that
+must be followed by option values. If any option value is missing, show the
+usage information and exit.
+
+The default behaviour is to set the value of any key not followed by an
+option value to `true`.
+
+.describe(key, desc)
+--------------------
+
+Describe a `key` for the generated usage information.
+
+Optionally `.describe()` can take an object that maps keys to descriptions.
+
+.options(key, opt)
+------------------
+
+Instead of chaining together `.alias().demand().default()`, you can specify
+keys in `opt` for each of the chainable methods.
+
+For example:
+
+````javascript
+var argv = require('yargs')
+    .options('f', {
+        alias : 'file',
+        default : '/etc/passwd',
+    })
+    .argv
+;
+````
+
+is the same as
+
+````javascript
+var argv = require('yargs')
+    .alias('f', 'file')
+    .default('f', '/etc/passwd')
+    .argv
+;
+````
+
+Optionally `.options()` can take an object that maps keys to `opt` parameters.
+
+.usage(message, opts)
+---------------------
+
+Set a usage message to show which commands to use. Inside `message`, the string
+`$0` will get interpolated to the current script name or node command for the
+present script similar to how `$0` works in bash or perl.
+
+`opts` is optional and acts like calling `.options(opts)`.
+
+.example(cmd, desc)
+-------------------
+
+Give some example invocations of your program. Inside `cmd`, the string
+`$0` will get interpolated to the current script name or node command for the
+present script similar to how `$0` works in bash or perl.
+Examples will be printed out as part of the help message.
+
+.check(fn)
+----------
+
+Check that certain conditions are met in the provided arguments.
+
+`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases.
+
+If `fn` throws or returns `false`, show the thrown error, usage information, and
+exit.
+
+.boolean(key)
+-------------
+
+Interpret `key` as a boolean. If a non-flag option follows `key` in
+`process.argv`, that string won't get set as the value of `key`.
+
+If `key` never shows up as a flag in `process.arguments`, `argv[key]` will be
+`false`.
+
+If `key` is an Array, interpret all the elements as booleans.
+
+.string(key)
+------------
+
+Tell the parser logic not to interpret `key` as a number or boolean.
+This can be useful if you need to preserve leading zeros in an input.
+
+If `key` is an Array, interpret all the elements as strings.
+
+.config(key)
+------------
+
+Tells the parser to interpret `key` as a path to a JSON config file. The file
+is loaded and parsed, and its properties are set as arguments.
+
+.wrap(columns)
+--------------
+
+Format usage output to wrap at `columns` many columns.
+
+.strict()
+---------
+
+Any command-line argument given that is not demanded, or does not have a
+corresponding description, will be reported as an error.
+
+.help([option, [description]])
+------------------------------
+
+Add an option (e.g., `--help`) that displays the usage string and exits the
+process. If present, the `description` parameter customises the description of
+the help option in the usage string.
+
+If invoked without parameters, `.help` returns the generated usage string.
+
+Example:
+
+```
+var yargs = require("yargs")
+       .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
+console.log(yargs.help());
+```
+
+Later on, ```argv``` can be retrived with ```yargs.argv```
+
+.version(version, option, [description])
+----------------------------------------
+
+Add an option (e.g., `--version`) that displays the version number (given by the
+`version` parameter) and exits the process. If present, the `description`
+parameter customises the description of the version option in the usage string.
+
+.showHelpOnFail(enable, [message])
+----------------------------------
+
+By default, yargs outputs a usage string if any error is detected. Use the
+`.showHelpOnFail` method to customize this behaviour. if `enable` is `false`,
+the usage string is not output. If the `message` parameter is present, this
+message is output after the error message.
+
+line_count.js
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Count the lines in a file.\nUsage: $0')
+    .demand('f')
+    .alias('f', 'file')
+    .describe('f', 'Load a file')
+    .showHelpOnFail(false, "Specify --help for available options")
+    .argv;
+
+// etc.
+````
+
+***
+
+    $ node line_count.js --file
+    Missing argument value: f
+
+    Specify --help for available options
+
+.showHelp(fn=console.error)
+---------------------------
+
+Print the usage data using `fn` for printing.
+
+Example:
+
+```
+var yargs = require("yargs")
+       .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
+yargs.showHelp();
+```
+
+Later on, ```argv``` can be retrived with ```yargs.argv```
+
+.parse(args)
+------------
+
+Parse `args` instead of `process.argv`. Returns the `argv` object.
+
+.argv
+-----
+
+Get the arguments as a plain old object.
+
+Arguments without a corresponding flag show up in the `argv._` array.
+
+The script name or node command is available at `argv.$0` similarly to how `$0`
+works in bash or perl.
+
+parsing tricks
+==============
+
+stop parsing
+------------
+
+Use `--` to stop parsing flags and stuff the remainder into `argv._`.
+
+    $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4
+    { _: [ '-c', '3', '-d', '4' ],
+      '$0': 'node ./examples/reflect.js',
+      a: 1,
+      b: 2 }
+
+negate fields
+-------------
+
+If you want to explicity set a field to false instead of just leaving it
+undefined or to override a default you can do `--no-key`.
+
+    $ node examples/reflect.js -a --no-b
+    { _: [],
+      '$0': 'node ./examples/reflect.js',
+      a: true,
+      b: false }
+
+numbers
+-------
+
+Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to
+one. This way you can just `net.createConnection(argv.port)` and you can add
+numbers out of `argv` with `+` without having that mean concatenation,
+which is super frustrating.
+
+duplicates
+----------
+
+If you specify a flag multiple times it will get turned into an array containing
+all the values in order.
+
+    $ node examples/reflect.js -x 5 -x 8 -x 0
+    { _: [],
+      '$0': 'node ./examples/reflect.js',
+        x: [ 5, 8, 0 ] }
+
+dot notation
+------------
+
+When you use dots (`.`s) in argument names, an implicit object path is assumed.
+This lets you organize arguments into nested objects.
+
+     $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5
+     { _: [],
+       '$0': 'node ./examples/reflect.js',
+         foo: { bar: { baz: 33 }, quux: 5 } }
+
+short numbers
+-------------
+
+Short numeric `head -n5` style argument work too:
+
+    $ node reflect.js -n123 -m456
+    { '3': true,
+      '6': true,
+      _: [],
+      '$0': 'node ./reflect.js',
+      n: 123,
+      m: 456 }
+
+installation
+============
+
+With [npm](http://github.com/isaacs/npm), just do:
+
+    npm install yargs
+or clone this project on github:
+
+    git clone http://github.com/chevex/yargs.git
+
+To run the tests with [expresso](http://github.com/visionmedia/expresso),
+just do:
+    
+    expresso
+
+inspired By
+===========
+
+This module is loosely inspired by Perl's
+[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm).
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/bool.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/bool.js
new file mode 100755 (executable)
index 0000000..26cbe6d
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env node
+var util = require('util');
+var argv = require('yargs').argv;
+
+if (argv.s) {
+    util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: ');
+}
+console.log(
+    (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '')
+);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/boolean_double.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/boolean_double.js
new file mode 100755 (executable)
index 0000000..f948c85
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .boolean(['x','y','z'])
+    .argv
+;
+console.dir([ argv.x, argv.y, argv.z ]);
+console.dir(argv._);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/boolean_single.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/boolean_single.js
new file mode 100755 (executable)
index 0000000..62ec4ee
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .boolean('v')
+    .argv
+;
+console.dir(argv.v);
+console.dir(argv._);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/count.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/count.js
new file mode 100755 (executable)
index 0000000..8bd4947
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .count('verbose')
+    .alias('v', 'verbose')
+    .argv;
+
+VERBOSE_LEVEL = argv.verbose;
+
+function WARN()  { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); }
+function INFO()  { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); }
+function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); }
+
+WARN("Showing only important stuff");
+INFO("Showing semi-important stuff too");
+DEBUG("Extra chatty mode");
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/default_hash.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/default_hash.js
new file mode 100755 (executable)
index 0000000..de9f820
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env node
+
+var argv = require('yargs')
+    .default({ x : 10, y : 10 })
+    .argv
+;
+
+console.log(argv.x + argv.y);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/default_singles.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/default_singles.js
new file mode 100755 (executable)
index 0000000..5df95f9
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .default('x', 10)
+    .default('y', 10)
+    .argv
+;
+console.log(argv.x + argv.y);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/demand_count.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/demand_count.js
new file mode 100755 (executable)
index 0000000..1b3d19b
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .demand(2)
+    .argv;
+console.dir(argv)
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/divide.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/divide.js
new file mode 100755 (executable)
index 0000000..f50fb26
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env node
+
+var argv = require('yargs')
+    .usage('Usage: $0 -x [num] -y [num]')
+    .demand(['x','y'])
+    .argv;
+
+console.log(argv.x / argv.y);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/help.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/help.js
new file mode 100755 (executable)
index 0000000..c499a1d
--- /dev/null
@@ -0,0 +1,27 @@
+var yargs = require('../index');
+
+var argv = yargs
+  .usage('This is my awesome program\n\nUsage: $0 [options]')
+  .help('help').alias('help', 'h')
+  .version('1.0.1', 'version').alias('version', 'V')
+  .options({
+    input: {
+      alias: 'i',
+      description: "<filename> Input file name",
+      requiresArg: true,
+      required: true
+    },
+    output: {
+      alias: 'o',
+      description: "<filename> output file name",
+      requiresArg: true,
+      required: true
+    }
+  })
+  .argv;
+
+console.log('Inspecting options');
+console.dir(argv);
+
+console.log("input:", argv.input);
+console.log("output:", argv.output);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/implies.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/implies.js
new file mode 100755 (executable)
index 0000000..80425e4
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env node
+
+var argv = require('yargs')
+    .usage('Usage: $0 -x [num] -y [num]')
+    .implies('x', 'y')
+    .argv;
+
+if (argv.x) {
+    console.log(argv.x / argv.y);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/implies_hash.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/implies_hash.js
new file mode 100755 (executable)
index 0000000..039f20d
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env node
+
+var argv = require('yargs')
+    .usage('Usage: $0 -x [num] -y [num] -w [msg] -h [msg]')
+    .implies({
+        x: 'y',
+        w: '--no-h',
+        1: 'h'
+    })
+    .argv;
+
+if (argv.x) {
+    console.log('x / y : ' + (argv.x / argv.y));
+}
+
+if (argv.y) {
+    console.log('y: ' + argv.y);
+}
+
+if (argv.w) {
+    console.log('w: ' +argv.w);
+}
+
+if (argv.h) {
+    console.log('h: ' +argv.h);
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count.js
new file mode 100755 (executable)
index 0000000..7b0d0d8
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Count the lines in a file.\nUsage: $0')
+    .demand('f')
+    .alias('f', 'file')
+    .describe('f', 'Load a file')
+    .argv
+;
+
+var fs = require('fs');
+var s = fs.createReadStream(argv.file);
+
+var lines = 0;
+s.on('data', function (buf) {
+    lines += buf.toString().match(/\n/g).length;
+});
+
+s.on('end', function () {
+    console.log(lines);
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count_options.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count_options.js
new file mode 100755 (executable)
index 0000000..53a345a
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Count the lines in a file.\nUsage: $0')
+    .options({
+        file : {
+            demand : true,
+            alias : 'f',
+            description : 'Load a file'
+        },
+        base : {
+            alias : 'b',
+            description : 'Numeric base to use for output',
+            default : 10,
+        },
+    })
+    .argv
+;
+
+var fs = require('fs');
+var s = fs.createReadStream(argv.file);
+
+var lines = 0;
+s.on('data', function (buf) {
+    lines += buf.toString().match(/\n/g).length;
+});
+
+s.on('end', function () {
+    console.log(lines.toString(argv.base));
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count_wrap.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/line_count_wrap.js
new file mode 100755 (executable)
index 0000000..412d448
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .usage('Count the lines in a file.\nUsage: $0')
+    .wrap(80)
+    .demand('f')
+    .alias('f', [ 'file', 'filename' ])
+    .describe('f',
+        "Load a file. It's pretty important."
+        + " Required even. So you'd better specify it."
+    )
+    .alias('b', 'base')
+    .describe('b', 'Numeric base to display the number of lines in')
+    .default('b', 10)
+    .describe('x', 'Super-secret optional parameter which is secret')
+    .default('x', '')
+    .argv
+;
+
+var fs = require('fs');
+var s = fs.createReadStream(argv.file);
+
+var lines = 0;
+s.on('data', function (buf) {
+    lines += buf.toString().match(/\n/g).length;
+});
+
+s.on('end', function () {
+    console.log(lines.toString(argv.base));
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/nonopt.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/nonopt.js
new file mode 100755 (executable)
index 0000000..36ae470
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+console.log('(%d,%d)', argv.x, argv.y);
+console.log(argv._);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/requires_arg.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/requires_arg.js
new file mode 100755 (executable)
index 0000000..02500e4
--- /dev/null
@@ -0,0 +1,19 @@
+var yargs = require('yargs');
+
+var argv = yargs.usage('This is my awesome program', {
+  'input': {
+    description: 'Input file name',
+    requiresArg: true,
+    short: 'i',
+  },
+  'output': {
+    description: 'Output file name',
+    requiresArg: true,
+    short: 'o'
+  }
+}).argv;
+
+yargs.showHelp();
+
+console.log('\n\nInspecting options');
+console.dir(argv);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/short.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/short.js
new file mode 100755 (executable)
index 0000000..e40a477
--- /dev/null
@@ -0,0 +1,3 @@
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+console.log('(%d,%d)', argv.x, argv.y);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/strict.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/strict.js
new file mode 100755 (executable)
index 0000000..637e1fd
--- /dev/null
@@ -0,0 +1,19 @@
+var yargs = require('yargs');
+
+var argv = yargs.usage('This is my awesome program', {
+  'about': {
+    description: 'Provide some details about the author of this program',
+    boolean: true,
+    short: 'a',
+  },
+  'info': {
+    description: 'Provide some information about this program',
+    boolean: true,
+    short: 'i'
+  }
+}).strict().argv;
+
+yargs.showHelp();
+
+console.log('\n\nInspecting options');
+console.dir(argv);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/string.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/string.js
new file mode 100755 (executable)
index 0000000..baf78e5
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env node
+var argv = require('yargs')
+    .string('x', 'y')
+    .argv
+;
+console.dir([ argv.x, argv.y ]);
+
+/* Turns off numeric coercion:
+    ./node string.js -x 000123 -y 9876
+    [ '000123', '9876' ]
+*/
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/usage-options.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/usage-options.js
new file mode 100755 (executable)
index 0000000..65a9c13
--- /dev/null
@@ -0,0 +1,19 @@
+var yargs = require('yargs');
+
+var argv = yargs.usage('This is my awesome program', {
+  'about': {
+    description: 'Provide some details about the author of this program',
+    required: true,
+    alias: 'a',
+  },
+  'info': {
+    description: 'Provide some information about the node.js agains!!!!!!',
+    boolean: true,
+    alias: 'i'
+  }
+}).argv;
+
+yargs.showHelp();
+
+console.log('\n\nInspecting options');
+console.dir(argv);
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/xup.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/example/xup.js
new file mode 100755 (executable)
index 0000000..4b174eb
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env node
+var argv = require('yargs').argv;
+
+if (argv.rif - 5 * argv.xup > 7.138) {
+    console.log('Buy more riffiwobbles');
+}
+else {
+    console.log('Sell the xupptumblers');
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/index.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/index.js
new file mode 100755 (executable)
index 0000000..1287d66
--- /dev/null
@@ -0,0 +1,638 @@
+var path = require('path');
+var minimist = require('./lib/minimist');
+var wordwrap = require('./lib/wordwrap');
+
+/*  Hack an instance of Argv with process.argv into Argv
+    so people can do
+        require('yargs')(['--beeble=1','-z','zizzle']).argv
+    to parse a list of args and
+        require('yargs').argv
+    to get a parsed version of process.argv.
+*/
+
+var inst = Argv(process.argv.slice(2));
+Object.keys(inst).forEach(function (key) {
+    Argv[key] = typeof inst[key] == 'function'
+        ? inst[key].bind(inst)
+        : inst[key];
+});
+
+var exports = module.exports = Argv;
+function Argv (processArgs, cwd) {
+    var self = {};
+    if (!cwd) cwd = process.cwd();
+    
+    self.$0 = process.argv
+        .slice(0,2)
+        .map(function (x) {
+            var b = rebase(cwd, x);
+            return x.match(/^\//) && b.length < x.length
+                ? b : x
+        })
+        .join(' ')
+    ;
+    
+    if (process.env._ != undefined && process.argv[1] == process.env._) {
+        self.$0 = process.env._.replace(
+            path.dirname(process.execPath) + '/', ''
+        );
+    }
+
+    var options;
+    self.resetOptions = function () {
+        options = {
+            boolean: [],
+            string: [],
+            alias: {},
+            default: [],
+            requiresArg: [],
+            count: [],
+            normalize: [],
+            config: []
+        };
+        return self;
+    };
+    self.resetOptions();
+    
+    self.boolean = function (bools) {
+        options.boolean.push.apply(options.boolean, [].concat(bools));
+        return self;
+    };
+
+    self.normalize = function (strings) {
+        options.normalize.push.apply(options.normalize, [].concat(strings));
+        return self;
+    };
+
+    self.config = function (configs) {
+        options.config.push.apply(options.config, [].concat(configs));
+        return self;
+    };
+
+    var examples = [];
+    self.example = function (cmd, description) {
+        examples.push([cmd, description]);
+        return self;
+    };
+    
+    self.string = function (strings) {
+        options.string.push.apply(options.string, [].concat(strings));
+        return self;
+    };
+    
+    self.default = function (key, value) {
+        if (typeof key === 'object') {
+            Object.keys(key).forEach(function (k) {
+                self.default(k, key[k]);
+            });
+        }
+        else {
+            options.default[key] = value;
+        }
+        return self;
+    };
+    
+    self.alias = function (x, y) {
+        if (typeof x === 'object') {
+            Object.keys(x).forEach(function (key) {
+                self.alias(key, x[key]);
+            });
+        }
+        else {
+            options.alias[x] = (options.alias[x] || []).concat(y);
+        }
+        return self;
+    };
+
+    self.count = function(counts) {
+        options.count.push.apply(options.count, [].concat(counts));
+        return self;
+    };
+    
+    var demanded = {};
+    self.demand = self.required = self.require = function (keys, msg) {
+        if (typeof keys == 'number') {
+            if (!demanded._) demanded._ = { count: 0, msg: null };
+            demanded._.count += keys;
+            demanded._.msg = msg;
+        }
+        else if (Array.isArray(keys)) {
+            keys.forEach(function (key) {
+                self.demand(key, msg);
+            });
+        }
+        else {
+            if (typeof msg === 'string') {
+                demanded[keys] = { msg: msg };
+            }
+            else if (msg === true || typeof msg === 'undefined') {
+                demanded[keys] = { msg: null };
+            }
+        }
+        
+        return self;
+    };
+
+    self.requiresArg = function (requiresArgs) {
+        options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs));
+        return self;
+    };
+
+    var implied = {};
+    self.implies = function (key, value) {
+        if (typeof key === 'object') {
+            Object.keys(key).forEach(function (k) {
+                self.implies(k, key[k]);
+            });
+        } else {
+            implied[key] = value;
+        }
+        return self;
+    };
+
+    var usage;
+    self.usage = function (msg, opts) {
+        if (!opts && typeof msg === 'object') {
+            opts = msg;
+            msg = null;
+        }
+        
+        usage = msg;
+        
+        if (opts) self.options(opts);
+        
+        return self;
+    };
+
+    var fails = [];
+    self.fail = function (f) {
+        fails.push(f);
+        return self;
+    };
+
+    function fail (msg) {
+        if (fails.length) {
+            fails.forEach(function (f) {
+                f(msg);
+            });
+        } else {
+            if (showHelpOnFail) {
+                self.showHelp();
+            }
+            if (msg) console.error(msg);
+            if (failMessage) {
+                if (msg) {
+                    console.error("");
+                }
+                console.error(failMessage);
+            }
+            process.exit(1);
+        }
+    }
+    
+    var checks = [];
+    self.check = function (f) {
+        checks.push(f);
+        return self;
+    };
+
+    self.defaults = self.default;
+
+    var descriptions = {};
+    self.describe = function (key, desc) {
+        if (typeof key === 'object') {
+            Object.keys(key).forEach(function (k) {
+                self.describe(k, key[k]);
+            });
+        }
+        else {
+            descriptions[key] = desc;
+        }
+        return self;
+    };
+    
+    self.parse = function (args) {
+        return parseArgs(args);
+    };
+    
+    self.option = self.options = function (key, opt) {
+        if (typeof key === 'object') {
+            Object.keys(key).forEach(function (k) {
+                self.options(k, key[k]);
+            });
+        }
+        else {
+            if (opt.alias) self.alias(key, opt.alias);
+
+            var demand = opt.demand || opt.required || opt.require;
+            if (demand) {
+                self.demand(key, demand);
+            }
+
+            if (typeof opt.default !== 'undefined') {
+                self.default(key, opt.default);
+            }
+            
+            if (opt.boolean || opt.type === 'boolean') {
+                self.boolean(key);
+                if (opt.alias) self.boolean(opt.alias);
+            }
+            if (opt.string || opt.type === 'string') {
+                self.string(key);
+                if (opt.alias) self.string(opt.alias);
+            }
+            if (opt.count || opt.type === 'count') {
+                self.count(key);
+            }
+
+            var desc = opt.describe || opt.description || opt.desc;
+            if (desc) {
+                self.describe(key, desc);
+            }
+
+            if (opt.requiresArg) {
+                self.requiresArg(key);
+            }
+        }
+
+        return self;
+    };
+
+    var wrap = null;
+    self.wrap = function (cols) {
+        wrap = cols;
+        return self;
+    };
+
+    var strict = false;
+    self.strict = function () {
+        strict = true;
+        return self;
+    };
+    
+    self.showHelp = function (fn) {
+        if (!fn) fn = console.error.bind(console);
+        fn(self.help());
+        return self;
+    };
+
+    var version = null;
+    var versionOpt = null;
+    self.version = function (ver, opt, msg) {
+        version = ver;
+        versionOpt = opt;
+        self.describe(opt, msg || 'Show version number');
+        return self;
+    };
+
+    var helpOpt = null;
+    self.addHelpOpt = function (opt, msg) {
+        helpOpt = opt;
+        self.describe(opt, msg || 'Show help');
+        return self;
+    };
+
+    var failMessage = null;
+    var showHelpOnFail = true;
+    self.showHelpOnFail = function (enabled, message) {
+        if (typeof enabled === 'string') {
+            enabled = true;
+            message = enabled;
+        }
+        else if (typeof enabled === 'undefined') {
+            enabled = true;
+        }
+        failMessage = message;
+        showHelpOnFail = enabled;
+        return self;
+    };
+
+
+    self.help = function () {
+        if (arguments.length > 0) {
+            return self.addHelpOpt.apply(self, arguments);
+        }
+
+        var keys = Object.keys(
+            Object.keys(descriptions)
+            .concat(Object.keys(demanded))
+            .concat(Object.keys(options.default))
+            .reduce(function (acc, key) {
+                if (key !== '_') acc[key] = true;
+                return acc;
+            }, {})
+        );
+        
+        var help = keys.length ? [ 'Options:' ] : [];
+
+        if (examples.length) {
+            help.unshift('');
+            examples.forEach(function (example) {
+                example[0] = example[0].replace(/\$0/g, self.$0);
+            });
+
+            var commandlen = longest(examples.map(function (a) {
+                return a[0];
+            }));
+
+            var exampleLines = examples.map(function(example) {
+                var command = example[0];
+                var description = example[1];
+                command += Array(commandlen + 5 - command.length).join(' ');
+                return '  ' + command + description;
+            });
+
+            exampleLines.push('');
+            help = exampleLines.concat(help);
+            help.unshift('Examples:');
+        }
+
+        if (usage) {
+            help.unshift(usage.replace(/\$0/g, self.$0), '');
+        }
+
+        var aliasKeys = (Object.keys(options.alias) || [])
+            .concat(Object.keys(self.parsed.newAliases) || []);
+
+        keys = keys.filter(function(key) {
+            return !self.parsed.newAliases[key] && aliasKeys.every(function(alias) {
+                return -1 == (options.alias[alias] || []).indexOf(key);
+            });
+        });
+        var switches = keys.reduce(function (acc, key) {
+            acc[key] = [ key ].concat(options.alias[key] || [])
+                .map(function (sw) {
+                    return (sw.length > 1 ? '--' : '-') + sw
+                })
+                .join(', ')
+            ;
+            return acc;
+        }, {});
+
+        var switchlen = longest(Object.keys(switches).map(function (s) {
+            return switches[s] || '';
+        }));
+        
+        var desclen = longest(Object.keys(descriptions).map(function (d) { 
+            return descriptions[d] || '';
+        }));
+        
+        keys.forEach(function (key) {
+            var kswitch = switches[key];
+            var desc = descriptions[key] || '';
+            
+            if (wrap) {
+                desc = wordwrap(switchlen + 4, wrap)(desc)
+                    .slice(switchlen + 4)
+                ;
+            }
+            
+            var spadding = new Array(
+                Math.max(switchlen - kswitch.length + 3, 0)
+            ).join(' ');
+            
+            var dpadding = new Array(
+                Math.max(desclen - desc.length + 1, 0)
+            ).join(' ');
+            
+            var type = null;
+            
+            if (options.boolean[key]) type = '[boolean]';
+            if (options.count[key]) type = '[count]';
+            if (options.string[key]) type = '[string]';
+            if (options.normalize[key]) type = '[string]';
+            
+            if (!wrap && dpadding.length > 0) {
+                desc += dpadding;
+            }
+            
+            var prelude = '  ' + kswitch + spadding;
+            var extra = [
+                type,
+                demanded[key]
+                    ? '[required]'
+                    : null
+                ,
+                options.default[key] !== undefined
+                    ? '[default: ' + (typeof options.default[key] === 'string' ?
+                    JSON.stringify : String)(options.default[key]) + ']'
+                    : null
+            ].filter(Boolean).join('  ');
+            
+            var body = [ desc, extra ].filter(Boolean).join('  ');
+            
+            if (wrap) {
+                var dlines = desc.split('\n');
+                var dlen = dlines.slice(-1)[0].length
+                    + (dlines.length === 1 ? prelude.length : 0)
+                
+                body = desc + (dlen + extra.length > wrap - 2
+                    ? '\n'
+                        + new Array(wrap - extra.length + 1).join(' ')
+                        + extra
+                    : new Array(wrap - extra.length - dlen + 1).join(' ')
+                        + extra
+                );
+            }
+            
+            help.push(prelude + body);
+        });
+        
+        if (keys.length) help.push('');
+        return help.join('\n');
+    };
+    
+    Object.defineProperty(self, 'argv', {
+        get : function () { return parseArgs(processArgs) },
+        enumerable : true
+    });
+    
+    function parseArgs (args) {
+        var parsed = minimist(args, options),
+            argv = parsed.argv,
+            aliases = parsed.aliases;
+
+        argv.$0 = self.$0;
+
+        self.parsed = parsed;
+
+        Object.keys(argv).forEach(function(key) {
+            if (key === helpOpt) {
+                self.showHelp(console.log);
+                process.exit(0);
+            }
+            else if (key === versionOpt) {
+                process.stdout.write(version);
+                process.exit(0);
+            }
+        });
+
+        if (demanded._ && argv._.length < demanded._.count) {
+            if (demanded._.msg) {
+                fail(demanded._.msg);
+            } else {
+                fail('Not enough non-option arguments: got '
+                    + argv._.length + ', need at least ' + demanded._.count
+                );
+            }
+        }
+
+        if (options.requiresArg.length > 0) {
+            var missingRequiredArgs = [];
+
+            options.requiresArg.forEach(function(key) {
+                var value = argv[key];
+
+                // minimist sets --foo value to true / --no-foo to false
+                if (value === true || value === false) {
+                    missingRequiredArgs.push(key);
+                }
+            });
+
+            if (missingRequiredArgs.length == 1) {
+                fail("Missing argument value: " + missingRequiredArgs[0]);
+            }
+            else if (missingRequiredArgs.length > 1) {
+                message = "Missing argument values: " + missingRequiredArgs.join(", ");
+                fail(message);
+            }
+        }
+        
+        var missing = null;
+        Object.keys(demanded).forEach(function (key) {
+            if (!argv.hasOwnProperty(key)) {
+                missing = missing || {};
+                missing[key] = demanded[key];
+            }
+        });
+        
+        if (missing) {
+            var customMsgs = [];
+            Object.keys(missing).forEach(function(key) {
+                var msg = missing[key].msg;
+                if (msg && customMsgs.indexOf(msg) < 0) {
+                    customMsgs.push(msg);
+                }
+            });
+            var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : '';
+
+            fail('Missing required arguments: ' + Object.keys(missing).join(', ') + customMsg);
+        }
+
+        if (strict) {
+            var unknown = [];
+
+            var aliases = {};
+
+            Object.keys(parsed.aliases).forEach(function (key) {
+                parsed.aliases[key].forEach(function (alias) {
+                    aliases[alias] = key;
+                });
+            });
+
+            Object.keys(argv).forEach(function (key) {
+                if (key !== "$0" && key !== "_" &&
+                    !descriptions.hasOwnProperty(key) &&
+                    !demanded.hasOwnProperty(key) &&
+                    !aliases.hasOwnProperty(key)) {
+                    unknown.push(key);
+                }
+            });
+
+            if (unknown.length == 1) {
+                fail("Unknown argument: " + unknown[0]);
+            }
+            else if (unknown.length > 1) {
+                fail("Unknown arguments: " + unknown.join(", "));
+            }
+        }
+
+        checks.forEach(function (f) {
+            try {
+                var result = f(argv, aliases);
+                if (result === false) {
+                    fail('Argument check failed: ' + f.toString());
+                } else if (typeof result === 'string') {
+                    fail(result);
+                }
+            }
+            catch (err) {
+                fail(err)
+            }
+        });
+
+        var implyFail = [];
+        Object.keys(implied).forEach(function (key) {
+            var num, origKey = key, value = implied[key];
+
+            // convert string '1' to number 1
+            var num = Number(key);
+            key = isNaN(num) ? key : num;
+
+            if (typeof key === 'number') {
+                // check length of argv._
+                key = argv._.length >= key;
+            } else if (key.match(/^--no-.+/)) {
+                // check if key doesn't exist
+                key = key.match(/^--no-(.+)/)[1];
+                key = !argv[key];
+            } else {
+                // check if key exists
+                key = argv[key];
+            }
+
+            num = Number(value);
+            value = isNaN(num) ? value : num;
+
+            if (typeof value === 'number') {
+                value = argv._.length >= value;
+            } else if (value.match(/^--no-.+/)) {
+                value = value.match(/^--no-(.+)/)[1];
+                value = !argv[value];
+            } else {
+                value = argv[value];
+            }
+
+            if (key && !value) {
+                implyFail.push(origKey);
+            }
+        });
+
+        if (implyFail.length) {
+            var msg = 'Implications failed:\n';
+
+            implyFail.forEach(function (key) {
+                msg += ('  ' + key + ' -> ' + implied[key] + '\n');
+            });
+
+            fail(msg);
+        }
+        
+        return argv;
+    }
+    
+    function longest (xs) {
+        return Math.max.apply(
+            null,
+            xs.map(function (x) { return x.length })
+        );
+    }
+    
+    return self;
+};
+
+// rebase an absolute path to a relative one with respect to a base directory
+// exported for tests
+exports.rebase = rebase;
+function rebase (base, dir) {
+    var ds = path.normalize(dir).split('/').slice(1);
+    var bs = path.normalize(base).split('/').slice(1);
+    
+    for (var i = 0; ds[i] && ds[i] == bs[i]; i++);
+    ds.splice(0, i); bs.splice(0, i);
+    
+    var p = path.normalize(
+        bs.map(function () { return '..' }).concat(ds).join('/')
+    ).replace(/\/$/,'').replace(/^$/, '.');
+    return p.match(/^[.\/]/) ? p : './' + p;
+};
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/lib/minimist.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/lib/minimist.js
new file mode 100755 (executable)
index 0000000..2174bd0
--- /dev/null
@@ -0,0 +1,288 @@
+var path = require('path');
+var fs = require('fs');
+
+module.exports = function (args, opts) {
+    if (!opts) opts = {};
+
+    var flags = { bools : {}, strings : {}, counts: {}, normalize: {}, configs: {} };
+
+    [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
+        flags.bools[key] = true;
+    });
+
+    [].concat(opts.string).filter(Boolean).forEach(function (key) {
+        flags.strings[key] = true;
+    });
+
+    [].concat(opts.count).filter(Boolean).forEach(function (key) {
+        flags.counts[key] = true;
+    });
+
+    [].concat(opts.normalize).filter(Boolean).forEach(function (key) {
+        flags.normalize[key] = true;
+    });
+
+    [].concat(opts.config).filter(Boolean).forEach(function (key) {
+        flags.configs[key] = true;
+    });
+
+    function toCamelCase(str) {
+        return str.split('-').map(function(word, i) {
+            return (i ? word[0].toUpperCase() + word.slice(1) : word);
+        }).join('');
+    }
+
+    var aliases = {},
+        newAliases = {};
+
+    Object.keys(opts.alias || {}).forEach(function (key) {
+        aliases[key] = [].concat(opts.alias[key]);
+        // For "--option-name", also set argv.optionName
+        aliases[key].concat(key).forEach(function (x) {
+            if (/-/.test(x)) {
+                var c = toCamelCase(x);
+                aliases[key].push(c);
+                newAliases[c] = true;
+            }
+        });
+        aliases[key].forEach(function (x) {
+            aliases[x] = [key].concat(aliases[key].filter(function (y) {
+                return x !== y;
+            }));
+        });
+    });
+
+    var defaults = opts['default'] || {};
+
+    Object.keys(defaults || {}).forEach(function (key) {
+        if (/-/.test(key) && !opts.alias[key]) {
+            var c = toCamelCase(key);
+            aliases[key] = aliases[key] || [];
+            // don't allow the same key to be added multiple times.
+            if (aliases[key].indexOf(c) === -1) {
+                aliases[key] = (aliases[key] || []).concat(c);
+                newAliases[c] = true;
+            }
+        }
+        (aliases[key] || []).forEach(function (alias) {
+            defaults[alias] = defaults[key];
+        });
+    });
+
+    var argv = { _ : [] };
+    Object.keys(flags.bools).forEach(function (key) {
+        setArg(key, defaults[key] === undefined ? false : defaults[key]);
+    });
+
+    var notFlags = [];
+    if (args.indexOf('--') !== -1) {
+        notFlags = args.slice(args.indexOf('--')+1);
+        args = args.slice(0, args.indexOf('--'));
+    }
+
+    function setArg (key, val) {
+        if (/-/.test(key) && !(aliases[key] && aliases[key].length)) {
+            var c = toCamelCase(key);
+            aliases[key] = [c];
+            newAliases[c] = true;
+        }
+
+        var value = !flags.strings[key] && isNumber(val) ? Number(val) : val;
+
+        if (flags.counts[key] || flags.counts[aliases[key]]) {
+            value = function(orig) { return orig !== undefined ? orig + 1 : 0; };
+        }
+
+        if (flags.configs[key]) {
+            try {
+                var config = JSON.parse(fs.readFileSync(val, 'utf8'));
+                Object.keys(config).forEach(function (key) {
+                    setArg(key, config[key]);
+                });
+            } catch (ex) {
+                console.error('Invalid JSON config file: ' + val);
+                throw ex;
+            }
+        }
+
+        setKey(argv, key.split('.'), value);
+
+        (aliases[key] || []).forEach(function (x) {
+            setKey(argv, x.split('.'), value);
+        });
+
+        var keys = [key].concat(aliases[key] || []);
+        for (var i = 0, l = keys.length; i < l; i++) {
+            if (flags.normalize[keys[i]]) {
+                keys.forEach(function(key) {
+                    argv.__defineSetter__(key, function(v) {
+                        val = path.normalize(v);
+                    });
+
+                    argv.__defineGetter__(key, function () {
+                        return typeof val === 'string' ?
+                            path.normalize(val) : val;
+                    });
+                });
+                break;
+            }
+        }
+    }
+
+    for (var i = 0; i < args.length; i++) {
+        var arg = args[i];
+
+        if (arg.match(/^--.+=/)) {
+            // Using [\s\S] instead of . because js doesn't support the
+            // 'dotall' regex modifier. See:
+            // http://stackoverflow.com/a/1068308/13216
+            var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
+            setArg(m[1], m[2]);
+        }
+        else if (arg.match(/^--no-.+/)) {
+            var key = arg.match(/^--no-(.+)/)[1];
+            setArg(key, false);
+        }
+        else if (arg.match(/^--.+/)) {
+            var key = arg.match(/^--(.+)/)[1];
+            var next = args[i + 1];
+            if (next !== undefined && !next.match(/^-/)
+                && !flags.bools[key]
+                && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
+                setArg(key, next);
+                i++;
+            }
+            else if (/^(true|false)$/.test(next)) {
+                setArg(key, next === 'true');
+                i++;
+            }
+            else {
+                setArg(key, true);
+            }
+        }
+        else if (arg.match(/^-[^-]+/)) {
+            var letters = arg.slice(1,-1).split('');
+
+            var broken = false;
+            for (var j = 0; j < letters.length; j++) {
+                var next = arg.slice(j+2);
+
+                if (letters[j+1] && letters[j+1] === '=') {
+                    setArg(letters[j], arg.slice(j+3));
+                    broken = true;
+                    break;
+                }
+
+                if (next === '-') {
+                    setArg(letters[j], next)
+                    continue;
+                }
+
+                if (/[A-Za-z]/.test(letters[j])
+                    && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
+                    setArg(letters[j], next);
+                    broken = true;
+                    break;
+                }
+
+                if (letters[j+1] && letters[j+1].match(/\W/)) {
+                    setArg(letters[j], arg.slice(j+2));
+                    broken = true;
+                    break;
+                }
+                else {
+                    setArg(letters[j], true);
+                }
+            }
+
+            var key = arg.slice(-1)[0];
+            if (!broken && key !== '-') {
+                if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
+                    && !flags.bools[key]
+                    && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
+                    setArg(key, args[i+1]);
+                    i++;
+                }
+                else if (args[i+1] && /true|false/.test(args[i+1])) {
+                    setArg(key, args[i+1] === 'true');
+                    i++;
+                }
+                else {
+                    setArg(key, true);
+                }
+            }
+        }
+        else {
+            argv._.push(
+                flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
+            );
+        }
+    }
+
+    Object.keys(defaults).forEach(function (key) {
+        if (!hasKey(argv, key.split('.'))) {
+            setKey(argv, key.split('.'), defaults[key]);
+
+            (aliases[key] || []).forEach(function (x) {
+                setKey(argv, x.split('.'), defaults[key]);
+            });
+        }
+    });
+
+    Object.keys(flags.counts).forEach(function (key) {
+        setArg(key, defaults[key]);
+    });
+
+    notFlags.forEach(function(key) {
+        argv._.push(key);
+    });
+
+    return {
+        argv: argv,
+        aliases: aliases,
+        newAliases: newAliases
+    };
+};
+
+function hasKey (obj, keys) {
+    var o = obj;
+    keys.slice(0,-1).forEach(function (key) {
+        o = (o[key] || {});
+    });
+
+    var key = keys[keys.length - 1];
+    return key in o;
+}
+
+function setKey (obj, keys, value) {
+    var o = obj;
+    keys.slice(0,-1).forEach(function (key) {
+        if (o[key] === undefined) o[key] = {};
+        o = o[key];
+    });
+
+
+    var key = keys[keys.length - 1];
+    if (typeof value === 'function') {
+        o[key] = value(o[key]);
+    }
+    else if (o[key] === undefined || typeof o[key] === 'boolean') {
+        o[key] = value;
+    }
+    else if (Array.isArray(o[key])) {
+        o[key].push(value);
+    }
+    else {
+        o[key] = [ o[key], value ];
+    }
+}
+
+function isNumber (x) {
+    if (typeof x === 'number') return true;
+    if (/^0x[0-9a-f]+$/i.test(x)) return true;
+    return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
+}
+
+function longest (xs) {
+    return Math.max.apply(null, xs.map(function (x) { return x.length }));
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/lib/wordwrap.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/lib/wordwrap.js
new file mode 100755 (executable)
index 0000000..b9a2a58
--- /dev/null
@@ -0,0 +1,50 @@
+// Simplified version of https://github.com/substack/node-wordwrap
+
+'use strict';
+
+module.exports = function (start, stop) {
+
+    if (!stop) {
+        stop = start;
+        start = 0;
+    }
+
+    var re = /(\S+\s+)/;
+
+    return function (text) {
+        var chunks = text.toString().split(re);
+
+        return chunks.reduce(function (lines, rawChunk) {
+            if (rawChunk === '') return lines;
+
+            var chunk = rawChunk.replace(/\t/g, '    ');
+
+            var i = lines.length - 1;
+            if (lines[i].length + chunk.length > stop) {
+                lines[i] = lines[i].replace(/\s+$/, '');
+
+                chunk.split(/\n/).forEach(function (c) {
+                    lines.push(
+                        new Array(start + 1).join(' ')
+                            + c.replace(/^\s+/, '')
+                    );
+                });
+            }
+            else if (chunk.match(/\n/)) {
+                var xs = chunk.split(/\n/);
+                lines[i] += xs.shift();
+                xs.forEach(function (c) {
+                    lines.push(
+                        new Array(start + 1).join(' ')
+                            + c.replace(/^\s+/, '')
+                    );
+                });
+            }
+            else {
+                lines[i] += chunk;
+            }
+
+            return lines;
+        }, [ new Array(start + 1).join(' ') ]).join('\n');
+    };
+};
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/package.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/package.json
new file mode 100755 (executable)
index 0000000..ddacd2e
--- /dev/null
@@ -0,0 +1,80 @@
+{
+  "name": "yargs",
+  "version": "1.3.3",
+  "description": "Light-weight option parsing with an argv hash. No optstrings attached.",
+  "main": "./index.js",
+  "dependencies": {},
+  "devDependencies": {
+    "hashish": "*",
+    "mocha": "*",
+    "chai": "*"
+  },
+  "scripts": {
+    "test": "mocha -R nyan"
+  },
+  "repository": {
+    "type": "git",
+    "url": "http://github.com/chevex/yargs.git"
+  },
+  "keywords": [
+    "argument",
+    "args",
+    "option",
+    "parser",
+    "parsing",
+    "cli",
+    "command"
+  ],
+  "author": {
+    "name": "Alex Ford",
+    "email": "Alex.Ford@CodeTunnel.com",
+    "url": "http://CodeTunnel.com"
+  },
+  "contributors": [
+    {
+      "name": "Chris Needham",
+      "email": "chris@chrisneedham.com",
+      "url": "http://chrisneedham.com"
+    },
+    {
+      "name": "James Nylen",
+      "email": "jnylen@gmail.com",
+      "url": "https://github.com/nylen"
+    },
+    {
+      "name": "Benjamin Horsleben",
+      "url": "https://github.com/fizker"
+    }
+  ],
+  "license": "MIT/X11",
+  "engine": {
+    "node": ">=0.4"
+  },
+  "gitHead": "e6807327c06dd6a311c63e124ff6a50e38b23804",
+  "bugs": {
+    "url": "https://github.com/chevex/yargs/issues"
+  },
+  "homepage": "https://github.com/chevex/yargs",
+  "_id": "yargs@1.3.3",
+  "_shasum": "054de8b61f22eefdb7207059eaef9d6b83fb931a",
+  "_from": "yargs@^1.3.3",
+  "_npmVersion": "2.1.7",
+  "_nodeVersion": "0.10.33",
+  "_npmUser": {
+    "name": "chevex",
+    "email": "alex.ford@codetunnel.com"
+  },
+  "maintainers": [
+    {
+      "name": "chevex",
+      "email": "alex.ford@codetunnel.com"
+    }
+  ],
+  "dist": {
+    "shasum": "054de8b61f22eefdb7207059eaef9d6b83fb931a",
+    "tarball": "http://registry.npmjs.org/yargs/-/yargs-1.3.3.tgz"
+  },
+  "directories": {},
+  "_resolved": "https://registry.npmjs.org/yargs/-/yargs-1.3.3.tgz",
+  "readme": "ERROR: No README data found!"
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/_.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/_.js
new file mode 100755 (executable)
index 0000000..5752ba9
--- /dev/null
@@ -0,0 +1,64 @@
+var spawn = require('child_process').spawn,
+    should = require('chai').should();
+
+describe('bin script', function () {
+
+    it('should run as a shell script with no arguments', function (done) {
+        testCmd('./bin.js', [], done);
+    });
+
+    it('should run as a shell script with arguments', function (done) {
+        testCmd('./bin.js', [ 'a', 'b', 'c' ], done);
+    });
+
+    it('should run as a node script with no arguments', function (done) {
+        testCmd('node bin.js', [], done);
+    });
+
+    it('should run as a node script with arguments', function (done) {
+        testCmd('node bin.js', [ 'x', 'y', 'z' ], done);
+    });
+
+    describe('path returned by "which"', function () {
+
+        beforeEach(function () {
+            this.which = spawn('which', ['node']);
+        });
+
+        it('should match the actual path to the script file', function (done) {
+            this.which.stdout.on('data', function (buf) {
+                testCmd(buf.toString().trim() + ' bin.js', [], done);
+            });
+            this.which.stderr.on('data', done);
+        });
+
+        it('should match the actual path to the script file, with arguments', function (done) {
+            this.which.stdout.on('data', function (buf) {
+                testCmd(buf.toString().trim() + ' bin.js', [ 'q', 'r' ], done);
+            });
+            this.which.stderr.on('data', done);
+        });
+
+    });
+
+});
+
+function testCmd(cmd, args, done) {
+
+    var oldDir = process.cwd();
+    process.chdir(__dirname + '/_');
+    
+    var cmds = cmd.split(' ');
+    
+    var bin = spawn(cmds[0], cmds.slice(1).concat(args.map(String)));
+    process.chdir(oldDir);
+    
+    bin.stderr.on('data', done);
+    
+    bin.stdout.on('data', function (buf) {
+        var _ = JSON.parse(buf.toString());
+        _.map(String).should.deep.equal(args.map(String));
+        done();
+    });
+
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/_/bin.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/_/bin.js
new file mode 100755 (executable)
index 0000000..4a18d85
--- /dev/null
@@ -0,0 +1,3 @@
+#!/usr/bin/env node
+var argv = require('../../index').argv
+console.log(JSON.stringify(argv._));
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/config.json b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/config.json
new file mode 100755 (executable)
index 0000000..64254fa
--- /dev/null
@@ -0,0 +1,5 @@
+{
+    "herp": "derp",
+    "z": 55,
+    "foo": "baz"
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/count.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/count.js
new file mode 100755 (executable)
index 0000000..829ecf7
--- /dev/null
@@ -0,0 +1,28 @@
+var should = require('chai').should()
+    yargs = require('../index');
+
+describe('count', function () {
+
+    it('should count the number of times a boolean is present', function () {
+        var parsed;
+
+        parsed = yargs(['-x']).count('verbose').argv;
+        parsed.verbose.should.equal(0);
+
+        parsed = yargs(['--verbose']).count('verbose').argv;
+        parsed.verbose.should.equal(1);
+
+        parsed = yargs(['--verbose', '--verbose']).count('verbose').argv;
+        parsed.verbose.should.equal(2);
+
+        parsed = yargs(['-vvv']).alias('v', 'verbose').count('verbose').argv;
+        parsed.verbose.should.equal(3);
+
+        parsed = yargs(['--verbose', '--verbose', '-v', '--verbose']).count('verbose').alias('v', 'verbose').argv;
+        parsed.verbose.should.equal(4);
+
+        parsed = yargs(['--verbose', '--verbose', '-v', '-vv']).count('verbose').alias('v', 'verbose').argv;
+        parsed.verbose.should.equal(5);
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/dash.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/dash.js
new file mode 100755 (executable)
index 0000000..9fde2e5
--- /dev/null
@@ -0,0 +1,35 @@
+var should = require('chai').should(),
+    yargs = require('../index');
+
+describe('-', function () {
+
+    it('should set - as value of n', function () {
+        var argv = yargs.parse(['-n', '-']);
+        argv.should.have.property('n', '-');
+        argv.should.have.property('_').with.length(0);
+    });
+
+    it('should set - as a non-hyphenated value', function () {
+        var argv = yargs.parse(['-']);
+        argv.should.have.property('_').and.deep.equal(['-']);
+    });
+
+    it('should set - as a value of f', function () {
+        var argv = yargs.parse(['-f-']);
+        argv.should.have.property('f', '-');
+        argv.should.have.property('_').with.length(0);
+    });
+
+    it('should set b to true and set - as a non-hyphenated value when b is set as a boolean', function () {
+        var argv = yargs(['-b', '-']).boolean('b').argv;
+        argv.should.have.property('b', true);
+        argv.should.have.property('_').and.deep.equal(['-']);
+    });
+
+    it('should set - as the value of s when s is set as a string', function () {
+        var argv = yargs([ '-s', '-' ]).string('s').argv;
+        argv.should.have.property('s', '-');
+        argv.should.have.property('_').with.length(0);
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/mocha.opts b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/mocha.opts
new file mode 100755 (executable)
index 0000000..259652d
--- /dev/null
@@ -0,0 +1 @@
+-R nyan
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse.js
new file mode 100755 (executable)
index 0000000..fc1b692
--- /dev/null
@@ -0,0 +1,389 @@
+var should = require('chai').should(),
+    yargs = require('../'),
+    path = require('path');
+
+describe('parse', function () {
+
+    it('should pass when specifying a "short boolean"', function () {
+        var parse = yargs.parse([ '-b' ]);
+        parse.should.have.property('b').to.be.ok.and.be.a('boolean');
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should pass when specifying a "long boolean"', function () {
+        var parse = yargs.parse(['--bool']);
+        parse.should.have.property('bool', true);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should place bare options in the _ array', function () {
+        var parse = yargs.parse(['foo', 'bar', 'baz']);
+        parse.should.have.property('_').and.deep.equal(['foo','bar','baz']);
+    });
+
+    it('should expand grouped short options to a hash with a key for each', function () {
+        var parse = yargs.parse(['-cats']);
+        parse.should.have.property('c', true);
+        parse.should.have.property('a', true);
+        parse.should.have.property('t', true);
+        parse.should.have.property('s', true);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of the final option in a group to the next supplied value', function () {
+        var parse = yargs.parse(['-cats', 'meow']);
+        parse.should.have.property('c', true);
+        parse.should.have.property('a', true);
+        parse.should.have.property('t', true);
+        parse.should.have.property('s', 'meow');
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of a single short option to the next supplied value', function () {
+        var parse = yargs.parse(['-h', 'localhost']);
+        parse.should.have.property('h', 'localhost');
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of multiple single short options to the next supplied values relative to each', function () {
+        var parse = yargs.parse(['-h', 'localhost', '-p', '555']);
+        parse.should.have.property('h', 'localhost');
+        parse.should.have.property('p', 555);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of a single long option to the next supplied value', function () {
+        var parse = yargs.parse(['--pow', 'xixxle']);
+        parse.should.have.property('pow', 'xixxle');
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of a single long option if an = was used', function () {
+        var parse = yargs.parse(['--pow=xixxle']);
+        parse.should.have.property('pow', 'xixxle');
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of multiple long options to the next supplied values relative to each', function () {
+        var parse = yargs.parse(['--host', 'localhost', '--port', '555']);
+        parse.should.have.property('host', 'localhost');
+        parse.should.have.property('port', 555);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set the value of multiple long options if = signs were used', function () {
+        var parse = yargs.parse(['--host=localhost', '--port=555']);
+        parse.should.have.property('host', 'localhost');
+        parse.should.have.property('port', 555);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should still set values appropriately if a mix of short, long, and grouped short options are specified', function () {
+        var parse = yargs.parse(['-h', 'localhost', '-fp', '555', 'script.js']);
+        parse.should.have.property('f', true);
+        parse.should.have.property('p', 555);
+        parse.should.have.property('h', 'localhost');
+        parse.should.have.property('_').and.deep.equal(['script.js']);
+    });
+
+    it('should still set values appropriately if a mix of short and long options are specified', function () {
+        var parse = yargs.parse(['-h', 'localhost', '--port', '555']);
+        parse.should.have.property('h', 'localhost');
+        parse.should.have.property('port', 555);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should explicitly set a boolean option to false if preceeded by "--no-"', function () {
+        var parse = yargs.parse(['--no-moo']);
+        parse.should.have.property('moo', false);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should group values into an array if the same option is specified multiple times', function () {
+        var parse = yargs.parse(['-v', 'a', '-v', 'b', '-v', 'c' ]);
+        parse.should.have.property('v').and.deep.equal(['a','b','c']);
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should still set values appropriately if we supply a comprehensive list of various types of options', function () {
+        var parse = yargs.parse([
+            '--name=meowmers', 'bare', '-cats', 'woo',
+            '-h', 'awesome', '--multi=quux',
+            '--key', 'value',
+            '-b', '--bool', '--no-meep', '--multi=baz',
+            '--', '--not-a-flag', 'eek'
+        ]);
+        parse.should.have.property('c', true);
+        parse.should.have.property('a', true);
+        parse.should.have.property('t', true);
+        parse.should.have.property('s', 'woo');
+        parse.should.have.property('h', 'awesome');
+        parse.should.have.property('b', true);
+        parse.should.have.property('bool', true);
+        parse.should.have.property('key', 'value');
+        parse.should.have.property('multi').and.deep.equal(['quux', 'baz']);
+        parse.should.have.property('meep', false);
+        parse.should.have.property('name', 'meowmers');
+        parse.should.have.property('_').and.deep.equal(['bare', '--not-a-flag', 'eek']);
+    });
+
+    it('should parse numbers appropriately', function () {
+        var argv = yargs.parse([
+            '-x', '1234',
+            '-y', '5.67',
+            '-z', '1e7',
+            '-w', '10f',
+            '--hex', '0xdeadbeef',
+            '789',
+        ]);
+        argv.should.have.property('x', 1234).and.be.a('number');
+        argv.should.have.property('y', 5.67).and.be.a('number');
+        argv.should.have.property('z', 1e7).and.be.a('number');
+        argv.should.have.property('w', '10f').and.be.a('string');
+        argv.should.have.property('hex', 0xdeadbeef).and.be.a('number');
+        argv.should.have.property('_').and.deep.equal([789]);
+        argv._[0].should.be.a('number');
+    });
+
+    it('should not set the next value as the value of a short option if that option is explicitly defined as a boolean', function () {
+        var parse = yargs([ '-t', 'moo' ]).boolean(['t']).argv;
+        parse.should.have.property('t', true).and.be.a('boolean');
+        parse.should.have.property('_').and.deep.equal(['moo']);
+    });
+
+    it('should set boolean options values if the next value is "true" or "false"', function () {
+        var parse = yargs(['--verbose', 'false', 'moo', '-t', 'true'])
+            .boolean(['t', 'verbose']).default('verbose', true).argv;
+        parse.should.have.property('verbose', false).and.be.a('boolean');
+        parse.should.have.property('t', true).and.be.a('boolean');
+        parse.should.have.property('_').and.deep.equal(['moo']);
+    });
+
+    it('should set boolean options to false by default', function () {
+        var parse = yargs(['moo'])
+            .boolean(['t', 'verbose'])
+            .default('verbose', false)
+            .default('t', false).argv;
+        parse.should.have.property('verbose', false).and.be.a('boolean');
+        parse.should.have.property('t', false).and.be.a('boolean');
+        parse.should.have.property('_').and.deep.equal(['moo']);
+    });
+
+    it('should allow defining options as boolean in groups', function () {
+        var parse = yargs([ '-x', '-z', 'one', 'two', 'three' ])
+            .boolean(['x','y','z']).argv;
+        parse.should.have.property('x', true).and.be.a('boolean');
+        parse.should.have.property('y', false).and.be.a('boolean');
+        parse.should.have.property('z', true).and.be.a('boolean');
+        parse.should.have.property('_').and.deep.equal(['one','two','three']);
+    });
+
+    it('should preserve newlines in option values' , function () {
+        var args = yargs.parse(['-s', "X\nX"]);
+        args.should.have.property('_').with.length(0);
+        args.should.have.property('s', 'X\nX');
+        // reproduce in bash:
+        // VALUE="new
+        // line"
+        // node program.js --s="$VALUE"
+        args = yargs.parse(["--s=X\nX"]);
+        args.should.have.property('_').with.length(0);
+        args.should.have.property('s', 'X\nX');
+    });
+
+    it('should not convert numbers to type number if explicitly defined as strings' , function () {
+        var s = yargs([ '-s', '0001234' ]).string('s').argv.s;
+        s.should.be.a('string').and.equal('0001234');
+        var x = yargs([ '-x', '56' ]).string('x').argv.x;
+        x.should.be.a('string').and.equal('56');
+    });
+
+    it('should leave all non-hyphenated values as strings if _ is defined as a string', function () {
+        var s = yargs([ '  ', '  ' ]).string('_').argv._;
+        s.should.have.length(2);
+        s[0].should.be.a('string').and.equal('  ');
+        s[1].should.be.a('string').and.equal('  ');
+    });
+
+    it('should normalize redundant paths', function () {
+        var a = yargs([ '-s', '/tmp/../' ]).alias('s', 'save').normalize('s').argv;
+        a.should.have.property('s', '/');
+        a.should.have.property('save', '/');
+    });
+
+    it('should normalize redundant paths when a value is later assigned', function () {
+        var a = yargs(['-s']).normalize('s').argv;
+        a.should.have.property('s', true);
+        a.s = '/path/to/new/dir/../../';
+        a.s.should.equal('/path/to/');
+    });
+
+    it('should assign data after forward slash to the option before the slash', function () {
+        var parse = yargs.parse(['-I/foo/bar/baz']);
+        parse.should.have.property('_').with.length(0);
+        parse.should.have.property('I', '/foo/bar/baz');
+        parse = yargs.parse(['-xyz/foo/bar/baz']);
+        parse.should.have.property('x', true);
+        parse.should.have.property('y', true);
+        parse.should.have.property('z', '/foo/bar/baz');
+        parse.should.have.property('_').with.length(0);
+    });
+
+    it('should set alias value to the same value as the full option', function () {
+        var argv = yargs([ '-f', '11', '--zoom', '55' ])
+            .alias('z', 'zoom')
+            .argv;
+        argv.should.have.property('zoom', 55);
+        argv.should.have.property('z', 55);
+        argv.should.have.property('f', 11);
+    });
+
+    /*
+     *it('should load options and values from a file when config is used', function () {
+     *    var argv = yargs([ '--settings', '../test/config.json', '--foo', 'bar' ])
+     *        .alias('z', 'zoom')
+     *        .config('settings')
+     *        .argv;
+     *    argv.should.have.property('herp', 'derp');
+     *    argv.should.have.property('zoom', 55);
+     *    argv.should.have.property('foo').and.deep.equal(['baz','bar']);
+     *});
+     */
+
+    it('should allow multiple aliases to be specified', function () {
+        var argv = yargs([ '-f', '11', '--zoom', '55' ])
+            .alias('z', [ 'zm', 'zoom' ])
+            .argv;
+        argv.should.have.property('zoom', 55);
+        argv.should.have.property('z', 55);
+        argv.should.have.property('zm', 55);
+        argv.should.have.property('f', 11);
+    });
+
+    it('should define option as boolean and set default to true', function () {
+        var argv = yargs.options({
+            sometrue: {
+                boolean: true,
+                default: true
+            }
+        }).argv;
+        argv.should.have.property('sometrue', true);
+    });
+
+    it('should define option as boolean and set default to false', function () {
+        var argv = yargs.options({
+            somefalse: {
+                boolean: true,
+                default: false
+            }
+        }).argv;
+        argv.should.have.property('somefalse', false);
+    });
+
+    it('should allow object graph traversal via dot notation', function () {
+        var argv = yargs([
+            '--foo.bar', '3', '--foo.baz', '4',
+            '--foo.quux.quibble', '5', '--foo.quux.o_O',
+            '--beep.boop'
+        ]).argv;
+        argv.should.have.property('foo').and.deep.equal({
+            bar: 3,
+            baz: 4,
+            quux: {
+                quibble: 5,
+                o_O: true
+            }
+        });
+        argv.should.have.property('beep').and.deep.equal({ boop: true });
+    });
+
+    it('should allow booleans and aliases to be defined with chainable api', function () {
+        var aliased = [ '-h', 'derp' ],
+            regular = [ '--herp',  'derp' ],
+            opts = {
+                herp: { alias: 'h', boolean: true }
+            },
+            aliasedArgv = yargs(aliased).boolean('herp').alias('h', 'herp').argv,
+            propertyArgv = yargs(regular).boolean('herp').alias('h', 'herp').argv;
+        aliasedArgv.should.have.property('herp', true);
+        aliasedArgv.should.have.property('h', true);
+        aliasedArgv.should.have.property('_').and.deep.equal(['derp']);
+        propertyArgv.should.have.property('herp', true);
+        propertyArgv.should.have.property('h', true);
+        propertyArgv.should.have.property('_').and.deep.equal(['derp']);
+    });
+
+    it('should allow booleans and aliases to be defined with options hash', function () {
+        var aliased = [ '-h', 'derp' ],
+            regular = [ '--herp', 'derp' ],
+            opts = {
+                herp: { alias: 'h', boolean: true }
+            },
+            aliasedArgv = yargs(aliased).options(opts).argv,
+            propertyArgv = yargs(regular).options(opts).argv;
+        aliasedArgv.should.have.property('herp', true);
+        aliasedArgv.should.have.property('h', true);
+        aliasedArgv.should.have.property('_').and.deep.equal(['derp']);
+        propertyArgv.should.have.property('herp', true);
+        propertyArgv.should.have.property('h', true);
+        propertyArgv.should.have.property('_').and.deep.equal(['derp']);
+    });
+
+    it('should set boolean and alias using explicit true', function () {
+        var aliased = [ '-h', 'true' ],
+            regular = [ '--herp',  'true' ],
+            opts = {
+                herp: { alias: 'h', boolean: true }
+            },
+            aliasedArgv = yargs(aliased).boolean('h').alias('h', 'herp').argv,
+            propertyArgv = yargs(regular).boolean('h').alias('h', 'herp').argv;
+        aliasedArgv.should.have.property('herp', true);
+        aliasedArgv.should.have.property('h', true);
+        aliasedArgv.should.have.property('_').with.length(0);
+    });
+
+    // regression, see https://github.com/substack/node-optimist/issues/71
+    it('should set boolean and --x=true', function() {
+        var parsed = yargs(['--boool', '--other=true']).boolean('boool').argv;
+        parsed.should.have.property('boool', true);
+        parsed.should.have.property('other', 'true');
+        parsed = yargs(['--boool', '--other=false']).boolean('boool').argv;
+        parsed.should.have.property('boool', true);
+        parsed.should.have.property('other', 'false');
+    });
+
+    // regression, see https://github.com/chevex/yargs/issues/63
+    it('should not add the same key to argv multiple times, when creating camel-case aliases', function() {
+      var yargs = require('../')(['--health-check=banana', '--second-key', 'apple', '-t=blarg'])
+          .options('h', {
+            alias: 'health-check',
+            description: 'health check',
+            default: 'apple'
+          })
+          .options('second-key', {
+            alias: 's',
+            description: 'second key',
+            default: 'banana'
+          })
+          .options('third-key', {
+            alias: 't',
+            description: 'third key',
+            default: 'third'
+          })
+
+      // before this fix, yargs failed parsing
+      // one but not all forms of an arg.
+      yargs.argv.secondKey.should.eql('apple');
+      yargs.argv.s.should.eql('apple');
+      yargs.argv['second-key'].should.eql('apple');
+
+      yargs.argv.healthCheck.should.eql('banana');
+      yargs.argv.h.should.eql('banana');
+      yargs.argv['health-check'].should.eql('banana');
+
+      yargs.argv.thirdKey.should.eql('blarg');
+      yargs.argv.t.should.eql('blarg');
+      yargs.argv['third-key'].should.eql('blarg');
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_camelCase.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_camelCase.js
new file mode 100755 (executable)
index 0000000..37072c3
--- /dev/null
@@ -0,0 +1,129 @@
+var should = require('chai').should(),
+    yargs = require('../');
+
+describe('parse', function () {
+
+    function runTests (yargs, strict) {
+
+        if (!strict) {
+            // Skip this test in strict mode because this option is not specified
+            it('should provide options with dashes as camelCase properties', function () {
+                var result = yargs()
+                    .parse([ '--some-option' ]);
+
+                result.should.have.property('some-option').that.is.a('boolean').and.is.true;
+                result.should.have.property('someOption' ).that.is.a('boolean').and.is.true;
+            });
+        }
+
+        it('should provide count options with dashes as camelCase properties', function () {
+            var result = yargs()
+                .option('some-option', {
+                    describe : 'some option',
+                    type     : 'count'
+                })
+                .parse([ '--some-option', '--some-option', '--some-option' ]);
+
+            result.should.have.property('some-option', 3);
+            result.should.have.property('someOption' , 3);
+        });
+
+        it('should provide options with dashes and aliases as camelCase properties', function () {
+            var result = yargs()
+                .option('some-option', {
+                    alias    : 'o',
+                    describe : 'some option'
+                })
+                .parse([ '--some-option' ]);
+
+            result.should.have.property('some-option').that.is.a('boolean').and.is.true;
+            result.should.have.property('someOption' ).that.is.a('boolean').and.is.true;
+        });
+
+        it('should provide defaults of options with dashes as camelCase properties', function() {
+            var result = yargs()
+                .option('some-option', {
+                    describe : 'some option',
+                    default  : 'asdf'
+                })
+                .parse([ ]);
+
+            result.should.have.property('some-option', 'asdf');
+            result.should.have.property('someOption' , 'asdf');
+        });
+
+        it('should provide aliases of options with dashes as camelCase properties', function() {
+            var result = yargs()
+                .option('some-option', {
+                    alias    : 'o',
+                    describe : 'some option',
+                    default  : 'asdf'
+                })
+                .parse([ ]);
+
+            result.should.have.property('o', 'asdf');
+            result.should.have.property('some-option', 'asdf');
+            result.should.have.property('someOption' , 'asdf');
+        });
+
+        it('should provide aliases of options with dashes as camelCase properties', function() {
+            var result = yargs()
+                .option('o', {
+                    alias    : 'some-option',
+                    describe : 'some option',
+                    default  : 'asdf'
+                })
+                .parse([ ]);
+
+            result.should.have.property('o', 'asdf');
+            result.should.have.property('some-option', 'asdf');
+            result.should.have.property('someOption' , 'asdf');
+        });
+
+        it('should provide aliases with dashes as camelCase properties', function() {
+            var result = yargs()
+                .option('o', {
+                    alias    : 'some-option',
+                    describe : 'some option'
+                })
+                .parse([ '--some-option', 'val' ]);
+
+            result.should.have.property('o'          ).that.is.a('string').and.equals('val');
+            result.should.have.property('some-option').that.is.a('string').and.equals('val');
+            result.should.have.property('someOption' ).that.is.a('string').and.equals('val');
+        });
+
+    }
+
+    describe('dashes and camelCase', function () {
+        runTests(function() {
+            return yargs();
+        });
+    });
+
+    describe('dashes and camelCase (strict)', function () {
+        runTests(function() {
+            // Special handling for failure messages, because normally a
+            // failure calls process.exit(1);
+            return yargs().strict().fail(function(msg) {
+                throw new Error(msg);
+            });
+        }, true);
+
+        // See https://github.com/chevex/yargs/issues/31
+
+        it('should not fail when options with defaults are missing', function () {
+            var result = yargs()
+                .fail(function(msg) {
+                    throw new Error(msg);
+                })
+                .option('some-option', {
+                    describe : 'some option',
+                    default  : 80
+                })
+                .strict()
+                .parse([ ]);
+        });
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_defaults.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_defaults.js
new file mode 100755 (executable)
index 0000000..bcd44c5
--- /dev/null
@@ -0,0 +1,82 @@
+var should = require('chai').should(),
+    yargs = require('../');
+
+describe('parse', function () {
+
+    describe('defaults', function () {
+        function checkNoArgs(argv, hasAlias) {
+            it('should set defaults if no args', function() {
+                var result = argv.parse([ ]);
+                result.should.have.property('flag', true);
+                if (hasAlias) {
+                    result.should.have.property('f', true);
+                }
+            });
+        }
+
+        function checkExtraArg(argv, hasAlias) {
+            it('should set defaults if one extra arg', function() {
+                var result = argv.parse([ 'extra' ]);
+                result.should.have.property('flag', true);
+                result.should.have.property('_').and.deep.equal(['extra']);
+                if (hasAlias) {
+                    result.should.have.property('f', true);
+                }
+            });
+        }
+
+        function checkStringArg(argv, hasAlias) {
+            it('should set defaults even if arg looks like a string', function() {
+                var result = argv.parse([ '--flag', 'extra' ]);
+                result.should.have.property('flag', true);
+                result.should.have.property('_').and.deep.equal(['extra']);
+                if (hasAlias) {
+                    result.should.have.property('f', true);
+                }
+            });
+        }
+
+        describe('for options with aliases', function () {
+            var args = yargs().options({
+                flag : {
+                    alias   : 'f',
+                    default : true
+                }
+            });
+
+            checkNoArgs(args, true);
+            checkExtraArg(args, true);
+            // This test case should fail, because we didn't specify that the
+            // option is a boolean
+            // checkStringArg(args, true);
+        });
+
+        describe('for typed options without aliases', function () {
+            var args = yargs().options({
+                flag : {
+                    type    : 'boolean',
+                    default : true
+                }
+            });
+
+            checkNoArgs(args);
+            checkExtraArg(args);
+            checkStringArg(args);
+        });
+
+        describe('for typed options with aliases', function () {
+            var args = yargs().options({
+                flag : {
+                    alias   : 'f',
+                    type    : 'boolean',
+                    default : true
+                }
+            });
+
+            checkNoArgs(args, true);
+            checkExtraArg(args, true);
+            checkStringArg(args, true);
+        });
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_modified.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/parse_modified.js
new file mode 100755 (executable)
index 0000000..0ad9aac
--- /dev/null
@@ -0,0 +1,21 @@
+var should = require('chai').should(),
+    yargs = require('../');
+
+describe('parse', function () {
+
+    describe('boolean modifier function', function () {
+
+        it('should prevent yargs from sucking in the next option as the value of the first option', function () {
+
+            // Arrange & Act
+            var result = yargs().boolean('b').parse([ '-b', '123' ]);
+
+            // Assert
+            result.should.have.property('b').that.is.a('boolean').and.is.true;
+            result.should.have.property('_').and.deep.equal([123]);
+
+        });
+
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/short.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/short.js
new file mode 100755 (executable)
index 0000000..0dacba5
--- /dev/null
@@ -0,0 +1,20 @@
+var should = require('chai').should(),
+    yargs = require('../');
+
+describe('short options', function () {
+
+    it ('should set n to the numeric value 123', function () {
+        var argv = yargs.parse([ '-n123' ]);
+        should.exist(argv);
+        argv.should.have.property('n', 123);
+    });
+
+    it ('should set option "1" to true, option "2" to true, and option "3" to numeric value 456', function () {
+        var argv = yargs.parse([ '-123', '456' ]);
+        should.exist(argv);
+        argv.should.have.property('1', true);
+        argv.should.have.property('2', true);
+        argv.should.have.property('3', 456);
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/usage.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/usage.js
new file mode 100755 (executable)
index 0000000..a72b78e
--- /dev/null
@@ -0,0 +1,773 @@
+var should = require('chai').should(),
+    Hash = require('hashish'),
+    yargs = require('../');
+
+describe('usage', function () {
+
+    describe('demand options', function () {
+        describe('using .demand()', function () {
+            it ('should show an error along with the missing arguments on demand fail', function () {
+                var r = checkUsage(function () {
+                    return yargs('-x 10 -z 20'.split(' '))
+                        .usage('Usage: $0 -x NUM -y NUM')
+                        .demand(['x','y'])
+                        .argv;
+                });
+                r.result.should.have.property('x', 10);
+                r.result.should.have.property('z', 20);
+                r.result.should.have.property('_').with.length(0);
+                r.errors.join('\n').split(/\n+/).should.deep.equal([
+                    'Usage: ./usage -x NUM -y NUM',
+                    'Options:',
+                    '  -x  [required]',
+                    '  -y  [required]',
+                    'Missing required arguments: y'
+                ]);
+                r.logs.should.have.length(0);
+                r.exit.should.be.ok;
+            });
+
+            describe('using .require()', function() {
+                it ('should show an error along with the missing arguments on demand fail', function () {
+                    var r = checkUsage(function () {
+                        return yargs('-x 10 -z 20'.split(' '))
+                            .usage('Usage: $0 -x NUM -y NUM')
+                            .require(['x','y'])
+                            .argv;
+                    });
+                    r.result.should.have.property('x', 10);
+                    r.result.should.have.property('z', 20);
+                    r.result.should.have.property('_').with.length(0);
+                    r.errors.join('\n').split(/\n+/).should.deep.equal([
+                        'Usage: ./usage -x NUM -y NUM',
+                        'Options:',
+                        '  -x  [required]',
+                        '  -y  [required]',
+                        'Missing required arguments: y'
+                    ]);
+                    r.logs.should.have.length(0);
+                    r.exit.should.be.ok;
+                });
+            });
+        });
+
+        it('should show an error along with a custom message on demand fail', function () {
+            var r = checkUsage(function () {
+                return yargs('-z 20'.split(' '))
+                    .usage('Usage: $0 -x NUM -y NUM')
+                    .demand(['x','y'], 'x and y are both required to multiply all the things')
+                    .argv;
+            });
+            r.result.should.have.property('z', 20);
+            r.result.should.have.property('_').with.length(0);
+            r.errors.join('\n').split(/\n+/).should.deep.equal([
+                'Usage: ./usage -x NUM -y NUM',
+                'Options:',
+                '  -x  [required]',
+                '  -y  [required]',
+                'Missing required arguments: x, y',
+                'x and y are both required to multiply all the things'
+            ]);
+            r.logs.should.have.length(0);
+            r.exit.should.be.ok;
+        });
+
+        it('should return valid values when demand passes', function () {
+            var r = checkUsage(function () {
+                return yargs('-x 10 -y 20'.split(' '))
+                    .usage('Usage: $0 -x NUM -y NUM')
+                    .demand(['x','y'])
+                    .argv;
+            });
+            r.should.have.property('result');
+            r.result.should.have.property('x', 10);
+            r.result.should.have.property('y', 20)
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('errors').with.length(0);
+            r.should.have.property('logs').with.length(0);
+            r.should.have.property('exit', false);
+        });
+    });
+
+    it('should return valid values when check passes', function () {
+        var r = checkUsage(function () {
+            return yargs('-x 10 -y 20'.split(' '))
+                .usage('Usage: $0 -x NUM -y NUM')
+                .check(function (argv) {
+                    if (!('x' in argv)) throw 'You forgot about -x';
+                    if (!('y' in argv)) throw 'You forgot about -y';
+                })
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('x', 10);
+        r.result.should.have.property('y', 20);
+        r.result.should.have.property('_').with.length(0);
+        r.should.have.property('errors').with.length(0);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit', false);
+    });
+
+    it('should display missing arguments when check fails with a thrown exception', function () {
+        var r = checkUsage(function () {
+            return yargs('-x 10 -z 20'.split(' '))
+                .usage('Usage: $0 -x NUM -y NUM')
+                .check(function (argv) {
+                    if (!('x' in argv)) throw 'You forgot about -x';
+                    if (!('y' in argv)) throw 'You forgot about -y';
+                })
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('x', 10);
+        r.result.should.have.property('z', 20);
+        r.result.should.have.property('_').with.length(0);
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Usage: ./usage -x NUM -y NUM',
+            'You forgot about -y'
+        ]);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+    });
+
+    it('should display missing arguments when check fails with a return value', function () {
+        var r = checkUsage(function () {
+            return yargs('-x 10 -z 20'.split(' '))
+                .usage('Usage: $0 -x NUM -y NUM')
+                .check(function (argv) {
+                    if (!('x' in argv)) return 'You forgot about -x';
+                    if (!('y' in argv)) return 'You forgot about -y';
+                })
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('x', 10);
+        r.result.should.have.property('z', 20);
+        r.result.should.have.property('_').with.length(0);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+        r.should.have.property('errors');
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Usage: ./usage -x NUM -y NUM',
+            'You forgot about -y'
+        ]);
+    });
+
+    exports.checkFailReturn = function () {
+        var r = checkUsage(function () {
+            return yargs('-x 10 -z 20'.split(' '))
+                .usage('Usage: $0 -x NUM -y NUM')
+                .check(function (argv) {
+                    if (!('x' in argv)) return 'You forgot about -x';
+                    if (!('y' in argv)) return 'You forgot about -y';
+                })
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('x', 10);
+        r.result.should.have.property('z', 20);
+        r.result.should.have.property('_').with.length(0);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+        r.should.have.property('errors');
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Usage: ./usage -x NUM -y NUM',
+            'You forgot about -y'
+        ]);
+    };
+
+    it('should return a valid result when check condition passes', function () {
+        function checker (argv) {
+            return 'x' in argv && 'y' in argv;
+        }
+        var r = checkUsage(function () {
+            return yargs('-x 10 -y 20'.split(' '))
+                .usage('Usage: $0 -x NUM -y NUM')
+                .check(checker)
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('x', 10);
+        r.result.should.have.property('y', 20);
+        r.result.should.have.property('_').with.length(0);
+        r.should.have.property('errors').with.length(0);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit', false);
+    });
+
+    it('should display a failed message when check condition fails', function () {
+        function checker (argv) {
+            return 'x' in argv && 'y' in argv;
+        }
+        var r = checkUsage(function () {
+            return yargs('-x 10 -z 20'.split(' '))
+                .usage('Usage: $0 -x NUM -y NUM')
+                .check(checker)
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('x', 10);
+        r.result.should.have.property('z', 20);
+        r.result.should.have.property('_').with.length(0);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+        r.should.have.property('errors');
+        r.errors.join('\n').split(/\n+/).join('\n').should.equal(
+            'Usage: ./usage -x NUM -y NUM\n'
+            + 'Argument check failed: ' + checker.toString()
+        );
+    });
+
+    it('should return a valid result when demanding a count of non-hyphenated values', function () {
+        var r = checkUsage(function () {
+            return yargs('1 2 3 --moo'.split(' '))
+                .usage('Usage: $0 [x] [y] [z] {OPTIONS}')
+                .demand(3)
+                .argv;
+        });
+        r.should.have.property('result');
+        r.should.have.property('errors').with.length(0);
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit', false);
+        r.result.should.have.property('_').and.deep.equal([1,2,3]);
+        r.result.should.have.property('moo', true);
+    });
+
+    it('should return a failure message when not enough non-hyphenated arguments are found after a demand count', function () {
+        var r = checkUsage(function () {
+            return yargs('1 2 --moo'.split(' '))
+                .usage('Usage: $0 [x] [y] [z] {OPTIONS}')
+                .demand(3)
+                .argv;
+        });
+        r.should.have.property('result');
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+        r.result.should.have.property('_').and.deep.equal([1,2]);
+        r.result.should.have.property('moo', true);
+        r.should.have.property('errors');
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Usage: ./usage [x] [y] [z] {OPTIONS}',
+            'Not enough non-option arguments: got 2, need at least 3'
+        ]);
+    });
+
+    it('should return a custom failure message when not enough non-hyphenated arguments are found after a demand count', function () {
+        var r = checkUsage(function () {
+            return yargs('src --moo'.split(' '))
+                .usage('Usage: $0 [x] [y] [z] {OPTIONS} <src> <dest> [extra_files...]')
+                .demand(2, 'src and dest files are both required')
+                .argv;
+        });
+        r.should.have.property('result');
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+        r.result.should.have.property('_').and.deep.equal(['src']);
+        r.result.should.have.property('moo', true);
+        r.should.have.property('errors');
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Usage: ./usage [x] [y] [z] {OPTIONS} <src> <dest> [extra_files...]',
+            'src and dest files are both required'
+        ]);
+    });
+
+    it('should return a valid result when setting defaults for singles', function () {
+        var r = checkUsage(function () {
+            return yargs('--foo 50 --baz 70 --powsy'.split(' '))
+                .default('foo', 5)
+                .default('bar', 6)
+                .default('baz', 7)
+                .argv
+            ;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('foo', 50);
+        r.result.should.have.property('bar', 6);
+        r.result.should.have.property('baz', 70);
+        r.result.should.have.property('powsy', true);
+        r.result.should.have.property('_').with.length(0);
+    });
+
+    it('should return a valid result when default is set for an alias', function () {
+        var r = checkUsage(function () {
+            return yargs('')
+                .alias('f', 'foo')
+                .default('f', 5)
+                .argv
+            ;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('f', 5);
+        r.result.should.have.property('foo', 5);
+        r.result.should.have.property('_').with.length(0);
+    });
+
+    it('should print a single line when failing and default is set for an alias', function() {
+        var r = checkUsage(function() {
+            return yargs('')
+                .alias('f', 'foo')
+                .default('f', 5)
+                .demand(1)
+                .argv
+            ;
+        });
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Options:',
+            '  -f, --foo  [default: 5]',
+            'Not enough non-option arguments: got 0, need at least 1',
+        ]);
+    });
+
+    it('should allow you to set default values for a hash of options', function () {
+        var r = checkUsage(function () {
+            return yargs('--foo 50 --baz 70'.split(' '))
+                .default({ foo : 10, bar : 20, quux : 30 })
+                .argv
+            ;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('_').with.length(0);
+        r.result.should.have.property('foo', 50);
+        r.result.should.have.property('baz', 70);
+        r.result.should.have.property('bar', 20);
+        r.result.should.have.property('quux', 30);
+    });
+
+    describe('required arguments', function () {
+        describe('with options object', function () {
+            it('should show a failure message if a required option is missing', function () {
+                var r = checkUsage(function () {
+                    var opts = {
+                        foo: { description: 'foo option', alias: 'f', requiresArg: true },
+                        bar: { description: 'bar option', alias: 'b', requiresArg: true }
+                    };
+
+                    return yargs('-f --bar 20'.split(' '))
+                        .usage('Usage: $0 [options]', opts)
+                        .argv;
+                });
+                r.should.have.property('result');
+                r.result.should.have.property('_').with.length(0);
+                r.should.have.property('errors');
+                r.should.have.property('logs').with.length(0);
+                r.should.have.property('exit').and.be.ok;
+                r.errors.join('\n').split(/\n+/).should.deep.equal([
+                    'Usage: ./usage [options]',
+                    'Options:',
+                    '  --foo, -f  foo option',
+                    '  --bar, -b  bar option',
+                    'Missing argument value: foo',
+                ]);
+            });
+
+            it('should show a failure message if more than one required option is missing', function () {
+                var r = checkUsage(function () {
+                    var opts = {
+                        foo: { description: 'foo option', alias: 'f', requiresArg: true },
+                        bar: { description: 'bar option', alias: 'b', requiresArg: true }
+                    };
+
+                    return yargs('-f --bar'.split(' '))
+                        .usage('Usage: $0 [options]', opts)
+                        .argv;
+                });
+                r.should.have.property('result');
+                r.result.should.have.property('_').with.length(0);
+                r.should.have.property('errors');
+                r.should.have.property('logs').with.length(0);
+                r.should.have.property('exit').and.be.ok;
+                r.errors.join('\n').split(/\n+/).should.deep.equal([
+                    'Usage: ./usage [options]',
+                    'Options:',
+                    '  --foo, -f  foo option',
+                    '  --bar, -b  bar option',
+                    'Missing argument values: foo, bar',
+                ]);
+            });
+        });
+
+        describe('with requiresArg method', function () {
+            it('should show a failure message if a required option is missing', function () {
+                var r = checkUsage(function () {
+                    var opts = {
+                        foo: { description: 'foo option', alias: 'f' },
+                        bar: { description: 'bar option', alias: 'b' }
+                    };
+
+                    return yargs('-f --bar 20'.split(' '))
+                        .usage('Usage: $0 [options]', opts)
+                        .requiresArg(['foo', 'bar'])
+                        .argv;
+                });
+                r.should.have.property('result');
+                r.result.should.have.property('_').with.length(0);
+                r.should.have.property('errors');
+                r.should.have.property('logs').with.length(0);
+                r.should.have.property('exit').and.be.ok;
+                r.errors.join('\n').split(/\n+/).should.deep.equal([
+                    'Usage: ./usage [options]',
+                    'Options:',
+                    '  --foo, -f  foo option',
+                    '  --bar, -b  bar option',
+                    'Missing argument value: foo',
+                ]);
+            });
+        });
+    });
+
+    context("with strict() option set", function () {
+        it('should fail given an option argument that is not demanded', function () {
+            var r = checkUsage(function () {
+                opts = {
+                    foo: { demand: 'foo option', alias: 'f' },
+                    bar: { demand: 'bar option', alias: 'b' }
+                };
+
+                return yargs('-f 10 --bar 20 --baz 30'.split(' '))
+                    .usage('Usage: $0 [options]', opts)
+                    .strict()
+                    .argv;
+            });
+
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.result.should.have.property('f', 10);
+            r.result.should.have.property('foo', 10);
+            r.result.should.have.property('b', 20);
+            r.result.should.have.property('bar', 20);
+            r.result.should.have.property('baz', 30);
+            r.should.have.property('errors');
+            r.errors.join('\n').split(/\n+/).should.deep.equal([
+                'Usage: ./usage [options]',
+                'Options:',
+                '  --foo, -f  [required]',
+                '  --bar, -b  [required]',
+                'Unknown argument: baz',
+            ]);
+            r.should.have.property('logs').with.length(0);
+            r.should.have.property('exit').and.be.ok;
+        });
+
+        it('should fail given an option argument without a corresponding description', function () {
+            var r = checkUsage(function () {
+                opts = {
+                    foo: { description: 'foo option', alias: 'f' },
+                    bar: { description: 'bar option', alias: 'b' }
+                };
+
+                return yargs('-f 10 --bar 20 --baz 30'.split(' '))
+                    .usage('Usage: $0 [options]', opts)
+                    .strict()
+                    .argv;
+            });
+
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.result.should.have.property('f', 10);
+            r.result.should.have.property('foo', 10);
+            r.result.should.have.property('b', 20);
+            r.result.should.have.property('bar', 20);
+            r.result.should.have.property('baz', 30);
+            r.should.have.property('errors');
+            r.errors.join('\n').split(/\n+/).should.deep.equal([
+                'Usage: ./usage [options]',
+                'Options:',
+                '  --foo, -f  foo option',
+                '  --bar, -b  bar option',
+                'Unknown argument: baz',
+            ]);
+            r.should.have.property('logs').with.length(0);
+            r.should.have.property('exit').and.be.ok;
+        });
+
+        it('should fail given multiple option arguments without corresponding descriptions', function () {
+            var r = checkUsage(function () {
+                opts = {
+                    foo: { description: 'foo option', alias: 'f' },
+                    bar: { description: 'bar option', alias: 'b' }
+                };
+
+                return yargs('-f 10 --bar 20 --baz 30 -q 40'.split(' '))
+                    .usage('Usage: $0 [options]', opts)
+                    .strict()
+                    .argv;
+            });
+
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.result.should.have.property('f', 10);
+            r.result.should.have.property('foo', 10);
+            r.result.should.have.property('b', 20);
+            r.result.should.have.property('bar', 20);
+            r.result.should.have.property('baz', 30);
+            r.result.should.have.property('q', 40);
+            r.should.have.property('errors');
+            r.errors.join('\n').split(/\n+/).should.deep.equal([
+                'Usage: ./usage [options]',
+                'Options:',
+                '  --foo, -f  foo option',
+                '  --bar, -b  bar option',
+                'Unknown arguments: baz, q',
+            ]);
+            r.should.have.property('logs').with.length(0);
+            r.should.have.property('exit').and.be.ok;
+        });
+
+        it('should pass given option arguments with corresponding descriptions', function () {
+            var r = checkUsage(function () {
+                opts = {
+                    foo: { description: 'foo option' },
+                    bar: { description: 'bar option' }
+                };
+
+                return yargs('--foo 10 --bar 20'.split(' '))
+                    .usage('Usage: $0 [options]', opts)
+                    .strict()
+                    .argv;
+            });
+
+            r.should.have.property('result');
+            r.result.should.have.property('foo', 10);
+            r.result.should.have.property('bar', 20)
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('errors').with.length(0);
+            r.should.have.property('logs').with.length(0);
+            r.should.have.property('exit', false);
+        });
+    });
+
+    it('should display example on fail', function () {
+        var r = checkUsage(function () {
+            return yargs('')
+                .example("$0 something", "description")
+                .example("$0 something else", "other description")
+                .demand(['y'])
+                .argv;
+        });
+        r.should.have.property('result');
+        r.result.should.have.property('_').with.length(0);
+        r.should.have.property('errors');
+        r.should.have.property('logs').with.length(0);
+        r.should.have.property('exit').and.be.ok;
+        r.errors.join('\n').split(/\n+/).should.deep.equal([
+            'Examples:',
+            '  ./usage something         description',
+            '  ./usage something else    other description',
+            'Options:',
+            '  -y  [required]',
+            'Missing required arguments: y'
+        ]);
+    });
+
+    describe('demand option with boolean flag', function () {
+        describe('with demand option', function () {
+            it('should report missing required arguments', function () {
+                var r = checkUsage(function () {
+                    return yargs('-y 10 -z 20'.split(' '))
+                        .usage('Usage: $0 -x NUM [-y NUM]')
+                        .options({
+                            'x': { description: 'an option',      demand: true  },
+                            'y': { description: 'another option', demand: false }
+                        })
+                        .argv;
+                });
+                r.result.should.have.property('y', 10);
+                r.result.should.have.property('z', 20);
+                r.result.should.have.property('_').with.length(0);
+                r.errors.join('\n').split(/\n/).should.deep.equal([
+                    'Usage: ./usage -x NUM [-y NUM]',
+                    '',
+                    'Options:',
+                    '  -x  an option       [required]',
+                    '  -y  another option',
+                    '',
+                    'Missing required arguments: x'
+                ]);
+                r.logs.should.have.length(0);
+                r.exit.should.be.ok;
+            });
+        });
+
+        describe('with required option', function () {
+            it('should report missing required arguments', function () {
+                var r = checkUsage(function () {
+                    return yargs('-y 10 -z 20'.split(' '))
+                        .usage('Usage: $0 -x NUM [-y NUM]')
+                        .options({
+                            'x': { description: 'an option',      required: true  },
+                            'y': { description: 'another option', required: false }
+                        })
+                        .argv;
+                });
+                r.result.should.have.property('y', 10);
+                r.result.should.have.property('z', 20);
+                r.result.should.have.property('_').with.length(0);
+                r.errors.join('\n').split(/\n/).should.deep.equal([
+                    'Usage: ./usage -x NUM [-y NUM]',
+                    '',
+                    'Options:',
+                    '  -x  an option       [required]',
+                    '  -y  another option',
+                    '',
+                    'Missing required arguments: x'
+                ]);
+                r.logs.should.have.length(0);
+                r.exit.should.be.ok;
+            });
+        });
+
+        it('should not report missing required arguments when given an alias', function () {
+            var r = checkUsage(function () {
+                return yargs('-w 10'.split(' '))
+                    .usage('Usage: $0 --width NUM [--height NUM]')
+                    .options({
+                        'width':  { description: 'Width',  alias: 'w', demand: true  },
+                        'height': { description: 'Height', alias: 'h', demand: false }
+                    })
+                    .argv;
+            });
+            r.result.should.have.property('w', 10);
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('errors').with.length(0);
+            r.logs.should.have.length(0);
+        });
+    });
+
+    describe('help option', function () {
+        it('should display usage', function () {
+            var r = checkUsage(function () {
+                return yargs(['--help'])
+                    .demand(['y'])
+                    .help('help')
+                    .argv;
+            });
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('errors');
+            r.should.have.property('logs').with.length(1);
+            r.should.have.property('exit').and.be.ok;
+            r.logs.join('\n').split(/\n+/).should.deep.equal([
+                'Options:',
+                '  --help  Show help',
+                '  -y                 [required]',
+                ''
+            ]);
+        });
+
+        it('should not show both dashed and camelCase aliases', function () {
+            var r = checkUsage(function () {
+                return yargs(['--help'])
+                    .usage('Usage: $0 options')
+                    .help('help')
+                    .describe('some-opt', 'Some option')
+                    .default('some-opt', 2)
+                    .argv;
+            });
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('exit').and.be.ok;
+            r.should.have.property('errors').with.length(0);
+            r.should.have.property('logs');
+            r.logs.join('\n').split(/\n+/).should.deep.equal([
+                'Usage: ./usage options',
+                'Options:',
+                '  --help      Show help  ',
+                '  --some-opt  Some option  [default: 2]',
+                ''
+            ]);
+        });
+    });
+
+    describe('version option', function () {
+        it('should display version', function () {
+            var r = checkUsage(function () {
+                return yargs(['--version'])
+                    .version('1.0.1', 'version', 'Show version number')
+                    .argv;
+            });
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('errors');
+            r.should.have.property('logs').with.length(1);
+            r.should.have.property('exit').and.be.ok;
+            r.logs.join('\n').split(/\n+/).should.deep.equal([
+                '1.0.1'
+            ]);
+        });
+    });
+
+    describe('showHelpOnFail', function () {
+        it('should display user supplied message', function () {
+            var opts = {
+                foo: { desc: 'foo option', alias: 'f' },
+                bar: { desc: 'bar option', alias: 'b' }
+            };
+
+            var r = checkUsage(function () {
+                return yargs(['--foo'])
+                    .usage('Usage: $0 [options]')
+                    .options(opts)
+                    .demand(['foo', 'bar'])
+                    .showHelpOnFail(false, "Specify --help for available options")
+                    .argv;
+            });
+            r.should.have.property('result');
+            r.result.should.have.property('_').with.length(0);
+            r.should.have.property('errors');
+            r.should.have.property('logs').with.length(0);
+            r.should.have.property('exit').and.be.ok;
+            r.errors.join('\n').split(/\n/).should.deep.equal([
+                'Missing required arguments: bar',
+                '',
+                'Specify --help for available options'
+            ]);
+        });
+    });
+
+    it('should succeed when rebase', function () {
+        yargs.rebase('/home/chevex', '/home/chevex/foo/bar/baz').should.equal('./foo/bar/baz');
+        yargs.rebase('/home/chevex/foo/bar/baz', '/home/chevex').should.equal('../../..');
+        yargs.rebase('/home/chevex/foo', '/home/chevex/pow/zoom.txt').should.equal('../pow/zoom.txt');
+    });
+
+    function checkUsage (f) {
+
+        var exit = false;
+
+        process._exit = process.exit;
+        process._env = process.env;
+        process._argv = process.argv;
+        process.stdout._write = process.stdout.write;
+
+        process.exit = function () { exit = true };
+        process.env = Hash.merge(process.env, { _ : 'node' });
+        process.argv = [ './usage' ];
+        process.stdout.write = function (msg) { logs.push(msg) };
+
+        var errors = [];
+        var logs = [];
+
+        console._error = console.error;
+        console.error = function (msg) { errors.push(msg) };
+        console._log = console.log;
+        console.log = function (msg) { logs.push(msg) };
+
+        var result = f();
+
+        process.exit = process._exit;
+        process.env = process._env;
+        process.argv = process._argv;
+        process.stdout.write = process.stdout._write;
+
+        console.error = console._error;
+        console.log = console._log;
+
+        return {
+            errors : errors,
+            logs : logs,
+            exit : exit,
+            result : result
+        };
+    };
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/whitespace.js b/MSF-Node/org.tizen.multiscreen/server/node_modules/yargs/test/whitespace.js
new file mode 100755 (executable)
index 0000000..a44496a
--- /dev/null
@@ -0,0 +1,12 @@
+var should = require('chai').should(),
+    yargs = require('../');
+
+describe('whitespace', function () {
+
+    it('should be whitespace', function () {
+        var argv = yargs.parse([ '-x', '\t' ]);
+        should.exist(argv);
+        argv.should.have.property('x', '\t');
+    });
+
+});
diff --git a/MSF-Node/org.tizen.multiscreen/server/package.json b/MSF-Node/org.tizen.multiscreen/server/package.json
new file mode 100755 (executable)
index 0000000..04bee3a
--- /dev/null
@@ -0,0 +1,62 @@
+{
+       "name": "msf-service",
+       "displayName": "Samsung MultiScreen Framework Service",
+       "version": "2.0.25",
+       "description": "Samsung MultiScreen Framework Service",
+       "homepage": "http://samsungdforum.com/Features/MultiScreen",
+       "license": "Apache-2.0",        
+       "main": "./index.js",
+       "keywords": [
+               "multiscreen",
+               "mdns",
+               "websockets"
+       ],
+       "author": "Samsung",
+       "private": false,
+       "scripts": {
+               "start": "node server.js",
+               "test": "node_modules/.bin/_mocha",
+               "build": "node_modules/.bin/gulp build",
+               "docs": "node_modules/.bin/bfdocs --theme=./resources/docs/theme/ ./resources/docs/manifest.json ./docs/"
+       },
+       "dependencies": {
+               "async": "~0.2.9",
+               "captchapng": "0.0.1",
+               "eventemitter2": "^0.4.13",
+               "express": "3.2.3",
+               "http-errors": "^1.2.5",
+               "lodash": "^2.4.1",
+               "mkdirp": "^0.5.0",
+               "ngrok": "^0.1.99",
+               "node-uuid": "~1.4.0",
+               "request": "~2.27.0",
+               "winston": "^0.8.1",
+               "yargs": "^1.3.3"
+       },
+       "engine": "node >= 0.10.15",
+       "jshintConfig": {
+               "curly": false,
+               "eqeqeq": true,
+               "immed": true,
+               "latedef": true,
+               "newcap": true,
+               "noarg": true,
+               "sub": true,
+               "undef": true,
+               "boss": true,
+               "eqnull": true,
+               "node": true,
+               "jquery": true,
+               "esnext": true,
+               "browser": true,
+               "devel": true,
+               "-W087": true,
+               "strict": false,
+               "evil": true,
+               "multistr": true,
+               "globals": {
+                       "constants": false,
+                       "tizen": false
+               }
+       }
+}
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin-tizen/index.js b/MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin-tizen/index.js
new file mode 100755 (executable)
index 0000000..bd96c05
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require('lodash');
+var util = require('util');
+var IpcClient = require('./lib/IpcClient');
+var MSFDevicePlugin = require('../device-plugin');
+var async = require('async');
+var createError = require('http-errors');
+var config = require("../../lib/config");
+
+/*
+ Constants
+ */
+
+var WEB_LAUNCHER_ID = 'org.tizen.browser';
+var IPC_PCS_PATH    = '/tmp/pcs';
+var IPC_MSF_PATH    = '/tmp/msf';
+
+
+var deviceAttributeMapping = {
+       DeviceName: 'name',
+       DUID: 'duid',
+    WifiMac: 'wifiMac',
+       Model: 'model',
+       NetworkType: 'networkType',
+       SSID: 'ssid',
+       IP: 'ip',
+       FirmwareVersion: 'firmwareVersion',
+       CountryCode: 'countryCode',
+       DeviceID: 'id',
+       ModelDescription: 'description',
+       ModelName: 'modelName',
+       UDN: 'udn',
+       Resolution: 'resolution',
+       DeveloperMode: 'developerMode',
+       DeveloperIP: 'developerIP',
+       SmartHubAgreement: 'smartHubAgreement'
+};
+var player = false;
+
+function Tizen(config){
+
+    /*
+    Call the super constructor
+    */
+    MSFDevicePlugin.apply(this, arguments);
+
+    this.currentWebAppUrl = null;
+    this.isContents = null;
+    this.attributes.type = 'Samsung SmartTV';
+
+    /*
+     IPC client interfaces
+     TODO : migrate device info
+     */
+    this.deviceClient = new IpcClient(IPC_PCS_PATH);
+    this.ipcClient = new IpcClient(IPC_MSF_PATH);
+
+    //this.tizenAddonManager = new TizenAddon.TizenAddonManager();
+    //this.tizenAddonManager.InitializeAddon();
+
+    /*
+     * Setup route handlers
+     */
+    
+    // This is called on network/name changes from Tizen firmware
+    this.service.app.post('/ms/1.0/device/info/update',function(req, res){
+        this.logger.debug('DeviceInfoUpdate::');
+        this.refreshAttributes();
+        res.send('Device info update request received');
+    }.bind(this));
+
+    /*
+     Set the initial attributes from IPC
+     */
+    this.getDeviceAttributes(function(err, attributes){
+        _.assign(this.attributes,attributes);
+               this.setDevelopementMode();     
+    }.bind(this));
+
+    /*
+     Delay the device registration by 10 seconds
+     */
+    setTimeout(this.register.bind(this), 5000);
+    
+}
+
+MSFDevicePlugin.extend(Tizen);
+
+Tizen.prototype.getDeviceAttributes = function(callback){
+    this.logger.debug('GetDeviceAttributes::start');
+    this.deviceClient.transceive('getinfo', function(err, result){
+        if (!err){
+            try{
+                result = JSON.parse(result);
+                var data = {};
+                _.each(result, function(val, key){
+                    if (_.has(deviceAttributeMapping, key)){
+                        data[deviceAttributeMapping[key]] = val;
+                    } else {
+                        data[key] = val;
+                    }
+                });
+                this.logger.debug('GetDeviceAttributes::complete');
+                callback(null,data);
+            }catch(err){
+                this.logger.error(err);
+                callback(err);
+            }
+        }
+    }.bind(this));
+};
+
+
+Tizen.prototype.refreshAttributes = function(){
+    this.logger.debug('RefreshAttributes::');
+    this.getDeviceAttributes(function(err, attributes){
+        if(err) {
+            return this.logger.error('unable to refresh attributes', err.message);
+        }
+        this.updateAttributes(attributes);
+    }.bind(this));
+
+};
+
+Tizen.prototype.registerTizenLog = function(){
+
+    this.service.logger.on('logging', function(transport, level, msg, meta)
+    {
+           if(transport.name === 'file')
+        {
+            TizenAddon.TizenLog("[" + level + "] " + msg + JSON.stringify(meta));
+           }
+    });
+};
+
+Tizen.prototype.setDevelopementMode = function(){
+
+       config.developement.os = "Tizen";
+       config.developement.developerMode = this.attributes.developerMode;
+       config.developement.developerIP = this.attributes.developerIP;
+       this.service.remoteVersion = config.service.remoteVersion;
+    this.attributes.OS = config.developement.os;
+};
+
+Tizen.prototype.getApplication = function(options, cb){
+
+    var params = {  appId : options.id , url:options.url};
+
+       this.ipcClient.callRPC( 'application.getApplication', params, function(err, result){
+
+        // intercept the callback to convert appId to id and running string to bool
+
+        if(!err && result){
+            result.id = result.appId;
+               if(result.id === "3201412000694")
+          {
+                               result.media_player = player;
+          }
+         result.running = (result.running === "true" || result.running === true);
+         delete result.appId;
+        }
+
+        cb(err,result);
+    });
+};
+
+
+
+Tizen.prototype.getPartyMode = function(options, cb){
+
+    var params = {  appId : options.id };
+    this.logger.verbose("getPartyMode");
+
+       this.ipcClient.callRPC( 'application.partyMode', params, function(err, result){
+
+        // intercept the callback to convert appId to id and running string to bool
+
+        if(!err && result){
+//            result.id = result.appId;
+//            result.running = (result.running === "true" || result.running === true);
+//            delete result.appId;
+            result.id = result.appId;
+            result.running = (result.running === "true" || result.running === true);
+                       result.partyMode = (result.partyMode === "true" || result.partyMode === true);
+            delete result.appId;
+        }
+
+        cb(err,result);
+    });
+};
+
+Tizen.prototype.getApplicationData = function(options, cb){
+
+    cb(null,{url:this.currentWebAppUrl, isContents:this.isContents});
+};
+
+Tizen.prototype.launchApplication = function(options, cb){
+
+    this.logger.info("launchApplication : ", options);
+
+    var params = { appId : options.id, clientIp : options.clientIp, deviceName : options.deviceName, data : options.data, url : options.url, isContents : options.isContents, testmode:options.testmode};
+
+    this.ipcClient.callRPC( 'application.launchApplication', params, function(err, result){
+
+        // intercept the callback to convert string to bool
+
+        if(!err && result != null){
+            result = (result === "true" || result === true);
+        }
+
+        cb(err,result);
+
+    }.bind(this));
+
+};
+
+Tizen.prototype.terminateApplication = function(options, cb){
+
+    var params = { appId : options.id, url : options.url, isContents : options.isContents};
+
+    this.ipcClient.callRPC( 'application.stopApplication', params, function(err, result){
+
+        // intercept the callback to convert string to bool
+
+        if(!err && result != null){
+            result = (result === "true" || result === true);
+        }
+
+        cb(err,result);
+    });
+
+};
+
+Tizen.prototype.installApplication = function(options, cb){
+
+    var params = { appId : options.id };
+
+    this.ipcClient.callRPC( 'application.installApplication', params, function(err, result){
+
+        // intercept the callback to convert string to bool
+
+        if(!err && result != null){
+            result = (result === "true" || result === true);
+        }
+
+        cb(err,result);
+    });
+};
+
+
+Tizen.prototype.getWebApplication = function(options, cb){
+    this.getApplication({id:WEB_LAUNCHER_ID, url:options.url}, cb);
+};
+
+Tizen.prototype.launchWebApplication = function(options, cb){
+
+    this.logger.info('launchWebApplicaiton', options);
+
+    var self = this;
+    var params = {id : WEB_LAUNCHER_ID, url:options.url, clientIp : options.clientIp,deviceName : options.deviceName, isContents:options.isContents, testmode : options.testmode};
+    
+    this.getWebApplication(params, function(err, appInfo){
+       if(err) return cb(err);
+   
+           if(appInfo.running && (options.url != self.currentWebAppUrl)) {
+                               self.terminateWebApplication({id:WEB_LAUNCHER_ID, url:self.currentWebAppUrl, isContents:player}, function(err, result){});
+                       }
+                       
+                       // We have to delay the launch request or IPC will still think it is running
+           setTimeout(function(){        
+               self.launchApplication(params, function(err, result){
+                   if(err) {
+                       self.currentWebAppUrl = null;
+                   } else {
+                       self.currentWebAppUrl = options.url;
+                                       self.isContents = options.isContents;
+                   }
+                   cb(err, result);
+               });
+           },1000);
+       
+                       if(options.isContents){
+                               player = true;
+                       } else{
+                               player = false;
+                       }
+       });
+};
+
+Tizen.prototype.terminateWebApplication = function(options, cb){
+    this.terminateApplication({id:WEB_LAUNCHER_ID, url:options.url, isContents:player}, cb);
+       player = false;
+};
+
+Tizen.prototype.requestRemoteControl = function (options, cb) {
+
+    var params = { TypeOfRemote: options.TypeOfRemote, Cmd: options.Cmd, DataOfCmd: options.DataOfCmd, Option: options.Option };
+
+    this.ipcClient.callRPC('application.remoteControl', params, function (err, result) {
+
+        // intercept the callback to convert appId to id and running string to bool
+
+        if (!err && result) {
+            result.id = result.appId;
+            delete result.appId;
+        }
+
+        cb(err, result);
+    });
+};
+
+Tizen.prototype.requestACLPairing = function(options, cb){
+
+    var params = { clientIp : options.clientIp, deviceName : options.deviceName};
+    this.logger.verbose("requestACLPairing");
+
+       this.ipcClient.callRPC( 'application.aclPairing', params, function(err, result){
+
+        if(!err && result != null){
+            result = (result === "true" || result === true);
+        }
+
+        cb(err,result);
+    });
+};
+
+module.exports = Tizen;
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin-tizen/lib/IpcClient.js b/MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin-tizen/lib/IpcClient.js
new file mode 100755 (executable)
index 0000000..177ba5c
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require("lodash");
+var logger = require('../../../lib/logging');
+var net = require('net');
+var createError = require('http-errors');
+var uuid   = require("node-uuid");
+
+var IpcClient = function(path){
+
+    this.ipcPath = path;
+
+    this.send = function(message, callback) {
+               if (typeof message === 'object'){
+                       message = JSON.stringify(message);
+               }
+
+        var client = null;
+
+        try{
+
+            var self = this;
+
+            client = net.connect({path: this.ipcPath},
+                function() {
+                    logger.info('ipc client connected::', self.ipcPath);
+                    client.end(message.length + ',' + message);
+                }
+            );
+
+            client.on('end', function() {
+                logger.info('ipc client disconnected::', self.ipcPath);
+                callback(null, true);
+            });
+
+            client.on('error', function(err){
+                logger.error('ipc client error::', self.ipcPath, err.message);
+                callback(createError(500));
+            });
+
+        }catch(e){
+
+            logger.error(e.message);
+            if(client && client.end){
+                client.end();
+            }
+        }
+    };
+
+    this.callRPC = function(method, params, callback){
+
+        var message = {
+            method : method,
+            params : params,
+            id     : uuid.v1()
+        };
+
+        this.transceive(message, function(err, response){
+
+            if(err) return callback(err);
+
+            try{
+                response = JSON.parse(response);
+
+                if(!response.error){
+
+                    logger.debug('IPC callRPC : result : ', response.result);
+                    return callback(null, response.result);
+
+                }else {
+
+                    logger.error('IPC callRPC : error : ', response.error);
+
+                    var code = parseInt(response.error.code, 10);
+
+                    // TODO : Finalize IPC error codes
+                    switch (code) {
+                        case -4009 :
+                            // TODO : request change to IPC so that launching/installing app already running/installed returns true
+                            //return callback(createError(409));
+                            return callback(null, true);
+                        case -4004 :
+                            return callback(createError(404));
+                               case -4001 :
+                            return callback(createError(401));
+                        default :
+                            return callback(createError(500));
+                    }
+                }
+
+            }catch(e){
+                logger.error('IPC callRPC : ', e.message);
+                callback(createError(500));
+            }
+
+        });
+    };
+
+    this.transceive = function(message, callback) {
+
+        logger.debug("IPC transceive called : ", message);
+
+        if (_.isObject(message)){
+            logger.debug("Stringifying message");
+            try{
+                message = JSON.stringify(message);
+            }catch(e){
+                return callback(400,"Unable to parse to JSON");
+            }
+        }
+
+
+        var client = null;
+        var callbackFired = false;
+
+        try{
+
+            var self = this;
+            var response = null;
+
+            client = net.connect({path: this.ipcPath}, function() {
+                logger.debug('IPC client connected :', self.ipcPath);
+                try {
+                    client.write(message.length + ',' + message);
+                } catch (err) {
+                    logger.error("IPC client client.write - FAILED", err);
+                    client.removeAllListeners();
+                    client.destroy();
+                }
+            });
+
+
+
+            var timeout = setTimeout(function(){
+                if(client)client.end();
+                return callback(createError(500, 'Timeout in IPC request'));
+            }, 65000);
+
+
+
+            client.on('error', function(err){
+                logger.error('ipc on error :', err.message);
+                if(client)client.end();
+                return callback(createError(500, 'unknown IPC error'));
+            });
+
+
+
+            client.on('end', function() {
+
+                logger.debug('ipc client on end');
+                if(timeout)clearTimeout(timeout);
+
+            });
+
+            client.on('close', function() {
+
+                logger.debug('ipc client on close');
+
+            });
+
+            client.on('data', function(data) {
+
+                logger.debug('ipc client on data');
+
+                if(data) {
+
+                    data = data.toString();
+
+                    logger.debug('ipc data = ', data);
+
+                    try {
+
+                        var cPos = data.indexOf(',');
+                        var len = parseInt(data.substr(0, cPos),10);
+                        var result = data.substring(cPos + 1, cPos + 1 + len);
+
+                        logger.silly('ipc on data : cPos : ', cPos);
+                        logger.silly('ipc on data : len : ', len);
+                        logger.silly('ipc on data : result : ', result);
+
+                        client.end();
+
+                        if(callbackFired){
+                            logger.warn('IPC data : callback was already fired!!!');
+                            return;
+                        }
+
+                        callbackFired = true;
+                        return callback(null, result);
+
+
+
+                    } catch (e) {
+
+                        client.end();
+
+                        logger.error(e.message);
+
+                        if(callbackFired){
+                            logger.warn('IPC data : callback was already fired!!!');
+                            return;
+                        }
+
+                        callbackFired = true;
+                        return callback(createError(500, 'unable to parse IPC response'));
+
+
+                    }
+                }else{
+                    client.end();
+
+                    if(callbackFired){
+                        logger.warn('IPC data : callback was already fired!!!');
+                        return;
+                    }
+
+                    callbackFired = true;
+                    return callback(createError(500, 'IPC response data was empty'));
+
+                }
+
+            });
+
+        }catch(e){
+
+            logger.error("IPC client - FAILED: ", e.message);
+
+            if(client && client.end){
+                client.end();
+                return callback(createError(500, 'unknown IPC error'));
+            }
+
+        }
+
+
+    };
+};
+
+module.exports = IpcClient;
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin.js b/MSF-Node/org.tizen.multiscreen/server/plugins/device-plugin.js
new file mode 100755 (executable)
index 0000000..04887db
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var util = require('util');
+var _ = require('lodash');
+var os = require("os");
+var MSFPlugin = require('./plugin');
+
+function DevicePlugin(config){
+
+    // Set all plugins to be event emitters
+    MSFPlugin.call(this);
+
+    this.attributes = {
+        type                : 'Multiscreen Device',
+        duid                           : '',
+        model                          : os.type()+' '+os.arch(),
+        modelName                      : os.type()+' '+os.arch(),
+        description                    : os.type()+' '+os.arch()+' on '+os.cpus()[0].model,
+        networkType                    : "wireless",
+        ssid                           : '',
+        ip                  : this.utils.getInternalIP(),
+        firmwareVersion     : os.release(),
+        name                : os.hostname(),
+        id                  : '',
+        udn                 : '',
+        resolution          : '1920x1080',
+        countryCode                    : 'US',
+        msfVersion                     : this.service.version,
+               smartHubAgreement   : 'false'
+    };
+    DevicePlugin.verifyImplementation(this);
+
+}
+
+/* Extend the base plugin */
+MSFPlugin.extend(DevicePlugin);
+
+/*
+ Static Members
+ */
+
+DevicePlugin.extend = function(targetClass){
+    util.inherits(targetClass, DevicePlugin);
+};
+
+
+DevicePlugin.verifyImplementation = function(canidate){
+
+    var members = {
+        methods : [
+            "getApplicationData",
+            "getApplication",
+            "getPartyMode",
+            "launchApplication",
+            "terminateApplication",
+            "installApplication",
+            "getWebApplication",
+            "launchWebApplication",
+            "terminateWebApplication",
+            "requestRemoteControl",
+            "requestACLPairing"
+        ]
+    };
+
+    for(var i=0; i<members.methods.length; i++){
+        var method = members.methods[i];
+        var eMsg = "";
+        if(!canidate[method]){
+
+            eMsg = this.name + " is missing required method "+method;
+            canidate.logger.error(eMsg);
+            throw eMsg;
+
+        }else if(canidate[method].length !== 2){
+
+            eMsg = this.name + " has invalid signature for method "+method;
+            canidate.logger.error(eMsg);
+            throw eMsg;
+
+        }
+    }
+
+};
+
+/*
+ Public Members
+ */
+
+DevicePlugin.prototype.register = function(){
+    this.device.registerDevice(this);
+};
+
+DevicePlugin.prototype.updateAttributes = function(attributes){
+    var keys = _.keys(attributes);
+    var currentAttributes = _.pick(this.attributes,keys);
+
+    if(!_.isEqual(currentAttributes, attributes)){
+        _.extend(this.attributes,attributes);
+        this.logger.info("Device attributes changed : ", attributes);
+        this.device.emit('change', attributes);
+
+    }
+};
+
+
+
+
+
+module.exports = DevicePlugin;
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-api-v2/channels/index.js b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-api-v2/channels/index.js
new file mode 100755 (executable)
index 0000000..8d548dc
--- /dev/null
@@ -0,0 +1,561 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require("lodash");
+var util = require('util');
+var EventEmitter = require('eventemitter2').EventEmitter2;
+var uuid = require('node-uuid');
+var url = require("url");
+
+/* TODO : Need to clean up these path dependencies... perhaps a global msfRootRequire method */
+var service = require('../../../lib/multiscreen-service');
+var WebSocketServer = require('../../../lib/ws/index').Server;
+
+var logger = service.logger.createNamedLogger('Channel v2');
+var device = service.device;
+var EventBus = service.events;\r
+var utils = service.utils;\r
+
+var timePingPong = 5000;
+
+
+function Channel(path, httpServer){
+
+    logger.info("Creating channel", path);
+
+    this.session = {
+        channelSession    : uuid.v1(),
+        path              : path,
+        createdTime       : Date.now(),
+        get duration () {
+            return Date.now() - this.createdTime;
+        }
+    };
+
+    this.path = path;
+    this.clientConnections = {};
+    this.clients = {};
+    this.host = null;
+    this.server = new WebSocketServer({server: httpServer, path: path});
+
+    this.server.on('error', this.onServerError.bind(this));
+    this.server.on('connection', this.onSocketConnection.bind(this));
+
+    EventBus.emit('channel:session:start', this.session);
+       
+}
+
+util.inherits(Channel, EventEmitter);
+
+
+Channel.prototype.handleProtocols = function(protocols, callback){
+    // In future versions more logic will need to be added here
+    // For now always default to msf-2
+    callback(true, 'msf-2');
+};
+
+
+Channel.prototype.isMaxConnections = function(){
+
+    return this.server.clients.length >= 50;
+
+};
+
+Channel.prototype.onServerError = function(err){
+
+    var message = err.message;
+    logger.error(message);
+
+};
+
+
+Channel.prototype.onSocketError = function(socket, err){
+
+    var message = err.message;
+    logger.error(message);
+
+};
+
+
+Channel.prototype.onSocketConnection = function(socket){
+
+    // Tick up the channels connection count
+    socket.session = {
+        channelSession  : this.session.channelSession,
+        txMessages      : 0,
+        rxMessages      : 0,
+        txMessageSize   : 0,
+               createdTime       : Date.now(),
+        userAgent       : socket.upgradeReq.headers['user-agent'],
+        get duration () {
+            return Date.now() - this.createdTime;
+        }
+    };
+
+    /*
+     *  Test if we are over the limit and disconnect the socket if so
+     */
+    if(this.isMaxConnections()){
+        socket.close(4000,"Maximum number of connections");
+        return;
+    }
+
+
+    /*
+     *  Create client object with an id and connect time
+     */
+
+    var id = uuid.v1();
+    var client = {id:id, connectTime:Date.now()};
+
+
+    // TODO : Improve me
+    // hate to store the id on the websocket but is the easiest way for now
+    socket.id = id;\r
+    socket.ip = utils.checkWhetherIpv6(socket.req[0].connection.remoteAddress);\r
+
+    
+    /*
+     *  Copy all query string attributes to the client attributes object
+     */
+    client.attributes = url.parse(socket.upgradeReq.url, true).query;
+       client.deviceName = typeof client.attributes.name === 'undefined' ? "Smart Device" : client.attributes.name;
+       socket.deviceName = client.deviceName;
+       
+    /*
+     *  Is this the tv connecting?
+     */
+    if(socket.upgradeReq.headers['host'].indexOf('127.0.0.1') === 0){
+        this.host = socket;
+        client.isHost = true;
+        logger.debug("TV has connected");
+    }
+
+    /*
+     *  This is a client
+     */
+    else{
+        client.isHost = false;
+        logger.debug("Client has connected");
+    }
+
+    /*
+     *  Add the connection and info to the maps
+     */
+    this.clientConnections[id] = socket;
+    this.clients[id] = client;
+
+    EventBus.emit('channel:client:session:start', socket.session);
+
+    /*
+     *  Add our listeners to the socket
+     */
+    socket.on('error', this.onSocketError.bind(this, socket));
+    socket.on('close', this.onSocketClose.bind(this, socket));
+    socket.on('message', this.onSocketMessage.bind(this, socket));
+
+
+    /*
+    *  register Ping Pong for socket connection.
+    */
+    this.registerPingPong(socket);
+       
+    /*
+     *  Notify the client he is connected providing the id and client list
+     *  TODO : Make this more efficient : currently converting clients Map to Array
+     */
+
+    var clientList = _.map(this.clients, function(client){
+        if(client){
+            return client;
+        }else{
+            console.warn("Found null client in list");
+            return void 0;
+        }
+
+    });
+
+    /*
+     *  Notify the client he is connected and give him his id and the current client list
+     */
+    var msgConnect = {
+        event : "ms.channel.connect",
+        data : {
+            id:client.id,
+            clients:clientList
+        }
+    };
+    this.send(msgConnect,socket);
+
+    /*
+     *  Notify everyone else the client connected
+     */
+    var msgClientConnect = {
+        event : "ms.channel.clientConnect",
+        data : client
+    };
+    this.broadcast(msgClientConnect,socket);
+
+
+    var msgReady = {
+        event : "ms.channel.ready",
+        data : {}
+    };
+    /*
+     *  If the host (tv) is already connected then send the read event to the client
+     */
+    if(this.host){
+        this.send(msgReady,socket);
+    }
+    /*
+     *  If the client is the host then broadcast to everyone that we are ready
+     */
+    if(client.isHost){
+        this.broadcast(msgReady,socket);
+    }
+
+
+};
+
+Channel.prototype.registerPingPong = function(socket){
+
+    socket.numberNotAck = 0;
+    socket.intervalPingPong = setInterval(function(){
+
+       if(socket.numberNotAck >= 2)
+        {
+           logger.warn("MSF can't get ACK during 10 sec from client ",socket.id);
+           socket.close();
+        }
+        else
+        {
+           socket.ping();
+           socket.numberNotAck++;
+        }
+
+    },timePingPong);
+
+    socket.on('pong',function(){socket.numberNotAck = 0; });
+
+};
+
+Channel.prototype.encodeMessageToBuffer = function(oMsg, payload){
+
+    var mStr = JSON.stringify(oMsg);
+    var mBuff = new Buffer(mStr, 'utf8');
+
+    var hBuff = new Buffer(2);
+    hBuff.writeUInt16BE(mBuff.length, 0);
+
+    return Buffer.concat([hBuff,mBuff,payload]);
+
+};
+
+
+Channel.prototype.decodeMessageFromBuffer = function(buf){
+
+    var mSize = buf.readUInt16BE(0);
+    var mStr = buf.toString('utf8',2,2+mSize);
+
+    var message = JSON.parse(mStr);
+    var payload = buf.slice(2+mSize);
+
+    return {message: message, payload: payload};
+
+};
+
+Channel.prototype.createMessageResponder = function(socket, msg){
+
+    if(!msg.id){
+        // Since this message has no id create a noop responder
+        return function(){};
+    }
+
+    return function(err, result){
+
+        var e = {};
+        var resMsg = {id : msg.id };
+
+        if(err){
+
+            if(err.status && err.status < 500){
+                e.status    = err.status || err.statusCode || 500;
+                e.message   = err.message || 'Error '+ e.message;
+                e.code      = e.code || e.status;
+                e.details   = err.details || void 0;
+            }else{
+                e.status    = 500;
+                e.message   = 'Internal Server Error';
+                e.code      = e.status;
+            }
+
+            resMsg.error = e;
+
+
+        }else{
+            resMsg.result = result;
+        }
+
+        socket.send(JSON.stringify(resMsg),function(err){
+            if(err) logger.warn('socket is closed, unable to send message : ',resMsg);
+        });
+    };
+
+};
+
+
+Channel.prototype.onSocketMessage = function(socket, msg, flags){
+
+    var msgByteLen = 0;
+
+    if (flags.binary) {
+        logger.silly('message from ('+socket.id+') : binary');
+        msgByteLen = msg.length;
+    }else{
+        logger.silly('message from ('+socket.id+') : ' , msg);
+        msgByteLen = Buffer.byteLength(msg);
+    }
+
+
+    // Add some data to the session
+    socket.session.txMessages++;
+    socket.session.txMessageSize += msgByteLen;
+
+    // Ensure the message is below max
+    if(msgByteLen > 10000000){
+        logger.warn('Socket Message : byte length exceeds max');
+        return this.sendErrorEvent(socket, 'Socket Message : byte length exceeds max');
+    }
+
+
+    // Let's try to parse the message
+    try{
+
+        var payload;
+
+        if(flags.binary){
+
+            // TODO : Handle blobs
+            var decoded = this.decodeMessageFromBuffer(msg);
+            payload = decoded.payload;
+            msg = decoded.message;
+
+        }else{
+
+            msg = JSON.parse(msg);
+                       msg.params.clientIp = socket.ip;
+                       msg.params.deviceName = socket.deviceName;
+
+        }
+
+        if(!msg.method){
+
+            logger.warn('missing method field from message', msg);
+            return this.sendErrorEvent(socket, 'missing method field from message');
+
+        }
+
+        switch(msg.method){
+
+            case 'ms.channel.emit':
+                this.emitMessage(socket, msg, payload);
+                break;
+            case 'ms.application.get':
+                device.getApplication(msg.params, this.createMessageResponder(socket, msg));
+                break;
+            case 'ms.application.stop':
+                device.terminateApplication(msg.params, this.createMessageResponder(socket, msg));
+                break;
+            case 'ms.application.install':
+                device.installApplication(msg.params, this.createMessageResponder(socket, msg));
+                break;
+            case 'ms.application.start':
+                device.launchApplication(msg.params, this.createMessageResponder(socket, msg));
+                break;
+            case 'ms.webapplication.get':
+                device.getWebApplication(msg.params, this.createMessageResponder(socket, msg));
+                break;
+            case 'ms.webapplication.stop':
+                device.terminateWebApplication(msg.params, this.createMessageResponder(socket, msg));
+                this.onSocketClose(socket);
+                break;
+            case 'ms.webapplication.start':
+                device.launchWebApplication(msg.params, this.createMessageResponder(socket, msg));
+                break;
+            default :
+                logger.warn('unrecognized method value : ', msg);
+                this.sendErrorEvent(socket, 'unrecognized method value : '+msg.method);
+        }
+
+
+    }catch(e){
+        // Fail silently
+        logger.error("unable to handle message : " +  e.message);
+        this.sendErrorEvent(socket, "unable to handle message : " + e.message);
+    }
+
+};
+
+Channel.prototype.emitMessage = function(socket, msg, payload){
+
+    var targetId = msg.params.to;
+    var event = msg.params.event;
+    var data = msg.params.data;
+
+    if(event.indexOf('ms.') === 0){
+        this.sendErrorEvent(socket, 'Usage of `ms.` in custom event is not allowed. Perhaps use a alternative namespace.');
+        return;
+    }
+
+    var notification = {
+        event   : event,
+        data    : data,
+        from    : socket.id
+    };
+
+    var options = {};
+
+    if(payload){
+        notification = this.encodeMessageToBuffer(notification, payload);
+        options.binary = true;
+    }
+
+    if(targetId === "all"){
+        this.broadcast(notification, null, options);
+    }else if(targetId === "broadcast"){
+        this.broadcast(notification, socket, options);
+    }else if(targetId === "host"){
+        this.send(notification, this.host, options);
+    }else if(typeof targetId === "string" && this.clientConnections[targetId]){
+        this.send(notification,this.clientConnections[targetId], options);      
+    }else if(_.isArray(targetId)){
+        targetId.forEach(function(id){
+            if(this.clientConnections[id]){
+                this.send(notification,this.clientConnections[id], options);
+            }
+        }, this);
+    }else{
+        logger.warn('unrecognized `to` value : ', msg);
+        this.sendErrorEvent(socket, 'unrecognized `to` value : '+targetId);
+    }
+
+};
+
+Channel.prototype.onSocketClose = function(socket){
+
+    if(this.clientConnections &&
+        this.clients && socket &&
+        this.clients[socket.id]){
+
+        var client = this.clients[socket.id];
+
+        EventBus.emit('channel:client:session:end', socket.session);
+
+        try{
+            var notification = {
+                event : 'ms.channel.clientDisconnect',
+                data : client
+            };
+            this.broadcast(notification,socket);
+
+            if(client.isHost){
+                delete this.host;
+                logger.debug('TV has disconnected');
+            }else{
+                logger.debug("Client has disconnected");
+            }
+            clearInterval(socket.intervalPingPong);
+            delete this.clientConnections[socket.id];
+            delete this.clients[socket.id];
+
+        }catch(e){
+            // Just a fail safe as there are times when multiple connections are closing at once
+            logger.warn("Issue sending clientDisconnect notification to client : ", e.message);
+        }
+    }
+
+};
+
+Channel.prototype.send = function(msg, socket, options){
+
+    options = options || {};
+    socket.session.rxMessages++;
+
+    try{
+        if(options.binary){
+            socket.send(msg, options);
+        }else{
+            socket.send(JSON.stringify(msg), options);
+        }
+
+    }catch(e){
+
+        logger.error(e.message);
+
+    }
+
+};
+
+
+Channel.prototype.broadcast = function(msg, excludedClient, options){
+
+    this.server.clients.forEach(function(client){
+        if(client !== excludedClient){
+            this.send(msg, client, options);
+        }
+    }, this);
+
+};
+
+Channel.prototype.sendErrorEvent = function(socket, message){
+
+    return socket.send(JSON.stringify({
+        event : 'ms.error',
+        data  : {
+            message : message || ""
+        }
+    }));
+
+};
+
+
+Channel.prototype.shutDown = function(){
+
+    logger.warn("Shutting down channel", this.path);
+
+    // Clear the test interval
+    clearTimeout(this.activeTimeout);
+
+    delete this.activeTimeout;
+    delete this.host;
+    delete this.clientConnections;
+    delete this.clients;
+
+    if(this.server){
+        this.server.close(4000);
+        delete this.server;
+    }
+
+    EventBus.emit('channel:session:end', this.session);
+    this.emit("shutDown");
+
+    this.removeAllListeners();
+
+};
+
+
+module.exports.Channel = Channel;
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-api-v2/index.js b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-api-v2/index.js
new file mode 100755 (executable)
index 0000000..d5386f4
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require('lodash');
+var util = require('util');
+var url = require('url');
+var Channel = require('./channels/index').Channel;
+var request = require('request');
+var createError = require('http-errors');
+var MSFPlugin = require('../plugin');
+var service = require('../../lib/multiscreen-service');
+var utils = service.utils;
+var serviceJson = require('../service.json');
+
+/*
+ Constants
+ */
+var URI_PATH = '/api/v2/';
+var REMOTE_CHANNEL = '/api/v2/channels/samsung.remote.control';
+
+/*
+ Utility function for create REST callback responders from route handlers
+ */
+function createCallbackResponder(req, res, next){
+
+    return function(err, result){
+
+        if(err){
+            return next(err);
+        }else{
+            // ensure standardized json
+            if(_.isBoolean(result)) result = {ok:result};
+            res.send(result);
+        }
+    };
+}
+
+function createCallbackPartyMode(req, res, next){
+
+    return function(err, result){
+        if(err){
+            return next(err);
+        }else{
+            // ensure standardized json
+            if(_.isBoolean(result.partyMode) && result.partyMode === true) result = {running : result.running, partymode_enable : true};
+            else{
+                result = {running : result.running, partymode_enable : false};
+            }
+            res.send(result);
+        }
+    };
+}
+
+
+function ApiV2(config){
+
+    /* Call the super constructor */
+    MSFPlugin.apply(this, arguments);
+
+    this.channels = {};
+
+    // REST API : Service
+    this.app.get(URI_PATH,this.getServiceInfo.bind(this));
+    
+    // REST API : Party Mode
+
+    this.app.get(URI_PATH + 'applications/org.volt.mycontents',this.getPartyMode.bind(this));
+    
+
+    // REST API : Application
+    this.app.get(URI_PATH + 'applications/:id',this.getApplication.bind(this));
+    this.app.post(URI_PATH + 'applications/:id',this.launchApplication.bind(this));
+    this.app.delete(URI_PATH + 'applications/:id',this.terminateApplication.bind(this));
+    this.app.put(URI_PATH + 'applications/:id',this.installApplication.bind(this));
+
+    // REST API : Web Application
+    this.app.get(URI_PATH + 'webapplication/',this.getWebApplication.bind(this));
+    this.app.post(URI_PATH + 'webapplication/',this.launchWebApplication.bind(this));
+    this.app.delete(URI_PATH + 'webapplication/',this.terminateWebApplication.bind(this));
+
+    // TODO : Remove this once we can pass parameters to all devices including Tizen
+    this.app.get(URI_PATH + 'webapplication/data',function(req, res, next){
+        this.device.getApplicationData(null, createCallbackResponder(req, res, next));
+    }.bind(this));
+
+    this.configureChannels();
+
+}
+
+
+MSFPlugin.extend(ApiV2);
+
+/*
+ Sets up the channel container and creates channels on the fly for upgrade requests
+ */
+ApiV2.prototype.configureChannels = function(){
+    var self = this;
+
+    this.server.on('upgrade',function(req, socket, upgradeHead){
+
+        var u = url.parse(req.url);
+
+        /*
+         * Check is it is a channel request
+         */
+
+        // Verify that the url path matches this api path plus `channels`
+        if(u && u.pathname.indexOf(URI_PATH+'channels') === 0){
+
+            var path = u.pathname;
+
+            if(!self.channels[path] && path!=REMOTE_CHANNEL){
+
+                var channel = self.channels[path] = new Channel(path, self.server);
+
+                if(channel){
+
+                    channel.server._onHandleUpgrade(req, socket, upgradeHead);
+                    // If the server shutsDown remove it from the mapped channels
+                    channel.on("shutDown", function(){
+                        delete self.channels[path];
+                        self.channels[path] = void 0;
+                    });
+
+                }else{
+                    socket.end();
+                }
+            }
+        }
+
+    });
+
+};
+
+
+
+ApiV2.prototype.getServiceInfo = function(req, res, next){
+
+    this.logger.verbose("getServiceInfo");
+
+    var self = this;
+
+    var infoHandler = function(err, callback){
+        var serviceType = JSON.stringify(serviceJson);
+        var info = {
+            id      : self.device.attributes.id,
+            name    : self.device.attributes.name,
+            version : self.service.version,
+            device  : self.device.attributes,
+            type    : self.device.attributes.type,
+            uri     : "http://"+ req.get('host') + URI_PATH,
+            remote  : self.service.remoteVersion,
+            isSupport : serviceType
+        };
+        callback(null,info);
+    };
+
+    infoHandler({}, createCallbackResponder(req, res, next));
+};
+
+ApiV2.prototype.getApplication = function getApplication(req, res, next){
+    this.logger.verbose("getApplication : ", req.params.id);
+    this.device.getApplication( {id:req.params.id}, createCallbackResponder(req, res, next));
+};
+
+
+ApiV2.prototype.getPartyMode = function getPartyMode(req, res, next){
+    this.logger.verbose("getPartyMode");
+    this.device.getPartyMode( {id: "org.volt.mycontents"}, createCallbackPartyMode(req, res, next));
+};
+
+ApiV2.prototype.launchApplication = function launchApplication(req, res, next){
+    this.logger.verbose("launchApplication : ", req.params.id);
+    var data = req.body;
+    var clientIp = utils.checkWhetherIpv6(req.headers['x-forwarded-for'] || req.connection.remoteAddress);
+    this.device.launchApplication({id:req.params.id, clientIp:clientIp, data:data}, createCallbackResponder(req, res, next));
+};
+
+ApiV2.prototype.terminateApplication = function stopApplication(req, res, next){
+    this.logger.verbose("stopApplication : ", req.params.id);
+    this.device.terminateApplication({id:req.params.id}, createCallbackResponder(req, res, next));
+};
+
+ApiV2.prototype.installApplication = function installApplication(req, res, next){
+    this.logger.verbose("installApplication : ", req.params.id);
+    this.device.installApplication({id:req.params.id}, createCallbackResponder(req, res, next));
+};
+
+ApiV2.prototype.getWebApplication = function getWebApplication(req, res, next){
+    this.logger.verbose("getWebApplication");
+    this.device.getWebApplication({url:req.body.url}, createCallbackResponder(req, res, next));
+};
+
+ApiV2.prototype.launchWebApplication = function launchWebApplication(req, res, next){
+    this.logger.verbose("launchWebApplication", req.body);
+    var clientIp = utils.checkWhetherIpv6(req.headers['x-forwarded-for'] || req.connection.remoteAddress);
+    this.device.launchWebApplication({url:req.body.url, clientIp:clientIp}, createCallbackResponder(req, res, next));
+};
+
+ApiV2.prototype.terminateWebApplication = function stopWebApplication(req, res, next){
+    this.logger.verbose("stopWebApplication", req.body);
+    this.device.terminateWebApplication({url:req.body.url}, createCallbackResponder(req, res, next));
+};
+
+
+
+
+module.exports = ApiV2;
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/index.js b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/index.js
new file mode 100755 (executable)
index 0000000..3f96dd0
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require('lodash');
+var fs = require('fs');
+var os = require('os');
+var path = require('path');
+var MSFPlugin = require('../plugin');
+var url = require('url');
+
+var captcha = require('captchapng');
+
+// TODO : Remove this path dependency
+var WebSocketServer = require('../../lib/ws').Server;
+
+/*
+ Constants
+ */
+var URI_ROOT = '/';
+var URI_LOGS = '/logs';
+var URI_SETTINGS_UPDATE = '/settings';
+var URI_CAPTCHA = '/captcha.png';
+var URI_TEST_TOOL = '/msftest';
+
+
+/*
+ HTML Templates
+ */
+var indexTemplate = require.resolve('./templates/index.tpl');
+
+
+/*
+ The websocket log server is only created if someone views the logging page to reduce resources
+ */
+var wsLogServer;
+
+
+
+function DevTools(config){
+
+    /*
+     Call the BaseModule constructor
+     */
+    MSFPlugin.apply(this, arguments);
+
+    /*
+     Route Handlers
+     */
+    this.app.get(URI_ROOT, this.renderIndex.bind(this));
+    this.app.post(URI_SETTINGS_UPDATE, this.updateSettings.bind(this));
+    this.app.get(URI_LOGS, this.renderLogs.bind(this));
+    this.app.get(URI_CAPTCHA, this.renderCaptcha.bind(this));
+       this.app.get(URI_TEST_TOOL, this.renderTool.bind(this));
+
+
+}
+
+MSFPlugin.extend(DevTools);
+
+/*
+ Creates and sets up the websocket server to broadcast logging messages
+ */
+DevTools.prototype.createWebSocketServer = function(){
+
+    if(!wsLogServer){
+
+        var self = this;
+
+        this.logger.info('Starting websocket logging server');
+
+        wsLogServer = new WebSocketServer({server:this.server, path:'/logger'});
+
+        wsLogServer.broadcast = function(data) {
+            for(var i=0; i<this.clients.length; i++){
+                this.clients[i].send(data);
+            }
+        };
+
+        wsLogServer.on('connection', function(ws) {
+            self.logger.info('Client connected to log server....');
+        });
+
+        this.service.logger.addListener('logging', function(transport, level, msg, meta){
+
+            // Only log the console transport to keep from broadcasting multiple times for a single message
+            if(transport.name === 'file'){
+                var entry = { level : level, msg : msg, meta : meta};
+                // Wrap in a try catch in case the meta has a circular reference
+                try{
+                    entry = JSON.stringify(entry);
+                    wsLogServer.broadcast(entry);
+                }catch(e){
+                    console.error(e);
+                }
+
+            }
+
+        });
+
+    }
+
+};
+
+
+
+DevTools.prototype.renderNotDevMode = function(req,res,next){  
+       next();
+};
+
+
+DevTools.prototype.renderIndex = function(req, res, next){
+
+    if(this.utils.isSupportDevelopement(req.ip))
+    {
+           var tplIndex = _.template(fs.readFileSync(indexTemplate,'utf8'));
+
+           var content = tplIndex({
+               mem     : process.memoryUsage(),
+               service : this.service.config.service,
+               logging : {
+                   level : this.service.logger.level,
+                   levels : ["error","warn","info","verbose","debug", "silly"]
+               },
+               allowAllContent : this.device.allowAllContent,
+               device  : this.service.device.attributes
+           });
+
+
+           res.set('Content-Type', 'text/html');
+           res.end(content);
+       }
+   else
+       {
+               this.renderNotDevMode(req,res,next);
+       }
+   
+};
+
+
+DevTools.prototype.updateSettings = function(req, res, next){
+    this.logger.verbose('captcha sent : '+req.body.captchaAnswer + ', correct : '+this.captchaAnswer);
+    if(parseInt(req.body.captchaAnswer) === this.captchaAnswer){
+        var message = 'Settings updated!';
+        if(req.body.logLevel){
+            this.service.logger.setLogLevel(req.body.logLevel);
+            message += '\n - log level set to '+ req.body.logLevel;
+        }
+        if(req.body.allowAllContent !== null){
+            this.device.allowAllContent = req.body.allowAllContent === "true";
+            message += '\n - allow all content set to '+ this.device.allowAllContent;
+        }
+        this.logger.info(message);
+        res.send(message);
+
+    }else{
+        res.send(403,'Not Allowed');
+    }
+
+};
+
+DevTools.prototype.renderLogs = function(req, res, next){
+
+       if(this.utils.isSupportDevelopement(req.ip))
+       {
+           if(!wsLogServer) this.createWebSocketServer();
+           res.sendfile(path.join(__dirname,'./templates/logs.html'));
+       }
+       else
+       {
+               this.renderNotDevMode(req,res,next);
+       }
+};
+
+DevTools.prototype.renderTool = function(req, res, next){
+       if(this.utils.isSupportDevelopement(req.ip))
+       {
+       res.sendfile(path.join(__dirname,'./templates/tool.html'));
+       }
+       else
+       {
+               this.renderNotDevMode(req,res,next);
+       }
+
+};
+
+
+DevTools.prototype.renderCaptcha = function(req, res, next){
+    this.captchaAnswer = parseInt(Math.random()*9000+1000);
+    var p = new captcha(80,30,this.captchaAnswer);
+    p.color(0, 0, 0, 0);
+    p.color(80, 80, 80, 255);
+
+    var img = p.getBase64();
+    var imgBase64 = new Buffer(img,'base64');
+    res.set('Content-Type', 'image/png');
+    res.end(imgBase64);
+
+};
+
+
+module.exports = DevTools;
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/index.tpl b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/index.tpl
new file mode 100755 (executable)
index 0000000..48ac7d5
--- /dev/null
@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title>Debug Config</title>
+
+
+    <link rel="stylesheet" href="/resources/css/bootstrap.min.css">
+    <!-- Optional theme
+    <link rel="stylesheet" href="/resources/css/bootstrap-theme.min.css">
+    -->
+
+    <script src="/resources/js/jquery.min.js"></script>
+    <script src="/resources/js/bootstrap.min.js"></script>
+
+    <style>
+
+        table.table-striped tr td:first-child{
+            width : 300px;
+        }
+
+        #devSettings label{
+                font-weight: normal;
+        }
+
+        #devSettings select{
+            padding: 5px;
+            height: auto;
+            margin-bottom: 20px;
+            width: auto;
+            min-width: 200px;
+        }
+
+
+    </style>
+
+</head>
+<body>
+
+<div class="container-fluid">
+    <div class="page-header">
+        <h1>MultiScreen Service</h1>
+    </div>
+
+    <div class="panel panel-default">
+        <div class="panel-heading">Service Information</div>
+        <div class="panel-body">
+            <table class="table table-striped">
+                <tbody>
+                <% _.each(service, function(value, key, object){ %>
+                <tr>
+                    <td><%= key.toUpperCase() %></td>
+                    <td><%= value %></td>
+                </tr>
+                <% }); %>
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+    <div class="panel panel-default">
+        <div class="panel-heading">Memory Information</div>
+        <div class="panel-body">
+            <table class="table table-striped">
+                <tbody>
+                <% _.each(mem, function(value, key, object){ %>
+                <tr>
+                    <td><%= key.toUpperCase() %></td>
+                    <td><%= value %></td>
+                </tr>
+                <% }); %>
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+    <div class="panel panel-default">
+        <div class="panel-heading">Device Information</div>
+        <div class="panel-body">
+            <table class="table table-striped">
+                <tbody>
+                <% _.each(device, function(value, key, object){ %>
+                <tr>
+                    <td><%= key.toUpperCase() %></td>
+                    <td><%= value %></td>
+                </tr>
+                <% }); %>
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+    <div class="panel panel-default">
+        <div class="panel-heading">Developer Options &nbsp;&nbsp;&nbsp; <a href="/logs/" target="ms-logger" style="color:greenyellow;">View Logs</a></div>
+        <div class="panel-body" id="devSettings">
+
+
+                <label for="logLevel">Logging Level</label>
+                <select name="logLevel" id="logLevel" class="form-control">
+                    <% _.each(logging.levels, function(value){ %>
+                    <% if(value === logging.level){ %>
+                    <option value="<%= value %>" selected><%= value.toUpperCase() %></option>
+                    <% }else{ %>
+                    <option value="<%= value %>"><%= value.toUpperCase() %></option>
+                    <% } %>
+                    <% }); %>
+                </select>
+
+
+                <div class="checkbox">
+                    <label>
+                        <% if(allowAllContent){ %>
+                        <input checked type="checkbox" value="allow" name="allowAllContent" id="allowAllContent">
+                        <% }else{ %>
+                        <input type="checkbox" value="allow" name="allowAllContent" id="allowAllContent">
+                        <% } %>
+                        Allow All Content
+                    </label>
+                </div>
+                <img src="/captcha.png"/>
+                <div class="captcha form-group">
+                    <label>
+                        <input checked type="text" class="form-control" value="" name="captchaAnswer" id="captchaAnswer">
+                        Enter text above to submit
+                    </label>
+                </div>
+                <button type="button" class="btn btn-primary" id="submit">Submit</button>
+        </div>
+    </div>
+
+</div>
+
+
+<script>
+
+    var uiLogLevel = $('#logLevel');
+    var uiAllowAllContent = $('#allowAllContent');
+    var captchaAnswer = $('#captchaAnswer');
+    var submit = $('#submit');
+
+    function onUpdateSuccess(data){
+        alert(data);
+    }
+
+    function onUpdateError(error){
+        alert(error.statusText);
+        window.location.reload();
+    }
+
+    submit.on('click',function(){
+        console.log('submitting setting change ::');
+        $.post( 'settings', {captchaAnswer:captchaAnswer.val(), allowAllContent:uiAllowAllContent.prop('checked'), logLevel:uiLogLevel.val()}).done(onUpdateSuccess).fail(onUpdateError);
+    });
+
+
+</script>
+
+
+
+
+
+
+
+</body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/logs.html b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/logs.html
new file mode 100755 (executable)
index 0000000..335a8e7
--- /dev/null
@@ -0,0 +1,125 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title>Debug Logs</title>
+
+
+    <link rel="stylesheet" href="/resources/css/bootstrap.min.css">
+    <!-- Optional theme -->
+    <link rel="stylesheet" href="/resources/css/bootstrap-theme.min.css">
+
+    <script src="/resources/js/jquery.min.js"></script>
+    <script src="/resources/js/bootstrap.min.js"></script>
+
+    <style>
+
+        .level-warn{
+            color : rgb(236, 197, 37);
+        }
+
+        .level-error {
+            color: rgb(255, 60, 60);
+        }
+
+        .level-verbose{
+            color : rgb(108, 185, 192);
+        }
+
+        .level-debug{
+            color : rgb(199, 152, 152);
+        }
+
+        .level-silly{
+            color : rgb(121, 121, 121);
+        }
+
+        .level-info{
+            color : rgb(49, 192, 49);
+        }
+
+        #logPanel table{
+            table-layout:fixed;
+        }
+
+        #log td{
+            word-wrap:break-word;
+        }
+
+        #log td.level{
+            width:100px;
+        }
+
+        #log td.time{
+            width:100px;
+        }
+
+    </style>
+
+</head>
+<body>
+
+<div class="container-fluid">
+    <div class="page-header">
+        <h1>MultiScreen Service Logs</h1>
+        <button id="btnClear" type="button" class="btn btn-info">CLEAR</button>
+    </div>
+
+    <div id="logPanel" class="panel panel-primary">
+        <div class="panel-heading">Logs</div>
+        <div class="panel-body">
+            <table class="table table-striped">
+                <tbody id="log">
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+</div>
+
+<script>
+
+    var ws = new WebSocket('ws://'+window.location.host+'/logger');
+
+    ws.onopen = function(){
+        console.info("ws is open");
+    };
+
+    ws.onclose = function(){
+        console.info("ws is closed");
+    };
+
+    ws.onerror = function(err){
+        console.error(err);
+    };
+
+    ws.onmessage = function(msg){
+
+        console.debug(msg.data);
+
+        msg = JSON.parse(msg.data);
+
+        var row = "";
+        row += '<tr class="level-' + msg.level +'">';
+        row += '<td class="level">' + msg.level.toUpperCase() + '</td>';
+        row += '<td class="message">' + JSON.stringify(msg.msg, null, " ") + '</td>';
+        row += '<td class="meta">' + JSON.stringify(msg.meta, null, " ") + '</td>';
+        row += '</tr>';
+
+        $('#log').append(row);
+    };
+
+    $('#btnClear').on('click', function(){
+        $('#log').empty();
+    });
+
+</script>
+
+
+
+
+
+
+
+</body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/tool.html b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-dev-tools/templates/tool.html
new file mode 100755 (executable)
index 0000000..253d387
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title>V2 WebSocket API Tester</title>
+
+    <link rel="stylesheet/less" type="text/css" href="/resources/tools/websockets/styles.less" />
+
+    <script src="/resources/tools/js/less-1.7.5.min.js"></script>
+    <script src="/resources/js/jquery.min.js"></script>
+    <script src="/resources/tools/websockets/main.js"></script>
+
+</head>
+<body>
+
+<div id="wrapper">
+
+    <header id="cntHeading">
+        <h1>V2 WebSocket API Tester</h1>
+    </header>
+
+    <section id="cntConnection">
+
+        <label for="txtConnectUrl">Connection URL</label>
+        <input id="txtConnectUrl" type="text" value="" />
+
+        <button id="btnConnect">Connect</button>
+        <button id="btnDisconnect">Disconnect</button>
+
+    </section>
+
+    <section id="cntSend">
+
+        <label for="selectMethod">RPC Method</label>
+        <select id="selectMethod"></select>
+
+        <button id="btnSend">SEND</button>
+
+        <label for="txtSend">JSON to send</label>
+        <textarea id="txtSend"></textarea>
+
+
+
+    </section>
+
+    <section id="cntReceive">
+
+        <label for="txtReceive">JSON response</label>
+        <textarea id="txtReceive"></textarea>
+
+    </section>
+
+    <section id="cntNotifications">
+
+        <label for="txtNotification">Notifications</label>
+        <textarea id="txtNotification"></textarea>
+
+    </section>
+
+
+</div>
+
+
+</body>
+</html>
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-mdns-js/index.js b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-mdns-js/index.js
new file mode 100755 (executable)
index 0000000..85687ac
--- /dev/null
@@ -0,0 +1,616 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var _ = require('lodash');
+var dgram = require('dgram');
+var MSFPlugin = require('../plugin');
+
+/*
+ Constants
+ some aren't currently used but may need to be incorporated later
+*/
+
+var SERVICE_NAME = 'samsungmsf';
+var RESPONSE_TTL = 60;
+
+var MDNS_ADDRESS = "224.0.0.251";
+var MDNS_PORT = 5353;
+var CLASS_IN = 1;
+var RESPONSE_CODE_OK = 0;
+
+var TYPE_A    = 0x0001;//host address
+var TYPE_AAAA    = 0x001C;//host address IPv6
+var TYPE_PTR  = 0x000C;
+var TYPE_TXT  = 0x0010;
+var TYPE_SRV  = 0x0021;//service location
+var TYPE_NSEC = 0x002F;//next secured
+
+/*
+ Constructor
+ */
+function Mdns(config){
+
+       /* Call the super constructor */
+       MSFPlugin.apply(this, arguments);
+
+       /* event handlers */
+    this.device.on('ready', this.initialize.bind(this));
+       this.device.on('change', this.update.bind(this));
+
+
+}
+
+/*
+ Extend the MSFPlugin
+ */
+MSFPlugin.extend(Mdns);
+
+/*
+ Initializes the plugin and begins broadcasting on udp socket
+ */
+Mdns.prototype.initialize = function(){
+
+       this.logger.verbose('initializing MDNS');
+
+       var self = this;
+    var logger = this.logger;
+
+    try {
+        this.sock = dgram.createSocket({ type: 'udp4', reuseAddr: true });
+    } catch (e){
+        this.sock = dgram.createSocket('udp4');
+    }
+
+    this.sock.bind(MDNS_PORT, function(err){
+        if(err) return this.logger.error(err.message);
+        self.sock.addMembership(MDNS_ADDRESS);
+        self.sock.setBroadcast(true);
+        self.sock.setMulticastTTL(2);
+        self.sock.setTTL(64);
+        self.sock.setMulticastLoopback(false);
+        self.sock.on('error', function (err) {
+            logger.error(err);
+        });
+
+
+        self.sock.on('message', function (msg, rinfo) {
+            self.onReceive(new Uint8Array(msg),rinfo.address,rinfo.port);
+        });
+
+        self.answer([
+            {type: 12},
+            {type: 16},
+            {type: 33},
+            {type: 1}
+        ], MDNS_ADDRESS, MDNS_PORT);
+
+        process.on('exit', function(){
+            self.answer([
+                {type: 12},
+                {type: 16},
+                {type: 33},
+                {type: 1}
+            ], MDNS_ADDRESS, MDNS_PORT, 0);
+        });
+
+    });
+};
+
+Mdns.prototype.update = function(){
+       var self = this;
+       if (self.sock){
+               self.logger.debug('Closing MDNS socket to reinitialize');
+               self.sock.on('close', function(){
+                       self.logger.debug('MDNS socket closed');
+                       self.initialize();
+               });
+               self.sock.close();
+
+       } else {
+               self.initialize();
+       }
+
+
+};
+
+
+/*
+ Parses incoming message and writes the response back to the socket
+ */
+Mdns.prototype.parseMdnsMessage = function(rawData){
+    function consumeWord(){
+        return (consumeByte() << 8) | consumeByte();
+    }
+
+       var result = {};
+       var position = 0;
+       var errored = false;
+       result.transactionID = consumeWord();
+       var flags = consumeWord();
+       result.isQuery = (flags & 0x8000) === 0;
+       result.opCode = (flags >> 11) & 0xF;
+       result.authoritativeAnswer = (flags & 0x400) !== 0;
+       result.truncated = (flags & 0x200) !== 0;
+       result.recursionDesired = (flags & 0x100) !== 0;
+       result.recursionAvailable = (flags & 0x80) !== 0;
+       result.responseCode = flags & 0xF;
+       var questionCount = consumeWord();
+       var answerCount = consumeWord();
+       var authorityRecordsCount = consumeWord();
+       var additionalRecordsCount = consumeWord();
+       result.questions = [];
+       result.answers = [];
+       result.authorityRecords = [];
+       result.additionalRecords = [];
+
+       function consumeDNSName(){
+
+               var parts = [];
+               while (true){
+                       if (position >= rawData.byteLength){
+                               break;
+                       }
+                       var partLength = consumeByte();
+                       if (partLength === 0)
+                               break;
+                       if (partLength === 0xC0){
+                               var bytePosition = consumeByte();
+                               var oldPosition = position;
+                               position = bytePosition;
+                               parts = parts.concat(consumeDNSName().split("."));
+                               position = oldPosition;
+                               break;
+                       }
+                       if (position + partLength > rawData.byteLength){
+                               if (!errored){
+                                       errored = true;
+                               }
+                               partLength = rawData.byteLength - position;
+                       }
+                       var part = "";
+                       while (partLength-- > 0)
+                               part += String.fromCharCode(consumeByte());
+                       parts.push(part);
+               }
+               return parts.join(".");
+       }
+
+       function consumeByte(){
+               if (position + 1 > rawData.byteLength){
+                       if (!errored){
+                               errored = true;
+                       }
+                       return 0;
+               }
+               return rawData[position++];
+       }
+       function consumeDWord(){
+               return (consumeWord() << 16) | consumeWord();
+       }
+       function consumeQuestion(){
+               var question = {};
+               question.name = consumeDNSName();
+               question.type = consumeWord();
+               question.class = consumeWord();
+               question.unicastResponseRequested = (question.class & 0x8000) !== 0;
+               question.class &= 0x7FFF;
+               return question;
+       }
+       function consumeByteArray(length){
+               length = Math.min(length,rawData.byteLength - position);
+               var data = new Uint8Array(length);
+               for (var i = 0; i < length; i++){
+                       data[i] = consumeByte();
+               }
+               return data;
+       }
+    _.each(_.range(questionCount), function(){
+        result.questions.push(consumeQuestion());
+    });
+       function consumeResourceRecord(){
+               var resource = {};
+               resource.name = consumeDNSName();
+               resource.type = consumeWord();
+               resource.class = consumeWord();
+               resource.flushCache = (resource.class & 0x8000) !== 0;
+               resource.class &= 0x7FFF;
+               resource.timeToLive = consumeDWord();
+               var extraDataLength = consumeWord();
+               resource.resourceData = consumeByteArray(extraDataLength);
+               return resource;
+       }
+    _.each(_.range(answerCount), function(){
+        result.answers.push(consumeResourceRecord());
+    });
+    _.each(_.range(authorityRecordsCount), function(){
+        result.authorityRecords.push(consumeResourceRecord());
+    });
+    _.each(_.range(additionalRecordsCount), function(){
+        result.additionalRecords.push(consumeResourceRecord());
+    });
+       return result;
+};
+
+
+/*
+ Encodes messages to bytearray
+ */
+Mdns.prototype.encodeMDNSMessage = function(message){
+    function writeByte(b,pos){
+        if (pos != null){
+            data[pos] = b;
+        }
+        else{
+            data.push(b);
+        }
+        return 1;
+    }
+
+    function writeWord(w, pos){
+        if (pos != null){
+            return writeByte(w >> 8,pos) + writeByte(w & 0xFF,pos + 1);
+        }
+        return writeByte(w >> 8) + writeByte(w & 0xFF);
+    }
+
+    function writeDWord(d){
+        return  writeWord(d >> 16) + writeWord(d & 0xFFFF);
+    }
+
+    function writeByteArray(b){
+        var bytesWritten = 0;
+        for (var i = 0, li = b.length; i < li; i++){
+            bytesWritten += writeByte(b[i]);
+        }
+        return bytesWritten;
+    }
+
+    function writeIPAddress(a){
+        var parts = a.split(".");
+        var bytesWritten = 0;
+        for (var i = 0, li = parts.length; i < li; i++){
+            bytesWritten += writeByte(parseInt(parts[i]));
+        }
+        return bytesWritten;
+    }
+
+    function writeIP6Address(a){
+        a = a.replace(":", '');
+        var bytesWritten = 0;
+        for (var i = 0, li = a.length; i < li; i++){
+            bytesWritten += writeByte(parseInt(a.charAt(i)));
+        }
+        return bytesWritten;
+    }
+
+    function writeStringArray(parts,includeLastTerminator){
+        var brokeEarly = false;
+        var bytesWritten = 0;
+        for (var i = 0, li = parts.length; i < li; i++){
+            var remainingString = parts.slice(i).join("._-_.");
+            var location = textMapping[remainingString];
+            if (location != null){
+                brokeEarly = true;
+                bytesWritten += writeByte(0xC0);
+                bytesWritten += writeByte(location);
+                break;
+            }
+            if (data.length < 256){//we can't ever shortcut to a position after the first 256 bytes
+                textMapping[remainingString] = data.length;
+            }
+            var part = parts[i];
+            bytesWritten += writeByte(part.length);
+            for (var j = 0, lj = part.length; j < lj; j++){
+                bytesWritten += writeByte(part.charCodeAt(j));
+            }
+        }
+        if (!brokeEarly && includeLastTerminator)
+            bytesWritten += writeByte(0);
+        return bytesWritten;
+
+
+    }
+
+    function writeDNSName(n){
+        var parts = n.split(".");
+        return writeStringArray(parts,true);
+    }
+
+    function writeQuestion(q){
+        writeDNSName(q.name);
+        writeWord(q.type);
+        writeWord(1);
+    }
+    function writeRecord(r){
+        writeDNSName(r.name);
+        writeWord(r.type);
+        writeWord(1);
+        writeDWord(r.timeToLive);
+        var lengthPos;
+        var length;
+        switch (r.type){
+            case TYPE_NSEC:
+                lengthPos = data.length;
+                writeWord(0);
+                length = writeDNSName(r.nsec_domainName);
+                length += writeByte(0);//offset (always 0)
+                r.nsec_types.sort();
+                var bytesNeeded = Math.ceil(r.nsec_types[r.nsec_types.length - 1] / 8);
+                length += writeByte(bytesNeeded);
+                var bitMapArray = new Uint8Array(bytesNeeded);
+                for (var i = 0, li = r.nsec_types.length; i < li; i++){
+                    var type= r.nsec_types[i];
+                    var byteNum = Math.floor(type / 8);
+                    var bitNum = type % 8;
+                    bitMapArray[byteNum] |= 1 << (7 - bitNum);
+                }
+                length += writeByteArray(bitMapArray);
+                writeWord(length,lengthPos);
+                break;
+            case TYPE_TXT:
+                lengthPos = data.length;
+                writeWord(0);
+                length = writeStringArray(r.txt_texts,false);
+                writeWord(length,lengthPos);
+                break;
+            case TYPE_A:
+                lengthPos = data.length;
+                writeWord(0);
+                length = writeIPAddress(r.a_address);
+                writeWord(length,lengthPos);
+                break;
+            case TYPE_AAAA:
+                lengthPos = data.length;
+                writeWord(0);
+                length = writeIP6Address(r.a_address);
+                writeWord(length,lengthPos);
+                break;
+            case TYPE_SRV:
+                lengthPos = data.length;
+                writeWord(0);
+                length = writeWord(r.srv_priority);
+                length += writeWord(r.srv_weight);
+                length += writeWord(r.srv_port);
+                length += writeDNSName(r.srv_target);
+                writeWord(length,lengthPos);
+                break;
+            case TYPE_PTR:
+                lengthPos = data.length;
+                writeWord(0);
+                length = writeDNSName(r.ptr_domainName);
+                writeWord(length,lengthPos);
+                break;
+            default:
+                writeWord(r.resourceData.byteLength);
+                writeByteArray(r.resourceData);
+        }
+    }
+
+       var data = [];
+       var textMapping = {};
+
+       writeWord(message.transactionID);
+       var flags = 0;
+       if (!message.isQuery)
+               flags |= 0x8000;
+       flags |= (message.opCode & 0xFF) << 11;
+       if (message.authoritativeAnswer)
+               flags |= 0x400;
+       if (message.truncated)
+               flags |= 0x200;
+       if (message.recursionDesired)
+               flags |= 0x100;
+       if (message.recursionAvailable)
+               flags |= 0x80;
+       flags |= message.responseCode & 0xF;
+       writeWord(flags);
+       writeWord(message.questions.length);
+       writeWord(message.answers.length);
+       writeWord(message.authorityRecords.length);
+       writeWord(message.additionalRecords.length);
+
+       var i, li;
+       for (i = 0, li = message.questions.length; i < li; i++){
+               writeQuestion(message.questions[i]);
+       }
+       for (i = 0, li = message.answers.length; i < li; i++){
+               writeRecord(message.answers[i]);
+       }
+       for (i = 0, li = message.authorityRecords.length; i < li; i++){
+               writeRecord(message.authorityRecords[i]);
+       }
+       for (i = 0, li = message.additionalRecords.length; i < li; i++){
+               writeRecord(message.additionalRecords[i]);
+       }
+
+       return new Uint8Array(data);
+
+
+};
+
+/*
+ Responds to mdns questions based on question type
+ */
+Mdns.prototype.answer = function(questions, address, port, ttl, transactionID){
+
+       var self = this;
+
+       transactionID = transactionID || 0;
+       ttl = ttl || RESPONSE_TTL;
+
+       _.each(questions, function(question){
+               var targetAddress = MDNS_ADDRESS;
+               var targetPort = MDNS_PORT;
+               if (question.unicastResponseRequested) {
+                       targetAddress = address;
+                       targetPort = port;
+               }
+               var response = {
+                       transactionID: transactionID,
+                       isQuery: false,
+                       opCode: 0,
+                       authoritativeAnswer: true,
+                       truncated: false,
+                       recursionDesired: false,
+                       recursionAvailable: false,
+                       responseCode: RESPONSE_CODE_OK,
+                       questions: [],
+                       answers: [],
+                       additionalRecords: [],
+                       authorityRecords: []
+               };
+
+               if (question.name === "_" + SERVICE_NAME + "._tcp.local"){
+                       if (question.type === 12){
+                               var addPtrRecord = {
+                                       name: "_" + SERVICE_NAME + "._tcp.local",
+                                       type: TYPE_PTR,
+                                       class: CLASS_IN,
+                                       flushCache: true,
+                                       timeToLive: ttl,
+                                       ptr_domainName: self.device.attributes.duid + "._" + SERVICE_NAME + "._tcp.local"
+                               };
+                               if (response.answers.length > 0){
+                                       response.additionalRecords.push(addPtrRecord);
+                               } else {
+                                       response.answers.push(addPtrRecord);
+                               }
+                       }
+               }
+               if (question.name === "._" + SERVICE_NAME + "._tcp.local"){
+                       if (question.type === 12){
+                               var addPtrDotRecord = {
+                                       name: "._" + SERVICE_NAME + "._tcp.local",
+                                       type: TYPE_PTR,
+                                       class: CLASS_IN,
+                                       flushCache: true,
+                                       timeToLive: ttl,
+                                       ptr_domainName: self.device.attributes.duid + "._" + SERVICE_NAME + "._tcp.local"
+                               };
+                               if (response.answers.length > 0){
+                                       response.additionalRecords.push(addPtrDotRecord);
+                               } else {
+                                       response.answers.push(addPtrDotRecord);
+                               }
+                       }
+               }
+               if (question.name === self.device.attributes.duid + "._" + SERVICE_NAME + "._tcp.local"){
+                       if (question.type === 16){
+                               var addTxtRecord = {
+                                       name: self.device.attributes.duid + "._" + SERVICE_NAME + "._tcp.local",
+                                       type: TYPE_TXT,
+                                       class: CLASS_IN,
+                                       flushCache: true,
+                                       timeToLive: ttl,
+                                       txt_texts:[\r
+                                               "id=" + self.device.attributes.id,\r
+                        "remote=" + self.service.remoteVersion,
+                                               "ve=" + self.service.version,
+                                               "md=" + self.device.attributes.type,
+                                               "ic=/resources/img/icon.png",
+                                               "fn=" + self.device.attributes.name,
+                                               "se=" + "http://" + self.utils.getInternalIP() + ":8001" + "/api/v2/"
+                                       ]
+                               };
+                               if (response.answers.length > 0){
+                                       response.additionalRecords.push(addTxtRecord);
+                               } else {
+                                       response.answers.push(addTxtRecord);
+                               }
+                       }
+                       if (question.type === 33){
+                               var addSrvRecord = {
+                                       name: self.device.attributes.duid + "._" + SERVICE_NAME + "._tcp.local",
+                                       type: TYPE_SRV,
+                                       class: CLASS_IN,
+                                       flushCache: true,
+                                       timeToLive: ttl,
+                                       srv_priority: 0,
+                                       srv_weight: 0,
+                                       srv_port: 8001,
+                                       srv_target: self.device.attributes.duid + ".local"
+                               };
+                               if (response.answers.length > 0){
+                                       response.additionalRecords.push(addSrvRecord);
+                               } else {
+                                       response.answers.push(addSrvRecord);
+                               }
+                       }
+               }
+               if (question.name === self.device.attributes.duid + ".local"){
+                       if (question.type === 1){
+                               var addARecord = {
+                                       name: self.device.attributes.duid + ".local",
+                                       type: TYPE_A,
+                                       class: CLASS_IN,
+                                       flushCache: true,
+                                       timeToLive: ttl,
+                                       a_address: self.utils.getInternalIP()
+                               };
+                               if (response.answers.length > 0){
+                                       response.additionalRecords.push(addARecord);
+                               } else {
+                                       response.answers.push(addARecord);
+                               }
+                       }
+                       var addNsecRecord = {
+                               name: self.device.attributes.duid + ".local",
+                               type: TYPE_NSEC,
+                               class: CLASS_IN,
+                               flushCache: true,
+                               timeToLive: ttl,
+                               nsec_domainName: self.device.attributes.duid + ".local",
+                               nsec_types:[TYPE_AAAA]
+                       };
+
+                       if (response.answers.length > 0){
+                               response.additionalRecords.push(addNsecRecord);
+                       } else {
+                               response.answers.push(addNsecRecord);
+                       }
+               }
+               if (response.answers.length > 0){
+                       response = self.encodeMDNSMessage(response);
+                       response = new Buffer(response);
+                       self.send(response, targetAddress, targetPort);
+               }
+
+       });
+};
+
+/*
+ Handler for receiving messages and answering them
+ */
+Mdns.prototype.onReceive = function(data,address,port){
+       var self = this;
+       var message = self.parseMdnsMessage(data);
+       this.answer(message.questions, address, port, RESPONSE_TTL, message.transactionID);
+};
+
+/*
+ Sends mDNS message accross the socket
+ */
+Mdns.prototype.send = function(message, address, port){
+    var logger = this.logger;
+       this.sock.send(message, 0, message.length, port, address, function(err){
+               if (err){
+            logger.error(err);
+               }
+       });
+};
+
+module.exports = Mdns;
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-msfd/index.js b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin-msfd/index.js
new file mode 100755 (executable)
index 0000000..21e1ec0
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var MSFPlugin = require('../plugin');
+var dgram = require('dgram');
+var uuid = require('node-uuid');
+
+var MULTICAST_ADDRESS   = '224.0.0.7';
+var MULTICAST_TTL       = 1;
+var MULTICAST_PORT      = 8001;
+var MAX_MESSAGE_LENGTH  = 2000;
+
+var MSG_UP              = 'up';
+var MSG_ALIVE           = 'alive';
+var MSG_DOWN            = 'down';
+var MSG_DISCOVER        = 'discover';
+
+var HEARTBEAT_INTERVAL  = 2000;
+var RECORD_TTL          = HEARTBEAT_INTERVAL * 4;
+
+var URI_V2 = '/api/v2/';
+var URI_V1 = '/ms/1.0/';
+
+
+function MFSD(config){
+
+    MSFPlugin.apply(this, arguments);
+
+    this.intervalAlive = null;
+
+    this.device.on('ready', this.start.bind(this));
+
+    // TODO : Need to look at other alternatives. This is never going to work to send the dead message
+    process.on('exit', this.stop.bind(this));
+
+}
+
+MSFPlugin.extend(MFSD);
+
+MFSD.prototype.start = function(){
+
+    this.logger.info('starting....');
+    if(this.socket) return this.logger.warn('attempted to start, already started');
+       this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
+
+    this.socket.on('message',this.onMessage.bind(this));
+    this.socket.on('error',this.logger.error.bind(this.logger));
+
+    this.socket.bind(MULTICAST_PORT, function(err){
+        if(err) return this.logger.error(err.message);
+        try {
+            this.socket.setMulticastTTL(MULTICAST_TTL);
+            this.socket.addMembership(MULTICAST_ADDRESS);
+        } catch (err){
+            this.logger.error(err);
+        }
+
+        // broadcast up
+        var msg = this.createMessage(MSG_UP, this.getServices());
+        this.socket.send(msg, 0, msg.length, MULTICAST_PORT, MULTICAST_ADDRESS, function (err) {
+            if(err) return this.logger.error(err);
+            this.logger.silly('sent up....');
+        }.bind(this));
+
+    }.bind(this));
+
+    this.intervalAlive = setInterval(this.sendAlive.bind(this), HEARTBEAT_INTERVAL);
+};
+
+MFSD.prototype.stop = function(){
+
+    this.logger.info('stopping....');
+    clearInterval(this.intervalAlive);
+    if(!this.socket) return this.logger.warn('attempted to stop, already stopped');
+
+    var msg = this.createMessage(MSG_DOWN, this.getServices());
+    // broadcast down
+    this.socket.send(msg, 0, msg.length, MULTICAST_PORT, MULTICAST_ADDRESS, function(err){
+        if(err) this.logger.error(err);
+        // cleanup
+        this.socket.close();
+        this.socket.removeAllListeners();
+        this.socket = null;
+    }.bind(this));
+};
+
+MFSD.prototype.sendAlive = function(){
+
+    //this.logger.silly('sending alive');
+    var msg = this.createMessage(MSG_ALIVE, this.getServices());
+    // broadcast alive
+    this.socket.send(msg, 0, msg.length, MULTICAST_PORT, MULTICAST_ADDRESS, function(err, bytes) {
+        if(err) return this.logger.error(err.message);
+    }.bind(this));
+};
+
+MFSD.prototype.createMessage = function(type, data){
+    var msg = {
+        type: type,
+        ttl: RECORD_TTL,
+        remote: this.service.remoteVersion,
+        sid: this.device.attributes.id,
+        data: data || {}
+    };
+    return new Buffer(JSON.stringify(msg));
+};
+
+MFSD.prototype.getServices = function(){
+    var base = "http://"+ this.utils.getInternalIP() + ":" + this.service.port;
+    return {
+        v1 : { uri : base + URI_V1 },
+        v2 : { uri : base + URI_V2 }
+    };
+};
+
+MFSD.prototype.onMessage = function(msg, rinfo) {
+
+    /* Dont attempt to deal with messages over the max */
+    if(msg.length > MAX_MESSAGE_LENGTH) return this.logger.warn('ignoring message over limit of '+msg.length);
+
+    /* attempt to parse it */
+    try{ msg = JSON.parse(msg);}
+    catch(e){ return this.logger.error('unable to parse msg : ',msg.toString()); }
+
+    var sid = this.device.attributes.id;
+
+    /* dont care about my own messages */
+    if(msg.sid === sid) return;
+
+    if (msg.type === MSG_DISCOVER) {
+        this.logger.verbose("received discovery request from : " + rinfo.address + ":" + rinfo.port);
+        // answer here
+        var response = this.createMessage(MSG_ALIVE, this.getServices());
+        this.socket.send(response, 0, response.length, rinfo.port, rinfo.address, function (err) {
+            if(err) return this.logger.error(err);
+            this.logger.silly('sent alive to '+rinfo.address + ":" + rinfo.port);
+        }.bind(this));
+
+    }
+
+};
+
+
+module.exports = MFSD;
+
+
+
+
+
+
+
+
+
+
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/plugin.js b/MSF-Node/org.tizen.multiscreen/server/plugins/plugin.js
new file mode 100755 (executable)
index 0000000..66d891c
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var util = require('util');
+var _ = require('lodash');
+var winston = require('winston');
+var EventEmitter = require('eventemitter2').EventEmitter2;
+var service = require('../lib/multiscreen-service');
+
+function MSFPlugin(config){
+
+    // Set all plugins to be event emitters
+    EventEmitter.call(this);
+
+    // Properties available to all plugins
+    this.name       = this.constructor.name;
+    this.config     = _.defaults(config || {}, this.configDefaults || {});
+    this.service    = service;
+    this.app        = service.app;
+    this.server     = service.server;
+    this.device     = service.device;
+    this.utils      = service.utils;
+    this.logger     = service.logger.createNamedLogger('Plugin : '+this.name);
+
+    this.logger.info('Loaded');
+}
+
+MSFPlugin.extend = function(targetClass){
+    util.inherits(targetClass, MSFPlugin);
+};
+
+util.inherits(MSFPlugin, EventEmitter);
+
+module.exports = MSFPlugin;
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/plugins/service.json b/MSF-Node/org.tizen.multiscreen/server/plugins/service.json
new file mode 100755 (executable)
index 0000000..14d0561
--- /dev/null
@@ -0,0 +1,9 @@
+{\r
+    "remote_available" : "true",\r
+    "remote_fourDirections" : "true",\r
+    "remote_touchPad" : "true",\r
+    "remote_voiceControl" : "false",\r
+    "DMP_available" : "true",\r
+    "DMP_DRM_PLAYREADY" : "false",\r
+    "DMP_DRM_WIDEVINE" : "false"\r
+}
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/server.js b/MSF-Node/org.tizen.multiscreen/server/server.js
new file mode 100755 (executable)
index 0000000..6483deb
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var service = require("./lib/multiscreen-service");
+service.start();
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/api-v2-channels.js b/MSF-Node/org.tizen.multiscreen/server/test/api-v2-channels.js
new file mode 100755 (executable)
index 0000000..4b0e737
--- /dev/null
@@ -0,0 +1,480 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var WebSocket = require('../lib/ws/index');
+var assert = require('assert');
+var _ = require('lodash');
+
+if(!global.msfService){
+    global.msfService = require('../lib/multiscreen-service');
+    global.msfService.logger.transports.console.silent = true;
+    global.msfService.start();
+}
+
+
+// service will assume 127.0.0.1 host is the tv so we have 2 different endpoints
+var wsHostEndpoint = "ws://127.0.0.1:8001/api/v2/channels/test";
+var wsClientEndpoint = "ws://localhost:8001/api/v2/channels/test";
+
+// Used in test for storing websocket refs and client info
+var hostSocket;
+var hostInfo;
+var client1Socket;
+var client1Info;
+var client2Socket;
+var client2Info;
+
+
+var packMessage = function(oMsg, payload){
+
+    var mStr = JSON.stringify(oMsg);
+    var mBuff = new Buffer(mStr, 'utf8');
+
+    var hBuff = new Buffer(2);
+    hBuff.writeUInt16BE(mBuff.length, 0);
+
+    return Buffer.concat([hBuff,mBuff,payload]);
+
+};
+
+var unpackMessage = function(buf){
+
+    var mSize = buf.readUInt16BE(0);
+    var mStr = buf.toString('utf8',2,2+mSize);
+
+    var message = JSON.parse(mStr);
+    var payload = buf.slice(2+mSize);
+
+    return {message: message, payload: payload};
+
+};
+
+
+describe('MultiScreen Service : API V2 : Channels', function() {
+
+
+    afterEach(function(done) {
+        if (hostSocket) hostSocket.removeAllListeners();
+        if (client1Socket) client1Socket.removeAllListeners();
+        if (client2Socket) client2Socket.removeAllListeners();
+        done();
+    });
+
+    it('waits 4 seconds before testing', function(done) {
+        this.timeout(5000);
+        assert.ok(true, "waiting");
+        setTimeout(done,4000);
+    });
+
+
+    it('connects as host', function(done) {
+
+        var endpoint = wsHostEndpoint + "?name=TheHost";
+
+        hostSocket = new WebSocket(endpoint);
+
+        hostSocket.on('error',function (evt) {
+            console.error(evt);
+        });
+
+        hostSocket.on('open',function (evt) {
+            assert.ok(true, "Host socket connected");
+        });
+
+        hostSocket.on('message',function (msg) {
+
+            msg = JSON.parse(msg);
+
+            if(msg.event === "ms.channel.connect"){
+                assert.ok(_.isString(msg.data.id), "valid client id");
+                assert.ok(_.isArray(msg.data.clients), "valid clients array");
+
+                msg.data.clients.forEach(function (info) {
+                    if (info.id === msg.data.id) hostInfo = info;
+                });
+                assert.ok(_.isObject(hostInfo), "contained the host client information");
+            }
+
+            if(msg.event === "ms.channel.ready"){
+                done();
+            }
+
+        });
+
+    });
+
+    it('connects as client1', function(done) {
+
+        var endpoint = wsClientEndpoint + "?name=TheClient";
+
+        client1Socket = new WebSocket(endpoint);
+
+        client1Socket.on('error',function (evt) {
+            console.error(evt);
+        });
+
+        client1Socket.on('open',function (evt) {
+            assert.ok(true, "Client socket connected");
+        });
+
+        client1Socket.on('message',function (msg) {
+            msg = JSON.parse(msg);
+
+            if(msg.event === 'ms.channel.connect'){
+                assert.ok(true, "client got connect event");
+                assert.ok(_.isString(msg.data.id), "valid client id");
+                assert.ok(_.isArray(msg.data.clients), "valid clients array");
+
+                msg.data.clients.forEach(function (info) {
+                    if (info.id === msg.data.id)  client1Info = info;
+                });
+
+                assert.ok(_.isObject(client1Info), "contained the client information");
+
+            }else if(msg.event === 'ms.channel.ready'){
+                assert.ok(true, "client got ready event");
+            }
+
+        });
+
+        hostSocket.on('message',function (msg) {
+            msg = JSON.parse(msg);
+
+            assert.equal(msg.event, 'ms.channel.clientConnect', "host received the clientConnect event");
+            assert.deepEqual(msg.data, client1Info, "contained the correct client information");
+
+            done();
+        });
+
+    });
+
+
+    it('emit an event with `ms.` prefix (not allowed)', function(done) {
+
+        var message = {
+            "method": "ms.channel.emit",
+            "params": {
+                to: client1Info.id,
+                event: 'ms.channel.anything',
+                data: 'this should give an error'
+            }
+        };
+
+        hostSocket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+            assert.equal(msg.event, 'ms.error', "host received the correct error event");
+            done();
+
+        });
+
+        hostSocket.send(JSON.stringify(message));
+
+    });
+
+
+    it('emits an invalid binary event to client', function(done) {
+
+        hostSocket.on('message', function (msg, flags) {
+
+            msg = JSON.parse(msg);
+            assert.equal(msg.event, 'ms.error', "host received the correct error event");
+            done();
+
+        });
+
+        var message = {
+            "method": "invalid",
+            "params": {
+                to: client1Info.id,
+                event: 'say',
+                data: 'hello'
+            }
+        };
+
+        var payload = new Buffer(100);
+        hostSocket.send(packMessage(message, payload));
+
+    });
+
+    it('emits an invalid binary data', function(done) {
+
+        hostSocket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+            assert.equal(msg.event, 'ms.error', "host received the correct error event");
+            done();
+
+        });
+
+        var payload = new Buffer(100);
+        hostSocket.send(payload);
+
+    });
+
+
+    it('emits a binary event', function(done) {
+
+        client1Socket.on('message', function (msg) {
+
+            assert.ok(msg instanceof Buffer, "client received a Buffer");
+
+            var decoded = unpackMessage(msg);
+
+            msg = decoded.message;
+
+            var expected = {
+                event: "say",
+                from: hostInfo.id,
+                data: 'hello'
+            };
+
+            assert.deepEqual(msg, expected, "client received correct message");
+            assert.equal(decoded.payload.length, 100, "payload was the correct size");
+
+            done();
+
+        });
+
+
+        var message = {
+            "method": "ms.channel.emit",
+            "params": {
+                to: client1Info.id,
+                event: 'say',
+                data: 'hello'
+            }
+        };
+
+        var payload = new Buffer(100);
+
+        hostSocket.send(packMessage(message, payload));
+
+    });
+
+
+    it('emits an event to clients by all possible `to` fields', function(done) {
+
+        var count = 0;
+
+        client1Socket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+
+            if( msg.data === client1Socket.id ||
+                msg.data === 'all' ||
+                msg.data === 'broadcast' ||
+                msg.data === 'host' ||
+                msg.data instanceof Array
+            ){
+                assert.ok(true, "client received message from target of : "+msg.data);
+            }
+
+            assert.equal(msg.event, "testToTargets", "client received correct event");
+            assert.equal(msg.from, hostInfo.id, "client received correct from id");
+            if (++count === 7) done();
+
+        });
+
+        hostSocket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+
+            if( msg.data === hostSocket.id ||
+                msg.data === 'all' ||
+                msg.data === 'broadcast' ||
+                msg.data === 'host' ||
+                msg.data instanceof Array
+            ){
+                assert.ok(true, "host received message from target of : "+msg.data);
+            }
+
+            assert.equal(msg.event, "testToTargets", "host received correct event");
+            assert.equal(msg.from, hostInfo.id, "host received correct from id");
+            if (++count === 7) done();
+
+        });
+
+
+        var message = {
+            "method": "ms.channel.emit",
+            "params": {
+                to: hostSocket.id,
+                event: 'testToTargets',
+                data: ''
+            }
+        };
+
+        // To client id
+        message.params.to = message.params.data = hostInfo.id;
+        hostSocket.send(JSON.stringify(message));
+
+        // To client all
+        message.params.to = message.params.data = 'all';
+        hostSocket.send(JSON.stringify(message));
+
+        // To broadcast
+        message.params.to = message.params.data = 'broadcast';
+        hostSocket.send(JSON.stringify(message));
+
+        // To host
+        message.params.to = message.params.data = 'host';
+        hostSocket.send(JSON.stringify(message));
+
+        // To array of clients
+        message.params.to = message.params.data = [client1Info.id, hostInfo.id];
+        hostSocket.send(JSON.stringify(message));
+
+    });
+
+    it('connects client 2 correctly and all others are notified', function(done) {
+
+        var count = 0;
+
+        var endpoint = wsClientEndpoint + "?name=TheClient2";
+
+        client2Socket = new WebSocket(endpoint);
+
+        client2Socket.on('open', function () {
+            assert.ok(true, "Client2 socket connected");
+        });
+
+        client2Socket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+
+            if(msg.event === 'ms.channel.connect'){
+                assert.ok(true, "client received the connect event");
+                assert.ok(_.isString(msg.data.id), "valid client id");
+                assert.ok(_.isArray(msg.data.clients), "valid clients array");
+
+                msg.data.clients.forEach(function (info) {
+                    if (info.id === msg.data.id)  client2Info = info;
+                });
+
+                assert.ok(_.isObject(client2Info), "contained the client information");
+
+            }else if(msg.event === 'ms.channel.ready'){
+                assert.ok(true, "client received the connect event");
+                if (++count === 3) done();
+            }
+
+
+        });
+
+        client1Socket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+
+            assert.equal(msg.event, 'ms.channel.clientConnect', "client 1 received the correct method");
+            assert.deepEqual(msg.data, client2Info, "contained the correct client information");
+            if (++count === 3) done();
+        });
+
+        hostSocket.on('message', function (msg) {
+
+            msg = JSON.parse(msg);
+
+            assert.equal(msg.event, 'ms.channel.clientConnect', "host received the correct method");
+            assert.deepEqual(msg.data, client2Info, "contained the correct client information");
+            if (++count === 3) done();
+        });
+
+    });
+
+
+    it('disconnects client 2 and all others are notified', function(done) {
+
+        var count = 0;
+
+        var expected = {
+            event: "ms.channel.clientDisconnect",
+            data: client2Info
+        };
+
+        hostSocket.on('message', function (msg) {
+            msg = JSON.parse(msg);
+            assert.deepEqual(msg, expected, "host received the correct disconnect message");
+            if (++count === 3) done();
+        });
+
+        client1Socket.on('message', function (msg) {
+            msg = JSON.parse(msg);
+            assert.deepEqual(msg, expected, "client 1 received the correct disconnect message");
+            if (++count === 3) done();
+        });
+
+        client2Socket.on('close',function () {
+            assert.ok(true, "client 2 socket has closed");
+            if (++count === 3) done();
+        });
+
+        client2Socket.close();
+
+    });
+
+    it('disconnects client 1 and all host is notified', function(done) {
+
+        var count = 0;
+
+        var expected = {
+            event: "ms.channel.clientDisconnect",
+            data: client1Info
+        };
+
+        hostSocket.on('message', function (msg) {
+            msg = JSON.parse(msg);
+            assert.deepEqual(msg, expected, "host received the correct disconnect message");
+            if (++count === 2) done();
+        });
+
+        client1Socket.on('close', function () {
+            assert.ok(true, "Client1 socket closed");
+            if (++count === 2) done();
+        });
+
+        client1Socket.close();
+
+    });
+
+    it('something', function(done) {
+
+        hostSocket.on('close', function () {
+
+            assert.ok(true, "host socket closed");
+            done();
+
+        });
+
+        hostSocket.close();
+
+    });
+
+
+    /*
+
+     it('something', function(done) {
+
+
+     });
+
+
+     */
+
+
+
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/api-v2-rest.js b/MSF-Node/org.tizen.multiscreen/server/test/api-v2-rest.js
new file mode 100755 (executable)
index 0000000..db9f499
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+var assert = require('assert');
+var request = require('request');
+var _ = require('lodash');
+
+if(!global.msfService){
+    global.msfService = require('../lib/multiscreen-service');
+    global.msfService.logger.transports.console.silent = true;
+    global.msfService.start();
+}
+
+
+// version 2 endpoint
+var serviceURL = "http://127.0.0.1:8001/api/v2/";
+
+// test values for app and webapp
+var testAppId = "e16522e6-1dbb-11e4-9ae8-b2227cce2b54";
+var testWebAppUrl = "http://engadget.com";
+
+
+describe('MultiScreen Service : API V2 : REST', function() {
+
+    it('waits 4 seconds before testing', function(done) {
+        this.timeout(5000);
+        assert.ok(true, "waiting");
+        setTimeout(done,4000);
+    });
+
+    it('gets service information', function(done) {
+
+        request.get({url: serviceURL, json: true}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            done();
+        });
+
+    });
+
+    it('shows pincode', function(done) {
+
+        request.post({url: serviceURL + 'pincode'}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            done();
+        });
+
+    });
+
+    it('hides pincode', function(done) {
+
+        request.del({url: serviceURL + 'pincode'}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            done();
+        });
+
+    });
+
+    it('gets application information', function(done) {
+
+        request.get({url: serviceURL + 'applications/' + testAppId}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            done();
+        });
+
+    });
+
+    it('launches application', function(done) {
+        this.timeout(5000);
+        request.post({url: serviceURL + 'applications/' + testAppId}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            setTimeout(done,3000);
+        });
+
+    });
+
+    it('stops application', function(done) {
+        this.timeout(5000);
+        request.del({url: serviceURL + 'applications/' + testAppId}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            setTimeout(done,2000);
+        });
+
+    });
+
+    it('installs application', function(done) {
+        request.put({url: serviceURL + 'applications/' + testAppId}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            done();
+        });
+
+    });
+
+    it('gets web-application information', function(done) {
+        request.get({url: serviceURL + 'webapplication/'}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            done();
+        });
+
+    });
+
+    it('launches the web-application', function(done) {
+        this.timeout(5000);
+        request.post({ url: serviceURL + 'webapplication/', json: {url: testWebAppUrl} }, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            setTimeout(done,3000);
+        });
+
+    });
+
+    it('stops the web-application', function(done) {
+        this.timeout(5000);
+        request.del({url: serviceURL + 'webapplication/'}, function (err, response, result) {
+            assert.equal(response.statusCode, 200, 'status code is 200');
+            setTimeout(done,2000);
+        });
+
+    });
+
+
+
+    /*
+    it('does something', function(done) {
+
+
+
+    });
+    */
+
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.ttf b/MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.ttf
new file mode 100755 (executable)
index 0000000..d030dc0
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.ttf differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.woff b/MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.woff
new file mode 100755 (executable)
index 0000000..2c77d6e
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/test/tools/fonts/amaticsc-regular.woff differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/img/cross-out.png b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/cross-out.png
new file mode 100755 (executable)
index 0000000..376e5bd
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/cross-out.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded-3d.png b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded-3d.png
new file mode 100755 (executable)
index 0000000..9ca4e3d
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded-3d.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded.png b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded.png
new file mode 100755 (executable)
index 0000000..e289cf2
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border-rounded.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border.png b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border.png
new file mode 100755 (executable)
index 0000000..91864e6
Binary files /dev/null and b/MSF-Node/org.tizen.multiscreen/server/test/tools/img/sketch-border.png differ
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/js/bootstrap.min.js b/MSF-Node/org.tizen.multiscreen/server/test/tools/js/bootstrap.min.js
new file mode 100755 (executable)
index 0000000..b04a0e8
--- /dev/null
@@ -0,0 +1,6 @@
+/*!
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown",h),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=" li:not(.divider):visible a",i=f.find("[role=menu]"+h+", [role=listbox]"+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu], [role=listbox]",f.prototype.keydown)}(jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());c.is("a")&&b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this,d=this.tip();this.setContent(),this.options.animation&&d.addClass("fade");var e="function"==typeof this.options.placement?this.options.placement.call(this,d[0],this.$element[0]):this.options.placement,f=/\s?auto?\s?/i,g=f.test(e);g&&(e=e.replace(f,"")||"top"),d.detach().css({top:0,left:0,display:"block"}).addClass(e),this.options.container?d.appendTo(this.options.container):d.insertAfter(this.$element);var h=this.getPosition(),i=d[0].offsetWidth,j=d[0].offsetHeight;if(g){var k=this.$element.parent(),l=e,m=document.documentElement.scrollTop||document.body.scrollTop,n="body"==this.options.container?window.innerWidth:k.outerWidth(),o="body"==this.options.container?window.innerHeight:k.outerHeight(),p="body"==this.options.container?0:k.offset().left;e="bottom"==e&&h.top+h.height+j-m>o?"top":"top"==e&&h.top-m-j<0?"bottom":"right"==e&&h.right+i>n?"left":"left"==e&&h.left-i<p?"right":e,d.removeClass(l).addClass(e)}var q=this.getCalculatedOffset(e,h,i,j);this.applyPlacement(q,e),this.hoverState=null;var r=function(){c.$element.trigger("shown.bs."+c.type)};a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,r).emulateTransitionEnd(150):r()}},b.prototype.applyPlacement=function(b,c){var d,e=this.tip(),f=e[0].offsetWidth,g=e[0].offsetHeight,h=parseInt(e.css("margin-top"),10),i=parseInt(e.css("margin-left"),10);isNaN(h)&&(h=0),isNaN(i)&&(i=0),b.top=b.top+h,b.left=b.left+i,a.offset.setOffset(e[0],a.extend({using:function(a){e.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),e.addClass("in");var j=e[0].offsetWidth,k=e[0].offsetHeight;if("top"==c&&k!=g&&(d=!0,b.top=b.top+g-k),/bottom|top/.test(c)){var l=0;b.left<0&&(l=-2*b.left,b.left=0,e.offset(b),j=e[0].offsetWidth,k=e[0].offsetHeight),this.replaceArrow(l-f+j,j,"left")}else this.replaceArrow(k-g,k,"top");d&&e.offset(b)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/js/jquery.min.js b/MSF-Node/org.tizen.multiscreen/server/test/tools/js/jquery.min.js
new file mode 100755 (executable)
index 0000000..e5ace11
--- /dev/null
@@ -0,0 +1,4 @@
+/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)
+},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
+},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.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 contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n});
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/js/less-1.7.5.min.js b/MSF-Node/org.tizen.multiscreen/server/test/tools/js/less-1.7.5.min.js
new file mode 100755 (executable)
index 0000000..4de6ffe
--- /dev/null
@@ -0,0 +1,16 @@
+/*!\r
+ * Less - Leaner CSS v1.7.5\r
+ * http://lesscss.org\r
+ *\r
+ * Copyright (c) 2009-2014, Alexis Sellier <self@cloudhead.net>\r
+ * Licensed under the Apache v2 License.\r
+ *\r
+ */\r
+\r
+ /** * @license Apache v2\r
+ */\r
+\r
+!function(a,b){function c(b){return a.less[b.split("/")[1]]}function d(a,b){"undefined"!=typeof console&&w.logLevel>=b&&console.log("less: "+a)}function e(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function f(a,c){var e="{line} {content}",f=a.filename||c,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,c,d){a.extract[c]!==b&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(c-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[c]))};a.extract?(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")):a.stack&&(h+=a.stack),d(h,z.errors)}function g(a,b,c){var f=b.href||"",g="less:"+(b.title||e(f)),h=document.getElementById(g),i=!1,j=document.createElement("style");j.setAttribute("type","text/css"),b.media&&j.setAttribute("media",b.media),j.id=g,j.styleSheet||(j.appendChild(document.createTextNode(a)),i=null!==h&&h.childNodes.length>0&&j.childNodes.length>0&&h.firstChild.nodeValue===j.firstChild.nodeValue);var k=document.getElementsByTagName("head")[0];if(null===h||i===!1){var l=b&&b.nextSibling||null;l?l.parentNode.insertBefore(j,l):k.appendChild(j)}if(h&&i===!1&&h.parentNode.removeChild(h),j.styleSheet)try{j.styleSheet.cssText=a}catch(m){throw new Error("Couldn't reassign styleSheet.cssText.")}if(c&&D){d("saving "+f+" to cache.",z.info);try{D.setItem(f,a),D.setItem(f+":timestamp",c)}catch(m){d("failed to save",z.errors)}}}function h(a){return w.postProcessor&&"function"==typeof w.postProcessor&&(a=w.postProcessor.call(a,a)||a),a}function i(a,c){var d,f,h="less-error-message:"+e(c||""),i='<li><label>{line}</label><pre class="{class}">{content}</pre></li>',j=document.createElement("div"),k=[],l=a.filename||c,m=l.match(/([^\/]+(\?.*)?)$/)[1];j.id=h,j.className="less-error-message",f="<h3>"+(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+'</h3><p>in <a href="'+l+'">'+m+"</a> ";var n=function(a,c,d){a.extract[c]!==b&&k.push(i.replace(/\{line\}/,(parseInt(a.line,10)||0)+(c-1)).replace(/\{class\}/,d).replace(/\{content\}/,a.extract[c]))};a.extract?(n(a,0,""),n(a,1,"line"),n(a,2,""),f+="on line "+a.line+", column "+(a.column+1)+":</p><ul>"+k.join("")+"</ul>"):a.stack&&(f+="<br/>"+a.stack.split("\n").slice(1).join("<br/>")),j.innerHTML=f,g([".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),j.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"==w.env&&(d=setInterval(function(){document.body&&(document.getElementById(h)?document.body.replaceChild(j,document.getElementById(h)):document.body.insertBefore(j,document.body.firstChild),clearInterval(d))},10))}function j(a,b){w.errorReporting&&"html"!==w.errorReporting?"console"===w.errorReporting?f(a,b):"function"==typeof w.errorReporting&&w.errorReporting("add",a,b):i(a,b)}function k(a){var b=document.getElementById("less-error-message:"+e(a));b&&b.parentNode.removeChild(b)}function l(){}function m(a){w.errorReporting&&"html"!==w.errorReporting?"console"===w.errorReporting?l(a):"function"==typeof w.errorReporting&&w.errorReporting("remove",a):k(a)}function n(a){for(var b,c=document.getElementsByTagName("style"),d=0;d<c.length;d++)if(b=c[d],b.type.match(C)){var e=new w.tree.parseEnv(w),f=b.innerHTML||"";e.filename=document.location.href.replace(/#.*$/,""),(a||w.globalVars)&&(e.useFileCache=!0);var g=function(a){return function(b,c){if(b)return j(b,"inline");var d=c.toCSS(w);a.type="text/css",a.styleSheet?a.styleSheet.cssText=d:a.innerHTML=d}}(b);new w.Parser(e).parse(f,g,{globalVars:w.globalVars,modifyVars:a})}}function o(a,b){var c,d,e=/^((?:[a-z-]+:)?\/+?(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,f=a.match(e),g={},h=[];if(!f)throw new Error("Could not parse sheet href - '"+a+"'");if(!f[1]||f[2]){if(d=b.match(e),!d)throw new Error("Could not parse page url - '"+b+"'");f[1]=f[1]||d[1]||"",f[2]||(f[3]=d[3]+f[3])}if(f[3]){for(h=f[3].replace(/\\/g,"/").split("/"),c=0;c<h.length;c++)"."===h[c]&&(h.splice(c,1),c-=1);for(c=0;c<h.length;c++)".."===h[c]&&c>0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=f[1]+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g}function p(a,b){var c,d,e,f,g=o(a),h=o(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;c<f.length-1;c++)i+="../";for(c=0;c<e.length-1;c++)i+=e[c]+"/";return i}function q(){if(a.XMLHttpRequest&&!("file:"===a.location.protocol&&"ActiveXObject"in a))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(b){return d("browser doesn't support AJAX.",z.errors),null}}function r(a,b,c,e){function f(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var g=q(),h=y?w.fileAsync:w.async;"function"==typeof g.overrideMimeType&&g.overrideMimeType("text/css"),d("XHR: Getting '"+a+"'",z.debug),g.open("GET",a,h),g.setRequestHeader("Accept",b||"text/x-less, text/css; q=0.9, */*; q=0.5"),g.send(null),y&&!w.fileAsync?0===g.status||g.status>=200&&g.status<300?c(g.responseText):e(g.status,a):h?g.onreadystatechange=function(){4==g.readyState&&f(g,c,e)}:f(g,c,e)}function s(b,c,d,e){c&&c.currentDirectory&&!/^([A-Za-z-]+:)?\//.test(b)&&(b=c.currentDirectory+b);var f=o(b,a.location.href),g=f.url,h={currentDirectory:f.path,filename:g};if(c?(h.entryPath=c.entryPath,h.rootpath=c.rootpath,h.rootFilename=c.rootFilename,h.relativeUrls=c.relativeUrls):(h.entryPath=f.path,h.rootpath=w.rootpath||f.path,h.rootFilename=g,h.relativeUrls=e.relativeUrls),h.relativeUrls&&(h.rootpath=e.rootpath?o(e.rootpath+p(f.path,h.entryPath)).path:f.path),e.useFileCache&&E[g])try{var i=E[g];d(null,i,g,h,{lastModified:new Date})}catch(j){d(j,null,g)}else r(g,e.mime,function(a,b){E[g]=a;try{d(null,a,g,h,{lastModified:b})}catch(c){d(c,null,g)}},function(a,b){d({type:"File",message:"'"+b+"' wasn't found ("+a+")"},null,g)})}function t(a,b,c,d,e){var f=new w.tree.parseEnv(w);f.mime=a.type,(e||w.globalVars)&&(f.useFileCache=!0),s(a.href,null,function(h,i,j,k,l){if(l){l.remaining=d;var n=D&&D.getItem(j),o=D&&D.getItem(j+":timestamp");if(!c&&o&&l.lastModified&&new Date(l.lastModified).valueOf()===new Date(o).valueOf())return g(n,a),l.local=!0,void b(null,null,i,a,l,j)}m(j),i?(f.currentFileInfo=k,new w.Parser(f).parse(i,function(c,d){if(c)return b(c,null,null,a);try{b(c,d,i,a,l,j)}catch(c){b(c,null,null,a)}},{modifyVars:e,globalVars:w.globalVars})):b(h,null,null,a,l,j)},f,e)}function u(a,b,c){for(var d=0;d<w.sheets.length;d++)t(w.sheets[d],a,b,w.sheets.length-(d+1),c)}function v(){"development"===w.env?(w.optimization=0,w.watchTimer=setInterval(function(){w.watchMode&&u(function(a,b,c,d,e){if(a)j(a,d.href);else if(b){var f=b.toCSS(w);f=h(f),g(f,d,e.lastModified)}})},w.poll)):w.optimization=3}("undefined"==typeof a.less||"undefined"!=typeof a.less.nodeType)&&(a.less={}),w=a.less,x=a.less.tree={},w.mode="browser";var w,x;w===b&&(w=exports,x=c("./tree"),w.mode="node"),w.Parser=function(a){function d(){D=y,G.push({current:C,i:y,j:z})}function e(){var a=G.pop();C=a.current,D=y=a.i,z=a.j}function f(){G.pop()}function g(){y>D&&(C=C.slice(y-D),D=y)}function h(a,b){var c=a.charCodeAt(0|b);return 32>=c&&(32===c||10===c||9===c)}function i(a){var b,c,d=typeof a;return"string"===d?v.charAt(y)!==a?null:(l(1),a):(g(),(b=a.exec(C))?(c=b[0].length,l(c),"string"==typeof b?b:1===b.length?b[0]:b):null)}function j(a){y>D&&(C=C.slice(y-D),D=y);var b=a.exec(C);return b?(l(b[0].length),"string"==typeof b?b:1===b.length?b[0]:b):null}function k(a){return v.charAt(y)!==a?null:(l(1),a)}function l(a){for(var b,c=y,d=z,e=y-D,f=y+C.length-e,g=y+=a,h=v;f>y&&(b=h.charCodeAt(y),!(b>32))&&(32===b||10===b||9===b||13===b);y++);return C=C.slice(a+y-g+e),D=y,!C.length&&z<B.length-1?(C=B[++z],l(0),!0):c!==y||d!==z}function m(a,b){var c="[object Function]"===Object.prototype.toString.call(a)?a.call(F):i(a);return c?c:void o(b||("string"==typeof a?"expected '"+a+"' got '"+v.charAt(y)+"'":"unexpected token"))}function n(a,b){return v.charAt(y)===a?(l(1),a):void o(b||"expected '"+a+"' got '"+v.charAt(y)+"'")}function o(a,b){var c=new Error(a);throw c.index=y,c.type=b||"Syntax",c}function p(a){return"string"==typeof a?v.charAt(y)===a:a.test(C)}function q(a){return v.charAt(y)===a}function r(a,b){return a.filename&&b.currentFileInfo.filename&&a.filename!==b.currentFileInfo.filename?E.imports.contents[a.filename]:v}function s(a,b){for(var c=a+1,d=null,e=-1;--c>=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}function t(a,b,d){var e=d.currentFileInfo.filename;return"browser"!==w.mode&&"rhino"!==w.mode&&(e=c("path").resolve(e)),{lineNumber:s(a,b).line+1,fileName:e}}function u(a,b){var c=r(a,b),d=s(a.index,c),e=d.line,f=d.column,g=a.call&&s(a.call,c).line,h=c.split("\n");this.type=a.type||"Syntax",this.message=a.message,this.filename=a.filename||b.currentFileInfo.filename,this.index=a.index,this.line="number"==typeof e?e+1:null,this.callLine=g+1,this.callExtract=h[g],this.stack=a.stack,this.column=f,this.extract=[h[e-1],h[e],h[e+1]]}var v,y,z,A,B,C,D,E,F,G=[],H=a&&a.filename;a instanceof x.parseEnv||(a=new x.parseEnv(a));var I=this.imports={paths:a.paths||[],queue:[],files:a.files,contents:a.contents,contentsIgnoredChars:a.contentsIgnoredChars,mime:a.mime,error:null,push:function(b,c,d,e){var f=this;this.queue.push(b);var g=function(a,c,d){f.queue.splice(f.queue.indexOf(b),1);var g=d===H;f.files[d]=c,a&&!f.error&&(f.error=a),e(a,c,g,d)};w.Parser.importer?w.Parser.importer(b,c,g,a):w.Parser.fileLoader(b,c,function(b,e,f,h){if(b)return void g(b);var i=new x.parseEnv(a);i.currentFileInfo=h,i.processImports=!1,i.contents[f]=e,(c.reference||d.reference)&&(h.reference=!0),d.inline?g(null,e,f):new w.Parser(i).parse(e,function(a,b){g(a,b,f)})},a)}},J=j;return u.prototype=new Error,u.prototype.constructor=u,this.env=a=a||{},this.optimization="optimization"in this.env?this.env.optimization:1,E={imports:I,parse:function(d,e,f){var g,h,i,j,k,l=null,m="";if(y=z=D=A=0,j=f&&f.globalVars?w.Parser.serializeVars(f.globalVars)+"\n":"",k=f&&f.modifyVars?"\n"+w.Parser.serializeVars(f.modifyVars):"",(j||f&&f.banner)&&(m=(f&&f.banner?f.banner:"")+j,E.imports.contentsIgnoredChars[a.currentFileInfo.filename]=m.length),d=d.replace(/\r\n/g,"\n"),v=d=m+d.replace(/^\uFEFF/,"")+k,E.imports.contents[a.currentFileInfo.filename]=d,B=function(b){function c(b,c){l=new u({index:c||i,type:"Parse",message:b,filename:a.currentFileInfo.filename},a)}function d(a){var c=i-s;512>c&&!a||!c||(r.push(b.slice(s,i+1)),s=i+1)}var e,f,g,h,i,j,k,m,n,o=b.length,p=0,q=0,r=[],s=0;for(i=0;o>i;i++)if(k=b.charCodeAt(i),!(k>=97&&122>=k||34>k))switch(k){case 40:q++,f=i;continue;case 41:if(--q<0)return c("missing opening `(`");continue;case 59:q||d();continue;case 123:p++,e=i;continue;case 125:if(--p<0)return c("missing opening `{`");p||q||d();continue;case 92:if(o-1>i){i++;continue}return c("unescaped `\\`");case 34:case 39:case 96:for(n=0,j=i,i+=1;o>i;i++)if(m=b.charCodeAt(i),!(m>96)){if(m==k){n=1;break}if(92==m){if(i==o-1)return c("unescaped `\\`");i++}}if(n)continue;return c("unmatched `"+String.fromCharCode(k)+"`",j);case 47:if(q||i==o-1)continue;if(m=b.charCodeAt(i+1),47==m)for(i+=2;o>i&&(m=b.charCodeAt(i),!(13>=m)||10!=m&&13!=m);i++);else if(42==m){for(g=j=i,i+=2;o-1>i&&(m=b.charCodeAt(i),125==m&&(h=i),42!=m||47!=b.charCodeAt(i+1));i++);if(i==o-1)return c("missing closing `*/`",j);i++}continue;case 42:if(o-1>i&&47==b.charCodeAt(i+1))return c("unmatched `/*`");continue}return 0!==p?g>e&&h>g?c("missing closing `}` or `*/`",e):c("missing closing `}`",e):0!==q?c("missing closing `)`",f):(d(!0),r)}(d),l)return e(new u(l,a));C=B[0];try{g=new x.Ruleset(null,this.parsers.primary()),g.root=!0,g.firstRoot=!0}catch(n){return e(new u(n,a))}if(g.toCSS=function(d){return function(e,f){e=e||{};var g,h,i=new x.evalEnv(e);"object"!=typeof f||Array.isArray(f)||(f=Object.keys(f).map(function(a){var b=f[a];return b instanceof x.Value||(b instanceof x.Expression||(b=new x.Expression([b])),b=new x.Value([b])),new x.Rule("@"+a,b,!1,null,0)}),i.frames=[new x.Ruleset(null,f)]);try{var j,k=[],l=[new x.joinSelectorVisitor,new x.processExtendsVisitor,new x.toCSSVisitor({compress:Boolean(e.compress)})],m=this;if(e.plugins)for(j=0;j<e.plugins.length;j++)e.plugins[j].isPreEvalVisitor?k.push(e.plugins[j]):e.plugins[j].isPreVisitor?l.splice(0,0,e.plugins[j]):l.push(e.plugins[j]);for(j=0;j<k.length;j++)k[j].run(m);for(g=d.call(m,i),j=0;j<l.length;j++)l[j].run(g);e.sourceMap&&(g=new x.sourceMapOutput({contentsIgnoredCharsMap:E.imports.contentsIgnoredChars,writeSourceMap:e.writeSourceMap,rootNode:g,contentsMap:E.imports.contents,sourceMapFilename:e.sourceMapFilename,sourceMapURL:e.sourceMapURL,outputFilename:e.sourceMapOutputFilename,sourceMapBasepath:e.sourceMapBasepath,sourceMapRootpath:e.sourceMapRootpath,outputSourceFiles:e.outputSourceFiles,sourceMapGenerator:e.sourceMapGenerator})),h=g.toCSS({compress:Boolean(e.compress),dumpLineNumbers:a.dumpLineNumbers,strictUnits:Boolean(e.strictUnits),numPrecision:8})}catch(n){throw new u(n,a)}if(e.cleancss&&"node"===w.mode){var o=c("clean-css"),p=e.cleancssOptions||{};return p.keepSpecialComments===b&&(p.keepSpecialComments="*"),p.processImport=!1,p.noRebase=!0,p.noAdvanced===b&&(p.noAdvanced=!0),new o(p).minify(h)}return e.compress?h.replace(/(^(\s)+)|((\s)+$)/g,""):h}}(g.eval),y<v.length-1){y=A;var o=s(y,v);i=v.split("\n"),h=o.line+1,l={type:"Parse",message:"Unrecognised input",index:y,filename:a.currentFileInfo.filename,line:h,column:o.column,extract:[i[h-2],i[h-1],i[h]]}}var p=function(b){return b=l||b||E.imports.error,b?(b instanceof u||(b=new u(b,a)),e(b)):e(null,g)};return a.processImports===!1?p():void new x.importVisitor(this.imports,p).run(g)},parsers:F={primary:function(){for(var a,b=this.mixin,c=J,d=[];C;){if(a=this.extendRule()||b.definition()||this.rule()||this.ruleset()||b.call()||this.comment()||this.rulesetCall()||this.directive())d.push(a);else if(!c(/^[\s\n]+/)&&!c(/^;+/))break;if(q("}"))break}return d},comment:function(){var b;if("/"===v.charAt(y))return"/"===v.charAt(y+1)?new x.Comment(j(/^\/\/.*/),!0,y,a.currentFileInfo):(b=j(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/),b?new x.Comment(b,!1,y,a.currentFileInfo):void 0)},comments:function(){for(var a,b=[];;){if(a=this.comment(),!a)break;b.push(a)}return b},entities:{quoted:function(){var b,c,d=y,e=y;return"~"===v.charAt(d)&&(d++,c=!0),'"'===v.charAt(d)||"'"===v.charAt(d)?(c&&k("~"),b=j(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/),b?new x.Quoted(b[0],b[1]||b[2],c,e,a.currentFileInfo):void 0):void 0},keyword:function(){var a;if(a=j(/^%|^[_A-Za-z-][_A-Za-z0-9-]*/)){var b=x.Color.fromKeyword(a);return b?b:new x.Keyword(a)}},call:function(){var b,c,d,e,f=y;if(b=/^([\w-]+|%|progid:[\w\.]+)\(/.exec(C)){if(b=b[1],c=b.toLowerCase(),"url"===c)return null;if(y+=b.length,"alpha"===c&&(e=F.alpha(),"undefined"!=typeof e))return e;if(k("("),d=this.arguments(),k(")"))return b?new x.Call(b,d,f,a.currentFileInfo):void 0}},arguments:function(){for(var a,b=[];;){if(a=this.assignment()||F.expression(),!a)break;if(b.push(a),!k(","))break}return b},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return a=j(/^\w+(?=\s?=)/i),a&&k("=")?(b=F.entity(),b?new x.Assignment(a,b):void 0):void 0},url:function(){var b;if("u"===v.charAt(y)&&j(/^url\(/))return b=this.quoted()||this.variable()||j(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",n(")"),new x.URL(null!=b.value||b instanceof x.Variable?b:new x.Anonymous(b),a.currentFileInfo)},variable:function(){var b,c=y;return"@"===v.charAt(y)&&(b=j(/^@@?[\w-]+/))?new x.Variable(b,c,a.currentFileInfo):void 0},variableCurly:function(){var b,c=y;return"@"===v.charAt(y)&&(b=j(/^@\{([\w-]+)\}/))?new x.Variable("@"+b[1],c,a.currentFileInfo):void 0},color:function(){var a;if("#"===v.charAt(y)&&(a=j(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||o("Invalid HEX color code"),new x.Color(a[1])}},dimension:function(){var a,b=v.charCodeAt(y);if(!(b>57||43>b||47===b||44==b))return a=j(/^([+-]?\d*\.?\d+)(%|[a-z]+)?/),a?new x.Dimension(a[1],a[2]):void 0},unicodeDescriptor:function(){var a;return a=j(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),a?new x.UnicodeDescriptor(a[0]):void 0},javascript:function(){var c,d,e=y;return"~"===v.charAt(e)&&(e++,d=!0),"`"===v.charAt(e)?(a.javascriptEnabled===b||a.javascriptEnabled||o("You are using JavaScript, which has been disabled."),d&&k("~"),c=j(/^`([^`]*)`/),c?new x.JavaScript(c[1],y,d):void 0):void 0}},variable:function(){var a;return"@"===v.charAt(y)&&(a=j(/^(@[\w-]+)\s*:/))?a[1]:void 0},rulesetCall:function(){var a;return"@"===v.charAt(y)&&(a=j(/^(@[\w-]+)\s*\(\s*\)\s*;/))?new x.RulesetCall(a[1]):void 0},extend:function(a){var b,c,d,e,f,g=y;if(j(a?/^&:extend\(/:/^:extend\(/)){do{for(d=null,b=null;!(d=j(/^(all)(?=\s*(\)|,))/))&&(c=this.element());)b?b.push(c):b=[c];d=d&&d[1],b||o("Missing target selector for :extend()."),f=new x.Extend(new x.Selector(b),d,g),e?e.push(f):e=[f]}while(k(","));return m(/^\)/),a&&m(/^;/),e}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var b,c,g,h,i,l,m=v.charAt(y),o=!1,p=y;if("."===m||"#"===m){for(d();;){if(b=y,h=j(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!h)break;g=new x.Element(i,h,b,a.currentFileInfo),c?c.push(g):c=[g],i=k(">")}return c&&(k("(")&&(l=this.args(!0).args,n(")")),F.important()&&(o=!0),F.end())?(f(),new x.mixin.Call(c,l,p,a.currentFileInfo,o)):void e()}},args:function(a){var b,c,g,h,i,l,m=E.parsers,n=m.entities,p={args:null,variadic:!1},q=[],r=[],s=[];for(d();;){if(a)l=m.detachedRuleset()||m.expression();else{if(m.comments(),"."===v.charAt(y)&&j(/^\.{3}/)){p.variadic=!0,k(";")&&!b&&(b=!0),(b?r:s).push({variadic:!0});break}l=n.variable()||n.literal()||n.keyword()}if(!l)break;h=null,l.throwAwayComments&&l.throwAwayComments(),i=l;var t=null;if(a?l.value&&1==l.value.length&&(t=l.value[0]):t=l,t&&t instanceof x.Variable)if(k(":")){if(q.length>0&&(b&&o("Cannot mix ; and , as delimiter types"),c=!0),i=a&&m.detachedRuleset()||m.expression(),!i){if(!a)return e(),p.args=[],p;o("could not understand value for named argument")}h=g=t.name}else{if(!a&&j(/^\.{3}/)){p.variadic=!0,k(";")&&!b&&(b=!0),(b?r:s).push({name:l.name,variadic:!0});break}a||(g=h=t.name,i=null)}i&&q.push(i),s.push({name:h,value:i}),k(",")||(k(";")||b)&&(c&&o("Cannot mix ; and , as delimiter types"),b=!0,q.length>1&&(i=new x.Value(q)),r.push({name:g,value:i}),g=null,q=[],c=!1)}return f(),p.args=b?r:s,p},definition:function(){var a,b,c,g,h=[],i=!1;if(!("."!==v.charAt(y)&&"#"!==v.charAt(y)||p(/^[^{]*\}/)))if(d(),b=j(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var l=this.args(!1);if(h=l.args,i=l.variadic,!k(")"))return A=y,void e();if(F.comments(),j(/^when/)&&(g=m(F.conditions,"expected condition")),c=F.block())return f(),new x.mixin.Definition(a,h,c,g,i);e()}else f()}},entity:function(){var a=this.entities;return a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()||this.comment()},end:function(){return k(";")||q("}")},alpha:function(){var a;if(j(/^\(opacity=/i))return a=j(/^\d+/)||this.entities.variable(),a?(n(")"),new x.Alpha(a)):void 0},element:function(){var b,c,g,h=y;return c=this.combinator(),b=j(/^(?:\d+\.\d+|\d+)%/)||j(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||k("*")||k("&")||this.attribute()||j(/^\([^()@]+\)/)||j(/^[\.#](?=@)/)||this.entities.variableCurly(),b||(d(),k("(")?(g=this.selector())&&k(")")?(b=new x.Paren(g),f()):e():f()),b?new x.Element(c,b,h,a.currentFileInfo):void 0},combinator:function(){var a=v.charAt(y);if("/"===a){d();var b=j(/^\/[a-z]+\//i);if(b)return f(),new x.Combinator(b);e()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(y++,"^"===a&&"^"===v.charAt(y)&&(a="^^",y++);h(v,y);)y++;return new x.Combinator(a)}return new x.Combinator(h(v,y-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(b){for(var c,d,e,f,g,h,i,j=y,k=J;(b&&(g=this.extend())||b&&(h=k(/^when/))||(f=this.element()))&&(h?i=m(this.conditions,"expected condition"):i?o("CSS guard can only be used at the end of selector"):g?d?d.push(g):d=[g]:(d&&o("Extend can only be used at the end of selector"),e=v.charAt(y),c?c.push(f):c=[f],f=null),"{"!==e&&"}"!==e&&";"!==e&&","!==e&&")"!==e););return c?new x.Selector(c,d,i,j,a.currentFileInfo):void(d&&o("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(k("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=m(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=j(/^[|~*$^]?=/),c&&(b=d.quoted()||j(/^[0-9]+%/)||j(/^[\w-]+/)||d.variableCurly()),n("]"),new x.Attribute(a,c,b)}},block:function(){var a;return k("{")&&(a=this.primary())&&k("}")?a:void 0},blockRuleset:function(){var a=this.block();return a&&(a=new x.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();return a?new x.DetachedRuleset(a):void 0},ruleset:function(){var b,c,g,h;for(d(),a.dumpLineNumbers&&(h=t(y,v,a));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],this.comments(),c.condition&&b.length>1&&o("Guards are only currently allowed on a single selector."),!k(","))break;c.condition&&o("Guards are only currently allowed on a single selector."),this.comments()}if(b&&(g=this.block())){f();var i=new x.Ruleset(b,g,a.strictImports);return a.dumpLineNumbers&&(i.debugInfo=h),i}A=y,e()},rule:function(b){var c,g,h,i,j,k=y,l=v.charAt(k);if("."!==l&&"#"!==l&&"&"!==l)if(d(),c=this.variable()||this.ruleProperty()){if(j="string"==typeof c,j&&(g=this.detachedRuleset()),this.comments(),g||(g=b||!a.compress&&!j?this.anonymousValue()||this.value():this.value()||this.anonymousValue(),h=this.important(),i=!j&&c.pop().value),g&&this.end())return f(),new x.Rule(c,g,h,i,k,a.currentFileInfo);if(A=y,e(),g&&!b)return this.rule(!0)}else f()},anonymousValue:function(){var a;return a=/^([^@+\/'"*`(;{}-]*);/.exec(C),a?(y+=a[0].length-1,new x.Anonymous(a[1])):void 0},"import":function(){var b,c,d=y,e=j(/^@import?\s+/);if(e){var f=(e?this.importOptions():null)||{};if(b=this.entities.quoted()||this.entities.url())return c=this.mediaFeatures(),i(";")||(y=d,o("missing semi-colon or unrecognised media features on import")),c=c&&new x.Value(c),new x.Import(b,c,f,d,a.currentFileInfo);y=d,o("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!k("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!k(","))break}while(a);return n(")"),d},importOption:function(){var a=j(/^(less|css|multiple|once|inline|reference)/);return a?a[1]:void 0},mediaFeature:function(){var b,c,d=this.entities,e=[];do if(b=d.keyword()||d.variable())e.push(b);else if(k("(")){if(c=this.property(),b=this.value(),!k(")"))return null;if(c&&b)e.push(new x.Paren(new x.Rule(c,b,null,null,y,a.currentFileInfo,!0)));else{if(!b)return null;e.push(new x.Paren(b))}}while(b);return e.length>0?new x.Expression(e):void 0},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!k(","))break}else if(a=b.variable(),a&&(c.push(a),!k(",")))break;while(a);return c.length>0?c:null},media:function(){var b,c,d,e;return a.dumpLineNumbers&&(e=t(y,v,a)),j(/^@media/)&&(b=this.mediaFeatures(),c=this.block())?(d=new x.Media(c,b,y,a.currentFileInfo),a.dumpLineNumbers&&(d.debugInfo=e),d):void 0},directive:function(){var b,c,g,h,i,l,m,n=y,p=!0;if("@"===v.charAt(y)){if(c=this["import"]()||this.media())return c;if(d(),b=j(/^@[a-z-]+/)){switch(h=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(h="@"+b.slice(b.indexOf("-",2)+1)),h){case"@charset":i=!0,p=!1;break;case"@namespace":l=!0,p=!1;break;case"@keyframes":i=!0;break;case"@host":case"@page":case"@document":case"@supports":m=!0}return this.comments(),i?(c=this.entity(),c||o("expected "+b+" identifier")):l?(c=this.expression(),c||o("expected "+b+" expression")):m&&(c=(j(/^[^{;]+/)||"").trim(),c&&(c=new x.Anonymous(c))),this.comments(),p&&(g=this.blockRuleset()),g||!p&&c&&k(";")?(f(),new x.Directive(b,c,g,n,a.currentFileInfo,a.dumpLineNumbers?t(n,v,a):null)):void e()}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!k(",")))break;while(a);return b.length>0?new x.Value(b):void 0},important:function(){return"!"===v.charAt(y)?j(/^! *important/):void 0},sub:function(){var a,b;return k("(")&&(a=this.addition())?(b=new x.Expression([a]),n(")"),b.parens=!0,b):void 0},multiplication:function(){var a,b,c,g,i;if(a=this.operand()){for(i=h(v,y-1);;){if(p(/^\/[*\/]/))break;if(d(),c=k("/")||k("*"),!c){f();break}if(b=this.operand(),!b){e();break}f(),a.parensInOp=!0,b.parensInOp=!0,g=new x.Operation(c,[g||a,b],i),i=h(v,y-1)}return g||a}},addition:function(){var a,b,c,d,e;if(a=this.multiplication()){for(e=h(v,y-1);;){if(c=j(/^[-+]\s+/)||!e&&(k("+")||k("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new x.Operation(c,[d||a,b],e),e=h(v,y-1)}return d||a}},conditions:function(){var a,b,c,d=y;if(a=this.condition()){for(;;){if(!p(/^,\s*(not\s*)?\(/)||!k(","))break;if(b=this.condition(),!b)break;c=new x.Condition("or",c||a,b,d)}return c||a}},condition:function(){var a,b,c,d,e=this.entities,f=y,g=!1;return j(/^not/)&&(g=!0),n("("),a=this.addition()||e.keyword()||e.quoted(),a?(d=j(/^(?:>=|<=|=<|[<=>])/),d?(b=this.addition()||e.keyword()||e.quoted(),b?c=new x.Condition(d,a,b,f,g):o("expected expression")):c=new x.Condition("=",a,new x.Keyword("true"),f,g),n(")"),j(/^and/)?new x.Condition("and",c,this.condition()):c):void 0},operand:function(){var a,b=this.entities,c=v.charAt(y+1);"-"!==v.charAt(y)||"@"!==c&&"("!==c||(a=k("-"));var d=this.sub()||b.dimension()||b.color()||b.variable()||b.call();return a&&(d.parensInOp=!0,d=new x.Negative(d)),d},expression:function(){var a,b,c=[];do a=this.addition()||this.entity(),a&&(c.push(a),p(/^\/[\/*]/)||(b=k("/"),b&&c.push(new x.Anonymous(b))));while(a);return c.length>0?new x.Expression(c):void 0},property:function(){var a=j(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);return a?a[1]:void 0},ruleProperty:function(){function b(a){var b=a.exec(f);return b?(h.push(y+i),i+=b[0].length,f=f.slice(b[1].length),g.push(b[1])):void 0}function c(){var a=/^\s*\/\*(?:[^*]|\*+[^\/*])*\*+\//.exec(f);return a?(i+=a[0].length,f=f.slice(a[0].length),!0):!1}var d,e,f=C,g=[],h=[],i=0;for(b(/^(\*?)/);b(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/););for(;c(););if(g.length>1&&b(/^\s*((?:\+_|\+)?)\s*:/)){for(l(i),""===g[0]&&(g.shift(),h.shift()),e=0;e<g.length;e++)d=g[e],g[e]="@"!==d.charAt(0)?new x.Keyword(d):new x.Variable("@"+d.slice(2,-1),h[e],a.currentFileInfo);return g}}}}},w.Parser.serializeVars=function(a){var b="";for(var c in a)if(Object.hasOwnProperty.call(a,c)){var d=a[c];b+=("@"===c[0]?"":"@")+c+": "+d+(";"===(""+d).slice(-1)?"":";")}return b},function(d){function e(a,b,c){if(!(c instanceof d.Dimension))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d.Dimension(a(parseFloat(c.value)),b)}function f(a,b,c){var e,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;3>l;l++)e=b.rgb[l]/255,f=c.rgb[l]/255,h=a(e,f),g&&(h=(j*f+i*(e-j*(e+f-h)))/g),k[l]=255*h;return new d.Color(k,g)}function g(){var a,b=d.functions;for(a in l)l.hasOwnProperty(a)&&(b[a]=e.bind(null,Math[a],l[a]));for(a in m)m.hasOwnProperty(a)&&(b[a]=f.bind(null,m[a]));a=d.defaultFunc,b["default"]=a.eval.bind(a)}function h(a){return d.functions.hsla(a.h,a.s,a.l,a.a)}function i(a,b){return a instanceof d.Dimension&&a.unit.is("%")?parseFloat(a.value*b/100):j(a)}function j(a){if(a instanceof d.Dimension)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{error:"RuntimeError",message:"color functions take numbers as parameters"}}function k(a){return Math.min(1,Math.max(0,a))}d.functions={rgb:function(a,b,c){return this.rgba(a,b,c,1)},rgba:function(a,b,c,e){var f=[a,b,c].methodMap(function(a){return i(a,255)});return e=j(e),new d.Color(f,e)},hsl:function(a,b,c){return this.hsla(a,b,c,1)},hsla:function(a,b,c,d){function e(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?g+(f-g)*a*6:1>2*a?f:2>3*a?g+(f-g)*(2/3-a)*6:g}a=j(a)%360/360,b=k(j(b)),c=k(j(c)),d=k(j(d));var f=.5>=c?c*(b+1):c+b-c*b,g=2*c-f;return this.rgba(255*e(a+1/3),255*e(a),255*e(a-1/3),d)},hsv:function(a,b,c){return this.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=j(a)%360/360*360,b=j(b),c=j(c),d=j(d);var e,f;e=Math.floor(a/60%6),f=a/60-e;var g=[c,c*(1-b),c*(1-f*b),c*(1-(1-f)*b)],h=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return this.rgba(255*g[h[e][0]],255*g[h[e][1]],255*g[h[e][2]],d)},hue:function(a){return new d.Dimension(a.toHSL().h)},saturation:function(a){return new d.Dimension(100*a.toHSL().s,"%")},lightness:function(a){return new d.Dimension(100*a.toHSL().l,"%")},hsvhue:function(a){return new d.Dimension(a.toHSV().h)},hsvsaturation:function(a){return new d.Dimension(100*a.toHSV().s,"%")},hsvvalue:function(a){return new d.Dimension(100*a.toHSV().v,"%")},red:function(a){return new d.Dimension(a.rgb[0])},green:function(a){return new d.Dimension(a.rgb[1])},blue:function(a){return new d.Dimension(a.rgb[2])},alpha:function(a){return new d.Dimension(a.toHSL().a)},luma:function(a){return new d.Dimension(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new d.Dimension(b*a.alpha*100,"%")},saturate:function(a,b){if(!a.rgb)return null;var c=a.toHSL();return c.s+=b.value/100,c.s=k(c.s),h(c)},desaturate:function(a,b){var c=a.toHSL();return c.s-=b.value/100,c.s=k(c.s),h(c)},lighten:function(a,b){var c=a.toHSL();return c.l+=b.value/100,c.l=k(c.l),h(c)},darken:function(a,b){var c=a.toHSL();return c.l-=b.value/100,c.l=k(c.l),h(c)},fadein:function(a,b){var c=a.toHSL();return c.a+=b.value/100,c.a=k(c.a),h(c)},fadeout:function(a,b){var c=a.toHSL();return c.a-=b.value/100,c.a=k(c.a),h(c)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=k(c.a),h(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=0>d?360+d:d,h(c)},mix:function(a,b,c){c||(c=new d.Dimension(50));var e=c.value/100,f=2*e-1,g=a.toHSL().a-b.toHSL().a,h=((f*g==-1?f:(f+g)/(1+f*g))+1)/2,i=1-h,j=[a.rgb[0]*h+b.rgb[0]*i,a.rgb[1]*h+b.rgb[1]*i,a.rgb[2]*h+b.rgb[2]*i],k=a.alpha*e+b.alpha*(1-e);return new d.Color(j,k)},greyscale:function(a){return this.desaturate(a,new d.Dimension(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=this.rgba(255,255,255,1)),"undefined"==typeof b&&(b=this.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:j(d),a.luma()<d?c:b},e:function(a){return new d.Anonymous(a instanceof d.JavaScript?a.evaluated:a.value)},escape:function(a){return new d.Anonymous(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))\r
+},replace:function(a,b,c,e){var f=a.value;return f=f.replace(new RegExp(b.value,e?e.value:""),c.value),new d.Quoted(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e<b.length;e++)c=c.replace(/%[sda]/i,function(a){var c=a.match(/s/i)?b[e].value:b[e].toCSS();return a.match(/[A-Z]$/)?encodeURIComponent(c):c});return c=c.replace(/%%/g,"%"),new d.Quoted(a.quote||"",c,a.escaped)},unit:function(a,b){if(!(a instanceof d.Dimension))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof d.Operation?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d.Keyword?b.value:b.toCSS():"",new d.Dimension(a.value,b)},convert:function(a,b){return a.convertTo(b.value)},round:function(a,b){var c="undefined"==typeof b?0:b.value;return e(function(a){return a.toFixed(c)},null,a)},pi:function(){return new d.Dimension(Math.PI)},mod:function(a,b){return new d.Dimension(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d.Dimension(a),b=new d.Dimension(b);else if(!(a instanceof d.Dimension&&b instanceof d.Dimension))throw{type:"Argument",message:"arguments must be numbers"};return new d.Dimension(Math.pow(a.value,b.value),a.unit)},_minmax:function(a,c){switch(c=Array.prototype.slice.call(c),c.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var e,f,g,h,i,j,k,l,m=[],n={};for(e=0;e<c.length;e++)if(g=c[e],g instanceof d.Dimension)if(h=""===g.unit.toString()&&l!==b?new d.Dimension(g.value,l).unify():g.unify(),j=""===h.unit.toString()&&k!==b?k:h.unit.toString(),k=""!==j&&k===b||""!==j&&""===m[0].unify().unit.toString()?j:k,l=""!==j&&l===b?g.unit.toString():l,f=n[""]!==b&&""!==j&&j===k?n[""]:n[j],f!==b)i=""===m[f].unit.toString()&&l!==b?new d.Dimension(m[f].value,l).unify():m[f].unify(),(a&&h.value<i.value||!a&&h.value>i.value)&&(m[f]=g);else{if(k!==b&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(c[e].value)&&Array.prototype.push.apply(c,Array.prototype.slice.call(c[e].value));return 1==m.length?m[0]:(c=m.map(function(a){return a.toCSS(this.env)}).join(this.env.compress?",":", "),new d.Anonymous((a?"min":"max")+"("+c+")"))},min:function(){return this._minmax(!0,arguments)},max:function(){return this._minmax(!1,arguments)},"get-unit":function(a){return new d.Anonymous(a.unit)},argb:function(a){return new d.Anonymous(a.toARGB())},percentage:function(a){return new d.Dimension(100*a.value,"%")},color:function(a){if(a instanceof d.Quoted){var b,c=a.value;if(b=d.Color.fromKeyword(c))return b;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(c))return new d.Color(c.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}}throw{type:"Argument",message:"argument must be a string"}},iscolor:function(a){return this._isa(a,d.Color)},isnumber:function(a){return this._isa(a,d.Dimension)},isstring:function(a){return this._isa(a,d.Quoted)},iskeyword:function(a){return this._isa(a,d.Keyword)},isurl:function(a){return this._isa(a,d.URL)},ispixel:function(a){return this.isunit(a,"px")},ispercentage:function(a){return this.isunit(a,"%")},isem:function(a){return this.isunit(a,"em")},isunit:function(a,b){return a instanceof d.Dimension&&a.unit.is(b.value||b)?d.True:d.False},_isa:function(a,b){return a instanceof b?d.True:d.False},tint:function(a,b){return this.mix(this.rgb(255,255,255),a,b)},shade:function(a,b){return this.mix(this.rgb(0,0,0),a,b)},extract:function(a,b){return b=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){var b=Array.isArray(a.value)?a.value.length:1;return new d.Dimension(b)},"data-uri":function(b,e){if("undefined"!=typeof a)return new d.URL(e||b,this.currentFileInfo).eval(this.env);var f=b.value,g=e&&e.value,h=c("./fs"),i=c("path"),j=!1;arguments.length<2&&(g=f);var k=g.indexOf("#"),l="";if(-1!==k&&(l=g.slice(k),g=g.slice(0,k)),this.env.isPathRelative(g)&&(g=this.currentFileInfo.relativeUrls?i.join(this.currentFileInfo.currentDirectory,g):i.join(this.currentFileInfo.entryPath,g)),arguments.length<2){var m;try{m=c("mime")}catch(n){m=d._mime}f=m.lookup(g);var o=m.charsets.lookup(f);j=["US-ASCII","UTF-8"].indexOf(o)<0,j&&(f+=";base64")}else j=/;base64$/.test(f);var p=h.readFileSync(g),q=32,r=parseInt(p.length/1024,10);if(r>=q&&this.env.ieCompat!==!1)return this.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",g,r,q),new d.URL(e||b,this.currentFileInfo).eval(this.env);p=j?p.toString("base64"):encodeURIComponent(p);var s='"data:'+f+","+p+l+'"';return new d.URL(new d.Anonymous(s))},"svg-gradient":function(a){function e(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position]"}}arguments.length<3&&e();var f,g,h,i,j,k,l,m=Array.prototype.slice.call(arguments,1),n="linear",o='x="0" y="0" width="1" height="1"',p=!0,q={compress:!1},r=a.toCSS(q);switch(r){case"to bottom":f='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":f='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":f='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":f='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":n="radial",f='cx="50%" cy="50%" r="75%"',o='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(g='<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><'+n+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+f+">",h=0;h<m.length;h+=1)m[h].value?(i=m[h].value[0],j=m[h].value[1]):(i=m[h],j=b),i instanceof d.Color&&((0===h||h+1===m.length)&&j===b||j instanceof d.Dimension)||e(),k=j?j.toCSS(q):0===h?"0%":"100%",l=i.alpha,g+='<stop offset="'+k+'" stop-color="'+i.toRGB()+'"'+(1>l?' stop-opacity="'+l+'"':"")+"/>";if(g+="</"+n+"Gradient><rect "+o+' fill="url(#gradient)" /></svg>',p)try{g=c("./encoder").encodeBase64(g)}catch(s){p=!1}return g="'data:image/svg+xml"+(p?";base64":"")+","+g+"'",new d.URL(new d.Anonymous(g))}},d._mime={_types:{".htm":"text/html",".html":"text/html",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png"},lookup:function(a){var e=c("path").extname(a),f=d._mime._types[e];if(f===b)throw new Error('Optional dependency "mime" is required for '+e);return f},charsets:{lookup:function(a){return a&&/^text\//.test(a)?"UTF-8":""}}};var l={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"},m={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,1>=a?m.multiply(a,b):m.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return m.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};d.defaultFunc={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;return null!=a?a?d.True:d.False:void 0},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}},g(),d.fround=function(a,b){var c=a&&a.numPrecision;return null==c?b:Number((b+2e-16).toFixed(c))},d.functionCall=function(a,b){this.env=a,this.currentFileInfo=b},d.functionCall.prototype=d.functions}(c("./tree")),function(a){a.colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(c("./tree")),function(a){a.debugInfo=function(b,c,d){var e="";if(b.dumpLineNumbers&&!b.compress)switch(b.dumpLineNumbers){case"comments":e=a.debugInfo.asComment(c);break;case"mediaquery":e=a.debugInfo.asMediaQuery(c);break;case"all":e=a.debugInfo.asComment(c)+(d||"")+a.debugInfo.asMediaQuery(c)}return e},a.debugInfo.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},a.debugInfo.asMediaQuery=function(a){return"@media -sass-debug-info{filename{font-family:"+("file://"+a.debugInfo.fileName).replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},a.find=function(a,b){for(var c,d=0;d<a.length;d++)if(c=b.call(a,a[d]))return c;return null},a.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},a.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},a.outputRuleset=function(a,b,c){var d,e=c.length;if(a.tabLevel=(0|a.tabLevel)+1,a.compress){for(b.add("{"),d=0;e>d;d++)c[d].genCSS(a,b);return b.add("}"),void a.tabLevel--}var f="\n"+Array(a.tabLevel).join("  "),g=f+"  ";if(e){for(b.add(" {"+g),c[0].genCSS(a,b),d=1;e>d;d++)b.add(g),c[d].genCSS(a,b);b.add(f+"}")}else b.add(" {"+f+"}");a.tabLevel--}}(c("./tree")),function(a){a.Alpha=function(a){this.value=a},a.Alpha.prototype={type:"Alpha",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Alpha(this.value.eval(b)):this},genCSS:function(a,b){b.add("alpha(opacity="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value),b.add(")")},toCSS:a.toCSS}}(c("../tree")),function(a){a.Anonymous=function(a,b,c,d,e){this.value=a,this.index=b,this.mapLines=d,this.currentFileInfo=c,this.rulesetLike="undefined"==typeof e?!1:e},a.Anonymous.prototype={type:"Anonymous",eval:function(){return new a.Anonymous(this.value,this.index,this.currentFileInfo,this.mapLines,this.rulesetLike)},compare:function(a){if(!a.toCSS)return-1;var b=this.toCSS(),c=a.toCSS();return b===c?0:c>b?-1:1},isRulesetLike:function(){return this.rulesetLike},genCSS:function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Assignment=function(a,b){this.key=a,this.value=b},a.Assignment.prototype={type:"Assignment",accept:function(a){this.value=a.visit(this.value)},eval:function(b){return this.value.eval?new a.Assignment(this.key,this.value.eval(b)):this},genCSS:function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Call=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d},a.Call.prototype={type:"Call",accept:function(a){this.args&&(this.args=a.visitArray(this.args))},eval:function(b){var c,d,e=this.args.map(function(a){return a.eval(b)}),f=this.name.toLowerCase();if(f in a.functions)try{if(d=new a.functionCall(b,this.currentFileInfo),c=d[f].apply(d,e),null!=c)return c}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}return new a.Call(this.name,e,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;c<this.args.length;c++)this.args[c].genCSS(a,b),c+1<this.args.length&&b.add(", ");b.add(")")},toCSS:a.toCSS}}(c("../tree")),function(a){function b(a){return"#"+a.map(function(a){return a=c(Math.round(a),255),(16>a?"0":"")+a.toString(16)}).join("")}function c(a,b){return Math.min(Math.max(a,0),b)}a.Color=function(a,b){this.rgb=Array.isArray(a)?a:6==a.length?a.match(/.{2}/g).map(function(a){return parseInt(a,16)}):a.split("").map(function(a){return parseInt(a+a,16)}),this.alpha="number"==typeof b?b:1};var d="transparent";a.Color.prototype={type:"Color",eval:function(){return this},luma:function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255;return a=.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4),b=.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4),c=.03928>=c?c/12.92:Math.pow((c+.055)/1.055,2.4),.2126*a+.7152*b+.0722*c},genCSS:function(a,b){b.add(this.toCSS(a))},toCSS:function(b,e){var f=b&&b.compress&&!e,g=a.fround(b,this.alpha);if(1>g)return 0===g&&this.isTransparentKeyword?d:"rgba("+this.rgb.map(function(a){return c(Math.round(a),255)}).concat(c(g,1)).join(","+(f?"":" "))+")";var h=this.toRGB();if(f){var i=h.split("");i[1]===i[2]&&i[3]===i[4]&&i[5]===i[6]&&(h="#"+i[1]+i[3]+i[5])}return h},operate:function(b,c,d){for(var e=[],f=this.alpha*(1-d.alpha)+d.alpha,g=0;3>g;g++)e[g]=a.operate(b,c,this.rgb[g],d.rgb[g]);return new a.Color(e,f)},toRGB:function(){return b(this.rgb)},toHSL:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},toHSV:function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},toARGB:function(){return b([255*this.alpha].concat(this.rgb))},compare:function(a){return a.rgb&&a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:-1}},a.Color.fromKeyword=function(b){if(b=b.toLowerCase(),a.colors.hasOwnProperty(b))return new a.Color(a.colors[b].slice(1));if(b===d){var c=new a.Color([0,0,0],0);return c.isTransparentKeyword=!0,c}}}(c("../tree")),function(a){a.Comment=function(a,b,c,d){this.value=a,this.silent=!!b,this.currentFileInfo=d},a.Comment.prototype={type:"Comment",genCSS:function(b,c){this.debugInfo&&c.add(a.debugInfo(b,this),this.currentFileInfo,this.index),c.add(this.value.trim())},toCSS:a.toCSS,isSilent:function(a){var b=this.currentFileInfo&&this.currentFileInfo.reference&&!this.isReferenced,c=a.compress&&!this.value.match(/^\/\*!/);return this.silent||b||c},eval:function(){return this},markReferenced:function(){this.isReferenced=!0}}}(c("../tree")),function(a){a.Condition=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e},a.Condition.prototype={type:"Condition",accept:function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},eval:function(a){var b,c=this.lvalue.eval(a),d=this.rvalue.eval(a),e=this.index;return b=function(a){switch(a){case"and":return c&&d;case"or":return c||d;default:if(c.compare)b=c.compare(d);else{if(!d.compare)throw{type:"Type",message:"Unable to perform comparison",index:e};b=d.compare(c)}switch(b){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a}}}(this.op),this.negate?!b:b}}}(c("../tree")),function(a){a.DetachedRuleset=function(a,b){this.ruleset=a,this.frames=b},a.DetachedRuleset.prototype={type:"DetachedRuleset",accept:function(a){this.ruleset=a.visit(this.ruleset)},eval:function(b){var c=this.frames||b.frames.slice(0);return new a.DetachedRuleset(this.ruleset,c)},callEval:function(b){return this.ruleset.eval(this.frames?new a.evalEnv(b,this.frames.concat(b.frames)):b)}}}(c("../tree")),function(a){a.Dimension=function(c,d){this.value=parseFloat(c),this.unit=d&&d instanceof a.Unit?d:new a.Unit(d?[d]:b)},a.Dimension.prototype={type:"Dimension",accept:function(a){this.unit=a.visit(this.unit)},eval:function(){return this},toColor:function(){return new a.Color([this.value,this.value,this.value])},genCSS:function(b,c){if(b&&b.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var d=a.fround(b,this.value),e=String(d);if(0!==d&&1e-6>d&&d>-1e-6&&(e=d.toFixed(20).replace(/0+$/,"")),b&&b.compress){if(0===d&&this.unit.isLength())return void c.add(e);d>0&&1>d&&(e=e.substr(1))}c.add(e),this.unit.genCSS(b,c)},toCSS:a.toCSS,operate:function(b,c,d){var e=a.operate(b,c,this.value,d.value),f=this.unit.clone();if("+"===c||"-"===c)if(0===f.numerator.length&&0===f.denominator.length)f.numerator=d.unit.numerator.slice(0),f.denominator=d.unit.denominator.slice(0);else if(0===d.unit.numerator.length&&0===f.denominator.length);else{if(d=d.convertTo(this.unit.usedUnits()),b.strictUnits&&d.unit.toString()!==f.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+f.toString()+"' and '"+d.unit.toString()+"'.");e=a.operate(b,c,this.value,d.value)}else"*"===c?(f.numerator=f.numerator.concat(d.unit.numerator).sort(),f.denominator=f.denominator.concat(d.unit.denominator).sort(),f.cancel()):"/"===c&&(f.numerator=f.numerator.concat(d.unit.denominator).sort(),f.denominator=f.denominator.concat(d.unit.numerator).sort(),f.cancel());return new a.Dimension(e,f)},compare:function(b){if(b instanceof a.Dimension){var c,d,e,f;if(this.unit.isEmpty()||b.unit.isEmpty())c=this,d=b;else if(c=this.unify(),d=b.unify(),0!==c.unit.compare(d.unit))return-1;return e=c.value,f=d.value,f>e?-1:e>f?1:0}return-1},unify:function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},convertTo:function(b){var c,d,e,f,g,h=this.value,i=this.unit.clone(),j={};if("string"==typeof b){for(c in a.UnitConversions)a.UnitConversions[c].hasOwnProperty(b)&&(j={},j[c]=b);b=j}g=function(a,b){return e.hasOwnProperty(a)?(b?h/=e[a]/e[f]:h*=e[a]/e[f],f):a};for(d in b)b.hasOwnProperty(d)&&(f=b[d],e=a.UnitConversions[d],i.map(g));return i.cancel(),new a.Dimension(h,i)}},a.UnitConversions={length:{m:1,cm:.01,mm:.001,"in":.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}},a.Unit=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],this.backupUnit=c},a.Unit.prototype={type:"Unit",clone:function(){return new a.Unit(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},genCSS:function(a,b){this.numerator.length>=1?b.add(this.numerator[0]):this.denominator.length>=1?b.add(this.denominator[0]):a&&a.strictUnits||!this.backupUnit||b.add(this.backupUnit)},toCSS:a.toCSS,toString:function(){var a,b=this.numerator.join("*");for(a=0;a<this.denominator.length;a++)b+="/"+this.denominator[a];return b},compare:function(a){return this.is(a.toString())?0:-1},is:function(a){return this.toString()===a},isLength:function(){return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/))},isEmpty:function(){return 0===this.numerator.length&&0===this.denominator.length},isSingular:function(){return this.numerator.length<=1&&0===this.denominator.length},map:function(a){var b;for(b=0;b<this.numerator.length;b++)this.numerator[b]=a(this.numerator[b],!1);for(b=0;b<this.denominator.length;b++)this.denominator[b]=a(this.denominator[b],!0)},usedUnits:function(){var b,c,d={};c=function(a){return b.hasOwnProperty(a)&&!d[e]&&(d[e]=a),a};for(var e in a.UnitConversions)a.UnitConversions.hasOwnProperty(e)&&(b=a.UnitConversions[e],this.map(c));return d},cancel:function(){var a,b,c,d={};for(b=0;b<this.numerator.length;b++)a=this.numerator[b],c||(c=a),d[a]=(d[a]||0)+1;for(b=0;b<this.denominator.length;b++)a=this.denominator[b],c||(c=a),d[a]=(d[a]||0)-1;this.numerator=[],this.denominator=[];for(a in d)if(d.hasOwnProperty(a)){var e=d[a];if(e>0)for(b=0;e>b;b++)this.numerator.push(a);else if(0>e)for(b=0;-e>b;b++)this.denominator.push(a)}0===this.numerator.length&&0===this.denominator.length&&c&&(this.backupUnit=c),this.numerator.sort(),this.denominator.sort()}}}(c("../tree")),function(a){a.Directive=function(a,b,c,d,e,f){this.name=a,this.value=b,c&&(this.rules=c,this.rules.allowImports=!0),this.index=d,this.currentFileInfo=e,this.debugInfo=f},a.Directive.prototype={type:"Directive",accept:function(a){var b=this.value,c=this.rules;c&&(c=a.visit(c)),b&&(b=a.visit(b))},isRulesetLike:function(){return!this.isCharset()},isCharset:function(){return"@charset"===this.name},genCSS:function(b,c){var d=this.value,e=this.rules;c.add(this.name,this.currentFileInfo,this.index),d&&(c.add(" "),d.genCSS(b,c)),e?a.outputRuleset(b,c,[e]):c.add(";")},toCSS:a.toCSS,eval:function(b){var c=this.value,d=this.rules;return c&&(c=c.eval(b)),d&&(d=d.eval(b),d.root=!0),new a.Directive(this.name,c,d,this.index,this.currentFileInfo,this.debugInfo)},variable:function(b){return this.rules?a.Ruleset.prototype.variable.call(this.rules,b):void 0},find:function(){return this.rules?a.Ruleset.prototype.find.apply(this.rules,arguments):void 0},rulesets:function(){return this.rules?a.Ruleset.prototype.rulesets.apply(this.rules):void 0},markReferenced:function(){var a,b;if(this.isReferenced=!0,this.rules)for(b=this.rules.rules,a=0;a<b.length;a++)b[a].markReferenced&&b[a].markReferenced()}}}(c("../tree")),function(a){a.Element=function(b,c,d,e){this.combinator=b instanceof a.Combinator?b:new a.Combinator(b),this.value="string"==typeof c?c.trim():c?c:"",this.index=d,this.currentFileInfo=e},a.Element.prototype={type:"Element",accept:function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},eval:function(b){return new a.Element(this.combinator,this.value.eval?this.value.eval(b):this.value,this.index,this.currentFileInfo)},genCSS:function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},toCSS:function(a){var b=this.value.toCSS?this.value.toCSS(a):this.value;return""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a||{})+b}},a.Attribute=function(a,b,c){this.key=a,this.op=b,this.value=c},a.Attribute.prototype={type:"Attribute",eval:function(b){return new a.Attribute(this.key.eval?this.key.eval(b):this.key,this.op,this.value&&this.value.eval?this.value.eval(b):this.value)},genCSS:function(a,b){b.add(this.toCSS(a))},toCSS:function(a){var b=this.key.toCSS?this.key.toCSS(a):this.key;return this.op&&(b+=this.op,b+=this.value.toCSS?this.value.toCSS(a):this.value),"["+b+"]"}},a.Combinator=function(a){this.value=" "===a?" ":a?a.trim():""},a.Combinator.prototype={type:"Combinator",_noSpaceCombinators:{"":!0," ":!0,"|":!0},genCSS:function(a,b){var c=a.compress||this._noSpaceCombinators[this.value]?"":" ";b.add(c+this.value+c)},toCSS:a.toCSS}}(c("../tree")),function(a){a.Expression=function(a){this.value=a},a.Expression.prototype={type:"Expression",accept:function(a){this.value&&(this.value=a.visitArray(this.value))},eval:function(b){var c,d=this.parens&&!this.parensInOp,e=!1;return d&&b.inParenthesis(),this.value.length>1?c=new a.Expression(this.value.map(function(a){return a.eval(b)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(e=!0),c=this.value[0].eval(b)):c=this,d&&b.outOfParenthesis(),this.parens&&this.parensInOp&&!b.isMathOn()&&!e&&(c=new a.Paren(c)),c},genCSS:function(a,b){for(var c=0;c<this.value.length;c++)this.value[c].genCSS(a,b),c+1<this.value.length&&b.add(" ")},toCSS:a.toCSS,throwAwayComments:function(){this.value=this.value.filter(function(b){return!(b instanceof a.Comment)})}}}(c("../tree")),function(a){a.Extend=function(b,c,d){switch(this.selector=b,this.option=c,this.index=d,this.object_id=a.Extend.next_id++,this.parent_ids=[this.object_id],c){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}},a.Extend.next_id=0,a.Extend.prototype={type:"Extend",accept:function(a){this.selector=a.visit(this.selector)},eval:function(b){return new a.Extend(this.selector.eval(b),this.option,this.index)},clone:function(){return new a.Extend(this.selector,this.option,this.index)},findSelfSelectors:function(a){var b,c,d=[];for(b=0;b<a.length;b++)c=a[b].elements,b>0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[{elements:d}]}}}(c("../tree")),function(a){a.Import=function(a,c,d,e,f){if(this.options=d,this.index=e,this.path=a,this.features=c,this.currentFileInfo=f,this.options.less!==b||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/css([\?;].*)?$/.test(g)&&(this.css=!0)}},a.Import.prototype={type:"Import",accept:function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),!this.options.inline&&this.root&&(this.root=a.visit(this.root))},genCSS:function(a,b){this.css&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},toCSS:a.toCSS,getPath:function(){if(this.path instanceof a.Quoted){var c=this.path.value;return this.css!==b||/(\.[a-z]*$)|([\?;].*)$/.test(c)?c:c+".less"}return this.path instanceof a.URL?this.path.value.value:null},evalForImport:function(b){return new a.Import(this.path.eval(b),this.features,this.options,this.index,this.currentFileInfo)},evalPath:function(b){var c=this.path.eval(b),d=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(c instanceof a.URL)){if(d){var e=c.value;e&&b.isPathRelative(e)&&(c.value=d+e)}c.value=b.normalizePath(c.value)}return c},eval:function(b){var c,d=this.features&&this.features.eval(b);if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var e=new a.Anonymous(this.root,0,{filename:this.importedFilename},!0,!0);return this.features?new a.Media([e],this.features.value):[e]}if(this.css){var f=new a.Import(this.evalPath(b),d,this.options,this.index);if(!f.css&&this.error)throw this.error;return f}return c=new a.Ruleset(null,this.root.rules.slice(0)),c.evalImports(b),this.features?new a.Media(c.rules,this.features.value):c.rules}}}(c("../tree")),function(a){a.JavaScript=function(a,b,c){this.escaped=c,this.expression=a,this.index=b},a.JavaScript.prototype={type:"JavaScript",eval:function(b){var c,d=this,e={},f=this.expression.replace(/@\{([\w-]+)\}/g,function(c,e){return a.jsify(new a.Variable("@"+e,d.index).eval(b))});try{f=new Function("return ("+f+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+f+"`",index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(e[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=f.call(e)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",index:this.index}}return"number"==typeof c?new a.Dimension(c):"string"==typeof c?new a.Quoted('"'+c+'"',c,this.escaped,this.index):new a.Anonymous(Array.isArray(c)?c.join(", "):c)}}}(c("../tree")),function(a){a.Keyword=function(a){this.value=a},a.Keyword.prototype={type:"Keyword",eval:function(){return this},genCSS:function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},toCSS:a.toCSS,compare:function(b){return b instanceof a.Keyword?b.value===this.value?0:1:-1}},a.True=new a.Keyword("true"),a.False=new a.Keyword("false")}(c("../tree")),function(a){a.Media=function(b,c,d,e){this.index=d,this.currentFileInfo=e;var f=this.emptySelectors();this.features=new a.Value(c),this.rules=[new a.Ruleset(f,b)],this.rules[0].allowImports=!0},a.Media.prototype={type:"Media",accept:function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},genCSS:function(b,c){c.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(b,c),a.outputRuleset(b,c,this.rules)},toCSS:a.toCSS,eval:function(b){b.mediaBlocks||(b.mediaBlocks=[],b.mediaPath=[]);var c=new a.Media(null,[],this.index,this.currentFileInfo);this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,c.debugInfo=this.debugInfo);var d=!1;b.strictMath||(d=!0,b.strictMath=!0);try{c.features=this.features.eval(b)}finally{d&&(b.strictMath=!1)}return b.mediaPath.push(c),b.mediaBlocks.push(c),b.frames.unshift(this.rules[0]),c.rules=[this.rules[0].eval(b)],b.frames.shift(),b.mediaPath.pop(),0===b.mediaPath.length?c.evalTop(b):c.evalNested(b)},variable:function(b){return a.Ruleset.prototype.variable.call(this.rules[0],b)},find:function(){return a.Ruleset.prototype.find.apply(this.rules[0],arguments)},rulesets:function(){return a.Ruleset.prototype.rulesets.apply(this.rules[0])},emptySelectors:function(){var b=new a.Element("","&",this.index,this.currentFileInfo),c=[new a.Selector([b],null,null,this.index,this.currentFileInfo)];return c[0].mediaEmpty=!0,c},markReferenced:function(){var a,b=this.rules[0].rules;for(this.rules[0].markReferenced(),this.isReferenced=!0,a=0;a<b.length;a++)b[a].markReferenced&&b[a].markReferenced()},evalTop:function(b){var c=this;if(b.mediaBlocks.length>1){var d=this.emptySelectors();c=new a.Ruleset(d,b.mediaBlocks),c.multiMedia=!0}return delete b.mediaBlocks,delete b.mediaPath,c},evalNested:function(b){var c,d,e=b.mediaPath.concat([this]);for(c=0;c<e.length;c++)d=e[c].features instanceof a.Value?e[c].features.value:e[c].features,e[c]=Array.isArray(d)?d:[d];return this.features=new a.Value(this.permute(e).map(function(b){for(b=b.map(function(b){return b.toCSS?b:new a.Anonymous(b)}),c=b.length-1;c>0;c--)b.splice(c,0,new a.Anonymous("and"));return new a.Expression(b)})),new a.Ruleset([],[])},permute:function(a){if(0===a.length)return[];\r
+if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d<c.length;d++)for(var e=0;e<a[0].length;e++)b.push([a[0][e]].concat(c[d]));return b},bubbleSelectors:function(b){b&&(this.rules=[new a.Ruleset(b.slice(0),[this.rules[0]])])}}}(c("../tree")),function(a){a.mixin={},a.mixin.Call=function(b,c,d,e,f){this.selector=new a.Selector(b),this.arguments=c&&c.length?c:null,this.index=d,this.currentFileInfo=e,this.important=f},a.mixin.Call.prototype={type:"MixinCall",accept:function(a){this.selector&&(this.selector=a.visit(this.selector)),this.arguments&&(this.arguments=a.visitArray(this.arguments))},eval:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p=[],q=!1,r=[],s=[],t=a.defaultFunc,u=0,v=1,w=2;for(e=this.arguments&&this.arguments.map(function(a){return{name:a.name,value:a.value.eval(b)}}),f=0;f<b.frames.length;f++)if((c=b.frames[f].find(this.selector)).length>0){for(j=!0,g=0;g<c.length;g++){for(d=c[g],i=!1,h=0;h<b.frames.length;h++)if(!(d instanceof a.mixin.Definition)&&d===(b.frames[h].originalRuleset||b.frames[h])){i=!0;break}if(!i&&d.matchArgs(e,b)){if(l={mixin:d,group:u},d.matchCondition){for(h=0;2>h;h++)t.value(h),s[h]=d.matchCondition(e,b);(s[0]||s[1])&&(s[0]!=s[1]&&(l.group=s[1]?v:w),r.push(l))}else r.push(l);q=!0}}for(t.reset(),n=[0,0,0],g=0;g<r.length;g++)n[r[g].group]++;if(n[u]>0)m=w;else if(m=v,n[v]+n[w]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename};for(g=0;g<r.length;g++)if(l=r[g].group,l===u||l===m)try{d=r[g].mixin,d instanceof a.mixin.Definition||(o=d.originalRuleset||d,d=new a.mixin.Definition("",[],d.rules,null,!1),d.originalRuleset=o),Array.prototype.push.apply(p,d.evalCall(b,e,this.important).rules)}catch(x){throw{message:x.message,index:this.index,filename:this.currentFileInfo.filename,stack:x.stack}}if(q){if(!this.currentFileInfo||!this.currentFileInfo.reference)for(f=0;f<p.length;f++)k=p[f],k.markReferenced&&k.markReferenced();return p}}throw j?{type:"Runtime",message:"No matching definition was found for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}},format:function(a){return this.selector.toCSS().trim()+"("+(a?a.map(function(a){var b="";return a.name&&(b+=a.name+":"),b+=a.value.toCSS?a.value.toCSS():"???"}).join(", "):"")+")"}},a.mixin.Definition=function(b,c,d,e,f,g){this.name=b,this.selectors=[new a.Selector([new a.Element(null,b,this.index,this.currentFileInfo)])],this.params=c,this.condition=e,this.variadic=f,this.arity=c.length,this.rules=d,this._lookups={},this.required=c.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:a},0),this.parent=a.Ruleset.prototype,this.frames=g},a.mixin.Definition.prototype={type:"MixinDefinition",accept:function(a){this.params&&this.params.length&&(this.params=a.visitArray(this.params)),this.rules=a.visitArray(this.rules),this.condition&&(this.condition=a.visit(this.condition))},variable:function(a){return this.parent.variable.call(this,a)},variables:function(){return this.parent.variables.call(this)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},evalParams:function(b,c,d,e){var f,g,h,i,j,k,l,m,n=new a.Ruleset(null,null),o=this.params.slice(0),p=0;if(c=new a.evalEnv(c,[n].concat(c.frames)),d)for(d=d.slice(0),p=d.length,h=0;p>h;h++)if(g=d[h],k=g&&g.name){for(l=!1,i=0;i<o.length;i++)if(!e[i]&&k===o[i].name){e[i]=g.value.eval(b),n.prependRule(new a.Rule(k,g.value.eval(b))),l=!0;break}if(l){d.splice(h,1),h--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+d[h].name+" not found"}}for(m=0,h=0;h<o.length;h++)if(!e[h]){if(g=d&&d[m],k=o[h].name)if(o[h].variadic){for(f=[],i=m;p>i;i++)f.push(d[i].value.eval(b));n.prependRule(new a.Rule(k,new a.Expression(f).eval(b)))}else{if(j=g&&g.value)j=j.eval(b);else{if(!o[h].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+p+" for "+this.arity+")"};j=o[h].value.eval(c),n.resetCache()}n.prependRule(new a.Rule(k,j)),e[h]=j}if(o[h].variadic&&d)for(i=m;p>i;i++)e[i]=d[i].value.eval(b);m++}return n},eval:function(b){return new a.mixin.Definition(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||b.frames.slice(0))},evalCall:function(b,c,d){var e,f,g=[],h=this.frames?this.frames.concat(b.frames):b.frames,i=this.evalParams(b,new a.evalEnv(b,h),c,g);return i.prependRule(new a.Rule("@arguments",new a.Expression(g).eval(b))),e=this.rules.slice(0),f=new a.Ruleset(null,e),f.originalRuleset=this,f=f.eval(new a.evalEnv(b,[this,i].concat(h))),d&&(f=this.parent.makeImportant.apply(f)),f},matchCondition:function(b,c){return this.condition&&!this.condition.eval(new a.evalEnv(c,[this.evalParams(c,new a.evalEnv(c,this.frames?this.frames.concat(c.frames):c.frames),b,[])].concat(this.frames).concat(c.frames)))?!1:!0},matchArgs:function(a,b){var c,d=a&&a.length||0;if(this.variadic){if(d<this.required-1)return!1}else{if(d<this.required)return!1;if(d>this.params.length)return!1}c=Math.min(d,this.arity);for(var e=0;c>e;e++)if(!this.params[e].name&&!this.params[e].variadic&&a[e].value.eval(b).toCSS()!=this.params[e].value.eval(b).toCSS())return!1;return!0}}}(c("../tree")),function(a){a.Negative=function(a){this.value=a},a.Negative.prototype={type:"Negative",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("-"),this.value.genCSS(a,b)},toCSS:a.toCSS,eval:function(b){return b.isMathOn()?new a.Operation("*",[new a.Dimension(-1),this.value]).eval(b):new a.Negative(this.value.eval(b))}}}(c("../tree")),function(a){a.Operation=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c},a.Operation.prototype={type:"Operation",accept:function(a){this.operands=a.visit(this.operands)},eval:function(b){var c=this.operands[0].eval(b),d=this.operands[1].eval(b);if(b.isMathOn()){if(c instanceof a.Dimension&&d instanceof a.Color&&(c=c.toColor()),d instanceof a.Dimension&&c instanceof a.Color&&(d=d.toColor()),!c.operate)throw{type:"Operation",message:"Operation on an invalid type"};return c.operate(b,this.op,d)}return new a.Operation(this.op,[c,d],this.isSpaced)},genCSS:function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},toCSS:a.toCSS},a.operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}}}(c("../tree")),function(a){a.Paren=function(a){this.value=a},a.Paren.prototype={type:"Paren",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){return new a.Paren(this.value.eval(b))}}}(c("../tree")),function(a){a.Quoted=function(a,b,c,d,e){this.escaped=c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e},a.Quoted.prototype={type:"Quoted",genCSS:function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},toCSS:a.toCSS,eval:function(b){var c=this,d=this.value.replace(/`([^`]+)`/g,function(d,e){return new a.JavaScript(e,c.index,!0).eval(b).value}).replace(/@\{([\w-]+)\}/g,function(d,e){var f=new a.Variable("@"+e,c.index,c.currentFileInfo).eval(b,!0);return f instanceof a.Quoted?f.value:f.toCSS()});return new a.Quoted(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},compare:function(a){if(!a.toCSS)return-1;var b,c;return"Quoted"!==a.type||this.escaped||a.escaped?(b=this.toCSS(),c=a.toCSS()):(b=a.value,c=this.value),b===c?0:c>b?-1:1}}}(c("../tree")),function(a){function c(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;e>c;c++)b[c].eval(a).genCSS(a,f);return d}a.Rule=function(c,d,e,f,g,h,i,j){this.name=c,this.value=d instanceof a.Value||d instanceof a.Ruleset?d:new a.Value([d]),this.important=e?" "+e.trim():"",this.merge=f,this.index=g,this.currentFileInfo=h,this.inline=i||!1,this.variable=j!==b?j:c.charAt&&"@"===c.charAt(0)},a.Rule.prototype={type:"Rule",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},toCSS:a.toCSS,eval:function(b){var d,e=!1,f=this.name,g=this.variable;"string"!=typeof f&&(f=1===f.length&&f[0]instanceof a.Keyword?f[0].value:c(b,f),g=!1),"font"!==f||b.strictMath||(e=!0,b.strictMath=!0);try{if(d=this.value.eval(b),!this.variable&&"DetachedRuleset"===d.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};return new a.Rule(f,d,this.important,this.merge,this.index,this.currentFileInfo,this.inline,g)}catch(h){throw"number"!=typeof h.index&&(h.index=this.index,h.filename=this.currentFileInfo.filename),h}finally{e&&(b.strictMath=!1)}},makeImportant:function(){return new a.Rule(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)}}}(c("../tree")),function(a){a.RulesetCall=function(a){this.variable=a},a.RulesetCall.prototype={type:"RulesetCall",accept:function(){},eval:function(b){var c=new a.Variable(this.variable).eval(b);return c.callEval(b)}}}(c("../tree")),function(a){a.Ruleset=function(a,b,c){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c},a.Ruleset.prototype={type:"Ruleset",accept:function(a){this.paths?a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},eval:function(b){var c,d,e,f,g=this.selectors,h=a.defaultFunc,i=!1;if(g&&(d=g.length)){for(c=[],h.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),f=0;d>f;f++)e=g[f].eval(b),c.push(e),e.evaldCondition&&(i=!0);h.reset()}else i=!0;var j,k,l=this.rules?this.rules.slice(0):null,m=new a.Ruleset(c,l,this.strictImports);m.originalRuleset=this,m.root=this.root,m.firstRoot=this.firstRoot,m.allowImports=this.allowImports,this.debugInfo&&(m.debugInfo=this.debugInfo),i||(l.length=0);var n=b.frames;n.unshift(m);var o=b.selectors;o||(b.selectors=o=[]),o.unshift(this.selectors),(m.root||m.allowImports||!m.strictImports)&&m.evalImports(b);var p=m.rules,q=p?p.length:0;for(f=0;q>f;f++)(p[f]instanceof a.mixin.Definition||p[f]instanceof a.DetachedRuleset)&&(p[f]=p[f].eval(b));var r=b.mediaBlocks&&b.mediaBlocks.length||0;for(f=0;q>f;f++)p[f]instanceof a.mixin.Call?(l=p[f].eval(b).filter(function(b){return b instanceof a.Rule&&b.variable?!m.variable(b.name):!0}),p.splice.apply(p,[f,1].concat(l)),q+=l.length-1,f+=l.length-1,m.resetCache()):p[f]instanceof a.RulesetCall&&(l=p[f].eval(b).rules.filter(function(b){return b instanceof a.Rule&&b.variable?!1:!0}),p.splice.apply(p,[f,1].concat(l)),q+=l.length-1,f+=l.length-1,m.resetCache());for(f=0;f<p.length;f++)j=p[f],j instanceof a.mixin.Definition||j instanceof a.DetachedRuleset||(p[f]=j=j.eval?j.eval(b):j);for(f=0;f<p.length;f++)if(j=p[f],j instanceof a.Ruleset&&j.selectors&&1===j.selectors.length&&j.selectors[0].isJustParentSelector()){p.splice(f--,1);for(var s=0;s<j.rules.length;s++)k=j.rules[s],k instanceof a.Rule&&k.variable||p.splice(++f,0,k)}if(n.shift(),o.shift(),b.mediaBlocks)for(f=r;f<b.mediaBlocks.length;f++)b.mediaBlocks[f].bubbleSelectors(c);return m},evalImports:function(b){var c,d,e=this.rules;if(e)for(c=0;c<e.length;c++)e[c]instanceof a.Import&&(d=e[c].eval(b),d&&d.length?(e.splice.apply(e,[c,1].concat(d)),c+=d.length-1):e.splice(c,1,d),this.resetCache())},makeImportant:function(){return new a.Ruleset(this.selectors,this.rules.map(function(a){return a.makeImportant?a.makeImportant():a}),this.strictImports)},matchArgs:function(a){return!a||0===a.length},matchCondition:function(b,c){var d=this.selectors[this.selectors.length-1];return d.evaldCondition?d.condition&&!d.condition.eval(new a.evalEnv(c,c.frames))?!1:!0:!1},resetCache:function(){this._rulesets=null,this._variables=null,this._lookups={}},variables:function(){return this._variables||(this._variables=this.rules?this.rules.reduce(function(b,c){return c instanceof a.Rule&&c.variable===!0&&(b[c.name]=c),b},{}):{}),this._variables},variable:function(a){return this.variables()[a]},rulesets:function(){if(!this.rules)return null;var b,c,d=a.Ruleset,e=a.mixin.Definition,f=[],g=this.rules,h=g.length;for(b=0;h>b;b++)c=g[b],(c instanceof d||c instanceof e)&&f.push(c);return f},prependRule:function(a){var b=this.rules;b?b.unshift(a):this.rules=[a]},find:function(b,c){c=c||this;var d,e=[],f=b.toCSS();return f in this._lookups?this._lookups[f]:(this.rulesets().forEach(function(f){if(f!==c)for(var g=0;g<f.selectors.length;g++)if(d=b.match(f.selectors[g])){b.elements.length>d?Array.prototype.push.apply(e,f.find(new a.Selector(b.elements.slice(d)),c)):e.push(f);break}}),this._lookups[f]=e,e)},genCSS:function(b,c){function d(b,c){return b.rules?!0:b instanceof a.Media||c&&b instanceof a.Comment?!0:b instanceof a.Directive||b instanceof a.Anonymous?b.isRulesetLike():!1}var e,f,g,h,i,j,k=[],l=[],m=[];b.tabLevel=b.tabLevel||0,this.root||b.tabLevel++;var n,o=b.compress?"":Array(b.tabLevel+1).join("  "),p=b.compress?"":Array(b.tabLevel).join("  ");for(e=0;e<this.rules.length;e++)i=this.rules[e],d(i,this.root)?m.push(i):i.isCharset&&i.isCharset()?k.push(i):l.push(i);if(l=k.concat(l),!this.root){h=a.debugInfo(b,this,p),h&&(c.add(h),c.add(p));var q,r=this.paths,s=r.length;for(n=b.compress?",":",\n"+p,e=0;s>e;e++)if(j=r[e],q=j.length)for(e>0&&c.add(n),b.firstSelector=!0,j[0].genCSS(b,c),b.firstSelector=!1,f=1;q>f;f++)j[f].genCSS(b,c);c.add((b.compress?"{":" {\n")+o)}for(e=0;e<l.length;e++)i=l[e],e+1!==l.length||this.root&&0!==m.length&&!this.firstRoot||(b.lastRule=!0),i.genCSS?i.genCSS(b,c):i.value&&c.add(i.value.toString()),b.lastRule?b.lastRule=!1:c.add(b.compress?"":"\n"+o);if(this.root||(c.add(b.compress?"}":"\n"+p+"}"),b.tabLevel--),n=(b.compress?"":"\n")+(this.root?o:p),g=m.length)for(l.length&&n&&c.add(n),m[0].genCSS(b,c),e=1;g>e;e++)n&&c.add(n),m[e].genCSS(b,c);c.isEmpty()||b.compress||!this.firstRoot||c.add("\n")},toCSS:a.toCSS,markReferenced:function(){if(this.selectors)for(var a=0;a<this.selectors.length;a++)this.selectors[a].markReferenced()},joinSelectors:function(a,b,c){for(var d=0;d<c.length;d++)this.joinSelector(a,b,c[d])},joinSelector:function(b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;for(e=0;e<d.elements.length;e++)j=d.elements[e],"&"===j.value&&(h=!0);if(h){for(r=[],i=[[]],e=0;e<d.elements.length;e++)if(j=d.elements[e],"&"!==j.value)r.push(j);else{for(s=[],r.length>0&&this.mergeElementsOnToSelectors(r,i),f=0;f<i.length;f++)if(k=i[f],0===c.length)k.length>0&&(k[0].elements=k[0].elements.slice(0),k[0].elements.push(new a.Element(j.combinator,"",j.index,j.currentFileInfo))),s.push(k);else for(g=0;g<c.length;g++)l=c[g],m=[],n=[],p=!0,k.length>0?(m=k.slice(0),q=m.pop(),o=d.createDerived(q.elements.slice(0)),p=!1):o=d.createDerived([]),l.length>1&&(n=n.concat(l.slice(1))),l.length>0&&(p=!1,o.elements.push(new a.Element(j.combinator,l[0].elements[0].value,j.index,j.currentFileInfo)),o.elements=o.elements.concat(l[0].elements.slice(1))),p||m.push(o),m=m.concat(n),s.push(m);i=s,r=[]}for(r.length>0&&this.mergeElementsOnToSelectors(r,i),e=0;e<i.length;e++)i[e].length>0&&b.push(i[e])}else if(c.length>0)for(e=0;e<c.length;e++)b.push(c[e].concat(d));else b.push([d])},mergeElementsOnToSelectors:function(b,c){var d,e;if(0===c.length)return void c.push([new a.Selector(b)]);for(d=0;d<c.length;d++)e=c[d],e.length>0?e[e.length-1]=e[e.length-1].createDerived(e[e.length-1].elements.concat(b)):e.push(new a.Selector(b))}}}(c("../tree")),function(a){a.Selector=function(a,b,c,d,e,f){this.elements=a,this.extendList=b,this.condition=c,this.currentFileInfo=e||{},this.isReferenced=f,c||(this.evaldCondition=!0)},a.Selector.prototype={type:"Selector",accept:function(a){this.elements&&(this.elements=a.visitArray(this.elements)),this.extendList&&(this.extendList=a.visitArray(this.extendList)),this.condition&&(this.condition=a.visit(this.condition))},createDerived:function(b,c,d){d=null!=d?d:this.evaldCondition;var e=new a.Selector(b,c||this.extendList,null,this.index,this.currentFileInfo,this.isReferenced);return e.evaldCondition=d,e.mediaEmpty=this.mediaEmpty,e},match:function(a){var b,c,d=this.elements,e=d.length;if(a.CacheElements(),b=a._elements.length,0===b||b>e)return 0;for(c=0;b>c;c++)if(d[c].value!==a._elements[c])return 0;return b},CacheElements:function(){var a,b,c,d="";if(!this._elements){for(a=this.elements.length,c=0;a>c;c++)if(b=this.elements[c],d+=b.combinator.value,b.value.value){if("string"!=typeof b.value.value){d="";break}d+=b.value.value}else d+=b.value;this._elements=d.match(/[,&#\*\.\w-]([\w-]|(\\.))*/g),this._elements?"&"===this._elements[0]&&this._elements.shift():this._elements=[]}},isJustParentSelector:function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},eval:function(a){var b=this.condition&&this.condition.eval(a),c=this.elements,d=this.extendList;return c=c&&c.map(function(b){return b.eval(a)}),d=d&&d.map(function(b){return b.eval(a)}),this.createDerived(c,d,b)},genCSS:function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;c<this.elements.length;c++)d=this.elements[c],d.genCSS(a,b)},toCSS:a.toCSS,markReferenced:function(){this.isReferenced=!0},getIsReferenced:function(){return!this.currentFileInfo.reference||this.isReferenced},getIsOutput:function(){return this.evaldCondition}}}(c("../tree")),function(a){a.UnicodeDescriptor=function(a){this.value=a},a.UnicodeDescriptor.prototype={type:"UnicodeDescriptor",genCSS:function(a,b){b.add(this.value)},toCSS:a.toCSS,eval:function(){return this}}}(c("../tree")),function(a){a.URL=function(a,b,c){this.value=a,this.currentFileInfo=b,this.isEvald=c},a.URL.prototype={type:"Url",accept:function(a){this.value=a.visit(this.value)},genCSS:function(a,b){b.add("url("),this.value.genCSS(a,b),b.add(")")},toCSS:a.toCSS,eval:function(b){var c,d=this.value.eval(b);if(!this.isEvald&&(c=this.currentFileInfo&&this.currentFileInfo.rootpath,c&&"string"==typeof d.value&&b.isPathRelative(d.value)&&(d.quote||(c=c.replace(/[\(\)'"\s]/g,function(a){return"\\"+a})),d.value=c+d.value),d.value=b.normalizePath(d.value),b.urlArgs&&!d.value.match(/^\s*data:/))){var e=-1===d.value.indexOf("?")?"?":"&",f=e+b.urlArgs;-1!==d.value.indexOf("#")?d.value=d.value.replace("#",f+"#"):d.value+=f}return new a.URL(d,this.currentFileInfo,!0)}}}(c("../tree")),function(a){a.Value=function(a){this.value=a},a.Value.prototype={type:"Value",accept:function(a){this.value&&(this.value=a.visitArray(this.value))},eval:function(b){return 1===this.value.length?this.value[0].eval(b):new a.Value(this.value.map(function(a){return a.eval(b)}))},genCSS:function(a,b){var c;for(c=0;c<this.value.length;c++)this.value[c].genCSS(a,b),c+1<this.value.length&&b.add(a&&a.compress?",":", ")},toCSS:a.toCSS}}(c("../tree")),function(a){a.Variable=function(a,b,c){this.name=a,this.index=b,this.currentFileInfo=c||{}},a.Variable.prototype={type:"Variable",eval:function(b){var c,d=this.name;if(0===d.indexOf("@@")&&(d="@"+new a.Variable(d.slice(1)).eval(b).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+d,filename:this.currentFileInfo.file,index:this.index};if(this.evaluating=!0,c=a.find(b.frames,function(a){var c=a.variable(d);return c?c.value.eval(b):void 0}))return this.evaluating=!1,c;throw{type:"Name",message:"variable "+d+" is undefined",filename:this.currentFileInfo.filename,index:this.index}}}}(c("../tree")),function(a){var b=["paths","optimization","files","contents","contentsIgnoredChars","relativeUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","processImports","syncImport","javascriptEnabled","mime","useFileCache","currentFileInfo"];a.parseEnv=function(a){if(d(a,this,b),this.contents||(this.contents={}),this.contentsIgnoredChars||(this.contentsIgnoredChars={}),this.files||(this.files={}),"string"==typeof this.paths&&(this.paths=[this.paths]),!this.currentFileInfo){var c=a&&a.filename||"input",e=c.replace(/[^\/\\]*$/,"");a&&(a.filename=null),this.currentFileInfo={filename:c,relativeUrls:this.relativeUrls,rootpath:a&&a.rootpath||"",currentDirectory:e,entryPath:e,rootFilename:c}}};var c=["silent","verbose","compress","yuicompress","ieCompat","strictMath","strictUnits","cleancss","sourceMap","importMultiple","urlArgs"];a.evalEnv=function(a,b){d(a,this,c),this.frames=b||[]},a.evalEnv.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},a.evalEnv.prototype.outOfParenthesis=function(){this.parensStack.pop()},a.evalEnv.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0},a.evalEnv.prototype.isPathRelative=function(a){return!/^(?:[a-z-]+:|\/)/.test(a)},a.evalEnv.prototype.normalizePath=function(a){var b,c=a.split("/").reverse();for(a=[];0!==c.length;)switch(b=c.pop()){case".":break;case"..":0===a.length||".."===a[a.length-1]?a.push(b):a.pop();break;default:a.push(b)}return a.join("/")};var d=function(a,b,c){if(a)for(var d=0;d<c.length;d++)a.hasOwnProperty(c[d])&&(b[c[d]]=a[c[d]])}}(c("./tree")),function(a){function b(a){return a}function c(a,b){var d,e;for(d in a)if(a.hasOwnProperty(d))switch(e=a[d],typeof e){case"function":e.prototype&&e.prototype.type&&(e.prototype.typeIndex=b++);break;case"object":b=c(e,b)}return b}var d={visitDeeper:!0},e=!1;a.visitor=function(b){this._implementation=b,this._visitFnCache=[],e||(c(a,1),e=!0)},a.visitor.prototype={visit:function(a){if(!a)return a;var c=a.typeIndex;if(!c)return a;var e,f=this._visitFnCache,g=this._implementation,h=c<<1,i=1|h,j=f[h],k=f[i],l=d;if(l.visitDeeper=!0,j||(e="visit"+a.type,j=g[e]||b,k=g[e+"Out"]||b,f[h]=j,f[i]=k),j!==b){var m=j.call(g,a,l);g.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=b&&k.call(g,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;d>c;c++)this.visit(a[c]);return a}var e=[];for(c=0;d>c;c++){var f=this.visit(a[c]);f.splice?f.length&&this.flatten(f,e):e.push(f)}return e},flatten:function(a,b){b||(b=[]);var c,d,e,f,g,h;for(d=0,c=a.length;c>d;d++)if(e=a[d],e.splice)for(g=0,f=e.length;f>g;g++)h=e[g],h.splice?h.length&&this.flatten(h,b):b.push(h);else b.push(e);return b}}}(c("./tree")),function(a){a.importVisitor=function(b,c,d,e,f){if(this._visitor=new a.visitor(this),this._importer=b,this._finish=c,this.env=d||new a.evalEnv,this.importCount=0,this.onceFileDetectionMap=e||{},this.recursionDetector={},f)for(var g in f)f.hasOwnProperty(g)&&(this.recursionDetector[g]=!0)},a.importVisitor.prototype={isReplacing:!0,run:function(a){var b;try{this._visitor.visit(a)}catch(c){b=c}this.isFinished=!0,0===this.importCount&&this._finish(b)},visitImport:function(b,c){var d,e=this,f=b.options.inline;if(!b.css||f){try{d=b.evalForImport(this.env)}catch(g){g.filename||(g.index=b.index,g.filename=b.currentFileInfo.filename),b.css=!0,b.error=g}if(d&&(!d.css||f)){b=d,this.importCount++;var h=new a.evalEnv(this.env,this.env.frames.slice(0));b.options.multiple&&(h.importMultiple=!0),this._importer.push(b.getPath(),b.currentFileInfo,b.options,function(c,d,g,i){c&&!c.filename&&(c.index=b.index,c.filename=b.currentFileInfo.filename);var j=g||i in e.recursionDetector;h.importMultiple||(b.skip=j?!0:function(){return i in e.onceFileDetectionMap?!0:(e.onceFileDetectionMap[i]=!0,!1)});var k=function(a){e.importCount--,0===e.importCount&&e.isFinished&&e._finish(a)};return!d||(b.root=d,b.importedFilename=i,f||!h.importMultiple&&j)?void k():(e.recursionDetector[i]=!0,void new a.importVisitor(e._importer,k,h,e.onceFileDetectionMap,e.recursionDetector).run(d))})}}return c.visitDeeper=!1,b},visitRule:function(a,b){return b.visitDeeper=!1,a},visitDirective:function(a){return this.env.frames.unshift(a),a},visitDirectiveOut:function(){this.env.frames.shift()},visitMixinDefinition:function(a){return this.env.frames.unshift(a),a},visitMixinDefinitionOut:function(){this.env.frames.shift()},visitRuleset:function(a){return this.env.frames.unshift(a),a},visitRulesetOut:function(){this.env.frames.shift()},visitMedia:function(a){return this.env.frames.unshift(a.rules[0]),a},visitMediaOut:function(){this.env.frames.shift()}}}(c("./tree")),function(a){a.joinSelectorVisitor=function(){this.contexts=[[]],this._visitor=new a.visitor(this)},a.joinSelectorVisitor.prototype={run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){var b,c=this.contexts[this.contexts.length-1],d=[];this.contexts.push(d),a.root||(b=a.selectors,b&&(b=b.filter(function(a){return a.getIsOutput()}),a.selectors=b.length?b:b=null,b&&a.joinSelectors(d,c,b)),b||(a.rules=null),a.paths=d)},visitRulesetOut:function(){this.contexts.length=this.contexts.length-1},visitMedia:function(a){var b=this.contexts[this.contexts.length-1];a.rules[0].root=0===b.length||b[0].multiMedia}}}(c("./tree")),function(a){a.toCSSVisitor=function(b){this._visitor=new a.visitor(this),this._env=b},a.toCSSVisitor.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a){return a.variable?[]:a},visitMixinDefinition:function(a){return a.frames=[],[]},visitExtend:function(){return[]},visitComment:function(a){return a.isSilent(this._env)?[]:a},visitMedia:function(a,b){return a.accept(this._visitor),b.visitDeeper=!1,a.rules.length?a:[]},visitDirective:function(b){if(b.currentFileInfo.reference&&!b.isReferenced)return[];if("@charset"===b.name){if(this.charset){if(b.debugInfo){var c=new a.Comment("/* "+b.toCSS(this._env).replace(/\n/g,"")+" */\n");return c.debugInfo=b.debugInfo,this._visitor.visit(c)}return[]}this.charset=!0}return b.rules&&b.rules.rules&&this._mergeRules(b.rules.rules),b},checkPropertiesInRoot:function(b){for(var c,d=0;d<b.length;d++)if(c=b[d],c instanceof a.Rule&&!c.variable)throw{message:"properties must be inside selector blocks, they cannot be in the root.",index:c.index,filename:c.currentFileInfo?c.currentFileInfo.filename:null}},visitRuleset:function(b,c){var d,e=[];if(b.firstRoot&&this.checkPropertiesInRoot(b.rules),b.root)b.accept(this._visitor),c.visitDeeper=!1,(b.firstRoot||b.rules&&b.rules.length>0)&&e.splice(0,0,b);else{b.paths&&(b.paths=b.paths.filter(function(b){var c;for(" "===b[0].elements[0].combinator.value&&(b[0].elements[0].combinator=new a.Combinator("")),c=0;c<b.length;c++)if(b[c].getIsReferenced()&&b[c].getIsOutput())return!0;return!1}));for(var f=b.rules,g=f?f.length:0,h=0;g>h;)d=f[h],d&&d.rules?(e.push(this._visitor.visit(d)),f.splice(h,1),g--):h++;g>0?b.accept(this._visitor):b.rules=null,c.visitDeeper=!1,f=b.rules,f&&(this._mergeRules(f),f=b.rules),f&&(this._removeDuplicateRules(f),f=b.rules),f&&f.length>0&&b.paths.length>0&&e.splice(0,0,b)}return 1===e.length?e[0]:e},_removeDuplicateRules:function(b){if(b){var c,d,e,f={};for(e=b.length-1;e>=0;e--)if(d=b[e],d instanceof a.Rule)if(f[d.name]){c=f[d.name],c instanceof a.Rule&&(c=f[d.name]=[f[d.name].toCSS(this._env)]);var g=d.toCSS(this._env);-1!==c.indexOf(g)?b.splice(e,1):c.push(g)}else f[d.name]=d}},_mergeRules:function(b){if(b){for(var c,d,e,f={},g=0;g<b.length;g++)d=b[g],d instanceof a.Rule&&d.merge&&(e=[d.name,d.important?"!":""].join(","),f[e]?b.splice(g--,1):f[e]=[],f[e].push(d));Object.keys(f).map(function(b){function e(b){return new a.Expression(b.map(function(a){return a.value}))}function g(b){return new a.Value(b.map(function(a){return a}))}if(c=f[b],c.length>1){d=c[0];var h=[],i=[];c.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),d.value=g(h)}})}}}}(c("./tree")),function(a){a.extendFinderVisitor=function(){this._visitor=new a.visitor(this),this.contexts=[],this.allExtendsStack=[[]]},a.extendFinderVisitor.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(b){if(!b.root){var c,d,e,f,g=[],h=b.rules,i=h?h.length:0;for(c=0;i>c;c++)b.rules[c]instanceof a.Extend&&(g.push(h[c]),b.extendOnEveryPath=!0);var j=b.paths;for(c=0;c<j.length;c++){var k=j[c],l=k[k.length-1],m=l.extendList;for(f=m?m.slice(0).concat(g):g,f&&(f=f.map(function(a){return a.clone()})),d=0;d<f.length;d++)this.foundExtends=!0,e=f[d],e.findSelfSelectors(k),e.ruleset=b,0===d&&(e.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(e)}this.contexts.push(b.selectors)}},visitRulesetOut:function(a){a.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(a){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}},a.processExtendsVisitor=function(){this._visitor=new a.visitor(this)},a.processExtendsVisitor.prototype={run:function(b){var c=new a.extendFinderVisitor;return c.run(b),c.foundExtends?(b.allExtends=b.allExtends.concat(this.doExtendChaining(b.allExtends,b.allExtends)),this.allExtendsStack=[b.allExtends],this._visitor.visit(b)):b},doExtendChaining:function(b,c,d){var e,f,g,h,i,j,k,l,m=[],n=this;for(d=d||0,e=0;e<b.length;e++)for(f=0;f<c.length;f++)j=b[e],k=c[f],j.parent_ids.indexOf(k.object_id)>=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&j.selfSelectors.forEach(function(b){h=n.extendSelector(g,i,b),l=new a.Extend(k.selector,k.option,0),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))}));if(m.length){if(this.extendChainCount++,d>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,c,d+1))}return m},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a){if(!a.root){var b,c,d,e,f=this.allExtendsStack[this.allExtendsStack.length-1],g=[],h=this;for(d=0;d<f.length;d++)for(c=0;c<a.paths.length;c++)if(e=a.paths[c],!a.extendOnEveryPath){var i=e[e.length-1].extendList;i&&i.length||(b=this.findMatch(f[d],e),b.length&&f[d].selfSelectors.forEach(function(a){g.push(h.extendSelector(b,e,a))}))}a.paths=a.paths.concat(g)}},findMatch:function(a,b){var c,d,e,f,g,h,i,j=this,k=a.selector.elements,l=[],m=[];for(c=0;c<b.length;c++)for(d=b[c],e=0;e<d.elements.length;e++)for(f=d.elements[e],(a.allowBefore||0===c&&0===e)&&l.push({pathIndex:c,index:e,matched:0,initialCombinator:f.combinator}),h=0;h<l.length;h++)i=l[h],g=f.combinator.value,""===g&&0===e&&(g=" "),!j.isElementValuesEqual(k[i.matched].value,f.value)||i.matched>0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1<d.elements.length||c+1<b.length)&&(i=null)),i?i.finished&&(i.length=k.length,i.endPathIndex=c,i.endPathElementIndex=e+1,l.length=0,m.push(i)):(l.splice(h,1),h--);return m},isElementValuesEqual:function(b,c){if("string"==typeof b||"string"==typeof c)return b===c;if(b instanceof a.Attribute)return b.op!==c.op||b.key!==c.key?!1:b.value&&c.value?(b=b.value.value||b.value,c=c.value.value||c.value,b===c):b.value||c.value?!1:!0;\r
+if(b=b.value,c=c.value,b instanceof a.Selector){if(!(c instanceof a.Selector)||b.elements.length!==c.elements.length)return!1;for(var d=0;d<b.elements.length;d++){if(b.elements[d].combinator.value!==c.elements[d].combinator.value&&(0!==d||(b.elements[d].combinator.value||" ")!==(c.elements[d].combinator.value||" ")))return!1;if(!this.isElementValuesEqual(b.elements[d].value,c.elements[d].value))return!1}return!0}return!1},extendSelector:function(b,c,d){var e,f,g,h,i,j=0,k=0,l=[];for(e=0;e<b.length;e++)h=b[e],f=c[h.pathIndex],g=new a.Element(h.initialCombinator,d.elements[0].value,d.elements[0].index,d.elements[0].currentFileInfo),h.pathIndex>j&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),k=0,j++),i=f.elements.slice(k,h.index).concat([g]).concat(d.elements.slice(1)),j===h.pathIndex&&e>0?l[l.length-1].elements=l[l.length-1].elements.concat(i):(l=l.concat(c.slice(j,h.pathIndex)),l.push(new a.Selector(i))),j=h.endPathIndex,k=h.endPathElementIndex,k>=c[j].elements.length&&(k=0,j++);return j<c.length&&k>0&&(l[l.length-1].elements=l[l.length-1].elements.concat(c[j].elements.slice(k)),j++),l=l.concat(c.slice(j,c.length))},visitRulesetOut:function(){},visitMedia:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitMediaOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a){var b=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);b=b.concat(this.doExtendChaining(b,a.allExtends)),this.allExtendsStack.push(b)},visitDirectiveOut:function(){this.allExtendsStack.length=this.allExtendsStack.length-1}}}(c("./tree")),function(a){a.sourceMapOutput=function(a){this._css=[],this._rootNode=a.rootNode,this._writeSourceMap=a.writeSourceMap,this._contentsMap=a.contentsMap,this._contentsIgnoredCharsMap=a.contentsIgnoredCharsMap,this._sourceMapFilename=a.sourceMapFilename,this._outputFilename=a.outputFilename,this._sourceMapURL=a.sourceMapURL,a.sourceMapBasepath&&(this._sourceMapBasepath=a.sourceMapBasepath.replace(/\\/g,"/")),this._sourceMapRootpath=a.sourceMapRootpath,this._outputSourceFiles=a.outputSourceFiles,this._sourceMapGeneratorConstructor=a.sourceMapGenerator||c("source-map").SourceMapGenerator,this._sourceMapRootpath&&"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/"),this._lineNumber=0,this._column=0},a.sourceMapOutput.prototype.normalizeFilename=function(a){return a=a.replace(/\\/g,"/"),this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),("\\"===a.charAt(0)||"/"===a.charAt(0))&&(a=a.substring(1))),(this._sourceMapRootpath||"")+a},a.sourceMapOutput.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename];this._contentsIgnoredCharsMap[b.filename]&&(c-=this._contentsIgnoredCharsMap[b.filename],0>c&&(c=0),j=j.slice(this._contentsIgnoredCharsMap[b.filename])),j=j.substring(0,c),f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;i<e.length;i++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+i+1,column:0===i?this._column:0},original:{line:f.length+i,column:0===i?h.length:0},source:this.normalizeFilename(b.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:f.length,column:h.length},source:this.normalizeFilename(b.filename)});1===e.length?this._column+=g.length:(this._lineNumber+=e.length-1,this._column=g.length),this._css.push(a)}},a.sourceMapOutput.prototype.isEmpty=function(){return 0===this._css.length},a.sourceMapOutput.prototype.toCSS=function(a){if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(var b in this._contentsMap)if(this._contentsMap.hasOwnProperty(b)){var d=this._contentsMap[b];this._contentsIgnoredCharsMap[b]&&(d=d.slice(this._contentsIgnoredCharsMap[b])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(b),d)}if(this._rootNode.genCSS(a,this),this._css.length>0){var e,f=JSON.stringify(this._sourceMapGenerator.toJSON());this._sourceMapURL?e=this._sourceMapURL:this._sourceMapFilename&&(e=this.normalizeFilename(this._sourceMapFilename)),this._writeSourceMap?this._writeSourceMap(f):e="data:application/json;base64,"+c("./encoder.js").encodeBase64(f),e&&this._css.push("/*# sourceMappingURL="+e+" */")}return this._css.join("")}}(c("./tree"));var y=/^(file|chrome(-extension)?|resource|qrc|app):/.test(location.protocol);w.env=w.env||("127.0.0.1"==location.hostname||"0.0.0.0"==location.hostname||"localhost"==location.hostname||location.port&&location.port.length>0||y?"development":"production");var z={debug:3,info:2,errors:1,none:0};if(w.logLevel="undefined"!=typeof w.logLevel?w.logLevel:"development"===w.env?z.debug:z.errors,w.async=w.async||!1,w.fileAsync=w.fileAsync||!1,w.poll=w.poll||(y?1e3:1500),w.functions)for(var A in w.functions)w.functions.hasOwnProperty(A)&&(w.tree.functions[A]=w.functions[A]);var B=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(location.hash);B&&(w.dumpLineNumbers=B[1]);var C=/^text\/(x-)?less$/,D=null,E={};if(w.watch=function(){return w.watchMode||(w.env="development",v()),this.watchMode=!0,!0},w.unwatch=function(){return clearInterval(w.watchTimer),this.watchMode=!1,!1},/!watch/.test(location.hash)&&w.watch(),"development"!=w.env)try{D="undefined"==typeof a.localStorage?null:a.localStorage}catch(F){}var G=document.getElementsByTagName("link");w.sheets=[];for(var H=0;H<G.length;H++)("stylesheet/less"===G[H].rel||G[H].rel.match(/stylesheet/)&&G[H].type.match(C))&&w.sheets.push(G[H]);w.modifyVars=function(a){w.refresh(!1,a)},w.refresh=function(a,b){var c,e;c=e=new Date,u(function(a,b,f,i,k){if(a)return j(a,i.href);if(k.local)d("loading "+i.href+" from cache.",z.info);else{d("parsed "+i.href+" successfully.",z.debug);var l=b.toCSS(w);l=h(l),g(l,i,k.lastModified)}d("css for "+i.href+" generated in "+(new Date-e)+"ms",z.info),0===k.remaining&&d("less has finished. css generated in "+(new Date-c)+"ms",z.info),e=new Date},a,b),n(b)},w.refreshStyles=n,w.Parser.fileLoader=s,w.refresh("development"===w.env),"function"==typeof define&&define.amd&&define(function(){return w})}(window);
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/index.html b/MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/index.html
new file mode 100755 (executable)
index 0000000..51a1cef
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head lang="en">
+    <meta charset="UTF-8">
+    <title>V2 WebSocket API Tester</title>
+
+    <link rel="stylesheet/less" type="text/css" href="styles.less" />
+
+    <script src="../js/less-1.7.5.min.js"></script>
+    <script src="../js/jquery.min.js"></script>
+    <script src="main.js"></script>
+
+</head>
+<body>
+
+<div id="wrapper">
+
+    <header id="cntHeading">
+        <h1>V2 WebSocket API Tester</h1>
+    </header>
+
+    <section id="cntConnection">
+
+        <label for="txtConnectUrl">Connection URL</label>
+        <input id="txtConnectUrl" type="text" value="" />
+
+        <button id="btnConnect">Connect</button>
+        <button id="btnDisconnect">Disconnect</button>
+
+    </section>
+
+    <section id="cntSend">
+
+        <label for="selectMethod">RPC Method</label>
+        <select id="selectMethod"></select>
+
+        <button id="btnSend">SEND</button>
+
+        <label for="txtSend">JSON to send</label>
+        <textarea id="txtSend"></textarea>
+
+
+
+    </section>
+
+    <section id="cntReceive">
+
+        <label for="txtReceive">JSON response</label>
+        <textarea id="txtReceive"></textarea>
+
+    </section>
+
+    <section id="cntNotifications">
+
+        <label for="txtNotification">Notifications</label>
+        <textarea id="txtNotification"></textarea>
+
+    </section>
+
+
+</div>
+
+
+</body>
+</html>
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/main.js b/MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/main.js
new file mode 100755 (executable)
index 0000000..cf85145
--- /dev/null
@@ -0,0 +1,199 @@
+$(function(){\r
+\r
+    var socket;\r
+\r
+    /*\r
+        UI Elements\r
+     */\r
+    var txtConnectUrl   = $("#txtConnectUrl");\r
+    var btnConnect      = $("#btnConnect");\r
+    var btnDisconnect   = $("#btnDisconnect");\r
+    var selectMethod    = $("#selectMethod");\r
+    var btnSend         = $("#btnSend");\r
+    var txtSend         = $("#txtSend");\r
+    var txtReceive      = $("#txtReceive");\r
+    var txtNotification = $("#txtNotification");\r
+\r
+\r
+    btnConnect.on('click', function(){\r
+        console.debug('btnConnect : click');\r
+        socket = new WebSocket(txtConnectUrl.val(),['msf-2','msf-3']);\r
+        console.debug('connecting to '+txtConnectUrl.val());\r
+        socket.addEventListener('open',     onSocketOpen );\r
+        socket.addEventListener('message',  onSocketMessage );\r
+        socket.addEventListener('close',    onSocketClose );\r
+        socket.addEventListener('error',    onSocketError );\r
+    });\r
+\r
+    btnDisconnect.on('click', function(){\r
+        console.debug('btnDisconnect : click');\r
+        if(socket){\r
+            socket.close();\r
+        }\r
+    });\r
+\r
+    btnSend.on('click', function(){\r
+        console.debug('btnSend : click');\r
+        if(socket){\r
+            socket.send(txtSend.val());\r
+        }\r
+    });\r
+\r
+    selectMethod.on('change', function(){\r
+        console.debug('selectMethod : change');\r
+        var key = $(this).val();\r
+        if(methods[key]){\r
+            var tplObj = methods[key];\r
+            txtSend.val(JSON.stringify(tplObj, null, 2));\r
+        }else{\r
+            console.warn('no template defined for selected method');\r
+        }\r
+\r
+    });\r
+\r
+    var onSocketOpen = function(){\r
+        console.info('websocket connected');\r
+        btnConnect.prop("disabled",true);\r
+        btnSend.prop("disabled",false);\r
+        btnDisconnect.prop("disabled",false);\r
+        $('body').css('background-color','#C9FF9C');\r
+    };\r
+\r
+    var onSocketMessage = function(msg){\r
+        try{\r
+            msg = JSON.parse(msg.data);\r
+            console.info('websocket message : ', msg);\r
+        }catch(e){\r
+            console.error('Unable to parse message : ', msg.data);\r
+        }\r
+\r
+        if(msg.id){\r
+            txtReceive.val(JSON.stringify(msg, null, 2));\r
+            txtReceive.addClass('flash');\r
+            txtReceive.one('animationend webkitAnimationEnd', function() {\r
+                $(this).removeClass('flash');\r
+            });\r
+        }else{\r
+            txtNotification.val(JSON.stringify(msg, null, 2));\r
+            txtNotification.addClass('flash');\r
+            txtNotification.one('animationend webkitAnimationEnd', function() {\r
+                $(this).removeClass('flash');\r
+            });\r
+        }\r
+\r
+    };\r
+\r
+    var onSocketClose = function(){\r
+        console.warn('websocket disconnected');\r
+        btnConnect.prop("disabled",false);\r
+        btnDisconnect.prop("disabled",true);\r
+        btnSend.prop("disabled",true);\r
+        socket = null;\r
+        $('body').css('background-color','#E5E5E5');\r
+    };\r
+\r
+    var onSocketError = function(evt){\r
+        console.error('websocket error : ', evt);\r
+    };\r
+\r
+    var initUI = function(){\r
+        txtConnectUrl.val('ws://'+location.host+'/api/v2/channels/test');\r
+        btnDisconnect.prop("disabled",true);\r
+        btnSend.prop("disabled",true);\r
+        for(var key in methods){\r
+            if (methods.hasOwnProperty(key)) {\r
+                var option = $('<option />')\r
+                    .attr('value', key)\r
+                    .text(key)\r
+                    .appendTo(selectMethod);\r
+            }\r
+        }\r
+        selectMethod.change();\r
+    };\r
+\r
+\r
+    var methods = {\r
+\r
+        "ms.channel.emit" : {\r
+            method : "ms.channel.emit",\r
+            params : {\r
+                event : "say",\r
+                data  : "Hello World!",\r
+                to    : "all"\r
+            }\r
+        },\r
+\r
+        "ms.application.get" : {\r
+            method : "ms.application.get",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                id : "HelloWorld"\r
+            }\r
+        },\r
+\r
+        "ms.application.start" : {\r
+            method : "ms.application.start",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                id : "HelloWorld"\r
+            }\r
+        },\r
+\r
+        "ms.application.stop" : {\r
+            method : "ms.application.stop",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                id : "HelloWorld"\r
+            }\r
+        },\r
+\r
+        "ms.application.install" : {\r
+            method : "ms.application.install",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                id : "HelloWorld"\r
+            }\r
+        },\r
+\r
+        "ms.webapplication.get" : {\r
+            method : "ms.webapplication.get",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                url : "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/"\r
+            }\r
+        },\r
+\r
+        "ms.webapplication.start" : {\r
+            method : "ms.webapplication.start",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                url : "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/"\r
+            }\r
+        },\r
+\r
+        "ms.webapplication.stop" : {\r
+            method : "ms.webapplication.stop",\r
+            get id(){return Date.now();},\r
+            params : {\r
+                url : "http://prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/"\r
+            }\r
+        },\r
+\r
+        "ms.pincode.show" : {\r
+            method : "ms.pincode.show",\r
+            get id(){return Date.now();}\r
+        },\r
+\r
+        "ms.pincode.hide" : {\r
+            method : "ms.pincode.hide",\r
+            get id(){return Date.now();}\r
+        },\r
+\r
+        "custom" : {}\r
+\r
+    };\r
+\r
+    initUI();\r
+\r
+\r
+});
\ No newline at end of file
diff --git a/MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/styles.less b/MSF-Node/org.tizen.multiscreen/server/test/tools/websockets/styles.less
new file mode 100755 (executable)
index 0000000..129b059
--- /dev/null
@@ -0,0 +1,168 @@
+
+@font-face {
+    font-family: 'amatic';
+    src:url('../fonts/amaticsc-regular.woff') format('woff'),
+        url('../fonts/amaticsc-regular.ttf') format('truetype');
+    font-weight: normal;
+    font-style: normal;
+}
+
+html {
+    width: 100%;
+    height: 100%;
+}
+
+body {
+    width: 100%;
+    height: 100%;
+    background-color: #E5E5E5;
+    font-family: 'amatic', cursive;
+}
+
+*, *:before, *:after {
+    box-sizing: border-box;
+    margin: 0;
+    padding: 0;
+}
+
+h1, h2, h3, h4, h5, h6{
+    font-family: 'amatic', cursive;
+}
+
+label{
+    font-weight: bolder;
+    font-size: 24px;
+    margin-bottom : 10px;
+}
+
+input, button, textarea, select {
+    padding : 5px;
+    border-radius: 5px;
+    background : #fff;
+    &:focus{
+        outline: 0;
+    }
+    &:disabled{
+        display: none;
+        background: url(../img/cross-out.png) center center no-repeat;
+        background-size: contain;
+        border : none;
+    }
+}
+
+button { .sketch-rounded-3d; }
+
+select, textarea{ .sketch-rounded; }
+
+input{ .sketch; }
+
+.sketch {
+    border: 7px solid transparent;
+    border-image: url('../img/sketch-border.png') 7 stretch;
+}
+
+.sketch-rounded {
+    border: 7px solid transparent;
+    border-image: url('../img/sketch-border-rounded.png') 7 stretch;
+}
+
+.sketch-rounded-3d {
+    border: 10px solid transparent;
+    border-image: url('../img/sketch-border-rounded-3d.png') 10 stretch;
+}
+
+#wrapper{
+    display: flex;
+    flex-flow: row wrap;
+    padding : 10px;
+}
+
+section, header{
+    display: flex;
+    flex-flow: row wrap;
+    background-color: #fff;
+    padding : 20px;
+    margin : 10px;
+    .sketch;
+}
+
+#cntHeading{
+    width: 100%;
+}
+
+#cntConnection{
+    width: 100%;
+    label {
+        width : 100%;
+    }
+    input {
+        width: 300px;
+    }
+    button {
+        margin-left: 10px;
+    }
+}
+
+#cntSend{
+    flex : 1;
+    label {
+        width : 100%;
+        &:not(:first-child){
+            margin-top: 20px;
+        }
+    }
+    select{
+        flex : 2;
+
+    }
+    button{
+        flex : 1;
+        margin-left: 10px;
+    }
+    textarea{
+        width :100%;
+        min-height: 200px;
+    }
+}
+
+#cntReceive{
+    flex : 1;
+    label {
+        width : 100%;
+    }
+    textarea{
+        width :100%;
+        min-height: 200px;
+    }
+}
+
+#cntNotifications{
+    flex : 1;
+    label {
+        width : 100%;
+    }
+    textarea{
+        width :100%;
+        min-height: 200px;
+    }
+}
+
+@-webkit-keyframes flash {
+    0% {
+        background-color: transparent;
+    }
+    50% {
+        background-color: #fff085;
+    }
+    100% {
+        background-color: transparent;
+    }
+}
+
+.flash{
+    -webkit-animation-name: flash;
+    -webkit-animation-duration: 500ms;
+    -webkit-animation-iteration-count: 1;
+    -webkit-animation-timing-function: ease-out;
+}
+
diff --git a/NOTICE b/NOTICE
new file mode 100755 (executable)
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/PinCodeService/IPCServer.cpp b/PinCodeService/IPCServer.cpp
new file mode 100755 (executable)
index 0000000..6d0b115
--- /dev/null
@@ -0,0 +1,654 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include "IPCServer.h"
+#include "CCDebugRemote.h"
+#include <curl/curl.h>         //To interact w/ Node server (internal server)
+#include <sys/time.h>          //timestamp for VDCurl request
+#include "json/writer.h"
+#include <net_connection.h>
+#include <wifi.h>
+#include <system_info.h>
+#include <sstream>
+#include <syspopup_caller.h>
+#include <bundle_internal.h>
+#include "bluetooth-api.h"
+
+#define MAC_ADDR_STR_LEN 18
+#define DEFAULT_MAC_ADDRESS "00:00:00:00:00:00"
+
+#undef LOG_TAG
+#define LOG_TAG "Remote_Daemon"
+
+IPCServer::IPCServer(void)
+{
+       m_socket = -1;
+//     callback = NULL;
+}
+
+IPCServer::~IPCServer(void)
+{
+       Final();
+}
+
+int IPCServer::IsAgreedSmartHubTerms(void)
+{
+       int ret = 0;
+       vconf_get_int(VCONFKEY_REMOTE_SERVER_HUB_TERMS, &ret);
+       if (ret == 1)
+               return ret; // agreement is true
+
+       return 0;  // doesn't agree
+}
+
+int IPCServer::Init()
+{
+       REMOTE_SYSPRINT_INFO("IPCServer Init");
+
+       if ((m_socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+               REMOTE_PRINT_INFO("IPCServer socket error");
+               return -1;
+       }
+
+       unlink(PCS_REMOTE_SOCKET_PATH);
+
+       struct sockaddr_un serveraddr;
+       memset(&serveraddr, 0, sizeof(struct sockaddr_un));
+       serveraddr.sun_family = AF_UNIX;
+       strncpy(serveraddr.sun_path, PCS_REMOTE_SOCKET_PATH, strlen(PCS_REMOTE_SOCKET_PATH));
+
+       if (bind(m_socket, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) == -1) {
+               //Error
+               REMOTE_PRINT_INFO("IPCServer socket bind error %d", errno);
+               Final();
+               return -1;
+       }
+
+       if (listen(m_socket, 5) == -1) {        //Max 5 people
+               //Error
+               REMOTE_PRINT_INFO("IPCServer socket listen error");
+               Final();
+               return -1;
+       }
+
+       if (!Thread::FlagCreate())
+               Thread::Create(256 * 1024);
+
+       //cloud app whitelist VDCurl call
+       //boost::thread response_thread(&IPCServer::VDCurlMessageSend, this);
+       //response_thread.join();
+
+       return 1;
+}
+
+void IPCServer::Final(void)
+{
+       REMOTE_PRINT_INFO("Fianl");
+
+       if (m_socket == -1)
+               return;
+
+       shutdown(m_socket, SHUT_RDWR);
+       close(m_socket);
+
+       m_socket = -1;
+
+       if (Thread::FlagCreate())
+               Thread::Destroy();
+}
+
+void IPCServer::t_Main(void)
+{
+       REMOTE_PRINT_INFO("Enter t_Main");
+
+       SocketProcess();
+}
+
+void IPCServer::SocketProcess(void)
+{
+       while (true) {
+               struct sockaddr_un address;
+               socklen_t addrSize = sizeof(struct sockaddr_un);
+
+               int sock = (int)accept(m_socket, (struct sockaddr *)&address, &addrSize);
+
+               if (sock  < 0)
+                       break;
+
+               int fd;
+               fd = dup(sock);
+               if (fd < 0) {
+                       REMOTE_PRINT_INFO("File Descriptor is negative, so there is an error\n", __PRETTY_FUNCTION__, __LINE__);
+                       close(sock);
+                       return;
+               }
+
+               FILE *file = fdopen(fd, "r+");
+
+               if (file == NULL) {
+                       REMOTE_PRINT_INFO("Can't open file descriptor\n", __PRETTY_FUNCTION__, __LINE__);
+                       close(fd);
+                       shutdown(sock, SHUT_RDWR);
+                       close(sock);
+                       return;
+               }
+
+               PacketParse(file, sock);
+               fclose(file);
+               file = NULL;
+               shutdown(sock, SHUT_RDWR);
+               close(sock);
+       }
+}
+
+void* IPCServer::SocketThread(void *arg)
+{
+       IPCServer *client = (IPCServer *)arg;
+       client->SocketProcess();
+       return NULL;
+}
+
+bool IPCServer::PacketParse(FILE *file, int sock)
+{
+       int length = 0;
+       int result = fscanf(file, "%d", &length);
+
+       if (result <= 0) {
+               REMOTE_PRINT_INFO("Error to process PCS command\n", __PRETTY_FUNCTION__, __LINE__);
+               return false;
+       }
+
+       REMOTE_PRINT_INFO("Get data length %d\n", __PRETTY_FUNCTION__, __LINE__, length);
+
+       //Read real data
+       if ((length > 0) && (length < 4096)) {
+               char *content = new char[length + 1];
+               memset(content, 0, length + 1);
+               char param[128] = "";
+               snprintf(param, 127, ",%%%ds", length);
+               result = fscanf(file, param, content);
+               int contentLength = strlen(content);
+               if (result <= 0 && length != contentLength) {
+                       REMOTE_PRINT_INFO("Error to get data, length = %d, get length = %d\n", __PRETTY_FUNCTION__, __LINE__, length, contentLength);
+                       delete[] content;
+                       return false;
+               }
+
+               //Check content.
+               if (strncmp(content, "showpincode,", 12) == 0) {
+                       int ret = 0;
+                       char *pin = &(content[12]);
+                       PinCodeToDisplay = pin;
+
+                       char *device_name = NULL;
+                       device_name = vconf_get_str(VCONFKEY_REMOTE_SERVER_DEVICE_NAME);
+
+                       bundle *b = NULL;
+                       b = bundle_create();
+                       bundle_add(b, "_PINCODE_", pin);
+                       bundle_add(b, "_DEVICE_NAME_", device_name);
+
+                       ret = syspopup_launch((char*)"rs-pincode-popup", b);
+                       if (ret < 0)
+                               REMOTE_PRINT_INFO("Pincode popup Launch Failed", __PRETTY_FUNCTION__, __LINE__);
+
+                       bundle_free(b);
+                       free(device_name);
+                       device_name = NULL;
+//TODO
+/*
+                       PTEvent Event;
+                       int pinInt = atoi(pin);
+                       Event.type = CWebServerAppBase::WEBSERVERAPP_EVENT_SHOW_PAIRING_CHALLENGE; // Event Type : WEBSERVERAPP_EVENT_SHOW_PAIRING_CHALLENGE
+                       Event.param.l[0] = pinInt; // Pincode
+                       ALMOND::SendEvent(&Event, "samsung.native.webserver"); */
+               } else if (strncmp(content, "hidepincode", 11) == 0) {
+                       int ret = 0;
+                       ret = syspopup_destroy_all();
+                       if (ret < 0)
+                               REMOTE_PRINT_INFO("Pincode popup Destroy Failed", __PRETTY_FUNCTION__, __LINE__);
+//TODO
+/*
+                       PTEvent Event;
+                       Event.type = 0xff0b; // Event Type : WEBSERVERAPP_EVENT_HIDE_PAIRING_CHALLENGE
+                       ALMOND::SendEvent(&Event, "samsung.native.webserver");*/
+               } else if (strncmp(content, "getinfo", 7) == 0) {
+                       //Get information
+                       std::string temp = MakeInformation();
+                       std::string info;
+                       char szlength[64] = "";
+                       snprintf(szlength, 63, "%d,", temp.size());
+                       info.append(szlength);
+                       info += temp;
+//                     send(sock, szlength, strlen(szlength), 0);
+                       REMOTE_PRINT_INFO("Info = %s\n", __PRETTY_FUNCTION__, __LINE__, info.c_str());
+                       send(sock, info.c_str(), info.size(), 0);
+               }
+               delete[] content;
+       }
+       return true;
+}
+
+std::string IPCServer::GetPinCode()
+{
+       REMOTE_PRINT_INFO("PCS pincode is %s\n", __PRETTY_FUNCTION__, __LINE__, PinCodeToDisplay.c_str());
+       return PinCodeToDisplay;
+}
+
+size_t write_fn(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+       char *tmp = new char[size * nmemb];
+       memset(tmp, 0, size * nmemb);
+       memcpy(tmp, ptr, size * nmemb);
+
+       std::string *PINData = (std::string *)stream;
+       if (PINData != NULL)
+               *PINData += tmp;
+
+       delete[] tmp;
+       return size * nmemb;
+}
+
+std::string IPCServer::GetPINFromAppID(std::string appID)
+{
+       static std::string pin;
+
+       if (appID.compare("-1") == 0) {
+               unsigned int seed = time(NULL);
+               char szPIN[7] = "";
+               for (int i = 0; i < 6; i++) {
+                       int v = rand_r(&seed) % 10;
+                       szPIN[i] = '0' + v;
+               }
+               pin = szPIN;
+       } else if (appID.compare("-2") == 0) {
+               unsigned int seed = time(NULL);
+               char szPIN[5] = "";
+               for (int i = 0; i < 4; i++) {
+                       int v = rand_r(&seed) % 10;
+                       szPIN[i] = '0' + v;
+               }
+               pin = szPIN;
+       } else if (appID.compare("clear") == 0) {
+               pin = "";
+       }
+       return pin;
+}
+
+#define MS_URL_NODE_UPDATE     "http://127.0.0.1:8001/ms/1.0/device/info/update"
+
+void IPCServer::UpdateMITNode()
+{
+       CURL *cu = curl_easy_init();
+
+       if (cu != NULL) {
+               REMOTE_PRINT_INFO("Update MIT Node by Curl\n", __PRETTY_FUNCTION__, __LINE__);
+               struct curl_slist *headers = NULL;
+
+               std::string data = "{}";
+
+               headers = curl_slist_append(headers, "Accept: application/json");
+               headers = curl_slist_append(headers, "Content-Type: application/json");
+               curl_easy_setopt(cu, CURLOPT_HTTPHEADER, headers);
+               curl_easy_setopt(cu, CURLOPT_URL, MS_URL_NODE_UPDATE);
+               curl_easy_setopt(cu, CURLOPT_POST, 1);
+               curl_easy_setopt(cu, CURLOPT_POSTFIELDS, data.c_str());
+               curl_easy_setopt(cu, CURLOPT_POSTFIELDSIZE, data.length());
+               curl_easy_setopt(cu, CURLOPT_TIMEOUT_MS, 1000);
+//             curl_easy_perform(cu);
+               const CURLcode rc = curl_easy_perform(cu);
+
+               if (rc == CURLE_OK)
+                       REMOTE_PRINT_INFO("Curl Perform Return OK \n", __PRETTY_FUNCTION__, __LINE__);
+               else
+                       REMOTE_PRINT_INFO("Curl Perform Return Fail [%s] \n", __PRETTY_FUNCTION__, __LINE__, curl_easy_strerror(rc));
+
+               curl_easy_cleanup(cu);
+       } else {
+               REMOTE_PRINT_INFO("Update MIT CURL is failed\n", __PRETTY_FUNCTION__, __LINE__);
+       }
+}
+
+std::string IPCServer::MakeInformation()
+{
+       std::string DUID = "";
+       std::string ModelCode = "";
+       std::string InternalIP = "none";
+       std::string ConnectType = "none";
+       std::string WiFiSSID;
+       std::string FirmwareVersion = "Unknown";
+       std::string SmartHubAgreement = "false";
+       std::string DeveloperMode = "0";
+       std::string DeveloperIP = "0.0.0.0";
+
+       //WiFi SSID & internal IP
+       //Network connection check
+       connection_h connection;
+       if (connection_create(&connection) == CONNECTION_ERROR_NONE) {
+               connection_type_e connection_type;
+               if (connection_get_type(connection, &connection_type) == CONNECTION_ERROR_NONE) {
+                       if (connection_type == CONNECTION_TYPE_WIFI) {
+                               ConnectType = "wireless";
+
+                               wifi_ap_h apinfo;
+                               if (wifi_get_connected_ap(&apinfo) == WIFI_ERROR_NONE) {
+                                       char *szWiFiSSID = NULL;
+                                       if (wifi_ap_get_bssid(apinfo, &szWiFiSSID) == WIFI_ERROR_NONE)
+                                               WiFiSSID = szWiFiSSID;
+
+                                       if (szWiFiSSID != NULL) {
+                                               free(szWiFiSSID);
+                                               szWiFiSSID = NULL;
+                                       }
+                                       wifi_ap_destroy(apinfo);
+                               } else {
+                                       REMOTE_PRINT_INFO("IPCServer couldn't get WiFi SSID\n", __PRETTY_FUNCTION__, __LINE__);
+                               }
+                       }
+               } else {
+                       REMOTE_PRINT_INFO("IPCServer couldn't get Network type\n", __PRETTY_FUNCTION__, __LINE__);
+               }
+
+               //Get IP address
+               char *szIP = NULL;
+               int ipResult = connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &szIP);
+               if (ipResult == CONNECTION_ERROR_NONE) {
+                       InternalIP = szIP;
+               } else {
+                       if (connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV6, &szIP) == CONNECTION_ERROR_NONE)
+                               InternalIP = szIP;
+                       else
+                               REMOTE_PRINT_INFO("IPCServer couldn't get address of IPv4 & IPv6\n", __PRETTY_FUNCTION__, __LINE__);
+               }
+               if (szIP != NULL)
+                       free(szIP);
+
+               //Destroy connection
+               if (connection_destroy(connection) != CONNECTION_ERROR_NONE)
+                       REMOTE_PRINT_INFO("IPCServer destroy connection error\n", __PRETTY_FUNCTION__, __LINE__);
+       } else {
+               REMOTE_PRINT_INFO("IPCServer couldn't get Network handle\n", __PRETTY_FUNCTION__, __LINE__);
+       }
+
+       std::string countryCode;
+
+       char *szCountryCode = NULL;
+       szCountryCode =  vconf_get_str(VCONFKEY_REMOTE_SERVER_COUNTRY_ID);
+       if (szCountryCode != 0) {
+               countryCode = szCountryCode;
+               free(szCountryCode);
+               szCountryCode = NULL;
+       }
+
+       char *szModelCode = NULL;
+       szModelCode = vconf_get_str(VCONFKEY_REMOTE_SERVER_MODEL_ID);
+       if (szModelCode != 0) {
+               ModelCode = szModelCode;
+               free(szModelCode);
+               szModelCode = NULL;
+       }
+
+       char *szDeveloperIP = NULL;
+       szDeveloperIP = vconf_get_str(VCONFKEY_REMOTE_SERVER_DEVELOPER_IP);
+       if (szDeveloperIP != 0) {
+               DeveloperIP = szDeveloperIP;
+               free(szDeveloperIP);
+               szDeveloperIP = NULL;
+       }
+       int szDeveloperMode = 0;
+       vconf_get_int(VCONFKEY_REMOTE_SERVER_DEVELOPER_MODE, &szDeveloperMode);
+       if (szDeveloperMode)
+               DeveloperMode = "1";
+
+
+       //Get Resoulution
+       std::string Resolution;
+
+       //Get Resolution
+       int width = 1280;
+       int height = 720;
+       GetPanelResolution(width, height);
+       char szResolution[128] = "";
+       snprintf(szResolution, 127, "%dx%d", width, height);
+       Resolution = szResolution;
+
+       //Get UPNP Device Information
+       std::string DeviceName;
+       std::string DeviceID;
+       std::string Description;
+       std::string ModelName;
+       std::string UDN;
+
+       if (IsAgreedSmartHubTerms() == 1)
+               SmartHubAgreement = "true";
+       else
+               SmartHubAgreement = "false";
+
+       char bt_mac[MAC_ADDR_STR_LEN];
+       ReadBTMAC(bt_mac);
+
+       char wifi_mac[MAC_ADDR_STR_LEN] = {0, };
+
+       ReadWifiMAC(wifi_mac);
+
+       char p2p_mac[MAC_ADDR_STR_LEN] = {0, };
+       Read_p2p_MAC(p2p_mac);
+
+       //Make JSON
+       std::string info = "{\"DUID\":\"";
+       info += UDN.c_str();
+
+       info += "\",\"Model\":\"";
+       #if 1 //for platform
+       char *p_model_name = NULL;
+       int model_name_ret = system_info_get_platform_string("http://tizen.org/system/model_name", &p_model_name);
+       if (model_name_ret != SYSTEM_INFO_ERROR_NONE) {
+               REMOTE_PRINT_FATAL("Failed to get system information(%d)", model_name_ret);
+       } else {
+               ModelCode = p_model_name;
+               free(p_model_name);
+       }
+       #endif
+       info += ModelCode.c_str();
+
+       info += "\",\"NetworkType\":\"";
+       info += ConnectType;
+
+       if (ConnectType.compare("wireless") == 0) {
+               info += "\",\"SSID\":\"";
+               info += WiFiSSID;
+       }
+
+       info += "\",\"IP\":\"";
+       info += InternalIP;
+
+       info += "\",\"WifiMac\":\"";
+       info += wifi_mac;
+
+       info += "\",\"FirmwareVersion\":\"";
+       info += FirmwareVersion;
+
+       info += "\",\"CountryCode\":\"";
+       info += countryCode;
+
+       info += "\",\"DeviceName\":\"";
+       #if 1 //for platform
+       char *p_device_name = NULL;
+       p_device_name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+       if (p_device_name == NULL) {
+               REMOTE_PRINT_FATAL("Failed to get device name");
+       } else {
+               DeviceName = p_device_name;
+               free(p_device_name);
+       }
+       #endif
+       info += DeviceName;
+
+       info += "\",\"DeviceID\":\"";
+       info += p2p_mac;
+
+       info += "\",\"ModelDescription\":\"";
+       info += Description;
+
+       info += "\",\"ModelName\":\"";
+       info += ModelName;
+
+       info += "\",\"UDN\":\"";
+       info += UDN;
+
+       info += "\",\"Resolution\":\"";
+       info += Resolution;
+
+       info += "\",\"DeveloperMode\":\"";
+       info += DeveloperMode;
+
+       info += "\",\"DeveloperIP\":\"";
+       info += DeveloperIP;
+
+       info += "\",\"SmartHubAgreement\":\"";
+       info += SmartHubAgreement;
+
+       info += "\"}";
+
+       REMOTE_PRINT_DEBUG("Info = %s\n", __PRETTY_FUNCTION__, __LINE__, info.c_str());
+       return info;
+}
+
+bool IPCServer::GetPanelResolution(int &width, int &height)
+{
+       //No need to verify return, return false? use default resolution
+       int tmpWidth = 0;
+       int tmpHeight = 0;
+
+//     system_info_get_value_int(SYSTEM_INFO_KEY_PANEL_RESOLUTION_WIDTH, &tmpWidth);
+//     system_info_get_value_int(SYSTEM_INFO_KEY_PANEL_RESOLUTION_HEIGHT, &tmpHeight);
+       REMOTE_PRINT_INFO("Panel Resolution = %dx%d\n", __PRETTY_FUNCTION__, __LINE__, tmpWidth, tmpHeight);
+
+       width = tmpWidth;
+       height = tmpHeight;
+       return true;
+}
+
+int IPCServer::cb(int msgType, void *cookie, void *userdata)
+{
+       return 1;
+}
+
+/*
+static size_t writeData(char *ptr, size_t size, size_t nmemb, void *stream)
+{
+       std::ostringstream *pStream = (std::ostringstream*)stream;
+       size_t written = size * nmemb;
+       pStream->write(ptr, written);
+       return written;
+}
+*/
+
+void IPCServer::ConvertCapitalMac(char *sMac)
+{
+       int i = 0;
+       if (strlen(sMac) != MAC_ADDR_STR_LEN - 1) {
+       }
+       else {
+               for (i = 0; i < MAC_ADDR_STR_LEN; i++) {
+                       if (sMac[i] >= 'a' && sMac[i] <= 'z')
+                               sMac[i] = sMac[i] - 0x20;
+
+                       if (sMac[i] == '-')
+                               sMac[i] = ':';
+               }
+       }
+}
+
+void IPCServer::ReadBTMAC(char *sBtmac)
+{
+    int i = 0;
+    bluetooth_device_address_t bt_address;
+       bluetooth_get_local_address(&bt_address);
+
+       memset(sBtmac, 0x0, MAC_ADDR_STR_LEN);
+       for (i = 0; i < 6; i++) {
+               snprintf(sBtmac + (i * 3), 3, "%2X", bt_address.addr[i]);
+               if (i < 5)  // Delimeter
+                       sBtmac[i * 3 + 2] = ':';
+       }
+       for (i = 0; i < MAC_ADDR_STR_LEN; i++) {
+               if (sBtmac[i] == ' ')
+                       sBtmac[i] = '0';
+       }
+       ConvertCapitalMac(sBtmac);
+}
+
+void IPCServer::ReadWifiMAC(char *sWifimac)
+{
+       char *mac_addr = NULL;
+       int rv = 0;
+
+       // WIFI MAC
+       rv = wifi_get_mac_address(&mac_addr);
+
+       if (rv != WIFI_ERROR_NONE) {
+               REMOTE_PRINT_INFO("Fail to get WIFI MAC address [%d]", rv);
+    } else {
+               ConvertCapitalMac(mac_addr);
+               if (strncmp(mac_addr, DEFAULT_MAC_ADDRESS, strlen(DEFAULT_MAC_ADDRESS))) {
+                       memcpy(sWifimac, mac_addr, MAC_ADDR_STR_LEN);
+                       REMOTE_PRINT_INFO("WIFI mac is %s", sWifimac);
+               } else {
+                       REMOTE_PRINT_INFO("Invalid WIFI MAC loaded = [%s]", mac_addr);
+               }
+       }
+
+       g_free(mac_addr);
+}
+
+char IPCServer::make_p2p_mac(char c)
+{
+       char convert_c = c;
+       if ((convert_c >= 'A') && (convert_c <= 'F')) {
+               convert_c = ((((convert_c - 'A') + 10) | 0x02) - 10) + 'A';
+       } else if ((convert_c >= '0') && (convert_c <= '9')) {
+               convert_c = ((convert_c - '0') | 0x02);
+               if (convert_c < 10)
+                       convert_c = convert_c + '0';
+               else
+                       convert_c = 'A' + (convert_c - 10);
+       } else {
+               REMOTE_PRINT_FATAL("error : wrong byte for mac!");
+       }
+       return convert_c;
+}
+
+void IPCServer::Read_p2p_MAC(char *p2pmac)
+{
+       char *temp_addr = NULL;
+
+       memset(p2pmac, 0x0, MAC_ADDR_STR_LEN);
+
+       temp_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+       if (temp_addr == NULL) {
+               REMOTE_PRINT_FATAL("vconf_get_str Failed for %s", VCONFKEY_WIFI_BSSID_ADDRESS);
+       } else {
+               memcpy(p2pmac, temp_addr, MAC_ADDR_STR_LEN - 1);
+               p2pmac[1] = make_p2p_mac(p2pmac[1]);
+               REMOTE_PRINT_INFO("P2P mac is %s", p2pmac);
+               free(temp_addr);
+       }
+}
+
diff --git a/PinCodeService/IPCServer.h b/PinCodeService/IPCServer.h
new file mode 100755 (executable)
index 0000000..9c39ea6
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/** 
+ * @file       IPCServer.h
+ * @brief      Create socket and Send, Recv by socket
+ *
+ * IPCServer Class definition file
+ * Copyright 2013 by Samsung Electronics, Inc.,
+ */
+
+#ifndef _IPCSERVER_H_
+#define _IPCSERVER_H_
+
+#include <sys/select.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string>
+#include "REMOTEThread.h"
+//#include "IInfoCallback.h"
+#include "json/json.h"
+#include "MSFVconfDefine.h"
+#include "wifi.h"
+
+#define PCS_REMOTE_SOCKET_PATH "/tmp/pcs"
+
+#undef LOG_TAG
+#define LOG_TAG "Remote_Daemon"
+
+
+/**
+ * @class      IPCServer
+ * @brief      IPCServer Class use BSD socket. Make socket for TV connection and Thread for recv
+ *
+ * @see        Packet
+ * Copyright 2013 by Samsung Electronics, Inc.,
+ */
+class IPCServer : public REMOTE::Thread {
+private:
+
+protected:
+       int m_socket;
+       pthread_mutex_t mutex;
+       std::string PinCodeToDisplay;
+//     IInfoCallback* callback;
+
+protected:
+       void t_Main(void);
+
+       bool PacketParse(FILE *file, int sock);
+       std::string MakeInformation();
+
+public:
+       /**
+        * @fn                  IPCServer(void);
+        * @brief               Constructor of IPCServer
+        * @exception   N/A
+        */
+       IPCServer(void);
+       /**
+        * @fn                  IPCServer(void);
+        * @brief               Destructor of IPCServer
+        * @exception   N/A
+        */
+       virtual ~IPCServer(void);
+
+       /**
+        * @fn                  int Init();
+        * @brief               Initialize socket and regist callback function.
+        * @param[in]   parser  Callback function to process received packet.
+        * @return              int             If return value is over 0, Initialize is success. 
+        * @exception   N/A
+        */
+       int Init(void);
+
+       /**
+        * @fn                  void Final(void);
+        * @brief               Close and Release socket.
+        * @return              void
+        * @exception   N/A
+        */
+       void Final(void);
+
+       /**
+        * @fn                  static void* SocketThread(void* arg);
+        * @brief               Thread function for iPhone/Linux
+        * @return              void*
+        * @exception   N/A
+        */
+       static void* SocketThread(void *arg);
+
+       /**
+        * @fn                  void SocketProcess(void);
+        * @brief               Actually SocketProcess method work receive from server. It's called by SocketThread method.
+        * @return              void*
+        * @exception   N/A
+        */
+       void SocketProcess(void);
+
+       std::string GetPinCode();
+       std::string GetPINFromAppID(std::string appID);
+       bool GetPanelResolution(int &width, int &height);
+       static int cb(int msgType, void *cookie, void *userdata);
+       void UpdateMITNode();
+       int IsAgreedSmartHubTerms(void);
+       //void SetCallback(IInfoCallback* cb);
+private:
+       void ReadBTMAC(char *);
+       void ReadWifiMAC(char *);
+       void Read_p2p_MAC(char *);
+       char make_p2p_mac(char);
+       void ConvertCapitalMac(char *);
+       //void VDCurlMessageSend(void);
+       //static void getMSFAppInfo_cb(keynode_t *key, void* data);
+};
+
+#endif /* _IPCSERVER_H_ */
diff --git a/PinCodeService/MSFServer.cpp b/PinCodeService/MSFServer.cpp
new file mode 100755 (executable)
index 0000000..204b4c0
--- /dev/null
@@ -0,0 +1,547 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include "MSFServer.h"
+#include "CCDebugRemote.h"
+#include <app_manager.h>
+#include "app_control.h"
+#include "system_info.h" // to use capi-system-info package api
+#include "MSFVconfDefine.h"
+#include "MSFSend.h"
+#include "REMOTEString.h"
+#include "RemoteLogger.h"
+#include "REMOTEApp.h"
+#include <aul.h>
+#include <unistd.h>
+#include <tzplatform_config.h>
+
+int callee_pid;                // callee's pid. for launching and terminating the corresponding app
+
+MSFServer::MSFServer(void)
+{
+       m_socket = -1;
+       recvThread = 0;
+}
+
+MSFServer::~MSFServer(void)
+{
+       Final();
+}
+
+int MSFServer::Init()
+{
+       REMOTE_SYSPRINT_INFO("[%s][%d] Init", __PRETTY_FUNCTION__, __LINE__);
+
+       if ((m_socket = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+               REMOTE_PRINT_INFO("[%s][%d] IPCServer socket error", __PRETTY_FUNCTION__, __LINE__);
+               return -1;
+       }
+
+       if ( 0 == unlink(MSF_SOCKET_PATH))
+               REMOTE_PRINT_INFO("[%s][%d] MSFServer remove file", __PRETTY_FUNCTION__, __LINE__);
+       else
+               REMOTE_PRINT_WARN("[%s][%d] MSFServer failed to remove file!", __PRETTY_FUNCTION__, __LINE__);
+
+       struct sockaddr_un serveraddr;
+       memset(&serveraddr, 0, sizeof(struct sockaddr_un));
+       serveraddr.sun_family = AF_UNIX;
+       strncpy(serveraddr.sun_path, MSF_SOCKET_PATH, strlen(MSF_SOCKET_PATH));
+
+       if (bind(m_socket, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) == -1) {
+               //Error
+               REMOTE_PRINT_WARN("[%s][%d] MSFServer socket bind error ", __PRETTY_FUNCTION__, __LINE__);
+               goto error;
+       }
+
+       if (listen(m_socket, 1) == -1) {        //Max 5 people
+               //Error
+               REMOTE_PRINT_WARN("[%s][%d] MSFServer socket listen error", __PRETTY_FUNCTION__, __LINE__);
+               goto error;
+       }
+
+       if (launchLock.FlagCreate() == false)
+               launchLock.Create();
+
+       StartRecv();
+       return 1;
+
+error:
+       Final();
+       return -1;
+}
+
+void MSFServer::Final(void)
+{
+       if (m_socket == -1)
+               return;
+
+       REMOTE_PRINT_INFO("[%s][%d] ClientSocket.Close %d", __PRETTY_FUNCTION__, __LINE__, m_socket);
+       shutdown(m_socket, SHUT_RDWR);
+       close(m_socket);
+
+       if (launchLock.FlagCreate() == true)
+               launchLock.Destroy();
+
+       m_socket = -1;
+       REMOTE_PRINT_INFO("[%s][%d] ClientSocket.Close() Exit ~~", __PRETTY_FUNCTION__, __LINE__);
+}
+
+int MSFServer::StartRecv(void)
+{
+       pthread_attr_t tattr;
+       pthread_attr_init(&tattr);
+       pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+       pthread_attr_setstacksize(&tattr, 128 * 1024);
+       int result = pthread_create(&recvThread, &tattr, MSFServer::SocketThread, this);
+       pthread_attr_destroy(&tattr);
+       return result;
+}
+
+void MSFServer::SocketProcess(void)
+{
+       while (true) {
+               struct sockaddr_un address;
+               socklen_t addrSize = sizeof(struct sockaddr_un);
+               int sock = (int)accept(m_socket, (struct sockaddr *)&address, &addrSize);
+
+               if (sock  < 0)
+                       break;
+
+               int fd;
+               fd = dup(sock);
+               if(fd < 0) {
+                       REMOTE_PRINT_WARN("[%s][%d] File Descriptor is negative, so there is an error", __PRETTY_FUNCTION__, __LINE__);
+                       close(sock);
+                       continue;
+               }
+
+               FILE *file = fdopen(fd, "r+");
+
+               if (file == NULL) {
+                       REMOTE_PRINT_WARN("[%s][%d] Can't open file descriptor", __PRETTY_FUNCTION__, __LINE__);
+                       close(fd);
+                       close(sock);
+                       continue;
+               }
+
+               PacketParse(file, sock);
+               close(fd);
+               shutdown(sock, SHUT_RDWR);
+               close(sock);
+               fclose(file);
+       }
+}
+
+void* MSFServer::SocketThread(void *arg)
+{
+       MSFServer *client = (MSFServer *)arg;
+       client->SocketProcess();
+       return NULL;
+}
+
+bool MSFServer::PacketParse(FILE *file, int sock)
+{
+       int status = 0 ;
+       vconf_get_int(VCONFKEY_REMOTE_SERVER_MLS_STATE_DB, &status);
+       REMOTE_PRINT_INFO("**************************** Checking for the MLS state*************************************** %d ", status);
+
+       if (status)
+               return false;
+
+       long length = 0;
+       int result = fscanf(file, "%ld,", &length);
+       if (result <= 0) {
+               REMOTE_PRINT_INFO("[%s][%d] Error to process MSFServer command", __PRETTY_FUNCTION__, __LINE__);
+               return false;
+       }
+
+       REMOTE_PRINT_INFO("[%s][%d] Get data length %ld", __PRETTY_FUNCTION__, __LINE__, length);
+
+       //Read real data
+       if ((length > 0) && (length < 8192)) {
+               char *content = new char[length + 1];
+               memset(content, 0, length + 1);
+               int contentLength = fread(content, 1, length, file);
+
+               if (length != contentLength) {
+                       REMOTE_PRINT_INFO("[%s][%d] Error to get data, length = %ld, get length = %d", __PRETTY_FUNCTION__, __LINE__, length, contentLength);
+                       delete[] content;
+                       return false;
+               }
+
+               ParseJSON(sock, content);
+               delete[] content;
+       } else {
+               return false;
+       }
+       return true;
+}
+
+void MSFServer::ParseJSON(int sock, std::string contents)
+{
+       std::string json_message = std::string(contents);
+
+       REMOTE_PRINT_INFO("[%s][%d] Get data %s", __PRETTY_FUNCTION__, __LINE__, json_message.c_str());
+       try {
+               // Parse json_message
+               Json::Value root;
+               Json::Reader reader;
+               Json::FastWriter writer;
+               bool parsingError = reader.parse(json_message, root, false);
+               if (!parsingError) {
+                       REMOTE_PRINT_INFO("[%s][%d] Error to parse json data, json message = %s", __PRETTY_FUNCTION__, __LINE__, json_message.c_str());
+                       CMSFSend::SendErrorMessage(sock, MSF_JSON_ERROR, std::string("Error to parse JSON data."), json_message, Json::Value(std::string("")));
+                       return;
+               }
+
+               if (root["id"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, "", "id");
+                       return;
+               }
+               std::string id = root["id"].asString();
+
+               if (root["method"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, id, "method");
+                       return;
+               }
+               std::string method = root["method"].asString();
+               Json::Value params = root["params"];    // 'params' can be NULL.
+
+               if (params.isNull()) {
+                       REMOTE_PRINT_INFO("[%s][%d] Get data %s", __PRETTY_FUNCTION__, __LINE__, json_message.c_str());
+                       CMSFSend::SendErrorMessage(sock, MSF_JSON_ERROR, std::string("Error to parse JSON data."), json_message, Json::Value(std::string("")));
+               } else {
+                       if (launchLock.FlagCreate())
+                               launchLock.Lock();
+
+                       if (method.compare("application.getApplication") == 0) {
+                               DoGetApplication(sock, params, id);
+                       } else if (method.compare("application.partyMode") == 0) {
+                               DoCheckPartyMode(sock, params, id);
+                       } else if (method.compare("application.launchApplication") == 0) {
+                               DoLaunchApplication(sock, params, id);
+                       } else if (method.compare("application.stopApplication") == 0) {
+                               DoStopApplication(sock, params, id);
+                       } else if (method.compare("application.installApplication") == 0) {
+                               DoInstallApplication(sock, params, id);
+                       } else if (method.compare("application.aclPairing") == 0) {
+                               DoACLPairing(sock, params, id);
+                       } else if (method.compare("application.getCastingAppsInfo") == 0) {
+                       } else {
+                               REMOTE_PRINT_INFO("[%s][%d] Get data %s", __PRETTY_FUNCTION__, __LINE__, json_message.c_str());
+                               CMSFSend::SendErrorMessage(sock, MSF_JSON_ERROR, std::string("Error to parse JSON data."), json_message, Json::Value(std::string("")));
+                       }
+                       if (launchLock.FlagCreate())
+                               launchLock.Unlock();
+               }
+       } catch (Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : params/ method / id ");
+       }
+}
+
+void MSFServer::DoGetApplication(int sock, Json::Value& params, std::string id)
+{
+       std::string widgetname;
+       std::string ver;
+       try {
+               REMOTE_PRINT_INFO("D %s\n", __PRETTY_FUNCTION__);
+               if (params["appId"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, id, "id");
+                       return;
+               }
+               std::string appID = params["appId"].asString();
+               REMOTE_PRINT_INFO("[%s][%d] getApplication ID = %s", __PRETTY_FUNCTION__, __LINE__,  appID.c_str());
+       //      was_app_info_s widget_info;
+               Json::Value appInfo = Json::Value(Json::objectValue);
+               Json::Value resp;
+
+               //Make JSON response message
+               appInfo["appId"] = Json::Value(appID);
+
+               if (widgetList.find(appID) != widgetList.end()) {
+                       ver = widgetList[appID].version;
+                       widgetname = widgetList[appID].name;
+               }
+
+               REMOTE_PRINT_INFO("[%s][%d] version = %s, widget name = %s", __PRETTY_FUNCTION__, __LINE__, ver.c_str(), widgetname.c_str());
+
+               if (ver.size() > 0)
+                       appInfo["version"] = Json::Value(ver);
+               else
+                       appInfo["version"] = Json::Value("none");
+
+               if (widgetname.size() > 0)
+                       appInfo["name"] = Json::Value(widgetname);
+               else
+                       appInfo["name"] = Json::Value("none");
+
+               bool running = false;
+
+               if (aul_app_is_running_for_uid(appID.c_str(), tzplatform_getuid(TZ_SYS_DEFAULT_USER)))
+                       running = true;
+
+               appInfo["running"] = Json::Value(running);
+               CMSFSend::SendRespMessage(sock, id, appInfo);
+       } catch (Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : appId/ version / id / name / result");
+       }
+}
+
+void MSFServer::DoLaunchApplication(int sock, Json::Value& params, std::string id)
+{
+       REMOTE_PRINT_INFO("D %s\n", __PRETTY_FUNCTION__);
+
+       try {
+               if (params["appId"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, id, "id");
+                       return;
+               }
+               std::string appID = params["appId"].asString();
+               std::string Url = params["url"].asString();
+
+               std::string clientIP = params["clientIp"].asString();
+               std::string deviceName = params["deviceName"].isNull()? "SmartView Device": params["deviceName"].asString();
+               Json::Value param = params["data"];
+
+               std::string parameter("");
+               parameter = param["id"].isNull()? "": param["id"].asString();
+
+               REMOTE_PRINT_DEBUG("[%s][%d] Launch AppIDsssss = %s, Parameter = [%s], clientIP = [%s]\n", __PRETTY_FUNCTION__, __LINE__, appID.c_str(), parameter.c_str(), clientIP.c_str());
+
+               //Check App is installed
+
+               if (NULL != appID.c_str()) {
+                       int pid = aul_app_get_pid_for_uid((const char *)appID.c_str(), tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+                       REMOTE_PRINT_INFO("BEFORE aul_app_get_pid:[%d] \n", pid);
+               
+                       REMOTE_PRINT_INFO("[%s][%d] Launch AppID = %s, Parameter = [%s]\n", __PRETTY_FUNCTION__, __LINE__, appID.c_str(), parameter.c_str());
+
+                       if (!params["url"].isNull() && appID == "org.tizen.browser")
+                               callee_pid = REMOTE::App::launch_browser((const char *)Url.c_str());
+                       else
+                               callee_pid = REMOTE::App::launch_app((const char *)appID.c_str());
+
+                       REMOTE_PRINT_INFO("REMOTE::App::launch_app callee_pid:[%d] \n", callee_pid);
+
+                       pid = aul_app_get_pid_for_uid((const char *)appID.c_str(), tzplatform_getuid(TZ_SYS_DEFAULT_USER)); // for_uid
+
+                       REMOTE_PRINT_INFO("AFTER aul_app_get_pid:[%d] \n", pid);
+
+                       if (0 <= callee_pid)
+                               REMOTE_PRINT_INFO("  Launch remote-server succesfull ");
+                       else
+                               REMOTE_PRINT_INFO("  Launch remote-server failed ");
+
+                       //Wait for starting
+                       int count = 0;
+
+                       while (count++ < 10) {
+                               if (aul_app_is_running_for_uid(appID.c_str(), tzplatform_getuid(TZ_SYS_DEFAULT_USER)))
+                                       break;
+
+                               usleep(500000);
+                       }
+               } else {
+                       CMSFSend::SendErrorMessage(sock, MSF_NOTFOUND, std::string("Not found error."), std::string(""), id);
+                       return;
+               }
+
+               CMSFSend::SendRespMessage(sock, id, Json::Value(true));
+       } catch(Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : appId/ clientIp/ data/ silent/ id/ testmode/ url");
+       }
+}
+
+void MSFServer::DoStopApplication(int sock, Json::Value& params, std::string id)
+{
+       REMOTE_PRINT_DEBUG(" DoStopApplication");
+       try {
+               if (params["appId"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, id, "id");
+                       return;
+               }
+               std::string appID = params["appId"].asString();
+       //      was_app_info_s widget_info;
+
+               int ret;
+
+               if (aul_app_is_running_for_uid(appID.c_str(), tzplatform_getuid(TZ_SYS_DEFAULT_USER))) {
+                       ret = REMOTE::App::terminate_app(callee_pid);
+                       if (ret < 0) {
+                               REMOTE_PRINT_INFO("REMOTE::App::terminate_app FAIL [%d]", ret);
+                               // resp["result"] = "false";
+                       } else {
+                               REMOTE_PRINT_INFO("REMOTE::App::terminate_app SUCCESS");
+                               // resp["result"] = "true";
+                       }
+               }
+
+               CMSFSend::SendRespMessage(sock, id, Json::Value(true));
+       } catch (Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : appId / id / url / result");
+       }
+}
+
+void MSFServer::DoInstallApplication(int sock, Json::Value& params, std::string id)
+{
+       try {
+               REMOTE_PRINT_INFO("D %s\n", __PRETTY_FUNCTION__);
+
+               if (params["appId"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, id, "appId");
+                       return;
+               }
+               std::string appID = params["appId"].asString();
+
+               if (appID != "org.tizen.browser") {
+                       CMSFSend::SendErrorMessage(sock, MSF_NOTFOUND, std::string("Not found error."), std::string(""), id);
+                       return ;
+               }
+
+               REMOTE_PRINT_INFO("D %s\n", __PRETTY_FUNCTION__);
+               REMOTE_PRINT_INFO("[INFO] We do NOT support this function 'DoInstallApplication' now. Sorry.");
+
+               CMSFSend::SendRespMessage(sock, id, Json::Value(true));
+       } catch (Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : appId / id ");
+       }
+}
+
+void MSFServer::DoCheckPartyMode(int sock, Json::Value& params, std::string id)
+{
+       REMOTE_PRINT_INFO("D %s\n", __PRETTY_FUNCTION__);
+
+       try {
+               if (params["appId"].isNull()) {
+                       CMSFSend::SendParamsErrorMessage(sock, id, "appId");
+                       return;
+               }
+               std::string appID = params["appId"].asString();
+               Json::Value rslt = Json::Value(Json::objectValue);
+               rslt["result"] = Json::Value(true);
+               rslt["id"] = id;
+
+               REMOTE_PRINT_INFO("D %s\n", __PRETTY_FUNCTION__);
+               REMOTE_PRINT_INFO("[INFO] We do NOT support this function 'DoCheckPartyMode' now. Sorry.");
+
+               rslt["partyMode"] = Json::Value(false);
+               rslt["running"] = Json::Value(false);
+
+               CMSFSend::SendRespMessage(sock, id, Json::Value(rslt));
+       } catch(Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : appId / id / partyMode / running / result");
+       }
+}
+
+bool MSFServer::checkAppsId(vector<std::string> appIdElement)
+{
+       if (appIdElement[0].length() > MAX_APPS_ID || (string::npos != appIdElement[0].find_first_not_of("0123456789"))) {
+               REMOTE_PRINT_WARN("[%s][%d] Apps Id have to be consist of digit", __PRETTY_FUNCTION__, __LINE__);
+               return false;
+       }
+       return true;
+}
+
+bool MSFServer::checkWidgetId(std::vector<std::string> appIdElement)
+{
+       std::vector<std::string>::iterator it;
+       bool flag = true;
+
+       for (it = appIdElement.begin(); it != appIdElement.end(); ++it) {
+               unsigned int max = flag? MAX_PROJECT_NAME: MAX_PACKAGE_ID;
+               flag = !flag;
+
+               if ((*it).length() > max || std::string::npos != (*it).find_first_of("~!@#$%^&*()_-+=|\'\"[]{}<>?/.,;:`")) {
+                       REMOTE_PRINT_WARN("[%s][%d] Widget Id have to be consist of digit or character", __PRETTY_FUNCTION__, __LINE__);
+                       return false;
+               }
+       }
+       return true;
+}
+
+bool MSFServer::CheckValidOfappId(std::string id)
+{
+       if (id.length() > MAX_PROJECT_NAME + MAX_PACKAGE_ID + 1)
+               return false;
+
+       int typeOfAppId = REMOTE::String::Split(id, appIdElement, ".");
+
+       bool isValid = false;
+       switch (typeOfAppId) {
+       case 0:
+               isValid = checkAppsId(appIdElement);
+               break;
+       case 2:
+               isValid = checkWidgetId(appIdElement);
+               break;
+       default:
+               isValid = false;
+               break;
+       }
+
+       REMOTE_PRINT_DEBUG("[%s][%d] AppId's validation is [ %d ] \n", __PRETTY_FUNCTION__, __LINE__, isValid);
+       return isValid;
+}
+
+void MSFServer::DoACLPairing(int sock, Json::Value& params, std::string id)
+{
+}
+
+int MSFServer::DecodeBase64(const char *src, int srcLength, char *dst)
+{
+       int i = 0;
+       int offset = 0;
+       int dstIndex = 0;
+
+       while (offset < srcLength) {
+               unsigned int block = 0;
+               int encodingSize = srcLength - offset;
+               if (encodingSize > 4)
+                       encodingSize = 4;
+
+               for (i = 0; i < encodingSize; i++) {
+                       char val = 0;
+                       if (src[offset] >= 'A' && src[offset] <= 'Z')
+                               val = src[offset] - 'A';
+                       else if (src[offset] >= 'a' && src[offset] <= 'z')
+                               val = src[offset] - 'a' + 'Z' - 'A' + 1;
+                       else if (src[offset] >= '0' && src[offset] <= '9')
+                               val = src[offset] - '0' + ('Z' - 'A' + 1) * 2;
+                       else if (src[offset] == '+')
+                               val = 62;
+                       else if (src[offset] == '/')
+                               val = 63;
+
+                       if (src[offset] != '=') {
+                               unsigned int decode = 0;
+                               decode = val;
+
+                               decode = decode << (encodingSize - i - 1) * 6;
+                               block |= decode;
+                       }
+                       offset++;
+               }
+
+               for (i = 0; i < encodingSize - 1; i++)
+                       memcpy(&dst[dstIndex++], ((char *)&block) + encodingSize - i - 2, 1);
+       }
+       return dstIndex;
+}
+
diff --git a/PinCodeService/MSFServer.h b/PinCodeService/MSFServer.h
new file mode 100755 (executable)
index 0000000..4722ca7
--- /dev/null
@@ -0,0 +1,144 @@
+/*\r
+ *\r
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+#ifndef _MSFSERVER_H_\r
+#define _MSFSERVER_H_\r
+\r
+#include <sys/select.h>\r
+#include <unistd.h>\r
+#include <pthread.h>\r
+#include <sys/types.h>\r
+#include <sys/socket.h>\r
+#include <sys/un.h>\r
+#include <netinet/in.h>\r
+#include <arpa/inet.h>\r
+#include <netdb.h>\r
+#include <unistd.h>\r
+#include <string.h>\r
+#include <sys/ioctl.h>\r
+#include <errno.h>\r
+#include <stdlib.h>\r
+#include <string>\r
+#include <map>\r
+#include <vector>\r
+#include <list>\r
+#include <json/json.h>\r
+#include "REMOTEMutex.h"\r
+\r
+#undef LOG_TAG\r
+#define LOG_TAG "Remote_Daemon"\r
+\r
+#define MSF_SOCKET_PATH        "/tmp/msf"\r
+#define MSF_BUFFER_SIZE        (256)\r
+\r
+#define PARTYMODE_APPID "org.volt.partymode"\r
+#define CLOUD_APPID "3201412000694"\r
+\r
+#define MAX_PROJECT_NAME 10\r
+#define MAX_PACKAGE_ID 50\r
+#define MAX_APPS_ID 13\r
+\r
+struct MSFApplicationInfo {\r
+       std::string id;\r
+       std::string version;\r
+       std::string name;\r
+};\r
+\r
+struct MSF_WIDGET_INFO {\r
+       std::string id;\r
+       std::string name;\r
+       std::string version;\r
+       std::string runtitle;\r
+};\r
+\r
+class MSFServer {\r
+protected:\r
+       int m_socket;\r
+       pthread_t recvThread;\r
+       REMOTE::Mutex launchLock;\r
+\r
+       std::map<std::string/* App id */, struct MSF_WIDGET_INFO> widgetList;\r
+       std::map<std::string/* App name */, std::string/* App id */> widgetNameMap;\r
+       std::vector<std::string> appIdElement;\r
+\r
+       int DecodeBase64(const char *src, int srcLength, char *dst);\r
+       bool CheckValidOfappId(std::string id);\r
+       bool checkAppsId(std::vector<std::string> appIdElement);\r
+       bool checkWidgetId(std::vector<std::string> appIdElement);\r
+\r
+       bool PacketParse(FILE *file, int sock);\r
+       void ParseJSON(int sock, std::string contents);\r
+       int StartRecv(void);\r
+\r
+       void DoGetApplication(int sock, Json::Value& params, std::string id);\r
+       void DoLaunchApplication(int sock, Json::Value& params, std::string id);\r
+       void DoStopApplication(int sock, Json::Value& params, std::string id);\r
+       void DoInstallApplication(int sock, Json::Value& params, std::string id);\r
+       void DoACLPairing(int sock, Json::Value& params, std::string id);\r
+\r
+public:\r
+       /**\r
+        * @fn                  MSFServer(void);\r
+        * @brief               Constructor of NGameManager\r
+        * @exception   N/A\r
+        */\r
+       MSFServer(void);\r
+       /**\r
+        * @fn                  ~MSFServer(void);\r
+        * @brief               Destructor of NGameManager\r
+        * @exception   N/A\r
+        */\r
+       virtual ~MSFServer(void);\r
+\r
+       /**\r
+        * @fn                  int Init();\r
+        * @brief               Initialize socket and regist callback function.\r
+        * @param[in]   parser  Callback function to process received packet.\r
+        * @return              int             If return value is over 0, Initialize is success. \r
+        * @exception   N/A\r
+        */\r
+       int Init(void);\r
+\r
+       /**\r
+        * @fn                  void Final(void);\r
+        * @brief               Close and Release socket.\r
+        * @return              void\r
+        * @exception   N/A\r
+        */\r
+       void Final(void);\r
+\r
+       /**\r
+        * @fn                  static void* SocketThread(void* arg);\r
+        * @brief               Thread function for iPhone/Linux\r
+        * @return              void*\r
+        * @exception   N/A\r
+        */\r
+       static void* SocketThread(void *arg);\r
+\r
+       /**\r
+        * @fn                  void SocketProcess(void);\r
+        * @brief               Actually SocketProcess method work receive from server. It's called by SocketThread method.\r
+        * @return              void*\r
+        * @exception   N/A\r
+        */\r
+       void SocketProcess(void);\r
+\r
+       void DoCheckPartyMode(int sock, Json::Value& params, std::string id);\r
+};\r
+\r
+#endif /* _MSFSERVER_H_ */\r
diff --git a/PinCodeService/Util/MSFSend.cpp b/PinCodeService/Util/MSFSend.cpp
new file mode 100755 (executable)
index 0000000..e1775b0
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "MSFSend.h"
+#include "CCDebugRemote.h"
+
+#include <stdio.h>
+#include <sys/socket.h>
+
+#undef LOG_TAG
+#define LOG_TAG "Remote_Daemon"
+
+void CMSFSend::SendRespMessage(int sock, std::string id, Json::Value result)
+{
+       try {
+               Json::Value resp = Json::Value(Json::objectValue);
+               resp["id"] = id;
+               resp["result"] = result;
+               Json::FastWriter writer;
+               Send(sock, writer.write(resp));
+       } catch (Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : result/ id ");
+       }
+}
+
+void CMSFSend::SendParamsErrorMessage(int sock, std::string id, std::string parameter)
+{
+       try {
+               SendErrorMessage(sock, MSF_INVALID_PARAMS, std::string("Parameter not found."), parameter, Json::Value(id));
+       } catch(Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception :  id");
+       }
+}
+
+void CMSFSend::SendErrorMessage(int sock, int errorCode, std::string errorMessage, std::string errorData, Json::Value id)
+{
+       REMOTE_PRINT_DEBUG("[%s]%s", __PRETTY_FUNCTION__, errorMessage.c_str());
+       try {
+               Json::Value errorJson = Json::Value(Json::objectValue);
+               errorJson["error"] = Json::Value(Json::objectValue);
+               errorJson["error"]["code"] = Json::Value(errorCode);
+               errorJson["error"]["message"] = Json::Value(errorMessage);
+               errorJson["error"]["data"] = Json::Value(errorData);
+               errorJson["id"] = id;
+               Json::FastWriter writer;
+               Send(sock, writer.write(errorJson));
+       } catch(Json::Exception& e) {
+               REMOTE_PRINT_WARN("JSON exception : error/ code / message/ data / id");
+       }
+}
+
+void CMSFSend::Send(int sock, std::string data)
+{
+       char length[64] = "";
+       snprintf(length, 63, "%d,", data.length());
+
+       std::string sendmsg = std::string(length) + data;
+       int sendmsgLength = sendmsg.length();
+       const char *sendmsg_ptr = sendmsg.c_str();
+
+       REMOTE_PRINT_INFO("[%s][%d] \n######### %s\n", __PRETTY_FUNCTION__, __LINE__, sendmsg.c_str());
+
+       int sent = 0;
+       do {
+               sent += send(sock, sendmsg_ptr + sent, sendmsgLength - sent, 0);
+       } while (sent < sendmsgLength);
+       //sendmsg_ptr = null;
+}
diff --git a/PinCodeService/Util/MSFSend.h b/PinCodeService/Util/MSFSend.h
new file mode 100755 (executable)
index 0000000..8f3c39f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef _MSF_SEND_H_
+#define _MSF_SEND_H_
+
+#include <string>
+#include <json/json.h>
+#include "json/writer.h"
+
+#define MSF_NOTFOUND (-4004)
+#define MSF_ALREADY_INSTALLED (-4009)
+#define MSF_NOTRUNNING (-4444)
+#define MSF_UNAUTHORIZED (-4001)
+#define MSF_FAIL (-4444)
+#define MSF_INVALID_PARAMS     (-32602)
+#define MSF_JSON_ERROR (-32700)
+#define MLS_NOT_SUPPORTED (-4010)
+
+class CMSFSend {
+public:
+       static void SendRespMessage(int sock, std::string id, Json::Value result);
+       static void SendParamsErrorMessage(int sock, std::string id, std::string parameter);
+       static void SendErrorMessage(int sock, int errorCode, std::string errorMessage, std::string errorData, Json::Value id);
+       static void Send(int sock, std::string data);
+};
+#endif // _MSF_SEND_H_
diff --git a/PinCodeService/Util/MSFVconfDefine.h b/PinCodeService/Util/MSFVconfDefine.h
new file mode 100755 (executable)
index 0000000..a9f2c00
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/** 
+ * @file       IPCServer.h
+ * @brief      Create socket and Send, Recv by socket
+ *
+ * IPCServer Class definition file
+ * Copyright 2013 by Samsung Electronics, Inc.,
+ */
+
+#ifndef _MSFDEFINE_H_
+#define _MSFDEFINE_H_
+
+#include <vconf.h>           // Tizen vconf Header
+#include <vconf-keys.h>
+
+#define VCONFKEY_REMOTE_SERVER_COUNTRY_ID "db/comss/countrycode"
+#define VCONFKEY_REMOTE_SERVER_DUID  "db/comss/duid"
+#define VCONFKEY_REMOTE_SERVER_MODEL_ID "db/comss/modelid"
+#define VCONFKEY_REMOTE_SERVER_DEVICE_NAME "db/menu/network/devicename/tv_name"
+#define VCONFKEY_REMOTE_SERVER_INFOLINK_VER "db/comss/infolinkversion"
+#define VCONFKEY_REMOTE_SERVER_DEVELOPER_MODE "db/sdk/develop/mode"
+#define VCONFKEY_REMOTE_SERVER_DEVELOPER_IP "db/sdk/develop/ip"
+#define VCONFKEY_REMOTE_SERVER_ATOKEN "db/comss/atoken"
+#define VCONFKEY_REMOTE_SERVER_HUB_TERMS "db/menu/smart_hub/homedatacontrol/defaultdisclaimeragree"
+#define VCONFKEY_REMOTE_SERVER_MLS_STATE_DB "db/mls/mls_state"
+#define VCONFKEY_REMOTE_SERVER_DEVICE_PSID "db/adagent/psid"
+
+#endif /* _MSFDEFINE_H_ */
diff --git a/PinCodeService/Util/RemoteLogger.cpp b/PinCodeService/Util/RemoteLogger.cpp
new file mode 100755 (executable)
index 0000000..bafecb8
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+#include <RemoteLogger.h>
+#include <CCDebugRemote.h>
+#include <vconf.h>
+#include <system_info.h>
+#include "MSFVconfDefine.h"
+
+
+CRemoteLogger* CRemoteLogger::s_pInstance = NULL;
+
+CRemoteLogger::CRemoteLogger(void)
+{
+       m_stMSFBIConf[eMSFBI_connect_installedapp].Name = std::string("CONNECT_INSTALLEDAPP");
+       m_stMSFBIConf[eMSFBI_connect_installedapp].Type = std::string("EV001");
+
+       m_stMSFBIConf[eMSFBI_connect_cloudapp].Name = std::string("CONNECT_CLOUDAPP");
+       m_stMSFBIConf[eMSFBI_connect_cloudapp].Type = std::string("EV002");
+
+       m_stMSFBIConf[eMSFBI_disconnect_installedapp].Name = std::string("DISCONNECT_INSTALLED");
+       m_stMSFBIConf[eMSFBI_disconnect_installedapp].Type = std::string("EV003");
+
+       m_stMSFBIConf[eMSFBI_disconnect_cloudapp].Name = std::string("DISCONNECT_CLOUDAPP");
+       m_stMSFBIConf[eMSFBI_disconnect_cloudapp].Type = std::string("EV004");
+
+       m_stMSFBIConf[eMSFBI_show_installpage].Name = std::string("INSTALL_APP");
+       m_stMSFBIConf[eMSFBI_show_installpage].Type = std::string("EV005");
+
+       m_stMSFBIConf[eMSFBI_dial].Name = std::string("DIAL_CONNECT");
+       m_stMSFBIConf[eMSFBI_dial].Type = std::string("EV006");
+
+       m_stMSFBIConf[eMSFBI_error].Name = std::string("ERROR_LOG");
+       m_stMSFBIConf[eMSFBI_error].Type = std::string("EV007");
+
+       m_stMSFBIConf[eMSFBI_connect_mediareceiver].Name = std::string("CONNECT_MEDIARECEIVE");
+       m_stMSFBIConf[eMSFBI_connect_mediareceiver].Type = std::string("EV008");
+
+       m_stMSFBIConf[eMSFBI_disconnect_mediareceiver].Name = std::string("DISCONNECT_MEDIARECE");
+       m_stMSFBIConf[eMSFBI_disconnect_mediareceiver].Type = std::string("EV009");
+
+       m_stMSFBIConf[eMSFBI_dial_device_allow].Name = std::string("DIAL_DEVICE_ALLOW");
+       m_stMSFBIConf[eMSFBI_dial_device_allow].Type = std::string("EV010");
+
+       m_stMSFBIConf[eMSFBI_dial_device_deny].Name = std::string("DIAL_DEVICE_DENY");
+       m_stMSFBIConf[eMSFBI_dial_device_deny].Type = std::string("EV011");
+}
+
+CRemoteLogger::~CRemoteLogger(void)
+{
+       if (s_pInstance != NULL) {
+               delete s_pInstance;
+               s_pInstance = NULL;
+       }
+}
+
+CRemoteLogger* CRemoteLogger::Get(void)
+{
+       if (NULL == s_pInstance)
+               s_pInstance = new CRemoteLogger();
+
+       return s_pInstance;
+}
+
+bool CRemoteLogger::AddBILog(eMSFBIType eType, std::string data1, std::string data2)
+{
+       std::string sDescription;
+       switch (eType) {
+       case eMSFBI_connect_installedapp:
+       case eMSFBI_disconnect_installedapp:
+       case eMSFBI_show_installpage:
+               sDescription.append("{ai=");
+               sDescription.append(data1);
+               sDescription.append(";er=");
+               sDescription.append(data2);
+               sDescription.append("}");
+               break;
+       case eMSFBI_connect_cloudapp:
+       case eMSFBI_disconnect_cloudapp:
+               sDescription.append("{au=");
+               sDescription.append(data1);
+               sDescription.append(";er=");
+               sDescription.append(data2);
+               sDescription.append("}");
+               break;
+       case eMSFBI_dial:
+               sDescription.append("{ai=");
+               sDescription.append(data1);
+               sDescription.append("}");
+               break;
+       case eMSFBI_error:
+               sDescription.append("{er=");
+               sDescription.append(data1);
+               sDescription.append("}");
+               break;
+       case eMSFBI_connect_mediareceiver:
+       case eMSFBI_dial_device_allow:
+       case eMSFBI_dial_device_deny:
+               sDescription.append("{ty=");
+               sDescription.append(data1);
+               sDescription.append("}");
+               break;
+       case eMSFBI_disconnect_mediareceiver:
+               sDescription.append("{}");
+               break;
+       default:
+               return false;
+       }
+
+       return AddEventLog(m_stMSFBIConf[eType].Name, m_stMSFBIConf[eType].Type, sDescription);
+}
+
+bool CRemoteLogger::AddEventLog(const std::string sEventName, const std::string sCategory, const std::string sDesc)
+{
+       if (false == m_Create()) {
+               REMOTE_PRINT_FATAL("cannot create logger instance");
+               return false;
+       }
+
+    time_t timer;
+    time(&timer);
+    char strTime[32] = {0, };
+
+    tm p;
+    localtime_r(&timer, &p);
+    p.tm_year = p.tm_year + 1900;
+    p.tm_mon = p.tm_mon + 1;
+
+    snprintf(strTime, 32, "%04d-%02d-%02dT%02d:%02d:%02d+%02d%02d", p.tm_year, p.tm_mon, p.tm_mday, p.tm_hour, p.tm_min, p.tm_sec, 0, 0);
+
+    std::string strTimeStamp(strTime);
+
+    m_GetFWVersion();
+    REMOTE_PRINT_DEBUG("KPI Log [%s] (%s)", sEventName.c_str(), sDesc.c_str());
+
+       return true;
+}
+
+bool CRemoteLogger::m_Create(void)
+{
+       for (int i = 1; i < eMSFBI_MAX; i++) {
+               m_stMSFBIConf[i].strLoglevel = "5";
+               m_stMSFBIConf[i].iLogLevel = EVENT_LOGLEVEL;
+       }
+
+       //add events
+       for (int i = 1; i < eMSFBI_MAX; i++) {
+       }
+
+       char *strPSID = NULL;
+       strPSID = vconf_get_str(VCONFKEY_REMOTE_SERVER_DEVICE_PSID);
+       REMOTE_PRINT_DEBUG("psid : %s", strPSID);
+       free(strPSID);
+
+       return true;
+}
+
+bool CRemoteLogger::m_GetFWVersion(void)
+{
+       char *strBuildVer = NULL;
+
+       if (strBuildVer != NULL) {
+               m_strFWVersion.assign(strBuildVer);
+               free(strBuildVer);
+               strBuildVer = NULL;
+       } else {
+               if (strBuildVer == NULL) {
+                       REMOTE_PRINT_DEBUG("ERR: no build version");
+                       return false;
+               }
+       }
+       return true;
+}
+
diff --git a/PinCodeService/Util/RemoteLogger.h b/PinCodeService/Util/RemoteLogger.h
new file mode 100755 (executable)
index 0000000..12ad5f4
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef _RM_KPILOG_H_
+#define _RM_KPILOG_H_
+
+#include <string>
+
+using namespace std;
+
+typedef enum _eMSFBIType {
+       eMSFBI_connect_installedapp = 1,
+       eMSFBI_connect_cloudapp,
+       eMSFBI_disconnect_installedapp,
+       eMSFBI_disconnect_cloudapp,
+       eMSFBI_show_installpage,
+       eMSFBI_dial,
+       eMSFBI_error,
+       eMSFBI_connect_mediareceiver,
+       eMSFBI_disconnect_mediareceiver,
+       eMSFBI_dial_device_allow,
+       eMSFBI_dial_device_deny,
+       eMSFBI_MAX
+} eMSFBIType;
+
+typedef struct _MSFBIconf {
+       std::string Name;
+       std::string Type;
+       int iLogLevel;
+       std::string strLoglevel;
+} MSFBIconf;
+
+#define QUEUE_MAX 30
+#define EXPIRATION 60
+#define THRESHOLD 0
+#define LOGLEVEL 10
+#define EVENT_LOGLEVEL 5
+#define INFO_LINK_OPERATIING_SERVER 0   //dummy
+
+class CRemoteLogger {
+public:
+       MSFBIconf m_stMSFBIConf[eMSFBI_MAX];
+
+       CRemoteLogger(void);
+       ~CRemoteLogger(void);
+
+       static CRemoteLogger* Get(void);
+       bool AddBILog(eMSFBIType eType, std::string data, std::string err);
+       bool AddEventLog(const std::string sEventName, const std::string sCategory, const std::string sDesc);
+
+private:
+  static CRemoteLogger *s_pInstance;
+
+  bool m_Create(void);
+  std::string m_pServerURL;
+
+  bool m_GetFWVersion(void);
+  std::string m_strFWVersion;
+};
+
+#endif /* _RM_KPILOG_H_ */
diff --git a/Src/Common/REMOTEApp.cpp b/Src/Common/REMOTEApp.cpp
new file mode 100755 (executable)
index 0000000..bd6d08a
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "REMOTEApp.h"
+#include <aul.h>
+#include <aul_svc.h> // for using aul_svc_set_uri()
+#include <bundle.h>
+#include <tzplatform_config.h>
+#include "CCDebugRemote.h"
+
+int _iter_visible_cb(const aul_app_info *info, void *data)
+{
+       int ret;
+       int *pid = (int *)data;
+
+       ret = aul_app_get_status_bypid_for_uid(info->pid, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       if (STATUS_VISIBLE == ret) {
+               PRINT_INFO("[%s][%d] STATUS_VISIBLE [%d]", __PRETTY_FUNCTION__, __LINE__, info->pid);
+
+               *pid = info->pid;
+
+               return -1;
+       }
+
+       return 0;
+}
+
+int REMOTE::App::launch_app(const char *appid)
+{
+       // if SUCCESS,  return callee's pid
+       // if FAIL,     return negative value
+
+       PRINT_INFO("[FUNC] rep_launch_app");
+
+       int ret;
+
+       bundle *pBundle = bundle_create();
+
+       if (BUNDLE_ERROR_NONE != bundle_add_str(pBundle, "AppId", appid)) {
+               PRINT_INFO("[%s][%d] bundle_add_str FAIL", __PRETTY_FUNCTION__, __LINE__);
+               bundle_free(pBundle);
+
+               return -1;
+       }
+
+       if (aul_app_is_running_for_uid(appid, tzplatform_getuid(TZ_SYS_DEFAULT_USER)))
+               aul_resume_app_for_uid(appid, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+       else
+               ret = aul_launch_app_for_uid(appid, pBundle, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       if (ret < 0) {
+               PRINT_INFO("[%s][%d] aul_launch_app FAIL [%d]", __PRETTY_FUNCTION__, __LINE__, ret);
+
+               return ret;
+       }
+
+       if (BUNDLE_ERROR_NONE != bundle_free(pBundle)) { // free bundle
+               PRINT_INFO("[%s][%d] bundle_free FAIL", __PRETTY_FUNCTION__, __LINE__);
+
+               return -1;
+       }
+
+       PRINT_INFO("[%s][%d] rep_launch_app SUCCESS [%d]", __PRETTY_FUNCTION__, __LINE__, ret);
+
+       return ret;
+}
+
+int REMOTE::App::launch_browser(const char *url)
+{
+       // if SUCCESS,  return callee's pid
+       // if FAIL,     return negative value
+
+       PRINT_INFO("[FUNC] rep_launch_browser");
+
+       int ret;
+
+       bundle *pBundle = bundle_create();
+
+       if (BUNDLE_ERROR_NONE != bundle_add_str(pBundle, "AppId", "org.tizen.browser")) {
+               PRINT_INFO("[%s][%d] bundle_add_str FAIL", __PRETTY_FUNCTION__, __LINE__);
+               bundle_free(pBundle);
+
+               return -1;
+       }
+
+       aul_svc_set_uri(pBundle, url); // url setting API
+
+       if (aul_app_is_running_for_uid("org.tizen.browser", tzplatform_getuid(TZ_SYS_DEFAULT_USER)))
+               aul_resume_app_for_uid("org.tizen.browser", tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+       else
+               ret = aul_launch_app_for_uid("org.tizen.browser", pBundle, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       if (ret < 0) {
+               PRINT_INFO("[%s][%d] aul_launch_app FAIL [%d]", __PRETTY_FUNCTION__, __LINE__, ret);
+
+               return ret;
+       }
+
+       if (BUNDLE_ERROR_NONE != bundle_free(pBundle)) { // free bundle
+               PRINT_INFO("[%s][%d] bundle_free FAIL", __PRETTY_FUNCTION__, __LINE__);
+
+               return -1;
+       }
+
+       PRINT_INFO("[%s][%d] rep_launch_app SUCCESS [%d]", __PRETTY_FUNCTION__, __LINE__, ret);
+
+       return ret;
+}
+
+int REMOTE::App::terminate_app(int pid)
+{
+       // current state: CREATE or PAUSED
+       // if SUCCESS,  return 0
+       // if FAIL,     return negative value
+
+       PRINT_INFO("[FUNC] rep_terminate_app");
+
+       int ret;
+
+       if (pid < 0) {
+               return -1;
+       } else {
+               ret = aul_terminate_pid_for_uid(pid, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+               if (ret < 0) {
+                       PRINT_INFO("[%s][%d] aul_terminate_pid FAIL [%d], PID [%d]", __PRETTY_FUNCTION__, __LINE__, ret, pid);
+
+                       return ret;
+               }
+       }
+
+       PRINT_INFO("[%s][%d] rep_terminate_app SUCCESS [%d], PID [%d]", __PRETTY_FUNCTION__, __LINE__, ret, pid);
+
+       return ret;
+}
+
+int REMOTE::App::get_current_showing_app(int *pid)
+{
+       PRINT_INFO("[FUNC] rep_get_current_showing_app [%d]", *pid);
+
+       int ret;
+
+       ret = aul_app_get_running_app_info_for_uid(_iter_visible_cb, pid, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       if (ret < 0) {
+               PRINT_INFO("[%s][%d] FAIL [%d]", __PRETTY_FUNCTION__, __LINE__, ret);
+
+               return ret;
+       }
+
+       PRINT_INFO("[%s][%d] SUCCESS [%d], pid:[%d]", __PRETTY_FUNCTION__, __LINE__, ret, *pid);
+
+       return ret;
+}
+
+int REMOTE::App::get_current_showing_app(char **appid)
+{
+       PRINT_INFO("[FUNC] rep_get_current_showing_app");
+
+       int ret;
+       int *pid = NULL;
+
+       ret = aul_app_get_running_app_info_for_uid(_iter_visible_cb, pid, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       if (ret < 0) {
+               PRINT_INFO("[%s][%d] FAIL [%d]", __PRETTY_FUNCTION__, __LINE__, ret);
+
+               return ret;
+       }
+
+       PRINT_INFO("[%s][%d] SUCCESS [%d], pid:[%d]", __PRETTY_FUNCTION__, __LINE__, ret, *pid);
+
+       ret = aul_app_get_appid_bypid_for_uid(*pid, *appid, sizeof(*appid), tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       return ret;
+}
+
+int REMOTE::App::get_app_status(int pid, int *status)
+{
+       int ret;
+
+       ret = aul_app_get_status_bypid_for_uid(pid, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+
+       if (ret < 0) {
+               return -1;
+       } else {
+               *status = ret;
+
+               return 0;
+       }
+}
+
diff --git a/Src/Common/REMOTEMutex.cpp b/Src/Common/REMOTEMutex.cpp
new file mode 100755 (executable)
index 0000000..3cb58c8
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*
+ * REMOTEMutex.h
+ *
+ *  Created on: 31-08-2013
+ *      Author: shivaram.y
+ */
+
+#include "REMOTEMutex.h"
+
+/*!
+ * This function creates a PCMutex object.
+ *
+ * \return true on success, otherwise false.
+ * \see Destroy()
+ */
+bool REMOTE::Mutex::Create(void)
+{
+       ASSERT(FlagCreate() == false);
+
+       if (m_sem.Create(1) == false)
+               return false;
+
+       m_threadId = 0;
+
+       return true;
+}
+
+/*!
+ * This function destroys the PCMutex object.
+ *
+ * \return true on success, otherwise false.
+ */
+void REMOTE::Mutex::Destroy(void)
+{
+       ASSERT(FlagCreate() == true);
+
+       m_sem.Destroy();
+
+       return;
+}
+
+/*!
+ * This function locks the created PCMutex object.
+ *
+ * \see Unlock(), Try()
+ */
+void REMOTE::Mutex::Lock(void)
+{
+       ASSERT(FlagCreate() == true);
+
+       if (m_threadId == (int)pthread_self()) {
+               m_count++;
+
+               return;
+       }
+
+       m_sem.Take();
+
+       m_threadId = (int)pthread_self();
+       m_count = 1;
+
+       return;
+}
+
+/*!
+ * If this function succeeds, the memeber variable that saves the
+ * thread ID will be set to the current thread ID.
+ *
+ * \return true on success, otherwise false.
+ * \see Lock(), Unlock()
+ */
+bool REMOTE::Mutex::Try(unsigned long msec)
+{
+       ASSERT(FlagCreate() == true);
+
+       if (m_threadId == (int)pthread_self()) {
+               m_count++;
+
+               return true;
+       }
+
+       if (m_sem.Try(msec) == false)
+               return false;
+
+       m_threadId = (int)pthread_self();
+       m_count = 1;
+
+       return true;
+}
+
+/*
+ * This function unlocks the PCMutex object.
+ *
+ * \return true on success, otherwise false.
+ * \see Lock(), Try()
+ */
+bool REMOTE::Mutex::Unlock(void)
+{
+       ASSERT(FlagCreate() == true);
+
+       if (m_threadId != (int)pthread_self())
+               return false;
+
+       m_count--;
+
+       if (m_count > 0)
+               return true;
+
+       m_threadId = 0;
+
+       m_sem.Give();
+
+       return true;
+}
diff --git a/Src/Common/REMOTESemaphore.cpp b/Src/Common/REMOTESemaphore.cpp
new file mode 100755 (executable)
index 0000000..422609d
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*
+ * REMOTESemaphore.h
+ *
+ *  Created on: 31-08-2013
+ *      Author: shivaram.y
+ */
+
+#include "REMOTESemaphore.h"
+#include <pthread.h>
+#include <errno.h>
+#include <semaphore.h>
+#include <sys/time.h>
+//#include <sys/resource.h>
+#include <time.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#define CONFIG_MAXIMUM_YIELD_COUNTER 16
+#define INFINITY ~0
+static unsigned char semCounter = CONFIG_MAXIMUM_YIELD_COUNTER;
+
+struct PTSemaphore {
+    pthread_cond_t  cond;
+    int             count;
+};
+
+pthread_mutex_t TimeMutex;
+
+
+/*!
+ * This function creates a PCSemaphore object.
+ *
+ * \param count Semaphore counter
+ * \return true on success, otherwise false.
+ *
+ * \see Destroy()
+ */
+bool REMOTE::Semaphore::Create(int count)
+{
+       pthread_mutex_lock(&TimeMutex);
+
+       pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+       m_id = new PTSemaphore;
+
+       if (m_id != NULL) {
+               m_id->cond  = cond;
+               m_id->count = count;
+       }
+
+       pthread_mutex_unlock(&TimeMutex);
+
+       return m_id != NULL;
+}
+
+/*!
+ * This function destroys the PCSemaphore object.
+ *
+ * \see Create()
+ */
+void REMOTE::Semaphore::Destroy()
+{
+       pthread_mutex_lock(&TimeMutex);
+
+       pthread_cond_destroy(&m_id->cond);
+       delete m_id;
+
+       m_id = NULL;
+       pthread_mutex_unlock(&TimeMutex);
+
+       return;
+}
+
+void REMOTE::Semaphore::Take(void)
+{
+       pthread_mutex_lock(&TimeMutex);
+
+       while (m_id->count <= 0) {
+               pthread_cond_wait(&m_id->cond, &TimeMutex);
+       }
+
+       m_id->count--;
+
+       pthread_mutex_unlock(&TimeMutex);
+
+       return;
+}
+
+bool REMOTE::Semaphore::Try(unsigned long msec)
+{
+       if (msec == (unsigned long)INFINITY) {
+               Take();
+
+               return true;
+       }
+
+       pthread_mutex_lock(&TimeMutex);
+
+       struct timeval  now;
+       struct timespec timeout;
+       int             ret = 0;
+       bool            tf;
+
+       if (msec == 0) {
+               if (m_id->count <= 0) {
+                       tf = false;
+               } else {
+                       tf = true;
+
+                       m_id->count--;
+               }
+       } else {
+               while ((m_id->count <= 0) && (ret != ETIMEDOUT)) {
+                       gettimeofday(&now, NULL);
+                       timeout.tv_sec  = now.tv_sec + msec / 1000;
+                       timeout.tv_nsec = now.tv_usec + msec % 1000 * 1000;
+
+                       while (timeout.tv_nsec > 1000000) {
+                               timeout.tv_nsec -= 1000000;
+                               timeout.tv_sec++;
+                       }
+
+                       timeout.tv_nsec *= 1000;
+
+                       ret = pthread_cond_timedwait(&m_id->cond, &TimeMutex, &timeout);
+               }
+
+               if (ret == ETIMEDOUT) {
+                       tf = false;
+               } else {
+                       tf = true;
+
+                       m_id->count--;
+               }
+       }
+
+       pthread_mutex_unlock(&TimeMutex);
+
+       return tf;
+}
+
+void REMOTE::Semaphore::Give(void)
+{
+       pthread_mutex_lock(&TimeMutex);
+       m_id->count++;
+       pthread_cond_signal(&m_id->cond);
+       pthread_mutex_unlock(&TimeMutex);
+
+       if (!semCounter--) {
+               sched_yield();
+               semCounter = CONFIG_MAXIMUM_YIELD_COUNTER;
+       }
+
+       return;
+}
+
diff --git a/Src/Common/REMOTEString.cpp b/Src/Common/REMOTEString.cpp
new file mode 100755 (executable)
index 0000000..f47f322
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * REMOTEString.h
+ *
+ *  Created on: 31-08-2013
+ *      Author: shivaram.y
+ */
+
+#include "REMOTEString.h"
+#include "CCDebugRemote.h"
+/*!
+ * This function compares the two strings \p dest and \p source.
+ * It returns an integer less than, equal to, or greater than zero
+ * if \p dest is found, to be less than, to match, or to be greater
+ * than \p source, respectively.
+ *
+ * \param dest The first null-terminated string to compare
+ * \param source The second null-terminated string to compare
+ *
+ * \return The function returns an integer less than, equal
+ *         to, or greater than zero if \p dest is found to be less
+ *         than, to match, or to be greater than \p source, respectively.
+ *
+ * \see Diff(const char*, const char*, unsigned int)
+ */
+int REMOTE::String::Diff(const char *dest, const char *source)
+{
+       ASSERT(dest != NULL);
+       ASSERT(source != NULL);
+
+       return strcmp(dest, source);
+}
+
+/*!
+ * This function is similar to Diff(const char*, const char*),
+ * except it only compares the first (at most) \p size characters
+ * of \p dest and \p source.
+ *
+ * \param dest The first null-terminated string to compare
+ * \param source The second null-terminated string to compare
+ * \param size The number of characters to compare
+ *
+ * \return The function returns an integer less than, equal to,
+ *         or greater than zero if \p dest (or the first \p size bytes
+ *         thereof) is found, to be less than, to match, or to be
+ *         greater than \p source, respectively.
+ *
+ * \see Diff(const char*, const char*)
+ */
+int REMOTE::String::Diff(const char *dest, const char *source, unsigned long size)
+{
+       ASSERT(dest != NULL);
+       ASSERT(source != NULL);
+
+       return strncmp(dest, source, size);
+}
+
+
+/*!
+ * This function is similar to Copy(char*. const char*),
+ * except that not more than \p size bytes of \p source are copied.
+ * Thus, if there is no null byte among the first \p size bytes of \p source,
+ * the result will not be null-terminated.
+ *
+ * In the case where the length of \p source is less than that of \p size,
+ * the remainder of \p dest will be padded with nulls.
+ *
+ * \param dest (out) The destination string
+ * \param source The source string
+ * \param size The number of characters to copy
+ *
+ * \see Copy(char*. const char*), PCMem::Copy(), PCWString::Copy()
+ */
+void REMOTE::String::Copy(char *dest, const char *source, unsigned long size)
+{
+       ASSERT(dest != NULL);
+       ASSERT(source != NULL);
+
+       strncpy(dest, source, size);
+
+       return;
+}
+
+unsigned int REMOTE::String::Length(const char *pString)
+{
+       return strlen(pString);
+}
+
+
+/*
+*/
+
+string REMOTE::String::ReplaceAll(const std::string& targetString, const std::string& src, const std::string& dest)
+{
+       string retString = targetString;
+
+       string::size_type Pos = 0;
+       Pos = retString.find_first_of(src, Pos);
+
+       while (string::npos != Pos) {
+               retString.replace(Pos, src.length(), dest);
+               Pos += dest.length();
+               Pos = retString.find_first_of(src, Pos);
+       }
+
+       return retString;
+}
+int REMOTE::String::Split(const string& targetString, vector<string>& tokens, const string& delimiters = " ")
+{
+       int numberOfSplited = 0;
+       if (!tokens.empty())
+               tokens.clear();
+
+    string::size_type startPos = targetString.find_first_not_of(delimiters, 0);
+    string::size_type foundPos = targetString.find_first_of(delimiters, startPos);
+       if (string::npos == foundPos) {
+               tokens.push_back(targetString);
+               return numberOfSplited;
+       }
+
+       while (string::npos != foundPos || string::npos != startPos) {
+               ++numberOfSplited;
+               tokens.push_back(targetString.substr(startPos, foundPos - startPos));
+               startPos = targetString.find_first_not_of(delimiters, foundPos);
+               foundPos = targetString.find_first_of(delimiters, startPos);
+       }
+
+       return numberOfSplited;
+}
diff --git a/Src/Common/REMOTEThread.cpp b/Src/Common/REMOTEThread.cpp
new file mode 100755 (executable)
index 0000000..47c6706
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*
+ * REMOTETime.h
+ *
+ *  Created on: 31-08-2013
+ *      Author: shivaram.y
+ */
+
+/**
+ * @file    REMOTEThread.cpp
+ * @author  Shivaram Yadav (shivaram.y@samsung.com)
+ * @version 1.0
+ * @brief   REMOTEThread source file
+ */
+
+#include "REMOTEThread.h"
+
+REMOTE::Thread::Thread()
+{
+       isREMOTEThreadRunning = false;
+}
+
+REMOTE::Thread::~Thread()
+{
+       this->Destroy();
+}
+
+/*!
+ * This function starts REMOTEThread execution.
+ *
+ * \param thread REMOTEThread instance
+ * \see Create()
+ *
+ */
+void runREMOTEThread(REMOTE::Thread *thread)
+{
+       thread->t_Main();
+}
+
+/*!
+ * This function creates REMOTEThread object.
+ *
+ * \param stackSize Size of stack
+ *
+ * \return true on success, otherwise false.
+ *
+ * \see Destroy()
+ */
+bool REMOTE::Thread::Create(unsigned long stackSize)
+{
+       boost::mutex::scoped_lock REMOTEScopedLock(REMOTEThreadMutex);
+
+       ASSERT(FlagCreate() == false);
+
+//    It seems that boost:thread::attributes are not available in boost on Tizen,
+
+//    Setting REMOTE Thread attributes:
+//    boost::thread::attributes REMOTEThreadAttributes;
+//    REMOTEThreadAttributes.set_stack_size(stackSize);
+
+//    Starting REMOTE Thread:
+//    boost::thread REMOTEThread(REMOTEThreadAttributes, runREMOTEThread, this);
+
+       boost::thread REMOTEThread(runREMOTEThread, this);
+       isREMOTEThreadRunning = true;
+
+       return true;
+}
+
+/*!
+ * This function destroys the REMOTEThread.
+ *
+ * \see Create()
+ */
+void REMOTE::Thread::Destroy(void)
+{
+       isREMOTEThreadRunning = false;
+       return;
+}
+
+/*!
+ * This function returns REMOTEThread Id.
+ *
+ * \return threadNumber
+ */
+int REMOTE::Thread::Id(void)
+{
+       std::string threadId = boost::lexical_cast<std::string>(boost::this_thread::get_id());
+       unsigned long threadNumber = 0;
+       sscanf(threadId.c_str(), "%lx", &threadNumber);
+       return threadNumber;
+}
+
diff --git a/main.cpp b/main.cpp
new file mode 100755 (executable)
index 0000000..3609dbc
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,231 @@
+/*
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*Product: Samsung NService Framework (remote-server)
+ * Version: 1.0
+ *
+ * Copyright 2013-2014 SWC, Samsung Electronics, Inc.
+ * All rights reserved.
+ */
+
+/**
+ * @file       main.cpp
+ * @brief      This file is resposible to run the convergence manager as deamon.
+                and initialize the RCR and convergence manager
+ * @created on: 2013.10.30
+ * @author: Shivaram Yadav (shivaram.y@samsung.com)
+ * @reviewer: Ji-Hoon Kim(jihoon95.kim@samsung.com), Han Kang (han264,kang@samsung.com)
+ */
+
+
+#include <CCDebugRemote.h>
+
+#include "IPCServer.h"
+#include "MSFServer.h"
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <glib.h>
+#include <systemd/sd-daemon.h>
+#include <sys/stat.h>
+#include <wait.h>
+#include <vconf.h>
+#include "net_connection.h"
+
+extern "C" {
+    #include <argos.h>
+}
+
+#define config_path_nservice "/opt/usr/apps/remote-server"
+#define uri_nservice         "nservice/"
+
+#define NOTIFY_TIME 15000      //watchdog notify time
+
+#undef LOG_TAG
+#define LOG_TAG "Remote_Daemon"
+
+
+static GMainLoop*    mainloop = NULL;
+IPCServer* ipc_server = NULL;
+MSFServer* msf_server = NULL;
+const char *service_name = "remote-server";
+
+gboolean watchdog_notify_callback(gpointer data)
+{
+       int ret = 0;
+       ret = aw_notify();
+
+       if(ret < 0)
+       {
+               REMOTE_PRINT_WARN("smart_deadlock_watchdog_notify failed return = %d", ret);
+       }
+
+
+       REMOTE_PRINT_WARN("[sd_notify debug] called sd_notify() : ret = %d : Proc : %s(%d)", ret, service_name, (unsigned long)getpid());
+
+       return TRUE;
+}
+
+static void CheckWifiSecurityEncryption(connection_h connection_info)
+{
+       //Check_Result (Wifi Check for Omission OK : 0, Not OK : 1)
+       //int Check_Result = 1;
+
+       REMOTE_PRINT_FATAL("CheckWifiSecurityEncryption START");
+
+       connection_h connection = connection_info;
+       connection_type_e connection_type;
+       connection_profile_h connection_profile;
+       connection_wifi_security_type_e connection_wifi_security_type;
+       connection_wifi_encryption_type_e connection_wifi_encryption_type;
+
+       if(connection == NULL)
+       {
+               REMOTE_PRINT_FATAL("Failed to get Connection Profile");
+               //pCMInstance->SetACLOmissionResult(Check_Result);
+               return;
+       }
+
+       // Check WIFI & WPA2 & AES (If all those are applied to TV, Allow Omission Access Popup)
+       if(connection_get_type(connection, &connection_type) == CONNECTION_ERROR_NONE)
+       {
+               if(connection_type == CONNECTION_TYPE_WIFI)
+               {
+                       if(connection_get_current_profile(connection, &connection_profile) != CONNECTION_ERROR_NONE)
+                       {
+                               REMOTE_PRINT_FATAL("Failed to get Connection Profile");
+                               //pCMInstance->SetACLOmissionResult(Check_Result);
+                               return;
+                       }
+
+                       if(connection_profile_get_wifi_security_type(connection_profile, &connection_wifi_security_type) != CONNECTION_ERROR_NONE)
+                       {
+                               REMOTE_PRINT_DEBUG("Failed to get Wifi Security Type");
+                       }
+                       else if (connection_profile_get_wifi_encryption_type(connection_profile, &connection_wifi_encryption_type) != CONNECTION_ERROR_NONE)
+                       {
+                               REMOTE_PRINT_DEBUG("Failed to get Wifi Encryption Type");
+                       }
+                       else if ( (connection_wifi_security_type == CONNECTION_WIFI_SECURITY_TYPE_WPA_PSK) &
+                               ( (connection_wifi_encryption_type == CONNECTION_WIFI_ENCRYPTION_TYPE_AES) || (connection_wifi_encryption_type == CONNECTION_WIFI_ENCRYPTION_TYPE_TKIP_AES_MIXED)))
+                       {
+                               //Check_Result = 0;
+                               REMOTE_PRINT_DEBUG("Wifi Check for Omission is OK");
+                               //pCMInstance->SetACLOmissionResult(Check_Result);
+                               return;
+                       }
+                       else
+                       {
+                               REMOTE_PRINT_DEBUG("Not Allow Ommission Of Access Popup : Because of Security type & Encryption type");
+                       }
+               }
+       }
+       else
+       {
+               REMOTE_PRINT_DEBUG("Failed to get Connection Type");
+       }
+       //pCMInstance->SetACLOmissionResult(Check_Result);
+       REMOTE_PRINT_FATAL("Wifi Check for Omission is Not OK");
+}
+
+void InitUpnpDevices()
+{
+       //Init IPC server
+       ipc_server = new IPCServer();
+       ipc_server->Init();
+
+       msf_server = new MSFServer();
+       msf_server->Init();
+}
+
+static void Setup_CMDaemon()
+{
+       InitUpnpDevices();
+
+       mainloop = g_main_loop_new(NULL, FALSE);
+}
+
+void getTvName_cb(keynode_t *key, void* data)
+{
+       ipc_server->UpdateMITNode(); // update Node Server When TV Name is changed.
+}
+
+void NetworkIPChanged_cb(const char* ipv4_address, const char* ipv6_address, void* user_data)
+{
+       if(ipv4_address != 0 && (strlen(ipv4_address) > 7))
+       {
+               REMOTE_PRINT_DEBUG("UpdateMITNode request, IP_address : [%s]", ipv4_address);
+               ipc_server->UpdateMITNode(); //update Node Server when IP is changed.
+
+               CheckWifiSecurityEncryption(user_data);
+       }
+       else
+       {
+               REMOTE_PRINT_DEBUG("There is no IP address");
+               //pCMInstance->SetACLOmissionResult(1); //Check WIFI for omission is 'Not OK'(1)
+       }
+}
+
+int main(void)
+{
+       REMOTE_PRINT_MAJOR("remote server main");
+       try
+       {
+               Setup_CMDaemon();
+
+               vconf_notify_key_changed("db/menu/network/devicename/tv_name", getTvName_cb, NULL);
+
+               if(mainloop != NULL)
+               {
+                       connection_h connection = NULL;
+                       int ret = -1;
+                       ret = connection_create(&connection);
+                       if(ret == CONNECTION_ERROR_NONE)
+                       {
+//                             connection_set_type_changed_cb(connection, NetworkTypeChanged_cb, NULL);
+                               CheckWifiSecurityEncryption(connection);
+                               connection_set_ip_address_changed_cb(connection, NetworkIPChanged_cb, connection);
+                       }
+                       else
+                       {
+                               REMOTE_PRINT_DEBUG("Fail to create connection_set_type_changed_cb\n");
+                       }
+                       //REMOTE_PRINT_DEBUG("Start Convergence Manager!");
+                       aw_register(60);
+
+                       g_timeout_add(NOTIFY_TIME, watchdog_notify_callback, mainloop);
+
+
+                       // Run GMainLoop
+                       REMOTE_PRINT_DEBUG("remote-server mainloop Start");
+                       g_main_loop_run(mainloop);
+                       g_main_loop_unref(mainloop);
+                       connection_destroy(connection);
+               }
+               else
+               {
+                       REMOTE_PRINT_WARN("Fail to start Convergence Manager!");
+               }
+
+               vconf_ignore_key_changed("db/menu/network/devicename/tv_name", getTvName_cb);
+       }
+       catch(...)
+       {
+       }
+       return 0;
+}
diff --git a/msf_tizen_client/AUTHORS b/msf_tizen_client/AUTHORS
new file mode 100644 (file)
index 0000000..7f2f6ad
--- /dev/null
@@ -0,0 +1,2 @@
+Sanggune Lee <sanggun7.lee@samsung.com>
+
diff --git a/msf_tizen_client/CMakeLists.txt b/msf_tizen_client/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..7252bc7
--- /dev/null
@@ -0,0 +1,64 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(msf-api)
+INCLUDE(GNUInstallDirs)
+
+# Targets
+SET(target_lib "msf-api")
+
+# Source Lists
+FILE(GLOB_RECURSE SRCS src/*.cpp)
+MESSAGE("Sources: ${SRCS}")
+
+# Dependencies
+SET(DEPS "glib-2.0 gio-2.0 json-glib-1.0 dlog openssl libwebsockets libcurl")
+
+SET(MAJORVER "0.1")
+SET(FULLVER "0.1")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -std=c++0x")
+
+INCLUDE(FindPkgConfig)
+INCLUDE_DIRECTORIES(
+${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+ADD_DEFINITIONS(-g -O2 -Wall -fPIC -Wl,--as-needed)
+
+# Building Library
+pkg_check_modules(lib_pkg REQUIRED ${DEPS})
+
+FOREACH(flag ${lib_pkg_CFLAGS})
+SET(LIB_EXTRA_CFLAGS "${LIB_EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target_lib} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target_lib} ${lib_pkg_LDFLAGS} nsd-dns-sd)
+SET_TARGET_PROPERTIES(${target_lib} PROPERTIES COMPILE_FLAGS ${LIB_EXTRA_CFLAGS})
+SET_TARGET_PROPERTIES(${target_lib} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"MSF\"")
+SET_TARGET_PROPERTIES(${target_lib} PROPERTIES SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${target_lib} PROPERTIES VERSION ${FULLVER})
+
+SET(VERSION ${FULLVER})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(PC_NAME ${PROJECT_NAME})
+SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+SET(PC_DESCRIPTION "Tizen MSF Shared Library")
+SET(PC_REQUIRED ${DEPS})
+SET(PC_LDFLAGS -l${target_lib})
+SET(PC_CFLAGS -I\${includedir}/msf-api)
+
+# Installing Library
+INSTALL(TARGETS ${target_lib} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries})
+INSTALL(
+DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/msf-api
+FILES_MATCHING PATTERN "*.h"
+)
+
+
+
+CONFIGURE_FILE(
+${PROJECT_NAME}.pc.in
+${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
+@ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
+ADD_SUBDIRECTORY(test)
diff --git a/msf_tizen_client/LICENSE b/msf_tizen_client/LICENSE
new file mode 100644 (file)
index 0000000..c575842
--- /dev/null
@@ -0,0 +1,203 @@
+Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                               Apache License
+                               Version 2.0, January 2004
+                               http://www.apache.org/licenses/
+
+       TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+       1. Definitions.
+
+       "License" shall mean the terms and conditions for use, reproduction,
+       and distribution as defined by Sections 1 through 9 of this document.
+
+       "Licensor" shall mean the copyright owner or entity authorized by
+       the copyright owner that is granting the License.
+
+       "Legal Entity" shall mean the union of the acting entity and all
+       other entities that control, are controlled by, or are under common
+       control with that entity. For the purposes of this definition,
+       "control" means (i) the power, direct or indirect, to cause the
+       direction or management of such entity, whether by contract or
+       otherwise, or (ii) ownership of fifty percent (50%) or more of the
+       outstanding shares, or (iii) beneficial ownership of such entity.
+
+       "You" (or "Your") shall mean an individual or Legal Entity
+       exercising permissions granted by this License.
+
+       "Source" form shall mean the preferred form for making modifications,
+       including but not limited to software source code, documentation
+       source, and configuration files.
+
+       "Object" form shall mean any form resulting from mechanical
+       transformation or translation of a Source form, including but
+       not limited to compiled object code, generated documentation,
+       and conversions to other media types.
+
+       "Work" shall mean the work of authorship, whether in Source or
+       Object form, made available under the License, as indicated by a
+       copyright notice that is included in or attached to the work
+       (an example is provided in the Appendix below).
+
+       "Derivative Works" shall mean any work, whether in Source or Object
+       form, that is based on (or derived from) the Work and for which the
+       editorial revisions, annotations, elaborations, or other modifications
+       represent, as a whole, an original work of authorship. For the purposes
+       of this License, Derivative Works shall not include works that remain
+       separable from, or merely link (or bind by name) to the interfaces of,
+       the Work and Derivative Works thereof.
+
+       "Contribution" shall mean any work of authorship, including
+       the original version of the Work and any modifications or additions
+       to that Work or Derivative Works thereof, that is intentionally
+       submitted to Licensor for inclusion in the Work by the copyright owner
+       or by an individual or Legal Entity authorized to submit on behalf of
+       the copyright owner. For the purposes of this definition, "submitted"
+       means any form of electronic, verbal, or written communication sent
+       to the Licensor or its representatives, including but not limited to
+       communication on electronic mailing lists, source code control systems,
+       and issue tracking systems that are managed by, or on behalf of, the
+       Licensor for the purpose of discussing and improving the Work, but
+       excluding communication that is conspicuously marked or otherwise
+       designated in writing by the copyright owner as "Not a Contribution."
+
+       "Contributor" shall mean Licensor and any individual or Legal Entity
+       on behalf of whom a Contribution has been received by Licensor and
+       subsequently incorporated within the Work.
+
+       2. Grant of Copyright License. Subject to the terms and conditions of
+       this License, each Contributor hereby grants to You a perpetual,
+       worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+       copyright license to reproduce, prepare Derivative Works of,
+       publicly display, publicly perform, sublicense, and distribute the
+       Work and such Derivative Works in Source or Object form.
+
+       3. Grant of Patent License. Subject to the terms and conditions of
+       this License, each Contributor hereby grants to You a perpetual,
+       worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+       (except as stated in this section) patent license to make, have made,
+       use, offer to sell, sell, import, and otherwise transfer the Work,
+       where such license applies only to those patent claims licensable
+       by such Contributor that are necessarily infringed by their
+Contribution(s) alone or by combination of their Contribution(s)
+       with the Work to which such Contribution(s) was submitted. If You
+       institute patent litigation against any entity (including a
+                       cross-claim or counterclaim in a lawsuit) alleging that the Work
+       or a Contribution incorporated within the Work constitutes direct
+       or contributory patent infringement, then any patent licenses
+       granted to You under this License for that Work shall terminate
+       as of the date such litigation is filed.
+
+       4. Redistribution. You may reproduce and distribute copies of the
+       Work or Derivative Works thereof in any medium, with or without
+       modifications, and in Source or Object form, provided that You
+       meet the following conditions:
+
+       (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+       (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+       (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+       (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+       You may add Your own copyright statement to Your modifications and
+       may provide additional or different license terms and conditions
+       for use, reproduction, or distribution of Your modifications, or
+       for any such Derivative Works as a whole, provided Your use,
+       reproduction, and distribution of the Work otherwise complies with
+       the conditions stated in this License.
+
+       5. Submission of Contributions. Unless You explicitly state otherwise,
+       any Contribution intentionally submitted for inclusion in the Work
+       by You to the Licensor shall be under the terms and conditions of
+       this License, without any additional terms or conditions.
+       Notwithstanding the above, nothing herein shall supersede or modify
+       the terms of any separate license agreement you may have executed
+       with Licensor regarding such Contributions.
+
+       6. Trademarks. This License does not grant permission to use the trade
+       names, trademarks, service marks, or product names of the Licensor,
+       except as required for reasonable and customary use in describing the
+       origin of the Work and reproducing the content of the NOTICE file.
+
+       7. Disclaimer of Warranty. Unless required by applicable law or
+       agreed to in writing, Licensor provides the Work (and each
+                       Contributor provides its Contributions) on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied, including, without limitation, any warranties or conditions
+       of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+       PARTICULAR PURPOSE. You are solely responsible for determining the
+       appropriateness of using or redistributing the Work and assume any
+       risks associated with Your exercise of permissions under this License.
+
+       8. Limitation of Liability. In no event and under no legal theory,
+       whether in tort (including negligence), contract, or otherwise,
+       unless required by applicable law (such as deliberate and grossly
+                       negligent acts) or agreed to in writing, shall any Contributor be
+       liable to You for damages, including any direct, indirect, special,
+       incidental, or consequential damages of any character arising as a
+       result of this License or out of the use or inability to use the
+       Work (including but not limited to damages for loss of goodwill,
+                       work stoppage, computer failure or malfunction, or any and all
+                       other commercial damages or losses), even if such Contributor
+       has been advised of the possibility of such damages.
+
+       9. Accepting Warranty or Additional Liability. While redistributing
+       the Work or Derivative Works thereof, You may choose to offer,
+       and charge a fee for, acceptance of support, warranty, indemnity,
+       or other liability obligations and/or rights consistent with this
+       License. However, in accepting such obligations, You may act only
+       on Your own behalf and on Your sole responsibility, not on behalf
+       of any other Contributor, and only if You agree to indemnify,
+       defend, and hold each Contributor harmless for any liability
+       incurred by, or claims asserted against, such Contributor by reason
+       of your accepting any such warranty or additional liability.
+
+       END OF TERMS AND CONDITIONS
+
+       APPENDIX: How to apply the Apache License to your work.
+
+       To apply the Apache License to your work, attach the following
+       boilerplate notice, with the fields enclosed by brackets "[]"
+       replaced with your own identifying information. (Don't include
+                       the brackets!)  The text should be enclosed in the appropriate
+       comment syntax for the file format. We also recommend that a
+       file or class name and description of purpose be included on the
+       same "printed page" as the copyright notice for easier
+       identification within third-party archives.
+
+       Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+
+       Licensed under the Apache License, Version 2.0 (the "License");
+       you may not use this file except in compliance with the License.
+       You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+       See the License for the specific language governing permissions and
+       limitations under the License.
diff --git a/msf_tizen_client/include/Application.h b/msf_tizen_client/include/Application.h
new file mode 100644 (file)
index 0000000..7ceaa00
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef _MSF_APPLICATION_H_
+#define _MSF_APPLICATION_H_
+
+#include"Result.h"
+#include"ApplicationInfo.h"
+#include"Channel.h"
+#include"Service.h"
+
+
+class Application:public Channel
+{
+public:
+       bool webapp;
+       static string ROUTE_APPLICATION;
+       static string ROUTE_WEBAPPLICATION;
+       static string curl_data;
+       bool install_result = false;
+       Result_Base *install_result_listener = NULL;
+
+       string createdata_data;
+       string curl_install_data;
+       typedef std::map<std::string, std::string> map_null;
+       map<string, string> *startArgs;
+       int curl_install(string uri);
+       int curl_application_calling(string uri);
+       map<string, string> getparams();
+       void invokeMethod(string method, map<string, string> params, Result_Base *);
+       void invokeMethod(string method, map<string, string> params,  string messageID, Result_Base *);
+       void realDisconnect(Result_Base *result);
+
+public:
+       Application();
+       Application(Service *service, string uri, string id);
+       Application(Service *service, string uri, string id, map<string, string> startArgs);
+       virtual ~Application();
+       Result_Base *result ;
+       bool isConnected();
+       bool isWebapp();
+       void createdata_process(string data);
+       void getinfo(Result_Base *result);
+       void connect();
+       void connect(Result_Base *r);
+       void connect(map<string, string> attributes, Result_Base *r);
+       void disconnect();
+       void disconnect(Result_Base *r);
+       void disconnect(bool stopOnDisconnect);
+       void install();
+       static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream);
+       static size_t createdata(char *buf, size_t size, size_t nmemb, void *up);
+       static Application create(Service *service, string uri);
+       static Application create(Service *service, string uri, string id, map<string, string>);
+       void start(Result_Base *result);
+       void stop(Result_Base *result);
+       void json_parse(const char *in);
+       static void foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data);
+       void setonInstallListener(Result_Base *listener);
+       void unsetonInstallListener();
+};
+
+#endif
diff --git a/msf_tizen_client/include/ApplicationInfo.h b/msf_tizen_client/include/ApplicationInfo.h
new file mode 100644 (file)
index 0000000..33c7f1b
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef _MSF_APPLICATION_INFO_H_
+#define _MSF_APPLICATION_INFO_H_
+
+#include <stdio.h>
+#include<iostream>
+#include <string.h>
+#include <json-glib/json-glib.h>
+#include <json-glib/json-parser.h>
+
+using namespace std;
+
+class ApplicationInfo
+{
+       string name;
+       string id;
+       string msf_version;
+       bool running;
+       static string PROPERTY_ID;
+       static string PROPERTY_STATE;
+       static string PROPERTY_NAME;
+       static string PROPERTY_VERSION;
+
+
+public:
+       string getID();
+       string getName();
+       string getVersion();
+       bool isRunning();
+       ApplicationInfo create(string data);
+       ApplicationInfo();
+       ApplicationInfo(string iD, bool state, string Name, string Version);
+       void json_parse(const char *in);
+       static void foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data);
+};
+
+#endif
diff --git a/msf_tizen_client/include/Channel.h b/msf_tizen_client/include/Channel.h
new file mode 100644 (file)
index 0000000..daccc7d
--- /dev/null
@@ -0,0 +1,265 @@
+#ifndef _CHANNEL_H_
+#define _CHANNEL_H_
+
+#include <libwebsockets.h>
+#include <list>
+#include <json-glib/json-glib.h>
+#include <json-glib/json-parser.h>
+#include "Result.h"
+#include "Error.h"
+#include "Message.h"
+#include "Client.h"
+
+using namespace std;
+
+class Service;
+class Clients;
+class Channel;
+
+class ChannelConnectionHandler {
+public:
+       ChannelConnectionHandler();
+       static string PING;
+       static string PONG;
+       static Channel *channel_ptr;
+       void run();
+       void setPingTimeout(long);
+       void resetLastPingReceived();
+       void calculateAverageRT();
+       void stopPing();
+       void startPing(Channel *);
+       static void *Pinging(void *);
+       static void ping_again(void *);
+       static pthread_t ping_thread;
+
+private:
+       long pingTimeout;
+       long lastPingReceived;
+       int numPings;
+       long startTime;
+       long pingSent;
+       double average;
+       long longestRT;
+       bool running;
+};
+
+enum Result_base_Type {
+       Result_Client = 1,
+       Result_bool = 2,
+       Result_ApplicationInfo = 3
+};
+
+typedef void (*_message_receive_cb)(Message msg);
+
+class OnConnectListener {
+public:
+       virtual void onConnect(Client Client) {}
+};
+
+class OnDisconnectListener {
+public:
+       virtual void onDisconnect(Client Client) {}
+};
+
+class OnClientConnectListener {
+public:
+       virtual void onClientConnect(Client Client) {}
+};
+
+class OnClientDisconnectListener {
+public:
+       virtual void onClientDisconnect(Client Client) {}
+};
+
+class OnReadyListener {
+public:
+       virtual void onReady() {}
+};
+
+class OnMessageListener {
+public:
+       virtual void onMessage(Message msg) {}
+};
+
+class OnErrorListener {
+public:
+       virtual void onError(/*Error error*/) {}
+};
+
+class Channel {
+public:
+       Channel();
+       Channel(Service *, string);
+       ~Channel();
+       static Channel *create(Service *service, string uri);
+       ChannelConnectionHandler *connectionHandler;
+       Clients *getclients();
+       Client getclient(string id);
+       void setConnectionTimeout(long timeout);
+       bool isConnected();
+       bool isWebSocketOpen();
+       bool connect();
+       void disconnect();
+       void set_connect_result(Result_Base *);
+       void unset_connect_result();
+       void set_disconnect_result(Result_Base *);
+       void unset_disconnect_result();
+       string getChannelUri(map<string, string> *);
+       void addOnMessageListener(string, OnMessageListener *);
+       void addOnAllMessageListener(OnMessageListener *);
+       void removeAllMessageListener();
+       void removeOnMessageListeners(string);
+       void removeOnMessageListener(string, OnMessageListener *);
+       void removeOnMessageListeners();
+       void removeAllListeners();
+       void register_message_receive_cb(_message_receive_cb cb);
+       void setonConnectListener(OnConnectListener *);
+       void unsetonConnectListener();
+       void setonDisconnectListener(OnDisconnectListener *);
+       void unsetonDisconnectListener();
+       void setonClientConnectListener(OnClientConnectListener *);
+       void unsetonClientConnectListener();
+       void setonClientDisconnectListener(OnClientDisconnectListener *);
+       void unsetonClientDisconnectListener();
+       void setonReadyListener(OnReadyListener *);
+       void unsetonReadyListener();
+       void setmessageListeners(list<OnMessageListener>);
+       void unsetmessageListeners();
+       void setonErrorListener(OnErrorListener *);
+       void unsetonErrorListener();
+       void publish(string event, const char *data);
+       void publish(string event, const char *data, unsigned char payload[],
+               int payload_size);
+       void publish(string event, const char *data, const char *target);
+       void publish(string event, const char *data, const char *target,
+               unsigned char payload[], int payload_size);
+       void publish(string event, const char *data, Client client);
+       void publish(string event, const char *data, Client client,
+               unsigned char payload[], int payload_size);
+       void publish(string event, const char *data, list<Client> clients);
+       void publish(string event, const char *data, list<Client> clients,
+               unsigned char payload[], int payload_size);
+       void publishMessage(string event, const char *data, const char *to,
+                       unsigned char payload[], int payload_size);
+       void publishMessage(string method, string event, const char *data,
+                       const char *to, unsigned char payload[],
+                       int payload_size);
+       // unsigned char *createBinaryMessage(string json, unsigned char payload[],
+       // int payload_size);
+       static void init_json_key_map();
+       static void foreach_json_object(JsonObject *object, const gchar *name,
+                               JsonNode *node, gpointer user_data);
+       static void foreach_json_array(JsonArray *object, guint index,
+                               JsonNode *node, gpointer user_data);
+
+       void set_isWrite(bool flag);
+       static int callback_lws_mirror(struct lws *wsi,
+                               enum lws_callback_reasons reason, void *user,
+                               void *in, size_t len);
+       static void *pt_startConnect(void *arg);
+
+       Clients *clients; //=new Clients(this );
+
+protected:
+       void start_app(char *data, int, string);
+       bool connect(Result_Base *result1);
+       bool connect(map<string, string>, Result_Base *result1);
+       void disconnect(Result_Base *result1);
+       void registerCallback(string, void *, int);
+       void handleError(string, Error);
+       string getipaddressfromUri(string uri);
+       string getapifromUri(string uri);
+       string getUID();
+
+       string ChannelID;
+       bool connected;
+       bool waitForOnReady;
+       Service *service;
+       string m_uri;
+       int errstatus;
+       int errcode;
+       string errMsg;
+       OnErrorListener *onErrorListener = NULL;
+       OnConnectListener *onConnectListener = NULL;
+       OnDisconnectListener *onDisconnectListener = NULL;
+       OnClientConnectListener *onClientConnectListener = NULL;
+       OnClientDisconnectListener *onClientDisconnectListener = NULL;
+       OnReadyListener *onReadyListener = NULL;
+       map<string, list<OnMessageListener *> > messageListeners;
+       Result_Base *connect_cb = NULL;
+       Result_Base *disconnect_cb = NULL;
+       static map<Channel *, int> channel_alive_map;
+
+private:
+       void emit(string event, const char *msg, string from, unsigned char *payld,
+             int payld_size);
+       void release_callback(string uid);
+       pair<void *, int> getcallback(string uid);
+       void handleSocketClosed();
+       void handleSocketClosedAndNotify();
+       void handleConnect(string);
+       void handleBinaryMessage(unsigned char payload[]);
+       void json_parse(const char *in);
+       void handleConnectMessage(string UID);
+       void handleMessage(string UID);
+       void handleMessage(string UID, unsigned char payload[]);
+       void handleApplicationMessage(string);
+       void doApplicationCallback(Result_Base *);
+       void handleClientConnectMessage();
+       void handleClientDisconnectMessage();
+       void handleErrorMessage(string);
+       void handleReadyMessage();
+       void handleDisconnectMessage();
+       void handleClientMessage(const char *msg, unsigned char payload[]);
+       void create_websocket(void *att);
+       unsigned char *prepareMessageMap(string, string, const char *data,
+                               const char *to, long *,
+                               unsigned char payload[], int payload_size);
+
+       static string ROUTE;
+       static string ERROR_EVENT;
+       static string CONNECT_EVENT;
+       static string CLIENT_CONNECT_EVENT;
+       static string CLIENT_DISCONNECT_EVENT;
+       static string READY_EVENT;
+       unsigned char
+       buf[LWS_SEND_BUFFER_PRE_PADDING + 4096 + LWS_SEND_BUFFER_POST_PADDING];
+       static pthread_t connect_thread;
+       int mirror_lifetime;
+       int force_exit;
+       char *messagedata;
+       bool isWrite;
+       bool binary_message;
+       bool disconnecting;
+       long buflen;
+       unsigned char cl_payload[1000];
+       int cl_payload_size;
+       int was_closed;
+       Client client;
+       long long clientconnectTime;
+       bool clientisHost;
+       string clientid;
+       map<string, string> clientattributes;
+       JsonObject *resultobj;
+       bool errobj;
+       string data;
+       string method;
+       string eventType;
+       string from;
+       bool resultresp;
+       string UID;
+       struct lws *wsi_mirror;
+       struct lws_context *Context;
+       list<Client> clientList;
+       Client me;
+       string msg_subject;
+       _message_receive_cb message_receive_cb = NULL;
+       OnMessageListener *everyMessageListener = NULL;
+       int msg_id;
+       bool isLaunched;
+       map<string, pair<void *, int> > callbacks;
+       map<void *, int> onReadyCallbacks;
+       static map<string, int> json_keys;
+};
+
+#endif
diff --git a/msf_tizen_client/include/Client.h b/msf_tizen_client/include/Client.h
new file mode 100644 (file)
index 0000000..bae2da8
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _CLIENT_H_
+#define _CLIENT_H_
+
+#include <stdio.h>
+#include<iostream>
+#include <string.h>
+#include<map>
+//#include"Channel.h"
+
+using namespace std;
+
+class Channel;
+
+class Client 
+{
+       static string ID_KEY;
+       static string IS_HOST_KEY;
+       static string CONNECT_TIME_KEY;
+       static string ATTRIBUTES_KEY;
+
+       string id;
+       bool host;
+       long long connectTime;
+       map<string, string> attributes;
+       Channel *m_channel;
+
+public:
+       Client();
+       void create(Client &client);
+       void create(Channel *channel, string, long long, /*map<string, string> data,*/bool, map<string, string>);
+       bool isHost();
+       const char *getId();
+       long long getConnectTime();
+       map<string, string> getAttributesKey();
+       Channel *getChannel();
+};
+
+#endif
diff --git a/msf_tizen_client/include/Clients.h b/msf_tizen_client/include/Clients.h
new file mode 100644 (file)
index 0000000..b19502a
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _CLIENTS_H_
+#define _CLIENTS_H_
+
+#include"Client.h"
+#include"Channel.h"
+#include<vector>
+
+using namespace std;
+
+class Channel;
+class Client;
+
+class Clients
+{
+       map<string, Client> clients;
+       string myClientId;
+       Client *host;
+       Client varme;
+       Channel *m_channel;
+
+public:
+       void setMyClientId(string clientId);
+       void reset();
+       void add(list <Client> clientList);
+       void add(Client client);
+       void remove(Client client);
+       int size();
+       Clients();
+       Clients(Channel *channel);
+       Client get(string clientId);
+       Client *getHost() ;//need better way to find host
+       Client me(void);
+       bool isMe(Client client);
+       list<Client> lists();
+       Channel *getChannel();
+};
+
+#endif
diff --git a/msf_tizen_client/include/Debug.h b/msf_tizen_client/include/Debug.h
new file mode 100755 (executable)
index 0000000..aebdc47
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __DEF_MSF_DBG_H_
+#define __DEF_MSF_DBG_H_
+
+#ifndef LINUX
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "MSF_API"
+#define MSF_DBG(format, args...) SLOGD(format, ##args)
+#define MSF_ERR(format, args...) SLOGE(format, ##args)
+#endif
+
+#ifdef LINUX
+#define MSF_DBG printf
+#define MSF_ERR printf
+#endif
+
+#endif
+
diff --git a/msf_tizen_client/include/Device.h b/msf_tizen_client/include/Device.h
new file mode 100644 (file)
index 0000000..d5bf607
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef DEVICE_H
+#define DEVICE_H
+
+#include <stdio.h>
+#include <iostream>
+#include <string.h>
+#include <json-glib/json-glib.h>
+#include <json-glib/json-parser.h>
+
+using namespace std;
+
+class Device
+{
+       static string DUID_KEY;
+       static string MODEL_KEY;
+       static string MODELNAME_KEY;
+       static string DESCRIPTION_KEY;
+       static string NETWORK_TYPE_KEY;
+       static string SSID_KEY;
+       static string IP_KEY;
+       static string FIRMWARE_VERSION_KEY ;
+       static string NAME_KEY ;
+       static string ID_KEY ;
+       static string UDN_KEY ;
+       static string RESOLUTION_KEY;
+       static string COUNTRY_CODE_KEY;
+       static string TYPE;
+       static string MSF_VERSION;
+       static string SMARTHUB_AGREEMENT;
+       static string WIFIMAC;
+       static string DEVELOPER_MODE;
+       static string DEVELOPER_IP;
+       static string OS;
+
+       string duid;
+       string model;
+       string description;
+       string networkType;
+       string ssid;
+       string ip;
+       string firmwareVersion;
+       string name;
+       string id;
+       string udn;
+       string resolution;
+       string countryCode;
+       string type;
+       string msf_version;
+       string smarthub_agreement;
+       string wifimac;
+       string developer_mode;
+       string deveoper_ip;
+       string os;
+
+public:
+       string getduid();
+       string getmodel();
+       string getdescription();
+       string getnetworkType();
+       string getssid();
+       string getip();
+       string getfirmwareVersion();
+       string getname();
+       string getudn();
+       string getresolution();
+       string getcountryCode();
+       string getid();
+
+       Device();
+       Device(JsonNode *node);
+       static Device create(JsonNode *node);
+       void json_parse(JsonNode *node);
+       static void foreach_json_object(JsonObject *object, const gchar *name, JsonNode *node, gpointer user_data);
+};
+
+#endif
diff --git a/msf_tizen_client/include/Error.h b/msf_tizen_client/include/Error.h
new file mode 100644 (file)
index 0000000..1a6b4e2
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef _MSF_ERROR_H
+#define _MSF_ERROR_H
+
+#include <stdio.h>
+#include<iostream>
+#include<string>
+
+using namespace std;
+
+class Error
+{
+private:
+       long code;
+       string name;
+       string message;
+
+public:
+       Error();
+       Error(long code, string name, string message);
+       static Error create(string message);
+       static Error create(long code, string name , string message);
+       const char *get_error_message();
+       //write other create funcs
+};
+
+#endif
diff --git a/msf_tizen_client/include/MSFDSearchProvider.h b/msf_tizen_client/include/MSFDSearchProvider.h
new file mode 100644 (file)
index 0000000..f068344
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef MSFDSEARCHPROVIDER_H
+#define MSFDSEARCHPROVIDER_H
+
+#include <map>
+#include <json-glib/json-glib.h>
+#include <json-glib/json-parser.h>
+#include"SearchProvider.h"
+
+using namespace std;
+
+class Search;
+
+class MSFDSearchProvider: public SearchProvider
+{
+       bool receive;
+       string state;
+       string id;
+       long ttl;
+       string url;
+
+public:
+
+       static string KEY_TYPE_STATE;
+       static string KEY_TTL;
+       static string KEY_SID;
+       static string KEY_DATA;
+       static string KEY_VERSION_1;
+       static string KEY_VERSION_2;
+       static string KEY_URI;
+       static string TYPE_DISCOVER;
+       static string STATE_UP;
+       static string STATE_DOWN;
+       static string STATE_ALIVE;
+       static int SERVICE_CHECK_TIMEOUT;
+       static int flag;
+       int fd;
+       map<string, long> aliveMap;
+       MSFDSearchProvider();
+       MSFDSearchProvider(Search *);
+       void start() ;
+       bool stop();
+       void createMSFD();
+       void processReceivedMsg(char *, int);
+       static SearchProvider create();
+       static SearchProvider create(Search *);
+       void json_parse(const char *in);
+       void reapServices();
+       void updateAlive(string id , long ttl);
+       static void foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data);
+};
+
+#endif //MSFDSEARCHPROVIDER_H
diff --git a/msf_tizen_client/include/Message.h b/msf_tizen_client/include/Message.h
new file mode 100644 (file)
index 0000000..17e9b8a
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef _MESSAGE_H_
+#define _MESSAGE_H_
+
+#include "Client.h"
+#include <stdio.h>
+#include <iostream>
+#include <string>
+#include <vector>
+
+
+using namespace std;
+
+class Message
+{
+public:
+       Channel *m_channel;
+       string m_event;
+       string m_data;
+       string m_from;
+
+       unsigned char *m_payload;
+       int m_payload_size;
+       //std::vector<unsigned char> m_payload;
+
+public:
+       static string TARGET_BROADCAST;
+       static string TARGET_ALL;
+       static string TARGET_HOST;
+
+       static string METHOD_APPLICATION_GET;
+       static string METHOD_APPLICATION_START;
+       static string METHOD_APPLICATION_STOP;
+       static string METHOD_APPLICATION_INSTALL;
+       static string METHOD_WEB_APPLICATION_GET;
+       static string METHOD_WEB_APPLICATION_START;
+       static string METHOD_WEB_APPLICATION_STOP;
+       static string METHOD_EMIT;
+
+       static string PROPERTY_MESSAGE;
+       static string PROPERTY_METHOD;
+       static string PROPERTY_MESSAGE_ID;
+       static string PROPERTY_PARAMS;
+       static string PROPERTY_ID;
+       static string PROPERTY_URL;
+       static string PROPERTY_ARGS;
+       static string PROPERTY_EVENT;
+       static string PROPERTY_DATA;
+       static string PROPERTY_TO;
+       static string PROPERTY_FROM;
+       static string PROPERTY_CLIENTS;
+       static string PROPERTY_RESULT;
+       static string PROPERTY_ERROR;
+
+       Message(Channel *ch, string event, string data, string from, unsigned char *payload, int payload_size);
+       Message();
+       virtual ~Message();
+       Message(const Message&);
+};
+
+#endif
diff --git a/msf_tizen_client/include/Result.h b/msf_tizen_client/include/Result.h
new file mode 100644 (file)
index 0000000..477b823
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef _MSF_RESULT_H_
+#define _MSF_RESULT_H_
+
+#include <iostream>
+
+using namespace std;
+
+class Service;
+class ApplicationInfo;
+class Client;
+class Device;
+class Error;
+
+//template <class T>
+
+typedef enum {
+       RESULT_BASE_APP_INFO,
+       RESULT_BASE_CLIENT,
+       RESULT_BASE_DEVICE,
+       RESULT_BASE_BOOL,
+       RESULT_BASE_SERVICE,
+       RESULT_BASE_ERROR
+} result_base_e;
+
+typedef void(*_appinfo_result_cb)(ApplicationInfo appinfo, void *user_data);
+typedef void(*_client_result_cb)(Client client, void *user_data);
+typedef void(*_device_result_cb)(Device dev, void *user_data);
+typedef void(*_bool_result_cb)(bool result, void *user_data);
+typedef void(*_service_result_cb)(Service service, void *user_data);
+typedef void(*_error_result_cb)(Error err, void *user_data);
+
+class Result_Base
+{
+public:
+
+       _appinfo_result_cb appinfo_result_cb = NULL;
+       _client_result_cb client_result_cb = NULL;
+       _device_result_cb device_result_cb = NULL;
+       _bool_result_cb bool_result_cb = NULL;
+       _service_result_cb service_result_cb = NULL;
+       _error_result_cb error_result_cb = NULL;
+       void *user_data;
+       Result_Base();
+       Result_Base(void*, void*, result_base_e);
+       virtual ~Result_Base();
+
+       virtual void onSuccess(ApplicationInfo argu);
+       virtual void onSuccess(Client argu);
+       virtual void onSuccess(Device argu);
+       virtual void onSuccess(bool argu);
+       virtual void onSuccess(Service argu);
+       virtual void onError(Error);
+};
+
+#endif
+
diff --git a/msf_tizen_client/include/Search.h b/msf_tizen_client/include/Search.h
new file mode 100644 (file)
index 0000000..65e86ed
--- /dev/null
@@ -0,0 +1,125 @@
+#ifndef _MSF_SEARCH_H
+#define _MSF_SEARCH_H
+
+//#include"Service.h"
+#include <list>
+#include"SearchProvider.h"
+#include <list>
+#include <pthread.h>
+#include <string>
+#include"mDNSSearchProvider.h"
+//#include"MSFDSearchProvider.h"
+
+#define NUM_OF_THREADS 2
+#define MDNS_THREAD_NUMBER 0
+#define MSFD_THREAD_NUMBER 1
+
+using namespace std;
+
+class Service;
+class MSFDSearchProvider;
+class mDNSSearchProvider;
+
+class OnStartListener
+{
+public:
+       virtual void onStart() { }
+};
+
+class OnStopListener
+{
+public:
+       virtual void onStop() { }
+};
+
+class OnServiceFoundListener
+{
+public:
+       virtual void onFound(Service) = 0;
+};
+
+class OnServiceLostListener
+{
+public:
+       virtual void onLost(Service) = 0;
+};
+
+class SearchListener:public OnStartListener, public OnStopListener, public OnServiceFoundListener, public OnServiceLostListener
+{
+public:
+       virtual ~SearchListener(){}
+       virtual void onStart();
+       virtual void onStop();
+       virtual void onFound(Service);
+       virtual void onLost(Service);
+};
+
+class Search:public SearchListener
+{
+private :
+       static int SERVICE_CHECK_TIMEOUT;
+       static Search *instance;
+       list<SearchProvider> providers ;
+       list<SearchProvider> removedProviders ;
+       static list<Service> services;
+
+       static int numRunning;
+       SearchListener *searchListener;
+       static bool clearProviders;
+       static bool starting;
+       static int search_ref_count;
+       static bool stopping;
+       bool searching_now;
+       static mDNSSearchProvider provider1;
+       static MSFDSearchProvider provider2;
+       //OnStartListener *onStartListener;
+       //OnStopListener *onStopListener;
+       //OnServiceFoundListener *onServiceFoundListener;
+       //OnServiceLostListener *onServiceLostListener;
+
+public:
+       static pthread_t threads[NUM_OF_THREADS];
+       static int onStartNotified;
+       //static Search* getInstance();
+       Search();
+       ~Search();
+       //bool isSearching();
+       bool start();
+       bool stop();
+
+       static list<Search*> search_list;
+       void onStart();
+       void onStop();
+       void onFound(Service);
+       void onLost(Service);
+       static void st_onStart();
+       static void st_onStop();
+       static void st_onFound(Service);
+       static void st_onLost(Service);
+
+       bool isEqualto(SearchProvider, SearchProvider);
+       list<Service> getServices();
+       bool remove(list<SearchProvider> *, SearchProvider);
+       void addProvider(SearchProvider);
+       //bool removeProvider(SearchProvider);
+       //void processRemovedProviders();
+       //void removeAllProviders();
+       void startDiscovery();
+       void stopDiscovery();
+       static bool addService(Service);
+       bool removeService(Service);
+       void removeAndNotify(Service);
+       void validateService(Service);
+       //void setOnStartListener(OnStartListener *);
+       //void setOnStopListener(OnStopListener);
+       //void setOnServiceFoundListener(OnServiceFoundListener);
+       //void setOnServiceLostListener(OnServiceLostListener);
+       Service getServiceById(string id);
+
+       void setSearchListener(SearchListener*);
+       void releaseSearchListener();
+       static void *pt_startMDNS(void *);
+       static void *pt_startMSFD(void *);
+};
+
+#endif
diff --git a/msf_tizen_client/include/SearchProvider.h b/msf_tizen_client/include/SearchProvider.h
new file mode 100644 (file)
index 0000000..42ac372
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _MSF_SEARCHPROVIDER_H
+#define _MSF_SEARCHPROVIDER_H
+
+#include<iostream>
+#include<list>
+#include<string>
+//#include "Service.h"
+//#include "Search.h"
+
+using namespace std;
+
+class Service;
+class Search;
+
+class SearchProvider
+{
+private:
+       Search *searchListener;
+       static list<Service> services;
+
+public:
+       SearchProvider();
+       SearchProvider(Search *);
+       virtual void start() {}
+       virtual bool stop() { return true; }
+       static list<Service> getServices();
+       bool isSearching();
+       void setSearchListener(Search *obj);
+
+protected:
+       bool searching;
+       void setServices(list<Service>);
+       void addService(Service service);
+       void removeService(Service service);
+       void removeServiceAndNotify(Service service);
+       void clearServices();
+       Service getServiceById(string id);
+};
+
+#endif
diff --git a/msf_tizen_client/include/Service.h b/msf_tizen_client/include/Service.h
new file mode 100644 (file)
index 0000000..6965b9b
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef _MSF_SERVICE_H
+#define _MSF_SERVICE_H
+
+#include <string>
+#include <map>
+#include <json-glib/json-glib.h>
+#include <json-glib/json-parser.h>
+
+
+using namespace std;
+
+class Application;
+class Search;
+class Result_Base;
+class Channel;
+
+struct position {
+       int start;
+       int end;
+};
+
+struct ServiceInfo {
+       string infoId;
+       string infoVersion;
+       string infoName;
+       string infotype;
+       string infoURI;
+};
+
+class Service
+{
+       static  string ID_PROPERTY;
+       static  string VERSION_PROPERTY;
+       static  string NAME_PROPERTY;
+       static  string TYPE_PROPERTY;
+       static  string ENDPOINT_PROPERTY;
+       string id = "";
+       string version = "";
+       string name = "";
+       string type = "";
+       string uri = "";
+       static string curl_data;
+       typedef std::map<std::string, std::string> map_type;
+       static Service local_service;
+       void *result_ptr;
+
+public:
+       Service();
+       Service(string, string, string, string, string);
+       static ServiceInfo serviceval;
+       static Result_Base *Resulturi;
+       Result_Base *Resultdevice;
+
+       position findServiceValue(string, char *);
+       void getDeviceInfo(Result_Base*);
+       void create(char*);
+       string getUri();
+       string getName();
+       string getType();
+       string getId();
+       string getVersion();
+       static Service getLocal(void);
+       static void getByURI(string, Result_Base*);
+       static void getByURI(string, long, Result_Base *result);
+       static void getById(string id, Result_Base *result);
+       static int curl_service_calling(string uri, long, void *);
+       //static Search *search();
+       static size_t createdata(char *buf, size_t size, size_t nmemb, void *up);
+       static void createdata_process(string data,  void *);
+       static int json_parse_service(const char *in,  void *);
+       static Service create(ServiceInfo);
+       static Service create(map<string, string>);
+       static void foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data);
+       Channel *createChannel(string uri);
+       Application createApplication(string uri);
+       Application createApplication(string uri, string channelId);
+       Application createApplication(string uri, string channelId, map<string, string> startArgs) ;
+};
+#endif
diff --git a/msf_tizen_client/include/URIparser.h b/msf_tizen_client/include/URIparser.h
new file mode 100644 (file)
index 0000000..45012fe
--- /dev/null
@@ -0,0 +1,89 @@
+#ifndef _URI_PARSER_H_
+#define _URI_PARSER_H_
+
+#include <vector>
+#include <string>
+
+namespace uri_parser
+{
+
+class URIParse
+{
+public:
+
+       URIParse();
+
+       URIParse(const std::string& uri);
+
+       URIParse(const char *uri);
+
+       ~URIParse();
+       void clear();
+
+       const std::string& getURIScheme() const;
+
+       void setURIScheme(const std::string& scheme);
+
+       const std::string& getURIHost() const;
+
+       bool empty() const;
+
+       static void decodeURI(const std::string& str, std::string& decodedStr, long _flags2);
+
+       static bool isIPAddressinURI(const std::string& str);
+
+protected:
+
+       unsigned short getWellKnownPortforURI() const;
+
+       void parseURI(const std::string& uri);
+
+       void URIparseAuthority(std::string::const_iterator& it, const std::string::const_iterator& end);
+
+       void URIparseHostAndPort(std::string::const_iterator& it, const std::string::const_iterator& end);
+
+       void URIparsePath(std::string::const_iterator& it, const std::string::const_iterator& end);
+
+       void URIparsePathEtc(std::string::const_iterator& it, const std::string::const_iterator& end);
+
+       void URIparseQuery(std::string::const_iterator& it, const std::string::const_iterator& end);
+
+       void URIparseFragment(std::string::const_iterator& it, const std::string::const_iterator& end);
+
+       static const std::string URIRESERVED_PATH;
+       static const std::string URIRESERVED_QUERY;
+       static const std::string URIRESERVED_FRAGMENT;
+       static const std::string URIILLEGAL;
+
+private:
+       template <class S>
+       S& toLowerInPlaceURI(S& str){
+               typename S::iterator it  = str.begin();
+               typename S::iterator end = str.end();
+               while (it != end) { *it = tolower(*it); ++it; }
+               return str;
+       }
+       std::string    _URIscheme;
+       std::string    _URIuserInfo;
+       std::string    _URIhost;
+       unsigned short _URIport;
+       std::string    _URIportStr;
+       std::string    _URIpath;
+       std::string    _URIquery;
+       std::string    _URIfragment;
+       long           _URIflags;
+};
+
+inline const std::string& URIParse::getURIScheme() const
+{
+       return _URIscheme;
+}
+
+inline const std::string& URIParse::getURIHost() const
+{
+       return _URIhost;
+}
+
+}
+
+#endif //_URI_PARSER_H_
diff --git a/msf_tizen_client/include/mDNSSearchProvider.h b/msf_tizen_client/include/mDNSSearchProvider.h
new file mode 100644 (file)
index 0000000..c8b4171
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef MDNSSEARCHPROVIDER_H
+#define MDNSSEARCHPROVIDER_H
+
+using namespace std;
+
+#include"SearchProvider.h"
+#include <nsd/dns-sd.h>
+
+class mDNSSearchProvider : public SearchProvider
+{
+private:
+
+public:
+
+       mDNSSearchProvider();
+       ~mDNSSearchProvider();
+       void addService(Service service);
+       mDNSSearchProvider(Search *sListener);
+       void start();
+       bool stop();
+       static SearchProvider create();
+       static SearchProvider create(Search *);
+};
+
+#endif
diff --git a/msf_tizen_client/msf-api.pc.in b/msf_tizen_client/msf-api.pc.in
new file mode 100755 (executable)
index 0000000..12d33ae
--- /dev/null
@@ -0,0 +1,13 @@
+#Package Information for pkg-config\r
+\r
+prefix=@PREFIX@\r
+exec_prefix=@PREFIX@\r
+libdir=@PC_LIBDIR@\r
+includedir=@PC_INCLUDE@\r
+\r
+Name: @PC_NAME@\r
+Description: @PC_DESCRIPTION@\r
+Version: @VERSION@\r
+Requires: @PC_REQUIRED@\r
+Libs: -L${libdir} @PC_LDFLAGS@\r
+Cflags: -I${includedir}\r
diff --git a/msf_tizen_client/packaging/msf-api.manifest b/msf_tizen_client/packaging/msf-api.manifest
new file mode 100755 (executable)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/msf_tizen_client/packaging/msf-api.spec b/msf_tizen_client/packaging/msf-api.spec
new file mode 100755 (executable)
index 0000000..a972d25
--- /dev/null
@@ -0,0 +1,77 @@
+Name:       msf-api
+Summary:    msf-api Shared Library
+Version:    0.1.1
+Release:    1
+Group:      System/Libraries
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+
+BuildRequires: cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(libwebsockets)
+BuildRequires: libcurl-devel
+BuildRequires: pkgconfig(openssl)
+BuildRequires: capi-network-nsd
+BuildRequires: capi-network-nsd-devel
+BuildRequires: curl
+
+%description
+msf-api Shared Library
+
+%prep
+%setup -q
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+
+export   CFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default"
+export CXXFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default -Wnon-virtual-dtor -Wno-c++0x-compat -std=c++0x"
+
+export   CFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
+export CXXFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
+
+export   CFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow -fno-common"
+export CXXFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow"
+
+export   CFLAGS+=" -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS+=" -DTIZEN_ENGINEER_MODE"
+export   FFLAGS+=" -DTIZEN_ENGINEER_MODE"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%manifest packaging/%{name}.manifest
+%defattr(-,root,root,-)
+%{_libdir}/*.so*
+/usr/share/license/%{name}
+/usr/bin/msf-api-test*
+
+%package devel
+Summary:    msf-api Shared Library (Development)
+Group:      System/Libraries
+Requires:      %{name} = %{version}-%{release}
+
+%description devel
+msf-api Shared Library (DEV)
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/msf-api/*.h
+%{_libdir}/pkgconfig/%{name}.pc
diff --git a/msf_tizen_client/src/Application.cpp b/msf_tizen_client/src/Application.cpp
new file mode 100644 (file)
index 0000000..1c2af21
--- /dev/null
@@ -0,0 +1,590 @@
+#include"Application.h"
+#include<curl/curl.h>
+#include <dlog.h>
+#include "Debug.h"
+#include<cstring>
+#include"URIparser.h"
+#include"Message.h"
+#include"Clients.h"
+
+using namespace std;
+using namespace uri_parser;
+
+string Application::ROUTE_APPLICATION = "applications/";
+string Application::curl_data = "";
+
+class ResultConnectboolCallback : public Result_Base
+{
+public:
+       Client client;
+       Result_Base** in_connect_cb  = NULL;
+
+       void onSuccess(bool abc)
+       {
+               dlog_print(DLOG_INFO, "MSF", "ResultConnectboolCallback success result");
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+               if (in_connect_cb != NULL) {
+                       if (((*in_connect_cb) != NULL) && (!strncmp(client.getId(), "", 1) == 0)) {
+                               dlog_print(DLOG_INFO, "MSF", "start success result");
+                               (*in_connect_cb)->onSuccess(client);
+                       } else {
+                       }
+               }
+
+               delete this;
+       }
+
+       void onError(Error)
+       {
+               dlog_print(DLOG_ERROR, "MSF", "start error result");
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+               dlog_print(DLOG_ERROR, "MSF", "start result.");
+               //app_pointer->handleSocketClosed();
+               delete this;
+       }
+};
+
+class connectCallback : public Result_Base
+{
+public:
+       ResultConnectboolCallback* start_cb;
+       Application* app_pointer = NULL;
+       Result_Base** in_connect_cb = NULL;
+
+public:
+       void onSuccess(Client abc)
+       {
+               static Client client12 = abc;
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+               if (app_pointer != NULL) {
+                       start_cb = new ResultConnectboolCallback();
+                       start_cb->in_connect_cb = in_connect_cb;
+                       start_cb->client = abc;
+                       app_pointer->start(start_cb);
+               }
+
+               if (in_connect_cb != NULL) {
+                       if ((*in_connect_cb) != NULL) {
+                               (*in_connect_cb)->onSuccess(true);
+                       }
+               }
+               delete this;
+       }
+
+       void onError(Error error)
+       {
+               // On error
+               if (in_connect_cb != NULL) {
+                       if ((*in_connect_cb) != NULL) {
+                               (*in_connect_cb)->onError(error);
+                       }
+               }
+               delete this;
+       }
+};
+
+class DisconnectboolCallback : public Result_Base
+{
+public:
+       Application* app_p = NULL;
+       Result_Base** in_disconnect_cb = NULL;
+
+       // server application stop success
+       void onSuccess(bool abc)
+       {
+               dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 3");
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               if (abc) {
+                       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 4");
+
+                       if (in_disconnect_cb != NULL) {
+                               if ((*in_disconnect_cb) != NULL) {
+                                       app_p->realDisconnect(*in_disconnect_cb);
+                                       //temp->onSuccess(me);
+                               } else {
+                               }
+                       }
+               } else {
+                       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 5");
+                       if (in_disconnect_cb != NULL) {
+                               if ((*in_disconnect_cb) != NULL) {
+                                       Error err(-1, "error", "stop failed");
+                                       DisconnectboolCallback *r = new DisconnectboolCallback();
+                                       r->app_p = this->app_p;
+                                       r->in_disconnect_cb = this->in_disconnect_cb;
+                                       r->onError(err);
+                               }
+                       } else {
+                       }
+
+                       //temp->onSuccess(me);
+               }
+
+               delete (this);
+       }
+
+       void onError(Error error)
+       {
+               dlog_print(DLOG_ERROR, "MSF", "application disconnect(bool, result) 6");
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               if (in_disconnect_cb != NULL) {
+                       if ((*in_disconnect_cb) != NULL) {
+                               dlog_print(DLOG_ERROR, "MSF", "application disconnect(bool, result) 7");
+                               (*in_disconnect_cb)->onError(error);
+                       }
+               }
+
+               delete (this);
+       }
+};
+Application::Application()
+{
+       dlog_print(DLOG_INFO, "MSF", "Application()");
+       waitForOnReady = false;
+       webapp = false;
+       install_result_listener = NULL;
+       install_result = false;
+}
+
+Application::Application(Service *se, string Uri, string Id)
+{
+       dlog_print(DLOG_INFO, "MSF", "Application(service, uri, id, startargs)");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       map<string, string> startargs = std::map<std::string, std::string>();
+       service = se;
+       m_uri = Uri;
+       ChannelID = Id;
+       bool webApp = false;
+       uri_parser::URIParse uri2(m_uri);
+       if (!(uri2.getURIScheme() == "")) {
+               dlog_print(DLOG_INFO, "MSF", "webapp set as true");
+               webApp = true;
+       }
+
+       this->webapp = webApp;
+       this->startArgs = &startargs;
+       waitForOnReady = false;
+       install_result_listener = NULL;
+       install_result = false;
+}
+
+Application::Application(Service *se, string Uri, string Id, map<string, string> startargs)
+{
+       dlog_print(DLOG_INFO, "MSF", "Application(service, uri, id, startargs)");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       service = se;
+       m_uri = Uri;
+       ChannelID = Id;
+       bool webApp = false;
+       uri_parser::URIParse uri2(m_uri);
+       if (!(uri2.getURIScheme() == "")) {
+               dlog_print(DLOG_INFO, "MSF", "webapp set as true");
+               webApp = true;
+       }
+
+       this->webapp = webApp;
+       this->startArgs = &startargs;
+       waitForOnReady = false;
+       install_result_listener = NULL;
+       install_result = false;
+}
+
+Application::~Application()
+{
+       dlog_print(DLOG_INFO, "MSF", "~Application()");
+}
+
+bool Application::isConnected()
+{
+       dlog_print(DLOG_INFO, "MSF", "Channel::isConnected() = %s", Channel::isConnected() ? "true" : "false");
+       dlog_print(DLOG_INFO, "MSF", "connected = %s", connected ? "true" : "false");
+       //return (Channel::isConnected() && connected);
+       return (Channel::isConnected());
+}
+
+bool Application::isWebapp()
+{
+       return webapp;
+}
+
+void Application::getinfo(Result_Base *result1)
+{
+       string uri = service->getUri();
+       if (isWebapp()) {
+               uri += "webapplication/";
+       } else {
+               //TODO
+               //uri += "applications/" + service->getid() + "/";
+       }
+
+       result = result1;
+       int ret = curl_application_calling(uri);
+       if (ret == -1) {
+               if (result1 != NULL)
+                       result1->onError(Error::create("Failed to get info"));
+       }
+}
+
+void Application::start(Result_Base *result)
+{
+       Clients *clientstemp = Channel::getclients();
+
+       if (clientstemp->getHost() == NULL)
+               waitForOnReady = true;
+
+       map<string, string> params = getparams();
+
+       invokeMethod(webapp?Message::METHOD_WEB_APPLICATION_START : Message::METHOD_APPLICATION_START, params, result);
+}
+
+void Application::stop(Result_Base *result)
+{
+       map<string, string> params = getparams();
+       invokeMethod(webapp?Message::METHOD_WEB_APPLICATION_STOP : Message::METHOD_APPLICATION_STOP, params, result);
+}
+
+void Application::install()
+{
+       int ret;
+       if (webapp) {
+               string randID = Channel::getUID();
+               dlog_print(DLOG_INFO, "MSF", "install call registercallback");
+               if (install_result_listener) {
+                       install_result_listener->onError(Error::create("Unsupported Method"));
+               }
+               /* Channel::registerCallback(randID,(void*)result,Result_bool); *       
+                *  handleError(randID,Error::create("Unsupported Method"));   */
+       } else {
+               string Uri = service->getUri().append(ROUTE_APPLICATION).append(m_uri);
+               dlog_print(DLOG_INFO, "MSF", "install uri = %s", Uri.c_str());
+               ret = Application::curl_install(Uri);
+               if (ret == -1) {
+                       if (install_result_listener)
+                               install_result_listener->onError(Error::create("Failed to Install"));
+               }
+       }
+}
+
+map<string, string> Application::getparams()
+{
+       string messagekey = Message::PROPERTY_ID;
+       string id = m_uri;
+       if (webapp) {
+               messagekey = Message::PROPERTY_URL;
+       }
+       map <string, string> params;
+       params[messagekey] = id;
+       return params;
+}
+
+
+void Application::connect()
+{
+       //Channel::connect();
+       connect(NULL);
+}
+
+void Application::connect(Result_Base *res)
+{
+       connect(map<string, string>(), res);
+}
+
+void Application::connect(map<string, string> attributes, Result_Base *res)
+{
+       dlog_print(DLOG_INFO, "MSF", "Application::connect(at, res)");
+
+       connectCallback* r = new connectCallback();
+       r->in_connect_cb = &connect_cb;
+       r->app_pointer = this;
+
+       Channel::connect(attributes, r);
+}
+
+void Application::disconnect()
+{
+       dlog_print(DLOG_INFO, "MSF", "application disconnect()");
+
+       disconnect(true);
+}
+
+void Application::disconnect(Result_Base *r)
+{
+       dlog_print(DLOG_INFO, "MSF", "application disconnect(result)");
+       disconnect(true);
+}
+
+void Application::disconnect(bool stopOnDisconnect)
+{
+       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 1");
+
+       if (stopOnDisconnect) {
+       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 2");
+               int numClients = 0;
+               numClients = clients->size();
+               static Client me ;
+               me =  clients->me();
+
+               fprintf(stderr, "\n MYCLIENT ID IS[%s] and Number of clients is [%d]\n", me.getId(), numClients);
+
+               dlog_print(DLOG_INFO, "MSF", "numClients = %d", numClients);
+               dlog_print(DLOG_INFO, "MSF", "clients->getHost : %s", clients->getHost() ? "true" : "false");
+               dlog_print(DLOG_INFO, "MSF", "strncmp(me.getId(),"",1) : %d", strncmp(me.getId(), "", 1));
+               if (((numClients == 2) && (clients->getHost() != NULL) && strncmp(me.getId(), "", 1)) ||
+                               ((numClients == 1) && (strncmp(me.getId(), "", 1))) ||
+                                (numClients == 0)) {
+                       dlog_print(DLOG_INFO, "MSF", "application disconnect(bool, result) 3");
+                       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+                       //Result_Base *rbool = NULL;;
+
+                       DisconnectboolCallback *r = new DisconnectboolCallback();
+                       r->in_disconnect_cb = &disconnect_cb;
+                       r->app_p = this;
+
+                       //rbool= r1bool;
+                       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                       stop(r);
+                       return;
+               }
+       }
+
+       realDisconnect(disconnect_cb);
+}
+
+void Application:: realDisconnect(Result_Base *result)
+{
+       Channel::disconnect(result);
+}
+
+void Application::invokeMethod(string method, map<string, string> params, string messageID, Result_Base *callback)
+{
+       dlog_print(DLOG_INFO, "MSF", "invokeMethod ()");
+       if (!Channel::isConnected()) {
+               dlog_print(DLOG_ERROR, "MSF", "invokeMethod() 1");
+               Channel::handleError(messageID, Error::create("Not Connected"));
+               return;
+       }
+
+       dlog_print(DLOG_INFO, "MSF", "invokeMethod() 2");
+       int l = 0;
+       string id = webapp?"url":"id";
+       char buffer[2000];
+       l += sprintf((char *)&buffer, " {\n \"method\": \"%s\",\n \"id\": %s, \n \"params\" : { \n \"%s\": \"%s\" \n } \n }", method.c_str(), messageID.c_str(), id.c_str(), params[id].c_str());
+       buffer[l] ='\0';
+       dlog_print(DLOG_INFO, "MSF", "invokeMethod() 3");
+       dlog_print(DLOG_INFO, "MSF", "invokeMethod() buf = %s", buffer);
+       Channel::start_app(buffer, l, messageID);
+}
+
+void Application::invokeMethod(string method, map<string, string> params, Result_Base *callback)
+{
+       string messageID = Channel::getUID();
+               dlog_print(DLOG_INFO, "MSF", "invokeMethod call registercallback");
+       Channel::registerCallback(messageID, (void*)callback, Result_bool);
+       invokeMethod(method, params,  messageID, callback);
+}
+
+
+Application Application::create(Service *service, string uri)
+{
+       dlog_print(DLOG_INFO, "MSF", "Application::create(service, uri)");
+       fprintf(stderr, "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       if (!((service == NULL) || (uri == ""))) {
+               string id = uri;
+               uri_parser::URIParse uri2(uri);
+               if (!(uri2.getURIScheme() == "")) {
+                       id  = uri2.getURIHost();
+               }
+               //Application *application=new Application(service, uri, id , std::map<std::string, std::string>());
+               Application app(service, uri, id , std::map<std::string, std::string>());
+               return app;
+       } else {
+               Application app;
+               return app;
+       }
+}
+
+Application Application::create(Service *service, string uri, string id, map<string, string> startargs)
+{
+       dlog_print(DLOG_INFO, "MSF", "Application::create(service, uri, id, startargs)");
+
+       if (!((service == NULL) || (uri == "") || (id == ""))) {
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               /*Application *application= new Application(service, uri, id , startargs);        */
+               Application app(service, uri, id , startargs);
+               return app;
+       } else {
+               Application app;
+               return app;
+       }
+}
+
+void Application::createdata_process(string data)
+{
+       printf("ApplicationInfo curl data : %s", data.c_str());
+       ApplicationInfo InfoObj;
+       InfoObj.create(data);
+       result->onSuccess(InfoObj);
+}
+
+size_t Application::createdata(char* buf, size_t size, size_t nmemb, void* up)
+{
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
+       if (buf != NULL) {
+               curl_data.append(buf, size*nmemb);
+       } else {
+               dlog_print(DLOG_ERROR, "MSF", "createdata() buf is null");
+       }
+
+       return size*nmemb;
+}
+
+size_t Application::read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+       //((char*)ptr)[size*nmemb-1] = 0;
+       dlog_print(DLOG_ERROR, "MSF", "read_callback = %s", (char*)ptr);
+       if (ptr != NULL)
+               static_cast<Application*>(stream)->curl_install_data.append(static_cast<const char*>(ptr), size*nmemb);
+
+       return size*nmemb;
+}
+
+int Application::curl_application_calling(string uri)
+{
+       CURL *curl;
+       CURLcode res = CURLE_FAILED_INIT;
+       struct curl_slist *headers = NULL;
+       headers = curl_slist_append(headers, "Accept: application/json");
+       headers = curl_slist_append(headers, "Content-Type: application/json");
+
+       curl = curl_easy_init();
+       dlog_print(DLOG_INFO, "MSF", "uri = %s", uri.c_str());
+
+       if (curl) {
+               const char *c = uri.c_str();
+               curl_easy_setopt(curl, CURLOPT_URL, c);
+               curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+               curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
+               curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Application::createdata);
+               curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
+               res = curl_easy_perform(curl);
+
+               if (res != CURLE_OK) {
+                       dlog_print(DLOG_ERROR, "MSF", "####Application curl ERROR = %d ####", res);
+                       MSF_DBG("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
+               } else {
+                       createdata_process(curl_data);
+               }
+
+               curl_install_data.clear();
+               curl_easy_cleanup(curl);
+
+               if (res != CURLE_OK)
+                       return -1;
+               else
+                       return 0;
+       }
+
+       return -1;
+}
+
+void Application::foreach_json_object(JsonObject* object, const gchar* key, JsonNode* node, gpointer user_data)
+{
+       Application* p = static_cast<Application*>(user_data);
+
+       if (!strncmp(key, "ok", 2)) {
+               p->install_result = json_node_get_boolean(node);
+       } else if (!strncmp(key, "status", 6)) {
+               p->errstatus = json_node_get_int(node);
+       } else if (!strncmp(key, "message", 7)) {
+               p->errMsg = json_node_get_string(node);
+       } else if (!strncmp(key, "code", 4)) {
+               p->errcode = json_node_get_int(node);
+               p->install_result = false;
+       }
+}
+
+void Application::json_parse(const char* in)
+{
+       JsonParser* parser = json_parser_new();
+       if (json_parser_load_from_data(parser, in, -1, NULL)) {
+               JsonNode* node = json_parser_get_root(parser);
+
+               if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+                       json_object_foreach_member(json_node_get_object(node), foreach_json_object, this);
+               }
+
+       } else {
+       }
+}
+
+int Application::curl_install(string uri)
+{
+       CURL *curl;
+       CURLcode res = CURLE_FAILED_INIT;
+       struct curl_slist *headers = NULL;
+       headers = curl_slist_append(headers, "Accept: application/json");
+       headers = curl_slist_append(headers, "Content-Type: application/json");
+       curl_global_init(CURL_GLOBAL_ALL);
+       curl = curl_easy_init();
+
+       if (curl) {
+               curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
+               curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Application::read_callback);
+               curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
+               curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+               curl_easy_setopt(curl, CURLOPT_URL, uri.c_str());
+
+               dlog_print(DLOG_ERROR, "MSF", "install curl put send");
+               res = curl_easy_perform(curl);
+
+               if (res != CURLE_OK) {
+                       dlog_print(DLOG_ERROR, "MSF", "####Application curl ERROR = %d ####", res);
+                       MSF_DBG("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
+               } else {
+                       dlog_print(DLOG_ERROR, "MSF", "####Application curl success ####");
+                       json_parse(curl_install_data.c_str());
+
+                       if (install_result_listener != NULL) {
+                               if (install_result) {
+                                       install_result_listener->onSuccess(install_result);
+                               } else {
+                                       string err = "";
+                                       err.append("status:");
+                                       err.append(to_string(errstatus));
+                                       err.append(" message:");
+                                       err.append(errMsg);
+                                       err.append(" code:");
+                                       err.append(to_string(errcode));
+                                       install_result_listener->onError(Error::create(err));
+                               }
+                       }
+               }
+
+
+
+               curl_install_data.clear();
+
+               curl_easy_cleanup(curl);
+               curl_global_cleanup();
+       }
+
+       if (res != CURLE_OK)
+               return -1;
+       else
+               return 0;
+}
+
+void Application::setonInstallListener(Result_Base* listener)
+{
+       install_result_listener = listener;
+}
+
+void Application::unsetonInstallListener()
+{
+       install_result_listener = NULL;
+}
diff --git a/msf_tizen_client/src/ApplicationInfo.cpp b/msf_tizen_client/src/ApplicationInfo.cpp
new file mode 100755 (executable)
index 0000000..53ff1f9
--- /dev/null
@@ -0,0 +1,80 @@
+#include"ApplicationInfo.h"
+
+string ApplicationInfo::PROPERTY_ID = "id";
+string ApplicationInfo::PROPERTY_STATE = "running";
+string ApplicationInfo::PROPERTY_NAME = "name";
+string ApplicationInfo::PROPERTY_VERSION = "version";
+
+ApplicationInfo::ApplicationInfo()
+{
+}
+
+ApplicationInfo::ApplicationInfo(string iD, bool state, string Name, string Version)
+{
+       id = iD;
+       running = state;
+       name = Name;
+       msf_version = Version;
+}
+
+string ApplicationInfo::getID()
+{
+       return  id;
+}
+
+string ApplicationInfo::getName()
+{
+       return name;
+}
+
+string ApplicationInfo::getVersion()
+{
+       return msf_version;
+}
+
+bool ApplicationInfo::isRunning()
+{
+       return running;
+}
+
+void ApplicationInfo::foreach_json_object(JsonObject* object, const gchar* key, JsonNode* node, gpointer user_data)
+{
+       ApplicationInfo* p = static_cast<ApplicationInfo*>(user_data);
+
+       if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+               if (!strncmp(key, ApplicationInfo::PROPERTY_STATE.c_str(), 7)) {
+                       p->running = json_node_get_boolean(node);
+               } else if (!strncmp(key, ApplicationInfo::PROPERTY_ID.c_str(), 2)) {
+                       p->id = json_node_get_string(node);
+               } else if (!strncmp(key, ApplicationInfo::PROPERTY_NAME.c_str(), 4)) {
+                       p->name = json_node_get_string(node);
+               } else if (!strncmp(key, ApplicationInfo::PROPERTY_VERSION.c_str(), 7)) {
+                       p->msf_version = json_node_get_string(node);
+               }
+       } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+               json_object_foreach_member(json_node_get_object(node), foreach_json_object, user_data);
+       }
+}
+
+void ApplicationInfo::json_parse(const char* in)
+{
+       JsonParser* parser = json_parser_new();
+       if (json_parser_load_from_data(parser, in, -1, NULL)) {
+               JsonNode* node = json_parser_get_root(parser);
+
+               if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+                       json_object_foreach_member(json_node_get_object(node), foreach_json_object, this);
+               }
+
+       } else {
+       }
+}
+
+ApplicationInfo ApplicationInfo::create(string data)
+{
+       json_parse(data.c_str());
+
+       ApplicationInfo appinfo(id, running, name, msf_version);
+
+       return appinfo;
+}
diff --git a/msf_tizen_client/src/Channel.cpp b/msf_tizen_client/src/Channel.cpp
new file mode 100644 (file)
index 0000000..33c0f0c
--- /dev/null
@@ -0,0 +1,1715 @@
+#include <stdlib.h>
+#include <ctime>
+#include <sstream>
+#include <string>
+#include <iterator>
+#include "Clients.h"
+#include "Service.h"
+#include "Channel.h"
+#include "Message.h"
+#include "Debug.h"
+
+#define JSON_KEY_IS_HOST 0
+#define JSON_KEY_CONNECT_TIME 1
+#define JSON_KEY_STATUS 2
+#define JSON_KEY_CODE 3
+#define JSON_KEY_ATTRIBUTES 4
+#define JSON_KEY_RESULT 5
+#define JSON_KEY_MESSAGE_ID 6
+#define JSON_KEY_ERROR 7
+#define JSON_KEY_EVENT 8
+#define JSON_KEY_FROM 9
+#define JSON_KEY_MESSAGE 10
+#define JSON_KEY_METHOD 11
+#define JSON_KEY_DATA 12
+#define JSON_KEY_CLIENTS 13
+
+class Application;
+
+using namespace std;
+
+string ChannelConnectionHandler::PING = "channel.ping";
+string ChannelConnectionHandler::PONG = "pong";
+Channel *ChannelConnectionHandler::channel_ptr = NULL;
+string Channel::ROUTE = "channels";
+string Channel::ERROR_EVENT = "ms.error";
+string Channel::CONNECT_EVENT = "ms.channel.connect";
+string Channel::CLIENT_CONNECT_EVENT = "ms.channel.clientConnect";
+string Channel::CLIENT_DISCONNECT_EVENT = "ms.channel.clientDisconnect";
+string Channel::READY_EVENT = "ms.channel.read";
+map<Channel *, int> Channel::channel_alive_map;
+map<string, int> Channel::json_keys;
+pthread_t Channel::connect_thread;
+pthread_t ChannelConnectionHandler::ping_thread = 0;
+pthread_mutex_t socket_write_mutext = PTHREAD_MUTEX_INITIALIZER;
+// pthread_mutex_t is_write_mutext = PTHREAD_MUTEX_INITIALIZER;
+
+ChannelConnectionHandler::ChannelConnectionHandler() {
+    pingTimeout = 5000000;
+    lastPingReceived = 0;
+    running = false;
+}
+
+Channel::Channel() {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    clientisHost = false;
+    isWrite = false;
+    buflen = 0;
+    was_closed = 1;
+    wsi_mirror = NULL;
+    Context = NULL;
+    mirror_lifetime = 0;
+    disconnecting = false;
+    from = "";
+    clients = new Clients(this); // new to destroy in destructer
+    isLaunched = false;
+    connectionHandler = new ChannelConnectionHandler();
+    resultresp = false;
+    channel_alive_map.insert({this, 1});
+    init_json_key_map();
+}
+
+Channel::Channel(Service *service1, string uri1) {
+    dlog_print(DLOG_INFO, "MSF", "Channel()");
+    clientisHost = false;
+    isWrite = false;
+    buflen = 0;
+    was_closed = 1;
+    wsi_mirror = NULL;
+    Context = NULL;
+    mirror_lifetime = 0;
+    disconnecting = false;
+    from = "";
+    clients = new Clients(this); // new to destroy in destructer
+    isLaunched = false;
+    connectionHandler = new ChannelConnectionHandler();
+    resultresp = false;
+    service = service1;
+    m_uri = uri1;
+    channel_alive_map.insert({this, 1});
+    init_json_key_map();
+}
+
+Channel *Channel::create(Service *service, string uri) {
+    dlog_print(DLOG_INFO, "MSF", "Channel()");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    fprintf(stderr, "\n********************************\n");
+    if ((service == NULL) || uri.length() <= 0)
+        return NULL;
+    Channel *channel = new Channel(service, uri);
+    return channel;
+}
+
+Channel::~Channel() {
+    dlog_print(DLOG_INFO, "MSF", "~Channel()");
+    connect_cb = NULL;
+    disconnect_cb = NULL;
+    onConnectListener = NULL;
+    onDisconnectListener = NULL;
+    onClientConnectListener = NULL;
+    onClientDisconnectListener = NULL;
+    onReadyListener = NULL;
+    channel_alive_map[this] = 0;
+}
+
+void Channel::init_json_key_map() {
+    static bool done = false;
+
+    if (!done) {
+        json_keys["isHost"] = JSON_KEY_IS_HOST;
+        json_keys["connectTime"] = JSON_KEY_CONNECT_TIME;
+        json_keys["status"] = JSON_KEY_STATUS;
+        json_keys["code"] = JSON_KEY_CODE;
+        json_keys["attributes"] = JSON_KEY_ATTRIBUTES;
+        json_keys[Message::PROPERTY_RESULT] = JSON_KEY_RESULT;
+        json_keys[Message::PROPERTY_MESSAGE_ID] = JSON_KEY_MESSAGE_ID;
+        json_keys[Message::PROPERTY_ERROR] = JSON_KEY_ERROR;
+        json_keys[Message::PROPERTY_EVENT] = JSON_KEY_EVENT;
+        json_keys[Message::PROPERTY_FROM] = JSON_KEY_FROM;
+        json_keys[Message::PROPERTY_MESSAGE] = JSON_KEY_MESSAGE;
+        json_keys[Message::PROPERTY_METHOD] = JSON_KEY_METHOD;
+        json_keys[Message::PROPERTY_DATA] = JSON_KEY_DATA;
+        json_keys[Message::PROPERTY_CLIENTS] = JSON_KEY_CLIENTS;
+
+        done = true;
+    }
+}
+
+void Channel::foreach_json_object(JsonObject *object, const gchar *name,
+                                  JsonNode *node, gpointer user_data) {
+    dlog_print(DLOG_INFO, "MSF", "foreach_json_object name : %s", name);
+    if (json_keys.find(name) == json_keys.end()) {
+        dlog_print(DLOG_INFO, "MSF",
+                   "foreach_json_object : there is no %s in map", name);
+        return;
+    }
+
+    int key = json_keys[name];
+    Channel *p = static_cast<Channel *>(user_data);
+    static int iferror = 0;
+    static bool arrayofclients = false;
+
+    switch (key) {
+    // key : isHost
+    case JSON_KEY_IS_HOST: {
+        p->clientisHost = json_node_get_boolean(node);
+        dlog_print(DLOG_INFO, "MSF", "isHost set as %s",
+                   p->clientisHost ? "true" : "false");
+
+        if (!strncmp(p->eventType.c_str(), CLIENT_CONNECT_EVENT.c_str(), 25) ||
+            !strncmp(p->eventType.c_str(), CONNECT_EVENT.c_str(), 25)) {
+            p->client.create(p, p->clientid, p->clientconnectTime,
+                             p->clientisHost, map<string, string>());
+            dlog_print(DLOG_INFO, "MSF", "add clientList");
+            p->clientList.push_back(p->client);
+        }
+    } break;
+
+    // key : connectTime
+    case JSON_KEY_CONNECT_TIME: {
+        p->clientconnectTime = json_node_get_int(node);
+        dlog_print(DLOG_INFO, "MSF", "clientconnectTime set as %lld",
+                   p->clientconnectTime);
+    } break;
+
+    // key : status
+    case JSON_KEY_STATUS: {
+        if (iferror) {
+            p->errstatus = json_node_get_int(node);
+            dlog_print(DLOG_INFO, "MSF", "p->errstatus set");
+        }
+    } break;
+
+    // key : code
+    case JSON_KEY_CODE: {
+        if (iferror) {
+            p->errcode = json_node_get_int(node);
+            string eid = std::to_string(p->msg_id);
+            dlog_print(DLOG_INFO, "MSF", "p->errcode set");
+
+            if (p->callbacks.find(eid) != p->callbacks.end()) {
+                dlog_print(DLOG_INFO, "MSF", "test 1");
+                pair<void *, int> temp = p->getcallback(eid);
+                if (temp.first != NULL) {
+                    Result_Base *temp1 = (Result_Base *)(temp.first);
+                    string err = "";
+                    err.append("status:");
+                    err.append(to_string(p->errstatus));
+                    err.append(" message:");
+                    err.append(p->errMsg);
+                    err.append(" code:");
+                    err.append(to_string(p->errcode));
+                    dlog_print(DLOG_INFO, "MSF", "test 2");
+                    if (temp1)
+                        temp1->onError(Error::create(err));
+                    if (p->onErrorListener)
+                        p->onErrorListener->onError();
+                }
+            }
+        }
+    } break;
+
+    // key : attributes
+    case JSON_KEY_ATTRIBUTES: {
+    } break;
+
+    // key : MESSAGE::PROPERTY_RESULT
+    case JSON_KEY_RESULT: {
+        if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+            p->resultresp = json_node_get_boolean(node);
+            if (p->resultresp) {
+                dlog_print(DLOG_INFO, "MSF", "set resultresp as true");
+            } else {
+                dlog_print(DLOG_INFO, "MSF", "set resultresp as false");
+            }
+            p->msg_subject = Message::PROPERTY_RESULT;
+        } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+            dlog_print(DLOG_INFO, "MSF", "set resultobj");
+            g_free(p->resultobj);
+            p->resultobj = json_node_dup_object(node);
+        }
+    } break;
+
+    // key : MESSAGE::PROPERTY_MESSAGE_ID
+    case JSON_KEY_MESSAGE_ID: {
+        if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+            if (json_node_get_value_type(node) == G_TYPE_INT ||
+                json_node_get_value_type(node) == G_TYPE_INT64) {
+                p->msg_id = json_node_get_int(node);
+                dlog_print(DLOG_INFO, "MSF", "msg-id set as %d", p->msg_id);
+            } else if (json_node_get_value_type(node) == G_TYPE_STRING) {
+                if ((p->eventType == CLIENT_CONNECT_EVENT) || arrayofclients) {
+                    p->clientid = json_node_get_string(node);
+                    dlog_print(DLOG_INFO, "MSF", "clientid set as = %s",
+                               p->clientid.c_str());
+                } else {
+                    p->from = json_node_get_string(node);
+                    dlog_print(DLOG_INFO, "MSF", "from set as = %s",
+                               p->from.c_str());
+                }
+            }
+        }
+    } break;
+
+    // key : MESSAGE::PROPERTY_ERROR
+    case JSON_KEY_ERROR: {
+        if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+            iferror = 1;
+            dlog_print(DLOG_INFO, "MSF", "iferror set as 1");
+        } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+            iferror = 1;
+            dlog_print(DLOG_INFO, "MSF", "iferror set as 1");
+            // g_free(p->errobj);
+            p->errobj = true;
+            json_object_foreach_member(json_node_get_object(node),
+                                       foreach_json_object, user_data);
+        }
+    } break;
+
+    // key : MESSAGE::PROPERTY_EVENT
+    case JSON_KEY_EVENT: {
+        p->eventType = json_node_get_string(node);
+        dlog_print(DLOG_INFO, "MSF", "eventType set as = %s",
+                   p->eventType.c_str());
+    } break;
+
+    // key : MESSAGE::PROPERTY_FROM
+    case JSON_KEY_FROM: {
+        p->from = json_node_get_string(node);
+        dlog_print(DLOG_INFO, "MSF", "from set as = %s", p->from.c_str());
+    } break;
+
+    // key : MESSAGE::PROPERTY_MESSAGE
+    case JSON_KEY_MESSAGE: {
+        p->errMsg = json_node_get_string(node);
+        dlog_print(DLOG_INFO, "MSF", "errMsg set as = %s", p->errMsg.c_str());
+    } break;
+
+    // key : MESSAGE::PROPERTY_METHOD
+    case JSON_KEY_METHOD: {
+        p->method = json_node_get_string(node);
+        dlog_print(DLOG_INFO, "MSF", "method set as = %s", p->method.c_str());
+    } break;
+    // key : MESSAGE:PROPERTY_DATA
+    case JSON_KEY_DATA: {
+        if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+            if (json_node_get_value_type(node) == G_TYPE_STRING) {
+                p->data = json_node_get_string(node);
+                dlog_print(DLOG_INFO, "MSF", "data set as = %s",
+                           p->data.c_str());
+            }
+        } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+            json_object_foreach_member(json_node_get_object(node),
+                                       foreach_json_object, user_data);
+        }
+    } break;
+
+    // key : MESSAGE:PROPERTY_CLIENTS
+    case JSON_KEY_CLIENTS: {
+        arrayofclients = true;
+        dlog_print(DLOG_INFO, "MSF", "array start");
+        json_array_foreach_element(json_node_get_array(node),
+                                   foreach_json_array, user_data);
+        dlog_print(DLOG_INFO, "MSF", "array end");
+        arrayofclients = false;
+    } break;
+
+    default:
+        break;
+    }
+}
+
+void Channel::foreach_json_array(JsonArray *array, guint index, JsonNode *node,
+                                 gpointer user_data) {
+    json_object_foreach_member(json_node_get_object(node), foreach_json_object,
+                               user_data);
+}
+
+void Channel::json_parse(const char *in) {
+    dlog_print(DLOG_INFO, "MSF", "Channel::json_parse : %s", in);
+
+    JsonParser *parser = json_parser_new();
+
+    if (json_parser_load_from_data(parser, in, -1, NULL)) {
+        JsonNode *node = json_parser_get_root(parser);
+
+        if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+            json_object_foreach_member(json_node_get_object(node),
+                                       foreach_json_object, this);
+        }
+
+    } else {
+        dlog_print(DLOG_ERROR, "MSF", "json_parsing error");
+    }
+}
+
+Clients *Channel::getclients() {
+    if (clients->size())
+        return clients;
+    else
+        return NULL;
+}
+
+void Channel::setConnectionTimeout(long timeout) {
+    if (timeout < 0)
+        return;
+    else if (timeout == 0)
+        connectionHandler->stopPing();
+    else
+       {
+        connectionHandler->setPingTimeout(timeout);
+        if (isWebSocketOpen())
+            connectionHandler->startPing(this);
+    }
+}
+
+void Channel::handleConnectMessage(string UID) {
+    dlog_print(DLOG_INFO, "MSF", "handleConnectMessage(uid)");
+
+    clients->reset();
+    clients->add(clientList);
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    clients->setMyClientId(from);
+
+    handleConnect(UID);
+    dlog_print(DLOG_INFO, "MSF", "handleConnectMessage(uid) 1");
+}
+
+void Channel::handleMessage(string UID) { handleMessage(UID, NULL); }
+
+void Channel::handleMessage(string UID, unsigned char payload[]) {
+    if (eventType.length() == 0) {
+        // if (msg_subject == Message::PROPERTY_RESULT) {
+        //     handleClientMessage(NULL,NULL);
+        //     return;
+        //}
+
+        handleApplicationMessage(UID);
+    } else if (eventType == CLIENT_CONNECT_EVENT) {
+        dlog_print(DLOG_INFO, "MSF", "call handleClientConnectMessage");
+        handleClientConnectMessage();
+    } else if (eventType == CLIENT_DISCONNECT_EVENT) {
+        dlog_print(DLOG_INFO, "MSF", "call handleclientdisconnect");
+        handleClientDisconnectMessage();
+    } else if (eventType == ERROR_EVENT) {
+        dlog_print(DLOG_INFO, "MSF", "call handleErrorMessage");
+        handleErrorMessage(UID);
+    } else if (eventType == READY_EVENT) {
+        dlog_print(DLOG_INFO, "MSF", "call handleReadyMessage");
+        handleReadyMessage();
+    } else {
+        dlog_print(DLOG_INFO, "MSF", "call handleClientMessage 2");
+        handleClientMessage(data.c_str(), payload);
+    }
+}
+
+void Channel::handleApplicationMessage(string uid) {
+    dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 1");
+    MSF_DBG(
+        "[MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",
+        __FUNCTION__, __LINE__, __FILE__);
+    string messageId = uid;
+    bool errorMap = errobj;
+    dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 2");
+    pair<void *, int> temp = getcallback(messageId);
+
+    dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 3");
+
+    if (temp.first != NULL) {
+        dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 4");
+        if ((waitForOnReady) && (errorMap == false)) {
+            dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 5");
+            MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in "
+                    "file [%s] \n",
+                    __FUNCTION__, __LINE__, __FILE__);
+            onReadyCallbacks.insert(temp);
+            if (!isLaunched) {
+                dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 6");
+                MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] "
+                        "in file [%s] \n",
+                        __FUNCTION__, __LINE__, __FILE__);
+                isLaunched = true;
+            } else {
+                dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 7");
+                MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] "
+                        "in file [%s] \n",
+                        __FUNCTION__, __LINE__, __FILE__);
+                // handleClientDisconnectMessage();
+                isLaunched = false;
+
+                if (temp.second == Result_bool) {
+                    dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 8");
+                    doApplicationCallback((Result_Base *)(temp.first));
+                }
+            }
+            return;
+        }
+
+        if (temp.second == Result_bool) {
+            dlog_print(DLOG_INFO, "MSF", "handleApplicationMessage 8");
+            MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in "
+                    "file [%s] \n",
+                    __FUNCTION__, __LINE__, __FILE__);
+            doApplicationCallback((Result_Base *)(temp.first));
+        }
+    } else {
+        doApplicationCallback(NULL);
+    }
+}
+
+void Channel::doApplicationCallback(Result_Base *result1) {
+    dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 1");
+    MSF_DBG(
+        "[MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",
+        __FUNCTION__, __LINE__, __FILE__);
+    if (resultobj != NULL) {
+        dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 2");
+        MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
+                "[%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+    }
+
+    bool errorMap = errobj;
+
+    if (errorMap != false) {
+        dlog_print(DLOG_ERROR, "MSF", "doApplicationCallback 3");
+        MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
+                "[%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        int code = errcode;
+        stringstream ss;
+        ss << code;
+        string str = ss.str();
+        if (result1 != NULL)
+            result1->onError(Error::create(str));
+    } else {
+        dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 4");
+
+        MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
+                "[%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        //     ApplicationInfo *InfoObj=new ApplicationInfo();
+        if (resultobj != NULL) {
+            dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 5");
+            // string json=json_object_to_json_string(resultobj);
+            // InfoObj->create(json);
+            if (result1 != NULL) {
+                dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 6");
+                result1->onSuccess(true);
+            }
+        }
+
+        if (msg_subject == Message::PROPERTY_RESULT) {
+            dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 7");
+            if (result1 != NULL) {
+                dlog_print(DLOG_INFO, "MSF", "doApplicationCallback 8");
+                result1->onSuccess(true);
+            }
+        }
+    }
+}
+
+void Channel::handleErrorMessage(string UID) {
+    Error err = Error::create(errMsg);
+    handleError(UID, err);
+}
+
+void Channel::handleError(string UID, Error err) {
+    if (UID.length() != 0) {
+        pair<void *, int> temp = Channel::getcallback(UID);
+        MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file "
+                "[%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        if (temp.first != NULL) {
+            if (temp.second == Result_Client) {
+                Result_Base *temp1 = (Result_Base *)(temp.first);
+                if (temp1)
+                    temp1->onError(err);
+            } else if (temp.second == Result_bool) {
+                Result_Base *temp1 = (Result_Base *)(temp.first);
+                if (temp1)
+                    temp1->onError(err);
+            }
+
+            if (onErrorListener)
+                onErrorListener->onError();
+        }
+    }
+}
+
+void Channel::handleClientMessage(const char *msg, unsigned char payload[]) {
+    dlog_print(DLOG_INFO, "MSF", "handleClientMessage 0");
+
+    emit(eventType, msg, from, cl_payload, cl_payload_size);
+}
+
+void Channel::emit(string event, const char *msg, string from,
+                   unsigned char *payld, int payld_size) {
+    dlog_print(DLOG_INFO, "MSF", "emit");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    if (msg == NULL) {
+        dlog_print(DLOG_INFO, "MSF", "emit msg = NULL");
+        return;
+    }
+
+    if (message_receive_cb) {
+        Message mesg(this, event, msg, from, payld, payld_size);
+        message_receive_cb(mesg);
+    }
+
+    if (everyMessageListener) {
+        Message mesg(this, event, msg, from, payld, payld_size);
+        everyMessageListener->onMessage(mesg);
+    }
+
+    if (messageListeners.size() != 0) {
+        dlog_print(DLOG_INFO, "MSF", "emit 1");
+
+        if (messageListeners.find(event) == messageListeners.end()) {
+            dlog_print(DLOG_INFO, "MSF", "map not found");
+            return;
+        }
+
+        list<OnMessageListener *> &onMessageListeners =
+            (messageListeners.find(event))->second;
+        dlog_print(DLOG_INFO, "MSF", "emit 2");
+
+        if (onMessageListeners.size() != 0) {
+            dlog_print(DLOG_INFO, "MSF", "emit 3");
+            std::list<OnMessageListener *>::const_iterator iterator;
+            for (iterator = onMessageListeners.begin();
+                 iterator != onMessageListeners.end(); ++iterator) {
+                Message mesg(this, event, msg, from, payld, payld_size);
+                (*iterator)->onMessage(mesg);
+            }
+        } else {
+            dlog_print(DLOG_INFO, "MSF", "empty listeners");
+        }
+    }
+}
+
+bool Channel::connect() { return connect(connect_cb); }
+
+bool Channel::connect(Result_Base *result1) {
+    bool ret = connect(map<string, string>(), result1);
+    return ret;
+}
+
+bool Channel::connect(map<string, string> attributes, Result_Base *result1) {
+    dlog_print(DLOG_INFO, "MSF", "Channel::connect(at, res)");
+
+    string uid = getUID();
+
+    dlog_print(DLOG_INFO, "MSF", "connect call registercallback");
+    registerCallback(uid, (void *)result1, Result_Client);
+
+    UID = uid;
+    if (isWebSocketOpen()) {
+        handleError(uid, Error::create("Already Connected"));
+        return false;
+    }
+
+    map<string, string> *at_data = new map<string, string>(attributes);
+    map<Channel *, map<string, string> *> *pt_user_data =
+        new map<Channel *, map<string, string> *>();
+    pt_user_data->insert({this, at_data});
+
+    int status = pthread_create(&connect_thread, NULL, pt_startConnect,
+                                (void *)pt_user_data);
+
+    if (status)
+        return true;
+    else
+        return false;
+}
+
+void Channel::disconnect() {
+    dlog_print(DLOG_INFO, "MSF", "channel disconnect()");
+    disconnect(disconnect_cb);
+}
+
+void Channel::disconnect(Result_Base *result1) {
+    dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 1");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    string randID = getUID();
+    UID = randID;
+    dlog_print(DLOG_INFO, "MSF", "disconnect call registercallback");
+    registerCallback(randID, (void *)result1, Result_Client);
+    string message = "";
+    if (!isWebSocketOpen())
+        message = "Already Disconnected";
+    if (disconnecting)
+        message = "Already Disconnecting";
+    if (message != "")
+        handleError(UID, Error::create(message));
+    else
+       {
+        dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 2");
+        MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
+                "file [%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        disconnecting = true;
+        // consume the callback
+        getcallback(randID);
+
+        dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 3");
+
+        while (1) {
+            if (mirror_lifetime > 0)
+                mirror_lifetime--;
+
+            if (!mirror_lifetime) {
+                dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 4");
+                break;
+            }
+        }
+
+        was_closed = 1;
+
+        if (result1) {
+            dlog_print(DLOG_INFO, "MSF", "channel disconnect(result) 5");
+
+            if (Channel::onDisconnectListener != NULL) {
+                dlog_print(DLOG_INFO, "MSF", "disconnect()");
+                // Channel::onDisconnectListener->onDisconnect(client);
+            }
+
+            result1->onSuccess(clients->me());
+        }
+
+        if (disconnecting) {
+            disconnecting = false;
+        }
+
+        connectionHandler->stopPing();
+    }
+}
+
+void Channel::handleReadyMessage() {
+    waitForOnReady = false;
+    std::map<void *, int>::const_iterator iterator;
+    for (iterator = onReadyCallbacks.begin();
+         iterator != onReadyCallbacks.end(); ++iterator) {
+        Result_Base *res = (Result_Base *)iterator->first;
+        onReadyCallbacks.erase(res);
+        doApplicationCallback(res);
+    }
+    if (onConnectListener)
+        onConnectListener->onConnect(clients->me());
+
+    if (onReadyListener != NULL)
+        onReadyListener->onReady();
+}
+
+void Channel::handleClientConnectMessage() {
+    dlog_print(DLOG_INFO, "MSF", "handleClientConnectMessage");
+
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    if (client.isHost())
+        connected = true;
+
+    clients->add(client);
+
+    dlog_print(DLOG_INFO, "MSF", "handleClientConnectMessage client = %s",
+               client.getId());
+    MSF_DBG("\n Debug Log: CLIENTLIST SIZE IS [%d],  %s %d in %s \n",
+            clients->size(), __FUNCTION__, __LINE__, __FILE__);
+    if (onClientConnectListener != NULL)
+        onClientConnectListener->onClientConnect(client);
+}
+
+void Channel::handleClientDisconnectMessage() {
+    dlog_print(DLOG_INFO, "MSF", "handle client disconnect Message event = %s",
+               eventType.c_str());
+
+    if (resultresp && isLaunched) {
+        dlog_print(DLOG_INFO, "MSF", "handleclientdisconnectMessage 1");
+        handleSocketClosed();
+        return;
+    }
+
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    Client client = clients->get(clientid);
+    if (client.isHost()) {
+        dlog_print(DLOG_INFO, "MSF", "handleclientdisconnectMessage 2");
+        connected = false;
+    }
+    clients->remove(client);
+
+    if (onClientDisconnectListener != NULL) {
+        dlog_print(DLOG_INFO, "MSF", "handleclientdisconnectMessage 3");
+        onClientDisconnectListener->onClientDisconnect(client);
+    }
+}
+
+void Channel::handleConnect(string UID) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    dlog_print(DLOG_INFO, "MSF", "handleConnect");
+    Client clienttemp = clients->me();
+
+    pair<void *, int> temp;
+
+    temp = Channel::getcallback(UID);
+    if (temp.second == Result_Client) {
+        Result_Base *temp1 = (Result_Base *)(temp.first);
+        if (temp1)
+            temp1->onSuccess(clienttemp);
+    } else if (temp.second == Result_bool) {
+        Result_Base *temp1 = (Result_Base *)(temp.first);
+        if (temp1)
+            temp1->onSuccess(true);
+    }
+
+    me = clients->me();
+
+    if (onConnectListener)
+        onConnectListener->onConnect(clienttemp);
+    // To start channnel heath check
+    if (isWebSocketOpen()) {
+        // connectionHandler->startPing(this);
+    }
+
+    dlog_print(DLOG_INFO, "MSF", "handleConnect 1");
+}
+
+void Channel::handleSocketClosedAndNotify() {
+    Client client = clients->me();
+    handleSocketClosed();
+
+    if (Channel::onDisconnectListener != NULL) {
+        dlog_print(DLOG_INFO, "MSF", "handleSocketClosedAndNotify");
+        Channel::onDisconnectListener->onDisconnect(client);
+    }
+}
+
+void Channel::handleSocketClosed() {
+    dlog_print(DLOG_INFO, "MSF", "handleSocketClosed");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    connectionHandler->stopPing();
+    wsi_mirror = NULL;
+    connected = false;
+    was_closed = 1;
+    if (disconnecting)
+        disconnecting = false;
+    callbacks.clear();
+    clients->reset();
+}
+
+int Channel::callback_lws_mirror(struct lws *wsi,
+                                 enum lws_callback_reasons reason, void *user,
+                                 void *in, size_t len) {
+    int n;
+    void *user_data;
+    Channel *this_ptr = NULL;
+    struct lws_context *context = lws_get_context(wsi);
+    user_data = lws_context_user(context);
+    this_ptr = static_cast<Channel *>(user_data);
+
+    if (channel_alive_map.find(this_ptr) != channel_alive_map.end()) {
+        if (channel_alive_map[this_ptr] == 0) {
+            return -1;
+        }
+    } else {
+        return -1;
+    }
+
+    switch (reason) {
+    case LWS_CALLBACK_ESTABLISHED:
+        break;
+
+    case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
+        break;
+
+    case LWS_CALLBACK_CLOSED:
+        if (this_ptr->disconnecting) {
+            dlog_print(DLOG_INFO, "MSF_SOCKET", "socket closed diconnecting");
+            MSF_DBG("mirror: LWS_CALLBACK_CLOSED\n");
+            this_ptr->wsi_mirror = NULL;
+            this_ptr->mirror_lifetime = 0;
+            this_ptr->disconnecting = false;
+
+        } else {
+            dlog_print(DLOG_INFO, "MSF_SOCKET",
+                       "socket closed not diconnecting");
+            dlog_print(DLOG_INFO, "MSF_SOCKET",
+                       "call handleSocketClosedAndNotify");
+            this_ptr->handleSocketClosedAndNotify();
+        }
+        break;
+
+    case LWS_CALLBACK_CLIENT_ESTABLISHED:
+        MSF_DBG("[MSF LOG]: LWS_CALLBACK_CLIENT_ESTABLISHED [%s]\n",
+                __FUNCTION__);
+        lws_callback_on_writable(wsi);
+        break;
+
+    case LWS_CALLBACK_CLIENT_RECEIVE:
+        if (this_ptr == NULL) {
+            dlog_print(DLOG_INFO, "MSF", "user ptr is NULL. return.");
+            // it means Channel object was deleted
+            return -1;
+        } else {
+            dlog_print(DLOG_INFO, "MSF", "user ptr is not NULL.");
+        }
+
+        this_ptr->eventType = "";
+
+        if (lws_frame_is_binary(wsi)) {
+            dlog_print(DLOG_INFO, "MSF", "BINARY MESSAGE ARRIVED");
+
+            int header_size = 0;
+
+            header_size = (int)((unsigned char *)in)[0];
+            header_size = header_size << 8;
+            header_size = header_size & 0xff00;
+            header_size = header_size | (int)((unsigned char *)in)[1];
+            dlog_print(DLOG_INFO, "MSF", "header_size = %d", header_size);
+
+            char header_json[header_size + 1] = {0};
+
+            memcpy(&header_json[0], &(((unsigned char *)in)[2]), header_size);
+            header_json[header_size + 1] = 0;
+
+            dlog_print(DLOG_INFO, "MSF", "in = %s", &header_json[0]);
+
+            this_ptr->json_parse(header_json);
+            memcpy(&(this_ptr->cl_payload),
+                   &(((unsigned char *)in)[2 + header_size]),
+                   len - 2 - header_size);
+
+            this_ptr->cl_payload[len - 2 - header_size] = 0;
+            this_ptr->cl_payload_size = len - 2 - header_size;
+
+            dlog_print(DLOG_INFO, "MSF", "payload = %s",
+                       &(this_ptr->cl_payload[0]));
+
+            this_ptr->connectionHandler->resetLastPingReceived();
+
+            if (this_ptr->eventType == CONNECT_EVENT) {
+                this_ptr->handleConnectMessage(this_ptr->UID);
+            } else {
+                // this_ptr->handleMessage(this_ptr->UID);
+                this_ptr->handleMessage(this_ptr->UID, this_ptr->cl_payload);
+            }
+        } else {
+            dlog_print(DLOG_INFO, "MSF", "TEXT MESSAGE ARRIVED");
+            MSF_DBG("[MSF LOG]LWS_CALLBACK_RECEIVE_ESTABLISHED:\t");
+            MSF_DBG("\n%s\n", (char *)in);
+            fprintf(stderr, "\n %s \n", (char *)in);
+            dlog_print(DLOG_INFO, "MSF", "socket in = %s", (char *)in);
+            this_ptr->json_parse((char *)in);
+            this_ptr->connectionHandler->resetLastPingReceived();
+
+            // dead code.
+            // server do not send METHOD_EMIT now
+            /*
+               if (!((this_ptr->method).compare(Message::METHOD_EMIT))) {
+               this_ptr->emit(this_ptr->eventType, (this_ptr->data).c_str(),
+               this_ptr->from, this_ptr->Payload);
+               break;
+               }
+             */
+            if (this_ptr->eventType == CONNECT_EVENT) {
+                this_ptr->handleConnectMessage(this_ptr->UID);
+            } else {
+                // this_ptr->handleMessage(this_ptr->UID);
+                this_ptr->handleMessage(this_ptr->UID, NULL);
+            }
+        }
+
+        dlog_print(DLOG_INFO, "MSF", "Socket receive end ");
+        break;
+
+    case LWS_CALLBACK_CLIENT_WRITEABLE:
+        if (this_ptr->isWrite) {
+            this_ptr->isWrite = false;
+
+            if (&(this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING]) == NULL ||
+                this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING] == 0 ||
+                this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING] == '\0') {
+                printf("\ntry write NULL data");
+                fflush(stdout);
+            } else {
+                // printf("\ntry write data = %s",
+                // &(this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING]));
+                // printf("\ndata size = %d", this_ptr->buflen);
+                fflush(stdout);
+            }
+
+            if (this_ptr->buflen <= 0) {
+                printf("\ntry write 0 size data");
+                fflush(stdout);
+            }
+
+            // printf("\nwrite socket");
+            // fflush(stdout);
+            if (this_ptr->binary_message) {
+                n = lws_write(wsi,
+                              &(this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING]),
+                              this_ptr->buflen, LWS_WRITE_BINARY);
+            } else {
+                n = lws_write(wsi,
+                              &(this_ptr->buf[LWS_SEND_BUFFER_PRE_PADDING]),
+                              this_ptr->buflen, LWS_WRITE_TEXT);
+            }
+
+            if (n < 0) {
+                MSF_DBG("Writing failed\n");
+                dlog_print(DLOG_ERROR, "MSF", "socket write failed");
+                printf("\nwrite socket failed");
+                printf("\ncallback isWrite=false");
+                fflush(stdout);
+                // printf("\ntry unlock socket mutex\n");
+                // fflush(stdout);
+                pthread_mutex_unlock(&socket_write_mutext);
+                // printf("\nunlock socket mutex\n");
+                // fflush(stdout);
+                return -1;
+            }
+            // fflush(stdout);
+        }
+        // fflush(stdout);
+        // fflush(stdout);
+        pthread_mutex_unlock(&socket_write_mutext);
+        // fflush(stdout);
+        lws_callback_on_writable(wsi);
+        break;
+
+    case LWS_CALLBACK_RECEIVE:
+        dlog_print(DLOG_INFO, "MSF_SOCKET", "socket LWS_CALLBACK_RECEIVE %d",
+                   reason);
+        break;
+
+    case LWS_CALLBACK_PROTOCOL_DESTROY:
+        dlog_print(DLOG_INFO, "MSF_SOCKET",
+                   "socket LWS_CALLBACK_PROTOCOL_DESTROY %d", reason);
+        break;
+
+    case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED:
+    case LWS_CALLBACK_ADD_POLL_FD:
+    case LWS_CALLBACK_DEL_POLL_FD:
+    case LWS_CALLBACK_CONFIRM_EXTENSION_OKAY:
+    case LWS_CALLBACK_CLIENT_RECEIVE_PONG:
+    case LWS_CALLBACK_HTTP:
+    case LWS_CALLBACK_HTTP_WRITEABLE:
+    case LWS_CALLBACK_HTTP_FILE_COMPLETION:
+    case LWS_CALLBACK_SERVER_WRITEABLE:
+    case LWS_CALLBACK_FILTER_NETWORK_CONNECTION:
+    case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION:
+    case LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS:
+    case LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER:
+    case LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION:
+    case LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH:
+        break;
+
+    default:
+        break;
+    }
+
+    return 0;
+}
+
+Client Channel::getclient(string id) { return clients->get(id); }
+
+bool Channel::isConnected() { return isWebSocketOpen(); }
+
+bool Channel::isWebSocketOpen() { return wsi_mirror == NULL ? false : true; }
+
+string Channel::getChannelUri(map<string, string> *attributes) {
+    return service->getUri();
+}
+
+void Channel::publish(string event, const char *data) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    string to = "\"";
+    to.append(Message::TARGET_ALL.c_str());
+    to.append("\"");
+
+    publishMessage(event, data, to.c_str(), NULL, 0);
+}
+
+void Channel::publish(string event, const char *data, unsigned char payload[],
+                      int payload_size) {
+    dlog_print(DLOG_INFO, "MSF", "publishMessage");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    string to = "\"";
+    to.append(Message::TARGET_ALL.c_str());
+    to.append("\"");
+    publishMessage(event, data, to.c_str(), payload, payload_size);
+}
+
+void Channel::publish(string event, const char *data, const char *target) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    string to = "\"";
+    to.append(target);
+    to.append("\"");
+    publishMessage(event, data, to.c_str(), NULL, 0);
+}
+
+void Channel::publish(string event, const char *data, const char *target,
+                      unsigned char payload[], int payload_size) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    string to = "\"";
+    to.append(target);
+    to.append("\"");
+    publishMessage(event, data, to.c_str(), payload, payload_size);
+}
+
+void Channel::publish(string event, const char *data, Client client) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    string to = "\"";
+    to.append(client.getId());
+    to.append("\"");
+    publishMessage(event, data, to.c_str(), NULL, 0);
+}
+
+void Channel::publish(string event, const char *data, Client client,
+                      unsigned char payload[], int payload_size) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    string to = "\"";
+    to.append(client.getId());
+    to.append("\"");
+    publishMessage(event, data, to.c_str(), payload, payload_size);
+}
+
+void Channel::publish(string event, const char *data, list<Client> clients) {
+    publish(event, data, clients, NULL, 0);
+}
+
+void Channel::publish(string event, const char *data, list<Client> clients,
+                      unsigned char payload[], int payload_size) {
+    string to = "[";
+
+    std::list<Client>::iterator iterator;
+    for (iterator = clients.begin(); iterator != clients.end(); ++iterator) {
+        to.append("\"");
+        to.append(iterator->getId());
+        to.append("\"");
+
+        if (std::next(iterator, 1) != clients.end()) {
+            to.append(",");
+        } else {
+            to.append("]");
+        }
+    }
+
+    // TODO
+    publishMessage(event, data, to.c_str(), payload, payload_size);
+}
+
+void Channel::publishMessage(string event, const char *data, const char *to,
+                             unsigned char payload[], int payload_size) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    publishMessage(Message::METHOD_EMIT, event, data, to, payload,
+                   payload_size);
+}
+
+void Channel::publishMessage(string method, string event, const char *data,
+                             const char *to, unsigned char payload[],
+                             int payload_size) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    if (!isWebSocketOpen()) {
+        handleError(string(), Error::create("Not Connected"));
+        return;
+    } else {
+        // int l=0;
+        // l += sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING]," {\n
+        // \"method\": \"%s\",\n \"params\": {\n \"event\": \"%s\",\n \"data\":
+        // \"%s\",\n \"to\": \"%s\"\n }\n}",method.c_str(),event.c_str(),
+        // (unsigned char*)data, (unsigned char*)to);
+
+        // unsigned char  *bufer=new char[LWS_SEND_BUFFER_PRE_PADDING + 4096
+        // +LWS_SEND_BUFFER_POST_PADDING];
+        // bufer=prepareMessageMap(method,event,data,to);
+
+        long prepare_buf_len = 0;
+        unsigned char *prepare_buf = prepareMessageMap(
+            method, event, data, to, &prepare_buf_len, payload, payload_size);
+
+        // printf("\ntry lock socket mutextn");
+        // fflush(stdout);
+        // lock buf[], socket, isWrite //
+        pthread_mutex_lock(&socket_write_mutext);
+        // printf("\nlock socket mutext\n");
+        // fflush(stdout);
+
+        memcpy(&buf[LWS_SEND_BUFFER_PRE_PADDING],
+               &prepare_buf[LWS_SEND_BUFFER_PRE_PADDING], prepare_buf_len);
+
+        buf[LWS_SEND_BUFFER_PRE_PADDING + prepare_buf_len] = 0;
+
+        buflen = prepare_buf_len;
+        // buf code
+        // for(int i=0; i<buflen;i++)
+        //     buf[i]=prepare_buf[i];
+
+        // buf[buflen] = 0;
+
+        delete[](prepare_buf);
+
+        MSF_DBG("buf is = %s %d \n", &buf[LWS_SEND_BUFFER_PRE_PADDING], buflen);
+        // buflen=l;
+        // messagedata=((char*)data);
+
+        if (binary_message) {
+            dlog_print(DLOG_INFO, "MSF", "publish buffer = %s",
+                       &buf[LWS_SEND_BUFFER_PRE_PADDING + 2]);
+        } else {
+            dlog_print(DLOG_INFO, "MSF", "publish buffer = %s",
+                       &buf[LWS_SEND_BUFFER_PRE_PADDING]);
+        }
+
+        // if (bufer)
+        //     free(bufer);
+
+        isWrite = true;
+        // printf("\npublish isWrite=true\n");
+    }
+}
+
+unsigned char *Channel::prepareMessageMap(string method, string event,
+                                          const char *data, const char *to,
+                                          long *prepare_buf_len,
+                                          unsigned char payload[],
+                                          int payload_size) {
+    int l = 0;
+    int header_size = 0;
+
+    unsigned char *prepare_buf =
+        new unsigned char[LWS_SEND_BUFFER_PRE_PADDING + 4096 +
+                          LWS_SEND_BUFFER_POST_PADDING];
+
+    if (payload) {
+        l += sprintf((char *)&prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + 2],
+                     "{\n \"method\": \"%s\",\n \"params\": {\n \"event\": "
+                     "\"%s\",\n \"data\": \"%s\",\n \"to\": %s\n }\n}",
+                     method.c_str(), event.c_str(), (unsigned char *)data,
+                     (unsigned char *)to);
+
+        header_size = l;
+
+        prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + 1] =
+            (unsigned char)header_size;
+        prepare_buf[LWS_SEND_BUFFER_PRE_PADDING] =
+            (unsigned char)((header_size) >> 8);
+
+        dlog_print(DLOG_INFO, "MSF", "publish header size = %d", header_size);
+        dlog_print(DLOG_INFO, "MSF", "buf[1] = %d",
+                   (char)prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + 1]);
+        dlog_print(DLOG_INFO, "MSF", "buf[0] = %d",
+                   (char)prepare_buf[LWS_SEND_BUFFER_PRE_PADDING]);
+
+        l += 2;
+
+        memcpy(&prepare_buf[LWS_SEND_BUFFER_PRE_PADDING + l], payload,
+               payload_size);
+
+        l += payload_size;
+
+        binary_message = true;
+    } else {
+        l += sprintf((char *)&prepare_buf[LWS_SEND_BUFFER_PRE_PADDING],
+                     "{\n \"method\": \"%s\",\n \"params\": {\n \"event\": "
+                     "\"%s\",\n \"data\": \"%s\",\n \"to\": %s\n }\n}",
+                     method.c_str(), event.c_str(), (unsigned char *)data,
+                     (unsigned char *)to);
+        binary_message = false;
+    }
+    MSF_DBG("buf is = %s %d \n", &buf[LWS_SEND_BUFFER_PRE_PADDING], l);
+
+    *prepare_buf_len = l;
+    return prepare_buf;
+}
+
+void Channel::handleBinaryMessage(unsigned char payload[]) {}
+
+void Channel::start_app(char *data, int buflength, string msgID) {
+    dlog_print(DLOG_INFO, "MSF", "start_app() buf = %s", data);
+    UID = msgID;
+    int l = 0;
+
+    // socket mutext start//
+    // printf("\ntry lock socket mutex\n");
+
+    // lock buf[], socket, isWrite //
+    pthread_mutex_lock(&socket_write_mutext);
+    // printf("\nlock socket mutex\n");
+    l += sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING], data);
+    MSF_DBG("buf is = %s %d \n", &buf[LWS_SEND_BUFFER_PRE_PADDING], l);
+    buflen = l;
+    buf[LWS_SEND_BUFFER_PRE_PADDING + l] = 0;
+
+    if (data == NULL) {
+    }
+
+    dlog_print(DLOG_INFO, "MSF", "start_app() buf = %s",
+               &buf[LWS_SEND_BUFFER_PRE_PADDING]);
+    binary_message = false;
+
+    isWrite = true;
+    printf("start_app isWrite=true");
+
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+}
+
+void Channel::registerCallback(string uid, void *callback, int value_type) {
+    dlog_print(DLOG_INFO, "MSF", "registerCallback uid = %s value_type = %d",
+               uid.c_str(), value_type);
+    callbacks[uid] = make_pair(callback, value_type);
+}
+
+void Channel::release_callback(string uid) { callbacks.erase(uid); }
+
+pair<void *, int> Channel::getcallback(string uid) {
+    map<string, pair<void *, int>>::iterator check_it = callbacks.find(uid);
+
+    if (check_it == callbacks.end()) {
+        dlog_print(DLOG_ERROR, "MSF",
+                   "callbacks map not found. critical error");
+        return pair<void *, int>();
+    }
+
+    if (uid.length() != 0) {
+        pair<void *, int> r1 = callbacks[uid];
+
+        callbacks.erase(uid);
+
+        dlog_print(DLOG_INFO, "MSF", "getcallback success uid = %s",
+                   uid.c_str());
+        return r1;
+    }
+
+    dlog_print(DLOG_INFO, "MSF", "getcallback failed", uid.c_str());
+    return pair<void *, int>();
+}
+
+string Channel::getUID() {
+    std::stringstream ss;
+    ss << (rand() % 9000 + 1000);
+    string randID = ss.str();
+    return randID;
+}
+
+void *Channel::pt_startConnect(void *att) {
+    map<Channel *, map<string, string> *> *pt_user_data =
+        static_cast<map<Channel *, map<string, string> *> *>(att);
+    map<string, string> *attributes = pt_user_data->begin()->second;
+
+    pt_user_data->begin()->first->create_websocket(attributes);
+
+    delete attributes;
+    delete pt_user_data;
+
+    return NULL;
+}
+
+void Channel::create_websocket(void *att) {
+    struct lws_protocols protocols[] = {
+        {"lws-mirror-protocol", Channel::callback_lws_mirror, sizeof(int), 0, 0,
+         NULL},
+
+        // libwebsockets 1.7 has a bug.
+        {NULL, NULL, 0, 0, 0, NULL} // this is anti-bug code
+    };
+
+    int port = 8001;
+    int use_ssl = 0;
+    int n = 0;
+    // int ret = 0;
+    map<string, string> *attributes = (map<string, string> *)(att);
+    string uri = getChannelUri(attributes);
+
+    was_closed = 0;
+    struct lws_context *context;
+
+    int ietf_version = -1; /* latest */
+
+    struct lws_context_creation_info info;
+
+    memset(&info, 0, sizeof info);
+
+    info.port = CONTEXT_PORT_NO_LISTEN;
+    info.protocols = protocols;
+    info.extensions = NULL;
+    info.ssl_cert_filepath = NULL;
+    info.ssl_private_key_filepath = NULL;
+    info.gid = -1;
+    info.uid = -1;
+    info.options = 0;
+    info.user = this;
+
+#ifndef LWS_NO_EXTENSIONS
+// info.extensions = lws_get_internal_extensions();
+#endif
+    if (this != NULL) {
+        info.user = this;
+    }
+    if (isWebSocketOpen()) {
+        MSF_DBG("\nAlready Connected");
+        dlog_print(DLOG_INFO, "MSF", "create_websocket already Connected");
+        // return 0;
+    }
+    context = lws_create_context(&info);
+    Context = context;
+    if (context == NULL) {
+        MSF_DBG("Creating libwebsocket context failed\n");
+        dlog_print(DLOG_ERROR, "MSF", "create_websocket context failed");
+        // return 1;
+    }
+    n = 0;
+    string address = getipaddressfromUri(uri);
+    string api = getapifromUri(uri);
+    api.append("channels/").append(ChannelID);
+
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+
+    struct lws_client_connect_info connect_info;
+    connect_info.context = context;
+    connect_info.address = address.c_str();
+    connect_info.port = port;
+    connect_info.ssl_connection = use_ssl;
+    connect_info.path = api.c_str();
+    connect_info.host = address.c_str();
+    connect_info.origin = address.c_str();
+    connect_info.protocol = protocols[0].name;
+    connect_info.ietf_version_or_minus_one = ietf_version;
+    connect_info.userdata = NULL;
+    connect_info.client_exts = NULL;
+
+    // loop until socket closed
+    while (n >= 0 && !was_closed) {
+        n = lws_service(context, 500);
+        if (n < 0)
+            continue;
+        if (wsi_mirror)
+            continue;
+        if (was_closed)
+            goto bail;
+        MSF_DBG("Creating wsi_mirror [%s] [%d]\n", __FUNCTION__, __LINE__);
+        // wsi_mirror = lws_client_connect_via_info(context, address.c_str(),
+        // port, use_ssl,  api.c_str(),address.c_str(),address.c_str(),
+        // protocols[0].name, ietf_version);
+        wsi_mirror = lws_client_connect_via_info(&connect_info);
+        if (wsi_mirror == NULL) {
+            MSF_DBG("Fail to create was_mirror[%s] [%d]\n", __FUNCTION__,
+                    __LINE__);
+            dlog_print(DLOG_ERROR, "MSF", "create_websocket create wsi failed");
+            handleError(UID, Error::create("ConnectFailed"));
+            // ret = 1;
+            goto bail;
+        }
+    }
+//     return 0;
+bail:
+    dlog_print(DLOG_INFO, "MSF", "create_websocket destroy context");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    if (context)
+        lws_context_destroy(context);
+    context = NULL;
+    wsi_mirror = NULL;
+}
+
+string Channel::getipaddressfromUri(string uri) {
+    string startpt = "http://";
+    const char *src = strstr(uri.c_str(), startpt.c_str());
+    int startpoint = (src - uri.c_str()) + sizeof(startpt);
+
+    std::string endpt = ":8001";
+    const char *dest = strstr(src, endpt.c_str());
+    int endpoint = (dest - uri.c_str());
+    std::string address =
+        uri.substr((startpoint + sizeof(startpt) - 1),
+                   (endpoint - startpoint + 1 - sizeof(startpt)));
+    return address;
+}
+
+string Channel::getapifromUri(string uri) {
+    string startpt = "/api";
+    const char *api = strstr(uri.c_str(), startpt.c_str());
+    return api;
+}
+void Channel::setonConnectListener(OnConnectListener *obj) {
+    onConnectListener = obj;
+}
+
+void Channel::unsetonConnectListener() { onConnectListener = NULL; }
+
+void Channel::setonDisconnectListener(OnDisconnectListener *obj) {
+    onDisconnectListener = obj;
+}
+
+void Channel::unsetonDisconnectListener() { onDisconnectListener = NULL; }
+void Channel::setonClientConnectListener(OnClientConnectListener *obj) {
+    onClientConnectListener = obj;
+}
+
+void Channel::unsetonClientConnectListener() { onClientConnectListener = NULL; }
+
+/*
+   void Channel::setmessageListeners(list<OnMessageListener>
+   onMessageListenerlist){
+   std::list<OnMessageListener>::const_iterator iterator;
+   std::list<OnMessageListener>::const_iterator it;
+   for (iterator = onMessageListenerlist.begin(),it =onMessageListeners.begin();
+   iterator != onMessageListenerlist.end(); ++iterator,++it)
+   {
+   it=iterator;
+   }
+
+   }
+   }
+ */
+
+void Channel::addOnMessageListener(string event,
+                                   OnMessageListener *onMessageListener) {
+    if (event.length() == 0 || onMessageListener == NULL)
+        return;
+
+    if (messageListeners.find(event) == messageListeners.end()) {
+        messageListeners.insert({event, list<OnMessageListener *>()});
+    }
+
+    list<OnMessageListener *> &onMessageListeners =
+        (messageListeners.find(event))->second;
+
+    onMessageListeners.push_back(onMessageListener);
+}
+
+void Channel::addOnAllMessageListener(OnMessageListener *onMessageListener) {
+    everyMessageListener = onMessageListener;
+}
+
+void Channel::removeAllMessageListener() { everyMessageListener = NULL; }
+
+void Channel::removeOnMessageListeners(string event) {
+    if (event.length() == 0)
+        return;
+
+    if (messageListeners.find(event) == messageListeners.end()) {
+        return;
+    }
+
+    list<OnMessageListener *> &onMessageListeners =
+        (messageListeners.find(event))->second;
+    onMessageListeners.clear();
+}
+
+void Channel::removeOnMessageListener(string event,
+                                      OnMessageListener *onMessageListener) {
+    if ((event.length() == 0) || (onMessageListener != NULL))
+        return;
+
+    if (messageListeners.find(event) == messageListeners.end()) {
+        return;
+    }
+
+    list<OnMessageListener *> &onMessageListeners =
+        (messageListeners.find(event))->second;
+
+    if (onMessageListeners.size() != 0) {
+        onMessageListeners.remove(onMessageListener);
+    }
+}
+
+void Channel::removeOnMessageListeners() { messageListeners.clear(); }
+
+void Channel::removeAllListeners() {
+    setonConnectListener(NULL);
+    setonDisconnectListener(NULL);
+    setonClientConnectListener(NULL);
+    setonClientDisconnectListener(NULL);
+    setonReadyListener(NULL);
+    setonErrorListener(NULL);
+    removeOnMessageListeners();
+}
+
+void Channel::register_message_receive_cb(_message_receive_cb cb) {
+    message_receive_cb = cb;
+}
+
+void Channel::setonClientDisconnectListener(OnClientDisconnectListener *obj) {
+    onClientDisconnectListener = obj;
+}
+
+void Channel::unsetonClientDisconnectListener() {
+    onClientDisconnectListener = NULL;
+}
+
+void Channel::setonErrorListener(OnErrorListener *obj) {
+    onErrorListener = obj;
+}
+
+void Channel::unsetonErrorListener() { onErrorListener = NULL; }
+
+void Channel::setonReadyListener(OnReadyListener *obj) {
+    onReadyListener = obj;
+}
+
+void Channel::unsetonReadyListener() { onReadyListener = NULL; }
+
+void Channel::set_isWrite(bool flag) {}
+
+void ChannelConnectionHandler::resetLastPingReceived() {
+    this->lastPingReceived = time(0);
+}
+
+void ChannelConnectionHandler::calculateAverageRT() {
+    long lastRT = lastPingReceived - pingSent;
+    if (lastRT > longestRT) {
+        longestRT = lastRT;
+    }
+    // average=((numPings++ * average)+lastRT)/numPings; //will check ankit
+}
+
+void ChannelConnectionHandler::stopPing() {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    if (ping_thread != 0) {
+        MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
+                "file [%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        pthread_cancel(ping_thread);
+        MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
+                "file [%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        pthread_join(ping_thread, NULL);
+        MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
+                "file [%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        running = false;
+        ping_thread = 0;
+        printf("ping thread close");
+        fflush(stdout);
+    }
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+}
+
+void ChannelConnectionHandler::startPing(Channel *ptr) {
+    dlog_print(DLOG_INFO, "MSF", "## startPing ###");
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    if (running) {
+        dlog_print(DLOG_INFO, "MSF",
+                   "## startPing already running. return ###");
+        return;
+    }
+    stopPing();
+    if (pingTimeout <= 0) {
+        dlog_print(DLOG_INFO, "MSF", "## startPing ping timeout. return ###");
+        MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in "
+                "file [%s] \n",
+                __FUNCTION__, __LINE__, __FILE__);
+        return;
+    }
+    running = true;
+    numPings = 0;
+    average = 0;
+    longestRT = 0;
+    startTime = time(0);
+    pingSent = startTime;
+    channel_ptr = ptr;
+
+    int err = pthread_create(&ping_thread, NULL, Pinging, ptr);
+    if (err) {
+        dlog_print(DLOG_INFO, "MSF", "pthread_create failed err = %d", err);
+    }
+    // Need to check this
+    // Pinging(ptr);
+}
+
+void ChannelConnectionHandler::ping_again(void *arg) {
+    dlog_print(DLOG_INFO, "MSF", "## ping again ###");
+    Channel *ptr = static_cast<Channel *>(arg);
+    long now = time(0);
+
+    if (now > ptr->connectionHandler->lastPingReceived +
+                  ptr->connectionHandler->pingTimeout) {
+        dlog_print(DLOG_INFO, "MSF", "## Pinging timeout. disconnect ###");
+        ptr->disconnect();
+    } else {
+        ptr->publish("msfVersion2", "msfVersion2", ptr->clients->me());
+        sleep(1);
+        ptr->publish(PING, PONG.c_str(), ptr->clients->me());
+        ptr->connectionHandler->pingSent = time(0);
+    }
+}
+
+void *ChannelConnectionHandler::Pinging(void *arg) {
+    dlog_print(DLOG_INFO, "MSF", "## Pinging ###");
+
+    Channel *ptr = static_cast<Channel *>(arg);
+
+    while (1) {
+        ping_again(ptr);
+        dlog_print(DLOG_INFO, "MSF", "## pinging 1 ###");
+        // usleep(ptr->connectionHandler->pingTimeout);
+        sleep(5);
+    }
+}
+
+void ChannelConnectionHandler::setPingTimeout(long t) {
+    MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file "
+            "[%s] \n",
+            __FUNCTION__, __LINE__, __FILE__);
+    pingTimeout = t;
+}
+
+void Channel::set_connect_result(Result_Base *r) { connect_cb = r; }
+
+void Channel::unset_connect_result() { connect_cb = NULL; }
+
+void Channel::set_disconnect_result(Result_Base *r) { disconnect_cb = r; }
+
+void Channel::unset_disconnect_result() { disconnect_cb = NULL; }
diff --git a/msf_tizen_client/src/Client.cpp b/msf_tizen_client/src/Client.cpp
new file mode 100644 (file)
index 0000000..309ae01
--- /dev/null
@@ -0,0 +1,56 @@
+#include "Channel.h"
+#include"Client.h"
+
+string Client::ID_KEY              = "id";
+string  Client::IS_HOST_KEY         = "isHost";
+string  Client::CONNECT_TIME_KEY    = "connectTime";
+string  Client::ATTRIBUTES_KEY      = "attributes";
+
+Client::Client()
+{
+       id   = string();
+       host = false ;
+       connectTime = 0;
+}
+
+void Client::create(Client &client)
+{
+       id   = client.id;
+       host = client.host ;
+       connectTime = client.connectTime;
+}
+
+void Client::create(Channel *channel, string Id, long long ConnectTime,  /*map<string, string> data,*/ bool Host, map<string, string> attr)
+{
+       id = Id;
+       host = Host;
+       connectTime = ConnectTime;
+       attributes = attr;
+       m_channel = channel;
+       //return client;
+}
+
+bool Client::isHost()
+{
+       return host;
+}
+
+const char *Client::getId()
+{
+       return id.c_str();
+}
+
+long long Client::getConnectTime()
+{
+       return connectTime;
+}
+map<string, string> Client::getAttributesKey()
+{
+       return attributes;
+}
+
+Channel *Client::getChannel()
+{
+       return m_channel;
+}
+
diff --git a/msf_tizen_client/src/Clients.cpp b/msf_tizen_client/src/Clients.cpp
new file mode 100644 (file)
index 0000000..8327cb8
--- /dev/null
@@ -0,0 +1,110 @@
+#include"Clients.h"
+
+Clients::Clients()
+{
+       host = NULL;
+       m_channel = NULL;
+}
+
+Clients::Clients(Channel *channel)
+{
+       host = NULL;
+       m_channel = channel;
+}
+
+Client Clients::get(string clientId)
+{
+       Client cl = clients.find(clientId)->second;
+       return cl;
+}
+
+Client* Clients::getHost()
+{
+       if (host == NULL) {
+               std::vector<Client> clients;
+               for (std::vector<Client>::iterator it = clients.begin() ; it != clients.end(); ++it) {
+                       if ((*it).isHost()) {
+                               host = new Client();
+                               host->create(*it);
+                       }
+               }
+       }
+       return host;
+}
+
+Client Clients::me(void)
+{
+       if (myClientId != "") {
+               Client client = get(myClientId);
+               if ((&client != NULL) && !(client.getId() == varme.getId())) {
+                       varme = client;
+               }
+       }
+       return varme;
+}
+
+bool Clients::isMe(Client client)
+{
+       return (client.getId()== myClientId);
+}
+
+/*int Clients::ssize()
+  {
+  return sizeof(clients);
+  }*/
+
+list<Client> Clients::lists()
+{
+   list<Client> client_list;
+   std::map<string, Client>::iterator clients_itr;
+
+   for (clients_itr = clients.begin(); clients_itr != clients.end(); clients_itr++) {
+          client_list.push_back(clients_itr->second);
+   }
+
+   return client_list;
+}
+
+void Clients::setMyClientId(string clientId)
+{
+       myClientId = clientId;
+       Client client = get(myClientId);
+       varme = client;
+}
+
+void Clients::reset()
+{
+       clients.clear();
+       if (host != NULL)
+               delete host;
+       host = NULL;
+       myClientId = "";
+}
+
+void Clients::add(list <Client> clientList)
+{
+       std::list<Client>::const_iterator iterator;
+       for (iterator = clientList.begin(); iterator != clientList.end(); ++iterator) {
+               add(*iterator);
+       }
+}
+
+void Clients::add(Client client)
+{
+       clients.insert({string(client.getId()), client});
+}
+
+int Clients::size()
+{
+       return clients.size();
+}
+
+void Clients::remove(Client client)
+{
+       clients.erase(client.getId());
+}
+
+Channel* Clients::getChannel()
+{
+       return m_channel;
+}
diff --git a/msf_tizen_client/src/Device.cpp b/msf_tizen_client/src/Device.cpp
new file mode 100644 (file)
index 0000000..c0673ca
--- /dev/null
@@ -0,0 +1,143 @@
+#include "Device.h"
+
+string Device::DUID_KEY                = "duid";
+string Device::MODEL_KEY               = "model";
+string Device::MODELNAME_KEY           = "modelName";
+string Device::DESCRIPTION_KEY         = "description";
+string Device::NETWORK_TYPE_KEY        = "networkType";
+string Device::SSID_KEY                = "ssid";
+string Device::IP_KEY                  = "ip";
+string Device::FIRMWARE_VERSION_KEY    = "firmwareVersion";
+string Device::NAME_KEY                = "name";
+string Device::ID_KEY                  = "id";
+string Device::UDN_KEY                 = "udn";
+string Device::RESOLUTION_KEY          = "resolution";
+string Device::COUNTRY_CODE_KEY        = "countryCode";
+string Device::TYPE                                            = "type";
+string Device::MSF_VERSION                             = "msfVersion";
+string Device::SMARTHUB_AGREEMENT              = "smartHubAgreement";
+string Device::WIFIMAC                                 = "wifiMac";
+string Device::DEVELOPER_MODE                  = "developerMode";
+string Device::DEVELOPER_IP                            = "developerIP";
+string Device::OS                                              = "OS";
+
+void Device::foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data)
+{
+       Device *p = static_cast<Device*>(user_data);
+
+       if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+               if (!strncmp(key , Device::DUID_KEY.c_str(), 4)) {
+                       p->duid = json_node_get_string(node);
+               } else if (!strncmp(key, Device::MODELNAME_KEY.c_str(), 9)) {
+               } else if (!strncmp(key, Device::MODEL_KEY.c_str(), 5)) {
+                       p->model = json_node_get_string(node);
+               } else if (!strncmp(key, Device::DESCRIPTION_KEY.c_str(), 11)) {
+                       p->description = json_node_get_string(node);
+               } else if (!strncmp(key, Device::NETWORK_TYPE_KEY.c_str(), 11)) {
+                       p->networkType = json_node_get_string(node);
+               } else if (!strncmp(key, Device::SSID_KEY.c_str(), 4)) {
+                       p->ssid = json_node_get_string(node);
+               } else if (!strncmp(key, Device::IP_KEY.c_str(), 2)) {
+                       p->ip = json_node_get_string(node);
+               } else if (!strncmp(key, Device::FIRMWARE_VERSION_KEY.c_str(), 15)) {
+                       p->firmwareVersion = json_node_get_string(node);
+               } else if (!strncmp(key, Device::NAME_KEY.c_str(), 4)) {
+                       p->name = json_node_get_string(node);
+               } else if (!strncmp(key, Device::ID_KEY.c_str(), 2)) {
+                       p->id = json_node_get_string(node);
+               } else if (!strncmp(key, Device::UDN_KEY.c_str(), 3)) {
+                       p->udn = json_node_get_string(node);
+               } else if (!strncmp(key, Device::RESOLUTION_KEY.c_str(), 9)) {
+                       p->resolution = json_node_get_string(node);
+               } else if (!strncmp(key, Device::COUNTRY_CODE_KEY.c_str(), 11)) {
+                       p->countryCode = json_node_get_string(node);
+               } else if (!strncmp(key, "running", 7)) {
+                       //running = json_object_get_boolean(val);
+               }
+       } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+               json_object_foreach_member(json_node_get_object(node), foreach_json_object, user_data);
+       }
+}
+
+
+void Device::json_parse(JsonNode *node)
+{
+       if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+               json_object_foreach_member(json_node_get_object(node), foreach_json_object, this);
+       }
+}
+
+Device::Device()
+{
+}
+
+Device::Device(JsonNode *node)
+{
+       json_parse(node);
+}
+
+string Device::getduid()
+{
+       return duid ;
+}
+
+string Device:: getmodel()
+{
+       return model;
+}
+
+string Device::getdescription()
+{
+       return description;
+}
+
+string Device::getnetworkType()
+{
+       return networkType;
+}
+
+string Device::getssid()
+{
+       return  ssid;
+}
+
+string Device::getip()
+{
+       return ip;
+}
+
+string Device::getfirmwareVersion()
+{
+       return firmwareVersion;
+}
+
+string Device::getudn()
+{
+       return udn;
+}
+
+string Device::getresolution()
+{
+       return resolution;
+}
+
+string Device::getcountryCode()
+{
+       return countryCode;
+}
+
+string Device::getname()
+{
+       return name;
+}
+
+string Device::getid()
+{
+       return id;
+}
+
+Device Device::create(JsonNode *node)
+{
+       Device device =  Device(node);
+       return device;
+}
diff --git a/msf_tizen_client/src/Error.cpp b/msf_tizen_client/src/Error.cpp
new file mode 100644 (file)
index 0000000..65584d4
--- /dev/null
@@ -0,0 +1,31 @@
+#include"Error.h"
+
+Error::Error()
+{
+}
+
+Error::Error(long code, string name, string message)
+{
+       this->code = code;
+       this->name = name;
+       this->message = message;
+}
+
+Error Error::create(string message)
+{
+       return create(-1, "error", message);
+}
+
+Error Error::create(long code, string name, string message)
+{
+       if ((name == "") || (message == "")) {
+               name = "error";
+       }
+
+       Error *error = new Error(code, name, message);
+       return *error;
+}
+const char *Error::get_error_message()
+{
+       return message.c_str();
+}
diff --git a/msf_tizen_client/src/MSFDSearchProvider.cpp b/msf_tizen_client/src/MSFDSearchProvider.cpp
new file mode 100644 (file)
index 0000000..2f76c0a
--- /dev/null
@@ -0,0 +1,301 @@
+#include <ctime>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include "MSFDSearchProvider.h"
+#include "Service.h"
+#include "Debug.h"
+#include "Error.h"
+#include "Result.h"
+#define MSGBUFSIZE 1000
+#define MULTICAST_PORT 8001
+#define MULTICAST_GROUP "224.0.0.7"
+
+string MSFDSearchProvider::KEY_TYPE_STATE = "type";
+string MSFDSearchProvider::KEY_TTL = "ttl";
+string MSFDSearchProvider::KEY_SID = "sid";
+string MSFDSearchProvider::KEY_DATA = "data";
+string MSFDSearchProvider::KEY_VERSION_1 = "v1";
+string MSFDSearchProvider::KEY_VERSION_2 = "v2";
+string MSFDSearchProvider::KEY_URI = "uri";
+string MSFDSearchProvider::TYPE_DISCOVER = "discover";
+string MSFDSearchProvider::STATE_UP = "up";
+string MSFDSearchProvider::STATE_DOWN = "down";
+string MSFDSearchProvider::STATE_ALIVE = "alive";
+int MSFDSearchProvider::SERVICE_CHECK_TIMEOUT = 5000;
+
+int MSFDSearchProvider::flag = 0;
+
+MSFDSearchProvider::MSFDSearchProvider()
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       SearchProvider();
+}
+
+MSFDSearchProvider::MSFDSearchProvider(Search *sListener):SearchProvider(sListener)
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+}
+
+SearchProvider MSFDSearchProvider::create()
+{
+       return (SearchProvider)MSFDSearchProvider();
+}
+
+SearchProvider MSFDSearchProvider::create(Search *searchListener)
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       return (SearchProvider)MSFDSearchProvider(searchListener);
+}
+
+void MSFDSearchProvider::start()
+{
+       dlog_print(DLOG_INFO, "MSF", "MSFD start()");
+       if (searching) {
+               stop();
+       }
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       clearServices();
+
+       aliveMap.clear();
+       receive = false;
+       createMSFD();
+}
+
+void MSFDSearchProvider::createMSFD()
+{
+       struct sockaddr_in addr;
+       struct sockaddr_in msf_server_addr;
+       int  nbytes;
+       unsigned int addrlen;
+       struct ip_mreq mreq;
+       char msgbuf[MSGBUFSIZE];
+       fd = 0;
+       u_int yes = 1;          /*** MODIFICATION TO ORIGINAL */
+
+       /* create what looks like an ordinary UDP socket */
+       if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+               perror("socket");
+               dlog_print(DLOG_ERROR, "MSF", "MSFD socket faile");
+       }
+
+       /**** MODIFICATION TO ORIGINAL */
+       /* allow multiple sockets to use the same PORT number */
+       if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
+               perror("Reusing ADDR failed");
+               dlog_print(DLOG_ERROR, "MSF", "MSFD reusing ADDR failed");
+       }
+       /*** END OF MODIFICATION TO ORIGINAL */
+
+       /* set up destination address */
+       memset(&addr, 0, sizeof(addr));
+       addr.sin_family = AF_INET;
+       addr.sin_addr.s_addr = htonl(INADDR_ANY); /* N.B.: differs from sender */
+       addr.sin_port = htons(MULTICAST_PORT);
+
+       dlog_print(DLOG_INFO, "MSF", "MSFD try bind socket");
+       /* bind to receive address */
+       if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+               perror("bind");
+               dlog_print(DLOG_ERROR, "MSF", "MSFD bind failed");
+       }
+       dlog_print(DLOG_INFO, "MSF", "MSFD try bind socket success");
+
+       /* use setsockopt() to request that the kernel join a multicast group */
+       mreq.imr_multiaddr.s_addr = inet_addr(MULTICAST_GROUP);
+       mreq.imr_interface.s_addr = htonl(INADDR_ANY);
+       if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
+               perror("setsockopt");
+               dlog_print(DLOG_ERROR, "MSF", "MSFD setsockopt failed");
+       }
+
+       while (1) {
+               addrlen = sizeof(msf_server_addr);
+               struct timeval tv;
+               tv.tv_sec = 0;
+               tv.tv_usec = 900000;
+
+               if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
+                       perror("setsockopt");
+                       dlog_print(DLOG_ERROR, "MSF", "MSFD setsockopt(SOL_SOCKET) failed");
+               }
+
+                       dlog_print(DLOG_INFO, "MSF", "MSFD waiting packet");
+               if ((nbytes = recvfrom(fd, msgbuf, MSGBUFSIZE, 0, (struct sockaddr *) &msf_server_addr, &addrlen)) < 0) {
+                       //dlog_print(DLOG_INFO, "MSF", "MSFD packet < 0");
+                       receive = false;
+                       dlog_print(DLOG_INFO, "MSF", "MSFD packet < 0 1");
+                       reapServices();
+                       dlog_print(DLOG_INFO, "MSF", "MSFD packet < 0 2");
+               } else {
+                       msgbuf[nbytes] = '\0';
+                       dlog_print(DLOG_INFO, "MSF", "MSFD waiting packet = %s", msgbuf);
+                       receive = true;
+                       processReceivedMsg(msgbuf, nbytes);
+               }
+       }
+}
+
+void MSFDSearchProvider::reapServices()
+{
+       dlog_print(DLOG_ERROR, "MSF", "MSFD reapServices");
+       long now = time(0);
+       map<string, long>::iterator it;
+       for(it = aliveMap.begin(); it != aliveMap.end(); ++it) {
+               long expires = it->second;
+               if (expires < now) {
+                       dlog_print(DLOG_ERROR, "MSF", "MSFD reapServices remove service");
+                       Service service = getServiceById(it->first);
+                       aliveMap.erase(it->first);
+                       removeServiceAndNotify(service);
+               }
+       }
+}
+
+void MSFDSearchProvider::updateAlive(string id, long ttl)
+{
+       long now = time(0);
+       ttl = ttl/1000;
+       long expires = now+ttl;
+       aliveMap[id] = expires;
+}
+
+void MSFDSearchProvider::processReceivedMsg(char *buf, int buflen)
+{
+       dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg start");
+       if (buf != NULL) {
+       }
+
+       while(receive) {
+       dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg 1");
+               reapServices();
+       dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg 2");
+               string data;
+               data.append(buf, buflen);
+               json_parse(data.c_str());
+
+               dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg after parse");
+
+               if (state == TYPE_DISCOVER) {
+                       dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg state = discover");
+                       continue;
+               }
+
+               if (id.length() > 0) {
+                       dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg id length > 0");
+                       Service serv =  getServiceById(id);
+                       Service *serv1 = &serv;
+
+                       if (serv.getId() != "") {
+                               receive = false;
+                       }
+
+                       if (state == STATE_ALIVE || state == STATE_UP) {
+                               map<string, long>::iterator i = aliveMap.find(id);
+                               if (((serv.getId()).length() == 0)) {//&&(i==aliveMap.end()))
+                                       updateAlive(id, ttl);
+                                       static map<string, long>* tempaliveMap = &aliveMap;
+                                       static MSFDSearchProvider *MSFDSearchProvider_pointer = this;
+                                       static string tempid = id;
+                                       static long tempttl = ttl;
+
+                                       class ResultMSFDServiceCallback : public Result_Base
+                                       {
+                                               public:
+                                                       void onSuccess(Service abc)
+                                                       {
+                                                               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                                                               MSFDSearchProvider_pointer->updateAlive(tempid, tempttl);
+                                                               //(*tempaliveMap)[tempid]=tempttl;
+                                                               MSFDSearchProvider_pointer->addService(abc);
+                                                       }
+
+                                                       void onError(Error)
+                                                       {
+                                                               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                                                               tempaliveMap->erase(tempid);
+                                                               //aliveMap.erase(id);
+                                                       }
+                                       };
+                                       Result_Base *rService = NULL;
+                                       ResultMSFDServiceCallback *r1Service = new ResultMSFDServiceCallback();
+                                       rService = r1Service;
+                                       Service::getByURI(url, SERVICE_CHECK_TIMEOUT, rService);
+
+                                       // ........ critical bug
+                                       //delete r1Service;
+                                       //r1Service = rService = NULL;
+                               } else {
+                                       updateAlive(id, ttl);
+                               }
+                       } else if ((serv1->getId() != "") && (state == STATE_DOWN)) {
+                               aliveMap.erase(id);
+                               removeServiceAndNotify(serv);
+                       }
+               } else {
+                       receive = false;
+               }
+       }
+       dlog_print(DLOG_INFO, "MSF", "MSFD processReceivedMsg end");
+}
+
+void MSFDSearchProvider::foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data)
+{
+       MSFDSearchProvider *p = static_cast<MSFDSearchProvider*>(user_data);
+
+       if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+               if (!strncmp(key , MSFDSearchProvider::KEY_TTL.c_str(), 2)) {
+                       p->ttl = json_node_get_int(node);
+                       dlog_print(DLOG_INFO, "MSF", "MSFD ttl = %d", p->ttl);
+               } else if (!strncmp(key , MSFDSearchProvider::KEY_TYPE_STATE.c_str(), 2)) {
+                       p->state = json_node_get_string(node);
+                       dlog_print(DLOG_INFO, "MSF", "MSFD state = %s", p->state.c_str());
+               } else if (!strncmp(key, MSFDSearchProvider::KEY_SID.c_str(), 4)) {
+                       p->id = json_node_get_string(node);
+                       dlog_print(DLOG_INFO, "MSF", "MSFD id = %s", p->id.c_str());
+               } else if (!strncmp(key, MSFDSearchProvider::KEY_URI.c_str(), 7)) {
+                       if (flag == 1) {
+                               p->url = json_node_get_string(node);
+                               dlog_print(DLOG_INFO, "MSF", "MSFD url = %s", p->url.c_str());
+                               flag = 0;
+                       }
+               }
+
+       } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+               if (!strncmp(key , KEY_VERSION_2.c_str(), 7)) {
+                       flag = 1;
+               }
+               json_object_foreach_member(json_node_get_object(node), foreach_json_object, user_data);
+       }
+}
+
+void MSFDSearchProvider::json_parse(const char *in)
+{
+       JsonParser *parser = json_parser_new();
+
+       if (json_parser_load_from_data(parser, in, -1, NULL)) {
+               JsonNode *node = json_parser_get_root(parser);
+
+               if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+                       json_object_foreach_member(json_node_get_object(node), foreach_json_object, this);
+               }
+
+       } else {
+               dlog_print(DLOG_ERROR, "MSF", "json_parsing error");
+       }
+}
+
+bool MSFDSearchProvider::stop()
+{
+       dlog_print(DLOG_INFO, "MSF", "MSFD stop()");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       //if (!searching) {
+       //      return false;
+       //}
+       receive = false;
+       close(fd);
+       return true;
+}
+
diff --git a/msf_tizen_client/src/Message.cpp b/msf_tizen_client/src/Message.cpp
new file mode 100644 (file)
index 0000000..21b988d
--- /dev/null
@@ -0,0 +1,73 @@
+#include <dlog.h>
+#include"Message.h"
+
+string Message::TARGET_BROADCAST             = "broadcast";
+string Message::TARGET_ALL                   = "all";
+string Message::TARGET_HOST                  = "host";
+
+string Message::METHOD_APPLICATION_GET        = "ms.application.get";
+string Message::METHOD_APPLICATION_START      = "ms.application.start";
+string Message::METHOD_APPLICATION_STOP       = "ms.application.stop";
+string Message::METHOD_APPLICATION_INSTALL    = "ms.application.install";
+string Message::METHOD_WEB_APPLICATION_GET    = "ms.webapplication.get";
+string Message::METHOD_WEB_APPLICATION_START  = "ms.webapplication.start";
+string Message::METHOD_WEB_APPLICATION_STOP   = "ms.webapplication.stop";
+string Message::METHOD_EMIT                  = "ms.channel.emit";
+
+string Message::PROPERTY_MESSAGE             = "message";
+string Message::PROPERTY_METHOD              = "method";
+string Message::PROPERTY_MESSAGE_ID          = "id";
+string Message::PROPERTY_PARAMS              = "params";
+string Message::PROPERTY_ID                  = "id";
+string Message::PROPERTY_URL                 = "url";
+string Message::PROPERTY_ARGS                = "args";
+string Message::PROPERTY_EVENT               = "event";
+string Message::PROPERTY_DATA                = "data";
+string Message::PROPERTY_TO                  = "to";
+string Message::PROPERTY_FROM                = "from";
+string Message::PROPERTY_CLIENTS             = "clients";
+string Message::PROPERTY_RESULT              = "result";
+string Message::PROPERTY_ERROR               = "error";
+
+Message::Message(Channel *ch, string event, string data, string from, unsigned char *payload, int payload_size)
+{
+       m_channel = ch;
+       m_event = event;
+       m_data = data;
+       m_from = from;
+       m_payload_size = payload_size;
+
+       m_payload = new unsigned char[payload_size+1];
+
+       for (int i = 0; i < payload_size; i++) {
+               m_payload[i] = payload[i];
+       }
+
+       m_payload[payload_size] = 0;
+
+       dlog_print(DLOG_INFO, "MSF", "Message Test 1");
+}
+
+Message::Message()
+{
+}
+
+Message::~Message()
+{
+       delete m_payload;
+}
+
+Message::Message(const Message& m)
+{
+       m_channel = m.m_channel;
+       m_event = m.m_event;
+       m_data = m.m_data;
+       m_from = m.m_from;
+       m_payload_size = m.m_payload_size;
+
+       m_payload = new unsigned char[m_payload_size+1];
+
+       for (int i = 0; i < m_payload_size; i++) {
+               m_payload[i] = m.m_payload[i];
+       }
+}
diff --git a/msf_tizen_client/src/Result.cpp b/msf_tizen_client/src/Result.cpp
new file mode 100644 (file)
index 0000000..3b5db95
--- /dev/null
@@ -0,0 +1,84 @@
+#include "Result.h"
+#include "ApplicationInfo.h"
+#include "Service.h"
+#include "Client.h"
+#include "Device.h"
+#include "Error.h"
+
+Result_Base::Result_Base()
+{
+}
+
+Result_Base::Result_Base(void *user_cb, void *data, result_base_e subject)
+{
+       appinfo_result_cb = NULL;
+       client_result_cb = NULL;
+       device_result_cb = NULL;
+       bool_result_cb = NULL;
+       service_result_cb = NULL;
+       error_result_cb = NULL;
+
+       switch (subject) {
+               case RESULT_BASE_APP_INFO:
+                       appinfo_result_cb = reinterpret_cast<_appinfo_result_cb>(user_cb);
+                       break;
+               case RESULT_BASE_CLIENT:
+                       client_result_cb = reinterpret_cast<_client_result_cb>(user_cb);
+                       break;
+               case RESULT_BASE_DEVICE:
+                       device_result_cb = reinterpret_cast<_device_result_cb>(user_cb);
+                       break;
+               case RESULT_BASE_BOOL:
+                       bool_result_cb = reinterpret_cast<_bool_result_cb>(user_cb);
+                       break;
+               case RESULT_BASE_SERVICE:
+                       service_result_cb = reinterpret_cast<_service_result_cb>(user_cb);
+                       break;
+               case RESULT_BASE_ERROR:
+                       error_result_cb = reinterpret_cast<_error_result_cb>(user_cb);
+                       break;
+       }
+
+       user_data = data;
+}
+
+Result_Base::~Result_Base()
+{
+}
+
+
+void Result_Base::onSuccess(ApplicationInfo arg)
+{
+       if (appinfo_result_cb)
+               appinfo_result_cb(arg, user_data);
+}
+
+void Result_Base::onSuccess(Client arg)
+{
+       if (client_result_cb)
+       client_result_cb(arg, user_data);
+}
+
+void Result_Base::onSuccess(Device arg)
+{
+       if (device_result_cb)
+       device_result_cb(arg, user_data);
+}
+
+void Result_Base::onSuccess(bool arg)
+{
+       if (bool_result_cb)
+       bool_result_cb(arg, user_data);
+}
+
+void Result_Base::onSuccess(Service arg)
+{
+       if (service_result_cb)
+       service_result_cb(arg, user_data);
+}
+
+void Result_Base::onError(Error er)
+{
+       if (error_result_cb)
+               error_result_cb(er, user_data);
+}
diff --git a/msf_tizen_client/src/Search.cpp b/msf_tizen_client/src/Search.cpp
new file mode 100644 (file)
index 0000000..72a9de2
--- /dev/null
@@ -0,0 +1,510 @@
+#include "Search.h"
+#include "Error.h"
+#include "Service.h"
+#include "Debug.h"
+#include "mDNSSearchProvider.h"
+#include "MSFDSearchProvider.h"
+#include "Result.h"
+
+int Search::SERVICE_CHECK_TIMEOUT = 5000;
+bool Search::clearProviders;
+pthread_t Search::threads[NUM_OF_THREADS];
+mDNSSearchProvider Search::provider1;
+MSFDSearchProvider Search::provider2;
+Search *Search::instance = NULL;
+bool Search::starting = false;
+bool Search::stopping = false;
+int Search::search_ref_count = 0;
+list<Search*> Search::search_list;
+list<Service> Search::services;
+int Search::onStartNotified;
+
+int Search::numRunning;
+
+/*
+   if (--onStartNotified==0)
+   {
+   if (onStartListener!=NULL)
+   onStartListener->onStart();
+   }*/
+
+void Search::onStart()
+{
+       st_onStart();
+}
+
+void Search::onStop()
+{
+       st_onStop();
+}
+
+void Search::onFound(Service service)
+{
+       st_onFound(service);
+}
+
+void Search::onLost(Service service)
+{
+       st_onLost(service);
+}
+
+void  Search :: st_onStart()
+{
+       dlog_print(DLOG_INFO, "MSF", "Search::onStart()");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+       // ....... ==0 ??
+       if (onStartNotified > 0) {
+               onStartNotified = 0;
+               starting = false; //not sure why ankit
+               list<Search*>::iterator itr;
+               for (itr = search_list.begin(); itr != search_list.end(); itr++) {
+                       if ((*itr)->searchListener != NULL &&  (*itr)->searching_now) {
+                               dlog_print(DLOG_INFO, "MSF", "call onStart");
+                               (*itr)->searchListener->onStart();
+                       }
+               }
+       }
+}
+
+void  Search::st_onStop()
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       list<Search*>::iterator itr;
+       for (itr = search_list.begin(); itr != search_list.end(); itr++) {
+               if ((*itr)->searchListener != NULL && (*itr)->searching_now) {
+                       (*itr)->searchListener->onStop();
+               }
+       }
+}
+
+void  Search::st_onFound(Service service)
+{
+       dlog_print(DLOG_INFO, "MSF", "Search::onFound()");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+       addService(service);
+
+       list<Search*>::iterator itr;
+
+       dlog_print(DLOG_INFO, "MSF", "Search::onFound() list size = %d", search_list.size());
+
+       for (itr = search_list.begin(); itr != search_list.end(); itr++) {
+               if ((*itr)->searchListener != NULL && (*itr)->searching_now) {
+                       (*itr)->searchListener->onFound(service);
+               }
+       }
+}
+
+void  Search::st_onLost(Service service)
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       //validateService(service);
+
+       list<Search*>::iterator itr;
+
+       for (itr = search_list.begin(); itr != search_list.end(); itr++) {
+               if ((*itr)->searchListener != NULL && (*itr)->searching_now) {
+                       (*itr)->searchListener->onLost(service);
+               }
+       }
+}
+
+void  SearchListener :: onStart()
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+}
+
+void  SearchListener :: onStop()
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+}
+
+void  SearchListener :: onFound(Service service)
+{
+       //addService(service);
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+}
+
+void SearchListener :: onLost(Service service)
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+}
+
+/*void Search::setOnStartListener(OnStartListener *obj){
+  cout<<obj;
+  onstartlistener=obj;
+  }
+
+  void Search::setOnStopListener(OnStopListener obj){
+  onstoplistener=obj;
+  }
+
+  void Search::setOnServiceFoundListener(OnServiceFoundListener obj){
+  onservicefoundlistener=obj;
+  }
+
+  void Search::setOnServiceLostListener(OnServiceLostListener obj){
+  onservicelostlistener=obj;
+  }*/
+
+/*
+Search *Search::getInstance()
+{
+       if (instance == NULL)
+               instance = new Search();
+
+       return instance;
+}
+*/
+
+Search::Search()
+{
+       searching_now = false;
+       searchListener = NULL;
+
+       search_list.push_back(this);
+       printf("Search::Search()\n");
+       fflush(stdout);
+}
+
+Search::~Search()
+{
+       search_list.remove(this);
+       printf("Search::~Search()\n");
+       fflush(stdout);
+
+       if (instance) {
+               //delete instance;
+               //instance = NULL;
+       }
+
+       if (searchListener) {
+               //delete searchListener;
+               //searchListener = NULL;
+       }
+}
+
+void Search::setSearchListener(SearchListener *obj)
+{
+       dlog_print(DLOG_INFO, "MSF", "setSearchListener");
+       searchListener = obj;
+}
+
+void Search::releaseSearchListener()
+{
+       if (searchListener) {
+               searchListener = NULL;
+       }
+}
+
+/*
+bool Search::isSearching()
+{
+       std::list<SearchProvider>::iterator iterator;
+       for (iterator = providers.begin(); iterator != providers.end(); ++iterator) {
+               if (iterator->isSearching()) {
+                       return true;
+               }
+       }
+       return starting||stopping;
+}
+*/
+
+Service Search::getServiceById(string id)
+{
+       std::list<Service>::iterator iterator;
+       for (iterator = services.begin(); iterator != services.end(); ++iterator) {
+               if ((iterator->getId()) == id) {
+                       return(*iterator);
+               }
+       }
+       return Service("", "", "", "", "");
+}
+
+bool Search::start()
+{
+       if (searching_now == false) {
+               if (search_ref_count == 0) {
+                       search_ref_count++;
+
+                       searching_now = true;
+
+                       dlog_print(DLOG_INFO, "MSF", "Search::start()");
+
+                       //if (isSearching()) {
+                       //      return false;
+                       //}
+
+                       startDiscovery();
+               } else {
+                       search_ref_count++;
+
+                       searching_now = true;
+
+                       if (searchListener != NULL) {
+                               dlog_print(DLOG_INFO, "MSF", "call onStart");
+                               searchListener->onStart();
+                       }
+               }
+       }
+
+       return true;
+}
+
+bool Search::stop()
+{
+       if (searching_now == true) {
+               search_ref_count--;
+               searching_now = false;
+
+               if (search_ref_count == 0) {
+                       dlog_print(DLOG_INFO, "MSF", "search stop 1");
+                       stopDiscovery();
+               } else {
+                       if (searchListener != NULL)
+                               searchListener->onStop();
+               }
+       }
+
+       return true;
+}
+
+list<Service> Search::getServices()
+{
+       return SearchProvider::getServices();
+}
+
+void Search::addProvider(SearchProvider provider)
+{
+       providers.push_back(provider);
+       provider.setSearchListener(this);
+}
+
+/*
+bool Search::removeProvider(SearchProvider provider)
+{
+       if (!provider.isSearching())
+               return remove(&providers,provider);
+       else
+               removedProviders.push_back(provider);
+       return false;
+}
+*/
+
+bool Search::isEqualto(SearchProvider s1, SearchProvider s2)
+{
+       list<Service> services1 = s1.getServices();
+       list<Service> services2 = s1.getServices();
+       int len1 = services1.size();
+       int len2 = services2.size();
+       if (len1 == len2)
+               return false;
+
+       std::list<Service>::iterator iter1;
+       std::list<Service>::iterator iter2;
+       for(iter1 = services1.begin(); iter1 != services1.end(); ++iter1) {
+               if (services2.size() != 0) {
+                       iter2 = services2.begin();
+                       while(iter2 != services2.end()) {
+                               if (((*iter2).getId()) == ((*iter1).getId())) {
+                                       services2.erase(iter2++);
+                                       break;
+                               } else {
+                                       iter2++;
+                               }
+                       }
+               }
+       }
+       if (services2.size() == 0)
+               return true;
+       else
+               return false;
+}
+
+bool Search::remove(list<SearchProvider> *providers, SearchProvider provider)
+{
+       std::list<SearchProvider>::iterator it = providers->begin();
+       while(it != providers->end()) {
+               bool match = isEqualto(*it, provider);
+               if (match) {
+                       providers->erase(it);
+                       return true;
+               }
+       }
+       return false;
+}
+
+/*
+void Search::processRemovedProviders()
+{
+       if (removedProviders.size()) {
+               std::list<SearchProvider>::iterator iter;
+               for(iter = removedProviders.begin(); iter != removedProviders.end(); ++iter) {
+                       if ((!((*iter).isSearching())) &&(remove(&providers,*iter)))
+                               remove(&removedProviders,*iter);
+               }
+       }
+}
+
+void Search::removeAllProviders()
+{
+       clearProviders = false;
+       if (!isSearching()) {
+               providers.clear();
+       }
+       else {
+               clearProviders = true;
+       }
+}
+*/
+
+void *Search::pt_startMDNS(void *arg)
+{
+       //provider1.start();
+       return NULL;
+}
+
+void *Search::pt_startMSFD(void *arg)
+{
+       provider2.start();
+       return NULL;
+}
+
+void Search::startDiscovery()
+{
+       dlog_print(DLOG_INFO, "MSF", "Search::startDiscovery()");
+       starting = true;
+       // If there are no search providers, then default to using MDNS.
+       if (providers.empty()) {
+               //providers.push_back(MDNSSearchProvider::create(this)); //CODE NEED TO REMOVE
+               providers.push_back(MSFDSearchProvider::create(this));
+       }
+
+       services.clear();
+
+       onStartNotified = numRunning = providers.size();
+
+       int ret = -1;
+
+       dlog_print(DLOG_INFO, "MSF", "try MDNS thread creat");
+       provider1.start();
+//     ret = pthread_create(&threads[MDNS_THREAD_NUMBER],NULL,pt_startMDNS,NULL);
+       dlog_print(DLOG_INFO, "MSF", "MDNS thread created");
+
+       if (ret == -1)
+               cout << "Fail to create MDNS search provider\n";
+
+       dlog_print(DLOG_INFO, "MSF", "try MSFD thread creat");
+       ret = pthread_create(&threads[MSFD_THREAD_NUMBER], NULL, pt_startMSFD, NULL);
+       dlog_print(DLOG_INFO, "MSF", "MSFD thread created");
+
+       if (ret == -1)
+               cout << "Fail to create MDNS search provider\n";
+
+       onStart();
+}
+
+void Search::stopDiscovery()
+{
+       MSF_DBG("\n[MSF API:]Function Name[%s] got called\n", __FUNCTION__);
+       stopping = true;
+       bool stop = false;
+       stop = provider1.stop();
+       stop = provider2.stop();
+
+       if (stop)
+               onStop();
+
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+       pthread_cancel(threads[1]);
+       pthread_join(threads[1], NULL);
+
+       dlog_print(DLOG_INFO, "MSF", "MDNS MSFD thread joined");
+       dlog_print(DLOG_INFO, "MSF", "Search::stop discovery end");
+}
+
+bool Search::addService(Service service)
+{
+       dlog_print(DLOG_INFO, "MSF", "Search::addService()");
+       bool match = false;
+       for (std::list<Service>::iterator it = services.begin(); it != services.end(); it++) {
+               if ((*it).getId() == service.getId()) {
+                       match = true;
+                       break;
+               }
+       }
+       if (!match)
+               services.push_back(service);
+       return true;
+}
+
+bool Search::removeService(Service service)
+{
+       for (std::list<Service>::iterator it = services.begin(); it != services.end(); it++) {
+               if ((*it).getId() == service.getId()) {
+                       services.erase(it);
+                       break;
+               }
+       }
+       return true;
+}
+
+void Search::removeAndNotify(Service service)
+{
+       if (removeService(service)) {
+               //              if (onServiceLostListener != NULL) {
+               //              searchListener->onLost(service);
+               //              }
+       }
+}
+
+void Search::validateService(Service service)
+{
+       /*
+       class ResultSearchServiceCallback : public Result_Base
+       {
+               public:
+                       void onSuccess(Service abc)
+                       {
+                               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                       }       
+
+                       void onError(Error)
+                       {
+                               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+                       }
+       };
+
+       Result_Base *rService;
+
+       ResultSearchServiceCallback *r1Service = new ResultSearchServiceCallback();
+
+       rService = r1Service;
+
+       Service::getByURI(service.getUri(), SERVICE_CHECK_TIMEOUT, rService);
+       delete r1Service;
+       rService = r1Service = NULL;
+       */
+       /*
+          @Override
+          public void onSuccess(Service result) {
+       // We can contact the service, so keep it in the master 
+       // list.
+       }
+
+       @Override
+       public void onError(Error error) {
+
+       // If we cannot validate the existence of the service, 
+       // then we will remove it from the master list.
+       removeAndNotify(service);
+
+       for (SearchProvider provider:providers) {
+       provider.removeService(service);
+       }
+       }
+       });*/
+}
+
diff --git a/msf_tizen_client/src/SearchProvider.cpp b/msf_tizen_client/src/SearchProvider.cpp
new file mode 100644 (file)
index 0000000..4410dbd
--- /dev/null
@@ -0,0 +1,116 @@
+#include"Service.h"
+#include "Search.h"
+#include"SearchProvider.h"
+#include "Debug.h"
+
+list<Service> SearchProvider::services;
+
+SearchProvider::SearchProvider()
+{
+       searching = false;
+}
+
+SearchProvider::SearchProvider(Search *searchListen)
+{
+       searchListener = searchListen;
+       searching = false;
+}
+
+list<Service> SearchProvider::getServices()
+{
+       return services;
+}
+
+void SearchProvider::setServices(list<Service> listofservices)
+{
+       clearServices();
+       if (listofservices.size() != 0) {
+               std::list<Service>::const_iterator iterator;
+               for (iterator = listofservices.begin(); iterator != listofservices.end(); ++iterator) {
+                       services.push_back(*iterator);
+               }
+       }
+}
+
+void SearchProvider::setSearchListener(Search *obj)
+{
+       searchListener = obj;
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+}
+
+void SearchProvider::addService(Service service)
+{
+       dlog_print(DLOG_INFO, "MSF", "SearchProvider::addService()");
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       bool found = false;
+
+       std::list<Service>::iterator iterator;
+
+       bool match = false;
+
+       for (iterator = services.begin(); iterator != services.end(); ++iterator) {
+               if (iterator->getId() == service.getId()) {
+                       match = true;
+                       break;
+               }
+       }
+
+       if (!match) {
+               services.push_back(service);
+               found = true;
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+               if (found) {
+                       Search::st_onFound(service);
+               }
+       } else {
+       }
+}
+
+void SearchProvider::removeService(Service service)
+{
+       if (&service == NULL) {
+               return;
+       }
+
+       std::list<Service>::iterator it = services.begin();
+       while (it != services.end()) {
+               if (((*it).getId()) == (service.getId())) {
+                       services.erase(it++);
+               } else {
+                       it++;
+               }
+       }
+}
+
+void SearchProvider::removeServiceAndNotify(Service service)
+{
+       removeService(service);
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       Search::st_onLost(service);
+}
+
+void SearchProvider::clearServices()
+{
+       services.clear();
+}
+
+Service SearchProvider::getServiceById(string id)
+{
+       //      MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n",__FUNCTION__ ,__LINE__,__FILE__);
+       std::list<Service>::iterator iterator;
+       for (iterator = services.begin(); iterator != services.end(); ++iterator) {
+               if (((*iterator).getId()) == id) {
+                       return(*iterator);
+               }
+       }
+       return Service("", "", "", "", "");
+}
+
+bool SearchProvider::isSearching()
+{
+       if (this->searching)
+               return true;
+       else
+               return false;
+}
diff --git a/msf_tizen_client/src/Service.cpp b/msf_tizen_client/src/Service.cpp
new file mode 100644 (file)
index 0000000..bca2d19
--- /dev/null
@@ -0,0 +1,463 @@
+#include "Service.h"
+#include "Search.h"
+#include "Result.h"
+#include "Channel.h"
+#include "Debug.h"
+#include "Device.h"
+#include "Application.h"
+#include<curl/curl.h>
+
+string Service::ID_PROPERTY         = "id";
+string Service::VERSION_PROPERTY    = "ve";
+string Service::NAME_PROPERTY       = "fn";
+string Service::TYPE_PROPERTY       = "md";
+string Service::ENDPOINT_PROPERTY   = "se";
+
+Result_Base *Service::Resulturi = NULL;
+ServiceInfo Service::serviceval;
+
+Service Service::local_service;
+
+string Service::curl_data = "";
+
+Service::Service()
+{
+       //Resulturi = NULL;
+       //Resultdevice=NULL;
+       //devicedata = NULL;
+}
+
+/*Service::Service(string Id,string Version,string Name,string Type,string Uri)
+{
+       id=Id;
+       version=Version;
+       name=Name;
+       type=Type;
+       uri=Uri;
+}*/
+
+Service::Service(string id1, string version1, string name1, string type1, string endPoint1)
+{
+       id = id1;
+       version = version1;
+       name = name1;
+       type = type1;
+       uri = endPoint1;
+}
+
+/*
+Search *Service::search()
+{
+    return Search::getInstance();
+}
+*/
+
+void Service:: getById(string id, Result_Base *result)
+{
+       Search search;
+       Service service;
+
+       bool status = search.start();
+       if (!status)    {
+               service = search.getServiceById(id);
+       } else {
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               usleep(50000000);
+               service = search.getServiceById(id);
+               search.stop();
+       }
+
+       if (service.getId().length() == 0) {
+               if (result != NULL)
+                       result->onError(Error::create("Service Not Found"));
+       } else {
+               if (result != NULL)
+                       result->onSuccess(service);
+       }
+}
+
+string Service::getName()
+{
+       return name;
+}
+
+string Service::getVersion()
+{
+       return version;
+}
+
+string Service::getType()
+{
+       return type;
+}
+
+string Service::getId()
+{
+       return id;
+}
+
+string Service::getUri()
+{
+       return uri;
+}
+
+void Service::create(char *service_txt)
+{
+       position posvalues;
+       string txt(service_txt);
+
+       posvalues = findServiceValue(ID_PROPERTY, service_txt);
+       id = txt.substr((posvalues.start)-1, ((posvalues.end)-(posvalues.start)+1));
+
+       posvalues = findServiceValue(VERSION_PROPERTY, service_txt);
+       version = txt.substr((posvalues.start)-1, ((posvalues.end)-(posvalues.start)+1));
+
+       posvalues = findServiceValue(NAME_PROPERTY, service_txt);
+       name = txt.substr((posvalues.start)-1, ((posvalues.end)-(posvalues.start)+1));
+
+       posvalues = findServiceValue(TYPE_PROPERTY, service_txt);
+       type = txt.substr((posvalues.start)-1, ((posvalues.end)-(posvalues.start)+1));
+
+       posvalues = findServiceValue(ENDPOINT_PROPERTY, service_txt);
+       uri = txt.substr((posvalues.start)-1, ((posvalues.end)-(posvalues.start)+1));
+
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH MDNS WITH URI [%s] [%s] [%d] in %s \n", uri.c_str(), __FUNCTION__, __LINE__, __FILE__);
+}
+
+Service Service::create(ServiceInfo servicevalue)
+{
+       //if (
+       string id = servicevalue.infoId;
+//     this->id=id;
+       string version = servicevalue.infoVersion;
+//     this->version=version;
+       string name = servicevalue.infoName;
+//     this->name=name;
+       string type = servicevalue.infotype;
+//     this->type=type;
+       string endPoint = servicevalue.infoURI;//TODO
+//     this->uri=endPoint;
+       Service service = Service(id, version, name, type, endPoint);
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH MSFD WITH URI [%s] [%s] [%d] in %s \n", endPoint.c_str(), __FUNCTION__, __LINE__, __FILE__);
+       return service;
+}
+
+Service Service::create(map<string, string> serviceMap)
+{
+       string id = serviceMap.find(ID_PROPERTY)->second;
+       string version = serviceMap.find("version")->second;
+       string name = serviceMap.find("name")->second;
+       string type = serviceMap.find("type")->second;
+       string endPoint = serviceMap.find("uri")->second;//TODO
+       Service service = Service(id, version, name, type, endPoint);
+       return service;
+       //return Service;*/
+}
+
+position Service::findServiceValue(string substrng, char *strng)
+{
+       const char *src = strstr(strng, substrng.c_str());
+       int startpoint = (src-strng)+sizeof(substrng);
+       std::string temp = "\"";
+       const char *dest = strstr(src, temp.c_str());
+       int endpoint = (dest-strng);
+       position values;
+       values.start = startpoint;
+       values.end = endpoint;
+       return values;
+}
+
+void Service::getDeviceInfo(Result_Base *dev_result)
+{
+       dlog_print(DLOG_INFO, "MSF", "getDeviceInfo");
+       curl_service_calling(uri, 0, dev_result);
+}
+
+Service Service::getLocal(void)
+{
+       class GetLocalServiceCallback : public Result_Base
+       {
+               public:
+                       void onSuccess(Service service)
+                       {
+                               dlog_print(DLOG_INFO, "MSF", "service name : %s\n", service.getName().c_str() ? service.getName().c_str() : "name is NULL");
+                               local_service = service;
+                       }
+
+                       void onError(Error)
+                       {
+                               dlog_print(DLOG_ERROR, "MSF", "getLocal() : Fail to get local service info");
+                       }
+       };
+
+       GetLocalServiceCallback r1Service;
+       string uri = "http://127.0.0.1:8001/api/v2/";
+       getByURI(uri, 0, &r1Service);
+
+       return local_service;
+}
+
+void Service::getByURI(string uri,  Result_Base *result)
+{
+       getByURI(uri, 0, result);
+}
+
+void Service::getByURI(string uri, long timeout,  Result_Base *result)
+{
+       dlog_print(DLOG_INFO, "MSF", "getByURI() uri = %s", uri.c_str());
+
+       Resulturi = result;
+       //Resultdevice = NULL;
+       curl_service_calling(uri, timeout, NULL);
+       Resulturi = NULL;
+}
+
+int Service::curl_service_calling(string uri, long timeout, void *dev_result_ptr)
+{
+       dlog_print(DLOG_INFO, "MSF", "curl_service_calling() 1");
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
+       CURL *curl;
+       CURLcode res;
+       struct curl_slist *headers = NULL;
+       headers = curl_slist_append(headers, "Accept: application/json");
+       headers = curl_slist_append(headers, "Content-Type: application/json");
+
+       curl = curl_easy_init();
+       if (curl) {
+               const char *c = uri.c_str();
+               curl_easy_setopt(curl, CURLOPT_URL, c);
+               curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+               //curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
+               //if (timeout != 0)
+                       curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 5000);
+
+               curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Service::createdata);
+               //curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 5000);
+               curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
+               //curl_easy_setopt(curl, CURLOPT_PORT, 8001);
+               //curl_easy_setopt(curl, CURLOPT_LOCALPORT, 8888);
+
+               res = curl_easy_perform(curl);
+
+               if (res != CURLE_OK) {
+                       dlog_print(DLOG_ERROR, "MSF", "####Service curl ERROR = %d ####", res);
+                       MSF_DBG("curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
+                       createdata_process("", dev_result_ptr);
+               } else {
+                       createdata_process(curl_data, dev_result_ptr);
+                       curl_data.clear();
+               }
+
+               curl_easy_cleanup(curl);
+               dlog_print(DLOG_INFO, "MSF", "curl_service_calling() 4");
+       }
+
+       dlog_print(DLOG_INFO, "MSF", "curl_service_calling() 5");
+
+       return 0;
+}
+
+size_t Service::createdata(char *buf, size_t size, size_t nmemb, void *up)
+{
+       dlog_print(DLOG_INFO, "MSF", "createdata() 1");
+
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
+       if (buf != NULL) {
+               //string data;
+
+               curl_data.append(buf, size*nmemb);
+
+               //createdata_process(data, ptr);
+       } else {
+               dlog_print(DLOG_ERROR, "MSF", "createdata() buf is null");
+               //createdata_process(string(), ptr);
+       }
+
+       return size*nmemb;
+}
+
+void Service::createdata_process(string data, void *dev_result_ptr)
+{
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
+       if (data.length() != 0) {
+               json_parse_service(data.c_str(), dev_result_ptr);
+       } else {
+               if (Resulturi != NULL) {
+                       Resulturi->onError(Error::create("Timeout"));
+
+                       //delete (Resulturi);
+
+                       //Resulturi = NULL;
+               }
+               if (dev_result_ptr != NULL) {
+                       (static_cast<Result_Base*> (dev_result_ptr))->onError(Error::create("Not Found"));
+               }
+       }
+}
+
+void Service::foreach_json_object(JsonObject *object, const gchar *key, JsonNode *node, gpointer user_data)
+{
+       if (json_node_get_node_type(node) == JSON_NODE_VALUE) {
+               if (!strncmp(key, "id", 2)) {
+                       serviceval.infoId = json_node_get_string(node);
+                       dlog_print(DLOG_ERROR, "MSF", "infoId set as %s", serviceval.infoId.c_str());
+                       //cout<<"\nID : \t"<<serviceval.infoId <<"\n";
+               } else if (!strncmp(key, "version", 4)) {
+                       serviceval.infoVersion = json_node_get_string(node);
+                       dlog_print(DLOG_ERROR, "MSF", "infoVersion set as %s", serviceval.infoVersion.c_str());
+               } else if (!strncmp(key, "name", 7)) {
+                       serviceval.infoName = json_node_get_string(node);
+                       dlog_print(DLOG_ERROR, "MSF", "infoName set as %s", serviceval.infoName.c_str());
+               } else if (!strncmp(key, "type", 7)) {
+                       serviceval.infotype = json_node_get_string(node);
+                       dlog_print(DLOG_ERROR, "MSF", "infotype set as %s", serviceval.infotype.c_str());
+
+               } else if (!strncmp(key, "uri", 7)) {
+                       serviceval.infoURI = json_node_get_string(node);
+                       dlog_print(DLOG_ERROR, "MSF", "infoURI set as %s", serviceval.infoURI.c_str());
+               }
+       } else if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+               if (!strncmp(key, "device", 7)) {
+                       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
+                       if (user_data != NULL) {
+                               Device dev = Device::create(node);
+                               (static_cast<Result_Base *>(user_data))->onSuccess(dev);
+                       }
+               }
+       }
+}
+
+
+int Service::json_parse_service(const char *in, void *ptr)
+{
+       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);
+       dlog_print(DLOG_ERROR, "MSF", "Service::json_parse_service : %s", in);
+
+       JsonParser *parser = json_parser_new();
+
+       if (json_parser_load_from_data(parser, in, -1, NULL)) {
+               JsonNode *node = json_parser_get_root(parser);
+
+               if (json_node_get_node_type(node) == JSON_NODE_OBJECT) {
+                       json_object_foreach_member(json_node_get_object(node), foreach_json_object, ptr);
+               }
+
+       } else {
+               dlog_print(DLOG_ERROR, "MSF", "json_parsing error");
+       }
+
+       /*
+       dlog_print(DLOG_INFO, "MSF", "Service json_parse_service()");
+       void *result_ptr = ptr;
+       enum json_type typed;
+       json_object_object_foreach(jobj, key, val) {
+               typed = json_object_get_type(val);
+               switch (typed) {
+                       case json_type_null:
+                               break;
+
+                       case json_type_boolean:
+                               break;
+
+                       case json_type_double:
+                               break;
+
+                       case json_type_int:
+                               break;
+
+                       case json_type_object:
+                               dlog_print(DLOG_INFO, "MSF", "Service json_parse_service() 2");
+                               if (!strncmp(key , "device", 7)) {
+                                       dlog_print(DLOG_INFO, "MSF", "Service json_parse_service() 3");
+
+                                       MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);  
+                                       if (result_ptr != NULL) {
+                                               dlog_print(DLOG_INFO, "MSF", "Service json_parse_service() 4");
+                                               MSF_DBG("\n Debug Log: SERVICE FOUND THROUGH  WITH URI [%s] [%d] in %s \n", __FUNCTION__, __LINE__, __FILE__);  
+
+                                               Device dev = Device::create(val);
+                                               (static_cast<Result_Base *> (result_ptr))->onSuccess(dev);
+                                               result_ptr=NULL;
+                                       }
+                               }
+                               break;
+
+                       case json_type_array:
+                               break;
+
+                       case json_type_string:
+                               if (!strncmp(key , "id", 2)) {
+                                       serviceval.infoId = json_object_get_string(val);
+                                       //cout<<"\nID : \t"<<serviceval.infoId <<"\n";
+                               }
+                               else if (!strncmp(key , "version", 4)) {
+                                       serviceval.infoVersion = json_object_get_string(val);
+                               }
+                               else if (!strncmp(key , "name", 7)) {
+                                       serviceval.infoName = json_object_get_string(val);
+                               }
+                               else if (!strncmp(key , "type", 7)) {
+                                       serviceval.infotype = json_object_get_string(val);
+                               }
+                               else if (!strncmp(key , "uri", 7)) {
+                                       serviceval.infoURI = json_object_get_string(val);
+                               }
+                               break;
+               }
+       }
+       */
+
+       if ((Resulturi!= NULL)) {
+               dlog_print(DLOG_INFO, "MSF", "json_parse_service() call onSuccess()");
+               Resulturi->onSuccess(create(serviceval));
+               //delete (Resulturi);
+               //Resulturi=NULL;
+       }
+
+       return 0;
+}
+
+Application  Service::createApplication(string uri)
+{
+       if (!(uri == "")) {//check length and return error
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               //Application *application = Application::create(this,uri);
+               Application application = Application::create(this, uri);
+               return application;
+       } else {
+               Application app;
+               return app;
+       }
+}
+
+Application Service::createApplication(string uri, string channelId)
+{
+       if (!((uri == "") || (channelId == ""))) {
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               //Application *application=Application::create(this, uri, channelId, map_type());
+               Application application = Application::create(this, uri, channelId, map_type());
+               return application;
+       } else {
+               Application app;
+               return app;
+       }
+}
+
+Application Service::createApplication(string uri, string channelId, map<string, string> startArgs)
+{
+       if (!((uri == "") || (channelId == ""))) {
+               MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               //Application *application =Application::create(this, uri, channelId, startArgs);
+               Application application = Application::create(this, uri, channelId, startArgs);
+               return application;
+       } else {
+               Application app;
+               return app;
+       }
+}
+
+Channel *Service::createChannel(string uri)
+{
+       Channel *channel = Channel::create(this, uri);
+       return channel;
+}
diff --git a/msf_tizen_client/src/URIparser.cpp b/msf_tizen_client/src/URIparser.cpp
new file mode 100644 (file)
index 0000000..4e4912a
--- /dev/null
@@ -0,0 +1,291 @@
+#include "URIparser.h"
+#include <stdio.h>
+#include <cstdlib>
+#include <cstring>
+
+namespace uri_parser {
+
+const std::string URIParse::URIRESERVED_PATH     = "?#";
+const std::string URIParse::URIRESERVED_QUERY    = "#";
+const std::string URIParse::URIRESERVED_FRAGMENT = "";
+const std::string URIParse::URIILLEGAL           = "%<>{}|\\\"^`";
+
+URIParse::URIParse():
+       _URIport(0), _URIflags(0)
+{
+}
+
+URIParse::URIParse(const std::string& uri):
+       _URIport(0), _URIflags(0)
+{
+       parseURI(uri);
+}
+
+URIParse::URIParse(const char* uri):
+       _URIport(0), _URIflags(0)
+{
+       parseURI(std::string(uri));
+}
+
+URIParse::~URIParse()
+{
+}
+
+void URIParse::clear()
+{
+       _URIscheme.clear();
+       _URIuserInfo.clear();
+       _URIhost.clear();
+       _URIport = 0;
+       _URIportStr.clear();
+       _URIpath.clear();
+       _URIquery.clear();
+       _URIfragment.clear();
+       _URIflags = 0;
+}
+
+void URIParse::setURIScheme(const std::string& scheme)
+{
+       _URIscheme = scheme;
+       toLowerInPlaceURI(_URIscheme);
+       if (_URIport == 0) {
+               _URIport = getWellKnownPortforURI();
+       }
+}
+
+bool URIParse::empty() const
+{
+       return _URIscheme.empty() && _URIhost.empty() && _URIpath.empty() && _URIquery.empty() && _URIfragment.empty();
+}
+
+void URIParse::decodeURI(const std::string& str, std::string& decodedStr, long _flags2)
+{
+       std::string::const_iterator it  = str.begin();
+       std::string::const_iterator end = str.end();
+
+       while (it != end) {
+               char c = *it++;
+               if (c == '%') {
+                       if (it == end) {
+                               if (_flags2 & 0x1)
+                                       printf("ERROR: URI encoding: no hex digit following percent sign.\n");
+                               return;
+                       }
+
+                       char hi = *it++;
+
+                       if (it == end) {
+                               if (_flags2 & 0x1)
+                                       printf("ERROR: URI encoding: two hex digits must follow percent sign.\n");
+                               return;
+                       }
+
+                       char lo = *it++;
+
+                       if (hi >= '0' && hi <= '9') {
+                               c = hi - '0';
+                       } else if (hi >= 'A' && hi <= 'F') {
+                               c = hi - 'A' + 10;
+                       } else if (hi >= 'a' && hi <= 'f') {
+                               c = hi - 'a' + 10;
+                       } else {
+                               if (_flags2 & 0x1)
+                                       printf("ERROR: URI encoding: not a hex digit.\n");
+                               return;
+                       }
+                       c *= 16;
+                       if (lo >= '0' && lo <= '9') {
+                               c += lo - '0';
+                       } else if (lo >= 'A' && lo <= 'F') {
+                               c += lo - 'A' + 10;
+                       } else if (lo >= 'a' && lo <= 'f') {
+                               c += lo - 'a' + 10;
+                       } else {
+                               if (_flags2 & 0x1)
+                                       printf("ERROR: URI encoding: not a hex digit.\n");
+                               return;
+                       }
+               }
+               decodedStr += c;
+       }
+}
+
+unsigned short URIParse::getWellKnownPortforURI() const
+{
+       if (_URIscheme == "ftp")
+               return 21;
+       else if (_URIscheme == "ssh")
+               return 22;
+       else if (_URIscheme == "telnet")
+               return 23;
+       else if (_URIscheme == "http")
+               return 80;
+       else if (_URIscheme == "nntp")
+               return 119;
+       else if (_URIscheme == "ldap")
+               return 389;
+       else if (_URIscheme == "https")
+               return 443;
+       else if (_URIscheme == "rtsp")
+               return 554;
+       else if (_URIscheme == "sip")
+               return 5060;
+       else if (_URIscheme == "sips")
+               return 5061;
+       else if (_URIscheme == "xmpp")
+               return 5222;
+       else
+               return 0;
+}
+
+void URIParse::parseURI(const std::string& uri)
+{
+       std::string::const_iterator it  = uri.begin();
+       std::string::const_iterator end = uri.end();
+       if (it == end) return;
+       if (*it != '/' && *it != '.' && *it != '?' && *it != '#') {
+               std::string scheme;
+               while (it != end && *it != ':' && *it != '?' && *it != '#' && *it != '/') scheme += *it++;
+               if (it != end && *it == ':') {
+                       ++it;
+
+                       if (it == end) {
+                               if (_URIflags & 0x1)
+                                       printf("ERROR: URI scheme must be followed by authority or path.\n");
+                               return;
+                       }
+                       setURIScheme(scheme);
+                       if (*it == '/') {
+                               ++it;
+                               if (it != end && *it == '/') {
+                                       ++it;
+                                       URIparseAuthority(it, end);
+                               } else {
+                                       --it;
+                               }
+                       }
+                       URIparsePathEtc(it, end);
+               } else {
+                       it = uri.begin();
+                       URIparsePathEtc(it, end);
+               }
+       } else {
+               URIparsePathEtc(it, end);
+       }
+}
+
+void URIParse::URIparseAuthority(std::string::const_iterator& it, const std::string::const_iterator& end)
+{
+       std::string userInfo;
+       std::string part;
+       while (it != end && *it != '/' && *it != '?' && *it != '#')     {
+               if (*it == '@') {
+                       userInfo = part;
+                       part.clear();
+               } else {
+                       part += *it;
+               }
+               ++it;
+       }
+       std::string::const_iterator pbeg = part.begin();
+       std::string::const_iterator pend = part.end();
+       URIparseHostAndPort(pbeg, pend);
+       _URIuserInfo = userInfo;
+}
+
+void URIParse::URIparseHostAndPort(std::string::const_iterator& it, const std::string::const_iterator& end)
+{
+       if (it == end) return;
+
+       std::string host;
+       if (*it == '[') {
+               ++it;
+               while (it != end && *it != ']') host += *it++;
+
+               if (it == end) {
+                       if (_URIflags & 0x1)
+                               printf("ERROR: unterminated IPv6 address.\n");
+                       return;
+               }
+               ++it;
+       } else {
+               while (it != end && *it != ':') host += *it++;
+       }
+
+       if (it != end && *it == ':') {
+               ++it;
+               std::string port;
+               while (it != end) port += *it++;
+               if (!port.empty()) {
+                       int nport = 0;
+
+                       _URIportStr = port.c_str();
+                       nport = atoi(port.c_str());
+                       if (nport < 0) {
+                               _URIport = 0;
+                       } else if (nport > 65535) {
+                               _URIport = 65535;
+                       } else {
+                               _URIport = (unsigned short) nport;
+                       }
+               } else {
+                       _URIport = getWellKnownPortforURI();
+               }
+       } else {
+               _URIport = getWellKnownPortforURI();
+       }
+       _URIhost = host;
+       toLowerInPlaceURI(_URIhost);
+}
+
+void URIParse::URIparsePath(std::string::const_iterator& it, const std::string::const_iterator& end)
+{
+       std::string path;
+       while (it != end && *it != '?' && *it != '#') path += *it++;
+       decodeURI(path, _URIpath, _URIflags);
+}
+
+void URIParse::URIparsePathEtc(std::string::const_iterator& it, const std::string::const_iterator& end)
+{
+       if (it == end) return;
+
+       if (*it != '?' && *it != '#')
+               URIparsePath(it, end);
+
+       if (it != end && *it == '?') {
+               ++it;
+               URIparseQuery(it, end);
+       }
+
+       if (it != end && *it == '#') {
+               ++it;
+               URIparseFragment(it, end);
+       }
+}
+
+void URIParse::URIparseQuery(std::string::const_iterator& it, const std::string::const_iterator& end)
+{
+       _URIquery.clear();
+       while (it != end && *it != '#') _URIquery += *it++;
+}
+
+void URIParse::URIparseFragment(std::string::const_iterator& it, const std::string::const_iterator& end)
+{
+       std::string fragment;
+       while (it != end) fragment += *it++;
+       decodeURI(fragment, _URIfragment, _URIflags);
+}
+
+bool URIParse::isIPAddressinURI(const std::string& str)
+{
+       const char *str2 = str.c_str();
+       const char *ptr = strrchr(str2, (int)'.');
+       if (ptr && *ptr == '.') {
+               ++ptr;
+               if (strchr("0123456789", *ptr))
+                       return 1;
+       }
+       return 0;
+}
+
+}
diff --git a/msf_tizen_client/src/mDNSSearchProvider.cpp b/msf_tizen_client/src/mDNSSearchProvider.cpp
new file mode 100644 (file)
index 0000000..74d52f1
--- /dev/null
@@ -0,0 +1,242 @@
+#include"mDNSSearchProvider.h"
+#include <stdlib.h>
+#include "Debug.h"
+#include <list>
+#include "Service.h"
+
+#define SERVICE_TYPE "_samsungmsf._tcp"
+
+dnssd_service_h g_service = 0;
+
+mDNSSearchProvider::~mDNSSearchProvider()
+{
+       MSF_DBG("mDNS off.");
+}
+
+static const char *dnssd_error_to_string(dnssd_error_e error)
+{
+       switch (error) {
+               case DNSSD_ERROR_NONE:
+                       return "DNSSD_ERROR_NONE";
+               case DNSSD_ERROR_OUT_OF_MEMORY:
+                       return "DNSSD_ERROR_OUT_OF_MEMORY";
+               case DNSSD_ERROR_INVALID_PARAMETER:
+                       return "DNSSD_ERROR_INVALID_PARAMETER";
+               case DNSSD_ERROR_NOT_SUPPORTED:
+                       return "DNSSD_ERROR_NOT_SUPPORTED";
+               case DNSSD_ERROR_NOT_INITIALIZED:
+                       return "DNSSD_ERROR_NOT_INITIALIZED";
+               case DNSSD_ERROR_ALREADY_REGISTERED:
+                       return "DNSSD_ERROR_ALREADY_REGISTERED";
+               case DNSSD_ERROR_NAME_CONFLICT:
+                       return "DNSSD_ERROR_NAME_CONFLICT";
+               case DNSSD_ERROR_SERVICE_NOT_RUNNING:
+                       return "DNSSD_ERROR_SERVICE_NOT_RUNNING";
+               case DNSSD_ERROR_OPERATION_FAILED:
+                       return "DNSSD_ERROR_OPERATION_FAILED";
+               default:
+                       return "UNSUPPORTED_ERROR";
+       }
+}
+
+mDNSSearchProvider::mDNSSearchProvider()
+{
+       MSF_DBG(" [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] ", __FUNCTION__, __LINE__, __FILE__);
+       SearchProvider();
+}
+
+mDNSSearchProvider::mDNSSearchProvider(Search *sListener) : SearchProvider(sListener)
+{
+       MSF_DBG(" [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] ", __FUNCTION__, __LINE__, __FILE__);
+}
+
+SearchProvider mDNSSearchProvider::create()
+{
+       return (SearchProvider)mDNSSearchProvider();
+}
+
+SearchProvider mDNSSearchProvider::create(Search *searchListener)
+{
+       MSF_DBG("\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       return (SearchProvider)mDNSSearchProvider(searchListener);
+}
+
+void mDNSSearchProvider::addService(Service service)
+{
+       this->SearchProvider::addService(service);
+}
+
+void extract_service_info(ServiceInfo &info, string text)
+{
+       int id_pos = text.find("id=");
+       int remote_pos = text.find("remote=");
+       int se_pos = text.find("se=");
+       int ve_pos = text.find("ve=");
+       int fn_pos = text.find("fn=");
+       int md_pos = text.find("md=");
+
+       char c_text[100];
+       int j = 0;
+
+       MSF_DBG("TxT Record : %s", text.c_str());
+
+       for(int i = id_pos + 3; remote_pos > i; i++, j++) {
+               c_text[j] = text[i];
+       }
+
+       c_text[j-1] = '\0';
+       info.infoId = c_text;
+       MSF_DBG("ID : %s", c_text);
+
+       j = 0;
+       for(int i = ve_pos + 3; md_pos > i; i++, j++) {
+               c_text[j] = text[i];
+       }
+
+       c_text[j-1] = '\0';
+       info.infoVersion = c_text;
+       MSF_DBG("Version : %s", c_text);
+
+       j = 0;
+       for(int i = fn_pos + 3; se_pos > i; i++, j++) {
+               c_text[j] = text[i];
+       }
+
+       c_text[j-1] = '\0';
+       info.infoName = c_text;
+       MSF_DBG("Name : %s", c_text);
+
+       j = 0;
+       for(unsigned int i = se_pos + 3; text.size() > i; i++, j++) {
+               c_text[j] = text[i];
+       }
+
+       c_text[j] = '\0';
+       info.infoURI = c_text;
+       MSF_DBG("Uri : %s", c_text);
+}
+
+static void dnssd_browse_reply(dnssd_service_state_e service_state, dnssd_service_h remote_service, void *user_data)
+{
+       MSF_DBG("[MSF : API] Debug log Function : [%s] and line [%d] in file [%s] ", __FUNCTION__, __LINE__, __FILE__);
+       mDNSSearchProvider *provider = (mDNSSearchProvider*)user_data;
+       int rv = 0;
+       MSF_DBG("Handler       : %u", remote_service);
+       MSF_DBG("State         : ");
+       switch (service_state) {
+               case DNSSD_SERVICE_STATE_AVAILABLE:
+                       MSF_DBG("Available");
+                       break;
+               case DNSSD_SERVICE_STATE_UNAVAILABLE:
+                       MSF_DBG("Un-Available");
+                       break;
+               case DNSSD_SERVICE_STATE_NAME_LOOKUP_FAILED:
+                       MSF_DBG("Lookup failure for service name");
+                       break;
+               case DNSSD_SERVICE_STATE_HOST_NAME_LOOKUP_FAILED:
+                       MSF_DBG("Lookup failure for host name and port number");
+                       break;
+               case DNSSD_SERVICE_STATE_ADDRESS_LOOKUP_FAILED:
+                       MSF_DBG("Lookup failure for IP address");
+                       break;
+               default:
+                       MSF_DBG("Unknown Browse State");
+                       break;
+       }
+
+       char *name = NULL;
+       char *type = NULL;
+
+       rv = dnssd_service_get_name(remote_service, &name);
+       if (rv == DNSSD_ERROR_NONE && name != NULL)
+               MSF_DBG("Service Name  : %s", name);
+
+       rv = dnssd_service_get_type(remote_service, &type);
+       if (rv == DNSSD_ERROR_NONE && type != NULL)
+               MSF_DBG("Service Type  : %s", type);
+
+       if (service_state == DNSSD_SERVICE_STATE_AVAILABLE) {
+               char *ip_v4_address = NULL;
+               char *ip_v6_address = NULL;
+               char *txt_record = NULL;
+               unsigned short txt_len = 0;
+               int port = 0;
+
+               rv = dnssd_service_get_ip(remote_service, &ip_v4_address, &ip_v6_address);
+               if (rv  == DNSSD_ERROR_NONE) {
+                       if (ip_v4_address)
+                               MSF_DBG("IPv4 Address  : %s", ip_v4_address);
+                       if (ip_v6_address)
+                               MSF_DBG("IPv6 Address  : %s", ip_v6_address);
+               }
+
+               rv = dnssd_service_get_port(remote_service, &port);
+               MSF_DBG("Port          : %d\n", port);
+
+               dnssd_service_get_all_txt_record(remote_service, &txt_len,
+                               (void **)&txt_record);
+               MSF_DBG("TXT Record: %s", txt_record);
+
+               string temp_str(txt_record, txt_len);
+
+               ServiceInfo service_info; //id, version, name, type, Uri
+               MSF_DBG("txt_len %d", txt_len);
+               if (txt_len > 100) {
+                       extract_service_info(service_info, temp_str);
+                       service_info.infotype = SERVICE_TYPE;
+                       Service service = Service::create(service_info);
+                       provider->addService(service);
+                       MSF_DBG("service : id( %s ) registerd.", service_info.infoId.c_str());
+               }
+
+               free(ip_v4_address);
+               free(ip_v6_address);
+               free(name);
+               free(type);
+               free(txt_record);
+       }
+}
+
+void mDNSSearchProvider::start()
+{
+       if (g_service != 0) {
+               dnssd_stop_browsing_service(g_service);
+               g_service = 0;
+       }
+
+       int rv = dnssd_initialize();
+       if (rv != DNSSD_ERROR_NONE) {
+               MSF_DBG("mDNS is not initialzed.");
+               return;
+       } else {
+               MSF_DBG("mDNS is initialzed successfully.");
+       }
+
+       rv = dnssd_start_browsing_service(SERVICE_TYPE, &g_service, dnssd_browse_reply, this);
+       if (rv != DNSSD_ERROR_NONE) {
+               MSF_DBG("Failed to browse for dns service, error %s", dnssd_error_to_string((dnssd_error_e)rv));
+       } else {
+               MSF_DBG("Succeeded to browse for dns service.");
+       }
+}
+
+bool mDNSSearchProvider::stop()
+{
+       int rv;
+
+       if (g_service != 0) {
+               rv = dnssd_stop_browsing_service(g_service);
+               g_service = 0;
+               if (rv != DNSSD_ERROR_NONE) {
+                       MSF_DBG("Failed to stop browse dns service %s", dnssd_error_to_string((dnssd_error_e)rv));
+                       return false;
+               } else {
+                       MSF_DBG("Successfully stopped browsing dns service");
+                       dnssd_deinitialize();
+                       return true;
+               }
+       } else {
+               MSF_DBG("Browsing is aleady stopped.");
+               return false;
+       }
+}
diff --git a/msf_tizen_client/test/CMakeLists.txt b/msf_tizen_client/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7f6fa7a
--- /dev/null
@@ -0,0 +1,36 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(msf-api-test)
+INCLUDE(GNUInstallDirs)
+
+# Targets
+SET(target "msf-api-test")
+
+# Source Lists
+SET(SRCS main.cpp)
+MESSAGE("Sources: ${SRCS}")
+
+# Dependencies
+SET(DEPS "glib-2.0 gio-2.0 json-glib-1.0 dlog openssl msf-api libwebsockets libcurl")
+
+INCLUDE(FindPkgConfig)
+INCLUDE_DIRECTORIES(
+${CMAKE_CURRENT_SOURCE_DIR}/include
+)
+ADD_DEFINITIONS(-g -O2 -Wall -fPIC -Wl,--as-needed)
+
+# Building Library
+pkg_check_modules(lib_pkg REQUIRED ${DEPS})
+
+FOREACH(flag ${lib_pkg_CFLAGS})
+SET(LIB_EXTRA_CFLAGS "${LIB_EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_EXECUTABLE(${target} ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${lib_pkg_LDFLAGS} -lcurl msf-api nsd-dns-sd glib-2.0 gio-2.0 json-glib-1.0)
+SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS ${LIB_EXTRA_CFLAGS})
+SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"MSF\"")
+SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${FULLVER})
+
+# Installing Library
+INSTALL(TARGETS ${target} DESTINATION bin)
diff --git a/msf_tizen_client/test/main.cpp b/msf_tizen_client/test/main.cpp
new file mode 100644 (file)
index 0000000..6d753e6
--- /dev/null
@@ -0,0 +1,663 @@
+//#include <msf-api/Search.h>
+//#include <msf-api/Service.h>
+//#include <msf-api/Clients.h>
+//#include <msf-api/Client.h>
+//#include <msf-api/Application.h>
+//#include <msf-api/ApplicationInfo.h>
+//#include <msf-api/Device.h>
+//#include <msf-api/Result.h>
+//#include <msf-api/Error.h>
+//#include <msf-api/Debug.h>
+#include "Search.h"
+#include "Service.h"
+#include "Clients.h"
+#include "Client.h"
+#include "Application.h"
+#include "ApplicationInfo.h"
+#include "Device.h"
+#include "Result.h"
+#include "Error.h"
+#include "Debug.h"
+#include <map>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <glib.h>
+
+/*
+ * change this value
+ * if you want to use msf c api, set 1
+ */
+
+
+/* availabel appID
+'dev-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv':
+'dev-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/index.html':
+'dev-multiscreen.samsung.com/casteroids/tv/index.html':
+'fling-tv.herokuapp.com':
+'google.com':
+'multiscreen.samsung.com/app-sample-photos/tv/index.html':
+'multiscreen.samsung.com/casteroids/tv/index.html':
+'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv':
+'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/helloworld/tv/index.html':
+'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/photoshare/tv':
+'prod-multiscreen-examples.s3-website-us-west-1.amazonaws.com/examples/photoshare/tv/index.html':
+'yahoo.com':
+*/
+
+Application* application = NULL;
+
+int result_arrive = 0;
+
+using namespace std;
+class SearchListenerinherit : public SearchListener {
+public:
+       std::string subject;
+       void onStart()
+       {
+               printf("\nsubject = %s\n", subject.c_str());
+               printf("\nSearch onStart");
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+       void onStop()
+       {
+               printf("\nsubject = %s\n", subject.c_str());
+               printf("\nSearch onStop");
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+       void onFound(Service service)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               printf("\nSearch onFound");
+               //fprintf(stderr,"\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               printf("\nservice name : %s\n", service.getName().c_str() ? service.getName().c_str() : "name is NULL");
+               printf("\nservice uri : %s\n", service.getUri().c_str() ? service.getUri().c_str() : "uri is NULL");
+               //fflush(stdout);
+               fflush(stdout);
+       }
+       void onLost(Service service)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               printf("\nSearch onLost");
+               printf("\nservice name : %s\n", service.getName().c_str() ? service.getName().c_str() : "name is NULL");
+               fflush(stdout);
+               //fprintf(stderr,"\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+};
+
+class OnConnectListenerinherit:public OnConnectListener{
+public:
+       std::string subject;
+       void onConnect(Client client) {
+               //string id=;
+               //bool ishost =client.isHost();
+               //int connecttime = client.getConnectTime();
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+class OnDisconnectListenerinherit:public OnDisconnectListener{
+public:
+       std::string subject;
+       void onDisconnect(Client client) {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+class OnClientConnectListenerinherit:public OnClientConnectListener{
+public:
+       Application* app;
+
+       std::string subject;
+       void onClientConnect(Client c) {
+               printf("\nsubject = %s", subject.c_str());
+               printf("\npublish hello to client %s\n", c.getId());
+               fflush(stdout);
+               const char* welcome = "hello welcome";
+               unsigned char binary[5] = {'a', 'b', 'c', 'd', '\0'};
+               app->publish("test_say", welcome, c, binary, 5);
+
+               //fprintf(stderr,"\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+};
+class OnClientDisconnectListenerinherit:public OnClientDisconnectListener{
+public:
+       std::string subject;
+       void onClientDisconnect(Client client) {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+};
+class OnMessageListenerinherit:public OnMessageListener{
+public:
+       std::string subject;
+       void onMessage(Message mesg) {
+               printf("\nsubject = %s\n", subject.c_str());
+               printf("message: [event: %s] ", mesg.m_event.c_str());
+               printf("[from: %s] ", mesg.m_from.c_str());
+
+               printf("[msg: %s] ", mesg.m_data.c_str());
+
+               printf("\n");
+
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+};
+class OnErrorListenerinherit:public OnErrorListener{
+public:
+       std::string subject;
+       void onError(Client client) {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+
+class ResultClient : public Result_Base
+{
+public:
+       std::string subject;
+       void onSuccess(Client abc)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultClient::onSuccess Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+
+               result_arrive = 1;
+       }
+       void onError(Error)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultClient::onError Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+class ResultBool : public Result_Base
+{
+public:
+       std::string subject;
+       void onSuccess(bool abc)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultBool::onSuccess Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+       void onError(Error e)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               printf("\nerror = %s", e.get_error_message());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultBool::onError Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+class ResultService : public Result_Base
+{
+public:
+       std::string subject;
+       void onSuccess(Service abc)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultService::onSuccess Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+       void onError(Error)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               fprintf(stderr, "\n [MSF : API] ResultService::onError Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+       }
+};
+class ResultDevice : public Result_Base
+{
+public:
+       std::string subject;
+       void onSuccess(Device d)
+       {
+               printf("\nsubject = %s\n", subject.c_str());
+               fflush(stdout);
+
+               printf("id : %s\n", d.getid().c_str());
+               printf("countryCode : %s\n", d.getcountryCode().c_str());
+               printf("description : %s\n", d.getdescription().c_str());
+               printf("dduid : %s\n", d.getduid().c_str());
+               printf("firmwareversion : %s\n", d.getfirmwareVersion().c_str());
+               printf("ssid : %s\n", d.getssid().c_str());
+               printf("ip : %s\n", d.getip().c_str());
+               printf("model : %s\n", d.getmodel().c_str());
+               printf("name : %s\n", d.getname().c_str());
+               printf("networkType : %s\n", d.getnetworkType().c_str());
+               printf("resolution : %s\n", d.getresolution().c_str());
+               printf("udn : %s\n", d.getudn().c_str());
+
+               fprintf(stderr, "\n [MSF : API] ResultDevice::onSuccess Debug log Function : [%s] and line [%d] in file [%s] and duid [%s] \n", __FUNCTION__, __LINE__, __FILE__, (d.getduid()).c_str());
+               result_arrive = 1;
+       }
+       void onError(Error)
+       {
+               printf("\nsubject = %s\n", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultDevice::onError Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+class ResultApplicationInfo : public Result_Base
+{
+public:
+       std::string subject;
+       void onSuccess(ApplicationInfo abc)
+       {
+               printf("\nsubject = %s\n", subject.c_str());
+               fflush(stdout);
+
+               printf("app id : %s\n", abc.getID().c_str());
+               printf("app name : %s\n", abc.getName().c_str());
+               printf("app version : %s\n", abc.getVersion().c_str());
+               printf("app running : %s\n", abc.isRunning() ? "true" : "false");
+               fprintf(stderr, "\n [MSF : API] ResultApplicationInfo::onSuccess Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+       void onError(Error)
+       {
+               printf("\nsubject = %s", subject.c_str());
+               fflush(stdout);
+               fprintf(stderr, "\n [MSF : API] ResultApplicationInfo::onError Debug log Function : [%s] and line [%d] in file [%s] \n", __FUNCTION__, __LINE__, __FILE__);
+               result_arrive = 1;
+       }
+};
+
+#if C_API
+int gl_connection_success = TIZEN_MSF_ERROR_NOT_ARRIVE;
+int gl_install_success = TIZEN_MSF_ERROR_NOT_ARRIVE;
+
+void device_info_cb(device_handle handle, int result)
+{
+       printf("device_info_cb\n");
+}
+
+void service_found_cb(service_handle handle)
+{
+       printf("service founded\n");
+       get_device_info(handle, device_info_cb);
+}
+
+void service_lost_cb(service_handle handle)
+{
+       printf("service lost\n");
+}
+
+void search_start_cb()
+{
+       printf("search started\n");
+}
+
+void search_stop_cb()
+{
+       printf("search stopped\n");
+}
+
+void app_connect_cb(client_handle handle)
+{
+}
+
+void app_disconnect_cb(client_handle handle)
+{
+}
+
+void app_client_connect_cb(client_handle handle)
+{
+}
+
+void app_client_disconnect_cb(client_handle handle)
+{
+}
+
+void app_message_cb(char* event, char* message, char* from, char* payld)
+{
+       printf("message cb\n");
+
+       if (event)
+               printf("event = %s\n", event);
+
+       if (message)
+               printf("message = %s\n", message);
+
+       if (from)
+               printf("from = %s\n", from);
+}
+
+void app_error_cb()
+{
+}
+
+void connection_cb(int result, client_handle c_handle, error_handle e_handle)
+{
+       printf("connection cb\n");
+       gl_connection_success = result;
+}
+
+void install_cb(int result, error_handle e_handle)
+{
+       gl_install_success = result;
+}
+
+#endif
+
+//Service service;
+Search search1;
+ResultDevice get_device_result;
+OnConnectListenerinherit connection_listener;
+ResultApplicationInfo result_applicationInfo;
+OnClientConnectListenerinherit client_connect_listener;
+OnClientDisconnectListenerinherit client_disconnect_listener;
+OnErrorListenerinherit error_listener;
+OnDisconnectListenerinherit disconnect_listener;
+ResultClient result_client_disconnect;
+ResultClient result_client_connect;
+ResultBool result_bool_install;
+OnMessageListenerinherit msg_listener1;
+OnMessageListenerinherit msg_listener2;
+ResultApplicationInfo appinfo;
+SearchListenerinherit search_listener1;
+SearchListenerinherit search_listener2;
+
+void Menu()
+{
+       printf("\n===============================\n");
+       printf("Start search            ==> s\n");
+       printf("Display service list    ==> d\n");
+       printf("Exit                    ==> Q\n");
+       printf("===============================\n");
+}
+
+void display_service_list()
+{
+       list<Service> services = search1.getServices();
+
+       search1.stop();
+       cout << "Length of services list is : ";
+       cout << "" << services.size() << "\n";
+
+       printf("service list:\n");
+
+       int n = 1;
+       for (std::list<Service>::iterator service = services.begin(); service != services.end(); service++) {
+               printf("idx : %d, id : %s, name : %s, uri : %s\n", n++, (*service).getId().c_str(), (*service).getName().c_str(), (*service).getUri().c_str());
+       }
+
+
+       char c;
+       cout << "\nEnter number to connect : \n";
+       cin >> c;
+
+       n = c - 48;
+       int n2 = 1;
+
+       for (std::list<Service>::iterator service = services.begin(); service != services.end(); service++) {
+               if (n2 != n) {
+                       n2++;
+                       continue;
+               }
+
+               string appID = "http://www.google.com";
+               //string appID = "org.tizen.netflix-app";
+               //string appID = "http://multiscreen.samsung.com/app-sample-photos/tv/index.html";
+               //string appID="111477001268";
+               //string appID="11147700";
+               //string appID = "youtube";
+               //string channelId = "com.samsung.multiscreen.youtube";
+               string channelId = "com.samsung.multiscreen.weblauncher";
+
+               (*service).getDeviceInfo(&get_device_result);
+               printf("wait deviceinfo arrive..");
+               fflush(stdout);
+
+               while (!result_arrive) {
+                       sleep(1);
+                       printf(".");
+                       fflush(stdout);
+               }
+               result_arrive = 0;
+
+               application = new Application(&(*service), appID, channelId);
+
+               application->setonConnectListener(&connection_listener);
+               client_connect_listener.app = application;
+               application->setonClientConnectListener(&client_connect_listener);
+               application->setonClientDisconnectListener(&client_disconnect_listener);
+               application->setonErrorListener(&error_listener);
+               application->setonDisconnectListener(&disconnect_listener);
+               application->addOnMessageListener("test_say", &msg_listener1);
+               application->addOnAllMessageListener(&msg_listener2);
+
+               application->set_connect_result(&result_client_connect);
+               application->connect();
+               printf("wait connect..\n");
+               fflush(stdout);
+
+               while (!result_arrive) {
+                       sleep(1);
+                       printf(".");
+                       fflush(stdout);
+               }
+               result_arrive = 0;
+               //application->>setConnectionTimeout(5000000);
+
+               //search.stop();
+               //usleep(5000000);
+               //usleep(5000000);
+               //usleep(5000000);
+               //Clients cl;
+               //cl.create("5fc25160-1dd3-11b2-976d-7b60039367e0",557430,false);
+               string ID = "90d105e0-1dd2-11b2-bffa-7536fc73d8d7";
+               string event = "test_say";
+               //Client c1=application->getclient(ID);
+               //const char* messageData = "Hello !";
+               //const char* messageData1="Hello sffffWorld!";
+               //int messageData=12345;
+               //char* target = "host";
+
+               //Application installApplication=(*service).createApplication(appID, channelId);
+               application->setonInstallListener(&result_bool_install);
+               application->install();
+               printf("wait install..\n");
+               fflush(stdout);
+               while (!result_arrive) {
+                       sleep(1);
+                       printf(".");
+                       fflush(stdout);
+               }
+               result_arrive = 0;
+
+               //unsigned char a[6] = {'a','x', 'd', 'q', '3', 't'};
+
+
+               //printf("publish message\n");
+               //application->publish(event,messageData, a, 6);//,c1);
+               //printf("wait message..\n");
+               //fflush(stdout);
+               //while (!result_arrive) {
+               //      sleep(1);
+               //      printf(".");
+               //fflush(stdout);
+               //}
+               //result_arrive = 0;
+               //application.publish(event,static_cast<void*>(messageData1));//,c1);
+
+               //sleep(5);
+               //printf("\n try disconnect\n");
+
+               //search.stop();
+
+
+#if 0
+               application->getinfo(&appinfo);
+               printf("wait appinfo..\n");
+               fflush(stdout);
+               while (!result_arrive) {
+                       sleep(1);
+                       printf(".");
+                       fflush(stdout);
+               }
+               result_arrive = 0;
+#endif
+
+
+#if 0
+               {
+                       bool isC = false;
+                       isC = application->isConnected();
+                       printf("connected = %s\n", isC ? "true" : "false");
+                       fflush(stdout);
+               }
+
+               {
+                       bool isW = false;
+                       isW = application->isWebapp();
+                       printf("webapp = %s\n", isW ? "true" : "false");
+                       fflush(stdout);
+               }
+
+#endif
+               // Clients Client test
+               {
+                       Clients* cs = application->getclients();
+
+                       if (cs == NULL) {
+                               printf("No clients\n");
+                       } else {
+                               std::list<Client> cl = cs->lists();
+                               int cs_index = 0;
+                               Client cli;
+                               printf("clients size = %d\n", cs->size());
+
+                               for (auto cs_itr = cl.begin(); cs_itr != cl.end(); cs_itr++) {
+                                       printf("client %d\n", cs_index++);
+                                       printf("client id :  %s\n", (*cs_itr).getId());
+                                       printf("client clients.get().getId() : %s\n", cs->get((*cs_itr).getId()).getId());
+                                       printf("client isHost :  %s\n", (*cs_itr).isHost() ? "true" : "false");
+                                       printf("client connectTIme :  %lld\n", (*cs_itr).getConnectTime());
+                                       Client* host = cs->getHost();
+                                       printf("host = %s\n", host ? host->getId() : "no host");
+                                       Channel* cha = NULL;
+                                       cha = (*cs_itr).getChannel();
+                                       if (cha != NULL)
+                                               printf("client channel uri = %s\n", cha->getChannelUri(NULL).c_str());
+                                       //printf("clients channel uri = %s\n", cs->getChannel()->getChannelUri(NULL).c_str());
+                                       printf("channel uri : %s\n", application->getChannelUri(NULL).c_str());
+                               }
+
+
+                               application->publish(event, "Hello Im newbe", cl);//,c1);
+                       }
+               }
+
+               {
+                       cout << "\nEnter a to disconnect : \n";
+                       cin >> c;
+
+                       application->set_disconnect_result(&result_client_disconnect);
+                       application->disconnect(true);
+                       printf("wait disconnect..\n");
+                       fflush(stdout);
+                       while (!result_arrive) {
+                               sleep(1);
+                               printf(".");
+                               fflush(stdout);
+                       }
+                       result_arrive = 0;
+               }
+
+               exit(0);
+       }
+}
+
+int test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
+{
+       get_device_result.subject = "getDeviceInfo";
+       connection_listener.subject = "connect_listen";
+       result_applicationInfo.subject = "appinfo";
+       client_connect_listener.subject = "client_connect_listen";
+       client_disconnect_listener.subject = "client_disconnect_listen";
+       error_listener.subject = "error_listen";
+       disconnect_listener.subject = "disconnect_listen";
+       result_client_connect.subject = "connect_result";
+       result_client_disconnect.subject = "disconnect_result";
+       result_bool_install.subject = "install_result";
+       msg_listener1.subject = "msg_listener 1";
+       msg_listener2.subject = "msg_listener 2";
+       appinfo.subject = "app info";
+       search_listener1.subject = "search_listener1";
+       search_listener2.subject = "search_listener2";
+
+
+       search1.setSearchListener(&search_listener1);
+
+       int rv;
+       char a[10];
+       GMainLoop *mainloop = reinterpret_cast<GMainLoop*>(data);
+
+       printf("Event received from stdin\n");
+
+       rv = read(0, a, 10);
+       if (rv <= 0) {
+               printf("read result error : %d\n", rv);
+               rv = 1;
+       }
+
+       if (a[0] == '\n' || a[0] == '\r') {
+               printf("Press ENTER to show options menu.......\n");
+               Menu();
+       }
+
+       switch (a[0]) {
+       case 's':
+               search1.start();
+               break;
+       case 'd':
+               display_service_list();
+               break;
+       case 'Q':
+               g_main_loop_quit(mainloop);
+               break;
+       default :
+               return true;
+       }
+
+       if (rv >= 1)
+               printf("\nOperation Succeeded!\n");
+       else
+               printf("\nOperation Failed!\n");
+
+       return TRUE;
+}
+
+
+int main(int argc, char** argv) {
+       GMainLoop *mainloop;
+       mainloop = g_main_loop_new(NULL, FALSE);
+
+       GIOChannel *channel = g_io_channel_unix_new(0);
+       g_io_add_watch(channel, static_cast<GIOCondition>(G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL),
+                       test_thread, mainloop);
+
+       printf("Test Thread created...\n");
+
+       g_main_loop_run(mainloop);
+
+       printf("Test Application Terminated\n");
+       g_main_loop_unref(mainloop);
+
+       return 0;
+}
diff --git a/packaging/org.tizen.multiscreen.service b/packaging/org.tizen.multiscreen.service
new file mode 100755 (executable)
index 0000000..56d0811
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=Node server start
+After=remote-server.service
+
+[Service]
+User=system
+Group=system
+Type=simple
+ExecStart = /usr/bin/node /usr/apps/org.tizen.multiscreen/server/server.js
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/remote-server.service b/packaging/remote-server.service
new file mode 100755 (executable)
index 0000000..728a4f3
--- /dev/null
@@ -0,0 +1,14 @@
+[Unit]
+Description=Remote Server service
+After=dlog-main.service dbus.service
+
+[Service]
+User=system
+Group=system
+Type=simple
+ExecStart=/usr/bin/remote-server
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/packaging/remote-server.spec b/packaging/remote-server.spec
new file mode 100755 (executable)
index 0000000..a3fe6d8
--- /dev/null
@@ -0,0 +1,154 @@
+Name: remote-server
+#year.month // 2016 => 3
+Version: 3.1
+#day
+Release: 18
+Summary: Remote server NService Framework
+
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.service
+Source2: org.tizen.multiscreen.service
+
+BuildRequires: cmake
+BuildRequires: boost-system
+BuildRequires: boost-thread
+BuildRequires: boost-devel
+BuildRequires: openssl
+BuildRequires: openssl-devel
+BuildRequires: expat-devel
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(libcurl)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(syspopup)
+BuildRequires: pkgconfig(syspopup-caller)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-network-wifi)
+BuildRequires: pkgconfig(capi-network-connection)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-system-settings)
+BuildRequires: pkgconfig(capi-appfw-app-manager)
+BuildRequires: pkgconfig(libsystemd)
+BuildRequires: pkgconfig(jsoncpp)
+BuildRequires: pkgconfig(deviced)
+BuildRequires: pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(bluetooth-api)
+BuildRequires: pkgconfig(argos_watchdog)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(json-glib-1.0)
+BuildRequires: pkgconfig(libwebsockets)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: curl
+BuildRequires: libcurl-devel
+BuildRequires: capi-network-nsd
+BuildRequires: capi-network-nsd-devel
+Requires: dbus
+#Requires(post): sys-assert
+Requires: syspopup
+
+%package devel
+Summary:       remote-server header files and .pc file
+Group:                 Development/Libraries
+Requires:   %{name} = %{version}
+
+%description devel
+THis package contains the head files and .pc file for remote-server
+%description
+Remote server NService Framework to handle the communication between TV App and Mobile App
+
+%define _systemddir /usr/lib/systemd/system
+%define _descriptiondir /opt/usr/apps/remote-server
+%define _chip_platform `cat %{BUILD_FLAG_PATH}/model-config-chip`
+%define _product_type `cat %{BUILD_FLAG_PATH}/model-config-product-type`
+%define _node_dir /usr/apps/
+
+%prep
+%setup -q
+%build
+
+export CFLAGS+=" -fPIC -fvisibility=hidden"
+export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+
+
+cmake . -DCMAKE_INSTALL_PREFIX=/usr/  \
+    -DCHIP_NAME=%{_chip_platform}  \
+    -DPRODUCT_TYPE=%{_product_type}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2  %{buildroot}/usr/share/license/%{name}
+
+%make_install
+mkdir -p %{buildroot}%{_libdir}/systemd/system
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+ln -sf ../%{name}.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/%{name}.service
+ln -sf ../org.tizen.multiscreen.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/org.tizen.multiscreen.service
+rm -Rf %{buildroot}%{_descriptiondir}
+mkdir -p %{buildroot}%{_descriptiondir}
+mkdir -p %{buildroot}/usr/apps/org.tizen.multiscreen
+
+%post
+systemctl enable remote-server.service
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%manifest remote-server.manifest
+%defattr(-,system,system,-)
+%{_bindir}/*
+%{_libdir}/systemd/system/%{name}.service
+%{_libdir}/systemd/system/org.tizen.multiscreen.service
+%{_libdir}/systemd/system/multi-user.target.wants/%{name}.service
+%{_libdir}/systemd/system/multi-user.target.wants/org.tizen.multiscreen.service
+%{_node_dir}/*
+/usr/share/license/%{name}
+
+%files devel
+
+%package -n msf-api
+Summary:    Msf-api Shared Library (Development)
+Group:      System/Libraries
+
+%description -n msf-api
+msf-api Shared Library (DEV)
+
+%post -n msf-api
+/sbin/ldconfig
+
+%postun -n msf-api
+/sbin/ldconfig
+
+%files -n msf-api
+%manifest remote-server.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libmsf-api.so*
+/usr/bin/msf-api-test*
+
+%package -n msf-api-devel
+Summary:    Msf-api Shared Library (Development)
+Group:      System/Libraries
+
+%description -n msf-api-devel
+msf-api Shared Library (DEV)
+
+%post -n msf-api-devel
+/sbin/ldconfig
+
+%postun -n msf-api-devel
+/sbin/ldconfig
+
+%files -n msf-api-devel
+%defattr(-,root,root,-)
+%{_includedir}/msf-api/*.h
+%{_libdir}/libmsf-api.so*
+%{_libdir}/pkgconfig/msf-api.pc
diff --git a/remote-server.manifest b/remote-server.manifest
new file mode 100755 (executable)
index 0000000..75b0fa5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
diff --git a/remote-server.xml b/remote-server.xml
new file mode 100755 (executable)
index 0000000..ed32454
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_NAME@" version="@VERSION@" install-location="internal-only">
+        <label>Remote-Server</label>
+        <author email="ankit.sh1@samsung.com" href="www.samsung.com">Ankit Sharma</author>
+       <author email="shivaram.y@samsung.com" href="www.samsung.com">Shivaram Yadav</author>
+        <description>Remote Server Daemon</description>
+        <service-application appid="@PACKAGE_NAME@" exec="@BINDIR@/@PROJECT_NAME@" on-boot="true" type="c++app" auto-restart="false">
+        <label>service-application</label>
+        </service-application>
+</manifest>
+
+
+
+